[jira] [Commented] (CALCITE-6206) Add library operator mapping for unparsing

2024-01-30 Thread Tanner Clary (Jira)


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

Tanner Clary commented on CALCITE-6206:
---

I'm beginning to work on this, I was thinking maybe each dialect has a map with 
`SqlKind` as the key and `SqlOperator` as the value.

There's actually a small PoC in https://github.com/apache/calcite/pull/3649 if 
either of you wanted to look. I didn't want to do all the libraries in case 
there were issues with my approach.

> Add library operator mapping for unparsing
> --
>
> Key: CALCITE-6206
> URL: https://issues.apache.org/jira/browse/CALCITE-6206
> Project: Calcite
>  Issue Type: Improvement
>Reporter: Tanner Clary
>Assignee: Tanner Clary
>Priority: Major
>
> [~julianhyde] and I have talked about adding the ability to reference 
> cross-dialect operator aliases during unparsing so it does not need to be 
> "manually added".
> For instance, if unparsing a call for the "STARTS_WITH" operator for the 
> Snowflake dialect, it would be nice if there was some sort of map that could 
> be referenced to see that the call should be unparsed with "STARTSWITH" 
> instead.



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


[jira] [Commented] (CALCITE-6206) Add library operator mapping for unparsing

2024-01-17 Thread Jiajun Xie (Jira)


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

Jiajun Xie commented on CALCITE-6206:
-

I have seen similar features before.

There are `UDFTransformer` in Coral. 

Here is 
[demo|https://github.com/linkedin/coral/commit/99310c2b423f12f355851140064bb46bddfaa126]
 about Hive "pmod" to Trino "mod", 

> Add library operator mapping for unparsing
> --
>
> Key: CALCITE-6206
> URL: https://issues.apache.org/jira/browse/CALCITE-6206
> Project: Calcite
>  Issue Type: Improvement
>Reporter: Tanner Clary
>Assignee: Tanner Clary
>Priority: Major
>
> [~julianhyde] and I have talked about adding the ability to reference 
> cross-dialect operator aliases during unparsing so it does not need to be 
> "manually added".
> For instance, if unparsing a call for the "STARTS_WITH" operator for the 
> Snowflake dialect, it would be nice if there was some sort of map that could 
> be referenced to see that the call should be unparsed with "STARTSWITH" 
> instead.



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


[jira] [Commented] (CALCITE-6206) Add library operator mapping for unparsing

2024-01-16 Thread Julian Hyde (Jira)


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

Julian Hyde commented on CALCITE-6206:
--

I support this initiative. Calcite needs to "translate SQL expression e from 
dialect X to dialect Y" in several different places: not just in RelToSql (aka 
JDBC adapter) but also when receiving SQL in a particular dialect. If the 
mapping is comprehensive and well-tested it will simplify code elsewhere (e.g. 
in methods that override {{SqlDialect.unparseCall}}).

> Add library operator mapping for unparsing
> --
>
> Key: CALCITE-6206
> URL: https://issues.apache.org/jira/browse/CALCITE-6206
> Project: Calcite
>  Issue Type: Improvement
>Reporter: Tanner Clary
>Assignee: Tanner Clary
>Priority: Major
>
> [~julianhyde] and I have talked about adding the ability to reference 
> cross-dialect operator aliases during unparsing so it does not need to be 
> "manually added".
> For instance, if unparsing a call for the "STARTS_WITH" operator for the 
> Snowflake dialect, it would be nice if there was some sort of map that could 
> be referenced to see that the call should be unparsed with "STARTSWITH" 
> instead.



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