You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2016/11/09 09:04:58 UTC

[jira] [Commented] (CALCITE-1486) Invalid literal error for complex expression

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

Julian Hyde commented on CALCITE-1486:
--------------------------------------

I reproduced this:

{noformat}
diff --git a/core/src/test/resources/sql/misc.iq b/core/src/test/resources/sql/misc.iq
index 3874d69..9dcd07e 100644
--- a/core/src/test/resources/sql/misc.iq
+++ b/core/src/test/resources/sql/misc.iq
@@ -1195,6 +1195,10 @@ from "scott".dept;
 
 !ok
 
+# [CALCITE-1486] Invalid literal
+select 8388608/(60+27.39);
+!ok
+
 # [CALCITE-1120] Support SELECT without FROM
 select 2 + 2;
 +--------+
{noformat}

No, it's not OK. {{getOperandLiteralValue}} should assume that the operand is constant, but not that it is a literal. If it is not a literal it should use constant reduction.

> Invalid literal error for complex expression
> --------------------------------------------
>
>                 Key: CALCITE-1486
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1486
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.10.0
>            Reporter: Dongming Liu
>            Assignee: Julian Hyde
>
> SQL:
> {noformat}
> select 8388608/(60+27.39)
> {noformat}
> When I call the {code}sqlToRelConverter.convertQuery {code} convert the SqlNode to RelNode, an error as follow:
> {noformat}
> Exception in thread "main" java.lang.AssertionError: Internal error: invalid literal: 60 + 27.39
> 	at org.apache.calcite.util.Util.newInternal(Util.java:777)
> 	at org.apache.calcite.sql.SqlLiteral.value(SqlLiteral.java:350)
> 	at org.apache.calcite.sql.SqlCallBinding.getOperandLiteralValue(SqlCallBinding.java:219)
> 	at org.apache.calcite.sql.SqlBinaryOperator.getMonotonicity(SqlBinaryOperator.java:189)
> 	at org.apache.calcite.sql.SqlCall.getMonotonicity(SqlCall.java:180)
> 	at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectList(SqlToRelConverter.java:3502)
> 	at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:665)
> 	at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:622)
> 	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:2852)
> 	at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:556)
> 	at org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:227)
> {noformat}
> Is this OK?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)