Skip to content

Calcite schema ddl #957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 92 additions & 6 deletions baremaps-calcite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ limitations under the License.
<name>Apache Baremaps Calcite</name>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -85,10 +85,96 @@ limitations under the License.
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-server</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-fmpp-resources</id>
<goals>
<goal>copy-resources</goal>
</goals>
<phase>initialize</phase>
<configuration>
<outputDirectory>${project.build.directory}/codegen</outputDirectory>
<resources>
<resource>
<directory>src/main/codegen</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<dependencies>
<dependency>
<groupId>net.sourceforge.fmpp</groupId>
<artifactId>fmpp</artifactId>
<version>0.9.16</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>generate-fmpp-sources</id>
<goals>
<goal>run</goal>
</goals>
<phase>initialize</phase>
<configuration>
<target>
<taskdef classname="fmpp.tools.AntTask" name="fmpp" />
<fmpp configuration="${project.build.directory}/codegen/config.fmpp" data="tdd(${project.build.directory}/codegen/config.fmpp), default: tdd(${project.build.directory}/codegen/default_config.fmpp)" outputRoot="${project.build.directory}/generated-sources/fmpp" sourceRoot="${project.build.directory}/codegen/templates" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>javacc</id>
<goals>
<goal>javacc</goal>
</goals>
<configuration>
<sourceDirectory>${project.build.directory}/generated-sources/fmpp</sourceDirectory>
<outputDirectory>${project.build.directory}/generated-sources/calcite</outputDirectory>
<includes>
<include>**/Parser.jj</include>
</includes>
<lookAhead>2</lookAhead>
<isStatic>false</isStatic>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
107 changes: 107 additions & 0 deletions baremaps-calcite/src/main/codegen/config.fmpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# 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.

data: {
# 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 class package and name
package: "org.apache.baremaps.calcite.sql",
class: "BaremapsSqlDdlParser",

# List of import statements.
imports: [
"org.apache.calcite.schema.ColumnStrategy"
"org.apache.calcite.sql.SqlCreate"
"org.apache.calcite.sql.SqlDrop"
"org.apache.calcite.sql.SqlTruncate"
"org.apache.calcite.sql.ddl.SqlCreateTableLike"
"org.apache.calcite.sql.ddl.SqlDdlNodes"
]

# List of new keywords. Example: "DATABASES", "TABLES". If the keyword is
# not a reserved keyword, add it to the 'nonReservedKeywords' section.
keywords: [
"IF"
"MATERIALIZED"
"STORED"
"VIRTUAL"
"JAR"
"FILE"
"ARCHIVE"
]

# List of non-reserved keywords to add;
# items in this list become non-reserved
nonReservedKeywordsToAdd: [
# not in core, added in server
"IF"
"MATERIALIZED"
"STORED"
"VIRTUAL"
"JAR"
"FILE"
"ARCHIVE"
]

# List of methods for parsing extensions to "CREATE [OR REPLACE]" calls.
# Each must accept arguments "(SqlParserPos pos, boolean replace)".
# Example: "SqlCreateForeignSchema".
createStatementParserMethods: [
"SqlCreateForeignSchema"
"SqlCreateMaterializedView"
"SqlCreateSchema"
"SqlCreateTable"
"SqlCreateType"
"SqlCreateView"
"SqlCreateFunction"
]

# List of methods for parsing extensions to "DROP" calls.
# Each must accept arguments "(SqlParserPos pos)".
# Example: "SqlDropSchema".
dropStatementParserMethods: [
"SqlDropMaterializedView"
"SqlDropSchema"
"SqlDropTable"
"SqlDropType"
"SqlDropView"
"SqlDropFunction"
]

# List of methods for parsing extensions to "TRUNCATE" calls.
# Each must accept arguments "(SqlParserPos pos)".
# Example: "SqlTruncateTable".
truncateStatementParserMethods: [
"SqlTruncateTable"
]

# 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".
# Example: "parserImpls.ftl".
implementationFiles: [
"parserImpls.ftl"
]
}
}

freemarkerLinks: {
includes: includes/
}
Loading
Loading