Review Board 1.7.22


HIVE-5297 Hive does not honor type for partition columns

Review Request #14155 - Created Sept. 16, 2013 and updated

Vikram Dixit Kumaraswamy
trunk
HIVE-5297
Reviewers
hive
ashutoshc
hive-git
Hive does not consider the type of the partition column while writing partitions. Consider for example the query:

create table tab1 (id1 int, id2 string) PARTITIONED BY(month string,day int) row format delimited fields terminated by ',';
alter table tab1 add partition (month='June', day='second');

Hive accepts this query. However if you try to select from this table and insert into another expecting schema match, it will insert nulls instead.
Ran all tests.
common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
Revision 350c348 New Change
[20] 801 lines
[+20] [+] public class HiveConf extends Configuration {
802
    SERVER_READ_SOCKET_TIMEOUT("hive.server.read.socket.timeout", 10),
802
    SERVER_READ_SOCKET_TIMEOUT("hive.server.read.socket.timeout", 10),
803
    SERVER_TCP_KEEP_ALIVE("hive.server.tcp.keepalive", true),
803
    SERVER_TCP_KEEP_ALIVE("hive.server.tcp.keepalive", true),
804

    
   
804

   
805
    // Whether to show the unquoted partition names in query results.
805
    // Whether to show the unquoted partition names in query results.
806
    HIVE_DECODE_PARTITION_NAME("hive.decode.partition.name", false),
806
    HIVE_DECODE_PARTITION_NAME("hive.decode.partition.name", false),

    
   
807

   

    
   
808
    HIVE_TYPE_CHECK_ON_INSERT("hive.typecheck.on.insert", true),
807
    ;
809
    ;
808

    
   
810

   
809
    public final String varname;
811
    public final String varname;
810
    public final String defaultVal;
812
    public final String defaultVal;
811
    public final int defaultIntVal;
813
    public final int defaultIntVal;
[+20] [20] 464 lines
ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java
Revision 393ef57 New Change
 
ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java
Revision a704462 New Change
 
ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
Revision 0c01749 New Change
 
ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java
Revision 767f545 New Change
 
ql/src/test/queries/clientnegative/illegal_partition_type.q
New File
 
ql/src/test/queries/clientnegative/illegal_partition_type2.q
New File
 
ql/src/test/queries/clientpositive/alter_partition_coltype.q
Revision 4d2e02f New Change
 
ql/src/test/queries/clientpositive/partition_type_check.q
New File
 
ql/src/test/results/clientnegative/alter_table_add_partition.q.out
Revision bd9c148 New Change
 
ql/src/test/results/clientnegative/alter_view_failure5.q.out
Revision 4edb82c New Change
 
ql/src/test/results/clientnegative/illegal_partition_type.q.out
New File
 
ql/src/test/results/clientnegative/illegal_partition_type2.q.out
New File
 
ql/src/test/results/clientpositive/alter_partition_coltype.q.out
Revision fe16fdd New Change
 
ql/src/test/results/clientpositive/partition_type_check.q.out
New File
 
  1. common/src/java/org/apache/hadoop/hive/conf/HiveConf.java: Loading...
  2. ql/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java: Loading...
  3. ql/src/java/org/apache/hadoop/hive/ql/parse/BaseSemanticAnalyzer.java: Loading...
  4. ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java: Loading...
  5. ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java: Loading...
  6. ql/src/test/queries/clientnegative/illegal_partition_type.q: Loading...
  7. ql/src/test/queries/clientnegative/illegal_partition_type2.q: Loading...
  8. ql/src/test/queries/clientpositive/alter_partition_coltype.q: Loading...
  9. ql/src/test/queries/clientpositive/partition_type_check.q: Loading...
  10. ql/src/test/results/clientnegative/alter_table_add_partition.q.out: Loading...
  11. ql/src/test/results/clientnegative/alter_view_failure5.q.out: Loading...
  12. ql/src/test/results/clientnegative/illegal_partition_type.q.out: Loading...
  13. ql/src/test/results/clientnegative/illegal_partition_type2.q.out: Loading...
  14. ql/src/test/results/clientpositive/alter_partition_coltype.q.out: Loading...
  15. ql/src/test/results/clientpositive/partition_type_check.q.out: Loading...