From 53dfda3412977ef69602a4b48b192251772b9675 Mon Sep 17 00:00:00 2001 From: Sai Sriharsha Annepu <72639930+gs-ssh16@users.noreply.github.com> Date: Tue, 29 Oct 2024 10:30:46 +0530 Subject: [PATCH] Native function to parse Postgres SQL statements (#3209) --- .../collection/generation/TestExtensions.java | 1 + .../pom.xml | 5 + .../finos/legend/engine/ide/PureIDELight.java | 2 +- .../pom.xml | 79 +++++++++ ...stgresSqlParserCodeRepositoryProvider.java | 28 ++++ ...lesystem.repository.CodeRepositoryProvider | 1 + ...tional_postgres_sql_parser.definition.json | 18 ++ .../postgresSqlParser.pure | 52 ++++++ .../pom.xml | 154 ++++++++++++++++++ .../PostgresSqlParserExtensionCompiled.java | 45 +++++ .../natives/ParseSqlStatementToJson.java | 49 ++++++ ....java.compiled.extension.CompiledExtension | 1 + ...estPostgresSqlParserFunctionsCompiled.java | 26 +++ .../pom.xml | 106 ++++++++++++ ...PostgresSqlParserExtensionInterpreted.java | 36 ++++ .../natives/ParseSqlStatementToJson.java | 66 ++++++++ ...interpreted.extension.InterpretedExtension | 1 + ...PostgresSqlParserFunctionsInterpreted.java | 26 +++ .../pom.xml | 8 +- .../sql/grammar/from/antlr4/SqlBaseLexer.g4 | 0 .../sql/grammar/from/antlr4/SqlBaseParser.g4 | 0 .../grammar/from/AbstractSqlBaseLexer.java | 0 .../sql/grammar/from/SQLGrammarParser.java | 0 .../sql/grammar/from/SQLParserException.java | 0 .../language/sql/grammar/from/SqlVisitor.java | 0 .../sql/grammar/to/SQLGrammarComposer.java | 0 .../test/roundtrip/TestSQLRoundTrip.java | 0 .../pom.xml | 6 +- ...external_query_sql_metamodel.protocol.json | 0 ...l_query_sql_schema_metamodel.protocol.json | 0 .../pom.xml | 2 +- ...ostgresSqlModelCodeRepositoryProvider.java | 0 ...lesystem.repository.CodeRepositoryProvider | 0 ...ational_postgres_sql_model.definition.json | 0 .../metamodel.pure | 0 .../schema_metamodel.pure | 0 .../pom.xml | 37 +++++ .../pom.xml | 15 ++ ...re_relational_sql_planning.definition.json | 3 +- .../pom.xml | 1 - .../pom.xml | 1 + .../legend-engine-xt-sql-compiler/pom.xml | 4 +- .../pom.xml | 4 +- .../legend-engine-xt-sql-http-api/pom.xml | 4 +- .../pom.xml | 4 +- .../pom.xml | 2 +- .../legend-engine-xt-sql-pure/pom.xml | 4 +- legend-engine-xts-sql/pom.xml | 2 - pom.xml | 21 ++- 49 files changed, 787 insertions(+), 27 deletions(-) create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/pom.xml create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/code/core/CoreExternalStoreRelationalPostgresSqlParserCodeRepositoryProvider.java create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/core_external_store_relational_postgres_sql_parser.definition.json create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/core_external_store_relational_postgres_sql_parser/postgresSqlParser.pure create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/pom.xml create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/PostgresSqlParserExtensionCompiled.java create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/natives/ParseSqlStatementToJson.java create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/test/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/TestPostgresSqlParserFunctionsCompiled.java create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/pom.xml create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/PostgresSqlParserExtensionInterpreted.java create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/natives/ParseSqlStatementToJson.java create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/test/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/TestPostgresSqlParserFunctionsInterpreted.java rename {legend-engine-xts-sql/legend-engine-xt-sql-grammar => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar}/pom.xml (92%) rename {legend-engine-xts-sql/legend-engine-xt-sql-grammar => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar}/src/main/antlr4/org/finos/legend/engine/language/sql/grammar/from/antlr4/SqlBaseLexer.g4 (100%) rename {legend-engine-xts-sql/legend-engine-xt-sql-grammar => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar}/src/main/antlr4/org/finos/legend/engine/language/sql/grammar/from/antlr4/SqlBaseParser.g4 (100%) rename {legend-engine-xts-sql/legend-engine-xt-sql-grammar => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar}/src/main/java/org/finos/legend/engine/language/sql/grammar/from/AbstractSqlBaseLexer.java (100%) rename {legend-engine-xts-sql/legend-engine-xt-sql-grammar => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar}/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SQLGrammarParser.java (100%) rename {legend-engine-xts-sql/legend-engine-xt-sql-grammar => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar}/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SQLParserException.java (100%) rename {legend-engine-xts-sql/legend-engine-xt-sql-grammar => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar}/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SqlVisitor.java (100%) rename {legend-engine-xts-sql/legend-engine-xt-sql-grammar => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar}/src/main/java/org/finos/legend/engine/language/sql/grammar/to/SQLGrammarComposer.java (100%) rename {legend-engine-xts-sql/legend-engine-xt-sql-grammar => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar}/src/test/java/org/finos/legend/engine/language/sql/grammar/test/roundtrip/TestSQLRoundTrip.java (100%) rename {legend-engine-xts-sql/legend-engine-xt-sql-protocol => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-protocol}/pom.xml (96%) rename {legend-engine-xts-sql/legend-engine-xt-sql-protocol => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-protocol}/src/main/resources/core_external_query_sql_metamodel.protocol.json (100%) rename {legend-engine-xts-sql/legend-engine-xt-sql-protocol => legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-protocol}/src/main/resources/core_external_query_sql_schema_metamodel.protocol.json (100%) rename legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/{legend-engine-xt-relationalStore-pure => legend-engine-xt-relationalStore-postgresSql}/legend-engine-xt-relationalStore-postgresSqlModel-pure/pom.xml (98%) rename legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/{legend-engine-xt-relationalStore-pure => legend-engine-xt-relationalStore-postgresSql}/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/java/org/finos/legend/engine/code/core/CoreExternalStoreRelationalPostgresSqlModelCodeRepositoryProvider.java (100%) rename legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/{legend-engine-xt-relationalStore-pure => legend-engine-xt-relationalStore-postgresSql}/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider (100%) rename legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/{legend-engine-xt-relationalStore-pure => legend-engine-xt-relationalStore-postgresSql}/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model.definition.json (100%) rename legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/{legend-engine-xt-relationalStore-pure => legend-engine-xt-relationalStore-postgresSql}/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model/metamodel.pure (100%) rename legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/{legend-engine-xt-relationalStore-pure => legend-engine-xt-relationalStore-postgresSql}/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model/schema_metamodel.pure (100%) create mode 100644 legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/pom.xml diff --git a/legend-engine-config/legend-engine-extensions-collection-generation/src/test/java/org/finos/legend/engine/extensions/collection/generation/TestExtensions.java b/legend-engine-config/legend-engine-extensions-collection-generation/src/test/java/org/finos/legend/engine/extensions/collection/generation/TestExtensions.java index f7d70e917e9..61ee22f13b9 100644 --- a/legend-engine-config/legend-engine-extensions-collection-generation/src/test/java/org/finos/legend/engine/extensions/collection/generation/TestExtensions.java +++ b/legend-engine-config/legend-engine-extensions-collection-generation/src/test/java/org/finos/legend/engine/extensions/collection/generation/TestExtensions.java @@ -587,6 +587,7 @@ protected Iterable getExpectedCodeRepositories() .with("core_external_store_relational_sql_planning") .with("core_external_store_relational_sql_dialect_translation") .with("core_external_store_relational_sql_dialect_translation_duckdb") + .with("core_external_store_relational_postgres_sql_parser") ; } } diff --git a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/pom.xml b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/pom.xml index 1b763bc9fad..8f04094405b 100644 --- a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/pom.xml +++ b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/pom.xml @@ -283,6 +283,11 @@ legend-engine-xt-relationalStore-SDT-pure runtime + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser + runtime + diff --git a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java index d1c989912e2..2ded863b65d 100644 --- a/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java +++ b/legend-engine-pure/legend-engine-pure-ide/legend-engine-pure-ide-light-http-server/src/main/java/org/finos/legend/engine/ide/PureIDELight.java @@ -108,7 +108,7 @@ protected MutableList buildRepositories(SourceLocationCon .with(this.buildCore("legend-engine-xts-java/legend-engine-xt-javaGeneration-pure", "external-language-java")) .with(this.buildCore("legend-engine-xts-java/legend-engine-xt-javaGeneration-featureBased-pure", "external-language-java-feature-based-generation")) .with(this.buildCore("legend-engine-xts-java/legend-engine-xt-javaPlatformBinding-pure", "java-platform-binding")) - .with(this.buildCore("legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure", "external-store-relational-postgres-sql-model")) + .with(this.buildCore("legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure", "external-store-relational-postgres-sql-model")) .with(this.buildCore("legend-engine-xts-sql/legend-engine-xt-sql-pure", "external-query-sql")) .with(this.buildCore("legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-pure-specification-metamodel", "elasticsearch_specification_metamodel")) .with(this.buildCore("legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-executionPlan-test", "elasticsearch_execution_test")) diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/pom.xml new file mode 100644 index 00000000000..a460cb14e2d --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/pom.xml @@ -0,0 +1,79 @@ + + + + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSql + 4.63.2-SNAPSHOT + + 4.0.0 + + legend-engine-pure-functions-relationalStore-postgresSql-parser + jar + Legend Engine - Pure - Functions - Relational Store - Postgres SQL - Parser + + + + + org.finos.legend.pure + legend-pure-maven-generation-par + + + generate-sources + + build-pure-jar + + + src/main/resources + ${legend.pure.version} + + + ${project.basedir}/src/main/resources/core_external_store_relational_postgres_sql_parser.definition.json + + + + + + + + org.finos.legend.pure + legend-pure-m2-dsl-diagram-grammar + ${legend.pure.version} + + + org.finos.legend.engine + legend-engine-pure-code-compiled-core + ${project.version} + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSqlModel-pure + ${project.version} + + + + + + + + + org.finos.legend.pure + legend-pure-m3-core + + + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/code/core/CoreExternalStoreRelationalPostgresSqlParserCodeRepositoryProvider.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/code/core/CoreExternalStoreRelationalPostgresSqlParserCodeRepositoryProvider.java new file mode 100644 index 00000000000..0b5cffc084f --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/code/core/CoreExternalStoreRelationalPostgresSqlParserCodeRepositoryProvider.java @@ -0,0 +1,28 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed 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. + +package org.finos.legend.engine.code.core; + +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepository; +import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider; +import org.finos.legend.pure.m3.serialization.filesystem.repository.GenericCodeRepository; + +public class CoreExternalStoreRelationalPostgresSqlParserCodeRepositoryProvider implements CodeRepositoryProvider +{ + @Override + public CodeRepository repository() + { + return GenericCodeRepository.build("core_external_store_relational_postgres_sql_parser.definition.json"); + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider new file mode 100644 index 00000000000..3399dbeeec4 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider @@ -0,0 +1 @@ +org.finos.legend.engine.code.core.CoreExternalStoreRelationalPostgresSqlParserCodeRepositoryProvider \ No newline at end of file diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/core_external_store_relational_postgres_sql_parser.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/core_external_store_relational_postgres_sql_parser.definition.json new file mode 100644 index 00000000000..14c6bc90c7d --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/core_external_store_relational_postgres_sql_parser.definition.json @@ -0,0 +1,18 @@ +{ + "name": "core_external_store_relational_postgres_sql_parser", + "pattern": "(meta::external::store::relational::postgresSql::parser)(::.*)?", + "dependencies": [ + "platform", + "platform_dsl_store", + "platform_dsl_mapping", + "platform_dsl_path", + "platform_dsl_graph", + "platform_dsl_diagram", + "platform_store_relational", + "core_functions_standard", + "core_functions_unclassified", + "core_functions_json", + "core", + "core_external_store_relational_postgres_sql_model" + ] +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/core_external_store_relational_postgres_sql_parser/postgresSqlParser.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/core_external_store_relational_postgres_sql_parser/postgresSqlParser.pure new file mode 100644 index 00000000000..5cdf431f38e --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-functions-relationalStore-postgresSql-parser/src/main/resources/core_external_store_relational_postgres_sql_parser/postgresSqlParser.pure @@ -0,0 +1,52 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed 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. + +import meta::external::query::sql::metamodel::*; +import meta::external::store::relational::postgresSql::parser::*; +import meta::pure::functions::meta::*; +import meta::json::*; + +native function meta::external::store::relational::postgresSql::parser::parseSqlStatementToJson(sql: String[1]): String[1]; + +function meta::external::store::relational::postgresSql::parser::parseSqlStatement(sql: String[1]): Statement[1] +{ + let statementJson = $sql->parseSqlStatementToJson(); + $statementJson->fromJSON( + Statement, + ^JSONDeserializationConfig( + typeKeyName = '_type', + failOnUnknownProperties = true, + typeLookup = typeLookupPairs() + ) + ); +} + +function <> meta::external::store::relational::postgresSql::parser::typeLookupPairs(): Pair[*] +{ + getAllPackageElements(meta::external::query::sql::metamodel, false) + ->filter(x | $x->instanceOf(Class)) + ->cast(@Class) + ->map(x | pair($x.name->toLowerFirstCharacter()->toOne(), $x->elementToPath())) +} + +function <> meta::external::store::relational::postgresSql::parser::testParseSqlStatement(): Boolean[1] +{ + let statement = parseSqlStatement('SELECT 1 + 2 as result'); + assert($statement->instanceOf(Query)); + assert($statement->cast(@Query).queryBody->instanceOf(QuerySpecification)); + assert($statement->cast(@Query).queryBody->cast(@QuerySpecification).select.selectItems->size() == 1); + assert($statement->cast(@Query).queryBody->cast(@QuerySpecification).select.selectItems->toOne()->instanceOf(SingleColumn)); + assert($statement->cast(@Query).queryBody->cast(@QuerySpecification).select.selectItems->toOne()->cast(@SingleColumn).alias == 'result'); + assert($statement->cast(@Query).queryBody->cast(@QuerySpecification).select.selectItems->toOne()->cast(@SingleColumn).expression->instanceOf(ArithmeticExpression)); +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/pom.xml new file mode 100644 index 00000000000..55a969d919e --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/pom.xml @@ -0,0 +1,154 @@ + + + + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSql + 4.63.2-SNAPSHOT + + 4.0.0 + + legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser + jar + Legend Engine - Pure - Runtime - Java Extension - Compiled - Functions - Relational Store - Postgres SQL - Parser + + + + + org.finos.legend.pure + legend-pure-maven-generation-java + + + compile + + build-pure-compiled-jar + + + true + true + modular + true + + core_external_store_relational_postgres_sql_parser + + + + + + + org.finos.legend.pure + legend-pure-m2-dsl-diagram-grammar + ${legend.pure.version} + + + org.finos.legend.engine + legend-engine-pure-code-compiled-core + ${project.version} + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSqlModel-pure + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-functions-relationalStore-postgresSql-parser + ${project.version} + + + + + + + + + + org.finos.legend.pure + legend-pure-m4 + + + org.finos.legend.pure + legend-pure-m3-core + + + org.finos.legend.pure + legend-pure-runtime-java-engine-compiled + + + + + + org.finos.legend.engine + legend-engine-pure-platform-java + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-unclassified + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-json + + + org.finos.legend.engine + legend-engine-pure-code-compiled-core + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSqlModel-pure + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSql-protocol + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSql-grammar + + + org.finos.legend.engine + legend-engine-pure-functions-relationalStore-postgresSql-parser + runtime + + + + + org.eclipse.collections + eclipse-collections + + + org.eclipse.collections + eclipse-collections-api + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + + + junit + junit + + + + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/PostgresSqlParserExtensionCompiled.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/PostgresSqlParserExtensionCompiled.java new file mode 100644 index 00000000000..77910a97f06 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/PostgresSqlParserExtensionCompiled.java @@ -0,0 +1,45 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed 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. + +package org.finos.legend.engine.pure.runtime.external.relational.postgresSql.parser.compiled; + +import org.eclipse.collections.api.factory.Lists; +import org.finos.legend.pure.runtime.java.compiled.extension.AbstractCompiledExtension; +import org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.Native; +import org.finos.legend.engine.pure.runtime.external.relational.postgresSql.parser.compiled.natives.ParseSqlStatementToJson; + +import java.util.List; + +public class PostgresSqlParserExtensionCompiled extends AbstractCompiledExtension +{ + @Override + public List getExtraNatives() + { + return Lists.fixedSize.with( + new ParseSqlStatementToJson() + ); + } + + @Override + public String getRelatedRepository() + { + return "core_external_store_relational_postgres_sql_parser"; + } + + public static CompiledExtension extension() + { + return new PostgresSqlParserExtensionCompiled(); + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/natives/ParseSqlStatementToJson.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/natives/ParseSqlStatementToJson.java new file mode 100644 index 00000000000..1df82aeacae --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/natives/ParseSqlStatementToJson.java @@ -0,0 +1,49 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed 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. + +package org.finos.legend.engine.pure.runtime.external.relational.postgresSql.parser.compiled.natives; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.finos.legend.engine.language.sql.grammar.from.SQLGrammarParser; +import org.finos.legend.engine.protocol.sql.metamodel.Statement; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.runtime.java.compiled.generation.processors.natives.AbstractNativeFunctionGeneric; + +public class ParseSqlStatementToJson extends AbstractNativeFunctionGeneric +{ + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + public ParseSqlStatementToJson() + { + super( + ParseSqlStatementToJson.class.getCanonicalName() + "." + "parseSqlStatementToJson", + AbstractNativeFunctionGeneric.getMethod(ParseSqlStatementToJson.class, "parseSqlStatementToJson").getParameterTypes(), + "parseSqlStatementToJson_String_1__String_1_" + ); + } + + public static String parseSqlStatementToJson(String sql) throws PureExecutionException + { + try + { + Statement statement = SQLGrammarParser.newInstance().parseStatement(sql); + return OBJECT_MAPPER.writeValueAsString(statement); + } + catch (JsonProcessingException e) + { + throw new PureExecutionException(e); + } + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension new file mode 100644 index 00000000000..41422a63b4a --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.compiled.extension.CompiledExtension @@ -0,0 +1 @@ +org.finos.legend.engine.pure.runtime.external.relational.postgresSql.parser.compiled.PostgresSqlParserExtensionCompiled \ No newline at end of file diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/test/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/TestPostgresSqlParserFunctionsCompiled.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/test/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/TestPostgresSqlParserFunctionsCompiled.java new file mode 100644 index 00000000000..a616fac0057 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser/src/test/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/compiled/TestPostgresSqlParserFunctionsCompiled.java @@ -0,0 +1,26 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed 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. + +package org.finos.legend.engine.pure.runtime.external.relational.postgresSql.parser.compiled; + +import junit.framework.Test; +import org.finos.legend.pure.runtime.java.compiled.testHelper.PureTestBuilderCompiled; + +public class TestPostgresSqlParserFunctionsCompiled +{ + public static Test suite() + { + return PureTestBuilderCompiled.buildSuite("meta::external::store::relational::postgresSql::parser"); + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/pom.xml new file mode 100644 index 00000000000..96c824bc294 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/pom.xml @@ -0,0 +1,106 @@ + + + + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSql + 4.63.2-SNAPSHOT + + 4.0.0 + + legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser + jar + Legend Engine - Pure - Runtime - Java Extension - Interpreted - Functions - Relational Store - Postgres SQL - Parser + + + + + org.finos.legend.pure + legend-pure-m4 + + + org.finos.legend.pure + legend-pure-m3-core + + + org.finos.legend.pure + legend-pure-runtime-java-engine-interpreted + + + + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSql-protocol + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSql-grammar + + + org.finos.legend.engine + legend-engine-pure-functions-relationalStore-postgresSql-parser + runtime + + + org.finos.legend.engine + legend-engine-xt-relationalStore-postgresSqlModel-pure + runtime + + + + + org.eclipse.collections + eclipse-collections-api + + + org.eclipse.collections + eclipse-collections + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + + + junit + junit + + + org.finos.legend.pure + legend-pure-m2-dsl-diagram-grammar + test + + + org.finos.legend.engine + legend-engine-pure-code-compiled-core + test + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-json + test + + + + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/PostgresSqlParserExtensionInterpreted.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/PostgresSqlParserExtensionInterpreted.java new file mode 100644 index 00000000000..a801e6ddd48 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/PostgresSqlParserExtensionInterpreted.java @@ -0,0 +1,36 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed 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. + +package org.finos.legend.engine.pure.runtime.external.relational.postgresSql.parser.interpreted; + +import org.eclipse.collections.impl.factory.Lists; +import org.eclipse.collections.impl.tuple.Tuples; +import org.finos.legend.pure.runtime.java.interpreted.extension.BaseInterpretedExtension; +import org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension; +import org.finos.legend.engine.pure.runtime.external.relational.postgresSql.parser.interpreted.natives.ParseSqlStatementToJson; + +public class PostgresSqlParserExtensionInterpreted extends BaseInterpretedExtension +{ + public PostgresSqlParserExtensionInterpreted() + { + super(Lists.mutable.with( + Tuples.pair("parseSqlStatementToJson_String_1__String_1_", ParseSqlStatementToJson::new) + )); + } + + public static InterpretedExtension extension() + { + return new PostgresSqlParserExtensionInterpreted(); + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/natives/ParseSqlStatementToJson.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/natives/ParseSqlStatementToJson.java new file mode 100644 index 00000000000..b340d0dfd13 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/natives/ParseSqlStatementToJson.java @@ -0,0 +1,66 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed 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. + +package org.finos.legend.engine.pure.runtime.external.relational.postgresSql.parser.interpreted.natives; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.eclipse.collections.api.list.ListIterable; +import org.eclipse.collections.api.map.MutableMap; +import org.finos.legend.engine.language.sql.grammar.from.SQLGrammarParser; +import org.finos.legend.engine.protocol.sql.metamodel.Statement; +import org.finos.legend.pure.m3.compiler.Context; +import org.finos.legend.pure.m3.exception.PureExecutionException; +import org.finos.legend.pure.m3.navigation.Instance; +import org.finos.legend.pure.m3.navigation.M3Properties; +import org.finos.legend.pure.m3.navigation.ProcessorSupport; +import org.finos.legend.pure.m3.navigation.ValueSpecificationBootstrap; +import org.finos.legend.pure.m4.ModelRepository; +import org.finos.legend.pure.m4.coreinstance.CoreInstance; +import org.finos.legend.pure.runtime.java.interpreted.ExecutionSupport; +import org.finos.legend.pure.runtime.java.interpreted.FunctionExecutionInterpreted; +import org.finos.legend.pure.runtime.java.interpreted.VariableContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.InstantiationContext; +import org.finos.legend.pure.runtime.java.interpreted.natives.NativeFunction; +import org.finos.legend.pure.runtime.java.interpreted.profiler.Profiler; + +import java.util.Stack; + +public class ParseSqlStatementToJson extends NativeFunction +{ + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + private final ModelRepository repository; + + public ParseSqlStatementToJson(FunctionExecutionInterpreted functionExecution, ModelRepository modelRepository) + { + this.repository = modelRepository; + } + + @Override + public CoreInstance execute(ListIterable params, Stack> resolvedTypeParameters, Stack> resolvedMultiplicityParameters, VariableContext variableContext, CoreInstance functionExpressionToUseInStack, Profiler profiler, InstantiationContext instantiationContext, ExecutionSupport executionSupport, Context context, ProcessorSupport processorSupport) throws PureExecutionException + { + try + { + String sql = Instance.getValueForMetaPropertyToOneResolved(params.get(0), M3Properties.values, processorSupport).getName(); + Statement statement = SQLGrammarParser.newInstance().parseStatement(sql); + String result = OBJECT_MAPPER.writeValueAsString(statement); + return ValueSpecificationBootstrap.newStringLiteral(this.repository, result, processorSupport); + } + catch (JsonProcessingException e) + { + throw new PureExecutionException(functionExpressionToUseInStack.getSourceInformation(), e); + } + } +} diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension new file mode 100644 index 00000000000..2a8d183f560 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/main/resources/META-INF/services/org.finos.legend.pure.runtime.java.interpreted.extension.InterpretedExtension @@ -0,0 +1 @@ +org.finos.legend.engine.pure.runtime.external.relational.postgresSql.parser.interpreted.PostgresSqlParserExtensionInterpreted \ No newline at end of file diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/test/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/TestPostgresSqlParserFunctionsInterpreted.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/test/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/TestPostgresSqlParserFunctionsInterpreted.java new file mode 100644 index 00000000000..465a42d9e32 --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser/src/test/java/org/finos/legend/engine/pure/runtime/external/relational/postgresSql/parser/interpreted/TestPostgresSqlParserFunctionsInterpreted.java @@ -0,0 +1,26 @@ +// Copyright 2024 Goldman Sachs +// +// Licensed 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. + +package org.finos.legend.engine.pure.runtime.external.relational.postgresSql.parser.interpreted; + +import junit.framework.Test; +import org.finos.legend.pure.runtime.java.interpreted.testHelper.PureTestBuilderInterpreted; + +public class TestPostgresSqlParserFunctionsInterpreted +{ + public static Test suite() + { + return PureTestBuilderInterpreted.buildSuite("meta::external::store::relational::postgresSql::parser"); + } +} diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-grammar/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/pom.xml similarity index 92% rename from legend-engine-xts-sql/legend-engine-xt-sql-grammar/pom.xml rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/pom.xml index a8d13abfa77..a070bfc81ff 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-grammar/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/pom.xml @@ -18,14 +18,14 @@ org.finos.legend.engine - legend-engine-xts-sql + legend-engine-xt-relationalStore-postgresSql 4.63.2-SNAPSHOT 4.0.0 - legend-engine-xt-sql-grammar + legend-engine-xt-relationalStore-postgresSql-grammar jar - Legend Engine - XT - SQL - Grammar + Legend Engine - XT - Relational Store - Postgres SQL - Grammar @@ -71,7 +71,7 @@ org.finos.legend.engine - legend-engine-xt-sql-protocol + legend-engine-xt-relationalStore-postgresSql-protocol diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/antlr4/org/finos/legend/engine/language/sql/grammar/from/antlr4/SqlBaseLexer.g4 b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/antlr4/org/finos/legend/engine/language/sql/grammar/from/antlr4/SqlBaseLexer.g4 similarity index 100% rename from legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/antlr4/org/finos/legend/engine/language/sql/grammar/from/antlr4/SqlBaseLexer.g4 rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/antlr4/org/finos/legend/engine/language/sql/grammar/from/antlr4/SqlBaseLexer.g4 diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/antlr4/org/finos/legend/engine/language/sql/grammar/from/antlr4/SqlBaseParser.g4 b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/antlr4/org/finos/legend/engine/language/sql/grammar/from/antlr4/SqlBaseParser.g4 similarity index 100% rename from legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/antlr4/org/finos/legend/engine/language/sql/grammar/from/antlr4/SqlBaseParser.g4 rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/antlr4/org/finos/legend/engine/language/sql/grammar/from/antlr4/SqlBaseParser.g4 diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/AbstractSqlBaseLexer.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/AbstractSqlBaseLexer.java similarity index 100% rename from legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/AbstractSqlBaseLexer.java rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/AbstractSqlBaseLexer.java diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SQLGrammarParser.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SQLGrammarParser.java similarity index 100% rename from legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SQLGrammarParser.java rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SQLGrammarParser.java diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SQLParserException.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SQLParserException.java similarity index 100% rename from legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SQLParserException.java rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SQLParserException.java diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SqlVisitor.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SqlVisitor.java similarity index 100% rename from legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SqlVisitor.java rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/from/SqlVisitor.java diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/to/SQLGrammarComposer.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/to/SQLGrammarComposer.java similarity index 100% rename from legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/to/SQLGrammarComposer.java rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/main/java/org/finos/legend/engine/language/sql/grammar/to/SQLGrammarComposer.java diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/test/java/org/finos/legend/engine/language/sql/grammar/test/roundtrip/TestSQLRoundTrip.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/test/java/org/finos/legend/engine/language/sql/grammar/test/roundtrip/TestSQLRoundTrip.java similarity index 100% rename from legend-engine-xts-sql/legend-engine-xt-sql-grammar/src/test/java/org/finos/legend/engine/language/sql/grammar/test/roundtrip/TestSQLRoundTrip.java rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-grammar/src/test/java/org/finos/legend/engine/language/sql/grammar/test/roundtrip/TestSQLRoundTrip.java diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-protocol/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-protocol/pom.xml similarity index 96% rename from legend-engine-xts-sql/legend-engine-xt-sql-protocol/pom.xml rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-protocol/pom.xml index a9b4c0a8f15..f873a036acf 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-protocol/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-protocol/pom.xml @@ -18,14 +18,14 @@ org.finos.legend.engine - legend-engine-xts-sql + legend-engine-xt-relationalStore-postgresSql 4.63.2-SNAPSHOT 4.0.0 - legend-engine-xt-sql-protocol + legend-engine-xt-relationalStore-postgresSql-protocol jar - Legend Engine - XT - SQL - Protocol + Legend Engine - XT - Relational Store - Postgres SQL - Protocol diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-protocol/src/main/resources/core_external_query_sql_metamodel.protocol.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-protocol/src/main/resources/core_external_query_sql_metamodel.protocol.json similarity index 100% rename from legend-engine-xts-sql/legend-engine-xt-sql-protocol/src/main/resources/core_external_query_sql_metamodel.protocol.json rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-protocol/src/main/resources/core_external_query_sql_metamodel.protocol.json diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-protocol/src/main/resources/core_external_query_sql_schema_metamodel.protocol.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-protocol/src/main/resources/core_external_query_sql_schema_metamodel.protocol.json similarity index 100% rename from legend-engine-xts-sql/legend-engine-xt-sql-protocol/src/main/resources/core_external_query_sql_schema_metamodel.protocol.json rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSql-protocol/src/main/resources/core_external_query_sql_schema_metamodel.protocol.json diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/pom.xml similarity index 98% rename from legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/pom.xml rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/pom.xml index 4edd522ddcd..4526c0ed6cc 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/pom.xml @@ -18,7 +18,7 @@ org.finos.legend.engine - legend-engine-xt-relationalStore-pure + legend-engine-xt-relationalStore-postgresSql 4.63.2-SNAPSHOT 4.0.0 diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/java/org/finos/legend/engine/code/core/CoreExternalStoreRelationalPostgresSqlModelCodeRepositoryProvider.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/java/org/finos/legend/engine/code/core/CoreExternalStoreRelationalPostgresSqlModelCodeRepositoryProvider.java similarity index 100% rename from legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/java/org/finos/legend/engine/code/core/CoreExternalStoreRelationalPostgresSqlModelCodeRepositoryProvider.java rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/java/org/finos/legend/engine/code/core/CoreExternalStoreRelationalPostgresSqlModelCodeRepositoryProvider.java diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider similarity index 100% rename from legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/META-INF/services/org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model.definition.json similarity index 100% rename from legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model.definition.json rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model.definition.json diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model/metamodel.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model/metamodel.pure similarity index 100% rename from legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model/metamodel.pure rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model/metamodel.pure diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model/schema_metamodel.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model/schema_metamodel.pure similarity index 100% rename from legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model/schema_metamodel.pure rename to legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/legend-engine-xt-relationalStore-postgresSqlModel-pure/src/main/resources/core_external_store_relational_postgres_sql_model/schema_metamodel.pure diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/pom.xml new file mode 100644 index 00000000000..722a4ad559c --- /dev/null +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-postgresSql/pom.xml @@ -0,0 +1,37 @@ + + + + + org.finos.legend.engine + legend-engine-xt-relationalStore-generation + 4.63.2-SNAPSHOT + + 4.0.0 + + legend-engine-xt-relationalStore-postgresSql + pom + Legend Engine - XT - Relational Store - Postgres SQL + + + legend-engine-xt-relationalStore-postgresSqlModel-pure + legend-engine-xt-relationalStore-postgresSql-protocol + legend-engine-xt-relationalStore-postgresSql-grammar + legend-engine-pure-functions-relationalStore-postgresSql-parser + legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser + legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser + + \ No newline at end of file diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-sqlPlanning-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-sqlPlanning-pure/pom.xml index cf510e8de68..65a6742efd2 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-sqlPlanning-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-sqlPlanning-pure/pom.xml @@ -66,6 +66,11 @@ legend-engine-xt-relationalStore-postgresSqlModel-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser + ${project.version} + @@ -104,6 +109,11 @@ legend-engine-xt-relationalStore-postgresSqlModel-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser + ${project.version} + @@ -138,6 +148,11 @@ org.finos.legend.engine legend-engine-xt-relationalStore-postgresSqlModel-pure + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser + runtime + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-sqlPlanning-pure/src/main/resources/core_external_store_relational_sql_planning.definition.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-sqlPlanning-pure/src/main/resources/core_external_store_relational_sql_planning.definition.json index 0ae1d0284bc..88e9192781c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-sqlPlanning-pure/src/main/resources/core_external_store_relational_sql_planning.definition.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-sqlPlanning-pure/src/main/resources/core_external_store_relational_sql_planning.definition.json @@ -4,6 +4,7 @@ "dependencies": [ "platform", "core", - "core_external_store_relational_postgres_sql_model" + "core_external_store_relational_postgres_sql_model", + "core_external_store_relational_postgres_sql_parser" ] } \ No newline at end of file diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/pom.xml index 89b530b80a0..4403109629e 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/pom.xml @@ -29,7 +29,6 @@ legend-engine-xt-relationalStore-core-pure legend-engine-xt-relationalStore-javaPlatformBinding-pure - legend-engine-xt-relationalStore-postgresSqlModel-pure legend-engine-xt-relationalStore-sqlPlanning-pure legend-engine-xt-relationalStore-sqlDialectTranslation-pure legend-engine-xt-relationalStore-SDT-pure diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/pom.xml b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/pom.xml index 5cd9e6195f1..2d7e89db99c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/pom.xml +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/pom.xml @@ -32,5 +32,6 @@ legend-engine-xt-relationalStore-protocol legend-engine-xt-relationalStore-pure legend-engine-xt-relationalStore-testDataGeneration-http-api + legend-engine-xt-relationalStore-postgresSql \ No newline at end of file diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-compiler/pom.xml b/legend-engine-xts-sql/legend-engine-xt-sql-compiler/pom.xml index 7a95c311ddd..312f0efc2b4 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-compiler/pom.xml +++ b/legend-engine-xts-sql/legend-engine-xt-sql-compiler/pom.xml @@ -151,7 +151,7 @@ org.finos.legend.engine - legend-engine-xt-sql-protocol + legend-engine-xt-relationalStore-postgresSql-protocol @@ -173,7 +173,7 @@ org.finos.legend.engine - legend-engine-xt-sql-grammar + legend-engine-xt-relationalStore-postgresSql-grammar test diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-grammar-integration/pom.xml b/legend-engine-xts-sql/legend-engine-xt-sql-grammar-integration/pom.xml index 48549aca5cf..c7839e983ce 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-grammar-integration/pom.xml +++ b/legend-engine-xts-sql/legend-engine-xt-sql-grammar-integration/pom.xml @@ -44,7 +44,7 @@ org.finos.legend.engine - legend-engine-xt-sql-grammar + legend-engine-xt-relationalStore-postgresSql-grammar org.finos.legend.engine @@ -68,7 +68,7 @@ org.finos.legend.engine - legend-engine-xt-sql-protocol + legend-engine-xt-relationalStore-postgresSql-protocol junit diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-http-api/pom.xml b/legend-engine-xts-sql/legend-engine-xt-sql-http-api/pom.xml index 006a8f7f7cf..384915a403f 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-http-api/pom.xml +++ b/legend-engine-xts-sql/legend-engine-xt-sql-http-api/pom.xml @@ -128,11 +128,11 @@ org.finos.legend.engine - legend-engine-xt-sql-protocol + legend-engine-xt-relationalStore-postgresSql-protocol org.finos.legend.engine - legend-engine-xt-sql-grammar + legend-engine-xt-relationalStore-postgresSql-grammar org.finos.legend.engine diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-postgres-server/pom.xml b/legend-engine-xts-sql/legend-engine-xt-sql-postgres-server/pom.xml index 00e2cbb64d6..587d79e96df 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-postgres-server/pom.xml +++ b/legend-engine-xts-sql/legend-engine-xt-sql-postgres-server/pom.xml @@ -202,11 +202,11 @@ org.finos.legend.engine - legend-engine-xt-sql-grammar + legend-engine-xt-relationalStore-postgresSql-grammar org.finos.legend.engine - legend-engine-xt-sql-protocol + legend-engine-xt-relationalStore-postgresSql-protocol com.h2database diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-providers/legend-engine-xt-sql-providers-core/pom.xml b/legend-engine-xts-sql/legend-engine-xt-sql-providers/legend-engine-xt-sql-providers-core/pom.xml index d9f23c31d35..744b8e3bae5 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-providers/legend-engine-xt-sql-providers-core/pom.xml +++ b/legend-engine-xts-sql/legend-engine-xt-sql-providers/legend-engine-xt-sql-providers-core/pom.xml @@ -36,7 +36,7 @@ org.finos.legend.engine - legend-engine-xt-sql-protocol + legend-engine-xt-relationalStore-postgresSql-protocol diff --git a/legend-engine-xts-sql/legend-engine-xt-sql-pure/pom.xml b/legend-engine-xts-sql/legend-engine-xt-sql-pure/pom.xml index adede66d481..de43412e756 100644 --- a/legend-engine-xts-sql/legend-engine-xt-sql-pure/pom.xml +++ b/legend-engine-xts-sql/legend-engine-xt-sql-pure/pom.xml @@ -297,7 +297,7 @@ org.finos.legend.engine - legend-engine-xt-sql-grammar + legend-engine-xt-relationalStore-postgresSql-grammar test @@ -312,7 +312,7 @@ org.finos.legend.engine - legend-engine-xt-sql-protocol + legend-engine-xt-relationalStore-postgresSql-protocol test diff --git a/legend-engine-xts-sql/pom.xml b/legend-engine-xts-sql/pom.xml index 12ab834c8d8..291fe4c9efb 100644 --- a/legend-engine-xts-sql/pom.xml +++ b/legend-engine-xts-sql/pom.xml @@ -30,10 +30,8 @@ legend-engine-xt-sql-compiler - legend-engine-xt-sql-grammar legend-engine-xt-sql-grammar-integration legend-engine-xt-sql-postgres-server - legend-engine-xt-sql-protocol legend-engine-xt-sql-providers legend-engine-xt-sql-pure legend-engine-xt-sql-http-api diff --git a/pom.xml b/pom.xml index 2a59399c6a0..63d7ffddced 100644 --- a/pom.xml +++ b/pom.xml @@ -2553,18 +2553,18 @@ org.finos.legend.engine - legend-engine-xt-sql-grammar + legend-engine-xt-relationalStore-postgresSql-grammar ${project.version} test-jar org.finos.legend.engine - legend-engine-xt-sql-grammar + legend-engine-xt-relationalStore-postgresSql-grammar ${project.version} org.finos.legend.engine - legend-engine-xt-sql-protocol + legend-engine-xt-relationalStore-postgresSql-protocol ${project.version} @@ -2577,6 +2577,21 @@ legend-engine-xt-relationalStore-postgresSqlModel-pure ${project.version} + + org.finos.legend.engine + legend-engine-pure-functions-relationalStore-postgresSql-parser + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-compiled-functions-relationalStore-postgresSql-parser + ${project.version} + + + org.finos.legend.engine + legend-engine-pure-runtime-java-extension-interpreted-functions-relationalStore-postgresSql-parser + ${project.version} + org.finos.legend.engine legend-engine-xt-sql-compiler