[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17257924#comment-17257924 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus commented on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-753734922 https://github.com/apache/kylin/pull/1529 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17256802#comment-17256802 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus closed pull request #1493: URL: https://github.com/apache/kylin/pull/1493 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17256801#comment-17256801 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus commented on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-752823570 Looks like there is another better solution. I will close this. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17256803#comment-17256803 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus edited a comment on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-752823570 Looks like there is another better solution from yanghong. I will close this. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17241252#comment-17241252 ] hcy commented on KYLIN-4823: (y):) > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17241224#comment-17241224 ] Xiaoxiang Yu commented on KYLIN-4823: - Similar issue > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17241204#comment-17241204 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus removed a comment on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-736166077 ### Analysis The method in `buildGroups` in `OLAPAggregateRel.java` return duplicate column, thus cause `sqlDigest.havingFilter` be set to a wrong column. ### Step by step Analysis 1. Having Filter is wrong, should be `price` not `LSTG_SITE_ID` ! Let's see what happen ? https://user-images.githubusercontent.com/14030549/100642316-993b7b80-3373-11eb-88cf-b1a7db7044e8.png;> 2. Fetch duplicate column in TupleExpression, two `LSTG_SITE_ID`. https://user-images.githubusercontent.com/14030549/100642470-c556fc80-3373-11eb-9601-0e2ac26f3c90.png;> 3. Add same column(`LSTG_SITE_ID`) to groupBy column twice. https://user-images.githubusercontent.com/14030549/100642615-f1727d80-3373-11eb-977a-a530e2ab36f6.png;> 4. Start to create a having TupleFilter https://user-images.githubusercontent.com/14030549/100642787-31d1fb80-3374-11eb-9acc-babce32c535b.png;> 5. `$2` is wrong because https://user-images.githubusercontent.com/14030549/100642872-5201ba80-3374-11eb-872f-b44c46e85b80.png;> 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17241200#comment-17241200 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus edited a comment on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-735928205 ## Cube Set shardBy to true to `KYLIN_SALES.SELLER_ID` . ### Reproduce SQL ```sql SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10 ``` ### Error Log ```java 2020-12-01 09:49:27,262 ERROR [Query c43e8817-e24d-6230-8857-cc0c2092ef5e-59] service.QueryService:576 : Exception while executing query java.sql.SQLException: Error while executing SQL "select * from (SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10) limit 5": Index: 4, Size: 1 at org.apache.calcite.avatica.Helper.createException(Helper.java:56) at org.apache.calcite.avatica.Helper.createException(Helper.java:41) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163) at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227) at org.apache.kylin.rest.service.QueryService.executeRequest(QueryService.java:1010) at org.apache.kylin.rest.service.QueryService.queryWithSqlMassage(QueryService.java:706) at org.apache.kylin.rest.service.QueryService.query(QueryService.java:225) at org.apache.kylin.rest.service.QueryService.queryAndUpdateCache(QueryService.java:514) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:474) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:402) at org.apache.kylin.rest.controller.QueryController.query(QueryController.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) at
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17241202#comment-17241202 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus edited a comment on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-735928205 ## Cube Set shardBy to true to `KYLIN_SALES.SELLER_ID` . ### Reproduce SQL ```sql SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10 ``` ### Error Log ```java 2020-12-01 09:49:27,262 ERROR [Query c43e8817-e24d-6230-8857-cc0c2092ef5e-59] service.QueryService:576 : Exception while executing query java.sql.SQLException: Error while executing SQL "select * from (SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10) limit 5": Index: 4, Size: 1 at org.apache.calcite.avatica.Helper.createException(Helper.java:56) at org.apache.calcite.avatica.Helper.createException(Helper.java:41) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163) at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227) at org.apache.kylin.rest.service.QueryService.executeRequest(QueryService.java:1010) at org.apache.kylin.rest.service.QueryService.queryWithSqlMassage(QueryService.java:706) at org.apache.kylin.rest.service.QueryService.query(QueryService.java:225) at org.apache.kylin.rest.service.QueryService.queryAndUpdateCache(QueryService.java:514) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:474) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:402) at org.apache.kylin.rest.controller.QueryController.query(QueryController.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) at
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17241198#comment-17241198 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus edited a comment on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-735928205 ## Cube Set shardBy to true to `KYLIN_SALES.SELLER_ID` . ### Reproduce SQL ```sql SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10 ``` ### Error Log ```java 2020-12-01 09:49:27,262 ERROR [Query c43e8817-e24d-6230-8857-cc0c2092ef5e-59] service.QueryService:576 : Exception while executing query java.sql.SQLException: Error while executing SQL "select * from (SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10) limit 5": Index: 4, Size: 1 at org.apache.calcite.avatica.Helper.createException(Helper.java:56) at org.apache.calcite.avatica.Helper.createException(Helper.java:41) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163) at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227) at org.apache.kylin.rest.service.QueryService.executeRequest(QueryService.java:1010) at org.apache.kylin.rest.service.QueryService.queryWithSqlMassage(QueryService.java:706) at org.apache.kylin.rest.service.QueryService.query(QueryService.java:225) at org.apache.kylin.rest.service.QueryService.queryAndUpdateCache(QueryService.java:514) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:474) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:402) at org.apache.kylin.rest.controller.QueryController.query(QueryController.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) at
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17241199#comment-17241199 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus commented on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-736166077 ### Analysis The method in `buildGroups` in `OLAPAggregateRel.java` return duplicate column, thus cause `sqlDigest.havingFilter` be set to a wrong column. ### Step by step Analysis 1. Having Filter is wrong, should be `price` not `LSTG_SITE_ID` ! Let's see what happen ? https://user-images.githubusercontent.com/14030549/100642316-993b7b80-3373-11eb-88cf-b1a7db7044e8.png;> 2. Fetch duplicate column in TupleExpression, two `LSTG_SITE_ID`. https://user-images.githubusercontent.com/14030549/100642470-c556fc80-3373-11eb-9601-0e2ac26f3c90.png;> 3. Add same column(`LSTG_SITE_ID`) to groupBy column twice. https://user-images.githubusercontent.com/14030549/100642615-f1727d80-3373-11eb-977a-a530e2ab36f6.png;> 4. Start to create a having TupleFilter https://user-images.githubusercontent.com/14030549/100642787-31d1fb80-3374-11eb-9acc-babce32c535b.png;> 5. `$2` is wrong because https://user-images.githubusercontent.com/14030549/100642872-5201ba80-3374-11eb-872f-b44c46e85b80.png;> 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17241196#comment-17241196 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus edited a comment on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-735928205 ## Cube Set shardBy to true to `KYLIN_SALES.SELLER_ID`. ## Reproduce SQL ```sql SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10 ``` ### Error Log ```java 2020-12-01 09:49:27,262 ERROR [Query c43e8817-e24d-6230-8857-cc0c2092ef5e-59] service.QueryService:576 : Exception while executing query java.sql.SQLException: Error while executing SQL "select * from (SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10) limit 5": Index: 4, Size: 1 at org.apache.calcite.avatica.Helper.createException(Helper.java:56) at org.apache.calcite.avatica.Helper.createException(Helper.java:41) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163) at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227) at org.apache.kylin.rest.service.QueryService.executeRequest(QueryService.java:1010) at org.apache.kylin.rest.service.QueryService.queryWithSqlMassage(QueryService.java:706) at org.apache.kylin.rest.service.QueryService.query(QueryService.java:225) at org.apache.kylin.rest.service.QueryService.queryAndUpdateCache(QueryService.java:514) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:474) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:402) at org.apache.kylin.rest.controller.QueryController.query(QueryController.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) at
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17241192#comment-17241192 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus edited a comment on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-735928205 ## Cube Set shardBy to true to `KYLIN_SALES.SELLER_ID`. ## Reproduce SQL ```sql SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10 ``` ### Error Log ```java 2020-12-01 09:49:27,262 ERROR [Query c43e8817-e24d-6230-8857-cc0c2092ef5e-59] service.QueryService:576 : Exception while executing query java.sql.SQLException: Error while executing SQL "select * from (SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10) limit 5": Index: 4, Size: 1 at org.apache.calcite.avatica.Helper.createException(Helper.java:56) at org.apache.calcite.avatica.Helper.createException(Helper.java:41) at org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163) at org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227) at org.apache.kylin.rest.service.QueryService.executeRequest(QueryService.java:1010) at org.apache.kylin.rest.service.QueryService.queryWithSqlMassage(QueryService.java:706) at org.apache.kylin.rest.service.QueryService.query(QueryService.java:225) at org.apache.kylin.rest.service.QueryService.queryAndUpdateCache(QueryService.java:514) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:474) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:402) at org.apache.kylin.rest.controller.QueryController.query(QueryController.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) at
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17241188#comment-17241188 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus edited a comment on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-735928205 ## Reproduce SQL ```sql SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10 ``` ### Cause Analysis 1. Having Filter is wrong, should be `price` not `LSTG_SITE_ID` ! Let's see what happen ? https://user-images.githubusercontent.com/14030549/100642316-993b7b80-3373-11eb-88cf-b1a7db7044e8.png;> 2. Fetch duplicate column in TupleExpression, two `LSTG_SITE_ID`. https://user-images.githubusercontent.com/14030549/100642470-c556fc80-3373-11eb-9601-0e2ac26f3c90.png;> 3. Add same column(`LSTG_SITE_ID`) to groupBy column twice. https://user-images.githubusercontent.com/14030549/100642615-f1727d80-3373-11eb-977a-a530e2ab36f6.png;> 4. Start to create a having TupleFilter https://user-images.githubusercontent.com/14030549/100642787-31d1fb80-3374-11eb-9acc-babce32c535b.png;> 5. `$2` is wrong because https://user-images.githubusercontent.com/14030549/100642872-5201ba80-3374-11eb-872f-b44c46e85b80.png;> 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17240939#comment-17240939 ] ASF GitHub Bot commented on KYLIN-4823: --- coveralls commented on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-735946693 ## Pull Request Test Coverage Report for [Build 6596](https://coveralls.io/builds/35332253) * **0** of **4** **(0.0%)** changed or added relevant lines in **1** file are covered. * **3** unchanged lines in **3** files lost coverage. * Overall coverage increased (+**0.01%**) to **28.048%** --- | Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | | :-|--||---: | | [query/src/main/java/org/apache/kylin/query/relnode/OLAPAggregateRel.java](https://coveralls.io/builds/35332253/source?filename=query%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fquery%2Frelnode%2FOLAPAggregateRel.java#L316) | 0 | 4 | 0.0% | Files with Coverage Reduction | New Missed Lines | % | | :-|--|--: | | [query/src/main/java/org/apache/kylin/query/relnode/OLAPAggregateRel.java](https://coveralls.io/builds/35332253/source?filename=query%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fquery%2Frelnode%2FOLAPAggregateRel.java#L320) | 1 | 0% | | [stream-core/src/main/java/org/apache/kylin/stream/core/storage/columnar/ColumnarStoreCache.java](https://coveralls.io/builds/35332253/source?filename=stream-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Fstream%2Fcore%2Fstorage%2Fcolumnar%2FColumnarStoreCache.java#L146) | 1 | 56.82% | | [tool/src/main/java/org/apache/kylin/tool/query/ProbabilityGenerator.java](https://coveralls.io/builds/35332253/source?filename=tool%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fkylin%2Ftool%2Fquery%2FProbabilityGenerator.java#L44) | 1 | 81.58% | | Totals | [![Coverage Status](https://coveralls.io/builds/35332253/badge)](https://coveralls.io/builds/35332253) | | :-- | --: | | Change from base [Build 6595](https://coveralls.io/builds/35328877): | 0.01% | | Covered Lines: | 26260 | | Relevant Lines: | 93624 | --- # - [Coveralls](https://coveralls.io) 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17240907#comment-17240907 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus commented on pull request #1493: URL: https://github.com/apache/kylin/pull/1493#issuecomment-735928205 ## Reproduce SQL ```sql SELECT SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY SELLER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID + 0.3 else LSTG_SITE_ID END HAVING SUM(PRICE)>10 ``` ### Cause Analysis 1. Having Filter is wrong! https://user-images.githubusercontent.com/14030549/100642316-993b7b80-3373-11eb-88cf-b1a7db7044e8.png;> 2. Fetch duplicate column in TupleExpression https://user-images.githubusercontent.com/14030549/100642470-c556fc80-3373-11eb-9601-0e2ac26f3c90.png;> 3. Add same column to groupBy column twice. https://user-images.githubusercontent.com/14030549/100642615-f1727d80-3373-11eb-977a-a530e2ab36f6.png;> 4. Start to create a having TupleFilter https://user-images.githubusercontent.com/14030549/100642787-31d1fb80-3374-11eb-9acc-babce32c535b.png;> 5. `$2` is wrong. https://user-images.githubusercontent.com/14030549/100642872-5201ba80-3374-11eb-872f-b44c46e85b80.png;> 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (KYLIN-4823) Push down having filter error when group by dynamic column
[ https://issues.apache.org/jira/browse/KYLIN-4823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17240901#comment-17240901 ] ASF GitHub Bot commented on KYLIN-4823: --- hit-lacus opened a new pull request #1493: URL: https://github.com/apache/kylin/pull/1493 ## Proposed changes Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue. ## Types of changes What types of changes does your code introduce to Kylin? _Put an `x` in the boxes that apply_ - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation Update (if none of the other choices apply) ## Checklist _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._ - [ ] I have create an issue on [Kylin's jira](https://issues.apache.org/jira/browse/KYLIN), and have described the bug/feature there in detail - [ ] Commit messages in my PR start with the related jira ID, like "KYLIN- Make Kylin project open-source" - [ ] Compiling and unit tests pass locally with my changes - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] If this change need a document change, I will prepare another pr against the `document` branch - [ ] Any dependent changes have been merged ## Further comments If this is a relatively large or complex change, kick off the discussion at user@kylin or dev@kylin by explaining why you chose the solution you did and what alternatives you considered, etc... 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Push down having filter error when group by dynamic column > --- > > Key: KYLIN-4823 > URL: https://issues.apache.org/jira/browse/KYLIN-4823 > Project: Kylin > Issue Type: Bug > Components: Query Engine >Affects Versions: v3.1.0 >Reporter: hcy >Priority: Major > > 如果cube只有一个segment,且shard by的列存在于group by中,满足having filter push > down的条件时,如果group by中存在动态列,并且case when then > 中的表达是为column而不是常量时会报数组越界的错误。配置kylin.query.enable-dynamic-column=true无效,也会报错。 > 测试Cube如下: > 模型为kylin > example中的kylin_sales_model,cube为kylin_sales_cube,为了重现错误把BUYER_ID的rowkey设置为shard > by > 测试SQL如下: > SELECT BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END AS > dyna_group, > SUM(PRICE) > FROM KYLIN_SALES > GROUP BY > BUYER_ID, > CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > HAVING SUM(PRICE)>10 > 报错如下: > {color:#b94a48}Index: 4, Size: 1 while executing SQL: "select * from (SELECT > BUYER_ID, CASE WHEN LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END > AS dyna_group, SUM(PRICE) FROM KYLIN_SALES GROUP BY BUYER_ID, CASE WHEN > LSTG_SITE_ID > 1 then LSTG_SITE_ID else LEAF_CATEG_ID END HAVING > SUM(PRICE)>10) limit 5"{color} > Caused by: java.lang.IndexOutOfBoundsException: Index: 4, Size: 1 > at java.util.ArrayList.rangeCheck(ArrayList.java:657) > at java.util.ArrayList.get(ArrayList.java:433) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.checkHavingCanPushDown(GTCubeStorageQueryBase.java:552) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.getStorageQueryRequest(GTCubeStorageQueryBase.java:189) > at > org.apache.kylin.storage.gtrecord.GTCubeStorageQueryBase.search(GTCubeStorageQueryBase.java:89) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.queryStorage(OLAPEnumerator.java:117) > at > org.apache.kylin.query.enumerator.OLAPEnumerator.moveNext(OLAPEnumerator.java:60) -- This message was sent by Atlassian Jira (v8.3.4#803005)