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

show create table outputs invalid sql for partitioned tables with comments

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Impala 2.6.0, Impala 2.7.0
    • Fix Version/s: Impala 2.9.0
    • Component/s: Frontend
    • Labels:
    • Environment:
      CentOS 7, CDH 5.8.0

      Description

      Show create table for partitioned tables with comments results an invalid SQL. "COMMENT" comes before "PARTITIONED BY" instead of reversed.

      You can test it from shell with these commands:

      impala-shell --quiet -q 'create table if not exists parted_table_w_comment (i int) partitioned by (day string) comment "A partitioned table with comment"'
      impala-shell --quiet -Bq 'show create table parted_table_w_comment' -o /tmp/create_parted_table_w_comment.sql
      impala-shell --quiet -q 'drop table parted_table_w_comment'
      sed -i -r 's/^"|"$//' /tmp/create_parted_table_w_comment.sql # remove double-quotes from beginning and end
      impala-shell --quiet -f /tmp/create_parted_table_w_comment.sql
      

      The resulting error is rigthly:

      ERROR: AnalysisException: Syntax error in line 5:
      PARTITIONED BY (
      ^
      Encountered: PARTITIONED
      

        Activity

        Hide
        joemcdonnell Joe McDonnell added a comment -

        commit 5755261954d71b05b5e56c8659edd17de88b2d93
        Author: Joe McDonnell <joemcdonnell@cloudera.com>
        Date: Mon Jan 9 13:46:22 2017 -0800

        IMPALA-4036: invalid SQL generated for partitioned table with comment

        For a table that has both a table comment and a partition specified,
        "show create table" incorrectly outputs the comment before the partition.
        This is not the correct order, and it results in an invalid SQL.

        This transaction fixes the ordering (partition comes before comment) and
        adds tests for this case.

        Change-Id: I29a33cfd142b473997fdc3acfe3f0966bc7ed784
        Reviewed-on: http://gerrit.cloudera.org:8080/5648
        Tested-by: Impala Public Jenkins
        Reviewed-by: Henry Robinson <henry@cloudera.com>

        Show
        joemcdonnell Joe McDonnell added a comment - commit 5755261954d71b05b5e56c8659edd17de88b2d93 Author: Joe McDonnell <joemcdonnell@cloudera.com> Date: Mon Jan 9 13:46:22 2017 -0800 IMPALA-4036 : invalid SQL generated for partitioned table with comment For a table that has both a table comment and a partition specified, "show create table" incorrectly outputs the comment before the partition. This is not the correct order, and it results in an invalid SQL. This transaction fixes the ordering (partition comes before comment) and adds tests for this case. Change-Id: I29a33cfd142b473997fdc3acfe3f0966bc7ed784 Reviewed-on: http://gerrit.cloudera.org:8080/5648 Tested-by: Impala Public Jenkins Reviewed-by: Henry Robinson <henry@cloudera.com>

          People

          • Assignee:
            joemcdonnell Joe McDonnell
            Reporter:
            tothandor@gmail.com_impala_e66b Andor Tóth
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development