adarshsanjeev commented on code in PR #12431:
URL: https://github.com/apache/druid/pull/12431#discussion_r858362924


##########
sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java:
##########
@@ -93,19 +93,20 @@
 import org.apache.druid.utils.Throwables;
 
 import javax.annotation.Nullable;
-
 import java.io.Closeable;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Properties;
 import java.util.Set;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 public class DruidPlanner implements Closeable
 {
   private static final EmittingLogger log = new 
EmittingLogger(DruidPlanner.class);
+  private static final Pattern UNNAMED_COLUMN_PATTERN = 
Pattern.compile("EXPR\\$\\d+");

Review Comment:
   Done



##########
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:
   Changed



-- 
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