amansinha100 commented on a change in pull request #1381: DRILL-6475: Unnest: 
Null fieldId Pointer.
URL: https://github.com/apache/drill/pull/1381#discussion_r203259439
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/planner/physical/visitor/AdjustOperatorsRowTypeVisitor.java
 ##########
 @@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.planner.physical.visitor;
+
+import java.util.ArrayList;
+import java.util.List;
+import com.google.common.base.Preconditions;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeField;
+import org.apache.calcite.rex.RexBuilder;
+import org.apache.calcite.rex.RexNode;
+import org.apache.drill.exec.planner.physical.JoinPrel;
+import org.apache.drill.exec.planner.physical.LateralJoinPrel;
+import org.apache.drill.exec.planner.physical.Prel;
+import org.apache.calcite.rel.RelNode;
+
+import com.google.common.collect.Lists;
+import org.apache.drill.exec.planner.physical.UnnestPrel;
+
+/**
+ * AdjustOperatorsRowTypeVisitor visits corresponding operators' which 
depending upon their functionality
+ * adjusts their output row types. The adjusting mechanism is unique to each 
operator. In case of joins this visitor
+ * adjusts the field names to make sure that upstream operator only sees that 
there are unique field names even though
+ * the children of the join has same field names. Whereas in case of 
lateral/unnest operators it changes the correlated
+ * field and also the unnest operator's output row type.
+ */
+public class AdjustOperatorsRowTypeVisitor extends BasePrelVisitor<Prel, Void, 
RuntimeException>{
+
+  private Prel currentLateralJoin = null;
+
+  private static AdjustOperatorsRowTypeVisitor INSTANCE = new 
AdjustOperatorsRowTypeVisitor();
+
+  public static Prel adjustRowType(Prel prel){
+    return prel.accept(INSTANCE, null);
+  }
+
+  private void register(Prel prel) {
+    this.currentLateralJoin = prel;
 
 Review comment:
   The registerPrel and unregisterPrel imply that they are working with any 
arbitrary physical rel, not specifically with lateral join.  Why not use a more 
generic name instead of currentLateralJoin because in future another operator 
may need to register a different physical rel.   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to