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/05 18:23:37 UTC

[GitHub] [hive] scarlin-cloudera opened a new pull request, #3179: HIVE-26117: Remove 2 superfluous lines of code in genJoinRelNode

scarlin-cloudera opened a new pull request, #3179:
URL: https://github.com/apache/hive/pull/3179

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
     2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
     3. Ensure you have added or run the appropriate tests for your PR: 
     4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX:  Your PR title ...'.
     5. Be sure to keep the PR description updated to reflect all changes.
     6. Please write your PR title to summarize what this PR proposes.
     7. If possible, provide a concise example to reproduce the issue for a faster review.
   
   -->
   
   ### What changes were proposed in this pull request?
   Removed 2 lines of code that had no effect on compilation
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   
   
   ### Why are the changes needed?
   Dead code removed
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   
   
   ### How was this patch tested?
   Run through unit tests
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   -->
   


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


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

Posted by GitBox <gi...@apache.org>.
kasakrisz commented on code in PR #3179:
URL: https://github.com/apache/hive/pull/3179#discussion_r845281998


##########
ql/src/test/results/clientnegative/joinneg.q.out:
##########
@@ -1 +1 @@
-FAILED: SemanticException [Error 10004]: Line 6:12 Invalid table alias or column reference 'b': (possible column names are: x.key, x.value, y.key, y.value)
+FAILED: SemanticException [Error 10009]: Line 6:12 Invalid table alias 'b'

Review Comment:
   The original error message was more informative.



##########
ql/src/test/results/clientpositive/llap/views_explain_ddl.q.out:
##########
@@ -305,7 +305,7 @@ TBLPROPERTIES (
 ALTER TABLE db1.table2_n13 UPDATE STATISTICS SET('numRows'='0','rawDataSize'='0' );
 ALTER TABLE db1.table1_n19 UPDATE STATISTICS SET('numRows'='0','rawDataSize'='0' );
 
-CREATE VIEW `db1`.`v3_n3` AS SELECT `t1`.`key`, `t1`.`value`, `t2`.`key` `k` FROM `db1`.`table1_n19` `t1` JOIN `db1`.`table2_n13` `t2` ON `t1`.`key` = `t2`.`key`;
+CREATE VIEW `db1`.`v3_n3` AS SELECT `t1`.`key`, `t1`.`value`, `t2`.`key` `k` FROM `db1`.`table1_n19` `t1` JOIN `db1`.`table2_n13` `t2` ON t1.key = t2.key;

Review Comment:
   View expanded text changed: quotation removed from table and column names in join condition: 
   ```
   t1.key = t2.key
   ```
   should remain 
   ```
   `t1`.`key` = `t2`.`key`
   ```



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


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

Posted by GitBox <gi...@apache.org>.
scarlin-cloudera commented on code in PR #3179:
URL: https://github.com/apache/hive/pull/3179#discussion_r848792532


##########
ql/src/test/results/clientpositive/llap/views_explain_ddl.q.out:
##########
@@ -305,7 +305,7 @@ TBLPROPERTIES (
 ALTER TABLE db1.table2_n13 UPDATE STATISTICS SET('numRows'='0','rawDataSize'='0' );
 ALTER TABLE db1.table1_n19 UPDATE STATISTICS SET('numRows'='0','rawDataSize'='0' );
 
-CREATE VIEW `db1`.`v3_n3` AS SELECT `t1`.`key`, `t1`.`value`, `t2`.`key` `k` FROM `db1`.`table1_n19` `t1` JOIN `db1`.`table2_n13` `t2` ON `t1`.`key` = `t2`.`key`;
+CREATE VIEW `db1`.`v3_n3` AS SELECT `t1`.`key`, `t1`.`value`, `t2`.`key` `k` FROM `db1`.`table1_n19` `t1` JOIN `db1`.`table2_n13` `t2` ON t1.key = t2.key;

Review Comment:
   Makes sense.  Didn't know what the unparsed translator does until now, thanks!



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


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

Posted by GitBox <gi...@apache.org>.
scarlin-cloudera commented on code in PR #3179:
URL: https://github.com/apache/hive/pull/3179#discussion_r848792227


##########
ql/src/test/results/clientnegative/joinneg.q.out:
##########
@@ -1 +1 @@
-FAILED: SemanticException [Error 10004]: Line 6:12 Invalid table alias or column reference 'b': (possible column names are: x.key, x.value, y.key, y.value)
+FAILED: SemanticException [Error 10009]: Line 6:12 Invalid table alias 'b'

Review Comment:
   Agreed, but I think that's an issue for the new code.  I would rather remove the lines of code that converts to ExprNodes (but keep the unparsetranslator part.



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


[GitHub] [hive] scarlin-cloudera closed pull request #3179: HIVE-26117: Remove 2 superfluous lines of code in genJoinRelNode

Posted by GitBox <gi...@apache.org>.
scarlin-cloudera closed pull request #3179: HIVE-26117: Remove 2 superfluous lines of code in genJoinRelNode
URL: https://github.com/apache/hive/pull/3179


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


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

Posted by GitBox <gi...@apache.org>.
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


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

Posted by GitBox <gi...@apache.org>.
scarlin-cloudera commented on code in PR #3179:
URL: https://github.com/apache/hive/pull/3179#discussion_r848794055


##########
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 have mixed feelings about this.
   
   I don't particularly like making UnparseTranslator dependent on some of these other classes. I suppose RexNode and ASTNode do not matter too much since they will always be dependencies but i'm not thrilled about adding a dependency to RowResolver.
   
   Having said that, they are in the same package right now and it will be easy enough to separate them, so I don't mind doing what you propose.



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


[GitHub] [hive] github-actions[bot] commented on pull request #3179: HIVE-26117: Remove 2 superfluous lines of code in genJoinRelNode

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #3179:
URL: https://github.com/apache/hive/pull/3179#issuecomment-1153332738

   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
   Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.


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