From b414482e4e746dea6cb5bea9613d1729a0a7365f Mon Sep 17 00:00:00 2001 From: "Pentelow, John" Date: Thu, 16 Jul 2026 09:50:19 -0400 Subject: [PATCH 1/2] Pure2SQl - support split --- .../EssentialFunctions_manifest.json | 6 ------ .../sqlQueryToString/clickHouseExtension.pure | 1 + .../EssentialFunctions_manifest.json | 6 ------ .../EssentialFunctions_manifest.json | 6 ------ .../sqlQueryToString/duckdbExtension.pure | 1 + .../relational-h2/EssentialFunctions_manifest.json | 6 ------ .../EssentialFunctions_manifest.json | 6 ------ .../sqlQueryToString/postgresExtension.pure | 1 + .../EssentialFunctions_manifest.json | 6 ------ .../sqlQueryToString/snowflakeExtension.pure | 1 + .../EssentialFunctions_manifest.json | 6 ------ .../stores/relational/LegendH2Extensions.java | 14 ++++++++++++++ .../relational/pureToSQLQuery/pureToSQLQuery.pure | 1 + .../relational/sqlQueryToString/dbExtension.pure | 1 + .../dbSpecific/h2/h2Extension1_4_200.pure | 1 + .../dbSpecific/h2/h2Extension2_1_214.pure | 1 + .../sqlQueryToString/extensionDefaults.pure | 1 + 17 files changed, 23 insertions(+), 42 deletions(-) diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-clickhouse/legend-engine-xt-relationalStore-clickhouse-PCT/src/main/resources/pct-manifests/relational-clickhouse/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-clickhouse/legend-engine-xt-relationalStore-clickhouse-PCT/src/main/resources/pct-manifests/relational-clickhouse/EssentialFunctions_manifest.json index e54d4059571..a21b04d45af 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-clickhouse/legend-engine-xt-relationalStore-clickhouse-PCT/src/main/resources/pct-manifests/relational-clickhouse/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-clickhouse/legend-engine-xt-relationalStore-clickhouse-PCT/src/main/resources/pct-manifests/relational-clickhouse/EssentialFunctions_manifest.json @@ -600,12 +600,6 @@ }, { "test" : "meta::pure::functions::string::tests::parseInteger::testParseInteger_Function_1__Boolean_1_", "expectedError" : "\"\nexpected: 9999999999999992\nactual: 1874919416\"" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"" }, { "test" : "meta::pure::functions::string::tests::startswith::testFalseStartsWith_Function_1__Boolean_1_", "expectedError" : "class java.lang.Long cannot be cast to class java.lang.Boolean (java.lang.Long and java.lang.Boolean are in module java.base of loader 'bootstrap')" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-clickhouse/legend-engine-xt-relationalStore-clickhouse-pure/src/main/resources/core_relational_clickhouse/relational/sqlQueryToString/clickHouseExtension.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-clickhouse/legend-engine-xt-relationalStore-clickhouse-pure/src/main/resources/core_relational_clickhouse/relational/sqlQueryToString/clickHouseExtension.pure index 0212769b3e2..15a2f9d4044 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-clickhouse/legend-engine-xt-relationalStore-clickhouse-pure/src/main/resources/core_relational_clickhouse/relational/sqlQueryToString/clickHouseExtension.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-clickhouse/legend-engine-xt-relationalStore-clickhouse-pure/src/main/resources/core_relational_clickhouse/relational/sqlQueryToString/clickHouseExtension.pure @@ -125,6 +125,7 @@ function <> meta::relational::functions::sqlQueryToString::click dynaFnToSql('second', $allStates, ^ToSql(format='toSecond(%s)')), dynaFnToSql('sha1', $allStates, ^ToSql(format='lower(hex(SHA1(%s)))')), dynaFnToSql('sha256', $allStates, ^ToSql(format='lower(hex(SHA256(%s)))')), + dynaFnToSql('split', $allStates, ^ToSql(format='splitByString(%s, %s)', transform={p:String[2] | [$p->at(1), $p->at(0)]})), dynaFnToSql('splitPart', $allStates, ^ToSql(format='splitByString(%s, %s)[%s]', transform={p:String[*] | $p->at(1)->concatenate($p->at(0))->concatenate($p->at(2))})), dynaFnToSql('substring', $allStates, ^ToSql(format='substring(%s)', transform={p:String[*]|$p->transformSubstringForClickHouse()})), dynaFnToSql('stdDevPopulation', $allStates, ^ToSql(format='%s', transform={p:String[*] | transformWithArrayReduceForClickHouse('stddevPop', $p)})), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-PCT/src/main/resources/pct-manifests/relational-databricks/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-PCT/src/main/resources/pct-manifests/relational-databricks/EssentialFunctions_manifest.json index 494298416a8..b863f0b90c0 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-PCT/src/main/resources/pct-manifests/relational-databricks/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-PCT/src/main/resources/pct-manifests/relational-databricks/EssentialFunctions_manifest.json @@ -600,12 +600,6 @@ }, { "test" : "meta::pure::functions::string::tests::parseDecimal::testParseZero_Function_1__Boolean_1_", "expectedError" : "\nexpected: 0.0D\nactual: 0D" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki." - }, { - "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki." }, { "test" : "meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "expectedError" : "\nexpected: 'he quick brown fox jumps over the lazy do'\nactual: 'the quick brown fox jumps over the lazy do'" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/main/resources/pct-manifests/relational-duckdb/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/main/resources/pct-manifests/relational-duckdb/EssentialFunctions_manifest.json index 0f4ef22fbdd..1c85953d1a0 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/main/resources/pct-manifests/relational-duckdb/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-PCT/src/main/resources/pct-manifests/relational-duckdb/EssentialFunctions_manifest.json @@ -399,12 +399,6 @@ }, { "test" : "meta::pure::functions::string::tests::parseDecimal::testParseZero_Function_1__Boolean_1_", "expectedError" : "\"\nexpected: 0.000D\nactual: 0.0D\"" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"" }, { "test" : "meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "expectedError" : "Assert failure at (resource:/platform/pure/essential/tests/assert.pure line:21 column:5), \"\nexpected: 'the quick brown fox jumps over the lazy dog'\nactual: 'the quick brown fox jumps over the lazy do'\"" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb/relational/sqlQueryToString/duckdbExtension.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb/relational/sqlQueryToString/duckdbExtension.pure index a099241c1cb..c6a7f5bba4e 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb/relational/sqlQueryToString/duckdbExtension.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-duckdb/legend-engine-xt-relationalStore-duckdb-pure/src/main/resources/core_relational_duckdb/relational/sqlQueryToString/duckdbExtension.pure @@ -273,6 +273,7 @@ function <> meta::relational::functions::sqlQueryToString::duckD dynaFnToSql('second', $allStates, ^ToSql(format='second(%s)')), dynaFnToSql('sha1', $allStates, ^ToSql(format='sha1(%s)')), dynaFnToSql('sha256', $allStates, ^ToSql(format='sha256(%s)')), + dynaFnToSql('split', $allStates, ^ToSql(format='string_split(%s, %s)')), dynaFnToSql('splitPart', $allStates, ^ToSql(format='split_part(%s, %s, %s)')), dynaFnToSql('substring', $allStates, ^ToSql(format='substring%s', transform={p:String[*]|$p->joinStrings('(', ', ', ')')})), // TODO - pure uses 0-based indexing, duck db returns location with 1-based index , keeping this as H2 also returns 1-based currently, many user tests need to be fixed dynaFnToSql('stdDevPopulation', $allStates, ^ToSql(format='stddev_pop(%s)')), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/main/resources/pct-manifests/relational-h2/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/main/resources/pct-manifests/relational-h2/EssentialFunctions_manifest.json index a5ade6b3a23..d8db89008b5 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/main/resources/pct-manifests/relational-h2/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-h2/legend-engine-xt-relationalStore-h2-PCT/src/main/resources/pct-manifests/relational-h2/EssentialFunctions_manifest.json @@ -594,12 +594,6 @@ }, { "test" : "meta::pure::functions::string::tests::parseInteger::testParseInteger_Function_1__Boolean_1_", "expectedError" : "org.h2.jdbc.JdbcSQLDataException: Data conversion error converting \"9999999999999992\"; SQL statement:\nselect cast('9999999999999992' as integer) [22018-214]" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"" }, { "test" : "meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "expectedError" : "\"\nexpected: 'he quick brown fox jumps over the lazy do'\nactual: 'the quick brown fox jumps over the lazy do'\"" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/main/resources/pct-manifests/relational-postgres/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/main/resources/pct-manifests/relational-postgres/EssentialFunctions_manifest.json index 5c401c6091a..bee812deca0 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/main/resources/pct-manifests/relational-postgres/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-PCT/src/main/resources/pct-manifests/relational-postgres/EssentialFunctions_manifest.json @@ -582,12 +582,6 @@ }, { "test" : "meta::pure::functions::string::tests::parseInteger::testParseInteger_Function_1__Boolean_1_", "expectedError" : "org.postgresql.util.PSQLException: ERROR: value \"9999999999999992\" is out of range for type integer" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'." - }, { - "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'." }, { "test" : "meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "expectedError" : "\"\nexpected: 'the quick brown fox jumps over the lazy dog'\nactual: 'the quick brown fox jumps over the lazy do'\"" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/src/main/resources/core_relational_postgres/relational/sqlQueryToString/postgresExtension.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/src/main/resources/core_relational_postgres/relational/sqlQueryToString/postgresExtension.pure index 020db3cf79b..311b479aaff 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/src/main/resources/core_relational_postgres/relational/sqlQueryToString/postgresExtension.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-postgres/legend-engine-xt-relationalStore-postgres-pure/src/main/resources/core_relational_postgres/relational/sqlQueryToString/postgresExtension.pure @@ -236,6 +236,7 @@ function <> meta::relational::functions::sqlQueryToString::postg dynaFnToSql('second', $allStates, ^ToSql(format='date_part(\'second\', %s)')), dynaFnToSql('sha1', $allStates, ^ToSql(format='encode(digest(%s, \'sha1\'), \'hex\')')), dynaFnToSql('sha256', $allStates, ^ToSql(format='encode(digest(%s, \'sha256\'), \'hex\')')), + dynaFnToSql('split', $allStates, ^ToSql(format='string_to_array(%s, %s)')), dynaFnToSql('substring', $allStates, ^ToSql(format='substring%s', transform={p:String[*]|$p->joinStrings('(', ', ', ')')})), dynaFnToSql('stdDevPopulation', $allStates, ^ToSql(format='stddev_pop(%s)')), dynaFnToSql('stdDevSample', $allStates, ^ToSql(format='stddev_samp(%s)')), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/main/resources/pct-manifests/relational-snowflake/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/main/resources/pct-manifests/relational-snowflake/EssentialFunctions_manifest.json index 593e151bf44..6b6ae7ddf78 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/main/resources/pct-manifests/relational-snowflake/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-PCT/src/main/resources/pct-manifests/relational-snowflake/EssentialFunctions_manifest.json @@ -375,12 +375,6 @@ }, { "test" : "meta::pure::functions::string::tests::parseDecimal::testParseZero_Function_1__Boolean_1_", "expectedError" : "\"\nexpected: 0.0D\nactual: 0D\"" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'." - }, { - "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'." }, { "test" : "meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "expectedError" : "\"\nexpected: 'he quick brown fox jumps over the lazy do'\nactual: 'the quick brown fox jumps over the lazy do'\"" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/src/main/resources/core_relational_snowflake/relational/sqlQueryToString/snowflakeExtension.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/src/main/resources/core_relational_snowflake/relational/sqlQueryToString/snowflakeExtension.pure index ebdf8c2caed..bc74a750af9 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/src/main/resources/core_relational_snowflake/relational/sqlQueryToString/snowflakeExtension.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-pure/src/main/resources/core_relational_snowflake/relational/sqlQueryToString/snowflakeExtension.pure @@ -372,6 +372,7 @@ function <> meta::relational::functions::sqlQueryToString::snowf dynaFnToSql('substring', $allStates, ^ToSql(format='substring%s', transform={p:String[*]|$p->joinStrings('(', ', ', ')')})), dynaFnToSql('stdDevPopulation', $allStates, ^ToSql(format='stddev_pop(%s)')), dynaFnToSql('stdDevSample', $allStates, ^ToSql(format='stddev_samp(%s)')), + dynaFnToSql('split', $allStates, ^ToSql(format='split(%s, %s)')), dynaFnToSql('splitPart', $allStates, ^ToSql(format='split_part(%s, %s, %s)')), dynaFnToSql('timeBucket', $allStates, ^ToSql(format='TIME_SLICE(%s)', transform={p:String[3]|$p->at(0) + ', ' + constructInterval($p->at(2), $p->at(1))})), dynaFnToSql('today', $allStates, ^ToSql(format='current_date')), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-PCT/src/main/resources/pct-manifests/relational-trino/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-PCT/src/main/resources/pct-manifests/relational-trino/EssentialFunctions_manifest.json index 96c3e00562d..216c4df2b5b 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-PCT/src/main/resources/pct-manifests/relational-trino/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-PCT/src/main/resources/pct-manifests/relational-trino/EssentialFunctions_manifest.json @@ -612,12 +612,6 @@ }, { "test" : "meta::pure::functions::string::tests::parseInteger::testParseInteger_Function_1__Boolean_1_", "expectedError" : "Cannot cast '9999999999999992' to INT" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"" - }, { - "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'. \nIf you would like to add a SQL translation for the function then follow the step-by-step guide on the PURE wiki.\"" }, { "test" : "meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "expectedError" : "\"\nexpected: 'the quick brown fox jumps over the lazy dog'\nactual: ''\"" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan-connection/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/LegendH2Extensions.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan-connection/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/LegendH2Extensions.java index b3c52009b81..0db60615131 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan-connection/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/LegendH2Extensions.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan-connection/src/main/java/org/finos/legend/engine/plan/execution/stores/relational/LegendH2Extensions.java @@ -34,6 +34,7 @@ import org.h2.value.ValueReal; import org.h2.value.ValueTimestamp; import org.h2.value.ValueVarchar; +import java.util.regex.Pattern; import java.math.BigDecimal; import java.nio.charset.StandardCharsets; @@ -215,6 +216,19 @@ public static String legend_h2_extension_split_part(String string, String token, return parts.length > readjustedPart ? parts[readjustedPart] : null; } + public static String[] legend_h2_extension_split(String string, String delimiter) + { + if (string == null) + { + return null; + } + if (delimiter == null || delimiter.isEmpty()) + { + return new String[]{string}; + } + return string.split(Pattern.quote(delimiter), -1); + } + private static HashSet extractProperty(HashSet resultSet, Object pathToExtract) { HashSet res = new HashSet<>(); diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/pureToSQLQuery/pureToSQLQuery.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/pureToSQLQuery/pureToSQLQuery.pure index e435a9ff1db..bdfc91ac541 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/pureToSQLQuery/pureToSQLQuery.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/pureToSQLQuery/pureToSQLQuery.pure @@ -10050,6 +10050,7 @@ function meta::relational::functions::pureToSqlQuery::getSupportedFunctions():Ma ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::string::replace_String_1__String_1__String_1__String_1_,second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::string::repeatString_String_$0_1$__Integer_1__String_$0_1$_,second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::string::reverseString_String_1__String_1_,second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), + ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::string::split_String_1__String_1__String_MANY_,second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::string::splitPart_String_$0_1$__String_1__Integer_1__String_$0_1$_,second=meta::relational::functions::pureToSqlQuery::processSplitPart_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), ^PureFunctionToRelationalFunctionPair(first=meta::pure::functions::math::abs_Integer_1__Integer_1_,second=meta::relational::functions::pureToSqlQuery::processDynaFunction_FunctionExpression_1__PropertyMapping_MANY__SelectWithCursor_1__Map_1__State_1__JoinType_1__String_1__List_1__DebugContext_1__Extension_MANY__RelationalOperationElement_1_), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbExtension.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbExtension.pure index 0006945c2d7..1ba15ea99f7 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbExtension.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbExtension.pure @@ -1270,6 +1270,7 @@ Enum meta::relational::functions::sqlQueryToString::DynaFunctionRegistry sin, sinh, size, + split, splitPart, sqlFalse, sqlNull, diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbSpecific/h2/h2Extension1_4_200.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbSpecific/h2/h2Extension1_4_200.pure index 8193f7c0331..188c75f07db 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbSpecific/h2/h2Extension1_4_200.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbSpecific/h2/h2Extension1_4_200.pure @@ -146,6 +146,7 @@ function <> meta::relational::functions::sqlQueryToString::h2::v dynaFnToSql('second', $allStates, ^ToSql(format='second(%s)')), dynaFnToSql('sha1', $allStates, ^ToSql(format='legend_h2_extension_hash_sha1(%s)')), dynaFnToSql('sha256', $allStates, ^ToSql(format='rawtohex(hash(\'SHA256\', %s))')), + dynaFnToSql('split', $allStates, ^ToSql(format='legend_h2_extension_split(%s, %s)')), dynaFnToSql('splitPart', $allStates, ^ToSql(format='legend_h2_extension_split_part(%s, %s, %s)')), dynaFnToSql('substring', $allStates, ^ToSql(format='substring%s', transform={p:String[*]|$p->joinStrings('(', ', ', ')')})), dynaFnToSql('stdDevPopulation', $allStates, ^ToSql(format='stddev_pop(%s)')), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbSpecific/h2/h2Extension2_1_214.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbSpecific/h2/h2Extension2_1_214.pure index 55ba984dfba..49e1155ac09 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbSpecific/h2/h2Extension2_1_214.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/dbSpecific/h2/h2Extension2_1_214.pure @@ -255,6 +255,7 @@ function <> meta::relational::functions::sqlQueryToString::h2::v dynaFnToSql('second', $allStates, ^ToSql(format='second(%s)')), dynaFnToSql('sha1', $allStates, ^ToSql(format='rawtohex(hash(\'SHA-1\', %s))')), dynaFnToSql('sha256', $allStates, ^ToSql(format='rawtohex(hash(\'SHA-256\', %s))')), + dynaFnToSql('split', $allStates, ^ToSql(format='legend_h2_extension_split(%s, %s)')), dynaFnToSql('splitPart', $allStates, ^ToSql(format='legend_h2_extension_split_part(%s, %s, %s)')), dynaFnToSql('substring', $allStates, ^ToSql(format='substring%s', transform={p:String[*]|$p->joinStrings('(', ', ', ')')})), dynaFnToSql('stdDevPopulation', $allStates, ^ToSql(format='stddev_pop(%s)')), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure index 933ca8e9bd8..456b8abeb4c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure @@ -272,6 +272,7 @@ function meta::relational::functions::sqlQueryToString::default::getDynaFunction dynaFnToSql('sign', $allStates, ^ToSql(format='sign(%s)')), dynaFnToSql('sin', $allStates, ^ToSql(format='sin(%s)')), dynaFnToSql('sinh', $allStates, ^ToSql(format='sinh(%s)')), + dynaFnToSql('split', $allStates, ^ToSql(format='split(%s, %s)')), dynaFnToSql('splitPart', $allStates, ^ToSql(format='split_part(%s, %s, %s)')), dynaFnToSql('size', $allStates, ^ToSql(format='count(%s)', transform={p:String[*]|if($p->isEmpty(),|'*',|$p)})), dynaFnToSql('sqlFalse', $allStates, ^ToSql(format='%s', transform={p:String[*]|processLiteralValue(false, [], $literalProcessor)})), From 80c00f584f7621337eb8c1e677be93f26211eb81 Mon Sep 17 00:00:00 2001 From: "Pentelow, John" Date: Fri, 17 Jul 2026 16:40:02 -0400 Subject: [PATCH 2/2] Pure2SQl - support split --- .../relational/sqlQueryToString/bigQueryExtension.pure | 1 + .../relational/sqlQueryToString/databricksExtension.pure | 1 + .../relational-memsql/EssentialFunctions_manifest.json | 4 ++-- .../relational-oracle/EssentialFunctions_manifest.json | 4 ++-- .../relational-spanner/EssentialFunctions_manifest.json | 4 ++-- .../relational-sqlserver/EssentialFunctions_manifest.json | 4 ++-- .../relational-trino/EssentialFunctions_manifest.json | 6 ++++++ .../relational/sqlDialectTranslation/toPostgresModel.pure | 1 + .../relational/sqlQueryToString/extensionDefaults.pure | 1 - 9 files changed, 17 insertions(+), 9 deletions(-) diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/src/main/resources/core_relational_bigquery/relational/sqlQueryToString/bigQueryExtension.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/src/main/resources/core_relational_bigquery/relational/sqlQueryToString/bigQueryExtension.pure index ce6a27107fd..16865d5dcde 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/src/main/resources/core_relational_bigquery/relational/sqlQueryToString/bigQueryExtension.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-bigquery/legend-engine-xt-relationalStore-bigquery-pure/src/main/resources/core_relational_bigquery/relational/sqlQueryToString/bigQueryExtension.pure @@ -90,6 +90,7 @@ function <> meta::relational::functions::sqlQueryToString::bigQu dynaFnToSql('quarterNumber', $allStates, ^ToSql(format='extract( quarter from %s)')), dynaFnToSql('round', $allStates, ^ToSql(format='round(%s, 0)')), dynaFnToSql('second', $allStates, ^ToSql(format='extract( second from %s)')), + dynaFnToSql('split', $allStates, ^ToSql(format='split(%s, %s)')), dynaFnToSql('stdDevPopulation', $allStates, ^ToSql(format='stddev_pop(%s)')), dynaFnToSql('stdDevSample', $allStates, ^ToSql(format='stddev_samp(%s)')), dynaFnToSql('substring', $allStates, ^ToSql(format='substring%s', transform={p:String[*]|$p->joinStrings('(', ', ', ')')})), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/src/main/resources/core_relational_databricks/relational/sqlQueryToString/databricksExtension.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/src/main/resources/core_relational_databricks/relational/sqlQueryToString/databricksExtension.pure index e8d01927096..13b1e1b4967 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/src/main/resources/core_relational_databricks/relational/sqlQueryToString/databricksExtension.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-databricks/legend-engine-xt-relationalStore-databricks-pure/src/main/resources/core_relational_databricks/relational/sqlQueryToString/databricksExtension.pure @@ -134,6 +134,7 @@ function <> meta::relational::functions::sqlQueryToString::datab dynaFnToSql('round', $allStates, ^ToSql(format='round(%s, %s)', transform=transformRound_String_MANY__String_MANY_)), dynaFnToSql('second', $allStates, ^ToSql(format='second(%s)')), dynaFnToSql('sha256', $allStates, ^ToSql(format='sha2(%s, 256)')), + dynaFnToSql('split', $allStates, ^ToSql(format='split(%s, %s)')), dynaFnToSql('sqlFalse', $allStates, ^ToSql(format='false')), dynaFnToSql('sqlTrue', $allStates, ^ToSql(format='true')), dynaFnToSql('substring', $allStates, ^ToSql(format='substring%s', transform={p:String[*]|$p->joinStrings('(', ', ', ')')})), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-PCT/src/main/resources/pct-manifests/relational-memsql/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-PCT/src/main/resources/pct-manifests/relational-memsql/EssentialFunctions_manifest.json index fae64d32740..787cca46f73 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-PCT/src/main/resources/pct-manifests/relational-memsql/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-memsql/legend-engine-xt-relationalStore-memsql-PCT/src/main/resources/pct-manifests/relational-memsql/EssentialFunctions_manifest.json @@ -644,10 +644,10 @@ "expectedError" : "\"\nexpected: 0.0D\nactual: 0D\"" }, { "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'." + "expectedError" : "\"[unsupported-api] The function 'split' (state: [Select, false]) is not supported yet\"" }, { "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'." + "expectedError" : "\"[unsupported-api] The function 'split' (state: [Select, false]) is not supported yet\"" }, { "test" : "meta::pure::functions::string::tests::startswith::testFalseStartsWith_Function_1__Boolean_1_", "expectedError" : "class java.lang.Long cannot be cast to class java.lang.Boolean (java.lang.Long and java.lang.Boolean are in module java.base of loader 'bootstrap')" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-oracle/legend-engine-xt-relationalStore-oracle-PCT/src/main/resources/pct-manifests/relational-oracle/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-oracle/legend-engine-xt-relationalStore-oracle-PCT/src/main/resources/pct-manifests/relational-oracle/EssentialFunctions_manifest.json index 1d2250cb763..c73a8bca6cb 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-oracle/legend-engine-xt-relationalStore-oracle-PCT/src/main/resources/pct-manifests/relational-oracle/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-oracle/legend-engine-xt-relationalStore-oracle-PCT/src/main/resources/pct-manifests/relational-oracle/EssentialFunctions_manifest.json @@ -620,10 +620,10 @@ "expectedError" : "\"\nexpected: ['']\nactual: []\"" }, { "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'" + "expectedError" : "\"[unsupported-api] The function 'split' (state: [Select, false]) is not supported yet\"" }, { "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'" + "expectedError" : "\"[unsupported-api] The function 'split' (state: [Select, false]) is not supported yet\"" }, { "test" : "meta::pure::functions::string::tests::startswith::testFalseStartsWith_Function_1__Boolean_1_", "expectedError" : "class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-PCT/src/main/resources/pct-manifests/relational-spanner/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-PCT/src/main/resources/pct-manifests/relational-spanner/EssentialFunctions_manifest.json index a819ce0d513..173cb45f2c0 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-PCT/src/main/resources/pct-manifests/relational-spanner/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-spanner/legend-engine-xt-relationalStore-spanner-PCT/src/main/resources/pct-manifests/relational-spanner/EssentialFunctions_manifest.json @@ -692,10 +692,10 @@ "expectedError" : "\"[unsupported-api] The function 'parseInteger' (state: [Select, false]) is not supported yet\"" }, { "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'." + "expectedError" : "\"[unsupported-api] The function 'split' (state: [Select, false]) is not supported yet\"" }, { "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'." + "expectedError" : "\"[unsupported-api] The function 'split' (state: [Select, false]) is not supported yet\"" }, { "test" : "meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "expectedError" : "\"\nexpected: 'he quick brown fox jumps over the lazy do'\nactual: 'the quick brown fox jumps over the lazy do'\"" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-PCT/src/main/resources/pct-manifests/relational-sqlserver/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-PCT/src/main/resources/pct-manifests/relational-sqlserver/EssentialFunctions_manifest.json index 12b5fc44b33..b7b0b4a8ad4 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-PCT/src/main/resources/pct-manifests/relational-sqlserver/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-sqlserver/legend-engine-xt-relationalStore-sqlserver-PCT/src/main/resources/pct-manifests/relational-sqlserver/EssentialFunctions_manifest.json @@ -650,10 +650,10 @@ "expectedError" : "\"Failed to execute plan - RuntimeException - com.microsoft.sqlserver.jdbc.SQLServerException: The conversion of the varchar value '9999999999999992' overflowed an int column.\"" }, { "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'." + "expectedError" : "\"[unsupported-api] The function 'split' (state: [Select, false]) is not supported yet\"" }, { "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", - "expectedError" : "\"No SQL translation exists for the PURE function 'split_String_1__String_1__String_MANY_'." + "expectedError" : "\"[unsupported-api] The function 'split' (state: [Select, false]) is not supported yet\"" }, { "test" : "meta::pure::functions::string::tests::startswith::testFalseStartsWith_Function_1__Boolean_1_", "expectedError" : "com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'like'." diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-PCT/src/main/resources/pct-manifests/relational-trino/EssentialFunctions_manifest.json b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-PCT/src/main/resources/pct-manifests/relational-trino/EssentialFunctions_manifest.json index 216c4df2b5b..a3f6ea6da02 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-PCT/src/main/resources/pct-manifests/relational-trino/EssentialFunctions_manifest.json +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-trino/legend-engine-xt-relationalStore-trino-PCT/src/main/resources/pct-manifests/relational-trino/EssentialFunctions_manifest.json @@ -612,6 +612,12 @@ }, { "test" : "meta::pure::functions::string::tests::parseInteger::testParseInteger_Function_1__Boolean_1_", "expectedError" : "Cannot cast '9999999999999992' to INT" + }, { + "test" : "meta::pure::functions::string::tests::split::testSplitWithNoSplit_Function_1__Boolean_1_", + "expectedError" : "\"[unsupported-api] The function 'split' (state: [Select, false]) is not supported yet\"" + }, { + "test" : "meta::pure::functions::string::tests::split::testSplit_Function_1__Boolean_1_", + "expectedError" : "\"[unsupported-api] The function 'split' (state: [Select, false]) is not supported yet\"" }, { "test" : "meta::pure::functions::string::tests::substring::testStartEnd_Function_1__Boolean_1_", "expectedError" : "\"\nexpected: 'the quick brown fox jumps over the lazy dog'\nactual: ''\"" diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlDialectTranslation/toPostgresModel.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlDialectTranslation/toPostgresModel.pure index ee02d369073..a530a9544e6 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlDialectTranslation/toPostgresModel.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlDialectTranslation/toPostgresModel.pure @@ -379,6 +379,7 @@ function <> meta::relational::functions::toPostgresModel::getDyn pair('toTimestamp', {p:meta::external::query::sql::metamodel::Expression[*]| functionCall('to_timestamp', if($p->size() == 1, | $p->concatenate(literal('YYYY-MM-DD HH:MI:SS')), | $p))}), pair('sha1', functionCall('sha1')), pair('sha256', functionCall('sha256')), + pair('split', functionCall('string_to_array')), pair('splitPart', functionCall('split_part')), pair('substring', functionCall('substring')), pair('monthName', {p:meta::external::query::sql::metamodel::Expression[*]| functionCall('to_char', $p->concatenate(literal('Month')))}), diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure index 456b8abeb4c..933ca8e9bd8 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/legend-engine-xt-relationalStore-core-pure/src/main/resources/core_relational/relational/sqlQueryToString/extensionDefaults.pure @@ -272,7 +272,6 @@ function meta::relational::functions::sqlQueryToString::default::getDynaFunction dynaFnToSql('sign', $allStates, ^ToSql(format='sign(%s)')), dynaFnToSql('sin', $allStates, ^ToSql(format='sin(%s)')), dynaFnToSql('sinh', $allStates, ^ToSql(format='sinh(%s)')), - dynaFnToSql('split', $allStates, ^ToSql(format='split(%s, %s)')), dynaFnToSql('splitPart', $allStates, ^ToSql(format='split_part(%s, %s, %s)')), dynaFnToSql('size', $allStates, ^ToSql(format='count(%s)', transform={p:String[*]|if($p->isEmpty(),|'*',|$p)})), dynaFnToSql('sqlFalse', $allStates, ^ToSql(format='%s', transform={p:String[*]|processLiteralValue(false, [], $literalProcessor)})),