paul-rogers opened a new issue #11660:
URL: https://github.com/apache/druid/issues/11660


   ### Affected Version
   
   Version: 0.21.1
   
   ### Description
   
   SQL Druid provides the 
[`TIME_PARSE()`](https://druid.apache.org/docs/latest/querying/sql.html#time-functions)
 function.
   
   Let's try it against the `segments` table. First, verify the data, on a 
system with only the sample Wikipedia data:
   
   ```sql
   SELECT
     "start"
   FROM sys.segments
   LIMIT 1
   ```
   
   Result:
   ```text
   2015-09-12T00:00:00.000Z
   ```
   
   Now, use `TIME_PARSE()` with the returned value. (OK, the query is kind of 
lame, but bear with me):
   
   ```sql
   SELECT
     TIME_PARSE('2015-09-12T00:00:00.000Z')
   FROM sys.segments
   LIMIT 1
   ```
   
   Result:
   ```text
   2015-09-12T00:00:00.000Z
   ```
   
   Now, put the two together: we know the `start` column has a perfectly fine 
timestamp string. Try to parse it:
   
   ```sql
   SELECT
     TIME_PARSE("start")
   FROM sys.segments
   LIMIT 1
   ```
   
   This fails:
   
   ```text
   Error: Unknown exception
   cannot translate call TIME_PARSE($t2)
   java.lang.RuntimeException
   ```
   
   Expected that a SQL function would work just as well for columns as for 
constants.
   
   Note: I was trying to use `TIME_PARSE()` to work around [another 
issue](https://github.com/apache/druid/issues/11659) that prevents using 
`MAX()` on a string.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to