Uploaded image for project: 'Kylin'
  1. Kylin
  2. KYLIN-2841

LIMIT pushdown should be applied to subquery

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: v2.1.0
    • Fix Version/s: v2.6.0
    • Component/s: None
    • Labels:

      Description

      Hi, all.

      I found that limit in the web UI seems not behaving as expected.

      When I run a query like the follows:

      SELECT
        SUM(col3) AS col4, 
        SUM(col5) AS total_col5,
        col1 
      FROM
      (
        SELECT
          col1,
          col2,
          MAX(col3) AS col3,
          COUNT(*) AS col5
        FROM db.table
        WHERE col6 = 'somestring'
        GROUP BY col1, col2
      )
      GROUP BY col1
      

      When I specify the limit as 50, the result has 19 records, and when I specify the limit as 500000, there are 90+ records in the result and each record has higher col4 and total_col5.
      But for query that doesn't have subquery, the result remains the same no matter how I change the limit.

      I guess for the query with subquery, limit somehow limits the number of the result from the inner query instead of the result of the outer query.

        Attachments

        1. kylin-2841-apply-patch.txt
          50 kB
          Xiaoxiang Yu
        2. image-2018-12-14-00-23-08-869.png
          428 kB
          Xiaoxiang Yu
        3. image-2018-12-14-00-08-27-648.png
          188 kB
          Xiaoxiang Yu
        4. image-2018-12-14-00-05-19-114.png
          171 kB
          Xiaoxiang Yu
        5. kylin-2841-2.txt
          24 kB
          Xiaoxiang Yu
        6. kylin-2841-1.txt
          24 kB
          Xiaoxiang Yu
        7. image-2018-12-13-23-45-06-271.png
          542 kB
          Xiaoxiang Yu
        8. image-2018-12-13-23-41-53-732.png
          491 kB
          Xiaoxiang Yu
        9. 0001-KYLIN-2841-LIMIT-is-buggy-with-subquery.patch
          4 kB
          zhengdong

          Issue Links

            Activity

              People

              • Assignee:
                zhengd zhengdong
                Reporter:
                visualskyrim Mu Kong
              • Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: