Yuming Wang created HIVE-24049:
----------------------------------

             Summary: Forbid binary type as partition column
                 Key: HIVE-24049
                 URL: https://issues.apache.org/jira/browse/HIVE-24049
             Project: Hive
          Issue Type: Bug
            Reporter: Yuming Wang


Use binary type as partition column maybe has data issue.
{noformat}
hive> create table t1(id int) partitioned by (part binary);
OK
Time taken: 3.307 seconds
hive> insert into t1 PARTITION(part) select 1 as id, cast('a' as binary) as 
part;
WARNING: Hive-on-MR is deprecated in Hive 2 and may not be available in the 
future versions. Consider using a different execution engine (i.e. spark, tez) 
or using Hive 1.X releases.
Query ID = yumwang_20200819144033_5eb6d723-edeb-4e17-8509-c658ad89c2a3
Total jobs = 3
Launching Job 1 out of 3
Number of reduce tasks is set to 0 since there's no reduce operator
Job running in-process (local Hadoop)
2020-08-19 14:40:36,083 Stage-1 map = 100%,  reduce = 0%
Ended Job = job_local247252310_0001
Stage-4 is selected by condition resolver.
Stage-3 is filtered out by condition resolver.
Stage-5 is filtered out by condition resolver.
Moving data to directory 
file:/Users/yumwang/Downloads/apache-hive-2.3.7-bin/tmp/t1/.hive-staging_hive_2020-08-19_14-40-33_789_7653530788805518878-1/-ext-10000
Loading data to table default.t1 partition (part=null)

Loaded : 1/1 partitions.
         Time taken to load dynamic partitions: 4.029 seconds
         Time taken for adding to write entity : 0.001 seconds
MapReduce Jobs Launched:
Stage-Stage-1:  HDFS Read: 0 HDFS Write: 0 SUCCESS
Total MapReduce CPU Time Spent: 0 msec
OK
Time taken: 6.591 seconds
hive> insert into t1 PARTITION(part) select 1 as id, cast('b' as binary) as 
part;
WARNING: Hive-on-MR is deprecated in Hive 2 and may not be available in the 
future versions. Consider using a different execution engine (i.e. spark, tez) 
or using Hive 1.X releases.
Query ID = yumwang_20200819144045_1f112d6d-effa-4d81-87e8-9326015289f1
Total jobs = 3
Launching Job 1 out of 3
Number of reduce tasks is set to 0 since there's no reduce operator
Job running in-process (local Hadoop)
2020-08-19 14:40:47,537 Stage-1 map = 100%,  reduce = 0%
Ended Job = job_local698238180_0002
Stage-4 is selected by condition resolver.
Stage-3 is filtered out by condition resolver.
Stage-5 is filtered out by condition resolver.
Moving data to directory 
file:/Users/yumwang/Downloads/apache-hive-2.3.7-bin/tmp/t1/.hive-staging_hive_2020-08-19_14-40-45_908_8062651574733580526-1/-ext-10000
Loading data to table default.t1 partition (part=null)

Loaded : 1/1 partitions.
         Time taken to load dynamic partitions: 0.15 seconds
         Time taken for adding to write entity : 0.0 seconds
MapReduce Jobs Launched:
Stage-Stage-1:  HDFS Read: 0 HDFS Write: 0 SUCCESS
Total MapReduce CPU Time Spent: 0 msec
OK
Time taken: 1.988 seconds
hive> select * from t1;
OK
1       61
1       62
Time taken: 0.471 seconds, Fetched: 2 row(s)
hive> select * from t1 where part= cast('b' as binary);;
OK
Time taken: 0.381 seconds
hive> select * from t1 where part= cast('b' as binary);
OK
Time taken: 0.141 seconds
hive> select * from t1 where part= cast('a' as binary);
OK
Time taken: 0.198 seconds
hive> select * from t1 where part= 61;
FAILED: RuntimeException Cannot convert to Binary from: int
{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to