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

Inserting data into Hive table from a query, when the query is a partitioned table and select * ,will generate a SemanticException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 0.10.0
    • None
    • Query Processor
    • None
    • Apache Hadoop 0.19.1 + Apache Hive 0.10.0

    Description

      Inserting data into Hive table from a query , when the query is : select * from a_partitioned_table, will throw a SemanticException .
      It seems that "*" contains the virtual partition columns.

      drop table if exists zr_test;
      create table if not exists zr_test (key string, value string) partitioned by (dt string);

      drop table if exists zr_test_1;
      create table if not exists zr_test_1 (key string, value string) partitioned by (dt string);

      --Query One
      explain
      insert into table zr_test partition (dt='20130217') select key, value from zr_test_1 where dt='20130217';

      --Query Two
      explain
      insert into table zr_test partition (dt='20130217') select * from zr_test_1 where dt='20130217';

      Ouery One works well, bug Query Two failed with the following information:
      FAILED: SemanticException [Error 10044]: Line 2:18 Cannot insert into target table because column number/types are different ''20130217'': Table insclause-0 has 2 columns, but query has 3 columns.

      p.s:
      Query Two works well on Apache Hadoop 0.20.1 + Hive 0.10.0

      Attachments

        1. HIVE-4032-1.patch
          0.9 kB
          caofangkun

        Activity

          People

            caofangkun caofangkun
            caofangkun caofangkun
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: