LakshSingla commented on code in PR #14534:
URL: https://github.com/apache/druid/pull/14534#discussion_r1257960890
##########
extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/sql/MSQTaskSqlEngine.java:
##########
@@ -169,23 +172,26 @@ public QueryMaker buildQueryMakerForInsert(
);
}
- private static void validateSelect(
- final List<Pair<Integer, String>> fieldMappings,
- final PlannerContext plannerContext
- ) throws ValidationException
+ /**
+ * Checks if the SELECT contains {@link
DruidSqlInsert#SQL_INSERT_SEGMENT_GRANULARITY} in the context. This is a
+ * defensive cheeck because {@link
org.apache.druid.sql.calcite.planner.DruidPlanner} should have called the
+ * {@link #validateContext}
+ */
+ private static void validateSelect(final PlannerContext plannerContext)
{
if
(plannerContext.queryContext().containsKey(DruidSqlInsert.SQL_INSERT_SEGMENT_GRANULARITY))
{
- throw new ValidationException(
- StringUtils.format("Cannot use \"%s\" without INSERT",
DruidSqlInsert.SQL_INSERT_SEGMENT_GRANULARITY)
- );
+ throw DruidException
+ .forPersona(DruidException.Persona.DEVELOPER)
+ .ofCategory(DruidException.Category.DEFENSIVE)
+ .build("Cannot use \"%s\" without INSERT",
DruidSqlInsert.SQL_INSERT_SEGMENT_GRANULARITY);
Review Comment:
Updated the error message stating where the bug might be and why this is a
defensive exception.
--
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]