| # 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 | |
| # (https://javacc.github.io/javacc/) 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: { | |
| default: tdd("../default_config.fmpp") | |
| # Data declarations for this parser. | |
| # | |
| # Default declarations are in default_config.fmpp; if you do not include a | |
| # declaration ('imports' or 'nonReservedKeywords', for example) in this file, | |
| # FMPP will use the declaration from default_config.fmpp. | |
| 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: [ | |
| "java.util.List" | |
| "org.apache.calcite.sql.SqlNode" | |
| "org.apache.calcite.sql.SqlCreate" | |
| "org.apache.calcite.sql.SqlInsert" | |
| "org.apache.calcite.sql.SqlNodeList" | |
| "org.apache.calcite.sql.SqlSelect" | |
| "org.apache.calcite.sql.SqlLiteral" | |
| "org.apache.calcite.sql.parser.SqlParserPos" | |
| "org.apache.calcite.sql.SqlBasicCall" | |
| "org.apache.druid.java.util.common.granularity.Granularity" | |
| "org.apache.druid.java.util.common.granularity.GranularityType" | |
| "org.apache.druid.java.util.common.granularity.Granularities" | |
| "org.apache.druid.sql.calcite.parser.DruidSqlAlterTable" | |
| "org.apache.druid.sql.calcite.parser.DruidSqlColumnDeclaration" | |
| "org.apache.druid.sql.calcite.parser.DruidSqlCreateTable" | |
| "org.apache.druid.sql.calcite.parser.DruidSqlInsert" | |
| "org.apache.druid.sql.calcite.parser.DruidSqlParserUtils" | |
| "org.apache.druid.sql.calcite.parser.DruidSqlPropertyAssignment" | |
| "org.apache.druid.sql.calcite.external.ExtendOperator" | |
| "org.apache.druid.sql.calcite.external.ParameterizeOperator" | |
| "org.apache.druid.sql.calcite.parser.SqlProjectionSpec" | |
| "org.apache.druid.sql.calcite.parser.ExternalDestinationSqlIdentifier" | |
| "java.util.HashMap" | |
| ] | |
| # List of new keywords. Example: "DATABASES", "TABLES". If the keyword is not a reserved | |
| # keyword add it to 'nonReservedKeywords' section. | |
| keywords: [ | |
| "CLUSTERED" | |
| "OVERWRITE" | |
| "PARTITIONED" | |
| "EXTERN" | |
| "IF" | |
| "PROPERTIES" | |
| "PROJECTION" | |
| "SEALED" | |
| "LONG" | |
| ] | |
| nonReservedKeywordsToAdd: [ | |
| "OVERWRITE" | |
| "EXTERN" | |
| "VARIANT" | |
| "IF" | |
| "PROPERTIES" | |
| "PROJECTION" | |
| "SEALED" | |
| "LONG" | |
| ] | |
| # List of methods for parsing custom SQL statements. | |
| # Return type of method implementation should be 'SqlNode'. | |
| # Example: SqlShowDatabases(), SqlShowTables(). | |
| statementParserMethods: [ | |
| "DruidSqlInsertEof()" | |
| "DruidSqlExplain()" | |
| "DruidSqlReplaceEof()" | |
| "DruidSqlAlterTable()" | |
| ] | |
| # CREATE reaches DruidSqlCreateTable through Calcite's stock SqlCreate() production, which supplies the | |
| # (Span, boolean replace) arguments. DROP TABLE is deliberately absent: catalog-only deletion would be a | |
| # surprising meaning for the statement, so it is left unclaimed until the semantics are settled. | |
| createStatementParserMethods: [ | |
| "DruidSqlCreateTable" | |
| ] | |
| # List of methods for parsing custom data types. | |
| # Return type of method implementation should be "SqlTypeNameSpec". | |
| # Example: SqlParseTimeStampZ(). | |
| dataTypeParserMethods: [ | |
| "DruidType()" | |
| ] | |
| # List of files in @includes directory that have parser method | |
| # implementations for parsing custom SQL statements, literals or types | |
| # given as part of "statementParserMethods", "literalParserMethods" or | |
| # "dataTypeParserMethods". | |
| implementationFiles: [ | |
| "common.ftl" | |
| "ddl.ftl" | |
| "explain.ftl" | |
| "replace.ftl" | |
| ] | |
| } | |
| } | |
| freemarkerLinks: { | |
| includes: includes/ | |
| } |