You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/12/22 16:23:14 UTC

[GitHub] [calcite] jinxing64 commented on a change in pull request #1676: [CALCITE-3591] Add bit_xor aggregate function

jinxing64 commented on a change in pull request #1676: [CALCITE-3591] Add bit_xor aggregate function
URL: https://github.com/apache/calcite/pull/1676#discussion_r360715293
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java
 ##########
 @@ -1552,9 +1554,15 @@ public Expression implementResult(AggContext info,
       Expression acc = add.accumulator().get(0);
       Expression arg = add.arguments().get(0);
       SqlAggFunction aggregation = info.aggregation();
-      final Method method = (aggregation == BIT_AND
-          ? BuiltInMethod.BIT_AND
-          : BuiltInMethod.BIT_OR).method;
+
+      BuiltInMethod builtInMethod = BuiltInMethod.BIT_AND;
+      if (aggregation == BIT_OR) {
+        builtInMethod = BuiltInMethod.BIT_OR;
+      } else if (aggregation == BIT_XOR) {
+        builtInMethod = BuiltInMethod.BIT_XOR;
+      }
 
 Review comment:
   Shall we do it like be below ?
   ```
   if (aggregation  == BIT_AND) {
     ...
   } else if (BIT_OR) {
     ...
   } else if (BIT_XOR) {
     ...
   } else {
     throw IllegalArgumentException
   }
   ```
   Or `Switch` is also cool for me.

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


With regards,
Apache Git Services