rohangarg commented on code in PR #12431:
URL: https://github.com/apache/druid/pull/12431#discussion_r858312642
##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java:
##########
@@ -221,6 +222,19 @@ public PlannerResult plan() throws SqlParseException,
ValidationException, RelCo
final SqlNode validatedQueryNode =
planner.validate(parameterizedQueryNode);
final RelRoot rootQueryRel = planner.rel(validatedQueryNode);
+ if (parsed.getInsertNode() != null) {
+ // Check that there are no unnamed columns in the insert.
+ // We do this validation here since we need the rel nodes for this.
+ for (Pair<Integer, String> field : rootQueryRel.fields) {
+ if (UNNAMED_COLUMN_PATTERN.matcher(field.right).matches()) {
+ throw new ValidationException("Cannot ingest unnamed expressions
that do not have an alias "
Review Comment:
nit: I think `Cannot ingest unnamed expressions that do not have an alias`
can be converted to `Cannot ingest expressions that do not have an alias`
##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java:
##########
@@ -221,6 +222,19 @@ public PlannerResult plan() throws SqlParseException,
ValidationException, RelCo
final SqlNode validatedQueryNode =
planner.validate(parameterizedQueryNode);
final RelRoot rootQueryRel = planner.rel(validatedQueryNode);
+ if (parsed.getInsertNode() != null) {
Review Comment:
this can be a part of the `insertNode` block in `buildQueryMaker`. We
already have a validation method for DS there, possibly this one can be in a
`validateInsertSource` like method
--
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]