You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Runkang He (Jira)" <ji...@apache.org> on 2023/04/26 01:10:00 UTC
[jira] [Comment Edited] (CALCITE-5598) Expand expression in a GROUP BY clause returns wrong result in case of expressions referenced by column index
[ https://issues.apache.org/jira/browse/CALCITE-5598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17716481#comment-17716481 ]
Runkang He edited comment on CALCITE-5598 at 4/26/23 1:10 AM:
--------------------------------------------------------------
[~julianhyde] I'm not sure how BigQuery uses calcite, does it only use the parsing layer? If so, this problem is BigQuery's part, not Calcite's part.
was (Author: JIRAUSER280488):
[~julianhyde] I'm not sure how bigquery uses calcite, does it only use the parsing layer? If so, this problem is BigQuery's part, not Calcite's part.
> Expand expression in a GROUP BY clause returns wrong result in case of expressions referenced by column index
> -------------------------------------------------------------------------------------------------------------
>
> Key: CALCITE-5598
> URL: https://issues.apache.org/jira/browse/CALCITE-5598
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.34.0
> Reporter: Zine eddine Zidane
> Priority: Blocker
>
> Given the following BigQuery query:
>
> {code:java}
> SELECT CAST(user_id AS STRING) AS id, COUNT(*) FROM `users` GROUP BY 1 HAVING COUNT (*)>1;{code}
>
> SqlValidatorImpl extendedExpand method returns "CAST(user_id AS STRING)" for expression “1” in the GROUP BY clause resulting in the following validated query:
>
> {code:java}
> SELECT CAST(user_id AS STRING) AS id, COUNT(*) FROM `users` GROUP BY CAST(user_id AS STRING) HAVING COUNT (*)>1;{code}
>
> This query fails on BigQuery with the error:
> {code:java}
> SELECT list expression references user_id which is neither grouped nor aggregated at [1:24] on source.{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)