You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2024/04/22 17:07:47 UTC
[PR] Minor: Add `Column::from(Tableref, &FieldRef)` [datafusion]
alamb opened a new pull request, #10178:
URL: https://github.com/apache/datafusion/pull/10178
## Which issue does this PR close?
Follow on to https://github.com/apache/datafusion/pull/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 schema
To 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 `FieldRef
## What changes are included in this PR?
Changes:
1. Add `Column::from(Tableref, &FieldRef)`
2. Change some code to use the new API
## Are these changes tested?
By existing tests
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org
Re: [PR] Minor: Add `Column::from(Tableref, &FieldRef)`, `Expr::from(Column)` and `Expr::from(Tableref, &FieldRef)` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10178:
URL: https://github.com/apache/datafusion/pull/10178#discussion_r1575252042
##########
benchmarks/src/tpch/convert.rs:
##########
@@ -88,9 +88,7 @@ impl ConvertOpt {
.schema()
.iter()
.take(schema.fields.len() - 1)
- .map(|(qualifier, field)| {
- Expr::Column(Column::from((qualifier, field.as_ref())))
- })
+ .map(Expr::from)
Review Comment:
This is now pretty nice I think given @comphead 's suggestion ❤️
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org
Re: [PR] Minor: Add `Column::from(Tableref, &FieldRef)`, `Expr::from(Column)` and `Expr::from(Tableref, &FieldRef)` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #10178:
URL: https://github.com/apache/datafusion/pull/10178
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Minor: Add `Column::from(Tableref, &FieldRef)`, `Expr::from(Column)` and `Expr::from(Tableref, &FieldRef)` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10178:
URL: https://github.com/apache/datafusion/pull/10178#issuecomment-2072298700
Thanks everyone for the reviews ❤️
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Minor: Add `Column::from(Tableref, &FieldRef)`, `Expr::from(Column)` and `Expr::from(Tableref, &FieldRef)` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10178:
URL: https://github.com/apache/datafusion/pull/10178#issuecomment-2070804781
> lgtm thanks @alamb CIL testdoc keeps failing
Thanks -- fixed in 4db07ee31
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org
Re: [PR] Minor: Add `Column::from(Tableref, &FieldRef)` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10178:
URL: https://github.com/apache/datafusion/pull/10178#discussion_r1575099919
##########
datafusion/common/src/column.rs:
##########
@@ -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 {
Review Comment:
This is the new API -- the rest of this PR updates the code to use it when possible
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org
Re: [PR] Minor: Add `Column::from(Tableref, &FieldRef)` [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10178:
URL: https://github.com/apache/datafusion/pull/10178#discussion_r1575249802
##########
benchmarks/src/tpch/convert.rs:
##########
@@ -88,9 +88,8 @@ impl ConvertOpt {
.schema()
.iter()
.take(schema.fields.len() - 1)
- .map(|(qualifier, field)| {
- Expr::Column(Column::from((qualifier, field.as_ref())))
- })
+ .map(Column::from)
Review Comment:
Good call -- I added some more `Expr::from` impls in c4bc7e36d and now this looks pretty nice
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org
Re: [PR] Minor: Add `Column::from(Tableref, &FieldRef)` [datafusion]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #10178:
URL: https://github.com/apache/datafusion/pull/10178#discussion_r1575124647
##########
benchmarks/src/tpch/convert.rs:
##########
@@ -88,9 +88,8 @@ impl ConvertOpt {
.schema()
.iter()
.take(schema.fields.len() - 1)
- .map(|(qualifier, field)| {
- Expr::Column(Column::from((qualifier, field.as_ref())))
- })
+ .map(Column::from)
Review Comment:
can we still use a single map?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org