[ https://issues.apache.org/jira/browse/CALCITE-5520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
TJ Banghart updated CALCITE-5520: --------------------------------- Description: 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. was: 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 has already applied the appropriate conversions. > 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)