[
https://issues.apache.org/jira/browse/CALCITE-4740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17402463#comment-17402463
]
Julian Hyde commented on CALCITE-4740:
--------------------------------------
There are a few places where "expr$" occurs:
{noformat}
$ git ls-files |xargs fgrep -i 'expr$"'
core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java:
if (fieldName.toLowerCase(Locale.ROOT).startsWith("expr$")) {
core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java:
.startsWith("expr$")) {
core/src/main/java/org/apache/calcite/sql/SqlUtil.java: return "EXPR$" +
ordinal;
core/src/main/java/org/apache/calcite/sql/validate/SqlValidatorUtil.java:
(original, attempt, size) -> Util.first(original, "EXPR$") + attempt;
core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java:
String aliasBase = (alias == null) ? "EXPR$" : alias;
core/src/main/java/org/apache/calcite/tools/RelBuilder.java: name !=
null ? name : "expr$" + i);{noformat}
You could rationalize a few of them into a method in SqlUtil or
SqlValidatorUtil.
> JDBC adapter generates incorrect HAVING clause in BigQuery dialect
> ------------------------------------------------------------------
>
> Key: CALCITE-4740
> URL: https://issues.apache.org/jira/browse/CALCITE-4740
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.27.0
> Environment: jdk8
> macos
> Reporter: yanjing.wang
> Priority: Minor
> Labels: pull-request-available
>
> I'm converting
> {code:java}
> String query = select
> "product_id" , sum("shelf_width")
> from "foodmart"."product"
> where "product_id" > 0
> group by "product_id" having sum("shelf_width") > 1{code}
> with big query dialect, but results
> {code:java}
> SELECT product_id, SUM(shelf_width)
> FROM foodmart.product
> WHERE product_id > 0
> GROUP BY product_id
> HAVING `EXPR$1` > 1
> {code}
> Maybe we need replace having clause aliases when stripping trivial aliases.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)