Fix segfault issue from empty metadata - #81
Merged
Conversation
Use empty map in bug fix
alinaliBQ
marked this pull request as ready for review
August 5, 2025 21:24
jduo
reviewed
Aug 5, 2025
| const auto& metadata_map = field->metadata(); | ||
| std::shared_ptr<const arrow::KeyValueMetadata> empty_metadata_map( | ||
| new arrow::KeyValueMetadata); | ||
| ColumnMetadata metadata(metadata_map ? metadata_map : empty_metadata_map); |
There was a problem hiding this comment.
Let's change the ColumnMetadata object itself to handle NULL safely and internally create an empty owned map (since it's easy for this to occur elsewhere)
Author
There was a problem hiding this comment.
yea that makes sense, I have updated the code to change ColumnMetadata.
There is an API Field::HasMetadata in arrow that checks if metadata is null, but seems it's not as commonly used.
Lines 304 to 306 in a6bc579
jduo
approved these changes
Aug 5, 2025
rscales
approved these changes
Aug 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Transform_innerwas having a seg fault error becausemetadata()return result was not being checked for null value. I see inflight_sql/flight_sql_result_set_metadata.ccthere is already a check for nullmetadata(), so I re-used this check inTransform_inner.arrow/cpp/src/arrow/flight/sql/odbc/flight_sql/flight_sql_result_set_metadata.cc
Lines 45 to 53 in a6bc579
metadata.GetTypeName()fromflightsql-odbc