[ 
https://issues.apache.org/jira/browse/CALCITE-7056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17978589#comment-17978589
 ] 

Yu Xu commented on CALCITE-7056:
--------------------------------

I currently have a fix idea in mind: Since it may be converted to a RexCall of 
Some, in this case, there is no need to do 
RexSubQuery conversion. Can we distinguish whether it is a subquery, and if 
not, just do the default processing? 
If it is OK,would be:
{code:java}
@Test void testQuantifyOperatorsWithTypeCoercion() {
  final String query = "SELECT timestamp '1970-01-01 01:23:45' = any 
(array[timestamp '1970-01-01 01:23:45',"
      + "timestamp '1970-01-01 01:23:46'])";
  final String expected = "SELECT TIMESTAMP '1970-01-01 01:23:45' ="
      + " SOME ARRAY[TIMESTAMP '1970-01-01 01:23:45', TIMESTAMP '1970-01-01 
01:23:46']\n"
      + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")";
  sql(query)
      .withCalcite().ok(expected);
} {code}
Please help evaluate this solution. [~nobigo]

> Convert RelNode to Sql failed when the RelNode includes quantify operators
> --------------------------------------------------------------------------
>
>                 Key: CALCITE-7056
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7056
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: xiong duan
>            Priority: Major
>
> {code:java}
> @Test void testQuantifyOperatorsWithTypeCoercion() {
>   final String query = "SELECT '1970-01-01 01:23:45' = any (array[timestamp 
> '1970-01-01 01:23:45',"
>       + "timestamp '1970-01-01 01:23:46'])";
>   final String expected = "SELECT '1970-01-01 01:23:45' = any 
> (array[timestamp '1970-01-01 01:23:45',"
>       + "timestamp '1970-01-01 01:23:46'])";
>   sql(query)
>       .withCalcite().ok(expected);
> } {code}
> It throws an exception :
> {code:java}
> class org.apache.calcite.rex.RexCall cannot be cast to class 
> org.apache.calcite.rex.RexSubQuery (org.apache.calcite.rex.RexCall and 
> org.apache.calcite.rex.RexSubQuery are in unnamed module of loader 
> 'app'){code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to