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

Query get stuck when containing multiple nested union

    XMLWordPrintableJSON

Details

    • Question
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 4.0.0
    • Impala 4.1.0
    • Frontend
    • None
    • ghx-label-11

    Description

      When query contains multiple union, and encounter a expr rewrite. Then this query will do 'reAnalyze', and get stuck in 'reset' method. Here is the example to reproduce this bug:

      SELECT `t1`.`dt`
      FROM
        (SELECT *
         FROM
           (SELECT *
            FROM
              (SELECT *
               FROM
                 (SELECT *
                  FROM
                    (SELECT *
                     FROM
                       (SELECT *
                        FROM
                          (SELECT *
                           FROM
                             (SELECT *
                              FROM
                                (SELECT *
                                 FROM
                                   (SELECT *
                                    FROM
                                      (SELECT *
                                       FROM
                                         (SELECT *
                                          FROM
                                            (SELECT *
                                             FROM
                                               (SELECT *
                                                FROM
                                                  (SELECT *
                                                   FROM
                                                     (SELECT *
                                                      FROM
                                                        (SELECT *
                                                         FROM
                                                           (SELECT *
                                                            FROM
                                                              (SELECT *
                                                               FROM
                                                                 (SELECT *
                                                                  FROM
                                                                    (SELECT *
                                                                     FROM
                                                                       (SELECT *
                                                                        FROM
                                                                          (SELECT *
                                                                           FROM
                                                                             (SELECT *
                                                                              FROM
                                                                                (SELECT *
                                                                                 FROM
                                                                                   (SELECT *
                                                                                    FROM
                                                                                      (SELECT *
                                                                                       FROM
                                                                                         (SELECT *
                                                                                          FROM
                                                                                            (SELECT *
                                                                                             FROM
                                                                                               (SELECT *
                                                                                                FROM
                                                                                                  (SELECT '20211020' AS `dt`
                                                                                                   UNION ALL SELECT '20211021' AS `dt`) AS `t`
                                                                                                UNION ALL SELECT '20211022' AS `dt`) AS `t`
                                                                                             UNION ALL SELECT '20211023' AS `dt`) AS `t`
                                                                                          UNION ALL SELECT '20211024' AS `dt`) AS `t`
                                                                                       UNION ALL SELECT '20211025' AS `dt`) AS `t`
                                                                                    UNION ALL SELECT '20211026' AS `dt`) AS `t`
                                                                                 UNION ALL SELECT '20211027' AS `dt`) AS `t`
                                                                              UNION ALL SELECT '20211028' AS `dt`) AS `t`
                                                                           UNION ALL SELECT '20211029' AS `dt`) AS `t`
                                                                        UNION ALL SELECT '20211030' AS `dt`) AS `t`
                                                                     UNION ALL SELECT '20211031' AS `dt`) AS `t`
                                                                  UNION ALL SELECT '20211101' AS `dt`) AS `t`
                                                               UNION ALL SELECT '20211102' AS `dt`) AS `t`
                                                            UNION ALL SELECT '20211103' AS `dt`) AS `t`
                                                         UNION ALL SELECT '20211104' AS `dt`) AS `t`
                                                      UNION ALL SELECT '20211105' AS `dt`) AS `t`
                                                   UNION ALL SELECT '20211106' AS `dt`) AS `t`
                                                UNION ALL SELECT '20211107' AS `dt`) AS `t`
                                             UNION ALL SELECT '20211108' AS `dt`) AS `t`
                                          UNION ALL SELECT '20211109' AS `dt`) AS `t`
                                       UNION ALL SELECT '20211110' AS `dt`) AS `t`
                                    UNION ALL SELECT '20211111' AS `dt`) AS `t`
                                 UNION ALL SELECT '20211112' AS `dt`) AS `t`
                              UNION ALL SELECT '20211113' AS `dt`) AS `t`
                           UNION ALL SELECT '20211114' AS `dt`) AS `t`
                        UNION ALL SELECT '20211115' AS `dt`) AS `t`
                     UNION ALL SELECT '20211116' AS `dt`) AS `t`
                  UNION ALL SELECT '20211117' AS `dt`) AS `t`
               UNION ALL SELECT '20211118' AS `dt`) AS `t`
            UNION ALL SELECT '20211119' AS `dt`) AS `t`
         UNION ALL SELECT '20211120' AS `dt`) AS `t1`
      CROSS JOIN
        (SELECT 1000+1000) AS `t2`
      GROUP BY `t1`.`dt`;
      

      This query may take long time to execute, such as ten minutes. If we reduce 'UNION', the query will execute quickly.

      Attachments

        Activity

          People

            skyyws Sheng Wang
            skyyws Sheng Wang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: