mihaibudiu commented on code in PR #4032:
URL: https://github.com/apache/calcite/pull/4032#discussion_r1828384689
##########
arrow/src/main/java/org/apache/calcite/adapter/arrow/ArrowTranslator.java:
##########
@@ -133,6 +133,15 @@ private String translateMatch2(RexNode node) {
return translateUnary("isnull", (RexCall) node);
case IS_NOT_NULL:
return translateUnary("isnotnull", (RexCall) node);
+ case IS_NOT_TRUE:
+ return translateUnary("isnottrue", (RexCall) node);
+ case IS_NOT_FALSE:
+ return translateUnary("isnotfalse", (RexCall) node);
+ case INPUT_REF:
Review Comment:
I don't understand why this assumes the type of the result is boolean.
##########
arrow/src/test/java/org/apache/calcite/adapter/arrow/ArrowAdapterDataTypesTest.java:
##########
@@ -176,4 +176,94 @@ static void initializeArrowState(@TempDir Path
sharedTempDir)
.returns(result)
.explainContains(plan);
}
+
+ @Test void testBooleanProject() {
+ String sql = "select \"booleanField\" from arrowdatatype";
+ String plan = "PLAN=ArrowToEnumerableConverter\n"
+ + " ArrowProject(booleanField=[$7])\n"
+ + " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1,
2, 3, 4, 5, 6, 7, 8, 9]])\n\n";
+ String result =
"booleanField=null\nbooleanField=true\nbooleanField=false\n";
+ CalciteAssert.that()
+ .with(arrow)
+ .query(sql)
+ .limit(3)
+ .returns(result)
+ .explainContains(plan);
+ }
+
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-6638">[CALCITE-6638]
+ * Arrow adapter should support IS FALSE Operator and IS TRUE Operator</a>.
*/
+ @Test void testArrowProjectWithIsTrueFilter() {
+ String sql = "select \"booleanField\"\n"
+ + "from arrowdatatype\n"
+ + "where \"booleanField\" is true";
+ String plan = "PLAN=ArrowToEnumerableConverter\n"
+ + " ArrowProject(booleanField=[$7])\n"
+ + " ArrowFilter(condition=[$7])\n"
+ + " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1,
2, 3, 4, 5, 6, 7, 8, 9]])\n\n";
+ String result = "booleanField=true\nbooleanField=true\n";
+
+ CalciteAssert.that()
+ .with(arrow)
+ .query(sql)
+ .limit(2)
+ .returns(result)
+ .explainContains(plan);
+ }
+
+ @Test void testArrowProjectFieldsWithNotFilter() {
+ String sql = "select \"booleanField\"\n"
+ + "from arrowdatatype\n"
+ + "where \"booleanField\" is false";
+ String plan = "PLAN=ArrowToEnumerableConverter\n"
+ + " ArrowProject(booleanField=[$7])\n"
+ + " ArrowFilter(condition=[NOT($7)])\n"
+ + " ArrowTableScan(table=[[ARROW, ARROWDATATYPE]], fields=[[0, 1,
2, 3, 4, 5, 6, 7, 8, 9]])\n\n";
+ String result = "booleanField=false\nbooleanField=false\n";
Review Comment:
why is this result correct?
There aren't two rows where the field is false
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]