You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Tim Armstrong (Jira)" <ji...@apache.org> on 2021/01/25 19:52:00 UTC
[jira] [Updated] (IMPALA-7885) Create function to convert to ts
from unix millis
[ https://issues.apache.org/jira/browse/IMPALA-7885?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tim Armstrong updated IMPALA-7885:
----------------------------------
Labels: ramp-up (was: )
> Create function to convert to ts from unix millis
> -------------------------------------------------
>
> Key: IMPALA-7885
> URL: https://issues.apache.org/jira/browse/IMPALA-7885
> Project: IMPALA
> Issue Type: Improvement
> Components: Backend
> Reporter: eugen yushin
> Assignee: Tim Armstrong
> Priority: Major
> Labels: ramp-up
>
> There're several functions like `from_unixtime`/`unix_micros_to_utc_timestamp`/`to_timestamp` in Impala which accepts seconds and micros, but none of them works with millis.
> At the same time, Impala already has all necessary utility methods to add such a functionality:
> [https://github.com/apache/impala/blob/master/be/src/runtime/timestamp-value.inline.h#L54]
> {code}
> inline TimestampValue TimestampValue::UtcFromUnixTimeMillis(int64_t unix_time_millis) {
> return UtcFromUnixTimeTicks<MILLIS_PER_SEC>(unix_time_millis);
> }
> {code}
> https://github.com/apache/impala/blob/master/be/src/exprs/timestamp-functions-ir.cc#L141
> {code}
> TimestampVal TimestampFunctions::UnixMicrosToUtcTimestamp(FunctionContext* context,
> const BigIntVal& unix_time_micros) {
> if (unix_time_micros.is_null) return TimestampVal::null();
> TimestampValue tv = TimestampValue::UtcFromUnixTimeMicros(unix_time_micros.val);
> TimestampVal result;
> tv.ToTimestampVal(&result);
> return result;
> }
> {code}
> It would be better to have Unix millis to timestamp conversion function as buit-in functionality to prevent from:
> - creating cumbersome 'aliases' like:
> {code}
> select unix_micros_to_utc_timestamp(1513895588243 * 1000)
> {code}
> or
> http://community.cloudera.com/t5/Interactive-Short-cycle-SQL/Why-not-from-unixtime-function-handles-an-unix-timestamp-in/m-p/63182#M3969
> {code}
> select cast(1513895588243 div 1000 as timestamp) + interval (1513895588243 % 1000) milliseconds;
> {code}
> - writing relatively slow udfs in java
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org