Sercan Tekin created HIVE-28301:
-----------------------------------

             Summary: Vectorization: CASE WHEN Returns Wrong Result in 
Hive-3.1.3
                 Key: HIVE-28301
                 URL: https://issues.apache.org/jira/browse/HIVE-28301
             Project: Hive
          Issue Type: Bug
          Components: Vectorization
    Affects Versions: 3.1.3
            Reporter: Sercan Tekin


*STEPS TO REPRODUCE:*

Create a table and insert data into it:
{code:java}
CREATE TABLE tbl_1 (col_1 STRING);
INSERT INTO tbl_1 VALUES ('G'),('G'),('not G'),('G'),('G'),('G');
{code}

Submit the below query:
{code:java}
SELECT DISTINCT (
    CASE
        WHEN col_1 = "G" THEN "Value_1"
        WHEN substr(LPAD(col_1,3,"0") ,1,1) = "G" THEN "Value_2"
        ELSE "Value_3"
    END) AS G
FROM tbl_1;
{code}

Actual result:
{code:java}
3alue_1
Value_1
Value_3
nValue_
{code}

Expected result (This is what Hive-2.3 returns):
{code:java}
Value_1
Value_3
{code}

Workaround:
Either:
{code:java}
SET hive.vectorized.execution.enabled=false;
{code}

Or reverting https://issues.apache.org/jira/browse/HIVE-16731.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to