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

Propagate analytic tuple predicates of outer-joined InlineView

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • Impala 4.3.0
    • None
    • None

    Description

      In some cases, direct pushing down predicates that reference analytic tuple into inline view leads to incorrect query results. such as sql:

      WITH detail_measure AS (
        SELECT
          *
        FROM
          (
            VALUES
              (
                1 AS `isqbiuar`,
                1 AS `bgsfrbun`,
                1 AS `result_type`,
                1 AS `bjuzzevg`
              ),
              (2, 2, 2, 2)
          ) a
      ),
      order_measure_sql0 AS (
        SELECT
          row_number() OVER (
            ORDER BY
              row_number_0 DESC NULLS LAST,
              isqbiuar ASC NULLS LAST
          ) AS `row_number_0`,
          `isqbiuar`
        FROM
          (
            VALUES
              (1 AS `row_number_0`, 1 AS `isqbiuar`),
              (2, 2)
          ) b
      )
      SELECT
        detail_measure.`isqbiuar` AS `isqbiuar`,
        detail_measure.`bgsfrbun` AS `bgsfrbun`,
        detail_measure.`result_type` AS `result_type`,
        detail_measure.`bjuzzevg` AS `bjuzzevg`,
        `row_number_0` AS `row_number_0`
      FROM
        detail_measure
        LEFT JOIN order_measure_sql0 ON order_measure_sql0.isqbiuar = detail_measure.isqbiuar
      WHERE
        row_number_0 BETWEEN 1
        AND 1
      ORDER BY
        `row_number_0` ASC NULLS LAST,
        `bgsfrbun` ASC NULLS LAST

      The current query result is:

      The correct query result is:

       

      Attachments

        1. image-2023-04-07-11-57-13-571.png
          7 kB
          ZhuMinghui
        2. image-2023-04-07-11-57-59-883.png
          6 kB
          ZhuMinghui

        Activity

          People

            ZhuMinghui ZhuMinghui
            ZhuMinghui ZhuMinghui
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: