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

Chunwei Lei edited comment on CALCITE-4081 at 7/31/20, 7:29 AM:
----------------------------------------------------------------

> Shouldn't RexExecutor have thrown? 11111111111111111111111111111111.111111 is 
>not a valid value (or DECIMAL(38, 6) is not a valid type, or something).

It should. With my fix[1], it would throw an exception while it is caught by 
RexExecutable[2].

[1] [https://github.com/apache/calcite/pull/2089]

[2][https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rex/RexExecutable.java#L88]


was (Author: chunwei lei):
> Shouldn't RexExecutor have thrown? 11111111111111111111111111111111.111111 is 
>not a valid value (or DECIMAL(38, 6) is not a valid type, or something).

It should. With my fix[1], it would throw an exception while it is caught by 
RexExecutable[2].

[1] [https://github.com/apache/calcite/pull/2089]

[2][https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rex/RexExecutable.java#L88]

 

> Round-tripping a DECIMAL literal through Planner -> RelToSqlConverter -> 
> Planner throws validation error
> --------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-4081
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4081
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Steven Talbot
>            Assignee: Chunwei Lei
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> Take the following SQL:
> SELECT CAST('11111111111111111111111111111111.111111' AS DECIMAL(38,6)) AS 
> "num"
> And, in the default Calcite SQL dialect with all defaults, send it through 
> Planner parse -> valiate -> rel to get a RelNode. The RelNode will have a 
> Project with the "111111111111111.11111" literal in there as a RexLiteral 
> with Decimal type. 
>  
> The use RelToSqlConverter to convert that RelNode back to SQL. The SQL now 
> looks like 
> SELECT 11111111111111111111111111111111.111111 AS "num"
>  
> If you attempt to parse and validate that SQL, you get "Numeric literal 
> '11111111111111111111111111111111.111111' out of range" throw by 
> SqlValidatorImpl.validateLiteral()



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to