nerrve commented on a change in pull request #1043: [CALCITE-2552] : Support 
for column alias in order by clause for BigQuerySqlDialect and HiveSqlDialect
URL: https://github.com/apache/calcite/pull/1043#discussion_r258462097
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java
 ##########
 @@ -1057,16 +1062,29 @@ public Builder builder(RelNode rel, Clause... clauses) 
{
       Context newContext;
       final SqlNodeList selectList = select.getSelectList();
       if (selectList != null) {
-        newContext = new Context(dialect, selectList.size()) {
-          public SqlNode field(int ordinal) {
-            final SqlNode selectItem = selectList.get(ordinal);
-            switch (selectItem.getKind()) {
-            case AS:
-              return ((SqlCall) selectItem).operand(0);
+        if (keepColumnAlias) {
+          newContext = new Context(dialect, selectList.size()) {
+            public SqlNode field(int ordinal) {
 
 Review comment:
   I see duplicate code here. Can you pull it out into a common block?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to