[ 
https://issues.apache.org/jira/browse/KYLIN-4440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18070893#comment-18070893
 ] 

ASF GitHub Bot commented on KYLIN-4440:
---------------------------------------

codecov-commenter commented on PR #1174:
URL: https://github.com/apache/kylin/pull/1174#issuecomment-4184787843

   ## 
[Codecov](https://app.codecov.io/gh/apache/kylin/pull/1174?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `0%` with `1 line` in your changes missing coverage. 
Please review.
   :white_check_mark: Project coverage is 25.01%. Comparing base 
([`6745acb`](https://app.codecov.io/gh/apache/kylin/commit/6745acb9d6c2732261938aebabd801b9bcea3963?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`aa4ca54`](https://app.codecov.io/gh/apache/kylin/commit/aa4ca54dc1c71e1743f1623c160b853dfbd875c4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 314 commits behind head on kylin3.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/kylin/pull/1174?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...va/org/apache/kylin/query/relnode/OLAPJoinRel.java](https://app.codecov.io/gh/apache/kylin/pull/1174?src=pr&el=tree&filepath=query%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fquery%2Frelnode%2FOLAPJoinRel.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cXVlcnkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2t5bGluL3F1ZXJ5L3JlbG5vZGUvT0xBUEpvaW5SZWwuamF2YQ==)
 | 0.00% | [1 Missing :warning: 
](https://app.codecov.io/gh/apache/kylin/pull/1174?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##             kylin3    #1174      +/-   ##
   ============================================
   - Coverage     25.02%   25.01%   -0.02%     
   + Complexity     6254     6252       -2     
   ============================================
     Files          1449     1449              
     Lines         88499    88499              
     Branches      12373    12373              
   ============================================
   - Hits          22148    22138      -10     
   - Misses        64177    64184       +7     
   - Partials       2174     2177       +3     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by 
Sentry](https://app.codecov.io/gh/apache/kylin/pull/1174?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   
   :loudspeaker: Have feedback on the report? [Share it 
here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> IllegalStateException thrown when a query contains group by clause with case 
> when of dimensional table columns
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: KYLIN-4440
>                 URL: https://issues.apache.org/jira/browse/KYLIN-4440
>             Project: Kylin
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: v2.2.0, v2.5.1, v2.6.5
>            Reporter: Xi Chen
>            Assignee: Yifei Wu
>            Priority: Major
>              Labels: calcite
>
> When a sub-query contains group by clause with case when of dimensional table 
> columns, and the sub-query is joined by another sub-query, the whole query 
> fails throwing java.lang.IllegalStateException.
> Example query of kylin_sales_cube:
> {code:java}
> SELECT *
> FROM
>   (SELECT part_dt ,
>           CASE
>               WHEN buyer_id >= 10003000 THEN 'A'
>               ELSE kylin_account.account_country
>           END AS category ,
>           sum(price) AS total_sold ,
>           count(DISTINCT seller_id) AS sellers
>    FROM kylin_sales
>    JOIN kylin_account ON kylin_sales.buyer_id = kylin_account.account_id
>    GROUP BY part_dt ,
>             CASE
>                 WHEN buyer_id >= 10003000 THEN 'A'
>                 ELSE kylin_account.account_country
>             END
>    ORDER BY part_dt) t1
> JOIN
>   (SELECT part_dt ,
>           sum(price) AS total_sold ,
>           count(DISTINCT seller_id) AS sellers
>    FROM kylin_sales
>    JOIN kylin_account ON kylin_sales.buyer_id = kylin_account.account_id
>    GROUP BY part_dt
>    ORDER BY part_dt) t2 ON t1.part_dt = t2.part_dt
> ORDER BY t1.part_dt DESC
> {code}
> Exception message:
> {code:java}
> RowType=7, ColumnRowType=8 while executing SQL: "SELECT * FROM ( SELECT 
> part_dt , CASE WHEN buyer_id >= 10003000 THEN 'A' ELSE 
> kylin_account.account_country END AS category , sum(price) AS total_sold , 
> count(DISTINCT seller_id) AS sellers FROM kylin_sales LEFT JOIN kylin_account 
> ON kylin_sales.buyer_id = kylin_account.account_id GROUP BY part_dt , CASE 
> WHEN buyer_id >= 10003000 THEN 'A' ELSE kylin_account.account_country END 
> ORDER BY part_dt ) t1 LEFT JOIN ( SELECT part_dt , sum(price) AS total_sold , 
> count(DISTINCT seller_id) AS sellers FROM kylin_sales LEFT JOIN kylin_account 
> ON kylin_sales.buyer_id = kylin_account.account_id GROUP BY part_dt ORDER BY 
> part_dt ) t2 ON t1.part_dt = t2.part_dt ORDER BY t1.part_dt DESC LIMIT 
> 50000"{code}
> More message from kylin logs:
> {code:java}
> Caused by: java.lang.IllegalStateException: RowType=7, ColumnRowType=8
>         at 
> org.apache.kylin.query.relnode.OLAPJoinRel.buildColumnRowType(OLAPJoinRel.java:223)
>         at 
> org.apache.kylin.query.relnode.OLAPJoinRel.implementOLAP(OLAPJoinRel.java:174)
>         at 
> org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:84)
>         at 
> org.apache.kylin.query.relnode.OLAPSortRel.implementOLAP(OLAPSortRel.java:72)
>         at 
> org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:84)
>         at 
> org.apache.kylin.query.relnode.OLAPLimitRel.implementOLAP(OLAPLimitRel.java:77)
>         at 
> org.apache.kylin.query.relnode.OLAPRel$OLAPImplementor.visitChild(OLAPRel.java:84)
>         at 
> org.apache.kylin.query.relnode.OLAPToEnumerableConverter.implement(OLAPToEnumerableConverter.java:75)
>         at 
> org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:103)
>         at 
> org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:92)
>         at 
> org.apache.calcite.prepare.CalcitePrepareImpl$CalcitePreparingStmt.implement(CalcitePrepareImpl.java:1278)
>         at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:331)
>         at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:230)
>         at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepareImpl.java:796)
>         at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepareImpl.java:655)
>         at 
> org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepareImpl.java:618)
>         at 
> org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConnectionImpl.java:221)
>         at 
> org.apache.calcite.jdbc.CalciteMetaImpl.prepareAndExecute(CalciteMetaImpl.java:603)
>         at 
> org.apache.calcite.avatica.AvaticaConnection.prepareAndExecuteInternal(AvaticaConnection.java:638)
>         at 
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:149)
>         ... 83 more
> {code}
>  
> However, the sub-queries both runs successfully alone:
> {code:java}
> SELECT part_dt ,
>        CASE
>            WHEN buyer_id >= 10003000 THEN 'A'
>            ELSE kylin_account.account_country
>        END AS category ,
>        sum(price) AS total_sold ,
>        count(DISTINCT seller_id) AS sellers
> FROM kylin_sales
> JOIN kylin_account ON kylin_sales.buyer_id = kylin_account.account_id
> GROUP BY part_dt ,
>          CASE
>              WHEN buyer_id >= 10003000 THEN 'A'
>              ELSE kylin_account.account_country
>          END
> ORDER BY part_dt;{code}
> {code:java}
> SELECT part_dt ,
>        sum(price) AS total_sold ,
>        count(DISTINCT seller_id) AS sellers
> FROM kylin_sales
> JOIN kylin_account ON kylin_sales.buyer_id = kylin_account.account_id
> GROUP BY part_dt
> ORDER BY part_dt
> {code}
> If the case when clause is removed from sub-query, it also runs successfully:
> {code:java}
> SELECT *
> FROM
>   (SELECT part_dt ,
>           kylin_account.account_country,
>           sum(price) AS total_sold ,
>           count(DISTINCT seller_id) AS sellers
>    FROM kylin_sales
>    JOIN kylin_account ON kylin_sales.buyer_id = kylin_account.account_id
>    GROUP BY part_dt ,
>             kylin_account.account_country
>    ORDER BY part_dt) t1
> JOIN
>   (SELECT part_dt ,
>           sum(price) AS total_sold ,
>           count(DISTINCT seller_id) AS sellers
>    FROM kylin_sales
>    JOIN kylin_account ON kylin_sales.buyer_id = kylin_account.account_id
>    GROUP BY part_dt
>    ORDER BY part_dt) t2 ON t1.part_dt = t2.part_dt
> ORDER BY t1.part_dt DESC
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to