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

Julian Hyde commented on CALCITE-5520:
--------------------------------------

I'm not very familiar with MSSQL, so can you clarify? It sounds as if MSSQL has 
no literals for its DATE, TIME and DATETIME types, but in some contexts (e.g. 
arguments to the FLOOR function) string literals are implicitly converted, and 
in other contexts you can use the CONVERT function to convert string literals 
or string expressions.

If so, what is your ask? Are you asking that Calcite skip calls to CONVERT that 
are redundant? Could you provide a SQL fragment that Calcite currently 
generates and another SQL fragment it should generate instead. 

> Improve MSSQL support for datetime literals
> -------------------------------------------
>
>                 Key: CALCITE-5520
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5520
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: TJ Banghart
>            Priority: Minor
>
> Datetime literals in MSSQL can mistakenly be unparsed as string literals. For 
> certain function calls like `FLOOR`, [logic already 
> exists|https://github.com/apache/calcite/blob/b64cb1325cfe1a5143ea3ca534f991b6f881c3c5/core/src/main/java/org/apache/calcite/sql/dialect/MssqlSqlDialect.java#L190-L225]
>  to wrap datetime reference with the appropriate conversions for the type.
> We should try to mimic this logic [in 
> {{uparseDateTimeLiteral}}|https://github.com/apache/calcite/blob/b64cb1325cfe1a5143ea3ca534f991b6f881c3c5/core/src/main/java/org/apache/calcite/sql/dialect/MssqlSqlDialect.java#L143-L146]
>  so when a literal is used in any function call, Calcite will have already 
> applied the appropriate conversions.



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

Reply via email to