[ 
https://issues.apache.org/jira/browse/CALCITE-7271?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18035615#comment-18035615
 ] 

Julian Hyde commented on CALCITE-7271:
--------------------------------------

Can this be implemented by adding a set of operators that each target (in this 
case Druid) does not support? 



A recent case sought to convert CHAR_LENGTH to LENGTH when pushing down to 
Oracle. It seems to me that both could be solved using data tables containing 
functions/operators. 

> Prevent unsafe CAST pushdown in Druid
> -------------------------------------
>
>                 Key: CALCITE-7271
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7271
>             Project: Calcite
>          Issue Type: Bug
>          Components: druid-adapter
>            Reporter: Stamatis Zampetakis
>            Priority: Minor
>
> Most of SQL queries are using the standard CAST operator that is unsafe and 
> should throw an error when the conversion is invalid. However, the [CAST 
> operation in 
> Druid|https://druid.apache.org/docs/latest/querying/sql-data-types/#standard-types]
>  returns null instead of throwing an error when the operation fails. 
> Currently the Druid adapter ignores the "error handling" discrepancies of the 
> CAST operator when pushing down such expressions. Ideally, to avoid altering 
> the semantics of the query the regular CAST should not be pushed to Druid.
> SQL queries can use the SAFE_CAST operator instead of the standard CAST 
> operator and this can be pushed safely to Druid since the semantics are the 
> same with those offered by the engine.
> The 
> [DruidSqlCastConverter|https://github.com/apache/calcite/blob/8b5c17e51e0c9c3f8e3db17c8d449e67e4e2974a/druid/src/main/java/org/apache/calcite/adapter/druid/DruidSqlCastConverter.java]
>  and potentially other classes may need modifications to handle/push the CAST 
> variations properly in Druid.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to