You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Yishu_Coder Lin <yi...@gmail.com> on 2017/04/17 23:46:38 UTC

Parser failed for 'select top 10 * from A;'

Hi guys,

I just started to use Calcite's SQL parser. I am working on a project
related to Teradata and I found calcite doesn't support SQL syntax like
'select top 10 * from A'.

Is there anyway that I can change the parser to support syntax like this?
Please advise. Thanks!

Regards,
Yishu

Re: Parser failed for 'select top 10 * from A;'

Posted by Julian Hyde <jh...@apache.org>.
Look through git history for changes related to Parser.jj and SqlParserTest.java.

If you can’t figure out what the parser engine is from that, I don’t think it’s likely that you will be able to pull off this change.

Julian

> On Apr 17, 2017, at 4:58 PM, Yishu_Coder Lin <yi...@gmail.com> wrote:
> 
> Hi Julian,
> 
> Thanks for the advise! What is the engine to parse Parser.jj? Where can I
> find the document to learn how to use it?
> 
> Best,
> Yishu
> 
> On Mon, Apr 17, 2017 at 4:55 PM, Julian Hyde <jh...@apache.org> wrote:
> 
>> Sure, you could change the parser. I suggest you add a few tests to
>> SqlParserTest and then change Parser.jj until the tests pass. You could
>> then translate your query to the same as RelNode tree as “select * from A
>> limit 10”, and Calcite can execute that.
>> 
>> Log a JIRA case describing the syntax you intend to implement.
>> 
>> Julian
>> 
>> 
>>> On Apr 17, 2017, at 4:46 PM, Yishu_Coder Lin <yi...@gmail.com>
>> wrote:
>>> 
>>> Hi guys,
>>> 
>>> I just started to use Calcite's SQL parser. I am working on a project
>>> related to Teradata and I found calcite doesn't support SQL syntax like
>>> 'select top 10 * from A'.
>>> 
>>> Is there anyway that I can change the parser to support syntax like this?
>>> Please advise. Thanks!
>>> 
>>> Regards,
>>> Yishu
>> 
>> 


Re: Parser failed for 'select top 10 * from A;'

Posted by Yishu_Coder Lin <yi...@gmail.com>.
Hi Julian,

Thanks for the advise! What is the engine to parse Parser.jj? Where can I
find the document to learn how to use it?

Best,
Yishu

On Mon, Apr 17, 2017 at 4:55 PM, Julian Hyde <jh...@apache.org> wrote:

> Sure, you could change the parser. I suggest you add a few tests to
> SqlParserTest and then change Parser.jj until the tests pass. You could
> then translate your query to the same as RelNode tree as “select * from A
> limit 10”, and Calcite can execute that.
>
> Log a JIRA case describing the syntax you intend to implement.
>
> Julian
>
>
> > On Apr 17, 2017, at 4:46 PM, Yishu_Coder Lin <yi...@gmail.com>
> wrote:
> >
> > Hi guys,
> >
> > I just started to use Calcite's SQL parser. I am working on a project
> > related to Teradata and I found calcite doesn't support SQL syntax like
> > 'select top 10 * from A'.
> >
> > Is there anyway that I can change the parser to support syntax like this?
> > Please advise. Thanks!
> >
> > Regards,
> > Yishu
>
>

Re: Parser failed for 'select top 10 * from A;'

Posted by Julian Hyde <jh...@apache.org>.
Sure, you could change the parser. I suggest you add a few tests to SqlParserTest and then change Parser.jj until the tests pass. You could then translate your query to the same as RelNode tree as “select * from A limit 10”, and Calcite can execute that.

Log a JIRA case describing the syntax you intend to implement.

Julian


> On Apr 17, 2017, at 4:46 PM, Yishu_Coder Lin <yi...@gmail.com> wrote:
> 
> Hi guys,
> 
> I just started to use Calcite's SQL parser. I am working on a project
> related to Teradata and I found calcite doesn't support SQL syntax like
> 'select top 10 * from A'.
> 
> Is there anyway that I can change the parser to support syntax like this?
> Please advise. Thanks!
> 
> Regards,
> Yishu