SQL grammar supported by Dremio?

Is there an ANTLR SQL grammar for Dremio available? I’m looking for something like the grammar that’s available for Spark SQL, eg, spark/SqlBaseParser.g4 at master · apache/spark · GitHub

Hi @verun , I don’t know if something like this exists for dremio, but you can find here :

a formal description of the accepted SQL (see parserImpl.ftl and alter.ftl).

Hoping it helps, Best regards from French west coast.


Thanks Fabrice! What is the .ftl extension? And how would I go from parserImpl.ftl to Java code that can parse a SQL statement given in string form?

Perhaps this code already exists in the Dremio Java code base somewhere?

All I want is a reliable way to figure out which tables are being referenced in the SQL query.

Update: I did some digging around and as far as I can tell, the Dremio code base is using JavaCC to augment the SQL parser provided by Apache Calcite. I was able to locate a Parser class (“com.dremio.exec.planner.sql.parser.impl.ParserImpl”) which I think would serve this purpose.


Thanks for the update @Varun