Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-4336

Wrong results with nested union operands due to missing casts.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • Impala 2.3.0, Impala 2.5.0, Impala 2.4.0, Impala 2.6.0, Impala 2.7.0
    • Impala 2.8.0
    • Frontend

    Description

      Unions with nested unions can produce incorrect results due to missing casts.
      This bug can happen for both UNION ALL and UNION DISTINCT.

      Repro:

      create table t (d double);
      insert into t values(5.5);
      
      select d from t union all values(cast(6.2 as float));
      +------------------------+
      | d                      |
      +------------------------+
      | 5.5                    |
      | 5.369229582389968e-315 |
      +------------------------+
      
      select d from t union all (select 10 union all select 20);
      +------------------------+
      | d                      |
      +------------------------+
      | 5.5                    |
      | 4.940656458412465e-323 |
      | 9.881312916824931e-323 |
      +------------------------+
      

      The underlying problem is that after unnesting unions we need to re-apply casts to the exprs of the unnested operands which my not be the same as the exprs of the original operand.

      Attachments

        Activity

          People

            alex.behm Alexander Behm
            alex.behm Alexander Behm
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: