-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Minor: Add Column::from(Tableref, &FieldRef)
, Expr::from(Column)
and Expr::from(Tableref, &FieldRef)
#10178
Conversation
@@ -346,6 +348,13 @@ impl From<(Option<&TableReference>, &Field)> for Column { | |||
} | |||
} | |||
|
|||
/// Create a column, use qualifier and field name | |||
impl From<(Option<&TableReference>, &FieldRef)> for Column { |
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 is the new API -- the rest of this PR updates the code to use it when possible
benchmarks/src/tpch/convert.rs
Outdated
.map(|(qualifier, field)| { | ||
Expr::Column(Column::from((qualifier, field.as_ref()))) | ||
}) | ||
.map(Column::from) |
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.
can we still use a single map?
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.
Good call -- I added some more Expr::from
impls in c4bc7e3 and now this looks pretty nice
Column::from(Tableref, &FieldRef)
Column::from(Tableref, &FieldRef)
, Expr::from(Column)
and Expr::from(Tableref, &FieldRef)
.map(|(qualifier, field)| { | ||
Expr::Column(Column::from((qualifier, field.as_ref()))) | ||
}) | ||
.map(Expr::from) |
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 is now pretty nice I think given @comphead 's suggestion ❤️
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.
lgtm thanks @alamb
CIL testdoc keeps failing
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.
Thanks @alamb
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.
LGTM, thank you @alamb
Thanks everyone for the reviews ❤️ |
…and `Expr::from(Tableref, &FieldRef)` (apache#10178) * Minor: Add `Column::from(Tableref, &FieldRef)` * Add Expr::from() * fix docs * Fix doc test
Which issue does this PR close?
Follow on to #9595 from @haohuaijin
Rationale for this change
@appletreeisyellow and I noticed this while upgrading IOx -- there are times when the code would like to create
Expr::Column
that reference each of the columns in a schemaTo do so it would be nice to be able to create a
Column
directly from a&FieldRef
rather than having to to first call.as_ref()
on the `FieldRefWhat changes are included in this PR?
Changes:
Column::from(Tableref, &FieldRef)
Expr::from(Column)
Expr::from(Tableref, &FieldRef)
Are these changes tested?
By existing tests
Are there any user-facing changes?