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

invalid tuple_idx when combining INSERT INTO with analytic subquery

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: Impala 2.1
    • Fix Version/s: Impala 2.2.7, Impala 2.3.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      RHEL 6.5 and CENTOS 6.4

      Description

      The following query is producing invalid tuple_idx when executing. If the INSRET INTO is changed into a CREATE TABLE AS statement it executes fine.

      CREATE TABLE test1  (a bigint, b string, c string)
      PARTITIONED BY (d int);
      
      CREATE TABLE test2  (a bigint, b string, c string)
      PARTITIONED BY (d int);
      
      INSERT INTO test2
      PARTITION(d)
      SELECT 
            SUM(a) OVER (
                  PARTITION BY b ORDER BY c ROWS UNBOUNDED PRECEDING
                  )
             AS a
         ,b
         ,c
         ,d
      FROM test1;
      

      Workaround
      Force expression materialization via a UNION ALL as follows:

      INSERT INTO test2
      PARTITION(d)
      SELECT 
      SUM(a) OVER (
      PARTITION BY b ORDER BY c ROWS UNBOUNDED PRECEDING
      )
      AS a
      ,b
      ,c
      ,d
      FROM test1
      UNION ALL <--- Adding UNION ALL with the SELECT statement below is the workaround
      SELECT NULL, NULL, NULL, NULL from test1 WHERE false;
      

        Attachments

          Activity

            People

            • Assignee:
              alex.behm Alexander Behm
              Reporter:
              tmgstev Tristan Stevens
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: