hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1655436 - in /hive/trunk: ql/src/test/queries/clientpositive/ ql/src/test/results/clientpositive/ serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/
Date Wed, 28 Jan 2015 19:18:48 GMT
Author: brock
Date: Wed Jan 28 19:18:47 2015
New Revision: 1655436

URL: http://svn.apache.org/r1655436
Log:
HIVE-9450 - [Parquet] Check all data types work for Parquet in Group By operator (Dong Chen
via Brock)

Modified:
    hive/trunk/ql/src/test/queries/clientpositive/parquet_decimal.q
    hive/trunk/ql/src/test/queries/clientpositive/parquet_types.q
    hive/trunk/ql/src/test/results/clientpositive/parquet_decimal.q.out
    hive/trunk/ql/src/test/results/clientpositive/parquet_types.q.out
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveCharObjectInspector.java
    hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveVarcharObjectInspector.java

Modified: hive/trunk/ql/src/test/queries/clientpositive/parquet_decimal.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/parquet_decimal.q?rev=1655436&r1=1655435&r2=1655436&view=diff
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/parquet_decimal.q (original)
+++ hive/trunk/ql/src/test/queries/clientpositive/parquet_decimal.q Wed Jan 28 19:18:47 2015
@@ -14,6 +14,8 @@ INSERT OVERWRITE TABLE parq_dec SELECT n
 
 SELECT * FROM parq_dec;
 
+SELECT value, count(*) FROM parq_dec GROUP BY value ORDER BY value;
+
 TRUNCATE TABLE parq_dec;
 
 INSERT OVERWRITE TABLE parq_dec SELECT name, NULL FROM dec;

Modified: hive/trunk/ql/src/test/queries/clientpositive/parquet_types.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/parquet_types.q?rev=1655436&r1=1655435&r2=1655436&view=diff
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/parquet_types.q (original)
+++ hive/trunk/ql/src/test/queries/clientpositive/parquet_types.q Wed Jan 28 19:18:47 2015
@@ -49,6 +49,8 @@ hex(cbinary), m1, l1, st1 FROM parquet_t
 
 SELECT cchar, LENGTH(cchar), cvarchar, LENGTH(cvarchar) FROM parquet_types;
 
+-- test types in group by
+
 SELECT ctinyint,
   MAX(cint),
   MIN(csmallint),
@@ -59,3 +61,15 @@ FROM parquet_types
 GROUP BY ctinyint
 ORDER BY ctinyint
 ;
+
+SELECT cfloat, count(*) FROM parquet_types GROUP BY cfloat ORDER BY cfloat;
+
+SELECT cchar, count(*) FROM parquet_types GROUP BY cchar ORDER BY cchar;
+
+SELECT cvarchar, count(*) FROM parquet_types GROUP BY cvarchar ORDER BY cvarchar;
+
+SELECT cstring1, count(*) FROM parquet_types GROUP BY cstring1 ORDER BY cstring1;
+
+SELECT t, count(*) FROM parquet_types GROUP BY t ORDER BY t;
+
+SELECT hex(cbinary), count(*) FROM parquet_types GROUP BY cbinary;
\ No newline at end of file

Modified: hive/trunk/ql/src/test/results/clientpositive/parquet_decimal.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/parquet_decimal.q.out?rev=1655436&r1=1655435&r2=1655436&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/parquet_decimal.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/parquet_decimal.q.out Wed Jan 28 19:18:47
2015
@@ -66,6 +66,24 @@ Mary	33.33
 Tom	19
 Beck	0
 Beck	79.9
+PREHOOK: query: SELECT value, count(*) FROM parq_dec GROUP BY value ORDER BY value
+PREHOOK: type: QUERY
+PREHOOK: Input: default@parq_dec
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT value, count(*) FROM parq_dec GROUP BY value ORDER BY value
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@parq_dec
+#### A masked pattern was here ####
+-12.25	1
+0	1
+4.33	1
+5.96	1
+19	1
+33.33	1
+55.71	1
+77.34	1
+79.9	1
+234.79	1
 PREHOOK: query: TRUNCATE TABLE parq_dec
 PREHOOK: type: TRUNCATETABLE
 PREHOOK: Output: default@parq_dec

Modified: hive/trunk/ql/src/test/results/clientpositive/parquet_types.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/parquet_types.q.out?rev=1655436&r1=1655435&r2=1655436&view=diff
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/parquet_types.q.out (original)
+++ hive/trunk/ql/src/test/results/clientpositive/parquet_types.q.out Wed Jan 28 19:18:47
2015
@@ -209,7 +209,9 @@ uvwzy	5	abcdede	7
 vwxyz	5	abcdede	7
 wxyza	5	abcde	5
 bcdef	5	abcde	5
-PREHOOK: query: SELECT ctinyint,
+PREHOOK: query: -- test types in group by
+
+SELECT ctinyint,
   MAX(cint),
   MIN(csmallint),
   COUNT(cstring1),
@@ -221,7 +223,9 @@ ORDER BY ctinyint
 PREHOOK: type: QUERY
 PREHOOK: Input: default@parquet_types
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT ctinyint,
+POSTHOOK: query: -- test types in group by
+
+SELECT ctinyint,
   MAX(cint),
   MIN(csmallint),
   COUNT(cstring1),
@@ -236,3 +240,135 @@ POSTHOOK: Input: default@parquet_types
 1	121	1	8	1.1749999970197678	2.0621590627301285
 2	119	1	7	1.2142857142857142	1.8
 3	120	1	7	1.171428578240531	1.7999999999999996
+PREHOOK: query: SELECT cfloat, count(*) FROM parquet_types GROUP BY cfloat ORDER BY cfloat
+PREHOOK: type: QUERY
+PREHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT cfloat, count(*) FROM parquet_types GROUP BY cfloat ORDER BY cfloat
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+1.0	5
+1.1	5
+1.2	4
+1.3	4
+1.4	4
+PREHOOK: query: SELECT cchar, count(*) FROM parquet_types GROUP BY cchar ORDER BY cchar
+PREHOOK: type: QUERY
+PREHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT cchar, count(*) FROM parquet_types GROUP BY cchar ORDER BY cchar
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+a    	1
+ab   	1
+abc  	1
+abcd 	1
+abcde	3
+bcdef	2
+cdefg	1
+klmno	1
+nopqr	1
+opqrs	1
+pqrst	2
+qrstu	1
+rstuv	1
+stuvw	1
+tuvwx	1
+uvwzy	1
+vwxyz	1
+wxyza	1
+PREHOOK: query: SELECT cvarchar, count(*) FROM parquet_types GROUP BY cvarchar ORDER BY cvarchar
+PREHOOK: type: QUERY
+PREHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT cvarchar, count(*) FROM parquet_types GROUP BY cvarchar ORDER BY
cvarchar
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+B4F3CAFDBE	1
+a  	1
+ab 	1
+abc	2
+abcd	1
+abcdd	1
+abcde	3
+abcded	4
+abcdede	3
+abcdedef	1
+abcdef	1
+abcdefg	1
+abcdefgh	1
+b	1
+PREHOOK: query: SELECT cstring1, count(*) FROM parquet_types GROUP BY cstring1 ORDER BY cstring1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT cstring1, count(*) FROM parquet_types GROUP BY cstring1 ORDER BY
cstring1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+abc	1
+bcd	1
+cde	1
+def	1
+efg	1
+fgh	1
+ghi	1
+hij	1
+ijk	1
+jkl	1
+klm	1
+lmn	1
+mno	1
+nop	1
+pqr	1
+qrs	2
+stu	1
+vwx	1
+wxy	1
+yza	1
+zab	1
+PREHOOK: query: SELECT t, count(*) FROM parquet_types GROUP BY t ORDER BY t
+PREHOOK: type: QUERY
+PREHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT t, count(*) FROM parquet_types GROUP BY t ORDER BY t
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+2011-01-01 01:01:01.111111111	1
+2012-02-02 02:02:02.222222222	1
+2013-03-03 03:03:03.333333333	1
+2014-04-04 04:04:04.444444444	1
+2015-05-05 05:05:05.555555555	1
+2016-06-06 06:06:06.666666666	1
+2017-07-07 07:07:07.777777777	1
+2018-08-08 08:08:08.888888888	1
+2019-09-09 09:09:09.999999999	1
+2020-10-10 10:10:10.101010101	1
+2021-11-11 11:11:11.111111111	1
+2022-12-12 12:12:12.121212121	1
+2023-01-02 13:13:13.131313131	1
+2024-02-02 14:14:14.141414141	1
+2025-03-03 15:15:15.151515151	1
+2026-04-04 16:16:16.161616161	1
+2027-05-05 17:17:17.171717171	1
+2028-06-06 18:18:18.181818181	1
+2029-07-07 19:19:19.191919191	1
+2030-08-08 20:20:20.202020202	1
+2031-09-09 21:21:21.212121212	1
+2032-10-10 22:22:22.222222222	1
+PREHOOK: query: SELECT hex(cbinary), count(*) FROM parquet_types GROUP BY cbinary
+PREHOOK: type: QUERY
+PREHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT hex(cbinary), count(*) FROM parquet_types GROUP BY cbinary
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@parquet_types
+#### A masked pattern was here ####
+	1
+68656C6C6F	1
+68692CCAC0BDE7	10
+B4F3CAFDBEDD	10

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveCharObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveCharObjectInspector.java?rev=1655436&r1=1655435&r2=1655436&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveCharObjectInspector.java
(original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveCharObjectInspector.java
Wed Jan 28 19:18:47 2015
@@ -101,6 +101,14 @@ public class WritableHiveCharObjectInspe
     if (o == null) {
       return null;
     }
+
+    if (o instanceof Text) {
+      String str = ((Text)o).toString();
+      HiveCharWritable hcw = new HiveCharWritable();
+      hcw.set(str, ((CharTypeInfo)typeInfo).getLength());
+      return hcw;
+    }
+
     HiveCharWritable writable = (HiveCharWritable) o;
     if (doesWritableMatchTypeParams((HiveCharWritable) o)) {
       return new HiveCharWritable(writable);

Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveVarcharObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveVarcharObjectInspector.java?rev=1655436&r1=1655435&r2=1655436&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveVarcharObjectInspector.java
(original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveVarcharObjectInspector.java
Wed Jan 28 19:18:47 2015
@@ -106,6 +106,14 @@ implements SettableHiveVarcharObjectInsp
     if (o == null) {
       return null;
     }
+
+    if (o instanceof Text) {
+      String str = ((Text)o).toString();
+      HiveVarcharWritable hcw = new HiveVarcharWritable();
+      hcw.set(str, ((VarcharTypeInfo)typeInfo).getLength());
+      return hcw;
+    }
+
     HiveVarcharWritable writable = (HiveVarcharWritable)o;
     if (doesWritableMatchTypeParams((HiveVarcharWritable)o)) {
       return new HiveVarcharWritable(writable);



Mime
View raw message