I used extension to the parser through freemarker template.
I have added parsing SqlInsertWithPartition() for new sql construct (insert
into t2 (c1, c2) partition by (c1) select c1, c2 from t1)
By I keep getting the following error:
PARSE ERROR: Encountered "partition" at line 1, column 30.
Though when I re-write my parsing to use other keyword then insert, for
example, my_insert, everything works fine.
My guess is that default insert parsing in Calcite [1] is done before
custom.
stmt = SqlExplain()
|
* stmt = SqlInsert()*
|
stmt = SqlDelete()
|
stmt = SqlUpdate()
|
stmt = SqlMerge()
|
stmt = SqlProcedureCall()
|
* stmt = SqlInsertWithPartition()*
[1]
https://github.com/apache/calcite/blob/master/core/src/main/codegen/templates/Parser.jj#L1259
Am I doing something wrong?
On Fri, Sep 16, 2016 at 3:33 AM Julian Hyde <[email protected]> wrote:
> Hopefully you know how to make extensions to the parser; see
> https://issues.apache.org/jira/browse/PHOENIX-1706 for instance. You
> can add an extension to INSERT syntax that is an empty string in
> Calcite's version of the parser, something else in your version of the
> parser. You might need to add a new template variable;
> https://issues.apache.org/jira/browse/CALCITE-1241 is an example of a
> change that did that.
>
> On Thu, Sep 15, 2016 at 6:54 AM, Arina Yelchiyeva
> <[email protected]> wrote:
> > Hi all!
> >
> > Calcite supports standard insert syntax. But I need to add partition by
> > clause in it.
> > I've been trying to overwrite it in parser using additional parser
> > statements calls but such calls go after insert in parsing hierarchy. So
> I
> > have been wondering is there a way to overwrite insert syntax?
> >
> > Kind regards
> > Arina
>