You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Tim Armstrong (JIRA)" <ji...@apache.org> on 2019/06/13 17:12:00 UTC
[jira] [Updated] (IMPALA-8664) Inconsistent result by integer
multiply NULL
[ https://issues.apache.org/jira/browse/IMPALA-8664?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Armstrong updated IMPALA-8664:
----------------------------------
Component/s: Frontend
> Inconsistent result by integer multiply NULL
> --------------------------------------------
>
> Key: IMPALA-8664
> URL: https://issues.apache.org/jira/browse/IMPALA-8664
> Project: IMPALA
> Issue Type: Bug
> Components: Frontend
> Affects Versions: Impala 2.11.0
> Reporter: Hajime Osako
> Priority: Major
>
> h3. A: "SELECT 1 * (NULL)" and "SELECT 1 * (CASE ...)" returns different result:
> Expected result "null":
> {code:sql}
> 0: jdbc:hive2://test> SELECT 1 * (NULL);
> null
> {code}
> The CASE part returns NULL, so expected same as above, but actually Exception:
> {code:sql}
> 0: jdbc:hive2://test> select 1 * (CASE WHEN '1' IS NULL THEN NULL ELSE NULL END);
> Error: AnalysisException: Arithmetic operation requires numeric operands: 1 * (CASE WHEN '1' IS NULL THEN NULL ELSE NULL END) (state=HY000,code=0)
> {code}
> h3. B: Using aggregation in CASE or without returns different result:
> As per A, below query failing is kind of understandable:
> {code:sql}
> 0: jdbc:hive2://test> SELECT (-1 * CASE WHEN SUM(1) IS NULL THEN NULL WHEN COALESCE(NULL, 0) = 0 THEN NULL ELSE 0 END) FROM (SELECT 1 as col1, 2 as col2) dummy_t;
> Error: AnalysisException: Arithmetic operation requires numeric operands: (-1 * CASE WHEN sum(1) IS NULL THEN NULL ELSE NULL END) (state=HY000,code=0)
> {code}
> But, removing SUM returns different result (no exception...):
> {code:sql}
> 0: jdbc:hive2://test> SELECT (-1 * CASE WHEN COALESCE(NULL, 0) = 0 THEN NULL ELSE 0 END) FROM (SELECT 1 as col1, 2 as col2) dummy_t;
> null
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org