rohangarg commented on code in PR #15195:
URL: https://github.com/apache/druid/pull/15195#discussion_r1365838364


##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidSqlValidator.java:
##########
@@ -39,4 +44,23 @@ protected DruidSqlValidator(
   {
     super(opTab, catalogReader, typeFactory, validatorConfig);
   }
+
+  @Override
+  public void validateCall(SqlCall call, SqlValidatorScope scope)
+  {
+    if (call.getKind() == SqlKind.NULLS_FIRST) {
+      SqlNode op0 = call.getOperandList().get(0);
+      if (op0.getKind() == SqlKind.DESCENDING) {
+        throw InvalidSqlInput.exception("DESCENDING ordering with NULLS FIRST 
is not supported!");

Review Comment:
   I think there are some places where `InvalidSqlInput` can't really point to 
a sql location. I agree with the fact that we can take that up as a whole, but 
I agree with Eric that we should provide some context info in the error 
message. If we are to go with the `InvalidSqlInput` way, we would add context 
to it like 
https://github.com/apache/druid/blob/master/sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java#L421
   What do you think?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to