-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Unify Metadata Handing: use FieldMetadata
in Expr::Alias
and ExprSchemable
#16320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -3657,7 +3834,7 @@ mod test { | |||
// If this test fails when you change `Expr`, please try | |||
// `Box`ing the fields to make `Expr` smaller | |||
// See https://github.com/apache/datafusion/issues/16199 for details | |||
assert_eq!(size_of::<Expr>(), 144); | |||
assert_eq!(size_of::<Expr>(), 128); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And Expr
gets smaller!
🤖 |
🤖: Benchmark completed Details
|
ec3c2dd
to
3a7c9c8
Compare
@@ -601,7 +625,7 @@ pub struct Alias { | |||
pub expr: Box<Expr>, | |||
pub relation: Option<TableReference>, | |||
pub name: String, | |||
pub metadata: Option<std::collections::HashMap<String, String>>, | |||
pub metadata: Option<FieldMetadata>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is the point of the PR is to use the FieldMetadata
struct introduced in this PR everywhere:
The rest of the changes in this PR are consequences of this change
🤖 |
🤖: Benchmark completed Details
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! The metadata we're passing around can be up to a few kilobytes and this (and the previous PR) are great quality of life improvements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice addition. Thank you.
Thanks @timsaucer and @paleolimbot |
Which issue does this PR close?
FieldMetadata
structure #16317Rationale for this change
We are working metadata through DataFusion as part of supporting extension types
so having a single unified representation to work on will make the code easier
to do. I added
FieldMetadata
to avoid the use ofBTreeMap
direcectly, but foundthere were still places that used
HashMap
to pass metadata around directlyWhat changes are included in this PR?
Let's use FieldMetadata everywhere
Are these changes tested?
By CI
Are there any user-facing changes?
This is an API change, but I think it sets us up for unified and efficient metadata handling in DataFusion