Hi folks! A question about `dateTimeFieldSpecs`: I...
# general
d
Hi folks! A question about `dateTimeFieldSpecs`: Is the
TIMESTAMP
type something that will stay in Pinot? Because @User gave me a nice hint about that but we don't see that in the docs, so I'm unsure whether I can safely use it and know that it won't get removed on future Pinot versions
n
it is here to stay. It’s part of the datatypes in this page https://docs.pinot.apache.org/basics/components/schema#data-types
d
Ah, nice! Thanks!
n
good catch 🙂 will fix it, and maybe also add some examples
d
Awesome, thanks a lot! ❤️
@User what format should be used though when publishing values through Kafka? I'm using, for example,
2020-04-04 00:00:00 UTC
, as a string, and it's not saving on Pinot
n
should be
Copy code
"dateTimeFieldSpecs": [
    {
      "name": "time_col_name",
      "dataType": "STRING",
      "format": "1:MILLISECONDS:SIMPLE_DATE_FORMAT:yyyyMMdd HH:mm:ss z",
      "granularity": "1:MILLISECONDS"
    }
  ]
https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
d
Oh... I thought the dataType would be
TIMESTAMP
, am I wrong?
n
@User does this
2020-04-04 00:00:00 UTC
string also work for
TIMESTAMP
?
j
No, you need to remove
UTC
n
so it’s
yyyyMMdd HH:mm:ss
and
epoch millis
that can use
TIMESTAMP
?
j
Yes
d
Oh, just
2020-04-04 00:00:00
then? And in terms of performance, how does that compare to using
SIMPLE_DATE_FORMAT
with a date-time format?
j
Standard
TIMESTAMP
format would be
yyyy-MM-dd HH:mm:ss.SSS
d
I mean, comparing the dataTypes, it would be
TIMESTAMP
vs
STRING
, would there be a significant performance difference?
j
TIMESTAMP
is stored as long (millis since epoch), so it has better performance than string
d
Ah, that's very relevant! 🙂
You guys rock so hard! Thank you very very much! ❤️
❤️ 1
j
The performance improvement is depending on the queries, but long should always be faster than string
Pleasure to help
d
Indeed, cause it's numeric and all that... awesome!
It worked fine here for me, thanks! The only odd thing I found about it is that, when getting the value from Pinot - not sure if because I'm using it through SQLAlchemy -, I'm getting a quoted string, like
"2020-01-01 00:00:00.000"
, instead of just the string with the datetime format. No big deal really, just a strange difference I found compared to when I was using
SIMPLE_DATE_FORMAT
earlier today. Thanks a lot, have a great weekend, folks!