You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by gu...@apache.org on 2013/10/29 18:25:59 UTC
svn commit: r1536823 [7/8] - in /hive/branches/tez: ./
cli/src/test/org/apache/hadoop/hive/cli/ common/src/java/conf/
common/src/java/org/apache/hadoop/hive/common/
common/src/java/org/apache/hadoop/hive/common/type/
common/src/java/org/apache/hadoop/h...
Modified: hive/branches/tez/ql/src/test/results/clientpositive/windowing_expressions.q.out
URL: http://svn.apache.org/viewvc/hive/branches/tez/ql/src/test/results/clientpositive/windowing_expressions.q.out?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/ql/src/test/results/clientpositive/windowing_expressions.q.out (original)
+++ hive/branches/tez/ql/src/test/results/clientpositive/windowing_expressions.q.out Tue Oct 29 17:25:55 2013
@@ -49,7 +49,7 @@ PREHOOK: query: create table over10k(
bo boolean,
s string,
ts timestamp,
- dec decimal,
+ dec decimal(4,2),
bin binary)
row format delimited
fields terminated by '|'
@@ -64,7 +64,7 @@ POSTHOOK: query: create table over10k(
bo boolean,
s string,
ts timestamp,
- dec decimal,
+ dec decimal(4,2),
bin binary)
row format delimited
fields terminated by '|'
@@ -682,10 +682,10 @@ POSTHOOK: type: QUERY
POSTHOOK: Input: default@over10k
POSTHOOK: Output: default@t1
POSTHOOK: Output: default@t2
-POSTHOOK: Lineage: t1.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t1.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t2.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t2.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t1.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t1.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t2.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t2.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
PREHOOK: query: select * from t1 limit 3
PREHOOK: type: QUERY
PREHOOK: Input: default@t1
@@ -694,10 +694,10 @@ POSTHOOK: query: select * from t1 limit
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t1
#### A masked pattern was here ####
-POSTHOOK: Lineage: t1.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t1.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t2.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t2.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t1.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t1.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t2.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t2.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
65542 rachel thompson
131088 oscar brown
262258 wendy steinbeck
@@ -709,10 +709,10 @@ POSTHOOK: query: select * from t2 limit
POSTHOOK: type: QUERY
POSTHOOK: Input: default@t2
#### A masked pattern was here ####
-POSTHOOK: Lineage: t1.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t1.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t2.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t2.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t1.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t1.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t2.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t2.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
65542 rachel thompson
131088 oscar brown
262258 wendy steinbeck
@@ -732,10 +732,10 @@ limit 11
POSTHOOK: type: QUERY
POSTHOOK: Input: default@part
#### A masked pattern was here ####
-POSTHOOK: Lineage: t1.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t1.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t2.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
-POSTHOOK: Lineage: t2.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal, comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t1.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t1.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t2.a1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
+POSTHOOK: Lineage: t2.b1 SCRIPT [(over10k)over10k.FieldSchema(name:t, type:tinyint, comment:null), (over10k)over10k.FieldSchema(name:si, type:smallint, comment:null), (over10k)over10k.FieldSchema(name:i, type:int, comment:null), (over10k)over10k.FieldSchema(name:b, type:bigint, comment:null), (over10k)over10k.FieldSchema(name:f, type:float, comment:null), (over10k)over10k.FieldSchema(name:d, type:double, comment:null), (over10k)over10k.FieldSchema(name:bo, type:boolean, comment:null), (over10k)over10k.FieldSchema(name:s, type:string, comment:null), (over10k)over10k.FieldSchema(name:ts, type:timestamp, comment:null), (over10k)over10k.FieldSchema(name:dec, type:decimal(4,2), comment:null), (over10k)over10k.FieldSchema(name:bin, type:binary, comment:null), (over10k)over10k.FieldSchema(name:BLOCK__OFFSET__INSIDE__FILE, type:bigint, comment:), (over10k)over10k.FieldSchema(name:INPUT__FILE__NAME, type:string, comment:), ]
Manufacturer#1 1173.15 2 true
Manufacturer#1 1173.15 2 true
Manufacturer#1 1414.42 28 true
Modified: hive/branches/tez/ql/src/test/results/clientpositive/windowing_multipartitioning.q.out
URL: http://svn.apache.org/viewvc/hive/branches/tez/ql/src/test/results/clientpositive/windowing_multipartitioning.q.out?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/ql/src/test/results/clientpositive/windowing_multipartitioning.q.out (original)
+++ hive/branches/tez/ql/src/test/results/clientpositive/windowing_multipartitioning.q.out Tue Oct 29 17:25:55 2013
@@ -12,7 +12,7 @@ PREHOOK: query: create table over10k(
bo boolean,
s string,
ts timestamp,
- dec decimal,
+ dec decimal(4,2),
bin binary)
row format delimited
fields terminated by '|'
@@ -27,7 +27,7 @@ POSTHOOK: query: create table over10k(
bo boolean,
s string,
ts timestamp,
- dec decimal,
+ dec decimal(4,2),
bin binary)
row format delimited
fields terminated by '|'
Modified: hive/branches/tez/ql/src/test/results/clientpositive/windowing_navfn.q.out
URL: http://svn.apache.org/viewvc/hive/branches/tez/ql/src/test/results/clientpositive/windowing_navfn.q.out?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/ql/src/test/results/clientpositive/windowing_navfn.q.out (original)
+++ hive/branches/tez/ql/src/test/results/clientpositive/windowing_navfn.q.out Tue Oct 29 17:25:55 2013
@@ -11,8 +11,8 @@ PREHOOK: query: create table over10k(
d double,
bo boolean,
s string,
- ts timestamp,
- dec decimal,
+ ts timestamp,
+ dec decimal(4,2),
bin binary)
row format delimited
fields terminated by '|'
@@ -26,8 +26,8 @@ POSTHOOK: query: create table over10k(
d double,
bo boolean,
s string,
- ts timestamp,
- dec decimal,
+ ts timestamp,
+ dec decimal(4,2),
bin binary)
row format delimited
fields terminated by '|'
Modified: hive/branches/tez/ql/src/test/results/clientpositive/windowing_ntile.q.out
URL: http://svn.apache.org/viewvc/hive/branches/tez/ql/src/test/results/clientpositive/windowing_ntile.q.out?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/ql/src/test/results/clientpositive/windowing_ntile.q.out (original)
+++ hive/branches/tez/ql/src/test/results/clientpositive/windowing_ntile.q.out Tue Oct 29 17:25:55 2013
@@ -12,7 +12,7 @@ PREHOOK: query: create table over10k(
bo boolean,
s string,
ts timestamp,
- dec decimal,
+ dec decimal(4,2),
bin binary)
row format delimited
fields terminated by '|'
@@ -27,7 +27,7 @@ POSTHOOK: query: create table over10k(
bo boolean,
s string,
ts timestamp,
- dec decimal,
+ dec decimal(4,2),
bin binary)
row format delimited
fields terminated by '|'
Modified: hive/branches/tez/ql/src/test/results/clientpositive/windowing_rank.q.out
URL: http://svn.apache.org/viewvc/hive/branches/tez/ql/src/test/results/clientpositive/windowing_rank.q.out?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/ql/src/test/results/clientpositive/windowing_rank.q.out (original)
+++ hive/branches/tez/ql/src/test/results/clientpositive/windowing_rank.q.out Tue Oct 29 17:25:55 2013
@@ -12,7 +12,7 @@ PREHOOK: query: create table over10k(
bo boolean,
s string,
ts timestamp,
- dec decimal,
+ dec decimal(4,2),
bin binary)
row format delimited
fields terminated by '|'
@@ -27,7 +27,7 @@ POSTHOOK: query: create table over10k(
bo boolean,
s string,
ts timestamp,
- dec decimal,
+ dec decimal(4,2),
bin binary)
row format delimited
fields terminated by '|'
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/RegexSerDe.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/RegexSerDe.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/RegexSerDe.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/RegexSerDe.java Tue Oct 29 17:25:55 2013
@@ -37,6 +37,7 @@ import org.apache.hadoop.hive.serde2.obj
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.AbstractPrimitiveJavaObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
@@ -231,7 +232,7 @@ public class RegexSerDe extends Abstract
Date d;
d = Date.valueOf(t);
row.set(c, d);
- } else if (typeName.equals(serdeConstants.DECIMAL_TYPE_NAME)) {
+ } else if (typeInfo instanceof DecimalTypeInfo) {
HiveDecimal bd = HiveDecimal.create(t);
row.set(c, bd);
} else if (typeInfo instanceof VarcharTypeInfo) {
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveDecimalWritable.java Tue Oct 29 17:25:55 2013
@@ -28,6 +28,7 @@ import org.apache.hadoop.hive.common.typ
import org.apache.hadoop.hive.serde2.ByteStream.Output;
import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils;
import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VInt;
+import org.apache.hadoop.hive.serde2.typeinfo.HiveDecimalUtils;
import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableUtils;
@@ -84,6 +85,18 @@ public class HiveDecimalWritable impleme
return HiveDecimal.create(new BigInteger(internalStorage), scale);
}
+ /**
+ * Get a HiveDecimal instance from the writable and constraint it with maximum precision/scale.
+ *
+ * @param maxPrecision maximum precision
+ * @param maxScale maximum scale
+ * @return HiveDecimal instance
+ */
+ public HiveDecimal getHiveDecimal(int maxPrecision, int maxScale) {
+ return HiveDecimalUtils.enforcePrecisionScale(HiveDecimal.create(new BigInteger(internalStorage), scale),
+ maxPrecision, maxScale);
+ }
+
@Override
public void readFields(DataInput in) throws IOException {
scale = WritableUtils.readVInt(in);
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveDecimal.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveDecimal.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveDecimal.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveDecimal.java Tue Oct 29 17:25:55 2013
@@ -24,18 +24,32 @@ import org.apache.commons.logging.LogFac
import org.apache.hadoop.hive.common.type.HiveDecimal;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyHiveDecimalObjectInspector;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.HiveDecimalUtils;
import org.apache.hadoop.io.Text;
public class LazyHiveDecimal extends LazyPrimitive<LazyHiveDecimalObjectInspector, HiveDecimalWritable> {
static final private Log LOG = LogFactory.getLog(LazyHiveDecimal.class);
+ private final int precision;
+ private final int scale;
+
public LazyHiveDecimal(LazyHiveDecimalObjectInspector oi) {
super(oi);
+ DecimalTypeInfo typeInfo = (DecimalTypeInfo)oi.getTypeInfo();
+ if (typeInfo == null) {
+ throw new RuntimeException("Decimal type used without type params");
+ }
+
+ precision = typeInfo.precision();
+ scale = typeInfo.scale();
data = new HiveDecimalWritable();
}
public LazyHiveDecimal(LazyHiveDecimal copy) {
super(copy);
+ precision = copy.precision;
+ scale = copy.scale;
data = new HiveDecimalWritable(copy.data);
}
@@ -59,6 +73,7 @@ public class LazyHiveDecimal extends Laz
}
HiveDecimal dec = HiveDecimal.create(byteData);
+ dec = enforcePrecisionScale(dec);
if (dec != null) {
data.set(dec);
isNull = false;
@@ -69,8 +84,13 @@ public class LazyHiveDecimal extends Laz
}
}
+ private HiveDecimal enforcePrecisionScale(HiveDecimal dec) {
+ return HiveDecimalUtils.enforcePrecisionScale(dec, precision, scale);
+ }
+
@Override
public HiveDecimalWritable getWritableObject() {
return data;
}
+
}
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveDecimalObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveDecimalObjectInspector.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveDecimalObjectInspector.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveDecimalObjectInspector.java Tue Oct 29 17:25:55 2013
@@ -22,14 +22,14 @@ import org.apache.hadoop.hive.common.typ
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
import org.apache.hadoop.hive.serde2.lazy.LazyHiveDecimal;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveDecimalObjectInspector;
-import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.HiveDecimalUtils;
-public class LazyHiveDecimalObjectInspector
- extends AbstractPrimitiveLazyObjectInspector<HiveDecimalWritable>
- implements HiveDecimalObjectInspector {
+public class LazyHiveDecimalObjectInspector extends AbstractPrimitiveLazyObjectInspector<HiveDecimalWritable>
+implements HiveDecimalObjectInspector {
- protected LazyHiveDecimalObjectInspector() {
- super(TypeInfoFactory.decimalTypeInfo);
+ protected LazyHiveDecimalObjectInspector(DecimalTypeInfo typeInfo) {
+ super(typeInfo);
}
@Override
@@ -39,7 +39,12 @@ public class LazyHiveDecimalObjectInspec
@Override
public HiveDecimal getPrimitiveJavaObject(Object o) {
- return o == null ? null : ((LazyHiveDecimal) o).getWritableObject().getHiveDecimal();
+ if (o == null) {
+ return null;
+ }
+
+ HiveDecimal dec = ((LazyHiveDecimal)o).getWritableObject().getHiveDecimal();
+ return HiveDecimalUtils.enforcePrecisionScale(dec, (DecimalTypeInfo) typeInfo);
}
}
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyPrimitiveObjectInspectorFactory.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyPrimitiveObjectInspectorFactory.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyPrimitiveObjectInspectorFactory.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyPrimitiveObjectInspectorFactory.java Tue Oct 29 17:25:55 2013
@@ -24,6 +24,7 @@ import java.util.Map;
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
import org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo;
@@ -64,8 +65,6 @@ public final class LazyPrimitiveObjectIn
new LazyTimestampObjectInspector();
public static final LazyBinaryObjectInspector LAZY_BINARY_OBJECT_INSPECTOR =
new LazyBinaryObjectInspector();
- public static final LazyHiveDecimalObjectInspector LAZY_BIG_DECIMAL_OBJECT_INSPECTOR =
- new LazyHiveDecimalObjectInspector();
private LazyPrimitiveObjectInspectorFactory() {
// prevent instantiation
@@ -98,8 +97,6 @@ public final class LazyPrimitiveObjectIn
LAZY_DATE_OBJECT_INSPECTOR);
cachedPrimitiveLazyObjectInspectors.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.TIMESTAMP_TYPE_NAME),
LAZY_TIMESTAMP_OBJECT_INSPECTOR);
- cachedPrimitiveLazyObjectInspectors.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.DECIMAL_TYPE_NAME),
- LAZY_BIG_DECIMAL_OBJECT_INSPECTOR);
cachedPrimitiveLazyObjectInspectors.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.BINARY_TYPE_NAME),
LAZY_BINARY_OBJECT_INSPECTOR);
}
@@ -128,6 +125,9 @@ public final class LazyPrimitiveObjectIn
case VARCHAR:
poi = new LazyHiveVarcharObjectInspector((VarcharTypeInfo)typeInfo);
break;
+ case DECIMAL:
+ poi = new LazyHiveDecimalObjectInspector((DecimalTypeInfo)typeInfo);
+ break;
default:
throw new RuntimeException(
"Primitve type " + typeInfo.getPrimitiveCategory() + " should not take parameters");
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveDecimal.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveDecimal.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveDecimal.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveDecimal.java Tue Oct 29 17:25:55 2013
@@ -17,15 +17,23 @@
*/
package org.apache.hadoop.hive.serde2.lazybinary;
+import org.apache.hadoop.hive.common.type.HiveDecimal;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
import org.apache.hadoop.hive.serde2.lazy.ByteArrayRef;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveDecimalObjectInspector;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
public class LazyBinaryHiveDecimal extends
LazyBinaryPrimitive<WritableHiveDecimalObjectInspector, HiveDecimalWritable> {
+ private int precision;
+ private int scale;
LazyBinaryHiveDecimal(WritableHiveDecimalObjectInspector oi) {
super(oi);
+
+ DecimalTypeInfo typeInfo = (DecimalTypeInfo) oi.getTypeInfo();
+ this.precision = typeInfo.precision();
+ this.scale = typeInfo.scale();
data = new HiveDecimalWritable();
}
@@ -37,6 +45,8 @@ public class LazyBinaryHiveDecimal exten
@Override
public void init(ByteArrayRef bytes, int start, int length) {
data.setFromBytes(bytes.getData(), start, length);
+ HiveDecimal dec = data.getHiveDecimal(precision, scale);
+ data = dec == null ? null : new HiveDecimalWritable(dec);
}
}
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinarySerDe.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinarySerDe.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinarySerDe.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinarySerDe.java Tue Oct 29 17:25:55 2013
@@ -18,8 +18,6 @@
package org.apache.hadoop.hive.serde2.lazybinary;
-import java.nio.ByteBuffer;
-import java.nio.charset.CharacterCodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -46,8 +44,6 @@ import org.apache.hadoop.hive.serde2.obj
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.StructField;
import org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveVarcharObjectInspector;
-import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveDecimalObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.BinaryObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.BooleanObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.ByteObjectInspector;
@@ -55,6 +51,7 @@ import org.apache.hadoop.hive.serde2.obj
import org.apache.hadoop.hive.serde2.objectinspector.primitive.DoubleObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.FloatObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveDecimalObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveVarcharObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.IntObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.LongObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.ShortObjectInspector;
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaHiveDecimalObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaHiveDecimalObjectInspector.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaHiveDecimalObjectInspector.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaHiveDecimalObjectInspector.java Tue Oct 29 17:25:55 2013
@@ -21,14 +21,18 @@ import java.math.BigInteger;
import org.apache.hadoop.hive.common.type.HiveDecimal;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
-import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.HiveDecimalUtils;
public class JavaHiveDecimalObjectInspector
- extends AbstractPrimitiveJavaObjectInspector
- implements SettableHiveDecimalObjectInspector {
+extends AbstractPrimitiveJavaObjectInspector
+implements SettableHiveDecimalObjectInspector {
- protected JavaHiveDecimalObjectInspector() {
- super(TypeInfoFactory.decimalTypeInfo);
+ public JavaHiveDecimalObjectInspector() {
+ }
+
+ public JavaHiveDecimalObjectInspector(DecimalTypeInfo typeInfo) {
+ super(typeInfo);
}
@Override
@@ -38,33 +42,32 @@ public class JavaHiveDecimalObjectInspec
}
if (o instanceof String) {
- o = HiveDecimal.create((String)o);
- if (o == null) {
- return null;
- }
+ HiveDecimal dec = enforcePrecisionScale(HiveDecimal.create((String)o));
+ return dec == null ? null : new HiveDecimalWritable(dec);
}
- return new HiveDecimalWritable((HiveDecimal) o);
+ HiveDecimal dec = enforcePrecisionScale((HiveDecimal)o);
+ return dec == null ? null : new HiveDecimalWritable(dec);
}
@Override
public HiveDecimal getPrimitiveJavaObject(Object o) {
- return o == null ? null : (HiveDecimal) o;
+ return enforcePrecisionScale((HiveDecimal)o);
}
@Override
public Object set(Object o, byte[] bytes, int scale) {
- return HiveDecimal.create(new BigInteger(bytes), scale);
+ return enforcePrecisionScale(HiveDecimal.create(new BigInteger(bytes), scale));
}
@Override
public Object set(Object o, HiveDecimal t) {
- return t;
+ return enforcePrecisionScale(t);
}
@Override
public Object set(Object o, HiveDecimalWritable t) {
- return t == null ? null : t.getHiveDecimal();
+ return t == null ? null : enforcePrecisionScale(t.getHiveDecimal());
}
@Override
@@ -74,11 +77,11 @@ public class JavaHiveDecimalObjectInspec
@Override
public Object create(HiveDecimal t) {
- if (t == null) {
- return null;
- }
+ return t;
+ }
- return HiveDecimal.create(t.unscaledValue(), t.scale());
+ private HiveDecimal enforcePrecisionScale(HiveDecimal dec) {
+ return HiveDecimalUtils.enforcePrecisionScale(dec,(DecimalTypeInfo)typeInfo);
}
}
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorFactory.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorFactory.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorFactory.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorFactory.java Tue Oct 29 17:25:55 2013
@@ -22,7 +22,6 @@ import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
-import org.apache.hadoop.hive.common.type.HiveVarchar;
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.io.ByteWritable;
import org.apache.hadoop.hive.serde2.io.DateWritable;
@@ -35,6 +34,7 @@ import org.apache.hadoop.hive.serde2.obj
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.PrimitiveTypeEntry;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
import org.apache.hadoop.hive.serde2.typeinfo.VarcharTypeInfo;
@@ -73,6 +73,8 @@ public final class PrimitiveObjectInspec
new WritableDoubleObjectInspector();
public static final WritableStringObjectInspector writableStringObjectInspector =
new WritableStringObjectInspector();
+ public static final WritableHiveVarcharObjectInspector writableHiveVarcharObjectInspector =
+ new WritableHiveVarcharObjectInspector((VarcharTypeInfo) TypeInfoFactory.varcharTypeInfo);
public static final WritableVoidObjectInspector writableVoidObjectInspector =
new WritableVoidObjectInspector();
public static final WritableDateObjectInspector writableDateObjectInspector =
@@ -82,7 +84,7 @@ public final class PrimitiveObjectInspec
public static final WritableBinaryObjectInspector writableBinaryObjectInspector =
new WritableBinaryObjectInspector();
public static final WritableHiveDecimalObjectInspector writableHiveDecimalObjectInspector =
- new WritableHiveDecimalObjectInspector();
+ new WritableHiveDecimalObjectInspector(TypeInfoFactory.decimalTypeInfo);
// Map from PrimitiveTypeInfo to AbstractPrimitiveWritableObjectInspector.
private static HashMap<PrimitiveTypeInfo, AbstractPrimitiveWritableObjectInspector> cachedPrimitiveWritableInspectorCache =
@@ -104,6 +106,7 @@ public final class PrimitiveObjectInspec
writableDoubleObjectInspector);
cachedPrimitiveWritableInspectorCache.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.STRING_TYPE_NAME),
writableStringObjectInspector);
+ cachedPrimitiveWritableInspectorCache.put(TypeInfoFactory.varcharTypeInfo, writableHiveVarcharObjectInspector);
cachedPrimitiveWritableInspectorCache.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.VOID_TYPE_NAME),
writableVoidObjectInspector);
cachedPrimitiveWritableInspectorCache.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.DATE_TYPE_NAME),
@@ -112,8 +115,7 @@ public final class PrimitiveObjectInspec
writableTimestampObjectInspector);
cachedPrimitiveWritableInspectorCache.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.BINARY_TYPE_NAME),
writableBinaryObjectInspector);
- cachedPrimitiveWritableInspectorCache.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.DECIMAL_TYPE_NAME),
- writableHiveDecimalObjectInspector);
+ cachedPrimitiveWritableInspectorCache.put(TypeInfoFactory.decimalTypeInfo, writableHiveDecimalObjectInspector);
}
private static Map<PrimitiveCategory, AbstractPrimitiveWritableObjectInspector> primitiveCategoryToWritableOI =
@@ -127,6 +129,7 @@ public final class PrimitiveObjectInspec
primitiveCategoryToWritableOI.put(PrimitiveCategory.FLOAT, writableFloatObjectInspector);
primitiveCategoryToWritableOI.put(PrimitiveCategory.DOUBLE, writableDoubleObjectInspector);
primitiveCategoryToWritableOI.put(PrimitiveCategory.STRING, writableStringObjectInspector);
+ primitiveCategoryToWritableOI.put(PrimitiveCategory.VARCHAR, writableHiveVarcharObjectInspector);
primitiveCategoryToWritableOI.put(PrimitiveCategory.VOID, writableVoidObjectInspector);
primitiveCategoryToWritableOI.put(PrimitiveCategory.DATE, writableDateObjectInspector);
primitiveCategoryToWritableOI.put(PrimitiveCategory.TIMESTAMP, writableTimestampObjectInspector);
@@ -150,6 +153,8 @@ public final class PrimitiveObjectInspec
new JavaDoubleObjectInspector();
public static final JavaStringObjectInspector javaStringObjectInspector =
new JavaStringObjectInspector();
+ public static final JavaHiveVarcharObjectInspector javaHiveVarcharObjectInspector =
+ new JavaHiveVarcharObjectInspector((VarcharTypeInfo) TypeInfoFactory.varcharTypeInfo);
public static final JavaVoidObjectInspector javaVoidObjectInspector =
new JavaVoidObjectInspector();
public static final JavaDateObjectInspector javaDateObjectInspector =
@@ -159,7 +164,7 @@ public final class PrimitiveObjectInspec
public static final JavaBinaryObjectInspector javaByteArrayObjectInspector =
new JavaBinaryObjectInspector();
public static final JavaHiveDecimalObjectInspector javaHiveDecimalObjectInspector =
- new JavaHiveDecimalObjectInspector();
+ new JavaHiveDecimalObjectInspector(TypeInfoFactory.decimalTypeInfo);
// Map from PrimitiveTypeInfo to AbstractPrimitiveJavaObjectInspector.
private static HashMap<PrimitiveTypeInfo, AbstractPrimitiveJavaObjectInspector> cachedPrimitiveJavaInspectorCache =
@@ -181,6 +186,7 @@ public final class PrimitiveObjectInspec
javaDoubleObjectInspector);
cachedPrimitiveJavaInspectorCache.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.STRING_TYPE_NAME),
javaStringObjectInspector);
+ cachedPrimitiveJavaInspectorCache.put(TypeInfoFactory.varcharTypeInfo, javaHiveVarcharObjectInspector);
cachedPrimitiveJavaInspectorCache.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.VOID_TYPE_NAME),
javaVoidObjectInspector);
cachedPrimitiveJavaInspectorCache.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.DATE_TYPE_NAME),
@@ -189,8 +195,7 @@ public final class PrimitiveObjectInspec
javaTimestampObjectInspector);
cachedPrimitiveJavaInspectorCache.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.BINARY_TYPE_NAME),
javaByteArrayObjectInspector);
- cachedPrimitiveJavaInspectorCache.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.DECIMAL_TYPE_NAME),
- javaHiveDecimalObjectInspector);
+ cachedPrimitiveJavaInspectorCache.put(TypeInfoFactory.decimalTypeInfo, javaHiveDecimalObjectInspector);
}
private static Map<PrimitiveCategory, AbstractPrimitiveJavaObjectInspector> primitiveCategoryToJavaOI =
@@ -204,6 +209,7 @@ public final class PrimitiveObjectInspec
primitiveCategoryToJavaOI.put(PrimitiveCategory.FLOAT, javaFloatObjectInspector);
primitiveCategoryToJavaOI.put(PrimitiveCategory.DOUBLE, javaDoubleObjectInspector);
primitiveCategoryToJavaOI.put(PrimitiveCategory.STRING, javaStringObjectInspector);
+ primitiveCategoryToJavaOI.put(PrimitiveCategory.VARCHAR, javaHiveVarcharObjectInspector);
primitiveCategoryToJavaOI.put(PrimitiveCategory.VOID, javaVoidObjectInspector);
primitiveCategoryToJavaOI.put(PrimitiveCategory.DATE, javaDateObjectInspector);
primitiveCategoryToJavaOI.put(PrimitiveCategory.TIMESTAMP, javaTimestampObjectInspector);
@@ -244,8 +250,11 @@ public final class PrimitiveObjectInspec
case VARCHAR:
result = new WritableHiveVarcharObjectInspector((VarcharTypeInfo)typeInfo);
break;
- default:
- throw new RuntimeException("Failed to create WritableHiveVarcharObjectInspector for " + typeInfo );
+ case DECIMAL:
+ result = new WritableHiveDecimalObjectInspector((DecimalTypeInfo)typeInfo);
+ break;
+ default:
+ throw new RuntimeException("Failed to create object inspector for " + typeInfo );
}
cachedPrimitiveWritableInspectorCache.put(typeInfo, result);
@@ -286,7 +295,7 @@ public final class PrimitiveObjectInspec
case TIMESTAMP:
return new WritableConstantTimestampObjectInspector((TimestampWritable)value);
case DECIMAL:
- return new WritableConstantHiveDecimalObjectInspector((HiveDecimalWritable)value);
+ return new WritableConstantHiveDecimalObjectInspector((DecimalTypeInfo)typeInfo, (HiveDecimalWritable)value);
case BINARY:
return new WritableConstantBinaryObjectInspector((BytesWritable)value);
case VOID:
@@ -330,6 +339,9 @@ public final class PrimitiveObjectInspec
case VARCHAR:
result = new JavaHiveVarcharObjectInspector((VarcharTypeInfo)typeInfo);
break;
+ case DECIMAL:
+ result = new JavaHiveDecimalObjectInspector((DecimalTypeInfo)typeInfo);
+ break;
default:
throw new RuntimeException("Failed to create JavaHiveVarcharObjectInspector for " + typeInfo );
}
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableConstantHiveDecimalObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableConstantHiveDecimalObjectInspector.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableConstantHiveDecimalObjectInspector.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableConstantHiveDecimalObjectInspector.java Tue Oct 29 17:25:55 2013
@@ -17,27 +17,43 @@
*/
package org.apache.hadoop.hive.serde2.objectinspector.primitive;
+import org.apache.hadoop.hive.common.type.HiveDecimal;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
import org.apache.hadoop.hive.serde2.objectinspector.ConstantObjectInspector;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
/**
* A WritableConstantHiveDecimalObjectInspector is a WritableHiveDecimalObjectInspector
* that implements ConstantObjectInspector.
*/
public class WritableConstantHiveDecimalObjectInspector extends WritableHiveDecimalObjectInspector
- implements ConstantObjectInspector {
+implements ConstantObjectInspector {
private HiveDecimalWritable value;
protected WritableConstantHiveDecimalObjectInspector() {
super();
}
- WritableConstantHiveDecimalObjectInspector(HiveDecimalWritable value) {
+
+ WritableConstantHiveDecimalObjectInspector(DecimalTypeInfo typeInfo,
+ HiveDecimalWritable value) {
+ super(typeInfo);
this.value = value;
}
@Override
public HiveDecimalWritable getWritableConstantValue() {
- return value;
+ // We need to enforce precision/scale here.
+ // A little inefficiency here as we need to create a HiveDecimal instance from the writable and
+ // recreate a HiveDecimalWritable instance on the HiveDecimal instance. However, we don't know
+ // the precision/scale of the original writable until we get a HiveDecimal instance from it.
+ DecimalTypeInfo decTypeInfo = (DecimalTypeInfo)typeInfo;
+ HiveDecimal dec = value == null ? null :
+ value.getHiveDecimal(decTypeInfo.precision(), decTypeInfo.scale());
+ if (dec == null) {
+ return null;
+ }
+ return new HiveDecimalWritable(dec);
}
+
}
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveDecimalObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveDecimalObjectInspector.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveDecimalObjectInspector.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveDecimalObjectInspector.java Tue Oct 29 17:25:55 2013
@@ -20,24 +20,27 @@ package org.apache.hadoop.hive.serde2.ob
import org.apache.hadoop.hive.common.type.HiveDecimal;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
-import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.hadoop.hive.serde2.typeinfo.DecimalTypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.HiveDecimalUtils;
-public class WritableHiveDecimalObjectInspector
- extends AbstractPrimitiveWritableObjectInspector
- implements SettableHiveDecimalObjectInspector {
+public class WritableHiveDecimalObjectInspector extends AbstractPrimitiveWritableObjectInspector
+implements SettableHiveDecimalObjectInspector {
- protected WritableHiveDecimalObjectInspector() {
- super(TypeInfoFactory.decimalTypeInfo);
+ public WritableHiveDecimalObjectInspector() {
+ }
+
+ protected WritableHiveDecimalObjectInspector(DecimalTypeInfo typeInfo) {
+ super(typeInfo);
}
@Override
public HiveDecimalWritable getPrimitiveWritableObject(Object o) {
- return o == null ? null : (HiveDecimalWritable) o;
+ return enforcePrecisionScale(((HiveDecimalWritable) o));
}
@Override
public HiveDecimal getPrimitiveJavaObject(Object o) {
- return o == null ? null : ((HiveDecimalWritable) o).getHiveDecimal();
+ return enforcePrecisionScale(((HiveDecimalWritable)o).getHiveDecimal());
}
@Override
@@ -47,27 +50,34 @@ public class WritableHiveDecimalObjectIn
@Override
public Object set(Object o, byte[] bytes, int scale) {
- ((HiveDecimalWritable) o).set(bytes, scale);
- return o;
+ HiveDecimalWritable writable = (HiveDecimalWritable)create(bytes, scale);
+ if (writable != null) {
+ ((HiveDecimalWritable)o).set(writable);
+ return o;
+ } else {
+ return null;
+ }
}
@Override
public Object set(Object o, HiveDecimal t) {
- if (t == null) {
+ HiveDecimal dec = enforcePrecisionScale(t);
+ if (dec != null) {
+ ((HiveDecimalWritable) o).set(dec);
+ return o;
+ } else {
return null;
}
-
- ((HiveDecimalWritable) o).set(t);
- return o;
}
@Override
public Object set(Object o, HiveDecimalWritable t) {
- if (t == null) {
+ HiveDecimalWritable writable = enforcePrecisionScale(t);
+ if (writable == null) {
return null;
}
- ((HiveDecimalWritable) o).set(t);
+ ((HiveDecimalWritable) o).set(writable);
return o;
}
@@ -78,11 +88,15 @@ public class WritableHiveDecimalObjectIn
@Override
public Object create(HiveDecimal t) {
- if (t == null) {
- return null;
- }
+ return t == null ? null : new HiveDecimalWritable(t);
+ }
+
+ private HiveDecimal enforcePrecisionScale(HiveDecimal dec) {
+ return HiveDecimalUtils.enforcePrecisionScale(dec, (DecimalTypeInfo)typeInfo);
+ }
- return new HiveDecimalWritable(t);
+ private HiveDecimalWritable enforcePrecisionScale(HiveDecimalWritable writable) {
+ return HiveDecimalUtils.enforcePrecisionScale(writable, (DecimalTypeInfo)typeInfo);
}
}
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfo.java Tue Oct 29 17:25:55 2013
@@ -68,4 +68,9 @@ public abstract class TypeInfo implement
@Override
public abstract int hashCode();
+
+ public boolean accept(TypeInfo other) {
+ return this.equals(other);
+ }
+
}
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java Tue Oct 29 17:25:55 2013
@@ -24,6 +24,8 @@ import java.util.concurrent.ConcurrentHa
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hive.common.type.HiveVarchar;
+import org.apache.hadoop.hive.common.type.HiveDecimal;
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorUtils.PrimitiveTypeEntry;
@@ -47,6 +49,7 @@ public final class TypeInfoFactory {
public static final PrimitiveTypeInfo intTypeInfo = new PrimitiveTypeInfo(serdeConstants.INT_TYPE_NAME);
public static final PrimitiveTypeInfo longTypeInfo = new PrimitiveTypeInfo(serdeConstants.BIGINT_TYPE_NAME);
public static final PrimitiveTypeInfo stringTypeInfo = new PrimitiveTypeInfo(serdeConstants.STRING_TYPE_NAME);
+ public static final PrimitiveTypeInfo varcharTypeInfo = new VarcharTypeInfo(HiveVarchar.MAX_VARCHAR_LENGTH);
public static final PrimitiveTypeInfo floatTypeInfo = new PrimitiveTypeInfo(serdeConstants.FLOAT_TYPE_NAME);
public static final PrimitiveTypeInfo doubleTypeInfo = new PrimitiveTypeInfo(serdeConstants.DOUBLE_TYPE_NAME);
public static final PrimitiveTypeInfo byteTypeInfo = new PrimitiveTypeInfo(serdeConstants.TINYINT_TYPE_NAME);
@@ -54,7 +57,12 @@ public final class TypeInfoFactory {
public static final PrimitiveTypeInfo dateTypeInfo = new PrimitiveTypeInfo(serdeConstants.DATE_TYPE_NAME);
public static final PrimitiveTypeInfo timestampTypeInfo = new PrimitiveTypeInfo(serdeConstants.TIMESTAMP_TYPE_NAME);
public static final PrimitiveTypeInfo binaryTypeInfo = new PrimitiveTypeInfo(serdeConstants.BINARY_TYPE_NAME);
- public static final PrimitiveTypeInfo decimalTypeInfo = new PrimitiveTypeInfo(serdeConstants.DECIMAL_TYPE_NAME);
+
+ /**
+ * A DecimalTypeInfo instance that has max precision and max scale.
+ */
+ public static final DecimalTypeInfo decimalTypeInfo = new DecimalTypeInfo(HiveDecimal.MAX_PRECISION,
+ HiveDecimal.MAX_SCALE);
public static final PrimitiveTypeInfo unknownTypeInfo = new PrimitiveTypeInfo("unknown");
@@ -68,6 +76,7 @@ public final class TypeInfoFactory {
cachedPrimitiveTypeInfo.put(serdeConstants.INT_TYPE_NAME, intTypeInfo);
cachedPrimitiveTypeInfo.put(serdeConstants.BIGINT_TYPE_NAME, longTypeInfo);
cachedPrimitiveTypeInfo.put(serdeConstants.STRING_TYPE_NAME, stringTypeInfo);
+ cachedPrimitiveTypeInfo.put(varcharTypeInfo.getQualifiedName(), varcharTypeInfo);
cachedPrimitiveTypeInfo.put(serdeConstants.FLOAT_TYPE_NAME, floatTypeInfo);
cachedPrimitiveTypeInfo.put(serdeConstants.DOUBLE_TYPE_NAME, doubleTypeInfo);
cachedPrimitiveTypeInfo.put(serdeConstants.TINYINT_TYPE_NAME, byteTypeInfo);
@@ -75,7 +84,7 @@ public final class TypeInfoFactory {
cachedPrimitiveTypeInfo.put(serdeConstants.DATE_TYPE_NAME, dateTypeInfo);
cachedPrimitiveTypeInfo.put(serdeConstants.TIMESTAMP_TYPE_NAME, timestampTypeInfo);
cachedPrimitiveTypeInfo.put(serdeConstants.BINARY_TYPE_NAME, binaryTypeInfo);
- cachedPrimitiveTypeInfo.put(serdeConstants.DECIMAL_TYPE_NAME, decimalTypeInfo);
+ cachedPrimitiveTypeInfo.put(decimalTypeInfo.getQualifiedName(), decimalTypeInfo);
cachedPrimitiveTypeInfo.put("unknown", unknownTypeInfo);
}
@@ -128,6 +137,12 @@ public final class TypeInfoFactory {
return null;
}
return new VarcharTypeInfo(Integer.valueOf(parts.typeParams[0]));
+ case DECIMAL:
+ if (parts.typeParams.length != 2) {
+ return null;
+ }
+ return new DecimalTypeInfo(Integer.valueOf(parts.typeParams[0]),
+ Integer.valueOf(parts.typeParams[1]));
default:
return null;
}
@@ -138,6 +153,11 @@ public final class TypeInfoFactory {
return (VarcharTypeInfo) getPrimitiveTypeInfo(fullName);
}
+ public static DecimalTypeInfo getDecimalTypeInfo(int precision, int scale) {
+ String fullName = DecimalTypeInfo.getQualifiedName(precision, scale);
+ return (DecimalTypeInfo) getPrimitiveTypeInfo(fullName);
+ };
+
public static TypeInfo getPrimitiveTypeInfoFromPrimitiveWritable(
Class<?> clazz) {
String typeName = PrimitiveObjectInspectorUtils
@@ -207,6 +227,6 @@ public final class TypeInfoFactory {
cachedMapTypeInfo.put(signature, result);
}
return result;
- };
+ }
}
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoUtils.java Tue Oct 29 17:25:55 2013
@@ -395,23 +395,39 @@ public final class TypeInfoUtils {
PrimitiveObjectInspectorUtils.getTypeEntryFromTypeName(t.text);
if (typeEntry != null && typeEntry.primitiveCategory != PrimitiveCategory.UNKNOWN ) {
String qualifiedTypeName = typeEntry.typeName;
- if (typeEntry.primitiveCategory == PrimitiveCategory.VARCHAR) {
- int length = HiveVarchar.MAX_VARCHAR_LENGTH;
-
- String[] params = parseParams();
+ String[] params = parseParams();
+ switch (typeEntry.primitiveCategory) {
+ case VARCHAR:
if (params == null || params.length == 0) {
- throw new RuntimeException( "Varchar type is specified without length: " + typeInfoString);
+ throw new IllegalArgumentException( "Varchar type is specified without length: " + typeInfoString);
}
-
+
if (params.length == 1) {
- length = Integer.valueOf(params[0]);
+ int length = Integer.valueOf(params[0]);
VarcharUtils.validateParameter(length);
+ qualifiedTypeName = BaseCharTypeInfo.getQualifiedName(typeEntry.typeName, length);
} else if (params.length > 1) {
- throw new RuntimeException("Type varchar only takes one parameter, but " +
+ throw new IllegalArgumentException("Type varchar only takes one parameter, but " +
params.length + " is seen");
- }
+ }
+
+ break;
+ case DECIMAL:
+ if (params == null || params.length == 0) {
+ throw new IllegalArgumentException( "Decimal type is specified without length: " + typeInfoString);
+ }
+
+ if (params.length == 2) {
+ int precision = Integer.valueOf(params[0]);
+ int scale = Integer.valueOf(params[1]);
+ HiveDecimalUtils.validateParameter(precision, scale);
+ qualifiedTypeName = DecimalTypeInfo.getQualifiedName(precision, scale);
+ } else if (params.length > 1) {
+ throw new IllegalArgumentException("Type varchar only takes one parameter, but " +
+ params.length + " is seen");
+ }
- qualifiedTypeName = BaseCharTypeInfo.getQualifiedName(typeEntry.typeName, length);
+ break;
}
return TypeInfoFactory.getPrimitiveTypeInfo(qualifiedTypeName);
@@ -679,7 +695,7 @@ public final class TypeInfoUtils {
switch (oi.getCategory()) {
case PRIMITIVE: {
PrimitiveObjectInspector poi = (PrimitiveObjectInspector) oi;
- result = TypeInfoFactory.getPrimitiveTypeInfo(poi.getTypeName());
+ result = poi.getTypeInfo();
break;
}
case LIST: {
Modified: hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/VarcharTypeInfo.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/VarcharTypeInfo.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/VarcharTypeInfo.java (original)
+++ hive/branches/tez/serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/VarcharTypeInfo.java Tue Oct 29 17:25:55 2013
@@ -45,7 +45,7 @@ public class VarcharTypeInfo extends Bas
VarcharTypeInfo pti = (VarcharTypeInfo) other;
- return this.typeName.equals(pti.typeName) && this.getLength() == pti.getLength();
+ return this.getLength() == pti.getLength();
}
/**
@@ -53,7 +53,7 @@ public class VarcharTypeInfo extends Bas
*/
@Override
public int hashCode() {
- return getQualifiedName().hashCode();
+ return getLength();
}
@Override
Modified: hive/branches/tez/service/src/java/org/apache/hive/service/cli/CLIService.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/service/src/java/org/apache/hive/service/cli/CLIService.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/service/src/java/org/apache/hive/service/cli/CLIService.java (original)
+++ hive/branches/tez/service/src/java/org/apache/hive/service/cli/CLIService.java Tue Oct 29 17:25:55 2013
@@ -26,6 +26,9 @@ import javax.security.auth.login.LoginEx
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.HiveMetaStoreClient;
import org.apache.hadoop.hive.metastore.IMetaStoreClient;
@@ -77,8 +80,17 @@ public class CLIService extends Composit
public synchronized void start() {
super.start();
- // Initialize and test a connection to the metastore
try {
+ // make sure that the base scratch directories exists and writable
+ setupStagingDir(hiveConf.getVar(HiveConf.ConfVars.SCRATCHDIR), false);
+ setupStagingDir(hiveConf.getVar(HiveConf.ConfVars.LOCALSCRATCHDIR), true);
+ setupStagingDir(hiveConf.getVar(HiveConf.ConfVars.DOWNLOADED_RESOURCES_DIR), true);
+ } catch (IOException eIO) {
+ throw new ServiceException("Error setting stage directories", eIO);
+ }
+
+ try {
+ // Initialize and test a connection to the metastore
metastoreClient = new HiveMetaStoreClient(hiveConf);
metastoreClient.getDatabases("default");
} catch (Exception e) {
@@ -341,4 +353,20 @@ public class CLIService extends Composit
}
}
}
+
+ // create the give Path if doesn't exists and make it writable
+ private void setupStagingDir(String dirPath, boolean isLocal) throws IOException {
+ Path scratchDir = new Path(dirPath);
+ FileSystem fs;
+ if (isLocal) {
+ fs = FileSystem.getLocal(hiveConf);
+ } else {
+ fs = scratchDir.getFileSystem(hiveConf);
+ }
+ if (!fs.exists(scratchDir)) {
+ fs.mkdirs(scratchDir);
+ FsPermission fsPermission = new FsPermission((short)0777);
+ fs.setPermission(scratchDir, fsPermission);
+ }
+ }
}
Modified: hive/branches/tez/service/src/java/org/apache/hive/service/cli/operation/ExecuteStatementOperation.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/service/src/java/org/apache/hive/service/cli/operation/ExecuteStatementOperation.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/service/src/java/org/apache/hive/service/cli/operation/ExecuteStatementOperation.java (original)
+++ hive/branches/tez/service/src/java/org/apache/hive/service/cli/operation/ExecuteStatementOperation.java Tue Oct 29 17:25:55 2013
@@ -40,7 +40,7 @@ public abstract class ExecuteStatementOp
public ExecuteStatementOperation(HiveSession parentSession, String statement, Map<String, String> confOverlay) {
super(parentSession, OperationType.EXECUTE_STATEMENT);
this.statement = statement;
- this.confOverlay = confOverlay;
+ setConfOverlay(confOverlay);
}
public String getStatement() {
@@ -63,4 +63,14 @@ public abstract class ExecuteStatementOp
}
return new HiveCommandOperation(parentSession, statement, processor, confOverlay);
}
+
+ protected Map<String, String> getConfOverlay() {
+ return confOverlay;
+ }
+
+ protected void setConfOverlay(Map<String, String> confOverlay) {
+ if (confOverlay != null) {
+ this.confOverlay = confOverlay;
+ }
+ }
}
Modified: hive/branches/tez/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java (original)
+++ hive/branches/tez/service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java Tue Oct 29 17:25:55 2013
@@ -80,7 +80,7 @@ public class SQLOperation extends Execut
public void prepare() throws HiveSQLException {
}
- private void runInternal() throws HiveSQLException {
+ private void runInternal(HiveConf sqlOperationConf) throws HiveSQLException {
setState(OperationState.RUNNING);
String statement_trimmed = statement.trim();
String[] tokens = statement_trimmed.split("\\s");
@@ -91,13 +91,13 @@ public class SQLOperation extends Execut
String SQLState = null;
try {
- driver = new Driver(getParentSession().getHiveConf(), getParentSession().getUserName());
+ driver = new Driver(sqlOperationConf, getParentSession().getUserName());
// In Hive server mode, we are not able to retry in the FetchTask
// case, when calling fetch queries since execute() has returned.
// For now, we disable the test attempts.
driver.setTryCount(Integer.MAX_VALUE);
- String subStatement = new VariableSubstitution().substitute(getParentSession().getHiveConf(), statement);
+ String subStatement = new VariableSubstitution().substitute(sqlOperationConf, statement);
response = driver.run(subStatement);
if (0 != response.getResponseCode()) {
@@ -143,7 +143,7 @@ public class SQLOperation extends Execut
public void run() throws HiveSQLException {
setState(OperationState.PENDING);
if (!shouldRunAsync()) {
- runInternal();
+ runInternal(getConfigForOperation());
} else {
Runnable backgroundOperation = new Runnable() {
SessionState ss = SessionState.get();
@@ -151,7 +151,7 @@ public class SQLOperation extends Execut
public void run() {
SessionState.start(ss);
try {
- runInternal();
+ runInternal(getConfigForOperation());
} catch (HiveSQLException e) {
LOG.error("Error: ", e);
// TODO: Return a more detailed error to the client,
@@ -318,4 +318,32 @@ public class SQLOperation extends Execut
return runAsync;
}
+ /**
+ * If there are query specific settings to overlay, then create a copy of config
+ * There are two cases we need to clone the session config that's being passed to hive driver
+ * 1. Async query -
+ * If the client changes a config setting, that shouldn't reflect in the execution already underway
+ * 2. confOverlay -
+ * The query specific settings should only be applied to the query config and not session
+ * @return new configuration
+ * @throws HiveSQLException
+ */
+ private HiveConf getConfigForOperation() throws HiveSQLException {
+ HiveConf sqlOperationConf = getParentSession().getHiveConf();
+ if (!getConfOverlay().isEmpty() || shouldRunAsync()) {
+ // clone the partent session config for this query
+ sqlOperationConf = new HiveConf(sqlOperationConf);
+
+ // apply overlay query specific settings, if any
+ for (Map.Entry<String, String> confEntry : getConfOverlay().entrySet()) {
+ try {
+ sqlOperationConf.verifyAndSet(confEntry.getKey(), confEntry.getValue());
+ } catch (IllegalArgumentException e) {
+ throw new HiveSQLException("Error applying statement specific settings", e);
+ }
+ }
+ }
+ return sqlOperationConf;
+ }
+
}
Modified: hive/branches/tez/service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java?rev=1536823&r1=1536822&r2=1536823&view=diff
==============================================================================
--- hive/branches/tez/service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java (original)
+++ hive/branches/tez/service/src/java/org/apache/hive/service/cli/session/HiveSessionImplwithUGI.java Tue Oct 29 17:25:55 2013
@@ -18,11 +18,9 @@
package org.apache.hive.service.cli.session;
-import java.io.File;
import java.io.IOException;
import java.util.Map;
-import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.ql.metadata.Hive;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.shims.ShimLoader;
@@ -46,7 +44,6 @@ public class HiveSessionImplwithUGI exte
String delegationToken) throws HiveSQLException {
super(username, password, sessionConf);
setSessionUGI(username);
- setUserPath(username);
setDelegationToken(delegationToken);
}
@@ -138,20 +135,6 @@ public class HiveSessionImplwithUGI exte
}
}
- // Append the user name to temp/scratch directory path for each impersonated user
- private void setUserPath(String userName) {
- for (HiveConf.ConfVars var: HiveConf.userVars) {
- String userVar = getHiveConf().getVar(var);
- if (userVar != null) {
- // If there's a path separator at end then remove it
- if (userVar.endsWith(File.separator)) {
- userVar = userVar.substring(0, userVar.length()-2);
- }
- getHiveConf().setVar(var, userVar + "-" + userName);
- }
- }
- }
-
@Override
protected HiveSession getSession() {
assert proxySession != null;