caicancai commented on code in PR #4032:
URL: https://github.com/apache/calcite/pull/4032#discussion_r1832684717
##########
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"
Review Comment:
done
##########
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 testArrowProjectFieldsWithIsFalseFilter() {
+ 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";
+
+ CalciteAssert.that()
+ .with(arrow)
+ .query(sql)
+ .limit(2)
+ .returns(result)
+ .explainContains(plan);
+ }
+
+
+ @Test void testArrowProjectFieldsWithIsNotTrueFilter() {
+ String sql = "select \"booleanField\"\n"
+ + "from arrowdatatype\n"
+ + "where \"booleanField\" is not true";
Review Comment:
done
--
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]