question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Date formatting issue in WHERE clause

See original GitHub issue

Noticed 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:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
Jackie-Jiangcommented, Jan 6, 2021

Find the issue and here is the fix: https://github.com/apache/incubator-pinot/pull/6416

0reactions
xiangfu0commented, Jan 6, 2021

hmm, I’ve seen this issue on another table with the datetime field event_time as well.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found