abstractdog commented on code in PR #6456:
URL: https://github.com/apache/hive/pull/6456#discussion_r3473562241


##########
ql/src/test/results/clientnegative/mergejoin_skew_abort.q.out:
##########
@@ -0,0 +1,70 @@
+PREHOOK: query: CREATE TABLE merge_skew_abort_a (testColKey_A int, 
testColValue_A string)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@merge_skew_abort_a
+POSTHOOK: query: CREATE TABLE merge_skew_abort_a (testColKey_A int, 
testColValue_A string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@merge_skew_abort_a
+PREHOOK: query: CREATE TABLE merge_skew_abort_b (testColKey_B int, 
testColValue_B string)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@merge_skew_abort_b
+POSTHOOK: query: CREATE TABLE merge_skew_abort_b (testColKey_B int, 
testColValue_B string)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@merge_skew_abort_b
+PREHOOK: query: INSERT INTO TABLE merge_skew_abort_a VALUES (1, 'a1'), (1, 
'a2'), (1, 'a3'), (1, 'a4'),(2, 'b1')
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@merge_skew_abort_a
+POSTHOOK: query: INSERT INTO TABLE merge_skew_abort_a VALUES (1, 'a1'), (1, 
'a2'), (1, 'a3'), (1, 'a4'),(2, 'b1')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@merge_skew_abort_a
+POSTHOOK: Lineage: merge_skew_abort_a.testcolkey_a SCRIPT []
+POSTHOOK: Lineage: merge_skew_abort_a.testcolvalue_a SCRIPT []
+PREHOOK: query: INSERT INTO TABLE merge_skew_abort_b VALUES (1, 'x1'), (2, 
'y1')
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@merge_skew_abort_b
+POSTHOOK: query: INSERT INTO TABLE merge_skew_abort_b VALUES (1, 'x1'), (2, 
'y1')
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@merge_skew_abort_b
+POSTHOOK: Lineage: merge_skew_abort_b.testcolkey_b SCRIPT []
+POSTHOOK: Lineage: merge_skew_abort_b.testcolvalue_b SCRIPT []
+PREHOOK: query: SELECT a.testColKey_A, a.testColValue_A, b.testColValue_B
+FROM merge_skew_abort_a a JOIN merge_skew_abort_b b ON a.testColKey_A = 
b.testColKey_B
+PREHOOK: type: QUERY
+PREHOOK: Input: default@merge_skew_abort_a
+PREHOOK: Input: default@merge_skew_abort_b
+#### A masked pattern was here ####
+Status: Failed
+Vertex failed, vertexName=Reducer 2, vertexId=vertex_#ID#, diagnostics=[Task 
failed, taskId=task_#ID#, diagnostics=[TaskAttempt 0 failed, info=[Error: Error 
while running task ( failure ) : attempt_#ID#:java.lang.RuntimeException: 
org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while 
processing row
+#### A masked pattern was here ####
+Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime 
Error while processing row
+#### A masked pattern was here ####
+Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Data skew 
detected in merge join: 2 rows accumulated for join column(s) [testcolkey_a] in 
table alias [a]. Consider reviewing data distribution.
+#### A masked pattern was here ####
+], TaskAttempt 1 failed, info=[Error: Error while running task ( failure ) : 
attempt_#ID#:java.lang.RuntimeException: 
org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime Error while 
processing row
+#### A masked pattern was here ####
+Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Hive Runtime 
Error while processing row
+#### A masked pattern was here ####
+Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Data skew 
detected in merge join: 2 rows accumulated for join column(s) [testcolkey_a] in 
table alias [a]. Consider reviewing data distribution.
+#### A masked pattern was here ####
+]], Vertex did not succeed due to OWN_TASK_FAILURE, failedTasks:1 
killedTasks:0, Vertex vertex_#ID# [Reducer 2] killed/failed due 
to:OWN_TASK_FAILURE]
+DAG did not succeed due to VERTEX_FAILURE. failedVertices:1 killedVertices:0

Review Comment:
   I believe this is going to be masked after 
[HIVE-29656](https://issues.apache.org/jira/browse/HIVE-29656), so needs to be 
changed here



##########
ql/src/test/org/apache/hadoop/hive/ql/optimizer/metainfo/query/TestJoinOperationMetadataResolver.java:
##########
@@ -0,0 +1,441 @@
+/*
+ * 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.optimizer.metainfo.query;
+
+import org.apache.hadoop.hive.ql.exec.ColumnInfo;
+import org.apache.hadoop.hive.ql.exec.JoinOperator;
+import org.apache.hadoop.hive.ql.exec.Operator;
+import org.apache.hadoop.hive.ql.exec.ReduceSinkOperator;
+import org.apache.hadoop.hive.ql.exec.RowSchema;
+import org.apache.hadoop.hive.ql.exec.TableScanOperator;
+import org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc;
+import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
+import org.apache.hadoop.hive.ql.plan.OperatorDesc;
+import org.apache.hadoop.hive.ql.plan.ReduceSinkDesc;
+import org.apache.hadoop.hive.ql.plan.TableScanDesc;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Unit tests for {@link JoinOperationMetadataResolver}.
+ * <p>
+ * All Hive operator/plan objects are mocked so the test has no Hadoop/Hive
+ * runtime dependency.
+ */
+class TestJoinOperationMetadataResolver {
+
+  /**
+   * Tracks the intermediate "schema-parent" operator created by 
rsWithColumnKey/rsWithColumnKeys
+   * so that attachTso() can wire the TSO into the correct position in the 
chain.
+   */
+  private final Map<ReduceSinkOperator, Operator<OperatorDesc>> schemaParents 
= new HashMap<>();
+  private JoinOperationMetadataResolver resolver;
+
+  @BeforeEach
+  void setUp() {

Review Comment:
   nit: it's strange for me that these unit tests are not public, I got used to 
see it, can you please fix



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