You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "jiangzhx (via GitHub)" <gi...@apache.org> on 2023/06/15 05:12:12 UTC

[GitHub] [arrow-datafusion] jiangzhx opened a new issue, #6673: push_down_projection removed necessary Projection `projection Int64(1) AS t1.e`

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

   ### Describe the bug
   
   after i added a new optimizer EliminateSubqueryAliases #6666.
   got error when query :`select * from (select 1 as e) t1,   (select 1 as e) t2;`
   `Schema error: No field named t1.e.`
   
   I discovered that `push_down_projection` optimization deleted the `projection Int64(1) AS t1.e`, which caused the error.
   
   ```
   ❯ explain verbose select * from (select 1 as e) t1,   (select 1 as e) t2;
   +------------------------------------------------------------+------------------------------------+
   | plan_type                                                  | plan                               |
   +------------------------------------------------------------+------------------------------------+
   | initial_logical_plan                                       | Projection: t1.e, t2.e             |
   |                                                            |   CrossJoin:                       |
   |                                                            |     SubqueryAlias: t1              |
   |                                                            |       Projection: Int64(1) AS e    |
   |                                                            |         EmptyRelation              |
   |                                                            |     SubqueryAlias: t2              |
   |                                                            |       Projection: Int64(1) AS e    |
   |                                                            |         EmptyRelation              |
   | logical_plan after inline_table_scan                       | SAME TEXT AS ABOVE                 |
   | logical_plan after type_coercion                           | SAME TEXT AS ABOVE                 |
   | logical_plan after count_wildcard_rule                     | SAME TEXT AS ABOVE                 |
   | analyzed_logical_plan                                      | SAME TEXT AS ABOVE                 |
   | logical_plan after simplify_expressions                    | SAME TEXT AS ABOVE                 |
   | logical_plan after unwrap_cast_in_comparison               | SAME TEXT AS ABOVE                 |
   | logical_plan after replace_distinct_aggregate              | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_join                          | SAME TEXT AS ABOVE                 |
   | logical_plan after decorrelate_predicate_subquery          | SAME TEXT AS ABOVE                 |
   | logical_plan after scalar_subquery_to_join                 | SAME TEXT AS ABOVE                 |
   | logical_plan after extract_equijoin_predicate              | SAME TEXT AS ABOVE                 |
   | logical_plan after simplify_expressions                    | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_subquery_aliases              | Projection: t1.e, t2.e             |
   |                                                            |   CrossJoin:                       |
   |                                                            |     Projection: e AS t1.e          |
   |                                                            |       Projection: Int64(1) AS e    |
   |                                                            |         EmptyRelation              |
   |                                                            |     Projection: e AS t2.e          |
   |                                                            |       Projection: Int64(1) AS e    |
   |                                                            |         EmptyRelation              |
   | logical_plan after merge_projection                        | Projection: t1.e, t2.e             |
   |                                                            |   CrossJoin:                       |
   |                                                            |     Projection: Int64(1) AS t1.e   |
   |                                                            |       EmptyRelation                |
   |                                                            |     Projection: Int64(1) AS t2.e   |
   |                                                            |       EmptyRelation                |
   | logical_plan after rewrite_disjunctive_predicate           | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_duplicated_expr               | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_filter                        | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_cross_join                    | SAME TEXT AS ABOVE                 |
   | logical_plan after common_sub_expression_eliminate         | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_limit                         | SAME TEXT AS ABOVE                 |
   | logical_plan after propagate_empty_relation                | SAME TEXT AS ABOVE                 |
   | logical_plan after filter_null_join_keys                   | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_outer_join                    | SAME TEXT AS ABOVE                 |
   | logical_plan after push_down_limit                         | SAME TEXT AS ABOVE                 |
   | logical_plan after push_down_filter                        | SAME TEXT AS ABOVE                 |
   | logical_plan after single_distinct_aggregation_to_group_by | SAME TEXT AS ABOVE                 |
   | logical_plan after simplify_expressions                    | SAME TEXT AS ABOVE                 |
   | logical_plan after unwrap_cast_in_comparison               | SAME TEXT AS ABOVE                 |
   | logical_plan after common_sub_expression_eliminate         | SAME TEXT AS ABOVE                 |
   | logical_plan after push_down_projection                    | Projection: t1.e, t2.e             |
   |                                                            |   CrossJoin:                       |
   |                                                            |     Projection:                    |
   |                                                            |       EmptyRelation                |
   |                                                            |     Projection:                    |
   |                                                            |       EmptyRelation                |
   | logical_plan after eliminate_projection                    | Projection: t1.e, t2.e             |
   |                                                            |   CrossJoin:                       |
   |                                                            |     EmptyRelation                  |
   |                                                            |     EmptyRelation                  |
   | logical_plan after push_down_limit                         | SAME TEXT AS ABOVE                 |
   | logical_plan after simplify_expressions                    | SAME TEXT AS ABOVE                 |
   | logical_plan after unwrap_cast_in_comparison               | SAME TEXT AS ABOVE                 |
   | logical_plan after replace_distinct_aggregate              | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_join                          | SAME TEXT AS ABOVE                 |
   | logical_plan after decorrelate_predicate_subquery          | SAME TEXT AS ABOVE                 |
   | logical_plan after scalar_subquery_to_join                 | SAME TEXT AS ABOVE                 |
   | logical_plan after extract_equijoin_predicate              | SAME TEXT AS ABOVE                 |
   | logical_plan after simplify_expressions                    | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_subquery_aliases              | SAME TEXT AS ABOVE                 |
   | logical_plan after merge_projection                        | SAME TEXT AS ABOVE                 |
   | logical_plan after rewrite_disjunctive_predicate           | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_duplicated_expr               | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_filter                        | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_cross_join                    | SAME TEXT AS ABOVE                 |
   | logical_plan after common_sub_expression_eliminate         | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_limit                         | SAME TEXT AS ABOVE                 |
   | logical_plan after propagate_empty_relation                | SAME TEXT AS ABOVE                 |
   | logical_plan after filter_null_join_keys                   | SAME TEXT AS ABOVE                 |
   | logical_plan after eliminate_outer_join                    | SAME TEXT AS ABOVE                 |
   | logical_plan after push_down_limit                         | SAME TEXT AS ABOVE                 |
   | logical_plan after push_down_filter                        | SAME TEXT AS ABOVE                 |
   | logical_plan after single_distinct_aggregation_to_group_by | SAME TEXT AS ABOVE                 |
   | logical_plan after simplify_expressions                    | SAME TEXT AS ABOVE                 |
   | logical_plan after unwrap_cast_in_comparison               | SAME TEXT AS ABOVE                 |
   | logical_plan after common_sub_expression_eliminate         | SAME TEXT AS ABOVE                 |
   | logical_plan after push_down_projection                    | Projection: t1.e, t2.e             |
   |                                                            |   CrossJoin:                       |
   |                                                            |     Projection:                    |
   |                                                            |       EmptyRelation                |
   |                                                            |     Projection:                    |
   |                                                            |       EmptyRelation                |
   | logical_plan after eliminate_projection                    | Projection: t1.e, t2.e             |
   |                                                            |   CrossJoin:                       |
   |                                                            |     EmptyRelation                  |
   |                                                            |     EmptyRelation                  |
   | logical_plan after push_down_limit                         | SAME TEXT AS ABOVE                 |
   | logical_plan                                               | Projection: t1.e, t2.e             |
   |                                                            |   CrossJoin:                       |
   |                                                            |     EmptyRelation                  |
   |                                                            |     EmptyRelation                  |
   | initial_physical_plan                                      | Schema error: No field named t1.e. |
   +------------------------------------------------------------+------------------------------------+
   ```
   
   ### To Reproduce
   
   test on https://github.com/apache/arrow-datafusion/pull/6666
   
   
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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] jiangzhx commented on issue #6673: push_down_projection removed necessary Projection `projection Int64(1) AS t1.e`

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

   https://github.com/apache/arrow-datafusion/pull/6595/files#r1225815262


-- 
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] jiangzhx closed issue #6673: push_down_projection removed necessary Projection `projection Int64(1) AS t1.e`

Posted by "jiangzhx (via GitHub)" <gi...@apache.org>.
jiangzhx closed issue #6673: push_down_projection removed necessary Projection `projection Int64(1) AS t1.e`
URL: https://github.com/apache/arrow-datafusion/issues/6673


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