question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failing to parse timestamp values without milliseconds

See original GitHub issue

There is a bug in the parsing of timestamp values without milliseconds while using select

E.g. the value [2016-02-03T08:16:26.389] is successfully parsed, but the next value [2016-02-03T08:19] fails:

Failed with exception java.io.IOException:org.elasticsearch.hadoop.rest.EsHadoopParsingException: Cannot parse value [2016-02-03T08:19] for field [receivedTimestamp]

The error is consistent across different timestamp fields.

Using elasticsearch-hadoop-hive-2.2.0.jar

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bitsondatadevcommented, Oct 22, 2018

For a more concrete example.

#assuming you have a string field called customer and a date field called createdAt in elasticsearch

hive> DROP TABLE IF EXISTS my_table;

hive> CREATE EXTERNAL TABLE my_table (id string, customer string, createdat string)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES (
    'es.resource' = 'my_table_es_index',
    'es.nodes' = 'es_url:9200',
    'es.read.metadata' = 'true',
    'es.mapping.names' = 'id:_metadata._id,customer:customer,createdat:createdAt',
    'es.mapping.date.rich' = 'false'
);

#print date as string
hive> select id, createdat, customer from my_table limit 10;

#convert the string described above to long (this type of logic can better reside inside a UDF)
hive> select id, unix_timestamp(createdat, "yyyy-MM-dd'T'HH:mm"), customer from my_table limit 10;
0reactions
wangxuegang1214commented, Aug 3, 2017

‘es.mapping.date.rich’=‘false’

Read more comments on GitHub >

github_iconTop Results From Across the Web

SimpleDateFormat cannot parse milliseconds with more than ...
It seems that is not possible to use SimpleDateFormat to express times with a finer grain than the millisecond. What is happening is...
Read more >
TimeStamp without milliseconds!!! – SQLServerCentral Forums
I need an expression to write in derived column transformation to get the data and time but time only till seconds i dont...
Read more >
How to parse out milliseconds from timestamp in log file?
Trying to parse out the millisecond timestamp from this log file, ... Could not use strptime to parse timestamp from ": COUNT 1003\n...
Read more >
Datetime Patterns for Formatting and Parsing - Apache Spark
Spark uses pattern letters in the following table for date and timestamp ... It should be used to format/parse only months without any...
Read more >
Formatting Dates and Times | ICU Documentation
Use a DateFormat to parse also: UErrorCode status = ZERO_ERROR; UDate myDate = df ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found