You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/19 12:50:38 UTC
[GitHub] [arrow-datafusion] andygrove opened a new pull request, #3208: Add SQL query planner support for DISTRIBUTE BY
andygrove opened a new pull request, #3208:
URL: https://github.com/apache/arrow-datafusion/pull/3208
# Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes https://github.com/apache/arrow-datafusion/issues/3207
# Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
Support Dask SQL queries that use this syntax
# What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
# Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
No
<!--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #3208: Add SQL query planner support for DISTRIBUTE BY
Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #3208:
URL: https://github.com/apache/arrow-datafusion/pull/3208#discussion_r950708674
##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1390,8 +1399,9 @@ pub enum Partitioning {
RoundRobinBatch(usize),
/// Allocate rows based on a hash of one of more expressions and the specified number
/// of partitions.
- /// This partitioning scheme is not yet fully supported. See <https://issues.apache.org/jira/browse/ARROW-11011>
Hash(Vec<Expr>, usize),
+ /// The DISTRIBUTE BY clause is used to repartition the data based on the input expressions
+ DistributeBy(Vec<Expr>),
Review Comment:
Given the description in the spark docs https://spark.apache.org/docs/latest/sql-ref-syntax-qry-select-distribute-by.html I think either hashing or not would produce the same behavior with respect to partitioning.
However, using just the expressions as you have in this PR is probably more performant -- hashing the values would be wasted work.
##########
datafusion/core/src/physical_plan/planner.rs:
##########
@@ -729,6 +729,9 @@ impl DefaultPhysicalPlanner {
.collect::<Result<Vec<_>>>()?;
Partitioning::Hash(runtime_expr, *n)
}
+ LogicalPartitioning::DistributeBy(_) => {
+ return Err(DataFusionError::NotImplemented("Physical plan does not support DistributeBy partitioning".to_string()))
Review Comment:
Thanks for breaking up these projects into smaller, easier to review chunks 👍
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] andygrove commented on pull request #3208: Add SQL query planner support for DISTRIBUTE BY
Posted by GitBox <gi...@apache.org>.
andygrove commented on PR #3208:
URL: https://github.com/apache/arrow-datafusion/pull/3208#issuecomment-1220640710
@jdye64 Do you think this is sufficient?
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] andygrove commented on a diff in pull request #3208: Add SQL query planner support for DISTRIBUTE BY
Posted by GitBox <gi...@apache.org>.
andygrove commented on code in PR #3208:
URL: https://github.com/apache/arrow-datafusion/pull/3208#discussion_r950178552
##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1390,8 +1399,9 @@ pub enum Partitioning {
RoundRobinBatch(usize),
/// Allocate rows based on a hash of one of more expressions and the specified number
/// of partitions.
- /// This partitioning scheme is not yet fully supported. See <https://issues.apache.org/jira/browse/ARROW-11011>
Review Comment:
This issue (https://github.com/apache/arrow-datafusion/issues/131) has been closed so I removed the comment
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] alamb merged pull request #3208: Add SQL query planner support for `DISTRIBUTE BY`
Posted by GitBox <gi...@apache.org>.
alamb merged PR #3208:
URL: https://github.com/apache/arrow-datafusion/pull/3208
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] andygrove commented on a diff in pull request #3208: Add SQL query planner support for DISTRIBUTE BY
Posted by GitBox <gi...@apache.org>.
andygrove commented on code in PR #3208:
URL: https://github.com/apache/arrow-datafusion/pull/3208#discussion_r950157361
##########
datafusion/sql/src/planner.rs:
##########
@@ -973,6 +973,20 @@ impl<'a, S: ContextProvider> SqlToRel<'a, S> {
alias: Option<String>,
outer_query_schema: Option<&DFSchema>,
) -> Result<LogicalPlan> {
+ // check for unsupported syntax first
+ if !select.cluster_by.is_empty() {
+ return Err(DataFusionError::NotImplemented("CLUSTER BY".to_string()));
+ }
+ if !select.lateral_views.is_empty() {
+ return Err(DataFusionError::NotImplemented("LATERAL VIEWS".to_string()));
+ }
+ if select.qualify.is_some() {
+ return Err(DataFusionError::NotImplemented("QUALIFY".to_string()));
+ }
+ if select.top.is_some() {
+ return Err(DataFusionError::NotImplemented("TOP".to_string()));
+ }
Review Comment:
We were previously just ignoring these fields so I think it is better to error if they are set and we don't support them
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] andygrove commented on a diff in pull request #3208: Add SQL query planner support for DISTRIBUTE BY
Posted by GitBox <gi...@apache.org>.
andygrove commented on code in PR #3208:
URL: https://github.com/apache/arrow-datafusion/pull/3208#discussion_r950409603
##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1390,8 +1399,9 @@ pub enum Partitioning {
RoundRobinBatch(usize),
/// Allocate rows based on a hash of one of more expressions and the specified number
/// of partitions.
- /// This partitioning scheme is not yet fully supported. See <https://issues.apache.org/jira/browse/ARROW-11011>
Hash(Vec<Expr>, usize),
+ /// The DISTRIBUTE BY clause is used to repartition the data based on the input expressions
+ DistributeBy(Vec<Expr>),
Review Comment:
Another option here would be to re-use `Hash` and make the number of partitions an `Option<usize>`.
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [arrow-datafusion] ursabot commented on pull request #3208: Add SQL query planner support for `DISTRIBUTE BY`
Posted by GitBox <gi...@apache.org>.
ursabot commented on PR #3208:
URL: https://github.com/apache/arrow-datafusion/pull/3208#issuecomment-1221336823
Benchmark runs are scheduled for baseline = fec33b1616f7a7ce40f5d3f73c5acb50c4e51b63 and contender = c8d61d8e3ce48120cc7074cfa2143cd79d33f22f. c8d61d8e3ce48120cc7074cfa2143cd79d33f22f is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] [ec2-t3-xlarge-us-east-2](https://conbench.ursa.dev/compare/runs/b173b081bf3241fda094108dad160354...a0fc094878c04464a16b63b73093dd16/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] [test-mac-arm](https://conbench.ursa.dev/compare/runs/6a4ce139f116442ab080f8ae997f77c7...7c0aa82ce9f64f90bd27eadd71ee8c77/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] [ursa-i9-9960x](https://conbench.ursa.dev/compare/runs/cb5bee9a93b9457783b49ea4fc0152af...f3744d728c5f41eaa9d410a2b8eef8d7/)
[Skipped :warning: Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] [ursa-thinkcentre-m75q](https://conbench.ursa.dev/compare/runs/5c8d0181919b49f7abc00a6f5fefde1a...7dc6f80efa5148a5bad7417bbe79f075/)
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org