deniskuzZ commented on code in PR #5409:
URL: https://github.com/apache/hive/pull/5409#discussion_r1813072472


##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConvertJoinMapJoin.java:
##########
@@ -657,22 +661,41 @@ private boolean convertJoinBucketMapJoin(JoinOperator 
joinOp, OptimizeTezProcCon
     boolean updatePartitionCols = false;
     List<Integer> positions = new ArrayList<>();
 
+    final CustomBucketFunction bucketFunction;
     if (listBucketCols.get(0).size() != bigTablePartitionCols.size()) {
       updatePartitionCols = true;
       // Prepare updated partition columns for small table(s).
       // Get the positions of bucketed columns
 
       int bigTableExprPos = 0;
       Map<String, ExprNodeDesc> colExprMap = bigTableRS.getColumnExprMap();
+      final boolean[] retainedColumns = new 
boolean[listBucketCols.get(0).size()];
       for (ExprNodeDesc bigTableExpr : bigTablePartitionCols) {
         // It is guaranteed there is only 1 list within listBucketCols.
-        for (String colName : listBucketCols.get(0)) {
+        for (int i = 0; i < listBucketCols.get(0).size(); i++) {
+          final String colName = listBucketCols.get(0).get(i);
           if (colExprMap.get(colName).isSame(bigTableExpr)) {
             positions.add(bigTableExprPos);
+            retainedColumns[i] = true;
           }
         }
         bigTableExprPos = bigTableExprPos + 1;
       }
+
+      Preconditions.checkState(opTraits.getCustomBucketFunctions().size() == 
1);
+      if (opTraits.getCustomBucketFunctions().get(0) == null) {
+        bucketFunction = null;

Review Comment:
   set default to `null` or `opTraits.getCustomBucketFunctions().get(0)` and 
avoid unnecessary conditional checks



##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConvertJoinMapJoin.java:
##########
@@ -657,22 +661,41 @@ private boolean convertJoinBucketMapJoin(JoinOperator 
joinOp, OptimizeTezProcCon
     boolean updatePartitionCols = false;
     List<Integer> positions = new ArrayList<>();
 
+    final CustomBucketFunction bucketFunction;
     if (listBucketCols.get(0).size() != bigTablePartitionCols.size()) {
       updatePartitionCols = true;
       // Prepare updated partition columns for small table(s).
       // Get the positions of bucketed columns
 
       int bigTableExprPos = 0;
       Map<String, ExprNodeDesc> colExprMap = bigTableRS.getColumnExprMap();
+      final boolean[] retainedColumns = new 
boolean[listBucketCols.get(0).size()];
       for (ExprNodeDesc bigTableExpr : bigTablePartitionCols) {
         // It is guaranteed there is only 1 list within listBucketCols.
-        for (String colName : listBucketCols.get(0)) {
+        for (int i = 0; i < listBucketCols.get(0).size(); i++) {
+          final String colName = listBucketCols.get(0).get(i);
           if (colExprMap.get(colName).isSame(bigTableExpr)) {
             positions.add(bigTableExprPos);
+            retainedColumns[i] = true;
           }
         }
         bigTableExprPos = bigTableExprPos + 1;
       }
+
+      Preconditions.checkState(opTraits.getCustomBucketFunctions().size() == 
1);
+      if (opTraits.getCustomBucketFunctions().get(0) == null) {
+        bucketFunction = null;

Review Comment:
   set default to `null` or even `opTraits.getCustomBucketFunctions().get(0)` 
and avoid unnecessary conditional checks



-- 
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-unsubscr...@hive.apache.org

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


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

Reply via email to