askarbozcan opened a new pull request, #3100:
URL: https://github.com/apache/calcite/pull/3100

   This PR adds partial support for [MSSQL CONVERT 
function](https://learn.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-ver16).
 A function very similar to CAST that has an optional "style" operand to 
support different kinds of date string formats, float decimal points in string 
form, etc.
   
   The reason this PR is "partial", is because it simply adds a thin wrapper 
around CAST operator.
   
   **Implemented**
   * Add lookahead in parser to first <CONVERT> token to make sure there are no 
clashes with other unrelated CONVERT functions (including MSSQL CONVERT func)
   * Add parser rule specifically for CONVERT to add support for its syntax
   * SQLOperator (SqlConvertMssqlFunction) which utilizes 
SqlOperator.rewriteCall() to delegate all the functionality to CAST
   * Related Quidem tests in functions.iq
   
   **Not implemented**
   * 'style' is useless. It is parsed, however beyond that, any functionality 
related to it is not implemented.
   
   **Difficulties & notes on implementing 'style' operator**
   Almost everywhere in the codebase, the operand order for CAST is hard-coded, 
which is not a bad assumption at all; yet because of it it seems impossible to 
fully implement CONVERT unless it's properly added as its own operator.
   
   For references:
   
[RexImpTable.CastImplementor](https://github.com/apache/calcite/blob/ee9b80b0b68d442991dfaa142722e3488ec73e79/core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java#L2918)
   
   
[StandardConvertletTable.convertCast](https://github.com/apache/calcite/blob/ee9b80b0b68d442991dfaa142722e3488ec73e79/core/src/main/java/org/apache/calcite/sql2rel/StandardConvertletTable.java#L595)


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

Reply via email to