LakshSingla commented on a change in pull request #12163: URL: https://github.com/apache/druid/pull/12163#discussion_r793954197
########## File path: sql/src/main/codegen/config.fmpp ########## @@ -0,0 +1,433 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to you under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This file is an FMPP (http://fmpp.sourceforge.net/) configuration file to +# allow clients to extend Calcite's SQL parser to support application specific +# SQL statements, literals or data types. +# +# Calcite's parser grammar file (Parser.jj) is written in javacc +# (http://javacc.java.net/) with Freemarker (http://freemarker.org/) variables +# to allow clients to: +# 1. have custom parser implementation class and package name. +# 2. insert new parser method implementations written in javacc to parse +# custom: +# a) SQL statements. +# b) literals. +# c) data types. +# 3. add new keywords to support custom SQL constructs added as part of (2). +# 4. add import statements needed by inserted custom parser implementations. +# +# Parser template file (Parser.jj) along with this file are packaged as +# part of the calcite-core-<version>.jar under "codegen" directory. + +data: { + parser: { + # Generated parser implementation package and class name. + package: "org.apache.druid.sql.calcite.parser", + class: "DruidSqlParserImpl", + + # List of additional classes and packages to import. + # Example. "org.apache.calcite.sql.*", "java.util.List". + imports: [ + "org.apache.calcite.sql.SqlNode" + "org.apache.calcite.sql.SqlInsert" + "org.apache.druid.sql.calcite.parser.DruidSqlInsert" + ] + + # List of new keywords. Example: "DATABASES", "TABLES". If the keyword is not a reserved + # keyword add it to 'nonReservedKeywords' section. + keywords: [ Review comment: One thing that @abhishekagarwal87 suggested is to have a flag (in PlannerContext or PlannerConfig) that can be used to switch between the custom and the default parser. That would make sense in case we don't want existing queries with `cluster` identifiers to fail. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
