You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/04/30 10:36:42 UTC

[GitHub] [iotdb] flashzxi opened a new pull request, #5744: [IOTDB-3048] Refactor binary transformer

flashzxi opened a new pull request, #5744:
URL: https://github.com/apache/iotdb/pull/5744

   A lot of switch case statements are used in BinaryTransformer, and the enum 
   
   TransformerType seems to be redundant. We can rewrite it wilh sbstract methods
   


-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] SteveYurongSu merged pull request #5744: [IOTDB-3048] Refactor binary transformer

Posted by GitBox <gi...@apache.org>.
SteveYurongSu merged PR #5744:
URL: https://github.com/apache/iotdb/pull/5744


-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] SteveYurongSu commented on a diff in pull request #5744: [IOTDB-3048] Refactor binary transformer

Posted by GitBox <gi...@apache.org>.
SteveYurongSu commented on code in PR #5744:
URL: https://github.com/apache/iotdb/pull/5744#discussion_r862464593


##########
server/src/main/java/org/apache/iotdb/db/query/udf/core/transformer/binary/CompareNonEqualTransformer.java:
##########
@@ -29,12 +33,24 @@ public CompareNonEqualTransformer(
   }
 
   @Override
-  protected TransformerType getTransformerType() {
-    return TransformerType.EqNeq;
+  protected void transformAndCache() throws QueryProcessException, IOException {
+    if (leftPointReader.getDataType() == TSDataType.BOOLEAN
+        && rightPointReader.getDataType() == TSDataType.BOOLEAN) {
+      cachedBoolean = evaluate(leftPointReader.currentBoolean(), rightPointReader.currentBoolean());
+    } else {
+      cachedBoolean =
+          evaluate(
+              castCurrentValueToDoubleOperand(leftPointReader),
+              castCurrentValueToDoubleOperand(rightPointReader));
+    }
+  }
+
+  protected boolean evaluate(boolean leftOperand, boolean rightOperand) {
+    return leftOperand == rightOperand;

Review Comment:
   ```suggestion
       return leftOperand != rightOperand;
   ```



-- 
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: reviews-unsubscribe@iotdb.apache.org

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