[
https://issues.apache.org/jira/browse/CALCITE-4345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17221362#comment-17221362
]
Jiatao Tao edited comment on CALCITE-4345 at 10/27/20, 12:12 PM:
-----------------------------------------------------------------
"isNumericLiteralEqualTo" seems to expand the scope, we need to consider all
the type, I can combine "isIntLiteral" with "intValue" as a new method like
"isIntLiteralEqual(RexNode, int)".
was (Author: aron.tao):
As I said in PR:
If we think "null" is not a reasonable "int literal", I can add this condition
to "isIntLiteral"
The [@vlsi|https://github.com/vlsi] mentioned (overflow case) is not the same,
if isIntLiteral(decimal) returns false, we already know it is not an int, why
do we still use intValue(decimal)? Please tell me if I am wrong
"isNumericLiteralEqualTo" seems to expand the scope, we need to consider all
the type, I can combine "isIntLiteral" with "intValue" as a new method like
"isIntLiteralEqualTo(RexNode, int)".
> SUM CASE WHEN xxx THEN 1 without "ELSE" throws NPE in
> AggregateCaseToFilterRule
> -------------------------------------------------------------------------------
>
> Key: CALCITE-4345
> URL: https://issues.apache.org/jira/browse/CALCITE-4345
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Jiatao Tao
> Assignee: Jiatao Tao
> Priority: Major
> Labels: pull-request-available
> Attachments: image-2020-10-19-16-59-44-900.png
>
> Time Spent: 3h 40m
> Remaining Estimate: 0h
>
> Add a test in CsvTest:
>
> {code:java}
> @Test void testSumCaseWhenWithoutElse() throws SQLException {
> sql("model", "select sum( CASE WHEN empno=10 THEN 1 END ) from EMPS").ok();
> }
> {code}
> Will throw NPE
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)