Yes, JavaCC can be intimidating. Test-driven development is the way to go: add 
a test case to SqlParserTest for your new feature (or a small part of your new 
feature), and make small changes to core/src/main/codegen/templates/Parser.jj 
until your test passes.

Try to follow the patterns in the grammar file. Think of existing SQL syntax 
that is similar to what you want to add, search for that syntax in Parser.jj, 
and try to write something similar.

The generated SqlParserImpl.java file is very large and only vaguely resembles 
the grammar. Still, if you made a mistake in a Java action blog, you can 
usually figure it out from compiler error messages. You can put breakpoints in 
the SqlParserImpl.java file and attach the debugger; sometimes it is useful, 
and sometimes it is just confusing. 


> On May 21, 2025, at 8:21 AM, Cancai Cai <can...@apache.org> wrote:
> 
> Thanks, Julian, for bringing up this discussion. I'm just writing a pipeline 
> parser recently. But I'm not using Calcite because I'm not very familiar with 
> JavaCC, and I'm not sure how to support pipeline syntax while being 
> compatible with SQL syntax, so I'm using go to write a parser specifically 
> for pipeline syntax from scratch. 
> 
> If no one takes over this work, I can start this work in the second half of 
> the year, because the first half of the year is too busy.
> 
> Best wishes,
> Cancai Cai
> 
> On 2025/05/19 17:49:20 Julian Hyde wrote:
>> SQL pipe syntax was introduced as part of GoogleSQL and is described
>> in a paper "SQL Has Problems. We Can Fix Them: Pipe Syntax In SQL" by
>> Jeff Shute and others[1]. Other vendors, including Firebolt and
>> Databricks, have announced support. I have logged a Jira case to
>> support pipe syntax in Calcite[2].
>> 
>> What do you think of supporting this syntax in Calcite? Is anyone
>> interested in taking on the task?
>> 
>> I have sketched out a design in the case, but I would like to hear
>> what people think are the technical challenges in this task.
>> 
>> Julian
>> 
>> [1] https://www.vldb.org/pvldb/vol17/p4051-shute.pdf
>> [2] https://issues.apache.org/jira/browse/CALCITE-7028
>> 

Reply via email to