Open estebanz01 opened 7 months ago
Pinot TIMESTAMP
data type takes millis since epoch time, and 56202-05-11 12:33:13.431
is the corresponding timestamp if we treat the micros as millis.
The workaround is to store the value as LONG
@estebanz01 does this hint solves your issue and it can be closed?
hi @hpvd it did solved my issue, but I don't think this issue should be closed. Shouldn't the format field tell the engine how to render properly the info?
TIMESTAMP
data type has implicit format of yyyy-MM-dd HH:mm:ss.SSS
or millis since epoch.
I think the confusion is coming from the fact that both format
and granularity
field within DateTimeFieldSpec
are for explanation purpose instead of conversion purpose. I.e. if the value doesn't align with the spec, Pinot won't automatically convert the value.
We should consider adding a feature to automatically convert the value if it doesn't align with the spec. cc @snleee @swaminathanmanish
Hola! 👋
So playing around with pinot, I found a small issue that bothers me a bit, so I thought it might be good to raise it as an issue. I'm dealing with high frequency data, so we need to timestamp points with a microsecond precision. We could even have a case for nanoseconds, but at that point it's better to just deal with it on the edge. Anyhow, here's what I have as a schema:
Microseconds schema
```json { "schemaName": "data_counting_temp", "dimensionFieldSpecs": [ { "name": "device_uuid", "dataType": "STRING" } ], "metricFieldSpecs": [ { "name": "noise", "dataType": "LONG" } ], "dateTimeFieldSpecs": [ { "name": "__key", "dataType": "TIMESTAMP", "format": "1:MICROSECONDS:EPOCH", "granularity": "1:MICROSECONDS" }, { "name": "__metadata$eventTime", "dataType": "TIMESTAMP", "format": "1:MICROSECONDS:EPOCH", "granularity": "1:MICROSECONDS" } ] } ```the data comes from pulsar, so that's why I have the
__metadata$eventTime
and__key
fields.The granularity is supported as it uses the time unit enums from here: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/TimeUnit.html, the problem comes when querying with the API. If I look at the table data in the pinot UI, I get the following:
which is fine as I thought it was converted on the frontend for styling purposes, but the real reason is that this data comes from the backend:
Basically, when querying this two fields, I'm not getting the
epoch
number that I expect, but a naive conversion toyyyy-MM-dd hh:mm:ss.sssssZ
. Shouldn't the API SQL check for the format and based on that, either apply transformations or get the raw value ?My workaround is ugly, but how well. Use timeconvert as follows:
which gives me the expected info:
Let me know if I should close this. Thanks in advance!