caicancai commented on code in PR #3890:
URL: https://github.com/apache/calcite/pull/3890#discussion_r1698699164


##########
arrow/src/test/java/org/apache/calcite/adapter/arrow/ArrowAdapterTest.java:
##########
@@ -518,6 +518,56 @@ static void initializeArrowState(@TempDir Path 
sharedTempDir) throws IOException
         .explainContains(plan);
   }
 
+  @Test void testDecimalProject() {
+    String sql = "select SAL from EMP";
+    String plan = "PLAN=ArrowToEnumerableConverter\n"
+        + "  ArrowProject(SAL=[$5])\n"
+        + "    ArrowTableScan(table=[[ARROW, EMP]], fields=[[0, 1, 2, 3, 4, 5, 
6, 7]])\n\n";
+    String result = "SAL=800.00\n"
+        + "SAL=1600.00\n"
+        + "SAL=1250.00\n";
+    CalciteAssert.that()
+        .with(arrow)
+        .query(sql)
+        .limit(3)
+        .returns(result)
+        .explainContains(plan);
+  }
+
+  @Test void testCastDecimalToSmallInt() {
+    String sql = "select CAST(LOSAL AS SMALLINT) from SALGRADE";
+    String plan =
+        "PLAN=EnumerableCalc(expr#0..2=[{inputs}], 
expr#3=[CAST($t1):SMALLINT], EXPR$0=[$t3])\n"
+            + "  ArrowToEnumerableConverter\n"
+            + "    ArrowTableScan(table=[[ARROW, SALGRADE]], fields=[[0, 1, 
2]])\n\n";
+    String result = "EXPR$0=700\n";
+
+    CalciteAssert.that()
+        .with(arrow)
+        .query(sql)
+        .typeIs("[EXPR$0 SMALLINT]")
+        .limit(1)
+        .returns(result)
+        .explainContains(plan);
+  }
+
+  @Test void testCastDecimalToTinyInt() {

Review Comment:
   ```
     @Test void testCastDecimalToFloat() {
       String sql = "select CAST(LOSAL AS FLOAT) as \"extra\" from SALGRADE";
       String plan = "PLAN=EnumerableCalc(expr#0..2=[{inputs}],"
           + " expr#3=[CAST($t1):FLOAT], extra=[$t3])\n"
           + "  ArrowToEnumerableConverter\n"
           + "    ArrowTableScan(table=[[ARROW, SALGRADE]], fields=[[0, 1, 
2]])\n\n";
       String result = "extra=700.0\nextra=1201.0\n";
   
       CalciteAssert.that()
           .with(arrow)
           .query(sql)
           .typeIs("[extra FLOAT]")
           .limit(2)
           .returns(result)
           .explainContains(plan);
     }
   ```
   This is the current cast test of arrow adapter
   
   It seems that the arrow adapter does not support similar pushdown at 
present, but I think it can be adapted in new jira cases in the future. This is 
a new feature. At present, my PR is just to add a simple test



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

Reply via email to