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

Incorrect results - Analytic functions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Not A Bug
    • Impala 2.5.0
    • None
    • Frontend
    • DB: functional

    Description

      The following query returns 1000 rows with no NULLS.

      Query:

      SELECT
        COALESCE(
          LEAD('251', 70) OVER (ORDER BY a3.smallint_col DESC, a3.int_col DESC), 
          LEAD('168', 64) OVER (ORDER BY a3.smallint_col DESC, a4.double_col ASC)
        ) AS char_col
      FROM 
        alltypes a3
        INNER JOIN alltypesagg a4 ON ((a4.date_string_col) = (a3.date_string_col)) AND ((a4.day) = (a3.bigint_col))
      

      However the following 2 queries, which are subsets return NULLS.

      SELECT
        LEAD('251', 70) OVER (ORDER BY a3.smallint_col DESC, a3.int_col DESC)
      FROM 
        alltypes a3
        INNER JOIN alltypesagg a4 ON ((a4.date_string_col) = (a3.date_string_col)) AND ((a4.day) = (a3.bigint_col))
      
      SELECT
        LEAD('168', 64) OVER (ORDER BY a3.smallint_col DESC, a4.double_col ASC)
      FROM 
        alltypes a3
        INNER JOIN alltypesagg a4 ON ((a4.date_string_col) = (a3.date_string_col)) AND ((a4.day) = (a3.bigint_col))
      

      Also when the original query is executed in Postgres, some NULLS are returned.

      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: