Hive
  1. Hive
  2. HIVE-912

table name in CTAS should be case-insensitive

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.5.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Table created in CTAS should be case sensitive. Currently the moveTask at the end of CTAS doesn't convert table name to lower case. This makes subsequent accessing to the table impossible since they are looking for lower case table names.

      1. Hive-912_3.patch
        15 kB
        Ning Zhang
      2. Hive-912_2.patch
        15 kB
        Ning Zhang
      3. Hive-912.patch
        14 kB
        Ning Zhang

        Activity

        Hide
        Ning Zhang added a comment -

        Uploading patch Hive-912.patch.

        Show
        Ning Zhang added a comment - Uploading patch Hive-912.patch.
        Hide
        Namit Jain added a comment -

        The changes look good - just a minor comment.
        Do you need to change odbc/src/cpp/hiveclienthelper.cpp ?

        Also, can you add a test for create table (not ctas) also ?

        Show
        Namit Jain added a comment - The changes look good - just a minor comment. Do you need to change odbc/src/cpp/hiveclienthelper.cpp ? Also, can you add a test for create table (not ctas) also ?
        Hide
        Prasad Chakka added a comment -

        are you about the regular create table stmt is case sensitive? I remember putting some unit-tests for that.

        Show
        Prasad Chakka added a comment - are you about the regular create table stmt is case sensitive? I remember putting some unit-tests for that.
        Hide
        Ning Zhang added a comment -

        I think most DDL cases works fine (case insensitive). I have manually tested some and all works. But I've seen diffs in the POSTHOOK when running unittests. Some examples are uniquejoin.q.out
        [junit] < POSTHOOK: Output: default@t1
        [junit]
        [junit] > POSTHOOK: Output: default@T1

        My change will be to convert table names to lower case in the createTableDesc at the very beginning of analyzing DDL statement. This will guarantee all code paths using the createTableDesc will see lower cased table names.

        Show
        Ning Zhang added a comment - I think most DDL cases works fine (case insensitive). I have manually tested some and all works. But I've seen diffs in the POSTHOOK when running unittests. Some examples are uniquejoin.q.out [junit] < POSTHOOK: Output: default@t1 [junit] — [junit] > POSTHOOK: Output: default@T1 My change will be to convert table names to lower case in the createTableDesc at the very beginning of analyzing DDL statement. This will guarantee all code paths using the createTableDesc will see lower cased table names.
        Hide
        Namit Jain added a comment -

        Also, I remember Oracle used to support "" for preserving case sensitive stuff.
        What will happen in that case with Hive ?

        Show
        Namit Jain added a comment - Also, I remember Oracle used to support "" for preserving case sensitive stuff. What will happen in that case with Hive ?
        Hide
        Ning Zhang added a comment -

        I thought Oracle's syntax would be put double quote around identifiers so that they won't be interpreted as keywords (e.g. "--tablename" won't be interpretated as comment). Hive use the back single quote for that purpose. I don't know whether Oracle preseves case though.

        Anyway, I changed it back to use case-sensitive names in createTableDesc but only convert to lower case when moveTask move to a file. A new patch is attached. Also added a simple test case for non-CTAS in case there isn't one.

        Show
        Ning Zhang added a comment - I thought Oracle's syntax would be put double quote around identifiers so that they won't be interpreted as keywords (e.g. "--tablename" won't be interpretated as comment). Hive use the back single quote for that purpose. I don't know whether Oracle preseves case though. Anyway, I changed it back to use case-sensitive names in createTableDesc but only convert to lower case when moveTask move to a file. A new patch is attached. Also added a simple test case for non-CTAS in case there isn't one.
        Hide
        Namit Jain added a comment -

        +1

        looks good
        will merge if the tests pass

        Show
        Namit Jain added a comment - +1 looks good will merge if the tests pass
        Hide
        Namit Jain added a comment -

        Can you remove the new table nzhang_Tmp in ctas.q at the end ?
        Some of the tests are failing because of that.

        Show
        Namit Jain added a comment - Can you remove the new table nzhang_Tmp in ctas.q at the end ? Some of the tests are failing because of that.
        Hide
        Ning Zhang added a comment -

        Fixed the test file as commented by Namit.

        Show
        Ning Zhang added a comment - Fixed the test file as commented by Namit.
        Hide
        Namit Jain added a comment -

        +1

        looks good

        Show
        Namit Jain added a comment - +1 looks good
        Hide
        Namit Jain added a comment -

        Committed. Thanks Ning

        Show
        Namit Jain added a comment - Committed. Thanks Ning

          People

          • Assignee:
            Ning Zhang
            Reporter:
            Ning Zhang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development