Date formatting issue in WHERE clause
See original GitHub issueNoticed that date transformation/formatting fails in WHERE
clause though it works fine when used in SELECT
.
My dataset timestamp is of the following format: 2020-10-01T14:00:00.000Z
.
The following works:
SELECT
dateTimeConvert("timestamp", '1:HOURS:SIMPLE_DATE_FORMAT:yyyy-MM-dd''T''HH:mm:ss.SSS''Z''', '1:HOURS:SIMPLE_DATE_FORMAT:yyyy-MM-dd', '1:HOURS')
FROM myTable
But same expression fails if moved to WHERE
:
SELECT
*
FROM myTable
WHERE
dateTimeConvert("timestamp", '1:HOURS:SIMPLE_DATE_FORMAT:yyyy-MM-dd''T''HH:mm:ss.SSS''Z''', '1:HOURS:SIMPLE_DATE_FORMAT:yyyy-MM-dd', '1:HOURS') = '2020-10-01'
This is likely related with handling single quotes in SIMPLE_DATE_FORMAT:yyyy-MM-dd''T''HH:mm:ss.SSS''Z''
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Date formatting issue in WHERE clause #6412 - apache/pinot
Noticed that date transformation/formatting fails in WHERE clause though it works fine when used in SELECT .
Read more >Date format in where clause-Oracle - Stack Overflow
I have one table where date column is having data in below format: "7/25/2014 12:14:27 AM'. I need to fetch this date by...
Read more >Date formatting in a where statement - SAS Communities
Solved: Hi, I'mt rying to select a date range from a table that currently has dates in the format: 18NOV2016:14:31:52.000000 I tried using ......
Read more >Using FORMAT for date in WHERE clause in SQL activity
I figured it out. The following code works just fine: SELECT EventDate From _Sent WHERE EventDate >= CONVERT(DATETIME2, FORMAT(DATEADD(HOUR, ...
Read more >Date format is not working in Where Clause - Qlik Community
Solved: Hi All, I have date format with millisecond. I am converting the time into DD-MON-YY and trying to apply this in where...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Find the issue and here is the fix: https://github.com/apache/incubator-pinot/pull/6416
hmm, I’ve seen this issue on another table with the datetime field
event_time
as well.