Skip to content

Commit

Permalink
HIVE-25334: fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-kumar-sharma committed Jul 26, 2021
1 parent 7ebb81a commit 52cf13f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumen
checkArgGroups(arguments, 0, tsInputTypes, STRING_GROUP, DATE_GROUP, NUMERIC_GROUP, VOID_GROUP, BOOLEAN_GROUP);

strict = SessionState.get() != null ? SessionState.get().getConf()
.getBoolVar(ConfVars.HIVE_INT_TIMESTAMP_CONVERSION_IN_SECONDS) : new HiveConf()
.getBoolVar(ConfVars.HIVE_INT_TIMESTAMP_CONVERSION_IN_SECONDS);
.getBoolVar(ConfVars.HIVE_STRICT_TIMESTAMP_CONVERSION) : new HiveConf()
.getBoolVar(ConfVars.HIVE_STRICT_TIMESTAMP_CONVERSION);

if (strict) {
if (PrimitiveObjectInspectorUtils.getPrimitiveGrouping(tsInputTypes[0]) == PrimitiveGrouping.NUMERIC_GROUP) {
Expand All @@ -97,8 +97,8 @@ public ObjectInspector initialize(ObjectInspector[] arguments) throws UDFArgumen
@Override
public Object evaluate(DeferredObject[] arguments) throws HiveException {
intToTimestampInSeconds = SessionState.get() != null ? SessionState.get().getConf()
.getBoolVar(ConfVars.HIVE_STRICT_TIMESTAMP_CONVERSION) : new HiveConf()
.getBoolVar(ConfVars.HIVE_STRICT_TIMESTAMP_CONVERSION);
.getBoolVar(ConfVars.HIVE_INT_TIMESTAMP_CONVERSION_IN_SECONDS) : new HiveConf()
.getBoolVar(ConfVars.HIVE_INT_TIMESTAMP_CONVERSION_IN_SECONDS);
PrimitiveObjectInspectorConverter.TimestampConverter ts =
(PrimitiveObjectInspectorConverter.TimestampConverter) tsConvertors[0];
ts.setIntToTimestampInSeconds(intToTimestampInSeconds);
Expand Down
1 change: 1 addition & 0 deletions ql/src/test/queries/clientpositive/timestamp_ints_casts.q
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
--! qt:dataset:alltypesorc
set hive.int.timestamp.conversion.in.seconds=false;
set hive.strict.timestamp.conversion=false;

explain
select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set hive.mapred.mode=nonstrict;
SET hive.vectorized.execution.enabled = true;
SET hive.int.timestamp.conversion.in.seconds=false;
set hive.fetch.task.conversion=none;
set hive.strict.timestamp.conversion=false;

explain vectorization expression
select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ STAGE PLANS:
Select Vectorization:
className: VectorSelectOperator
native: true
projectedOutputColumnNums: [15, 16, 17, 18, 19, 20, 21, 23, 8, 24, 26]
selectExpressions: CastLongToTimestamp(col 0:tinyint) -> 15:timestamp, CastLongToTimestamp(col 1:smallint) -> 16:timestamp, CastLongToTimestamp(col 2:int) -> 17:timestamp, CastLongToTimestamp(col 3:bigint) -> 18:timestamp, CastDoubleToTimestamp(col 4:float) -> 19:timestamp, CastDoubleToTimestamp(col 5:double) -> 20:timestamp, CastLongToTimestamp(col 10:boolean) -> 21:timestamp, CastLongToTimestamp(col 22:bigint)(children: LongColMultiplyLongScalar(col 3:bigint, val 0) -> 22:bigint) -> 23:timestamp, CastStringToTimestamp(col 6:string) -> 24:timestamp, CastStringToTimestamp(col 25:string)(children: StringSubstrColStartLen(col 6:string, start 0, length 1) -> 25:string) -> 26:timestamp
projectedOutputColumnNums: [16, 18, 20, 22, 23, 24, 26, 30, 8, 31, 33]
selectExpressions: CastMillisecondsLongToTimestamp(col 0:tinyint) -> 16:timestamp, CastMillisecondsLongToTimestamp(col 1:smallint) -> 18:timestamp, CastMillisecondsLongToTimestamp(col 2:int) -> 20:timestamp, CastMillisecondsLongToTimestamp(col 3:bigint) -> 22:timestamp, CastDoubleToTimestamp(col 4:float) -> 23:timestamp, CastDoubleToTimestamp(col 5:double) -> 24:timestamp, CastMillisecondsLongToTimestamp(col 10:boolean) -> 26:timestamp, CastMillisecondsLongToTimestamp(col 29:bigint)(children: LongColMultiplyLongScalar(col 3:bigint, val 0) -> 29:bigint) -> 30:timestamp, CastStringToTimestamp(col 6:string) -> 31:timestamp, CastStringToTimestamp(col 32:string)(children: StringSubstrColStartLen(col 6:string, start 0, length 1) -> 32:string) -> 33:timestamp
Statistics: Num rows: 6144 Data size: 2641080 Basic stats: COMPLETE Column stats: COMPLETE
File Output Operator
compressed: false
Expand Down Expand Up @@ -310,29 +310,29 @@ where cbigint % 250 = 0
POSTHOOK: type: QUERY
POSTHOOK: Input: default@alltypesorc
#### A masked pattern was here ####
1969-12-31 23:59:24 1969-12-31 23:56:40 NULL 1906-06-05 21:34:10 1969-12-31 23:59:24 1969-12-31 23:56:40 NULL 1970-01-01 00:00:00 1969-12-31 15:59:45.748 NULL NULL
1969-12-31 23:59:24 1969-12-31 23:56:40 NULL 2020-09-12 02:50:00 1969-12-31 23:59:24 1969-12-31 23:56:40 NULL 1970-01-01 00:00:00 1969-12-31 15:59:53.817 NULL NULL
1969-12-31 23:59:30 1969-12-31 23:56:40 NULL 2015-04-24 05:10:50 1969-12-31 23:59:30 1969-12-31 23:56:40 NULL 1970-01-01 00:00:00 1969-12-31 16:00:12.935 NULL NULL
1969-12-31 23:59:09 NULL 1994-07-07 17:09:31 2003-05-26 04:27:30 1969-12-31 23:59:09 NULL 1970-01-01 00:00:00 1970-01-01 00:00:00 1969-12-31 16:00:08.451 NULL NULL
1969-12-31 23:59:09 NULL 1993-09-09 05:51:22 1908-10-29 15:05:50 1969-12-31 23:59:09 NULL 1970-01-01 00:00:01 1970-01-01 00:00:00 1969-12-31 16:00:08.451 NULL NULL
1970-01-01 00:00:20 1970-01-01 04:20:01 NULL 1958-07-08 04:05:50 1970-01-01 00:00:20 1970-01-01 04:20:01 NULL 1970-01-01 00:00:00 1969-12-31 15:59:45.129 NULL NULL
1969-12-31 23:59:22 1970-01-01 04:20:01 NULL 1911-02-07 09:30:00 1969-12-31 23:59:22 1970-01-01 04:20:01 NULL 1970-01-01 00:00:00 1969-12-31 15:59:58.614 NULL NULL
1969-12-31 23:59:55 1970-01-01 04:20:01 NULL 1989-05-29 03:33:20 1969-12-31 23:59:55 1970-01-01 04:20:01 NULL 1970-01-01 00:00:00 1969-12-31 16:00:04.679 NULL NULL
1970-01-01 00:00:48 1970-01-01 04:20:01 NULL 1944-10-18 10:23:20 1970-01-01 00:00:48 1970-01-01 04:20:01 NULL 1970-01-01 00:00:00 1969-12-31 15:59:50.235 NULL NULL
1970-01-01 00:00:08 NULL 1949-01-13 08:21:02 1940-06-26 23:47:30 1970-01-01 00:00:08 NULL 1970-01-01 00:00:00 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1970-01-01 00:00:08 NULL 1966-09-27 14:32:46 1928-05-26 18:07:30 1970-01-01 00:00:08 NULL 1970-01-01 00:00:00 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1970-01-01 00:00:08 NULL 1995-07-08 05:01:04 1997-07-06 03:58:20 1970-01-01 00:00:08 NULL 1970-01-01 00:00:00 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1970-01-01 00:00:08 NULL 1948-10-12 15:01:29 2020-05-04 11:20:50 1970-01-01 00:00:08 NULL 1970-01-01 00:00:00 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1970-01-01 00:00:08 NULL 1998-03-27 08:56:12 1910-12-27 14:10:00 1970-01-01 00:00:08 NULL 1970-01-01 00:00:01 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1970-01-01 00:00:08 NULL 1999-07-01 22:14:06 2008-03-13 09:07:30 1970-01-01 00:00:08 NULL 1970-01-01 00:00:01 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1969-12-31 23:59:01 1969-12-31 22:00:04 NULL 1919-02-22 21:13:20 1969-12-31 23:59:01 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 16:00:13.15 NULL NULL
1969-12-31 23:59:39 1969-12-31 22:00:04 NULL 2018-11-17 04:30:00 1969-12-31 23:59:39 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 15:59:55.9 NULL NULL
1969-12-31 23:59:00 1969-12-31 22:00:04 NULL 2018-01-18 22:32:30 1969-12-31 23:59:00 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 15:59:52.408 NULL NULL
1969-12-31 23:59:46 1969-12-31 22:00:04 NULL 1920-10-24 17:28:20 1969-12-31 23:59:46 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 16:00:11.065 NULL NULL
1970-01-01 00:00:59 1969-12-31 22:00:04 NULL 1933-12-12 13:05:00 1970-01-01 00:00:59 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 16:00:10.956 NULL NULL
1969-12-31 23:59:52 1969-12-31 22:00:04 NULL 1911-05-19 01:28:20 1969-12-31 23:59:52 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 16:00:03.136 NULL NULL
1970-01-01 00:00:05 1969-12-31 22:00:04 NULL 1937-10-26 06:48:20 1970-01-01 00:00:05 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 16:00:10.973 NULL NULL
1969-12-31 23:59:36 1969-12-31 22:00:04 NULL 1996-04-10 04:36:40 1969-12-31 23:59:36 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 15:59:53.145 NULL NULL
1969-12-31 23:59:10 1969-12-31 22:00:04 NULL 1937-04-28 23:05:50 1969-12-31 23:59:10 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 15:59:54.733 NULL NULL
1970-01-01 00:00:11 NULL 1967-12-15 03:06:58 2027-02-19 16:15:50 1970-01-01 00:00:11 NULL 1970-01-01 00:00:01 1970-01-01 00:00:00 1969-12-31 16:00:02.351 NULL NULL
1970-01-01 00:00:11 NULL 1959-05-16 11:19:43 2009-01-30 14:50:00 1970-01-01 00:00:11 NULL 1970-01-01 00:00:01 1970-01-01 00:00:00 1969-12-31 16:00:02.351 NULL NULL
1969-12-31 23:59:59.964 1969-12-31 23:59:59.8 NULL 1969-12-08 18:43:03.25 1969-12-31 23:59:24 1969-12-31 23:56:40 NULL 1970-01-01 00:00:00 1969-12-31 15:59:45.748 NULL NULL
1969-12-31 23:59:59.964 1969-12-31 23:59:59.8 NULL 1970-01-19 12:24:39 1969-12-31 23:59:24 1969-12-31 23:56:40 NULL 1970-01-01 00:00:00 1969-12-31 15:59:53.817 NULL NULL
1969-12-31 23:59:59.97 1969-12-31 23:59:59.8 NULL 1970-01-17 13:10:52.25 1969-12-31 23:59:30 1969-12-31 23:56:40 NULL 1970-01-01 00:00:00 1969-12-31 16:00:12.935 NULL NULL
1969-12-31 23:59:59.949 NULL 1970-01-09 22:53:20.971 1970-01-13 04:45:23.25 1969-12-31 23:59:09 NULL 1970-01-01 00:00:00 1970-01-01 00:00:00 1969-12-31 16:00:08.451 NULL NULL
1969-12-31 23:59:59.949 NULL 1970-01-09 15:39:13.882 1969-12-09 15:45:32.75 1969-12-31 23:59:09 NULL 1970-01-01 00:00:00.001 1970-01-01 00:00:00 1969-12-31 16:00:08.451 NULL NULL
1970-01-01 00:00:00.02 1970-01-01 00:00:15.601 NULL 1969-12-27 19:19:26.75 1970-01-01 00:00:20 1970-01-01 04:20:01 NULL 1970-01-01 00:00:00 1969-12-31 15:59:45.129 NULL NULL
1969-12-31 23:59:59.962 1970-01-01 00:00:15.601 NULL 1969-12-10 11:41:51 1969-12-31 23:59:22 1970-01-01 04:20:01 NULL 1970-01-01 00:00:00 1969-12-31 15:59:58.614 NULL NULL
1969-12-31 23:59:59.995 1970-01-01 00:00:15.601 NULL 1970-01-08 02:06:56 1969-12-31 23:59:55 1970-01-01 04:20:01 NULL 1970-01-01 00:00:00 1969-12-31 16:00:04.679 NULL NULL
1970-01-01 00:00:00.048 1970-01-01 00:00:15.601 NULL 1969-12-22 19:03:59 1970-01-01 00:00:48 1970-01-01 04:20:01 NULL 1970-01-01 00:00:00 1969-12-31 15:59:50.235 NULL NULL
1970-01-01 00:00:00.008 NULL 1969-12-24 08:12:58.862 1969-12-21 05:16:47.25 1970-01-01 00:00:08 NULL 1970-01-01 00:00:00 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1970-01-01 00:00:00.008 NULL 1969-12-30 19:24:23.566 1969-12-16 19:20:17.25 1970-01-01 00:00:08 NULL 1970-01-01 00:00:00 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1970-01-01 00:00:00.008 NULL 1970-01-10 07:39:39.664 1970-01-11 01:09:21.5 1970-01-01 00:00:08 NULL 1970-01-01 00:00:00 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1970-01-01 00:00:00.008 NULL 1969-12-24 05:59:27.689 1970-01-19 09:16:31.25 1970-01-01 00:00:08 NULL 1970-01-01 00:00:00 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1970-01-01 00:00:00.008 NULL 1970-01-11 07:29:48.972 1969-12-10 10:41:39 1970-01-01 00:00:08 NULL 1970-01-01 00:00:00.001 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1970-01-01 00:00:00.008 NULL 1970-01-11 18:34:27.246 1970-01-14 22:49:59.25 1970-01-01 00:00:08 NULL 1970-01-01 00:00:00.001 1970-01-01 00:00:00 1969-12-31 16:00:15.892 NULL NULL
1969-12-31 23:59:59.941 1969-12-31 23:59:52.804 NULL 1969-12-13 10:11:50 1969-12-31 23:59:01 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 16:00:13.15 NULL NULL
1969-12-31 23:59:59.979 1969-12-31 23:59:52.804 NULL 1970-01-18 20:27:09 1969-12-31 23:59:39 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 15:59:55.9 NULL NULL
1969-12-31 23:59:59.94 1969-12-31 23:59:52.804 NULL 1970-01-18 13:11:54.75 1969-12-31 23:59:00 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 15:59:52.408 NULL NULL
1969-12-31 23:59:59.986 1969-12-31 23:59:52.804 NULL 1969-12-14 00:50:00.5 1969-12-31 23:59:46 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 16:00:11.065 NULL NULL
1970-01-01 00:00:00.059 1969-12-31 23:59:52.804 NULL 1969-12-18 19:57:25.5 1970-01-01 00:00:59 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 16:00:10.956 NULL NULL
1969-12-31 23:59:59.992 1969-12-31 23:59:52.804 NULL 1969-12-10 14:06:48.5 1969-12-31 23:59:52 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 16:00:03.136 NULL NULL
1970-01-01 00:00:00.005 1969-12-31 23:59:52.804 NULL 1969-12-20 05:53:12.5 1970-01-01 00:00:05 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 16:00:10.973 NULL NULL
1969-12-31 23:59:59.976 1969-12-31 23:59:52.804 NULL 1970-01-10 14:18:31 1969-12-31 23:59:36 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 15:59:53.145 NULL NULL
1969-12-31 23:59:59.95 1969-12-31 23:59:52.804 NULL 1969-12-20 01:33:32.75 1969-12-31 23:59:10 1969-12-31 22:00:04 NULL 1970-01-01 00:00:00 1969-12-31 15:59:54.733 NULL NULL
1970-01-01 00:00:00.011 NULL 1969-12-31 06:03:04.018 1970-01-21 20:50:53.75 1970-01-01 00:00:11 NULL 1970-01-01 00:00:00.001 1970-01-01 00:00:00 1969-12-31 16:00:02.351 NULL NULL
1970-01-01 00:00:00.011 NULL 1969-12-28 02:49:09.583 1970-01-15 06:35:27 1970-01-01 00:00:11 NULL 1970-01-01 00:00:00.001 1970-01-01 00:00:00 1969-12-31 16:00:02.351 NULL NULL

0 comments on commit 52cf13f

Please sign in to comment.