xiong duan created CALCITE-6901: ----------------------------------- Summary: SINGLE_VALUE rewrite to wrong sql in MySQL dialect Key: CALCITE-6901 URL: https://issues.apache.org/jira/browse/CALCITE-6901 Project: Calcite Issue Type: Bug Reporter: xiong duan
Now, the MySQL dialect rewrites the SINGLE_VALUE to: {code:java} CASE COUNT(*) WHEN 0 THEN NULL WHEN 1 THEN <result> ELSE (SELECT NULL UNION ALL SELECT NULL) END{code} But it should be: {code:java} CASE COUNT(*) WHEN 0 THEN NULL WHEN 1 THEN min(<result>) ELSE (SELECT NULL UNION ALL SELECT NULL) END {code} The exception: {code:java} SQL 错误 [1140] [42000]: In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column '*****'; this is incompatible with sql_mode=only_full_group_by {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)