Hello and Happy Friday!

We decided to store date/timestamps as a string due to all the issues we
had with time zones and the way we want them to work consistently across
Impala, Hive, Kudu and Spark.

In a query like below, I thought I would have to convert strings with
timestamps to timestamp explicitly but looks like Impala does implicit
conversion and our users won't need to worry about doing it. Is my
assumption correct?

SELECT something
FROM table1
WHERE
  ingest_dt_tm > now() - interval 2 hours

Query above is a simple one and I understand how Impala would "know" to do
implicit convertion.

But I was really surprised that query below also worked properly because in
that case I compare a string column with another string:

SELECT something
FROM table1
WHERE
  ingest_dt_tm > '2019-01-18 10:42:25.795'

I thought we would need to do CAST('2019-01-18 10:42:25.795' as timestamp)
or something like that.

Also from a performance perspective, would the statement below be equal:

SELECT something
FROM table1
WHERE
  ingest_dt_tm > '2019-01-18 10:42:25.795'

SELECT something
FROM table1
WHERE
  cast(ingest_dt_tm as timestamp)> '2019-01-18 10:42:25.795'

SELECT something
FROM table1
WHERE
  ingest_dt_tm > cast('2019-01-18 10:42:25.795' as timestamp)

Reply via email to