You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "wnob (via GitHub)" <gi...@apache.org> on 2023/06/27 02:31:14 UTC

[GitHub] [calcite] wnob commented on a diff in pull request #3206: [CALCITE-5724] Generated SQL uses literal values in ORDER BY clauses

wnob commented on code in PR #3206:
URL: https://github.com/apache/calcite/pull/3206#discussion_r1243066698


##########
core/src/main/java/org/apache/calcite/rel/rel2sql/SqlImplementor.java:
##########
@@ -1122,6 +1122,11 @@ public List<SqlNode> fieldList() {
     }
 
     void addOrderItem(List<SqlNode> orderByList, RelFieldCollation field) {
+      // If the field being ordered on is a Literal value, we can safely skip it.
+      if (!dialect.getConformance().isSortByLiteralAllowed()
+          && field(field.getFieldIndex()) instanceof SqlLiteral) {
+        return;
+      }

Review Comment:
   See my comment on the JIRA case. I think a better solution will live in `SqlImplementor.Context.orderField`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org