hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Dere" <jd...@hortonworks.com>
Subject Review Request 31696: HIVE-9792 Support interval type in expressions/predicates
Date Tue, 03 Mar 2015 19:34:16 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/31696/
-----------------------------------------------------------

Review request for hive.


Bugs: HIVE-9792
    https://issues.apache.org/jira/browse/HIVE-9792


Repository: hive-git


Description
-------

This adds 2 separate interval types:
- year-month interval, which represents a date difference in years and months. Internally
represented as an offset of months.
- day-time interval, which represents a date difference in days/hours/minutes/seconds/nanoseconds.
1 day = 24 hours = 1440 minutes = 86400 seconds. Internally represented as an offset of seconds
(long) and nanoseconds (int).

I've tried using the Oracle's Datetime and Interval Arithmetic rules with regard to timestamp
arithmetic, where the timestamp arithmetic is done in UTC time. This results in similar behavior
to below depending on the default time zone in Hive:

SQL> select timestamp '1999-09-15 00:00:00 America/Los_Angeles' - timestamp '1999-12-15
00:00:00 America/Los_Angeles' from dual;

TIMESTAMP'1999-09-1500:00:00AMERICA/LOS_ANGELES'-TIMESTAMP'1999-12-1500:00:
---------------------------------------------------------------------------
-000000091 01:00:00.000000000

SQL> select timestamp '1999-09-15 00:00:00 UTC' - timestamp '1999-12-15 00:00:00 UTC' from
dual;

TIMESTAMP'1999-09-1500:00:00UTC'-TIMESTAMP'1999-12-1500:00:00UTC'
---------------------------------------------------------------------------
-000000091 00:00:00.000000000


Diffs
-----

  common/src/java/org/apache/hadoop/hive/common/type/HiveIntervalDayTime.java PRE-CREATION

  common/src/java/org/apache/hadoop/hive/common/type/HiveIntervalYearMonth.java PRE-CREATION

  common/src/java/org/apache/hadoop/hive/common/type/MutableHiveIntervalDayTime.java PRE-CREATION

  common/src/java/org/apache/hadoop/hive/common/type/MutableHiveIntervalYearMonth.java PRE-CREATION

  common/src/java/org/apache/hive/common/util/DateTimeUtils.java PRE-CREATION 
  common/src/test/org/apache/hadoop/hive/common/type/TestHiveIntervalDayTime.java PRE-CREATION

  common/src/test/org/apache/hadoop/hive/common/type/TestHiveIntervalYearMonth.java PRE-CREATION

  common/src/test/org/apache/hive/common/util/TestDateTimeUtils.java PRE-CREATION 
  ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionRegistry.java 20811ab 
  ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinKey.java 6a3c300 
  ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/ASTBuilder.java 4b1f5c1

  ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/RexNodeConverter.java
4dbac57 
  ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/TypeConverter.java 88c989f

  ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g 90b84ac 
  ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g 72b852e 
  ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g cabf971 
  ql/src/java/org/apache/hadoop/hive/ql/parse/TypeCheckProcFactory.java 706390b 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseArithmetic.java 575c764

  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseDTI.java PRE-CREATION 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFBaseUnary.java c5bec44 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDTIMinus.java PRE-CREATION

  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPDTIPlus.java PRE-CREATION

  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPMinus.java 5419a19 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPNegative.java d653264 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFOPPlus.java accd347 
  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToIntervalDayTime.java PRE-CREATION

  ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFToIntervalYearMonth.java PRE-CREATION

  ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPMinus.java 24618c9 
  ql/src/test/org/apache/hadoop/hive/ql/udf/generic/TestGenericUDFOPPlus.java 4b2f7fb 
  ql/src/test/queries/clientnegative/interval_1.q PRE-CREATION 
  ql/src/test/queries/clientnegative/interval_2.q PRE-CREATION 
  ql/src/test/queries/clientnegative/interval_3.q PRE-CREATION 
  ql/src/test/queries/clientnegative/invalid_arithmetic_type.q ad37cff 
  ql/src/test/queries/clientpositive/interval_1.q PRE-CREATION 
  ql/src/test/queries/clientpositive/interval_2.q PRE-CREATION 
  ql/src/test/queries/clientpositive/interval_3.q PRE-CREATION 
  ql/src/test/queries/clientpositive/interval_arithmetic.q PRE-CREATION 
  ql/src/test/queries/clientpositive/interval_comparison.q PRE-CREATION 
  ql/src/test/results/clientnegative/interval_1.q.out PRE-CREATION 
  ql/src/test/results/clientnegative/interval_2.q.out PRE-CREATION 
  ql/src/test/results/clientnegative/interval_3.q.out PRE-CREATION 
  ql/src/test/results/clientnegative/invalid_arithmetic_type.q.out afd09ca 
  ql/src/test/results/clientpositive/interval_1.q.out PRE-CREATION 
  ql/src/test/results/clientpositive/interval_2.q.out PRE-CREATION 
  ql/src/test/results/clientpositive/interval_3.q.out PRE-CREATION 
  ql/src/test/results/clientpositive/interval_arithmetic.q.out PRE-CREATION 
  ql/src/test/results/clientpositive/interval_comparison.q.out PRE-CREATION 
  serde/if/serde.thrift 2db27b5 
  serde/src/gen/thrift/gen-cpp/serde_constants.h 418f666 
  serde/src/gen/thrift/gen-cpp/serde_constants.cpp cc71b65 
  serde/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/serde/serdeConstants.java e70d0c4

  serde/src/gen/thrift/gen-php/org/apache/hadoop/hive/serde/Types.php c1d8085 
  serde/src/gen/thrift/gen-py/org_apache_hadoop_hive_serde/constants.py 7d7608f 
  serde/src/gen/thrift/gen-rb/serde_constants.rb 33f12b0 
  serde/src/java/org/apache/hadoop/hive/serde2/binarysortable/BinarySortableSerDe.java 2b7fba6

  serde/src/java/org/apache/hadoop/hive/serde2/io/HiveIntervalDayTimeWritable.java PRE-CREATION

  serde/src/java/org/apache/hadoop/hive/serde2/io/HiveIntervalYearMonthWritable.java PRE-CREATION

  serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyFactory.java 864d9aa 
  serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveIntervalDayTime.java PRE-CREATION

  serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyHiveIntervalYearMonth.java PRE-CREATION

  serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java 879743f 
  serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveIntervalDayTimeObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyHiveIntervalYearMonthObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/lazy/objectinspector/primitive/LazyPrimitiveObjectInspectorFactory.java
7423c00 
  serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryFactory.java 8bd5838 
  serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveIntervalDayTime.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryHiveIntervalYearMonth.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinarySerDe.java 62cba01 
  serde/src/java/org/apache/hadoop/hive/serde2/lazybinary/LazyBinaryUtils.java 11e8cf4 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorConverters.java
2a47d97 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/ObjectInspectorUtils.java 5e67a07

  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/PrimitiveObjectInspector.java
05aed0a 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/HiveIntervalDayTimeObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/HiveIntervalYearMonthObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaHiveIntervalDayTimeObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/JavaHiveIntervalYearMonthObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorConverter.java
cb996a8 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorFactory.java
f466297 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/PrimitiveObjectInspectorUtils.java
5ccacf1 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/SettableHiveIntervalDayTimeObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/SettableHiveIntervalYearMonthObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableConstantHiveIntervalDayTimeObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableConstantHiveIntervalYearMonthObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveIntervalDayTimeObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/objectinspector/primitive/WritableHiveIntervalYearMonthObjectInspector.java
PRE-CREATION 
  serde/src/java/org/apache/hadoop/hive/serde2/typeinfo/TypeInfoFactory.java e5c9f18 
  serde/src/test/org/apache/hadoop/hive/serde2/io/TestHiveIntervalDayTimeWritable.java PRE-CREATION

  serde/src/test/org/apache/hadoop/hive/serde2/io/TestHiveIntervalYearMonthWritable.java PRE-CREATION


Diff: https://reviews.apache.org/r/31696/diff/


Testing
-------


Thanks,

Jason Dere


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message