Re: Question about creating a SqlBasicCall

2022-01-29 Thread Julian Hyde
Logically, your operator simply has three arguments. How the call with those 
arguments is converted back into SQL - whether it generates a comma or a space 
between arguments 1 and 2 - is a matter of syntax. It looks like your operator 
is unparsing calls using the default operator syntax, which uses commas, and 
you should override how it unparses itself.  

> On Jan 29, 2022, at 1:28 AM, Zhe Hu  wrote:
> 
> Hi, community.
> 
> 
> I have one small question about how to create a SqlBasicCall in Parser.jj 
> correctly.
> Take TimestampAddFunctionCall as an example, we create it by:
>SqlStdOperatorTable.TIMESTAMP_ADD.createCall(s.end(this), args)
> As a result, call like “TIMESTAMPADD(arg0, arg1, arg2)” will be formed.
> 
> 
> Here is my question:
> How does the SqlParser assemble the operands with COMMA correctly?
> Since the result is not “TIMESTAMPADD(arg0 arg1, arg2)”, which loses the 
> former COMMA; or “TIMESTAMPADD(arg0 arg1, arg2)”、“TIMESTAMPADD(arg0 arg1 
> arg2)”.
> 
> 
> I’ve noticed that SqlParserPos is involved, but I’m not sure if it’s relevant.
> 
> 
> Any feedback would be awesome.
> 
> 
> Best,
> ZheHu



Question about creating a SqlBasicCall

2022-01-29 Thread Zhe Hu
Hi, community.


I have one small question about how to create a SqlBasicCall in Parser.jj 
correctly.
Take TimestampAddFunctionCall as an example, we create it by:
SqlStdOperatorTable.TIMESTAMP_ADD.createCall(s.end(this), args)
As a result, call like “TIMESTAMPADD(arg0, arg1, arg2)” will be formed.


Here is my question:
How does the SqlParser assemble the operands with COMMA correctly?
Since the result is not “TIMESTAMPADD(arg0 arg1, arg2)”, which loses the former 
COMMA; or “TIMESTAMPADD(arg0 arg1, arg2)”、“TIMESTAMPADD(arg0 arg1 arg2)”.


I’ve noticed that SqlParserPos is involved, but I’m not sure if it’s relevant.


Any feedback would be awesome.


Best,
ZheHu