You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2015/03/19 20:05:29 UTC
svn commit: r1667850 [3/4] - in /hive/trunk:
common/src/java/org/apache/hadoop/hive/common/type/
common/src/java/org/apache/hive/common/util/
common/src/test/org/apache/hadoop/hive/common/type/
common/src/test/org/apache/hive/common/util/ ql/src/java/o...
Added: hive/trunk/ql/src/test/results/clientpositive/interval_2.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/interval_2.q.out?rev=1667850&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/interval_2.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/interval_2.q.out Thu Mar 19 19:05:28 2015
@@ -0,0 +1,231 @@
+PREHOOK: query: -- group-by/order-by/aggregation functions
+
+select
+ iym, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by iym
+order by iym asc
+limit 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: -- group-by/order-by/aggregation functions
+
+select
+ iym, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by iym
+order by iym asc
+limit 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+0-1 3 0 0 0-1 0-1 0 01:01:01.000000000 0 01:01:01.000000000
+2-1 1 2 2 2-1 2-1 2 01:01:01.000000000 2 01:01:01.000000000
+4-1 1 4 4 4-1 4-1 4 01:01:01.000000000 4 01:01:01.000000000
+5-1 3 5 5 5-1 5-1 5 01:01:01.000000000 5 01:01:01.000000000
+8-1 1 8 8 8-1 8-1 8 01:01:01.000000000 8 01:01:01.000000000
+PREHOOK: query: select
+ iym, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by iym
+order by iym desc
+limit 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ iym, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by iym
+order by iym desc
+limit 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+498-1 3 498 498 498-1 498-1 498 01:01:01.000000000 498 01:01:01.000000000
+497-1 1 497 497 497-1 497-1 497 01:01:01.000000000 497 01:01:01.000000000
+496-1 1 496 496 496-1 496-1 496 01:01:01.000000000 496 01:01:01.000000000
+495-1 1 495 495 495-1 495-1 495 01:01:01.000000000 495 01:01:01.000000000
+494-1 1 494 494 494-1 494-1 494 01:01:01.000000000 494 01:01:01.000000000
+PREHOOK: query: -- same query as previous, with having clause
+select
+ iym, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by iym
+having max(idt) > interval '496 0:0:0' day to second
+order by iym desc
+limit 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: -- same query as previous, with having clause
+select
+ iym, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by iym
+having max(idt) > interval '496 0:0:0' day to second
+order by iym desc
+limit 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+498-1 3 498 498 498-1 498-1 498 01:01:01.000000000 498 01:01:01.000000000
+497-1 1 497 497 497-1 497-1 497 01:01:01.000000000 497 01:01:01.000000000
+496-1 1 496 496 496-1 496-1 496 01:01:01.000000000 496 01:01:01.000000000
+PREHOOK: query: select
+ idt, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by idt
+order by idt asc
+limit 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ idt, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by idt
+order by idt asc
+limit 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+0 01:01:01.000000000 3 0 0 0-1 0-1 0 01:01:01.000000000 0 01:01:01.000000000
+2 01:01:01.000000000 1 2 2 2-1 2-1 2 01:01:01.000000000 2 01:01:01.000000000
+4 01:01:01.000000000 1 4 4 4-1 4-1 4 01:01:01.000000000 4 01:01:01.000000000
+5 01:01:01.000000000 3 5 5 5-1 5-1 5 01:01:01.000000000 5 01:01:01.000000000
+8 01:01:01.000000000 1 8 8 8-1 8-1 8 01:01:01.000000000 8 01:01:01.000000000
+PREHOOK: query: select
+ idt, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by idt
+order by idt desc
+limit 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ idt, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by idt
+order by idt desc
+limit 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+498 01:01:01.000000000 3 498 498 498-1 498-1 498 01:01:01.000000000 498 01:01:01.000000000
+497 01:01:01.000000000 1 497 497 497-1 497-1 497 01:01:01.000000000 497 01:01:01.000000000
+496 01:01:01.000000000 1 496 496 496-1 496-1 496 01:01:01.000000000 496 01:01:01.000000000
+495 01:01:01.000000000 1 495 495 495-1 495-1 495 01:01:01.000000000 495 01:01:01.000000000
+494 01:01:01.000000000 1 494 494 494-1 494-1 494 01:01:01.000000000 494 01:01:01.000000000
+PREHOOK: query: -- same query as previous, with having clause
+select
+ idt, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by idt
+having max(iym) < interval '496-0' year to month
+order by idt desc
+limit 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: -- same query as previous, with having clause
+select
+ idt, count(*), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+group by idt
+having max(iym) < interval '496-0' year to month
+order by idt desc
+limit 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+495 01:01:01.000000000 1 495 495 495-1 495-1 495 01:01:01.000000000 495 01:01:01.000000000
+494 01:01:01.000000000 1 494 494 494-1 494-1 494 01:01:01.000000000 494 01:01:01.000000000
+493 01:01:01.000000000 1 493 493 493-1 493-1 493 01:01:01.000000000 493 01:01:01.000000000
+492 01:01:01.000000000 2 492 492 492-1 492-1 492 01:01:01.000000000 492 01:01:01.000000000
+491 01:01:01.000000000 1 491 491 491-1 491-1 491 01:01:01.000000000 491 01:01:01.000000000
+PREHOOK: query: select
+ count(iym), count(idt), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ count(iym), count(idt), min(key), max(key), min(iym), max(iym), min(idt), max(idt)
+from (
+ select
+ key,
+ interval_year_month(concat(key, '-1')) as iym,
+ interval_day_time(concat(key, ' 1:1:1')) as idt
+ from src) q1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+500 500 0 98 0-1 498-1 0 01:01:01.000000000 498 01:01:01.000000000
Added: hive/trunk/ql/src/test/results/clientpositive/interval_3.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/interval_3.q.out?rev=1667850&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/interval_3.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/interval_3.q.out Thu Mar 19 19:05:28 2015
@@ -0,0 +1,102 @@
+PREHOOK: query: -- where clause
+select
+ l_orderkey, l_shipdate, l_receiptdate
+from lineitem
+ where (cast(l_shipdate as date) - date '1992-01-01') < interval '365 0:0:0' day to second
+order by l_orderkey
+PREHOOK: type: QUERY
+PREHOOK: Input: default@lineitem
+#### A masked pattern was here ####
+POSTHOOK: query: -- where clause
+select
+ l_orderkey, l_shipdate, l_receiptdate
+from lineitem
+ where (cast(l_shipdate as date) - date '1992-01-01') < interval '365 0:0:0' day to second
+order by l_orderkey
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@lineitem
+#### A masked pattern was here ####
+6 1992-04-27 1992-05-02
+37 1992-07-10 1992-08-02
+37 1992-07-02 1992-07-28
+37 1992-07-21 1992-08-15
+PREHOOK: query: select
+ l_orderkey, l_shipdate, l_receiptdate
+from lineitem
+ where (cast(l_shipdate as date) + interval '1-0' year to month) <= date '1994-01-01'
+order by l_orderkey
+PREHOOK: type: QUERY
+PREHOOK: Input: default@lineitem
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ l_orderkey, l_shipdate, l_receiptdate
+from lineitem
+ where (cast(l_shipdate as date) + interval '1-0' year to month) <= date '1994-01-01'
+order by l_orderkey
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@lineitem
+#### A masked pattern was here ####
+6 1992-04-27 1992-05-02
+37 1992-07-10 1992-08-02
+37 1992-07-02 1992-07-28
+37 1992-07-21 1992-08-15
+PREHOOK: query: select
+ l_orderkey, l_shipdate, l_receiptdate
+from lineitem
+ where (cast(l_shipdate as date) + interval '1-0' year to month) <= date '1994-01-01'
+ and (cast(l_receiptdate as date) - cast(l_shipdate as date)) < interval '10' day
+order by l_orderkey
+PREHOOK: type: QUERY
+PREHOOK: Input: default@lineitem
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ l_orderkey, l_shipdate, l_receiptdate
+from lineitem
+ where (cast(l_shipdate as date) + interval '1-0' year to month) <= date '1994-01-01'
+ and (cast(l_receiptdate as date) - cast(l_shipdate as date)) < interval '10' day
+order by l_orderkey
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@lineitem
+#### A masked pattern was here ####
+6 1992-04-27 1992-05-02
+PREHOOK: query: -- joins
+select
+ a.l_orderkey, b.l_orderkey, a.interval1
+from
+ (
+ select
+ l_orderkey, l_shipdate, l_receiptdate, (cast(l_receiptdate as date) - cast(l_shipdate as date)) as interval1
+ from lineitem
+ ) a
+ join
+ (
+ select
+ l_orderkey, l_shipdate, l_receiptdate, (cast(l_receiptdate as date) - date '1992-07-02') as interval2
+ from lineitem
+ ) b
+ on a.interval1 = b.interval2 and a.l_orderkey = b.l_orderkey
+order by a.l_orderkey
+PREHOOK: type: QUERY
+PREHOOK: Input: default@lineitem
+#### A masked pattern was here ####
+POSTHOOK: query: -- joins
+select
+ a.l_orderkey, b.l_orderkey, a.interval1
+from
+ (
+ select
+ l_orderkey, l_shipdate, l_receiptdate, (cast(l_receiptdate as date) - cast(l_shipdate as date)) as interval1
+ from lineitem
+ ) a
+ join
+ (
+ select
+ l_orderkey, l_shipdate, l_receiptdate, (cast(l_receiptdate as date) - date '1992-07-02') as interval2
+ from lineitem
+ ) b
+ on a.interval1 = b.interval2 and a.l_orderkey = b.l_orderkey
+order by a.l_orderkey
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@lineitem
+#### A masked pattern was here ####
+37 37 26 00:00:00.000000000
Added: hive/trunk/ql/src/test/results/clientpositive/interval_arithmetic.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/interval_arithmetic.q.out?rev=1667850&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/interval_arithmetic.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/interval_arithmetic.q.out Thu Mar 19 19:05:28 2015
@@ -0,0 +1,620 @@
+PREHOOK: query: create table interval_arithmetic_1 (dateval date, tsval timestamp)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@interval_arithmetic_1
+POSTHOOK: query: create table interval_arithmetic_1 (dateval date, tsval timestamp)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@interval_arithmetic_1
+PREHOOK: query: insert overwrite table interval_arithmetic_1
+ select cast(ctimestamp1 as date), ctimestamp1 from alltypesorc
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+PREHOOK: Output: default@interval_arithmetic_1
+POSTHOOK: query: insert overwrite table interval_arithmetic_1
+ select cast(ctimestamp1 as date), ctimestamp1 from alltypesorc
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+POSTHOOK: Output: default@interval_arithmetic_1
+POSTHOOK: Lineage: interval_arithmetic_1.dateval EXPRESSION [(alltypesorc)alltypesorc.FieldSchema(name:ctimestamp1, type:timestamp, comment:null), ]
+POSTHOOK: Lineage: interval_arithmetic_1.tsval SIMPLE [(alltypesorc)alltypesorc.FieldSchema(name:ctimestamp1, type:timestamp, comment:null), ]
+PREHOOK: query: -- interval year-month arithmetic
+explain
+select
+ dateval,
+ dateval - interval '2-2' year to month,
+ dateval - interval '-2-2' year to month,
+ dateval + interval '2-2' year to month,
+ dateval + interval '-2-2' year to month,
+ - interval '2-2' year to month + dateval,
+ interval '2-2' year to month + dateval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+POSTHOOK: query: -- interval year-month arithmetic
+explain
+select
+ dateval,
+ dateval - interval '2-2' year to month,
+ dateval - interval '-2-2' year to month,
+ dateval + interval '2-2' year to month,
+ dateval + interval '-2-2' year to month,
+ - interval '2-2' year to month + dateval,
+ interval '2-2' year to month + dateval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: interval_arithmetic_1
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: dateval (type: date), (dateval - 2-2) (type: date), (dateval - -2-2) (type: date), (dateval + 2-2) (type: date), (dateval + -2-2) (type: date), (-2-2 + dateval) (type: date), (2-2 + dateval) (type: date)
+ outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Limit
+ Number of rows: 2
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: 2
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: select
+ dateval,
+ dateval - interval '2-2' year to month,
+ dateval - interval '-2-2' year to month,
+ dateval + interval '2-2' year to month,
+ dateval + interval '-2-2' year to month,
+ - interval '2-2' year to month + dateval,
+ interval '2-2' year to month + dateval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+PREHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ dateval,
+ dateval - interval '2-2' year to month,
+ dateval - interval '-2-2' year to month,
+ dateval + interval '2-2' year to month,
+ dateval + interval '-2-2' year to month,
+ - interval '2-2' year to month + dateval,
+ interval '2-2' year to month + dateval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+1970-01-01 1967-11-01 1972-03-01 1972-03-01 1967-11-01 1967-11-01 1972-03-01
+NULL NULL NULL NULL NULL NULL NULL
+PREHOOK: query: explain
+select
+ dateval,
+ dateval - date '1999-06-07',
+ date '1999-06-07' - dateval,
+ dateval - dateval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+ dateval,
+ dateval - date '1999-06-07',
+ date '1999-06-07' - dateval,
+ dateval - dateval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: interval_arithmetic_1
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: dateval (type: date), (dateval - 1999-06-07) (type: interval_day_time), (1999-06-07 - dateval) (type: interval_day_time), (dateval - dateval) (type: interval_day_time)
+ outputColumnNames: _col0, _col1, _col2, _col3
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Limit
+ Number of rows: 2
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: 2
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: select
+ dateval,
+ dateval - date '1999-06-07',
+ date '1999-06-07' - dateval,
+ dateval - dateval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+PREHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ dateval,
+ dateval - date '1999-06-07',
+ date '1999-06-07' - dateval,
+ dateval - dateval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+1970-01-01 -10748 23:00:00.000000000 10748 23:00:00.000000000 0 00:00:00.000000000
+NULL NULL NULL NULL
+PREHOOK: query: explain
+select
+ tsval,
+ tsval - interval '2-2' year to month,
+ tsval - interval '-2-2' year to month,
+ tsval + interval '2-2' year to month,
+ tsval + interval '-2-2' year to month,
+ - interval '2-2' year to month + tsval,
+ interval '2-2' year to month + tsval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+ tsval,
+ tsval - interval '2-2' year to month,
+ tsval - interval '-2-2' year to month,
+ tsval + interval '2-2' year to month,
+ tsval + interval '-2-2' year to month,
+ - interval '2-2' year to month + tsval,
+ interval '2-2' year to month + tsval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: interval_arithmetic_1
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: tsval (type: timestamp), (tsval - 2-2) (type: timestamp), (tsval - -2-2) (type: timestamp), (tsval + 2-2) (type: timestamp), (tsval + -2-2) (type: timestamp), (-2-2 + tsval) (type: timestamp), (2-2 + tsval) (type: timestamp)
+ outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Limit
+ Number of rows: 2
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: 2
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: select
+ tsval,
+ tsval - interval '2-2' year to month,
+ tsval - interval '-2-2' year to month,
+ tsval + interval '2-2' year to month,
+ tsval + interval '-2-2' year to month,
+ - interval '2-2' year to month + tsval,
+ interval '2-2' year to month + tsval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+PREHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ tsval,
+ tsval - interval '2-2' year to month,
+ tsval - interval '-2-2' year to month,
+ tsval + interval '2-2' year to month,
+ tsval + interval '-2-2' year to month,
+ - interval '2-2' year to month + tsval,
+ interval '2-2' year to month + tsval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+1969-12-31 15:59:46.674 1967-10-31 15:59:46.674 1972-02-29 15:59:46.674 1972-02-29 15:59:46.674 1967-10-31 15:59:46.674 1967-10-31 15:59:46.674 1972-02-29 15:59:46.674
+NULL NULL NULL NULL NULL NULL NULL
+PREHOOK: query: explain
+select
+ interval '2-2' year to month + interval '3-3' year to month,
+ interval '2-2' year to month - interval '3-3' year to month
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+ interval '2-2' year to month + interval '3-3' year to month,
+ interval '2-2' year to month - interval '3-3' year to month
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-0 is a root stage
+
+STAGE PLANS:
+ Stage: Stage-0
+ Fetch Operator
+ limit: 2
+ Processor Tree:
+ TableScan
+ alias: interval_arithmetic_1
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ expressions: 5-5 (type: interval_year_month), -1-1 (type: interval_year_month)
+ outputColumnNames: _col0, _col1
+ Statistics: Num rows: 12288 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
+ Limit
+ Number of rows: 2
+ Statistics: Num rows: 2 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
+ ListSink
+
+PREHOOK: query: select
+ interval '2-2' year to month + interval '3-3' year to month,
+ interval '2-2' year to month - interval '3-3' year to month
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+PREHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ interval '2-2' year to month + interval '3-3' year to month,
+ interval '2-2' year to month - interval '3-3' year to month
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+5-5 -1-1
+5-5 -1-1
+PREHOOK: query: -- interval day-time arithmetic
+explain
+select
+ dateval,
+ dateval - interval '99 11:22:33.123456789' day to second,
+ dateval - interval '-99 11:22:33.123456789' day to second,
+ dateval + interval '99 11:22:33.123456789' day to second,
+ dateval + interval '-99 11:22:33.123456789' day to second,
+ -interval '99 11:22:33.123456789' day to second + dateval,
+ interval '99 11:22:33.123456789' day to second + dateval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+POSTHOOK: query: -- interval day-time arithmetic
+explain
+select
+ dateval,
+ dateval - interval '99 11:22:33.123456789' day to second,
+ dateval - interval '-99 11:22:33.123456789' day to second,
+ dateval + interval '99 11:22:33.123456789' day to second,
+ dateval + interval '-99 11:22:33.123456789' day to second,
+ -interval '99 11:22:33.123456789' day to second + dateval,
+ interval '99 11:22:33.123456789' day to second + dateval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: interval_arithmetic_1
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: dateval (type: date), (dateval - 99 11:22:33.123456789) (type: timestamp), (dateval - -99 11:22:33.123456789) (type: timestamp), (dateval + 99 11:22:33.123456789) (type: timestamp), (dateval + -99 11:22:33.123456789) (type: timestamp), (-99 11:22:33.123456789 + dateval) (type: timestamp), (99 11:22:33.123456789 + dateval) (type: timestamp)
+ outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Limit
+ Number of rows: 2
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: 2
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: select
+ dateval,
+ dateval - interval '99 11:22:33.123456789' day to second,
+ dateval - interval '-99 11:22:33.123456789' day to second,
+ dateval + interval '99 11:22:33.123456789' day to second,
+ dateval + interval '-99 11:22:33.123456789' day to second,
+ -interval '99 11:22:33.123456789' day to second + dateval,
+ interval '99 11:22:33.123456789' day to second + dateval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+PREHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ dateval,
+ dateval - interval '99 11:22:33.123456789' day to second,
+ dateval - interval '-99 11:22:33.123456789' day to second,
+ dateval + interval '99 11:22:33.123456789' day to second,
+ dateval + interval '-99 11:22:33.123456789' day to second,
+ -interval '99 11:22:33.123456789' day to second + dateval,
+ interval '99 11:22:33.123456789' day to second + dateval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+1970-01-01 1969-09-23 13:37:26.876543211 1970-04-10 11:22:33.123456789 1970-04-10 11:22:33.123456789 1969-09-23 13:37:26.876543211 1969-09-23 13:37:26.876543211 1970-04-10 11:22:33.123456789
+NULL NULL NULL NULL NULL NULL NULL
+PREHOOK: query: explain
+select
+ dateval,
+ tsval,
+ dateval - tsval,
+ tsval - dateval,
+ tsval - tsval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+ dateval,
+ tsval,
+ dateval - tsval,
+ tsval - dateval,
+ tsval - tsval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: interval_arithmetic_1
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: dateval (type: date), tsval (type: timestamp), (dateval - tsval) (type: interval_day_time), (tsval - dateval) (type: interval_day_time), (tsval - tsval) (type: interval_day_time)
+ outputColumnNames: _col0, _col1, _col2, _col3, _col4
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Limit
+ Number of rows: 2
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: 2
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: select
+ dateval,
+ tsval,
+ dateval - tsval,
+ tsval - dateval,
+ tsval - tsval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+PREHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ dateval,
+ tsval,
+ dateval - tsval,
+ tsval - dateval,
+ tsval - tsval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+1970-01-01 1969-12-31 15:59:46.674 0 08:00:12.326000000 -0 08:00:12.326000000 0 00:00:00.000000000
+NULL NULL NULL NULL NULL
+PREHOOK: query: explain
+select
+ tsval,
+ tsval - interval '99 11:22:33.123456789' day to second,
+ tsval - interval '-99 11:22:33.123456789' day to second,
+ tsval + interval '99 11:22:33.123456789' day to second,
+ tsval + interval '-99 11:22:33.123456789' day to second,
+ -interval '99 11:22:33.123456789' day to second + tsval,
+ interval '99 11:22:33.123456789' day to second + tsval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+ tsval,
+ tsval - interval '99 11:22:33.123456789' day to second,
+ tsval - interval '-99 11:22:33.123456789' day to second,
+ tsval + interval '99 11:22:33.123456789' day to second,
+ tsval + interval '-99 11:22:33.123456789' day to second,
+ -interval '99 11:22:33.123456789' day to second + tsval,
+ interval '99 11:22:33.123456789' day to second + tsval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: interval_arithmetic_1
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: tsval (type: timestamp), (tsval - 99 11:22:33.123456789) (type: timestamp), (tsval - -99 11:22:33.123456789) (type: timestamp), (tsval + 99 11:22:33.123456789) (type: timestamp), (tsval + -99 11:22:33.123456789) (type: timestamp), (-99 11:22:33.123456789 + tsval) (type: timestamp), (99 11:22:33.123456789 + tsval) (type: timestamp)
+ outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: NONE
+ Limit
+ Number of rows: 2
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 2 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: 2
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: select
+ tsval,
+ tsval - interval '99 11:22:33.123456789' day to second,
+ tsval - interval '-99 11:22:33.123456789' day to second,
+ tsval + interval '99 11:22:33.123456789' day to second,
+ tsval + interval '-99 11:22:33.123456789' day to second,
+ -interval '99 11:22:33.123456789' day to second + tsval,
+ interval '99 11:22:33.123456789' day to second + tsval
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+PREHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ tsval,
+ tsval - interval '99 11:22:33.123456789' day to second,
+ tsval - interval '-99 11:22:33.123456789' day to second,
+ tsval + interval '99 11:22:33.123456789' day to second,
+ tsval + interval '-99 11:22:33.123456789' day to second,
+ -interval '99 11:22:33.123456789' day to second + tsval,
+ interval '99 11:22:33.123456789' day to second + tsval
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+1969-12-31 15:59:46.674 1969-09-23 05:37:13.550543211 1970-04-10 03:22:19.797456789 1970-04-10 03:22:19.797456789 1969-09-23 05:37:13.550543211 1969-09-23 05:37:13.550543211 1970-04-10 03:22:19.797456789
+NULL NULL NULL NULL NULL NULL NULL
+PREHOOK: query: explain
+select
+ interval '99 11:22:33.123456789' day to second + interval '10 9:8:7.123456789' day to second,
+ interval '99 11:22:33.123456789' day to second - interval '10 9:8:7.123456789' day to second
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+ interval '99 11:22:33.123456789' day to second + interval '10 9:8:7.123456789' day to second,
+ interval '99 11:22:33.123456789' day to second - interval '10 9:8:7.123456789' day to second
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-0 is a root stage
+
+STAGE PLANS:
+ Stage: Stage-0
+ Fetch Operator
+ limit: 2
+ Processor Tree:
+ TableScan
+ alias: interval_arithmetic_1
+ Statistics: Num rows: 12288 Data size: 326837 Basic stats: COMPLETE Column stats: COMPLETE
+ Select Operator
+ expressions: 109 20:30:40.246913578 (type: interval_day_time), 89 02:14:26.000000000 (type: interval_day_time)
+ outputColumnNames: _col0, _col1
+ Statistics: Num rows: 12288 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
+ Limit
+ Number of rows: 2
+ Statistics: Num rows: 2 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
+ ListSink
+
+PREHOOK: query: select
+ interval '99 11:22:33.123456789' day to second + interval '10 9:8:7.123456789' day to second,
+ interval '99 11:22:33.123456789' day to second - interval '10 9:8:7.123456789' day to second
+from interval_arithmetic_1
+limit 2
+PREHOOK: type: QUERY
+PREHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+POSTHOOK: query: select
+ interval '99 11:22:33.123456789' day to second + interval '10 9:8:7.123456789' day to second,
+ interval '99 11:22:33.123456789' day to second - interval '10 9:8:7.123456789' day to second
+from interval_arithmetic_1
+limit 2
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@interval_arithmetic_1
+#### A masked pattern was here ####
+109 20:30:40.246913578 89 02:14:26.000000000
+109 20:30:40.246913578 89 02:14:26.000000000
+PREHOOK: query: drop table interval_arithmetic_1
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@interval_arithmetic_1
+PREHOOK: Output: default@interval_arithmetic_1
+POSTHOOK: query: drop table interval_arithmetic_1
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@interval_arithmetic_1
+POSTHOOK: Output: default@interval_arithmetic_1
Added: hive/trunk/ql/src/test/results/clientpositive/interval_comparison.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/interval_comparison.q.out?rev=1667850&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/interval_comparison.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/interval_comparison.q.out Thu Mar 19 19:05:28 2015
@@ -0,0 +1,188 @@
+PREHOOK: query: -- should all be true
+select
+ i1 = i1,
+ i1 = i2,
+ i1 >= i2,
+ i1 <= i2,
+ i3 = i3,
+ i3 = i4,
+ i3 <= i4,
+ i3 >= i4,
+ i1 < i3,
+ i3 > i1,
+ i1 != i3
+from (
+ select
+ interval '2-0' year to month as i1,
+ interval '2' year as i2,
+ interval '2-1' year to month as i3,
+ interval '25' month as i4
+ from src limit 1
+) q1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: -- should all be true
+select
+ i1 = i1,
+ i1 = i2,
+ i1 >= i2,
+ i1 <= i2,
+ i3 = i3,
+ i3 = i4,
+ i3 <= i4,
+ i3 >= i4,
+ i1 < i3,
+ i3 > i1,
+ i1 != i3
+from (
+ select
+ interval '2-0' year to month as i1,
+ interval '2' year as i2,
+ interval '2-1' year to month as i3,
+ interval '25' month as i4
+ from src limit 1
+) q1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+true true true true true true true true true true true
+PREHOOK: query: -- should all be false
+select
+ i1 != i1,
+ i1 != i2,
+ i1 < i2,
+ i1 > i2,
+ i1 = i3,
+ i1 > i3,
+ i1 >= i3,
+ i3 < i1,
+ i3 <= i1
+from (
+ select
+ interval '2-0' year to month as i1,
+ interval '2' year as i2,
+ interval '2-1' year to month as i3,
+ interval '25' month as i4
+ from src limit 1
+) q1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: -- should all be false
+select
+ i1 != i1,
+ i1 != i2,
+ i1 < i2,
+ i1 > i2,
+ i1 = i3,
+ i1 > i3,
+ i1 >= i3,
+ i3 < i1,
+ i3 <= i1
+from (
+ select
+ interval '2-0' year to month as i1,
+ interval '2' year as i2,
+ interval '2-1' year to month as i3,
+ interval '25' month as i4
+ from src limit 1
+) q1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+false false false false false false false false false
+PREHOOK: query: -- should all be true
+select
+ i1 = i1,
+ i1 = i2,
+ i1 >= i2,
+ i1 <= i2,
+ i3 = i3,
+ i3 = i4,
+ i3 <= i4,
+ i3 >= i4,
+ i1 < i3,
+ i3 > i1,
+ i1 != i3
+from (
+ select
+ interval '1 0:0:0' day to second as i1,
+ interval '24' hour as i2,
+ interval '1 0:0:1' day to second as i3,
+ interval '86401' second as i4
+ from src limit 1
+) q1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: -- should all be true
+select
+ i1 = i1,
+ i1 = i2,
+ i1 >= i2,
+ i1 <= i2,
+ i3 = i3,
+ i3 = i4,
+ i3 <= i4,
+ i3 >= i4,
+ i1 < i3,
+ i3 > i1,
+ i1 != i3
+from (
+ select
+ interval '1 0:0:0' day to second as i1,
+ interval '24' hour as i2,
+ interval '1 0:0:1' day to second as i3,
+ interval '86401' second as i4
+ from src limit 1
+) q1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+true true true true true true true true true true true
+PREHOOK: query: -- should all be false
+select
+ i1 != i1,
+ i1 != i2,
+ i1 < i2,
+ i1 > i2,
+ i1 = i3,
+ i1 > i3,
+ i1 >= i3,
+ i3 < i1,
+ i3 <= i1
+from (
+ select
+ interval '1 0:0:0' day to second as i1,
+ interval '24' hour as i2,
+ interval '1 0:0:1' day to second as i3,
+ interval '86401' second as i4
+ from src limit 1
+) q1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: -- should all be false
+select
+ i1 != i1,
+ i1 != i2,
+ i1 < i2,
+ i1 > i2,
+ i1 = i3,
+ i1 > i3,
+ i1 >= i3,
+ i3 < i1,
+ i3 <= i1
+from (
+ select
+ interval '1 0:0:0' day to second as i1,
+ interval '24' hour as i2,
+ interval '1 0:0:1' day to second as i3,
+ interval '86401' second as i4
+ from src limit 1
+) q1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+false false false false false false false false false
Modified: hive/trunk/serde/if/serde.thrift
URL: http://svn.apache.org/viewvc/hive/trunk/serde/if/serde.thrift?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/if/serde.thrift (original)
+++ hive/trunk/serde/if/serde.thrift Thu Mar 19 19:05:28 2015
@@ -60,6 +60,8 @@ const string DATETIME_TYPE_NAME = "date
const string TIMESTAMP_TYPE_NAME = "timestamp";
const string DECIMAL_TYPE_NAME = "decimal";
const string BINARY_TYPE_NAME = "binary";
+const string INTERVAL_YEAR_MONTH_TYPE_NAME = "interval_year_month";
+const string INTERVAL_DAY_TIME_TYPE_NAME = "interval_day_time";
const string LIST_TYPE_NAME = "array";
const string MAP_TYPE_NAME = "map";
@@ -71,7 +73,27 @@ const string LIST_COLUMN_TYPES = "column
const string TIMESTAMP_FORMATS = "timestamp.formats";
-const set<string> PrimitiveTypes = [ VOID_TYPE_NAME BOOLEAN_TYPE_NAME TINYINT_TYPE_NAME SMALLINT_TYPE_NAME INT_TYPE_NAME BIGINT_TYPE_NAME FLOAT_TYPE_NAME DOUBLE_TYPE_NAME STRING_TYPE_NAME VARCHAR_TYPE_NAME CHAR_TYPE_NAME DATE_TYPE_NAME DATETIME_TYPE_NAME TIMESTAMP_TYPE_NAME DECIMAL_TYPE_NAME BINARY_TYPE_NAME],
+const set<string> PrimitiveTypes = [
+ VOID_TYPE_NAME
+ BOOLEAN_TYPE_NAME
+ TINYINT_TYPE_NAME
+ SMALLINT_TYPE_NAME
+ INT_TYPE_NAME
+ BIGINT_TYPE_NAME
+ FLOAT_TYPE_NAME
+ DOUBLE_TYPE_NAME
+ STRING_TYPE_NAME
+ VARCHAR_TYPE_NAME
+ CHAR_TYPE_NAME
+ DATE_TYPE_NAME
+ DATETIME_TYPE_NAME
+ TIMESTAMP_TYPE_NAME
+ INTERVAL_YEAR_MONTH_TYPE_NAME
+ INTERVAL_DAY_TIME_TYPE_NAME
+ DECIMAL_TYPE_NAME
+ BINARY_TYPE_NAME
+],
+
const set<string> CollectionTypes = [ LIST_TYPE_NAME MAP_TYPE_NAME ],
const set<string> IntegralTypes = [ TINYINT_TYPE_NAME SMALLINT_TYPE_NAME INT_TYPE_NAME BIGINT_TYPE_NAME ],
Modified: hive/trunk/serde/src/gen/thrift/gen-cpp/serde_constants.cpp
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-cpp/serde_constants.cpp?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-cpp/serde_constants.cpp (original)
+++ hive/trunk/serde/src/gen/thrift/gen-cpp/serde_constants.cpp Thu Mar 19 19:05:28 2015
@@ -77,6 +77,10 @@ serdeConstants::serdeConstants() {
BINARY_TYPE_NAME = "binary";
+ INTERVAL_YEAR_MONTH_TYPE_NAME = "interval_year_month";
+
+ INTERVAL_DAY_TIME_TYPE_NAME = "interval_day_time";
+
LIST_TYPE_NAME = "array";
MAP_TYPE_NAME = "map";
@@ -105,6 +109,8 @@ serdeConstants::serdeConstants() {
PrimitiveTypes.insert("date");
PrimitiveTypes.insert("datetime");
PrimitiveTypes.insert("timestamp");
+ PrimitiveTypes.insert("interval_year_month");
+ PrimitiveTypes.insert("interval_day_time");
PrimitiveTypes.insert("decimal");
PrimitiveTypes.insert("binary");
Modified: hive/trunk/serde/src/gen/thrift/gen-cpp/serde_constants.h
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-cpp/serde_constants.h?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-cpp/serde_constants.h (original)
+++ hive/trunk/serde/src/gen/thrift/gen-cpp/serde_constants.h Thu Mar 19 19:05:28 2015
@@ -48,6 +48,8 @@ class serdeConstants {
std::string TIMESTAMP_TYPE_NAME;
std::string DECIMAL_TYPE_NAME;
std::string BINARY_TYPE_NAME;
+ std::string INTERVAL_YEAR_MONTH_TYPE_NAME;
+ std::string INTERVAL_DAY_TIME_TYPE_NAME;
std::string LIST_TYPE_NAME;
std::string MAP_TYPE_NAME;
std::string STRUCT_TYPE_NAME;
Modified: hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/serdeConstants.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/serdeConstants.java?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/serdeConstants.java (original)
+++ hive/trunk/serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/serdeConstants.java Thu Mar 19 19:05:28 2015
@@ -99,6 +99,10 @@ public class serdeConstants {
public static final String BINARY_TYPE_NAME = "binary";
+ public static final String INTERVAL_YEAR_MONTH_TYPE_NAME = "interval_year_month";
+
+ public static final String INTERVAL_DAY_TIME_TYPE_NAME = "interval_day_time";
+
public static final String LIST_TYPE_NAME = "array";
public static final String MAP_TYPE_NAME = "map";
@@ -129,6 +133,8 @@ public class serdeConstants {
PrimitiveTypes.add("date");
PrimitiveTypes.add("datetime");
PrimitiveTypes.add("timestamp");
+ PrimitiveTypes.add("interval_year_month");
+ PrimitiveTypes.add("interval_day_time");
PrimitiveTypes.add("decimal");
PrimitiveTypes.add("binary");
}
Modified: hive/trunk/serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php (original)
+++ hive/trunk/serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php Thu Mar 19 19:05:28 2015
@@ -82,6 +82,10 @@ $GLOBALS['serde_CONSTANTS']['DECIMAL_TYP
$GLOBALS['serde_CONSTANTS']['BINARY_TYPE_NAME'] = "binary";
+$GLOBALS['serde_CONSTANTS']['INTERVAL_YEAR_MONTH_TYPE_NAME'] = "interval_year_month";
+
+$GLOBALS['serde_CONSTANTS']['INTERVAL_DAY_TIME_TYPE_NAME'] = "interval_day_time";
+
$GLOBALS['serde_CONSTANTS']['LIST_TYPE_NAME'] = "array";
$GLOBALS['serde_CONSTANTS']['MAP_TYPE_NAME'] = "map";
@@ -111,6 +115,8 @@ $GLOBALS['serde_CONSTANTS']['PrimitiveTy
"date" => true,
"datetime" => true,
"timestamp" => true,
+ "interval_year_month" => true,
+ "interval_day_time" => true,
"decimal" => true,
"binary" => true,
);
Modified: hive/trunk/serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py (original)
+++ hive/trunk/serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py Thu Mar 19 19:05:28 2015
@@ -42,6 +42,8 @@ DATETIME_TYPE_NAME = "datetime"
TIMESTAMP_TYPE_NAME = "timestamp"
DECIMAL_TYPE_NAME = "decimal"
BINARY_TYPE_NAME = "binary"
+INTERVAL_YEAR_MONTH_TYPE_NAME = "interval_year_month"
+INTERVAL_DAY_TIME_TYPE_NAME = "interval_day_time"
LIST_TYPE_NAME = "array"
MAP_TYPE_NAME = "map"
STRUCT_TYPE_NAME = "struct"
@@ -64,6 +66,8 @@ PrimitiveTypes = set([
"date",
"datetime",
"timestamp",
+ "interval_year_month",
+ "interval_day_time",
"decimal",
"binary",
])
Modified: hive/trunk/serde/src/gen/thrift/gen-rb/serde_constants.rb
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/gen/thrift/gen-rb/serde_constants.rb?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/gen/thrift/gen-rb/serde_constants.rb (original)
+++ hive/trunk/serde/src/gen/thrift/gen-rb/serde_constants.rb Thu Mar 19 19:05:28 2015
@@ -73,6 +73,10 @@ DECIMAL_TYPE_NAME = %q"decimal"
BINARY_TYPE_NAME = %q"binary"
+INTERVAL_YEAR_MONTH_TYPE_NAME = %q"interval_year_month"
+
+INTERVAL_DAY_TIME_TYPE_NAME = %q"interval_day_time"
+
LIST_TYPE_NAME = %q"array"
MAP_TYPE_NAME = %q"map"
@@ -102,6 +106,8 @@ PrimitiveTypes = Set.new([
%q"date",
%q"datetime",
%q"timestamp",
+ %q"interval_year_month",
+ %q"interval_day_time",
%q"decimal",
%q"binary",
])
Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java Thu Mar 19 19:05:28 2015
@@ -32,6 +32,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.common.type.HiveDecimal;
+import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
+import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.AbstractSerDe;
import org.apache.hadoop.hive.serde2.ByteStream;
@@ -45,6 +47,8 @@ import org.apache.hadoop.hive.serde2.io.
import org.apache.hadoop.hive.serde2.io.DoubleWritable;
import org.apache.hadoop.hive.serde2.io.HiveCharWritable;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalYearMonthWritable;
import org.apache.hadoop.hive.serde2.io.HiveVarcharWritable;
import org.apache.hadoop.hive.serde2.io.ShortWritable;
import org.apache.hadoop.hive.serde2.io.TimestampWritable;
@@ -64,6 +68,8 @@ import org.apache.hadoop.hive.serde2.obj
import org.apache.hadoop.hive.serde2.objectinspector.primitive.FloatObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveCharObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveDecimalObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveIntervalDayTimeObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveIntervalYearMonthObjectInspector;
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;
@@ -244,11 +250,7 @@ public class BinarySortableSerDe extends
case LONG: {
LongWritable r = reuse == null ? new LongWritable()
: (LongWritable) reuse;
- long v = buffer.read(invert) ^ 0x80;
- for (int i = 0; i < 7; i++) {
- v = (v << 8) + (buffer.read(invert) & 0xff);
- }
- r.set(v);
+ r.set(deserializeLong(buffer, invert));
return r;
}
case FLOAT: {
@@ -374,6 +376,22 @@ public class BinarySortableSerDe extends
t.setBinarySortable(bytes, 0);
return t;
+ case INTERVAL_YEAR_MONTH: {
+ HiveIntervalYearMonthWritable i = reuse == null ? new HiveIntervalYearMonthWritable()
+ : (HiveIntervalYearMonthWritable) reuse;
+ i.set(deserializeInt(buffer, invert));
+ return i;
+ }
+
+ case INTERVAL_DAY_TIME: {
+ HiveIntervalDayTimeWritable i = reuse == null ? new HiveIntervalDayTimeWritable()
+ : (HiveIntervalDayTimeWritable) reuse;
+ long totalSecs = deserializeLong(buffer, invert);
+ int nanos = deserializeInt(buffer, invert);
+ i.set(totalSecs, nanos);
+ return i;
+ }
+
case DECIMAL: {
// See serialization of decimal for explanation (below)
@@ -542,6 +560,14 @@ public class BinarySortableSerDe extends
return v;
}
+ private static long deserializeLong(InputByteBuffer buffer, boolean invert) throws IOException {
+ long v = buffer.read(invert) ^ 0x80;
+ for (int i = 0; i < 7; i++) {
+ v = (v << 8) + (buffer.read(invert) & 0xff);
+ }
+ return v;
+ }
+
static int getCharacterMaxLength(TypeInfo type) {
return ((BaseCharTypeInfo)type).getLength();
}
@@ -661,14 +687,7 @@ public class BinarySortableSerDe extends
case LONG: {
LongObjectInspector loi = (LongObjectInspector) poi;
long v = loi.get(o);
- writeByte(buffer, (byte) ((v >> 56) ^ 0x80), invert);
- writeByte(buffer, (byte) (v >> 48), invert);
- writeByte(buffer, (byte) (v >> 40), invert);
- writeByte(buffer, (byte) (v >> 32), invert);
- writeByte(buffer, (byte) (v >> 24), invert);
- writeByte(buffer, (byte) (v >> 16), invert);
- writeByte(buffer, (byte) (v >> 8), invert);
- writeByte(buffer, (byte) v, invert);
+ serializeLong(buffer, v, invert);
return;
}
case FLOAT: {
@@ -755,6 +774,22 @@ public class BinarySortableSerDe extends
}
return;
}
+ case INTERVAL_YEAR_MONTH: {
+ HiveIntervalYearMonthObjectInspector ioi = (HiveIntervalYearMonthObjectInspector) poi;
+ HiveIntervalYearMonth intervalYearMonth = ioi.getPrimitiveJavaObject(o);
+ int totalMonths = intervalYearMonth.getTotalMonths();
+ serializeInt(buffer, totalMonths, invert);
+ return;
+ }
+ case INTERVAL_DAY_TIME: {
+ HiveIntervalDayTimeObjectInspector ioi = (HiveIntervalDayTimeObjectInspector) poi;
+ HiveIntervalDayTime intervalDayTime = ioi.getPrimitiveJavaObject(o);
+ long totalSecs = intervalDayTime.getTotalSeconds();
+ int nanos = intervalDayTime.getNanos();
+ serializeLong(buffer, totalSecs, invert);
+ serializeInt(buffer, nanos, invert);
+ return;
+ }
case DECIMAL: {
// decimals are encoded in three pieces:
// sign: 1, 2 or 3 for smaller, equal or larger than 0 respectively
@@ -875,6 +910,17 @@ public class BinarySortableSerDe extends
writeByte(buffer, (byte) (v >> 16), invert);
writeByte(buffer, (byte) (v >> 8), invert);
writeByte(buffer, (byte) v, invert);
+ }
+
+ private static void serializeLong(ByteStream.Output buffer, long v, boolean invert) {
+ writeByte(buffer, (byte) ((v >> 56) ^ 0x80), invert);
+ writeByte(buffer, (byte) (v >> 48), invert);
+ writeByte(buffer, (byte) (v >> 40), invert);
+ writeByte(buffer, (byte) (v >> 32), invert);
+ writeByte(buffer, (byte) (v >> 24), invert);
+ writeByte(buffer, (byte) (v >> 16), invert);
+ writeByte(buffer, (byte) (v >> 8), invert);
+ writeByte(buffer, (byte) v, invert);
}
@Override
Added: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveIntervalDayTimeWritable.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveIntervalDayTimeWritable.java?rev=1667850&view=auto
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveIntervalDayTimeWritable.java (added)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveIntervalDayTimeWritable.java Thu Mar 19 19:05:28 2015
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.serde2.io;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
+import org.apache.hadoop.hive.serde2.ByteStream.RandomAccessOutput;
+import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils;
+import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VInt;
+import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VLong;
+import org.apache.hadoop.io.WritableComparable;
+import org.apache.hadoop.io.WritableUtils;
+
+public class HiveIntervalDayTimeWritable
+ implements WritableComparable<HiveIntervalDayTimeWritable> {
+
+ static final private Log LOG = LogFactory.getLog(HiveIntervalDayTimeWritable.class);
+
+ protected HiveIntervalDayTime intervalValue = new HiveIntervalDayTime();
+
+ public HiveIntervalDayTimeWritable() {
+ }
+
+ public HiveIntervalDayTimeWritable(HiveIntervalDayTime value) {
+ intervalValue.set(value);
+ }
+
+ public HiveIntervalDayTimeWritable(HiveIntervalDayTimeWritable writable) {
+ intervalValue.set(writable.intervalValue);
+ }
+
+ public void set(int days, int hours, int minutes, int seconds, int nanos) {
+ intervalValue.set(days, hours, minutes, seconds, nanos);
+ }
+
+ public void set(HiveIntervalDayTime value) {
+ intervalValue.set(value);
+ }
+
+ public void set(HiveIntervalDayTimeWritable writable) {
+ intervalValue.set(writable.intervalValue);
+ }
+
+ public void set(long totalSeconds, int nanos) {
+ intervalValue.set(totalSeconds, nanos);
+ }
+
+ public HiveIntervalDayTime getHiveIntervalDayTime() {
+ return new HiveIntervalDayTime(intervalValue);
+ }
+
+ @Override
+ public void readFields(DataInput in) throws IOException {
+ // read totalSeconds, nanos from DataInput
+ set(WritableUtils.readVLong(in), WritableUtils.readVInt(in));
+ }
+
+ @Override
+ public void write(DataOutput out) throws IOException {
+ // write totalSeconds, nanos to DataOutput
+ WritableUtils.writeVLong(out, intervalValue.getTotalSeconds());
+ WritableUtils.writeVInt(out, intervalValue.getNanos());
+ }
+
+ public void writeToByteStream(RandomAccessOutput byteStream) {
+ LazyBinaryUtils.writeVLong(byteStream, intervalValue.getTotalSeconds());
+ LazyBinaryUtils.writeVInt(byteStream, intervalValue.getNanos());
+ }
+
+ public void setFromBytes(byte[] bytes, int offset, int length, VInt vInt, VLong vLong) {
+ LazyBinaryUtils.readVLong(bytes, offset, vLong);
+ LazyBinaryUtils.readVInt(bytes, offset + vLong.length, vInt);
+ assert (length == (vInt.length + vLong.length));
+ set(vLong.value, vInt.value);
+ }
+
+ @Override
+ public int compareTo(HiveIntervalDayTimeWritable other) {
+ return this.intervalValue.compareTo(other.intervalValue);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof HiveIntervalDayTimeWritable)) {
+ return false;
+ }
+ return 0 == compareTo((HiveIntervalDayTimeWritable) obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return intervalValue.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return intervalValue.toString();
+ }
+}
Added: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveIntervalYearMonthWritable.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveIntervalYearMonthWritable.java?rev=1667850&view=auto
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveIntervalYearMonthWritable.java (added)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/HiveIntervalYearMonthWritable.java Thu Mar 19 19:05:28 2015
@@ -0,0 +1,119 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.serde2.io;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
+import org.apache.hadoop.hive.serde2.ByteStream.RandomAccessOutput;
+import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils;
+import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VInt;
+import org.apache.hadoop.io.WritableComparable;
+import org.apache.hadoop.io.WritableUtils;
+
+public class HiveIntervalYearMonthWritable
+ implements WritableComparable<HiveIntervalYearMonthWritable> {
+
+ static final private Log LOG = LogFactory.getLog(HiveIntervalYearMonthWritable.class);
+
+ protected HiveIntervalYearMonth intervalValue = new HiveIntervalYearMonth();
+
+ public HiveIntervalYearMonthWritable() {
+ }
+
+ public HiveIntervalYearMonthWritable(HiveIntervalYearMonth hiveInterval) {
+ intervalValue.set(hiveInterval);
+ }
+
+ public HiveIntervalYearMonthWritable(HiveIntervalYearMonthWritable hiveIntervalWritable) {
+ intervalValue.set(hiveIntervalWritable.intervalValue);
+ }
+
+ public void set(int years, int months) {
+ intervalValue.set(years, months);
+ }
+
+ public void set(HiveIntervalYearMonth hiveInterval) {
+ intervalValue.set(hiveInterval);
+ }
+
+ public void set(HiveIntervalYearMonthWritable hiveIntervalWritable) {
+ intervalValue.set(hiveIntervalWritable.intervalValue);
+ }
+
+ public void set(int totalMonths) {
+ intervalValue.set(totalMonths);
+ }
+
+ public HiveIntervalYearMonth getHiveIntervalYearMonth() {
+ return new HiveIntervalYearMonth(intervalValue);
+ }
+
+ @Override
+ public void readFields(DataInput in) throws IOException {
+ // read totalMonths from DataInput
+ set(WritableUtils.readVInt(in));
+ }
+
+ @Override
+ public void write(DataOutput out) throws IOException {
+ // write totalMonths to DataOutput
+ WritableUtils.writeVInt(out, intervalValue.getTotalMonths());
+ }
+
+ public void writeToByteStream(RandomAccessOutput byteStream) {
+ LazyBinaryUtils.writeVInt(byteStream, intervalValue.getTotalMonths());
+ }
+
+ public void setFromBytes(byte[] bytes, int offset, int length, VInt vInt) {
+ LazyBinaryUtils.readVInt(bytes, offset, vInt);
+ assert (length == vInt.length);
+ set(vInt.value);
+ }
+
+ @Override
+ public int compareTo(HiveIntervalYearMonthWritable other) {
+ return this.intervalValue.compareTo(other.intervalValue);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof HiveIntervalYearMonthWritable)) {
+ return false;
+ }
+ return 0 == compareTo((HiveIntervalYearMonthWritable) obj);
+ }
+
+ @Override
+ public int hashCode() {
+ return intervalValue.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return intervalValue.toString();
+ }
+}
Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java Thu Mar 19 19:05:28 2015
@@ -35,6 +35,8 @@ import org.apache.hadoop.hive.serde2.laz
import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyFloatObjectInspector;
import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyHiveCharObjectInspector;
import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyHiveDecimalObjectInspector;
+import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyHiveIntervalYearMonthObjectInspector;
+import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyHiveIntervalDayTimeObjectInspector;
import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyHiveVarcharObjectInspector;
import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyIntObjectInspector;
import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyLongObjectInspector;
@@ -125,6 +127,10 @@ public final class LazyFactory {
return new LazyDate((LazyDateObjectInspector) oi);
case TIMESTAMP:
return new LazyTimestamp((LazyTimestampObjectInspector) oi);
+ case INTERVAL_YEAR_MONTH:
+ return new LazyHiveIntervalYearMonth((LazyHiveIntervalYearMonthObjectInspector) oi);
+ case INTERVAL_DAY_TIME:
+ return new LazyHiveIntervalDayTime((LazyHiveIntervalDayTimeObjectInspector) oi);
case BINARY:
return new LazyBinary((LazyBinaryObjectInspector) oi);
case DECIMAL:
Added: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveIntervalDayTime.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveIntervalDayTime.java?rev=1667850&view=auto
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveIntervalDayTime.java (added)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveIntervalDayTime.java Thu Mar 19 19:05:28 2015
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.serde2.lazy;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
+import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyHiveIntervalDayTimeObjectInspector;
+import org.apache.hadoop.io.Text;
+
+public class LazyHiveIntervalDayTime
+ extends LazyPrimitive<LazyHiveIntervalDayTimeObjectInspector, HiveIntervalDayTimeWritable> {
+
+ public LazyHiveIntervalDayTime(LazyHiveIntervalDayTimeObjectInspector oi) {
+ super(oi);
+ data = new HiveIntervalDayTimeWritable();
+ }
+
+ public LazyHiveIntervalDayTime(LazyHiveIntervalDayTime copy) {
+ super(copy);
+ data = new HiveIntervalDayTimeWritable(copy.data);
+ }
+
+ @Override
+ public void init(ByteArrayRef bytes, int start, int length) {
+ String s = null;
+ try {
+ s = Text.decode(bytes.getData(), start, length);
+ data.set(HiveIntervalDayTime.valueOf(s));
+ isNull = false;
+ } catch (Exception e) {
+ isNull = true;
+ logExceptionMessage(bytes, start, length, "INTERVAL_DAY_TIME");
+ }
+ }
+
+ public static void writeUTF8(OutputStream out, HiveIntervalDayTimeWritable i) throws IOException {
+ ByteBuffer b = Text.encode(i.toString());
+ out.write(b.array(), 0, b.limit());
+ }
+
+ @Override
+ public HiveIntervalDayTimeWritable getWritableObject() {
+ return data;
+ }
+}
Added: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveIntervalYearMonth.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveIntervalYearMonth.java?rev=1667850&view=auto
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveIntervalYearMonth.java (added)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveIntervalYearMonth.java Thu Mar 19 19:05:28 2015
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.serde2.lazy;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalYearMonthWritable;
+import org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive.LazyHiveIntervalYearMonthObjectInspector;
+import org.apache.hadoop.io.Text;
+
+public class LazyHiveIntervalYearMonth
+ extends LazyPrimitive<LazyHiveIntervalYearMonthObjectInspector, HiveIntervalYearMonthWritable> {
+
+ public LazyHiveIntervalYearMonth(LazyHiveIntervalYearMonthObjectInspector oi) {
+ super(oi);
+ data = new HiveIntervalYearMonthWritable();
+ }
+
+ public LazyHiveIntervalYearMonth(LazyHiveIntervalYearMonth copy) {
+ super(copy);
+ data = new HiveIntervalYearMonthWritable(copy.data);
+ }
+
+ @Override
+ public void init(ByteArrayRef bytes, int start, int length) {
+ String s = null;
+ try {
+ s = Text.decode(bytes.getData(), start, length);
+ data.set(HiveIntervalYearMonth.valueOf(s));
+ isNull = false;
+ } catch (Exception e) {
+ isNull = true;
+ logExceptionMessage(bytes, start, length, "INTERVAL_YEAR_MONTH");
+ }
+ }
+
+ public static void writeUTF8(OutputStream out, HiveIntervalYearMonthWritable i)
+ throws IOException {
+ ByteBuffer b = Text.encode(i.toString());
+ out.write(b.array(), 0, b.limit());
+ }
+
+ @Override
+ public HiveIntervalYearMonthWritable getWritableObject() {
+ return data;
+ }
+}
Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java Thu Mar 19 19:05:28 2015
@@ -39,6 +39,8 @@ import org.apache.hadoop.hive.serde2.obj
import org.apache.hadoop.hive.serde2.objectinspector.primitive.FloatObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveCharObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveDecimalObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveIntervalDayTimeObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveIntervalYearMonthObjectInspector;
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;
@@ -254,6 +256,16 @@ public final class LazyUtils {
((TimestampObjectInspector) oi).getPrimitiveWritableObject(o));
break;
}
+ case INTERVAL_YEAR_MONTH: {
+ LazyHiveIntervalYearMonth.writeUTF8(out,
+ ((HiveIntervalYearMonthObjectInspector) oi).getPrimitiveWritableObject(o));
+ break;
+ }
+ case INTERVAL_DAY_TIME: {
+ LazyHiveIntervalDayTime.writeUTF8(out,
+ ((HiveIntervalDayTimeObjectInspector) oi).getPrimitiveWritableObject(o));
+ break;
+ }
case DECIMAL: {
LazyHiveDecimal.writeUTF8(out,
((HiveDecimalObjectInspector) oi).getPrimitiveJavaObject(o));
Added: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveIntervalDayTimeObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveIntervalDayTimeObjectInspector.java?rev=1667850&view=auto
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveIntervalDayTimeObjectInspector.java (added)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveIntervalDayTimeObjectInspector.java Thu Mar 19 19:05:28 2015
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive;
+
+import org.apache.hadoop.hive.common.type.HiveIntervalDayTime;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
+import org.apache.hadoop.hive.serde2.lazy.LazyHiveIntervalDayTime;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveIntervalDayTimeObjectInspector;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+
+public class LazyHiveIntervalDayTimeObjectInspector
+ extends AbstractPrimitiveLazyObjectInspector<HiveIntervalDayTimeWritable>
+ implements HiveIntervalDayTimeObjectInspector{
+
+ LazyHiveIntervalDayTimeObjectInspector() {
+ super(TypeInfoFactory.intervalDayTimeTypeInfo);
+ }
+
+ @Override
+ public Object copyObject(Object o) {
+ return o == null ? null : new LazyHiveIntervalDayTime((LazyHiveIntervalDayTime) o);
+ }
+
+ @Override
+ public HiveIntervalDayTime getPrimitiveJavaObject(Object o) {
+ return o == null ? null : ((LazyHiveIntervalDayTime) o).getWritableObject().getHiveIntervalDayTime();
+ }
+}
Added: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveIntervalYearMonthObjectInspector.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveIntervalYearMonthObjectInspector.java?rev=1667850&view=auto
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveIntervalYearMonthObjectInspector.java (added)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveIntervalYearMonthObjectInspector.java Thu Mar 19 19:05:28 2015
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.serde2.lazy.objectinspector.primitive;
+
+import org.apache.hadoop.hive.common.type.HiveIntervalYearMonth;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalYearMonthWritable;
+import org.apache.hadoop.hive.serde2.lazy.LazyHiveIntervalYearMonth;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.HiveIntervalYearMonthObjectInspector;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+
+public class LazyHiveIntervalYearMonthObjectInspector
+ extends AbstractPrimitiveLazyObjectInspector<HiveIntervalYearMonthWritable>
+ implements HiveIntervalYearMonthObjectInspector{
+
+ LazyHiveIntervalYearMonthObjectInspector() {
+ super(TypeInfoFactory.intervalYearMonthTypeInfo);
+ }
+
+ @Override
+ public Object copyObject(Object o) {
+ return o == null ? null : new LazyHiveIntervalYearMonth((LazyHiveIntervalYearMonth) o);
+ }
+
+ @Override
+ public HiveIntervalYearMonth getPrimitiveJavaObject(Object o) {
+ return o == null ? null : ((LazyHiveIntervalYearMonth) o).getWritableObject().getHiveIntervalYearMonth();
+ }
+}
Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyPrimitiveObjectInspectorFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyPrimitiveObjectInspectorFactory.java?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyPrimitiveObjectInspectorFactory.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyPrimitiveObjectInspectorFactory.java Thu Mar 19 19:05:28 2015
@@ -72,6 +72,10 @@ public final class LazyPrimitiveObjectIn
new LazyDateObjectInspector();
public static final LazyTimestampObjectInspector LAZY_TIMESTAMP_OBJECT_INSPECTOR =
new LazyTimestampObjectInspector();
+ public static final LazyHiveIntervalYearMonthObjectInspector LAZY_INTERVAL_YEAR_MONTH_OBJECT_INSPECTOR =
+ new LazyHiveIntervalYearMonthObjectInspector();
+ public static final LazyHiveIntervalDayTimeObjectInspector LAZY_INTERVAL_DAY_TIME_OBJECT_INSPECTOR =
+ new LazyHiveIntervalDayTimeObjectInspector();
public static final LazyBinaryObjectInspector LAZY_BINARY_OBJECT_INSPECTOR =
new LazyBinaryObjectInspector();
@@ -108,6 +112,10 @@ 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.INTERVAL_YEAR_MONTH_TYPE_NAME),
+ LAZY_INTERVAL_YEAR_MONTH_OBJECT_INSPECTOR);
+ cachedPrimitiveLazyObjectInspectors.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.INTERVAL_DAY_TIME_TYPE_NAME),
+ LAZY_INTERVAL_DAY_TIME_OBJECT_INSPECTOR);
cachedPrimitiveLazyObjectInspectors.put(TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.BINARY_TYPE_NAME),
LAZY_BINARY_OBJECT_INSPECTOR);
}
Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryFactory.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryFactory.java?rev=1667850&r1=1667849&r2=1667850&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryFactory.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryFactory.java Thu Mar 19 19:05:28 2015
@@ -29,6 +29,8 @@ 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.WritableHiveCharObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveIntervalDayTimeObjectInspector;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveIntervalYearMonthObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveVarcharObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveDecimalObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableBinaryObjectInspector;
@@ -84,6 +86,10 @@ public final class LazyBinaryFactory {
return new LazyBinaryDate((WritableDateObjectInspector) oi);
case TIMESTAMP:
return new LazyBinaryTimestamp((WritableTimestampObjectInspector) oi);
+ case INTERVAL_YEAR_MONTH:
+ return new LazyBinaryHiveIntervalYearMonth((WritableHiveIntervalYearMonthObjectInspector) oi);
+ case INTERVAL_DAY_TIME:
+ return new LazyBinaryHiveIntervalDayTime((WritableHiveIntervalDayTimeObjectInspector) oi);
case BINARY:
return new LazyBinaryBinary((WritableBinaryObjectInspector) oi);
case DECIMAL:
Added: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveIntervalDayTime.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveIntervalDayTime.java?rev=1667850&view=auto
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveIntervalDayTime.java (added)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveIntervalDayTime.java Thu Mar 19 19:05:28 2015
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.serde2.lazybinary;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.hive.serde2.io.HiveIntervalDayTimeWritable;
+import org.apache.hadoop.hive.serde2.lazy.ByteArrayRef;
+import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VInt;
+import org.apache.hadoop.hive.serde2.lazybinary.LazyBinaryUtils.VLong;
+import org.apache.hadoop.hive.serde2.objectinspector.primitive.WritableHiveIntervalDayTimeObjectInspector;
+
+/**
+ * LazyBinaryHiveIntervalDayTime
+ * A LazyBinaryObject that encodes a HiveIntervalDayTime
+ */
+public class LazyBinaryHiveIntervalDayTime extends
+ LazyBinaryPrimitive<WritableHiveIntervalDayTimeObjectInspector, HiveIntervalDayTimeWritable>{
+ static final Log LOG = LogFactory.getLog(LazyBinaryHiveIntervalDayTime.class);
+
+ /**
+ * Reusable member for decoding integer.
+ */
+ VInt vInt = new LazyBinaryUtils.VInt();
+ VLong vLong = new LazyBinaryUtils.VLong();
+
+ LazyBinaryHiveIntervalDayTime(WritableHiveIntervalDayTimeObjectInspector oi) {
+ super(oi);
+ data = new HiveIntervalDayTimeWritable();
+ }
+
+ LazyBinaryHiveIntervalDayTime(LazyBinaryHiveIntervalDayTime copy) {
+ super(copy);
+ data = new HiveIntervalDayTimeWritable(copy.data);
+ }
+
+ @Override
+ public void init(ByteArrayRef bytes, int start, int length) {
+ data.setFromBytes(bytes.getData(), start, length, vInt, vLong);
+ }
+}