LakshSingla commented on PR #12770:
URL: https://github.com/apache/druid/pull/12770#issuecomment-1201219958

   Thanks for the comment @paul-rogers. The original behavior of the code 
(Calcite layer) was to cast any column with the name `__time` to TIMESTAMP for 
evaluation purposes. The modified behavior of the code checks whether the table 
was an external table or not, and takes a call depending on that.
   The issue with the query in the example:
   ```sql
   INSERT INTO foo
   SELECT TIME_PARSE("__time") AS __time, ...
   FROM TABLE(...)
   ```
   is that even this would fail because `ExternalDataSource` would provide the 
`__time` column (the left one) to the Calcite layer for execution, which would 
be interpreted as TIMESTAMP, instead of whatever the user intended it to be. 
This would cause a Calcite exception because `TIME_PARSE` will expect a 
`STRING` input and not a `TIMESTAMP` input. By changing the Macro, we are 
providing the "hint" to the execution layer that we want this column to be 
interpreted as whatever was provided by the user. 


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