Member since
01-24-2017
6
Posts
0
Kudos Received
0
Solutions
09-21-2017
08:05 PM
This is interesting. Thank you for posting this resolution to this comparison as I was able to use a similar approach to my issue!
I am on HDP 2.6.1 and I had some similar unexpected behavior. When selecting a timestamp column, I wanted to grab all columns where the timestamp was within a certain date. However, when it returned the rows.... it "zeroed" the timestamp column to "yyyy-mm-dd 00:00:00" where ymd was the actual day. I found it bizarre since I only applied a function to my where clause and not my selected column. Here is an example: -- Unexpected query behavior
SELECT time_stamp_column
FROM my_table
WHERE date(time_stamp_column) = '2017-09-15'
limit 4;
--Unexpected results (no timestamps in table with values "00:00:00 0")
2017-09-15 00:00:00 0
2017-09-15 00:00:00 0
2017-09-15 00:00:00 0
2017-09-15 00:00:00 0
--Query using cast
SELECT time_stamp_column
FROM my_table
WHERE time_stamp_column >= '2017-09-15 00:00:00' AND
time_stamp_column < '2017-09-16 00:00:00'
limit 4;
--Expected/desired results (this is the actual data, as no columns have exactly the 00:00:00 timestamp)
2017-09-15 17:25:28.766248
2017-09-15 17:29:05.427199
2017-09-15 17:29:08.219565
2017-09-15 17:33:20.907088
Thanks @knarendran ! Hopefully someone else will find this useful.
... View more