Skip to content
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

[IDEA PLACEHOLDER] Add support for Calcite Spatial #1210

Open
wants to merge 3 commits into
base: branch-21.06
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- #1216 Add unit test for DAYOFWEEK
- #1205 Implement string REVERSE
- #1220 Implement string LEFT and RIGHT
- #1210 Add support for Calcite Spatial


## Improvements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
import java.util.Properties;
import java.util.EnumSet;

import org.apache.calcite.runtime.GeoFunctions;

/**
* <h1>Generate Relational Algebra</h1>
* The purpose of this class is to hold the planner, the program, and the
Expand Down Expand Up @@ -101,7 +103,7 @@ public RelationalAlgebraGenerator(BlazingSchema newSchema) {

Properties info = new Properties();
info.setProperty("lex", "JAVA");
Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
Connection connection = DriverManager.getConnection("jdbc:calcite:fun=spatial:", info);
CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class);
calciteConnection.setSchema(newSchema.getName());

Expand All @@ -118,6 +120,7 @@ public RelationalAlgebraGenerator(BlazingSchema newSchema) {
List<SqlOperatorTable> sqlOperatorTables = new ArrayList<>();
sqlOperatorTables.add(SqlLibraryOperatorTableFactory.INSTANCE.getOperatorTable(
EnumSet.of(SqlLibrary.STANDARD, SqlLibrary.ORACLE, SqlLibrary.MYSQL)));
sqlOperatorTables.add(CalciteCatalogReader.operatorTable(GeoFunctions.class.getName()));
sqlOperatorTables.add(new CalciteCatalogReader(CalciteSchema.from(schema.getSubSchema(newSchema.getName())),
defaultSchema,
new JavaTypeFactoryImpl(RelDataTypeSystem.DEFAULT),
Expand Down