You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2022/04/12 11:59:48 UTC

[GitHub] [hive] kgyrtkirk commented on a diff in pull request #3179: HIVE-26117: Remove 2 superfluous lines of code in genJoinRelNode

kgyrtkirk commented on code in PR #3179:
URL: https://github.com/apache/hive/pull/3179#discussion_r848327228


##########
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java:
##########
@@ -2643,15 +2643,17 @@ private RelNode genJoinRelNode(RelNode leftRel, String leftTableAlias, RelNode r
             count++;
           }
           joinCond = count > 1 ? and : equal;
-        } else if (unparseTranslator != null && unparseTranslator.isEnabled()) {
-          genAllExprNodeDesc(joinCond, input, jCtx);
         }
         Map<ASTNode, RexNode> exprNodes = RexNodeTypeCheck.genExprNodeJoinCond(
             joinCond, jCtx, cluster.getRexBuilder());
         if (jCtx.getError() != null) {
           throw new SemanticException(SemanticAnalyzer.generateErrorMessage(jCtx.getErrorSrcNode(),
               jCtx.getError()));
         }
+        for (Map.Entry<ASTNode, RexNode> entry : exprNodes.entrySet()) {
+          UnparseTranslatorHelper.addTranslationIfNeeded(entry.getKey(), entry.getValue(),

Review Comment:
   I think we are kinda approach a point where we should have the unparse translator enabled at all times...
   I wonder how much we gain by keeping the support to have it disabled...



##########
ql/src/java/org/apache/hadoop/hive/ql/parse/UnparseTranslatorHelper.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * 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.hadoop.hive.ql.parse;
+
+import org.apache.calcite.rex.RexInputRef;
+import org.apache.calcite.rex.RexNode;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.hadoop.hive.ql.exec.ColumnInfo;
+import org.apache.hadoop.hive.ql.metadata.HiveUtils;
+
+/**
+ * Class containing static methods that help populate the UnparseTranslator.
+ */
+public class UnparseTranslatorHelper {
+
+  /**
+   * Adds translation to the unparseTranslator for the RexNode if it is a RexInputRef.
+   * Grabs the inputRef information from the given RowResolver.
+   */
+  public static void addTranslationIfNeeded(ASTNode astNode, RexNode rexNode, RowResolver rr,

Review Comment:
   I think it would make sense to have this inside the `UnparseTranslator` class instead...(I don't think there will be more functions added in the near future)



-- 
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: gitbox-unsubscribe@hive.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org