From 4aeac220ab58d9bfd040a83bbc9bb1e3d50664c7 Mon Sep 17 00:00:00 2001 From: Naresh P R Date: Sun, 13 Oct 2019 22:00:31 +0530 Subject: [PATCH] HIVE-22331 - unix_timestamp without argument returns timestamp in millisecond instead of second. --- .../hadoop/hive/ql/udf/generic/GenericUDFUnixTimeStamp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUnixTimeStamp.java b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUnixTimeStamp.java index 4bab23afb7..cfcac5c4c7 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUnixTimeStamp.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFUnixTimeStamp.java @@ -43,7 +43,7 @@ protected void initializeInput(ObjectInspector[] arguments) throws UDFArgumentEx } else { if (currentInstant == null) { currentInstant = new LongWritable(0); - currentInstant.set(SessionState.get().getQueryCurrentTimestamp().toEpochMilli()); + currentInstant.set(SessionState.get().getQueryCurrentTimestamp().getEpochSecond()); String msg = "unix_timestamp(void) is deprecated. Use current_timestamp instead."; SessionState.getConsole().printInfo(msg, false); } -- 2.18.0