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 2021/06/14 07:46:19 UTC

[GitHub] [hive] kasakrisz commented on a change in pull request #2381: HIVE-25224: Multi insert statements involving tables with different bucketing_versions results in error

kasakrisz commented on a change in pull request #2381:
URL: https://github.com/apache/hive/pull/2381#discussion_r649926112



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/optimizer/BucketVersionPopulator.java
##########
@@ -131,22 +132,47 @@ private OpGroup newGroup(NodeProcessorCtx procCtx) {
     }
   }
 
+  enum InfoType {
+    MANDATORY, OPTIONAL,
+  };
+
   /**
    * This class represents the version required by an Operator.
    */
-  private static class OperatorBucketingVersionInfo {
+  static class OperatorBucketingVersionInfo {
+
+    public static final Comparator<OperatorBucketingVersionInfo> MANDATORY_FIRST =
+        new Comparator<BucketVersionPopulator.OperatorBucketingVersionInfo>() {
 
+          @Override
+          public int compare(OperatorBucketingVersionInfo i1, OperatorBucketingVersionInfo i2) {
+            int r = i1.infoType.compareTo(i2.infoType);
+            if (r != 0) {
+              // mandatory first
+              return r;
+            }
+            r = i2.bucketingVersion - i1.bucketingVersion;

Review comment:
       nit. `Integer.compare(i2.bucketingVersion, i1.bucketingVersion)` can be used here.




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

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