You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "github-code-scanning[bot] (via GitHub)" <gi...@apache.org> on 2023/02/19 00:21:05 UTC

[GitHub] [druid] github-code-scanning[bot] commented on a diff in pull request #13798: Introduce a DruidException for better user error messages

github-code-scanning[bot] commented on code in PR #13798:
URL: https://github.com/apache/druid/pull/13798#discussion_r1111128671


##########
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtils.java:
##########
@@ -379,37 +384,44 @@
             StringComparators.NUMERIC
         );
       default:
-        throw new ValidationException("Unsupported operation in OVERWRITE WHERE clause: " + sqlBasicCall.getOperator().getName());
+        throw DruidException.validationError(
+            "Unsupported operation in OVERWRITE WHERE clause: %s",
+            sqlBasicCall.getOperator().getName()
+        );
     }
   }
 
   /**
    * Converts a {@link SqlNode} identifier into a string representation
    *
-   * @param sqlNode the sql node
+   * @param sqlNode the SQL node
    * @return string representing the column name
-   * @throws ValidationException if the sql node is not an SqlIdentifier
+   * @throws ValidationException if the SQL node is not an SqlIdentifier

Review Comment:
   ## Javadoc has impossible 'throws' tag
   
   Javadoc for parseColumnName claims to throw ValidationException but this is impossible.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/4311)



##########
sql/src/main/java/org/apache/druid/sql/calcite/parser/DruidSqlParserUtils.java:
##########
@@ -379,37 +384,44 @@
             StringComparators.NUMERIC
         );
       default:
-        throw new ValidationException("Unsupported operation in OVERWRITE WHERE clause: " + sqlBasicCall.getOperator().getName());
+        throw DruidException.validationError(
+            "Unsupported operation in OVERWRITE WHERE clause: %s",
+            sqlBasicCall.getOperator().getName()
+        );
     }
   }
 
   /**
    * Converts a {@link SqlNode} identifier into a string representation
    *
-   * @param sqlNode the sql node
+   * @param sqlNode the SQL node
    * @return string representing the column name
-   * @throws ValidationException if the sql node is not an SqlIdentifier
+   * @throws ValidationException if the SQL node is not an SqlIdentifier
    */
-  public static String parseColumnName(SqlNode sqlNode) throws ValidationException
+  public static String parseColumnName(SqlNode sqlNode)
   {
     if (!(sqlNode instanceof SqlIdentifier)) {
-      throw new ValidationException("Expressions must be of the form __time <operator> TIMESTAMP");
+      throw DruidException.validationError(
+          "OVERWRITE WHERE expressions must be of the form __time <operator> TIMESTAMP"
+      );
     }
     return ((SqlIdentifier) sqlNode).getSimple();
   }
 
   /**
    * Converts a {@link SqlNode} into a timestamp, taking into account the timezone
    *
-   * @param sqlNode the sql node
+   * @param sqlNode the SQL node
    * @param timeZone timezone
    * @return the timestamp string as milliseconds from epoch
-   * @throws ValidationException if the sql node is not a SqlTimestampLiteral
+   * @throws ValidationException if the SQL node is not a SqlTimestampLiteral

Review Comment:
   ## Javadoc has impossible 'throws' tag
   
   Javadoc for parseTimeStampWithTimeZone claims to throw ValidationException but this is impossible.
   
   [Show more details](https://github.com/apache/druid/security/code-scanning/4312)



-- 
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@druid.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org