Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-22641

Columns returned in sorted order when show columns query is run with no search pattern.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • 3.1.0
    • None
    • Hive, HiveServer2

    Description

      In Hive 1.2.1 and 2.0 while displaying columns for a table, it used to return in same order as it was created. for example

      create table col_order_test(server_name string, task_name string, partition_name string, start_time string, end_time string, table_owner string, table_name string) stored as orc;
      show columns in col_order_test;
      
      +-----------------+--+
      |      field      |
      +-----------------+--+
      | server_name     |
      | task_name       |
      | partition_name  |
      | start_time      |
      | end_time        |
      | table_owner     |
      | table_name      |
      +-----------------+--+
      

      For Hive 3 columns are returned in sorted order for the same query, below is output.

      create table col_order_test(server_name string, task_name string, partition_name string, start_time string, end_time string, table_owner string, table_name string) stored as orc;
      show columns in col_order_test;
      
      +-----------------+
      |      field      |
      +-----------------+
      | end_time        |
      | partition_name  |
      | server_name     |
      | start_time      |
      | table_name      |
      | table_owner     |
      | task_name       |
      +-----------------+
      

      Above behavior looks to be changed with the introduction of search column feature as part of Jira HIVE-18373

      This behavior change can cause an existing process to fail in a few environments, for example, code to generate the INSERT OVERWRITE in a different manner, which may result in query failure.

      I would like to request a community if we can improve the Jira HIVE-18373 by returning column order same as it was created if the search pattern provided by the user is null.

      Attaching patch with the change.

      Attachments

        1. HIVE-22641.patch
          2 kB
          Chiran Ravani

        Issue Links

          Activity

            People

              chiran54321 Chiran Ravani
              chiran54321 Chiran Ravani
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m