Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-13733

CTE + "IS NULL" predicate + column aliasing as existing column leads to wrong results

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 1.1.0
    • None
    • None
    • None

    Description

      hive> create table t (i int,a string,b string);
      hive> insert into t values (1,'hello','world'),(2,'bye',null);
      hive> select * from t where t.b is null;
      2 bye NULL

      This is wrong, all 3 columns should return the same value - t.a.

      hive> with cte as (select t.a as a,t.a as b,t.a as c from t where t.b is null) select * from cte;
      bye NULL bye

      However, these are right:

      hive> select t.a as a,t.a as b,t.a as c from t where t.b is null;
      bye bye bye

      hive> with cte as (select t.a as a,t.a as b,t.a as c from t where t.b is not null) select * from cte;OK
      hello hello hello

      Attachments

        Issue Links

          Activity

            People

              pxiong Pengcheng Xiong
              dmarkovitz Dudu Markovitz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: