Hive
  1. Hive
  2. HIVE-881

CTAS does not work on with fields terminator

    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
    • Release Note:
      HIVE-881. CTAS to work with fields terminator. (Ning Zhang via zshao)

      Description

      This query got wrong results:

      create table tmp row format fields terminated by ',' stored as textfile as select * from nzhang_tt;

      The result is the same as no "fields terminated by".

      1. Hive-881.patch
        44 kB
        Ning Zhang
      2. Hive-881_2.patch
        52 kB
        Ning Zhang

        Activity

        Hide
        Ning Zhang added a comment -

        That's right. Exporting results to a local file may be used for porting to other DBMSs. I'll open another JIRA.

        Show
        Ning Zhang added a comment - That's right. Exporting results to a local file may be used for porting to other DBMSs. I'll open another JIRA.
        Hide
        Zheng Shao added a comment -

        By the way, as a use case for "CREATE EXTERNAL TABLE AS", CTAS and "INSERT OVERWRITE DIRECTORY" will share almost exactly the same code, and HIVE-634 can be solved as well.

        Show
        Zheng Shao added a comment - By the way, as a use case for "CREATE EXTERNAL TABLE AS", CTAS and "INSERT OVERWRITE DIRECTORY" will share almost exactly the same code, and HIVE-634 can be solved as well.
        Hide
        Zheng Shao added a comment -

        Committed. Thanks Ning!

        Show
        Zheng Shao added a comment - Committed. Thanks Ning!
        Hide
        Zheng Shao added a comment -

        Looks good. Can you add a bootcamp task for that?
        I will commit this one as soon as it passes the test.

        Show
        Zheng Shao added a comment - Looks good. Can you add a bootcamp task for that? I will commit this one as soon as it passes the test.
        Hide
        Ning Zhang added a comment -

        It's probably not hard to create external table in CTAS. It was left out just because it's probably not very useful to create an external table holding the query results (seems the motivation for external table is that the data are already there and we just want queriability on them). If there are really needs to create external tables, we can make it a bootcamp task. The only think need to change is probably the parser, the file location, and the FileSink's destination URI.

        The CTAS currently support row format serde (there is a test case in ctas.q and an example in the wiki documentation).

        Show
        Ning Zhang added a comment - It's probably not hard to create external table in CTAS. It was left out just because it's probably not very useful to create an external table holding the query results (seems the motivation for external table is that the data are already there and we just want queriability on them). If there are really needs to create external tables, we can make it a bootcamp task. The only think need to change is probably the parser, the file location, and the FileSink's destination URI. The CTAS currently support row format serde (there is a test case in ctas.q and an example in the wiki documentation).
        Hide
        Zheng Shao added a comment -

        Also, do we support "ROW FORMAT SERDE" as well?

        Show
        Zheng Shao added a comment - Also, do we support "ROW FORMAT SERDE" as well?
        Hide
        Zheng Shao added a comment -

        +1.
        BTW, how hard it is to support "CREATE EXTERNAL TABLE"? If not, we might want to add that feature in as well.

        Show
        Zheng Shao added a comment - +1. BTW, how hard it is to support "CREATE EXTERNAL TABLE"? If not, we might want to add that feature in as well.
        Hide
        Ning Zhang added a comment -

        add support to LineTerminator, FieldEscape, etc in row format. Also fixed an existing bug in genScriptPlan

        Show
        Ning Zhang added a comment - add support to LineTerminator, FieldEscape, etc in row format. Also fixed an existing bug in genScriptPlan
        Hide
        Ning Zhang added a comment -

        Hive-881.patch fixes this bug.

        Show
        Ning Zhang added a comment - Hive-881.patch fixes this bug.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development