Impala built-in function: unix_timestamp function is not accurate enough

2016-11-16T06:27:39

I am using the following impala query to extract data from my_table:

select id, timestamp, unix_timestamp(timestamp) as ts from my_table

The output is:

        id          timestamp               ts
-------------------------------------------------------
    0   A       2016-08-21 16:18:34.336     1471796314
    1   A       2016-08-21 16:18:34.517     1471796314
    2   A       2016-08-21 16:18:34.677     1471796314
    3   B       2016-08-14 00:20:00.641     1471134000
    4   B       2016-08-14 00:20:00.697     1471134000
    5   B       2016-08-14 00:20:00.720     1471134000
    6   B       2016-08-14 00:20:00.750     1471134000

The converted ts field becomes all the same because the original timestamp difference is very small. Is there a way (a function) which can make ts using higher digits (accuracy)? I need every ts to be different if the original timestamp is different. Thanks!

Copyright License:
Author:「Edamame」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/40620847/impala-built-in-function-unix-timestamp-function-is-not-accurate-enough

About “Impala built-in function: unix_timestamp function is not accurate enough” questions

I am using the following impala query to extract data from my_table: select id, timestamp, unix_timestamp(timestamp) as ts from my_table The output is: id timestamp ...
I keep getting an AnalysisException that says "split unknown" when I try to use the split function in Cloudera Impala. It seems to be a valid function listed on the built-in functions page. For ref...
I am using a built-in function in Impala like: select id, parse_url(my_table.url, "QUERY", "extensionId") from my_table Now I am migrating to SparkSQL (using pyspark in Jupyter Notebook): my_table.
I have a string timestamp column as below in one of the table. Column 20210108003444 ---- 8th Jan 2021 00.34 AM 20201109013716 2020112422811 How can I convert this into a unix_timest...
How to to compute datediff by hour in impala? For example like below Select datediff(hour,'2017-06-21T02:29:54.244720804Z', '2017-06-21T02:30:10.574379557Z'); Default impala 'datediff' function o...
I have table in hive with string in 12 hrs format in which data is appended every day. I don't have control over hive table. Need to expose as view in impala after conversion. to_timestamp() doesn't
Can we convert month numbers to month name. I can see a function called month name https://impala.apache.org/docs/build/html/topics/impala_datetime_functions.html#datetime_functions__month But ...
I have a postgres function that is called in a query. Its similar to this sample: CREATE OR REPLACE FUNCTION test_function(id integer, dt date, days int[], accts text[], flag boolean) RETURNS floa...
I am using concat_ws(' ', collect_list(field1)) as field1, but the query is not running in impala. Does impala not support this function? If not, what is an alternative for a similar operati...
I am trying to use and overlaps function as in ORACLE or Netezza that takes two date ranges and check if they overlap each other. Soemthing like this: SELECT (TIMESTAMP '2011-01-28 00:00:00', TIME...

Copyright License:Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.