Repository navigation
Conversation
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.
Rationale for this change
Fixes #37219.
ProjectionDescr::FromExpressionscopies field nullability and metadata only for a barefield_ref. A projection such asdataset.field("id").cast(int64())therefore produced a nested field with the defaultnullable=trueand dropped the source field's metadata, even though a safe cast preserves the source values and cannot introduce nulls when the source is required.What changes are included in this PR?
castcalls back to its field reference.int32 -> int64(including metadata) and optionalint16 -> float64.Are these changes tested?
Yes, against an editable Arrow C++ 27.0.0-SNAPSHOT build in WSL.
nullable=1 metadata_preserved=0.nullable=0 metadata_preserved=1.arrow-dataset-scanner-testtest translation unit compiles successfully with C++20.clang-format==18.1.8 --dry-run --Werrorandgit diff --checkpassed.The full local test executable was not linked because this minimal build lacked the optional Boost test dependency; the focused upstream regression is included for CI.
Are there any user-facing changes?
Yes. Dataset projections that cast a field now retain that field's declared nullability and metadata. The output data type, values, and cast behavior are unchanged.
Was AI used for this PR?
In accordance with the AI generation guidelines, AI was used for implementation, tests, and description. The behavior was reproduced against the unmodified base and validated against a local Arrow build before submission.
PR code and description written by:
Reviewed before submission by: