diff --git a/CHANGELOG.md b/CHANGELOG.md index a8922e5c1..17b815568 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/algebra/blazingdb-calcite-application/src/main/java/com/blazingdb/calcite/application/RelationalAlgebraGenerator.java b/algebra/blazingdb-calcite-application/src/main/java/com/blazingdb/calcite/application/RelationalAlgebraGenerator.java index 2f9b50b86..0f498cd77 100644 --- a/algebra/blazingdb-calcite-application/src/main/java/com/blazingdb/calcite/application/RelationalAlgebraGenerator.java +++ b/algebra/blazingdb-calcite-application/src/main/java/com/blazingdb/calcite/application/RelationalAlgebraGenerator.java @@ -57,6 +57,8 @@ import java.util.Properties; import java.util.EnumSet; +import org.apache.calcite.runtime.GeoFunctions; + /** *

Generate Relational Algebra

* The purpose of this class is to hold the planner, the program, and the @@ -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()); @@ -118,6 +120,7 @@ public RelationalAlgebraGenerator(BlazingSchema newSchema) { List 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),