Skip to content

Commit d3c0e60

Browse files
committed
[MXP-3068](https://jira.tools.sap/browse/MXP-3068). Broken alias with is calc view
1 parent efeb2cd commit d3c0e60

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1839,7 +1839,7 @@ private Builder builder(RelNode rel, Set<Clause> clauses) {
18391839
case AS:
18401840
final SqlCall asCall = (SqlCall) selectItem;
18411841
SqlNode alias = asCall.operand(1);
1842-
if (aliasRef && !SqlUtil.isGeneratedAlias(((SqlIdentifier) alias).getSimple())) {
1842+
if ((aliasRef && !SqlUtil.isGeneratedAlias(((SqlIdentifier) alias).getSimple())) || RelOptUtil.hasCalcViewHint(rel)) {
18431843
// For BigQuery, given the query
18441844
// SELECT SUM(x) AS x FROM t HAVING(SUM(t.x) > 0)
18451845
// we can generate

0 commit comments

Comments
 (0)