You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Arina Yelchiyeva <ar...@gmail.com> on 2016/02/25 16:20:22 UTC

translate function syntax

Hi all!

In Drill we faced the issue that Calcite doesn't allow Hive function
translate (expession, from_string, to_string) as Calcite expects different
syntax: translate( expression USING identifier).
Though translate(expression USING identifier) is an SQL standard, translate
(expession, from_string, to_string) is widely used among other databases.

Is there a way customly complement Calcite parse instructions for translate
function without Calcite code change?
I see that we can add custom sql statements, literals and so on but I
didn't figure out how all these can be used for translate function case.

Kind regards
Arina

Re: translate function syntax

Posted by Julian Hyde <jh...@apache.org>.
I think you’ll need to change the parser to generate a call to the SQL standard TRANSLATE if it sees ‘USING’ and generate a call to an unresolved TRANSLATE function if it sees ‘,’.

I’d appreciate if you could add the Oracle-style TRANSLATE function to SqlStdOperatorTable (call it say TRANSLATE3, since it has 3 parameters). Then the validator will be able to resolve it.

Julian

> On Feb 25, 2016, at 7:20 AM, Arina Yelchiyeva <ar...@gmail.com> wrote:
> 
> Hi all!
> 
> In Drill we faced the issue that Calcite doesn't allow Hive function
> translate (expession, from_string, to_string) as Calcite expects different
> syntax: translate( expression USING identifier).
> Though translate(expression USING identifier) is an SQL standard, translate
> (expession, from_string, to_string) is widely used among other databases.
> 
> Is there a way customly complement Calcite parse instructions for translate
> function without Calcite code change?
> I see that we can add custom sql statements, literals and so on but I
> didn't figure out how all these can be used for translate function case.
> 
> Kind regards
> Arina