clintropolis commented on a change in pull request #10605:
URL: https://github.com/apache/druid/pull/10605#discussion_r553811715
##########
File path: core/src/test/java/org/apache/druid/math/expr/FunctionTest.java
##########
@@ -519,6 +519,31 @@ public void testLeast()
assertExpr("least(1, null, 'A')", "1");
}
+ @Test
+ public void testBitwise()
+ {
+ assertExpr("bitwiseAnd(3, 1)", 1L);
+ assertExpr("bitwiseAnd(2, 1)", 0L);
+ assertExpr("bitwiseOr(3, 1)", 3L);
+ assertExpr("bitwiseOr(2, 1)", 3L);
+ assertExpr("bitwiseXor(3, 1)", 2L);
+ assertExpr("bitwiseXor(2, 1)", 3L);
+ assertExpr("bitwiseShiftLeft(2, 1)", 4L);
+ assertExpr("bitwiseShiftRight(2, 1)", 1L);
+ assertExpr("bitwiseAnd(bitwiseComplement(1), 7)", 6L);
+ assertExpr("bitwiseAnd('2', '1')", null);
+ assertExpr("bitwiseAnd(2, '1')", 0L);
+
+ assertExpr("bitwiseOr(2.345, 1)", 4612462889363109315L);
Review comment:
more exhaustive coverage which should include these combinations is done
in `VectorExprSanityTest`, where non-vectorized and vectorized evaluation
results are asserted to be equal with a variety of combinations of inputs, but
I can add explicit tests here since those don't necessarily confirm
correctness, just self consistency between the two evaluation modes.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]