You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "David Ross (JIRA)" <ji...@apache.org> on 2019/03/22 18:54:00 UTC
[jira] [Updated] (HIVE-21494) Wrong CASE branch chosen seemingly
dependent on contents of branch
[ https://issues.apache.org/jira/browse/HIVE-21494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
David Ross updated HIVE-21494:
------------------------------
Component/s: CBO
> Wrong CASE branch chosen seemingly dependent on contents of branch
> ------------------------------------------------------------------
>
> Key: HIVE-21494
> URL: https://issues.apache.org/jira/browse/HIVE-21494
> Project: Hive
> Issue Type: Bug
> Components: CBO
> Affects Versions: 3.1.0
> Reporter: David Ross
> Priority: Major
>
> The following query returns {{-100}} which is logically incorrect:
>
> {code:java}
> SELECT
> CASE
> WHEN COALESCE(
> CASE
> WHEN COALESCE( CAST('Infinity' AS DOUBLE), 0 ) = 0
> THEN -1
> ELSE ( 5 / (CAST('Infinity' AS DOUBLE) * SIGN(5)) )
> END, 0 ) = 0
> THEN (
> CAST('Infinity' AS DOUBLE)
> -- -200
> )
> ELSE -100
> END full_query{code}
>
> The expected behavior is for it to return {{Infinity}}, or the contents of the {{THEN}} branch.
>
> If the {{THEN}} branch is edited like this, it returns -{{200}} as expected:
>
> {code:java}
> SELECT
> CASE
> WHEN COALESCE(
> CASE
> WHEN COALESCE( CAST('Infinity' AS DOUBLE), 0 ) = 0
> THEN -1
> ELSE ( 5 / (CAST('Infinity' AS DOUBLE) * SIGN(5)) )
> END, 0 ) = 0
> THEN (
> -- CAST('Infinity' AS DOUBLE)
> -200
> )
> ELSE -100
> END full_query{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)