Skip to content

fix: reject malformed Arrow field IDs - #845

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/reject-malformed-arrow-field-ids
Open

fix: reject malformed Arrow field IDs#845
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/reject-malformed-arrow-field-ids

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • reject malformed PARQUET:field_id metadata instead of accepting a valid numeric prefix or returning the unknown-field sentinel
  • preserve the unknown-field sentinel when field-ID metadata is absent
  • add coverage for trailing characters, overflow, and an empty value

Testing

  • arrow_test --gtest_filter=FromArrowSchemaTest.RejectMalformedFieldIdMetadata
  • full CTest suite (17 test binaries)

int32_t GetFieldId(const ArrowSchema& schema) {
Result<int32_t> GetFieldId(const ArrowSchema& schema) {
if (schema.metadata == nullptr) {
return kUnknownFieldId;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed? It is not clear to me what is the difference between unknowFieldId (returning the constant) and InvalidFieldId (returning in a error)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are intentionally different. If the PARQUET:field_id metadata is missing, we keep the existing behavior and use the unknown field ID sentinel. If the key is present but the value is malformed or outside int32_t, we return an invalid schema error instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants