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

Incorrect result (Analytic Functions)

    XMLWordPrintableJSON

Details

    Description

      The query should clearly return 0 rows, however 2 rows are returned.

      Query:

      SELECT
      LEAD(-496, 81) OVER (ORDER BY t1.double_col DESC, t1.id ASC) AS int_col
      FROM alltypestiny t1
      WHERE
      5 = 6
      UNION
      SELECT
      794.67 AS decimal_col
      FROM alltypes t1
      WHERE
      5 = 6
      

      Result:

      +---------+
      | int_col |
      +---------+
      | NULL    |
      | 794.67  |
      +---------+
      

      Plan:

      +--------------------------------------------------------------+
      | Explain String                                               |
      +--------------------------------------------------------------+
      | Estimated Per-Host Requirements: Memory=170.00MB VCores=2    |
      |                                                              |
      | 10:EXCHANGE [UNPARTITIONED]                                  |
      | |                                                            |
      | 09:AGGREGATE [FINALIZE]                                      |
      | |  group by: int_col                                         |
      | |                                                            |
      | 08:EXCHANGE [HASH(int_col)]                                  |
      | |                                                            |
      | 05:AGGREGATE                                                 |
      | |  group by: int_col                                         |
      | |                                                            |
      | 00:UNION                                                     |
      | |                                                            |
      | |--04:SCAN HDFS [functional.alltypes t1]                     |
      | |     partitions=24/24 files=24 size=478.45KB                |
      | |                                                            |
      | 07:EXCHANGE [RANDOM]                                         |
      | |                                                            |
      | 03:ANALYTIC                                                  |
      | |  functions: lead(-496, 81, NULL)                           |
      | |  order by: double_col DESC, id ASC                         |
      | |  window: ROWS BETWEEN UNBOUNDED PRECEDING AND 81 FOLLOWING |
      | |                                                            |
      | 06:MERGING-EXCHANGE [UNPARTITIONED]                          |
      | |  order by: double_col DESC, id ASC                         |
      | |                                                            |
      | 02:SORT                                                      |
      | |  order by: double_col DESC, id ASC                         |
      | |                                                            |
      | 01:SCAN HDFS [functional.alltypestiny t1]                    |
      |    partitions=4/4 files=4 size=460B                          |
      +--------------------------------------------------------------+
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: