[jira] [Commented] (CALCITE-2440) SQL with UNNEST fail in volcano planner in some cases
[ https://issues.apache.org/jira/browse/CALCITE-2440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16586993#comment-16586993 ] Shuyi Chen commented on CALCITE-2440: - Thanks a lot for the pointer, [~vvysotskyi]. Yes, I found the a rule assuming Correlate -> Uncollect, but can't match Correlate -> Project -> Uncollect after the change in CALCITE-2291. Will fix the rule in the target project. Closing this ticket as invalid. > SQL with UNNEST fail in volcano planner in some cases > - > > Key: CALCITE-2440 > URL: https://issues.apache.org/jira/browse/CALCITE-2440 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.17.0 >Reporter: Shuyi Chen >Assignee: Julian Hyde >Priority: Major > > After [CALCITE-2291|https://issues.apache.org/jira/browse/CALCITE-2291], > specifically, [this > line|https://github.com/apache/calcite/blob/7088dc7261d294b7c6d5c9f4463435e95f0b9c15/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L1952] > causes volcano planner to fail to find the best plan for query > {code:java} > SELECT a, s FROM T, UNNEST(T.c) as A (s) > {code} > . I'll try to write a unittest in Calcite to reproduce. [~cshi] [~vvysotskyi] > [~HanumathRao], can you provide some context? Thanks a lot. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2440) SQL with UNNEST fail in volcano planner in some cases
[ https://issues.apache.org/jira/browse/CALCITE-2440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16585616#comment-16585616 ] Volodymyr Vysotskyi commented on CALCITE-2440: -- I think the problem is that one of the rules which convert rel nodes to required implementation with required trait set cannot be applied. I would recommend revising all rules which create rel nodes that are available in the resulting plan (before Calcite upgrade) and check if one of the rules is not applied. I assume you have a rule which expects {{Correlate -> Uncollect -> Project}} section of the tree, but tree contains {{Project}} after {{Correlate}} and before {{Uncollect}}. > SQL with UNNEST fail in volcano planner in some cases > - > > Key: CALCITE-2440 > URL: https://issues.apache.org/jira/browse/CALCITE-2440 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.17.0 >Reporter: Shuyi Chen >Assignee: Julian Hyde >Priority: Major > > After [CALCITE-2291|https://issues.apache.org/jira/browse/CALCITE-2291], > specifically, [this > line|https://github.com/apache/calcite/blob/7088dc7261d294b7c6d5c9f4463435e95f0b9c15/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L1952] > causes volcano planner to fail to find the best plan for query > {code:java} > SELECT a, s FROM T, UNNEST(T.c) as A (s) > {code} > . I'll try to write a unittest in Calcite to reproduce. [~cshi] [~vvysotskyi] > [~HanumathRao], can you provide some context? Thanks a lot. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2440) SQL with UNNEST fail in volcano planner in some cases
[ https://issues.apache.org/jira/browse/CALCITE-2440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16585420#comment-16585420 ] Shuyi Chen commented on CALCITE-2440: - [~vvysotskyi], thanks a lot. There are 52 rules together, it's hard to identify the set. After running the volcanoplanner, the relsubset.best is null and bestCost is {inf}. Do you have any idea on what might be the cause so I can narrow down the search space? > SQL with UNNEST fail in volcano planner in some cases > - > > Key: CALCITE-2440 > URL: https://issues.apache.org/jira/browse/CALCITE-2440 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.17.0 >Reporter: Shuyi Chen >Assignee: Julian Hyde >Priority: Major > > After [CALCITE-2291|https://issues.apache.org/jira/browse/CALCITE-2291], > specifically, [this > line|https://github.com/apache/calcite/blob/7088dc7261d294b7c6d5c9f4463435e95f0b9c15/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L1952] > causes volcano planner to fail to find the best plan for query > {code:java} > SELECT a, s FROM T, UNNEST(T.c) as A (s) > {code} > . I'll try to write a unittest in Calcite to reproduce. [~cshi] [~vvysotskyi] > [~HanumathRao], can you provide some context? Thanks a lot. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2440) SQL with UNNEST fail in volcano planner in some cases
[ https://issues.apache.org/jira/browse/CALCITE-2440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16584750#comment-16584750 ] Volodymyr Vysotskyi commented on CALCITE-2440: -- [~suez1224], thanks for the clarification. I'm wondering, will this query pass if you change the alias for unnest result: {code:sql} SELECT a, s FROM T, UNNEST(T.c) as AAA(s) SELECT T.a, AAA.s FROM T, UNNEST(T.c) as AAA(s) {code} There is no direct unit test for this problem, but the side effect of this change may be observed in this line: [https://github.com/apache/calcite/commit/68ba411e23ba930bb2086bb3eed4c46edfac23eb#diff-337728f1a3a35c634362df7a0a509505R4546]. Regarding unit tests with volcano planner, you may use a test from the description of CALCITE-2223 as an example. You just should specify rules which should be applied, and perhaps more {{EnumerableRules}}, since the initial query was much simpler. Also, there is built rel nodes tree manually, but you can use {{SqlToRelConverter}} to specify a query only. > SQL with UNNEST fail in volcano planner in some cases > - > > Key: CALCITE-2440 > URL: https://issues.apache.org/jira/browse/CALCITE-2440 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.17.0 >Reporter: Shuyi Chen >Assignee: Julian Hyde >Priority: Major > > After [CALCITE-2291|https://issues.apache.org/jira/browse/CALCITE-2291], > specifically, [this > line|https://github.com/apache/calcite/blob/7088dc7261d294b7c6d5c9f4463435e95f0b9c15/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L1952] > causes volcano planner to fail to find the best plan for query > {code:java} > SELECT a, s FROM T, UNNEST(T.c) as A (s) > {code} > . I'll try to write a unittest in Calcite to reproduce. [~cshi] [~vvysotskyi] > [~HanumathRao], can you provide some context? Thanks a lot. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2440) SQL with UNNEST fail in volcano planner in some cases
[ https://issues.apache.org/jira/browse/CALCITE-2440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16583181#comment-16583181 ] Shuyi Chen commented on CALCITE-2440: - [~vvysotskyi], table "T" does contains column "a". Could you please point me to the unittest that causes the loss of field aliases? [~julianhyde], do you have any good suggestion for me to reproduce the issue in calcite to debug the volcano planner? I hit the issue when I upgrade Apache Flink to use Calcite 1.17. But Flink have many rules and it's hard to find out which set of rules cause the issue. Thanks a lot. > SQL with UNNEST fail in volcano planner in some cases > - > > Key: CALCITE-2440 > URL: https://issues.apache.org/jira/browse/CALCITE-2440 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.17.0 >Reporter: Shuyi Chen >Assignee: Julian Hyde >Priority: Major > > After [CALCITE-2291|https://issues.apache.org/jira/browse/CALCITE-2291], > specifically, [this > line|https://github.com/apache/calcite/blob/7088dc7261d294b7c6d5c9f4463435e95f0b9c15/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L1952] > causes volcano planner to fail to find the best plan for query > {code:java} > SELECT a, s FROM T, UNNEST(T.c) as A (s) > {code} > . I'll try to write a unittest in Calcite to reproduce. [~cshi] [~vvysotskyi] > [~HanumathRao], can you provide some context? Thanks a lot. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2440) SQL with UNNEST fail in volcano planner in some cases
[ https://issues.apache.org/jira/browse/CALCITE-2440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16567657#comment-16567657 ] Volodymyr Vysotskyi commented on CALCITE-2440: -- [~suez1224], the line of code you have provided in the Jira description, helped to fix a loss of field aliases for the cases of the queries where unnest was used in a non-root level. Could you please check a query you have provided? You are using column "a", does table "T" have such column, or you are trying to reference result of "unnest"? > SQL with UNNEST fail in volcano planner in some cases > - > > Key: CALCITE-2440 > URL: https://issues.apache.org/jira/browse/CALCITE-2440 > Project: Calcite > Issue Type: Bug > Components: core >Affects Versions: 1.17.0 >Reporter: Shuyi Chen >Assignee: Julian Hyde >Priority: Major > > After [CALCITE-2291|https://issues.apache.org/jira/browse/CALCITE-2291], > specifically, [this > line|https://github.com/apache/calcite/blob/7088dc7261d294b7c6d5c9f4463435e95f0b9c15/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java#L1952] > causes volcano planner to fail to find the best plan for query > {code:java} > SELECT a, s FROM T, UNNEST(T.c) as A (s) > {code} > . I'll try to write a unittest in Calcite to reproduce. [~cshi] [~vvysotskyi] > [~HanumathRao], can you provide some context? Thanks a lot. -- This message was sent by Atlassian JIRA (v7.6.3#76005)