You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "caicancai (via GitHub)" <gi...@apache.org> on 2024/07/29 15:46:37 UTC

[PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

caicancai opened a new pull request, #3890:
URL: https://github.com/apache/calcite/pull/3890

   part of [6305](https://issues.apache.org/jira/browse/CALCITE-6305)


-- 
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3890:
URL: https://github.com/apache/calcite/pull/3890#discussion_r1700465435


##########
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() {

Review Comment:
   ```
     @Test void testCastDecimalToTinyInt() {
       String sql = "select CAST(LOSAL AS TINYINT) from SALGRADE";
       String plan =
           "PLAN=EnumerableCalc(expr#0..2=[{inputs}], expr#3=[CAST($t1):TINYINT], 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 TINYINT]")
           .limit(1)
           .returns(result)
           .explainContains(plan);
     }
   ```
   This test will fail, but I don't know how to describe it with a test
   The arrow adapter still has a lot of problems, I'm not sure if adding these tests will be useful
   I borrowed from: https://github.com/apache/datafusion-comet
   



##########
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() {

Review Comment:
   This will fail. I tried it. I think I should think about how to show this failure case in the 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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3890:
URL: https://github.com/apache/calcite/pull/3890#discussion_r1698704446


##########
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() {

Review Comment:
   This will fail. I tried it. I think I should think about how to show this failure case in the 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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #3890:
URL: https://github.com/apache/calcite/pull/3890#discussion_r1697299634


##########
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() {

Review Comment:
   If you really want to test the functionality of the cast you should test a case where the value is too large for the target type.



-- 
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on PR #3890:
URL: https://github.com/apache/calcite/pull/3890#issuecomment-2256294643

   Through some testing I found some bugs, I will open a jira case to discuss


-- 
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #3890:
URL: https://github.com/apache/calcite/pull/3890#issuecomment-2256367829

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3890) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3890&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_calcite&pullRequest=3890&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_calcite&pullRequest=3890&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3890&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_calcite&pullRequest=3890&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_calcite&pullRequest=3890)
   
   


-- 
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #3890:
URL: https://github.com/apache/calcite/pull/3890#discussion_r1697759245


##########
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:
   According to the generated plan, the CAST function can't push down to Arrow. So this is a test of the EnumerableCalc successfully executing the CAST function.  Is there any other reason why we need to cover these tests here?



-- 
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on PR #3890:
URL: https://github.com/apache/calcite/pull/3890#issuecomment-2258676550

   @mihaibudiu PATL, thanks. There may be some bugs in other tests, I will open a jira case to fix them


-- 
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "mihaibudiu (via GitHub)" <gi...@apache.org>.
mihaibudiu commented on code in PR #3890:
URL: https://github.com/apache/calcite/pull/3890#discussion_r1700553412


##########
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() {

Review Comment:
   You are testing a feature which does not really work.
   Is there an issue for the bug? If there is you can add the negative test and disable it until the bug is fixed.



-- 
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "NobiGo (via GitHub)" <gi...@apache.org>.
NobiGo commented on code in PR #3890:
URL: https://github.com/apache/calcite/pull/3890#discussion_r1697810845


##########
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:
   Hi, @caicancai  AFAIK, `EnumerableCalc(expr#0..2=[{inputs}], expr#3=[CAST($t1):SMALLINT], EXPR$0=[$t3])` means we execute the CAST by Enumerable. If we can push down the CAST, the top plan will be `ArrowToEnumerableConverter`.  



-- 
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai closed pull request #3890: Add Some testcast and testDecimalProject for the Arrow adapter
URL: https://github.com/apache/calcite/pull/3890


-- 
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3890:
URL: https://github.com/apache/calcite/pull/3890#discussion_r1697806954


##########
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:
   I noticed that there are similar tests, such as testCastDecimalToInt. I don't know how this test is related to pushdown. I would be grateful if you can answer my doubts.



-- 
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@calcite.apache.org

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


Re: [PR] Add Some testcast and testDecimalProject for the Arrow adapter [calcite]

Posted by "caicancai (via GitHub)" <gi...@apache.org>.
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);
     }
   ```
   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: commits-unsubscribe@calcite.apache.org

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