You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Jefffrey (via GitHub)" <gi...@apache.org> on 2023/02/11 09:39:53 UTC

[GitHub] [arrow-datafusion] Jefffrey opened a new issue, #5248: SQL ORDER BY doesn't do ambiguity check

Jefffrey opened a new issue, #5248:
URL: https://github.com/apache/arrow-datafusion/issues/5248

   **Describe the bug**
   A clear and concise description of what the bug is.
   
   In SQL when ORDER BY an ambiguous column, it doesn't return an error.
   
   **To Reproduce**
   Steps to reproduce the behavior:
   
   ```sql
   ❯ select * from test1 t1 join test2 t2 using (a) order by b;
   +---+---+---+---+---+
   | a | b | c | b | c |
   +---+---+---+---+---+
   | 1 | 2 | 3 | 2 | 3 |
   | 4 | 5 | 6 | 5 | 6 |
   +---+---+---+---+---+
   2 rows in set. Query took 0.016 seconds.
   ❯ explain select * from test1 t1 join test2 t2 using (a) order by b;
   +---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | plan_type     | plan                                                                                                                                                          |
   +---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
   | logical_plan  | Projection: t1.a, t1.b, t1.c, t2.b, t2.c                                                                                                                      |
   |               |   Sort: t1.b ASC NULLS LAST                                                                                                                                   |
   |               |     Projection: t1.a, t1.b, t1.c, t2.b, t2.c                                                                                                                  |
   |               |       Inner Join: Using t1.a = t2.a                                                                                                                           |
   |               |         SubqueryAlias: t1                                                                                                                                     |
   |               |           TableScan: test1 projection=[a, b, c]                                                                                                               |
   |               |         SubqueryAlias: t2                                                                                                                                     |
   |               |           TableScan: test2 projection=[a, b, c]                                                                                                               |
   | physical_plan | ProjectionExec: expr=[a@0 as a, b@1 as b, c@2 as c, b@3 as b, c@4 as c]                                                                                       |
   |               |   SortPreservingMergeExec: [b@1 ASC NULLS LAST]                                                                                                               |
   |               |     SortExec: [b@1 ASC NULLS LAST]                                                                                                                            |
   |               |       ProjectionExec: expr=[a@0 as a, b@1 as b, c@2 as c, b@4 as b, c@5 as c]                                                                                 |
   |               |         CoalesceBatchesExec: target_batch_size=8192                                                                                                           |
   |               |           HashJoinExec: mode=Partitioned, join_type=Inner, on=[(Column { name: "a", index: 0 }, Column { name: "a", index: 0 })]                              |
   |               |             CoalesceBatchesExec: target_batch_size=8192                                                                                                       |
   |               |               RepartitionExec: partitioning=Hash([Column { name: "a", index: 0 }], 12), input_partitions=12                                                   |
   |               |                 RepartitionExec: partitioning=RoundRobinBatch(12), input_partitions=1                                                                         |
   |               |                   CsvExec: files={1 group: [[home/jeffrey/Code/arrow-datafusion/datafusion-cli/test.csv]]}, has_header=true, limit=None, projection=[a, b, c] |
   |               |             CoalesceBatchesExec: target_batch_size=8192                                                                                                       |
   |               |               RepartitionExec: partitioning=Hash([Column { name: "a", index: 0 }], 12), input_partitions=12                                                   |
   |               |                 RepartitionExec: partitioning=RoundRobinBatch(12), input_partitions=1                                                                         |
   |               |                   CsvExec: files={1 group: [[home/jeffrey/Code/arrow-datafusion/datafusion-cli/test.csv]]}, has_header=true, limit=None, projection=[a, b, c] |
   |               |                                                                                                                                                               |
   +---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
   2 rows in set. Query took 0.011 seconds.
   ```
   
   **Expected behavior**
   A clear and concise description of what you expected to happen.
   
   Should return error
   
   **Additional context**
   Add any other context about the problem here.
   


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] Jefffrey commented on issue #5248: SQL ORDER BY doesn't do ambiguity check

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on issue #5248:
URL: https://github.com/apache/arrow-datafusion/issues/5248#issuecomment-1455053191

   I plan to resolve this as part of https://github.com/apache/arrow-datafusion/issues/5211


-- 
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 closed issue #5248: SQL ORDER BY doesn't do ambiguity check

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #5248: SQL ORDER BY doesn't do ambiguity check
URL: https://github.com/apache/arrow-datafusion/issues/5248


-- 
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