From db9e8ea4e7b40499d61841c18384d2cfde1955d2 Mon Sep 17 00:00:00 2001 From: theodosis1989 Date: Thu, 28 Mar 2024 06:00:49 +0100 Subject: [PATCH] Fix to infer sourceDataType in cross store joins (#2557) --- .../TestSnowflakeExplodeSemiStructured.java | 8 +-- ...nowflakeExtractFromSemiStructuredJoin.java | 4 +- ...wflakeExtractFromSemiStructuredSimple.java | 12 ++-- ...TestSnowflakeSemiStructuredFlattening.java | 44 ++++++------- ...flakeSemiStructuredInheritanceMapping.java | 16 ++--- ...owflakeSemiStructuredJoinChainMapping.java | 8 +-- .../TestSnowflakeSemiStructuredMatching.java | 26 ++++---- ...lakeSemiStructuredMultiBindingMapping.java | 12 ++-- ...owflakeSemiStructuredParseJsonMapping.java | 4 +- ...tSnowflakeSemiStructuredTypeFunctions.java | 24 +++---- ...tSnowflakeSimpleSemiStructuredMapping.java | 64 +++++++++---------- .../TestExtractFromSemiStructuredJoin.java | 2 +- .../TestExtractFromSemiStructuredSimple.java | 6 +- .../TestSemiStructuredInheritanceMapping.java | 8 +-- .../TestSemiStructuredJoinChainMapping.java | 4 +- .../TestSemiStructuredMatching.java | 14 ++-- ...TestSemiStructuredMultiBindingMapping.java | 6 +- .../TestSimpleSemiStructuredMapping.java | 32 +++++----- .../tests/executionPlanTest.pure | 24 +++---- .../m2m2rShowcase.pure | 14 ++-- .../relationalMappingExecution.pure | 49 ++++++++++---- .../tests/testCanRouteWrappedFunctions.pure | 4 +- .../relational/tds/tests/testTDSExtend.pure | 2 +- .../relational/tds/tests/testTDSJoin.pure | 24 +++++++ 24 files changed, 231 insertions(+), 180 deletions(-) diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExplodeSemiStructured.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExplodeSemiStructured.java index 6541420bb12..443dfec8b14 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExplodeSemiStructured.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExplodeSemiStructured.java @@ -67,12 +67,12 @@ public void testComplexProjectFlattenedAndExplodedPropertiesInProject() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Id, String, VARCHAR(100), \"\"), (Entity Tag, String, \"\", \"\"), (Entity Tag Id, String, \"\", \"\"), (Orders/Id, String, VARCHAR(100), \"\")]\n" + + " type = TDS[(Id, String, VARCHAR(100), \"\"), (Entity Tag, String, VARCHAR(65536), \"\"), (Entity Tag Id, String, VARCHAR(65536), \"\"), (Orders/Id, String, VARCHAR(100), \"\")]\n" + " resultColumns = [(\"Id\", VARCHAR(100)), (\"Entity Tag\", \"\"), (\"Entity Tag Id\", \"\"), (\"Orders/Id\", VARCHAR(100))]\n" + " sql = select \"root\".ID as \"Id\", \"ss_flatten_0\".VALUE['tag']::varchar as \"Entity Tag\", \"ss_flatten_0\".VALUE['tagId']::varchar as \"Entity Tag Id\", \"blocks_1\".ID as \"Orders/Id\" from Semistructured.Blocks as \"root\" inner join lateral flatten(input => \"root\".BLOCKDATA['relatedEntities'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\" left outer join (select \"orders_0\".ID, \"orders_0\".IDENTIFIER, \"orders_0\".QUANTITY, \"orders_0\".SIDE, \"orders_0\".PRICE, \"blocks_2\".leftJoinKey_0 as leftJoinKey_0 from (select \"ss_flatten_1\".VALUE as flattened_prop, \"root\".ID as leftJoinKey_0 from Semistructured.Blocks as \"root\" inner join lateral flatten(input => \"root\".BLOCKDATA['relatedEntities'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_1\") as \"blocks_2\" inner join Semistructured.Orders as \"orders_0\" on (to_varchar(get_path(\"blocks_2\".flattened_prop, 'tag')) = 'order' and to_varchar(get_path(\"blocks_2\".flattened_prop, 'tagId')) = \"orders_0\".ID)) as \"blocks_1\" on (\"root\".ID = \"blocks_1\".leftJoinKey_0)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Id, String, VARCHAR(100), \"\"), (Entity Tag, String, \"\", \"\"), (Entity Tag Id, String, \"\", \"\"), (Orders/Id, String, VARCHAR(100), \"\")]\n"; + String TDSType = " type = TDS[(Id, String, VARCHAR(100), \"\"), (Entity Tag, String, VARCHAR(65536), \"\"), (Entity Tag Id, String, VARCHAR(65536), \"\"), (Orders/Id, String, VARCHAR(100), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -193,12 +193,12 @@ public void testAggregationAggregateExplodedPropertyInsideProject() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Id, String, VARCHAR(100), \"\"), (Account, String, VARCHAR(100), \"\"), (Buy Order, Integer, \"\", \"\")]\n" + + " type = TDS[(Id, String, VARCHAR(100), \"\"), (Account, String, VARCHAR(100), \"\"), (Buy Order, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"Id\", VARCHAR(100)), (\"Account\", VARCHAR(100)), (\"Buy Order\", INT)]\n" + " sql = select \"root\".ID as \"Id\", \"root\".ACCOUNT as \"Account\", \"blocks_1\".aggCol as \"Buy Order\" from Semistructured.Blocks as \"root\" left outer join (select \"blocks_2\".ID as ID, sum(\"blocks_3\".QUANTITY) as aggCol from Semistructured.Blocks as \"blocks_2\" left outer join (select \"orders_0\".ID, \"orders_0\".IDENTIFIER, \"orders_0\".QUANTITY, \"orders_0\".SIDE, \"orders_0\".PRICE, \"blocks_4\".leftJoinKey_0 as leftJoinKey_0 from (select \"ss_flatten_0\".VALUE as flattened_prop, \"root\".ID as leftJoinKey_0 from Semistructured.Blocks as \"root\" inner join lateral flatten(input => \"root\".BLOCKDATA['relatedEntities'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\") as \"blocks_4\" inner join Semistructured.Orders as \"orders_0\" on (to_varchar(get_path(\"blocks_4\".flattened_prop, 'tag')) = 'order' and to_varchar(get_path(\"blocks_4\".flattened_prop, 'tagId')) = \"orders_0\".ID)) as \"blocks_3\" on (\"blocks_2\".ID = \"blocks_3\".leftJoinKey_0) where \"blocks_3\".SIDE = 'BUY' group by \"blocks_2\".ID) as \"blocks_1\" on (\"root\".ID = \"blocks_1\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Id, String, VARCHAR(100), \"\"), (Account, String, VARCHAR(100), \"\"), (Buy Order, Integer, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Id, String, VARCHAR(100), \"\"), (Account, String, VARCHAR(100), \"\"), (Buy Order, Integer, BIGINT, \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExtractFromSemiStructuredJoin.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExtractFromSemiStructuredJoin.java index bd0ae5eda28..a0203330678 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExtractFromSemiStructuredJoin.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExtractFromSemiStructuredJoin.java @@ -31,12 +31,12 @@ public void testJoinOnSemiStructuredProperty() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Last Name, String, VARCHAR(100), \"\"), (Firm/Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Last Name, String, VARCHAR(100), \"\"), (Firm/Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Last Name\", VARCHAR(100)), (\"Firm/Legal Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".LASTNAME as \"Last Name\", \"firm_table_0\".FIRM_DETAILS['legalName']::varchar as \"Firm/Legal Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" left outer join FIRM_SCHEMA.FIRM_TABLE as \"firm_table_0\" on (to_number(get_path(\"root\".FIRM, 'ID')) = to_number(get_path(\"firm_table_0\".FIRM_DETAILS, 'ID')))\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Last Name, String, VARCHAR(100), \"\"), (Firm/Legal Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Last Name, String, VARCHAR(100), \"\"), (Firm/Legal Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExtractFromSemiStructuredSimple.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExtractFromSemiStructuredSimple.java index c9fb77af203..e45eac5d2ab 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExtractFromSemiStructuredSimple.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeExtractFromSemiStructuredSimple.java @@ -30,12 +30,12 @@ public void testDotAndBracketNotationAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Id, Integer, INT, \"\"), (Dot Only, StrictDate, \"\", \"\"), (Bracket Only, DateTime, \"\", \"\"), (Dot & Bracket, String, \"\", \"\")]\n" + + " type = TDS[(Id, Integer, INT, \"\"), (Dot Only, StrictDate, DATE, \"\"), (Bracket Only, DateTime, TIMESTAMP, \"\"), (Dot & Bracket, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Id\", INT), (\"Dot Only\", \"\"), (\"Bracket Only\", \"\"), (\"Dot & Bracket\", \"\")]\n" + " sql = select \"root\".ID as \"Id\", to_date(get_path(\"root\".FIRM_DETAILS, 'dates.estDate')) as \"Dot Only\", to_timestamp(get_path(\"root\".FIRM_DETAILS, '[\"dates\"][\"last Update\"]')) as \"Bracket Only\", to_varchar(get_path(\"root\".FIRM_DETAILS, 'address.lines[1][\"details\"]')) as \"Dot & Bracket\" from FIRM_SCHEMA.FIRM_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Id, Integer, INT, \"\"), (Dot Only, StrictDate, \"\", \"\"), (Bracket Only, DateTime, \"\", \"\"), (Dot & Bracket, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Id, Integer, INT, \"\"), (Dot Only, StrictDate, DATE, \"\"), (Bracket Only, DateTime, TIMESTAMP, \"\"), (Dot & Bracket, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -47,12 +47,12 @@ public void testArrayElementNoFlattenAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Id, Integer, INT, \"\"), (Second Line of Address, String, \"\", \"\")]\n" + + " type = TDS[(Id, Integer, INT, \"\"), (Second Line of Address, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Id\", INT), (\"Second Line of Address\", \"\")]\n" + " sql = select \"root\".ID as \"Id\", to_varchar(get_path(\"root\".FIRM_DETAILS, 'address.lines[1][\"details\"]')) as \"Second Line of Address\" from FIRM_SCHEMA.FIRM_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Id, Integer, INT, \"\"), (Second Line of Address, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Id, Integer, INT, \"\"), (Second Line of Address, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -81,12 +81,12 @@ public void testAllDataTypesAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Id, Integer, INT, \"\"), (Legal Name, String, \"\", \"\"), (Est Date, StrictDate, \"\", \"\"), (Mnc, Boolean, \"\", \"\"), (Employee Count, Integer, \"\", \"\"), (Last Update, DateTime, \"\", \"\")]\n" + + " type = TDS[(Id, Integer, INT, \"\"), (Legal Name, String, VARCHAR(65536), \"\"), (Est Date, StrictDate, DATE, \"\"), (Mnc, Boolean, BIT, \"\"), (Employee Count, Integer, BIGINT, \"\"), (Last Update, DateTime, TIMESTAMP, \"\")]\n" + " resultColumns = [(\"Id\", INT), (\"Legal Name\", \"\"), (\"Est Date\", \"\"), (\"Mnc\", \"\"), (\"Employee Count\", \"\"), (\"Last Update\", \"\")]\n" + " sql = select \"root\".ID as \"Id\", to_varchar(get_path(\"root\".FIRM_DETAILS, 'legalName')) as \"Legal Name\", to_date(get_path(\"root\".FIRM_DETAILS, 'dates.estDate')) as \"Est Date\", to_boolean(get_path(\"root\".FIRM_DETAILS, 'mnc')) as \"Mnc\", to_number(get_path(\"root\".FIRM_DETAILS, 'employeeCount')) as \"Employee Count\", to_timestamp(get_path(\"root\".FIRM_DETAILS, '[\"dates\"][\"last Update\"]')) as \"Last Update\" from FIRM_SCHEMA.FIRM_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Id, Integer, INT, \"\"), (Legal Name, String, \"\", \"\"), (Est Date, StrictDate, \"\", \"\"), (Mnc, Boolean, \"\", \"\"), (Employee Count, Integer, \"\", \"\"), (Last Update, DateTime, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Id, Integer, INT, \"\"), (Legal Name, String, VARCHAR(65536), \"\"), (Est Date, StrictDate, DATE, \"\"), (Mnc, Boolean, BIT, \"\"), (Employee Count, Integer, BIGINT, \"\"), (Last Update, DateTime, TIMESTAMP, \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredFlattening.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredFlattening.java index 80013f35ea9..57d18ff8e6f 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredFlattening.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredFlattening.java @@ -32,12 +32,12 @@ public void testSemiStructuredPrimitivePropertyFlattening() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Other Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Other Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Firm Other Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"ss_flatten_0\".VALUE::varchar as \"Firm Other Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" inner join lateral flatten(input => \"root\".FIRM_DETAILS['otherNames']::varchar, outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Other Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Other Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -48,12 +48,12 @@ public void testSemiStructuredComplexPropertyFlattening() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Firm Address Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"ss_flatten_0\".VALUE['name']::varchar as \"Firm Address Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" inner join lateral flatten(input => \"root\".FIRM_DETAILS['addresses'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -64,12 +64,12 @@ public void testSemiStructuredPrimitivePropertyArrayIndexing() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Other Name 0, String, \"\", \"\"), (Firm Other Name 2, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Other Name 0, String, VARCHAR(65536), \"\"), (Firm Other Name 2, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Firm Other Name 0\", \"\"), (\"Firm Other Name 2\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"root\".FIRM_DETAILS['otherNames'][0]::varchar as \"Firm Other Name 0\", \"root\".FIRM_DETAILS['otherNames'][2]::varchar as \"Firm Other Name 2\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Other Name 0, String, \"\", \"\"), (Firm Other Name 2, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Other Name 0, String, VARCHAR(65536), \"\"), (Firm Other Name 2, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -80,12 +80,12 @@ public void testSemiStructuredComplexPropertyArrayIndexing() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address 0 Name, String, \"\", \"\"), (Firm Address 2 Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address 0 Name, String, VARCHAR(65536), \"\"), (Firm Address 2 Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Firm Address 0 Name\", \"\"), (\"Firm Address 2 Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"root\".FIRM_DETAILS['addresses'][0]['name']::varchar as \"Firm Address 0 Name\", \"root\".FIRM_DETAILS['addresses'][2]['name']::varchar as \"Firm Address 2 Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address 0 Name, String, \"\", \"\"), (Firm Address 2 Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address 0 Name, String, VARCHAR(65536), \"\"), (Firm Address 2 Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -96,12 +96,12 @@ public void testSemiStructuredComplexPropertyFlatteningFollowedBySubType() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address Line 0 Line No, Integer, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address Line 0 Line No, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Firm Address Line 0 Line No\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"ss_flatten_0\".VALUE['lines'][0]['lineno'] as \"Firm Address Line 0 Line No\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" inner join lateral flatten(input => \"root\".FIRM_DETAILS['addresses'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address Line 0 Line No, Integer, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address Line 0 Line No, Integer, BIGINT, \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -112,12 +112,12 @@ public void testSemiStructuredComplexPropertyArrayIndexingFollowedBySubType() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address 0 Line 0 Line No, Integer, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address 0 Line 0 Line No, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Firm Address 0 Line 0 Line No\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"root\".FIRM_DETAILS['addresses'][0]['lines'][0]['lineno'] as \"Firm Address 0 Line 0 Line No\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address 0 Line 0 Line No, Integer, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address 0 Line 0 Line No, Integer, BIGINT, \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -128,12 +128,12 @@ public void testSemiStructuredPrimitivePropertyFiltering() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\")]\n" + " sql = select distinct \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" inner join lateral flatten(input => \"root\".FIRM_DETAILS['otherNames']::varchar, outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\" where \"ss_flatten_0\".VALUE::varchar = 'A'\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -173,12 +173,12 @@ public void testSemiStructuredSubAggregation() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address Names, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address Names, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Firm Address Names\", INT)]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"person_table_1\".aggCol as \"Firm Address Names\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" left outer join (select \"person_table_2\".ID as ID, listagg(\"ss_flatten_0\".VALUE['name']::varchar, ';') as aggCol from PERSON_SCHEMA.PERSON_TABLE as \"person_table_2\" inner join lateral flatten(input => \"person_table_2\".FIRM_DETAILS['addresses'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\" group by \"person_table_2\".ID) as \"person_table_1\" on (\"root\".ID = \"person_table_1\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address Names, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address Names, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -189,12 +189,12 @@ public void testSemiStructuredSubAggregationDeep() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address Line No Sum, Integer, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address Line No Sum, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Firm Address Line No Sum\", INT)]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"person_table_1\".aggCol as \"Firm Address Line No Sum\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" left outer join (select \"person_table_2\".ID as ID, sum(\"ss_flatten_1\".VALUE['lineno']) as aggCol from PERSON_SCHEMA.PERSON_TABLE as \"person_table_2\" inner join lateral flatten(input => \"person_table_2\".FIRM_DETAILS['addresses'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\" inner join lateral flatten(input => \"ss_flatten_0\".VALUE['lines'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_1\" group by \"person_table_2\".ID) as \"person_table_1\" on (\"root\".ID = \"person_table_1\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address Line No Sum, Integer, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address Line No Sum, Integer, BIGINT, \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -205,12 +205,12 @@ public void testSemiStructuredMultiLevelFlatten() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address Name Line No, Integer, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address Name Line No, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Firm Address Name Line No\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"ss_flatten_1\".VALUE['lineno'] as \"Firm Address Name Line No\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" inner join lateral flatten(input => \"root\".FIRM_DETAILS['addresses'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\" inner join lateral flatten(input => \"ss_flatten_0\".VALUE['lines'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_1\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Firm Address Name Line No, Integer, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Firm Address Name Line No, Integer, BIGINT, \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -221,12 +221,12 @@ public void testSemiStructuredMultiFlatten() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Name, String, \"\", \"\"), (Firm Address Line 0 No, Integer, \"\", \"\"), (Firm Other Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Name, String, VARCHAR(65536), \"\"), (Firm Address Line 0 No, Integer, BIGINT, \"\"), (Firm Other Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address Name\", \"\"), (\"Firm Address Line 0 No\", \"\"), (\"Firm Other Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"ss_flatten_0\".VALUE['name']::varchar as \"Firm Address Name\", \"ss_flatten_0\".VALUE['lines'][0]['lineno'] as \"Firm Address Line 0 No\", \"ss_flatten_1\".VALUE::varchar as \"Firm Other Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" inner join lateral flatten(input => \"root\".FIRM_DETAILS['addresses'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\" inner join lateral flatten(input => \"root\".FIRM_DETAILS['otherNames']::varchar, outer => true, recursive => false, mode => 'array') as \"ss_flatten_1\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Name, String, \"\", \"\"), (Firm Address Line 0 No, Integer, \"\", \"\"), (Firm Other Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Name, String, VARCHAR(65536), \"\"), (Firm Address Line 0 No, Integer, BIGINT, \"\"), (Firm Other Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); Assert.assertEquals("[PERSON_TABLE.FIRM_DETAILS , PERSON_TABLE.FIRSTNAME ]", this.scanColumns("flatten::semiStructuredMultiFlatten__TabularDataSet_1_", snowflakeMapping)); diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredInheritanceMapping.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredInheritanceMapping.java index 8fc10007d73..382b4604cc2 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredInheritanceMapping.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredInheritanceMapping.java @@ -30,12 +30,12 @@ public void testSemiStructuredPropertyAccessAtBaseClass() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['address']['name']::varchar as \"Firm Address Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -47,12 +47,12 @@ public void testSemiStructuredPropertyAccessAtSubClass() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address 0 Line No\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['address']['lines'][0]['lineno'] as \"Firm Address 0 Line No\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, BIGINT, \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -64,12 +64,12 @@ public void testSemiStructuredPropertyAccessAtSubClassNested() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, \"\", \"\"), (Firm Address Street, String, \"\", \"\"), (Firm Address City, String, \"\", \"\"), (Firm Address State, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, BIGINT, \"\"), (Firm Address Street, String, VARCHAR(65536), \"\"), (Firm Address City, String, VARCHAR(65536), \"\"), (Firm Address State, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address 0 Line No\", \"\"), (\"Firm Address Street\", \"\"), (\"Firm Address City\", \"\"), (\"Firm Address State\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['address']['lines'][0]['lineno'] as \"Firm Address 0 Line No\", \"root\".FIRM_DETAILS['address']['lines'][0]['street']::varchar as \"Firm Address Street\", \"root\".FIRM_DETAILS['address']['lines'][1]['city']::varchar as \"Firm Address City\", \"root\".FIRM_DETAILS['address']['lines'][2]['state']::varchar as \"Firm Address State\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, \"\", \"\"), (Firm Address Street, String, \"\", \"\"), (Firm Address City, String, \"\", \"\"), (Firm Address State, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, BIGINT, \"\"), (Firm Address Street, String, VARCHAR(65536), \"\"), (Firm Address City, String, VARCHAR(65536), \"\"), (Firm Address State, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -81,12 +81,12 @@ public void testSemiStructuredPropertyAccessAtSubClassNestedUsingProjectWithFunc String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, \"\", \"\"), (Firm Address Street, String, \"\", \"\"), (Firm Address City, String, \"\", \"\"), (Firm Address State, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, BIGINT, \"\"), (Firm Address Street, String, VARCHAR(65536), \"\"), (Firm Address City, String, VARCHAR(65536), \"\"), (Firm Address State, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address 0 Line No\", \"\"), (\"Firm Address Street\", \"\"), (\"Firm Address City\", \"\"), (\"Firm Address State\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['address']['lines'][0]['lineno'] as \"Firm Address 0 Line No\", \"root\".FIRM_DETAILS['address']['lines'][0]['street']::varchar as \"Firm Address Street\", \"root\".FIRM_DETAILS['address']['lines'][1]['city']::varchar as \"Firm Address City\", \"root\".FIRM_DETAILS['address']['lines'][2]['state']::varchar as \"Firm Address State\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, \"\", \"\"), (Firm Address Street, String, \"\", \"\"), (Firm Address City, String, \"\", \"\"), (Firm Address State, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, BIGINT, \"\"), (Firm Address Street, String, VARCHAR(65536), \"\"), (Firm Address City, String, VARCHAR(65536), \"\"), (Firm Address State, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredJoinChainMapping.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredJoinChainMapping.java index e177c9fa9b9..d1467126a89 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredJoinChainMapping.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredJoinChainMapping.java @@ -30,12 +30,12 @@ public void testSingleJoinInChain() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Manager Firm Legal Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"person_table_1\".FIRM_DETAILS['legalName']::varchar as \"Manager Firm Legal Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_1\" on (\"root\".MANAGERID = \"person_table_1\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -47,12 +47,12 @@ public void testMultipleJoinsInChain() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, \"\", \"\"), (Manager Manager Firm Legal Name, String, \"\", \"\"), (Manager Manager Firm Legal Name Dup1, String, \"\", \"\"), (Manager Manager Firm Legal Name Dup2, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name Dup1, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name Dup2, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Manager Firm Legal Name\", \"\"), (\"Manager Manager Firm Legal Name\", \"\"), (\"Manager Manager Firm Legal Name Dup1\", \"\"), (\"Manager Manager Firm Legal Name Dup2\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"person_table_1\".FIRM_DETAILS['legalName']::varchar as \"Manager Firm Legal Name\", \"person_table_2\".FIRM_DETAILS['legalName']::varchar as \"Manager Manager Firm Legal Name\", \"person_table_3\".FIRM_DETAILS['legalName']::varchar as \"Manager Manager Firm Legal Name Dup1\", \"person_table_5\".FIRM_DETAILS['legalName']::varchar as \"Manager Manager Firm Legal Name Dup2\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_1\" on (\"root\".MANAGERID = \"person_table_1\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_2\" on (\"person_table_1\".MANAGERID = \"person_table_2\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_3\" on (\"person_table_1\".MANAGERID = \"person_table_3\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_4\" on (\"root\".MANAGERID = \"person_table_4\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_5\" on (\"person_table_4\".MANAGERID = \"person_table_5\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, \"\", \"\"), (Manager Manager Firm Legal Name, String, \"\", \"\"), (Manager Manager Firm Legal Name Dup1, String, \"\", \"\"), (Manager Manager Firm Legal Name Dup2, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name Dup1, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name Dup2, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); Assert.assertEquals("[PERSON_TABLE.FIRM_DETAILS , PERSON_TABLE.FIRSTNAME , PERSON_TABLE.ID , PERSON_TABLE.MANAGERID ]", this.scanColumns(queryFunction, snowflakeMapping)); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredMatching.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredMatching.java index 35e5cf33790..e3580bfe6f3 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredMatching.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredMatching.java @@ -31,12 +31,12 @@ public void testSemiStructuredMatchComplexProperty() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Customer Address, String, \"\", \"\")]\n" + + " type = TDS[(Customer Address, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Customer Address\", \"\")]\n" + " sql = select case when \"root\".CUSTOMER['customerAddress']['@type']::varchar in ('BillingAddress') then \"root\".CUSTOMER['customerAddress']['billAddress']::varchar when \"root\".CUSTOMER['customerAddress']['@type']::varchar in ('ShippingAddress') then \"root\".CUSTOMER['customerAddress']['shipAddress']::varchar else 'Default Address' end as \"Customer Address\" from ORDER_SCHEMA.ORDER_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Customer Address, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Customer Address, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -49,12 +49,12 @@ public void testSemiStructuredMatchWithMultipleProject() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Customer Address, String, \"\", \"\"), (Order Price, Integer, \"\", \"\")]\n" + + " type = TDS[(Customer Address, String, VARCHAR(65536), \"\"), (Order Price, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"Customer Address\", \"\"), (\"Order Price\", \"\")]\n" + " sql = select case when \"root\".CUSTOMER['customerAddress']['@type']::varchar in ('BillingAddress') then \"root\".CUSTOMER['customerAddress']['billAddress']::varchar when \"root\".CUSTOMER['customerAddress']['@type']::varchar in ('ShippingAddress') then \"root\".CUSTOMER['customerAddress']['shipAddress']::varchar else null end as \"Customer Address\", case when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('CashOnDeliveryPayment') then \"root\".CUSTOMER['transactionDetails']['payment']['amountToBePaid'] when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then \"root\".CUSTOMER['transactionDetails']['payment']['amountPaid'] else null end as \"Order Price\" from ORDER_SCHEMA.ORDER_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Customer Address, String, \"\", \"\"), (Order Price, Integer, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Customer Address, String, VARCHAR(65536), \"\"), (Order Price, Integer, BIGINT, \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -66,12 +66,12 @@ public void testSemiStructuredMatchWithComplexFilter() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Customer Address, String, \"\", \"\")]\n" + + " type = TDS[(Customer Address, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Customer Address\", \"\")]\n" + " sql = select case when \"root\".CUSTOMER['customerAddress']['@type']::varchar in ('BillingAddress') then \"root\".CUSTOMER['customerAddress']['billAddress']::varchar when \"root\".CUSTOMER['customerAddress']['@type']::varchar in ('ShippingAddress') then \"root\".CUSTOMER['customerAddress']['shipAddress']::varchar else null end as \"Customer Address\" from ORDER_SCHEMA.ORDER_TABLE as \"root\" where case when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('CashOnDeliveryPayment') then \"root\".CUSTOMER['transactionDetails']['payment']['amountToBePaid'] when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then \"root\".CUSTOMER['transactionDetails']['payment']['amountPaid'] else null end < 200\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Customer Address, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Customer Address, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -83,7 +83,7 @@ public void testSemiStructuredMatchWithVariableAccess() String snowflakePlan = this.buildExecutionPlanString(queryFunction, snowflakeMapping, snowflakeRuntime); String snowflakeExpected = "Sequence\n" + "(\n" + - " type = TDS[(Max Amount Flag, Boolean, \"\", \"\")]\n" + + " type = TDS[(Max Amount Flag, Boolean, BIT, \"\")]\n" + " (\n" + " Allocation\n" + " (\n" + @@ -102,7 +102,7 @@ public void testSemiStructuredMatchWithVariableAccess() " )\n" + " RelationalBlockExecutionNode\n" + " (\n" + - " type = TDS[(Max Amount Flag, Boolean, \"\", \"\")]\n" + + " type = TDS[(Max Amount Flag, Boolean, BIT, \"\")]\n" + " (\n" + " SQL\n" + " (\n" + @@ -113,7 +113,7 @@ public void testSemiStructuredMatchWithVariableAccess() " )\n" + " Relational\n" + " (\n" + - " type = TDS[(Max Amount Flag, Boolean, \"\", \"\")]\n" + + " type = TDS[(Max Amount Flag, Boolean, BIT, \"\")]\n" + " resultColumns = [(\"Max Amount Flag\", \"\")]\n" + " sql = select case when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('CashOnDeliveryPayment') then case when \"root\".CUSTOMER['transactionDetails']['payment']['amountToBePaid'] < ${maxAmount} then true else false end when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then case when \"root\".CUSTOMER['transactionDetails']['payment']['amountPaid'] < ${maxAmount} then true else false end else null end as \"Max Amount Flag\" from ORDER_SCHEMA.ORDER_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + @@ -144,12 +144,12 @@ public void testSemiStructuredMatchMultilevel() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Amount, Integer, \"\", \"\")]\n" + + " type = TDS[(Amount, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"Amount\", \"\")]\n" + " sql = select case when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then case when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('WalletPrepaidPayment') then \"root\".CUSTOMER['transactionDetails']['payment']['walletTransactionAmount'] when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('CardPrepaidPayment') then \"root\".CUSTOMER['transactionDetails']['payment']['cardTransactionAmount'] when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then \"root\".CUSTOMER['transactionDetails']['payment']['amountPaid'] else null end when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('CashOnDeliveryPayment') then \"root\".CUSTOMER['transactionDetails']['payment']['amountToBePaid'] else null end as \"Amount\" from ORDER_SCHEMA.ORDER_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Amount, Integer, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Amount, Integer, BIGINT, \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -161,12 +161,12 @@ public void testSemiStructuredMatchWithMultipleProjectUsingCol() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Customer Address, String, \"\", \"\"), (Order Price, Integer, \"\", \"\")]\n" + + " type = TDS[(Customer Address, String, VARCHAR(65536), \"\"), (Order Price, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"Customer Address\", \"\"), (\"Order Price\", \"\")]\n" + " sql = select case when \"root\".CUSTOMER['customerAddress']['@type']::varchar in ('BillingAddress') then \"root\".CUSTOMER['customerAddress']['billAddress']::varchar when \"root\".CUSTOMER['customerAddress']['@type']::varchar in ('ShippingAddress') then \"root\".CUSTOMER['customerAddress']['shipAddress']::varchar else null end as \"Customer Address\", case when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('CashOnDeliveryPayment') then \"root\".CUSTOMER['transactionDetails']['payment']['amountToBePaid'] when \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then \"root\".CUSTOMER['transactionDetails']['payment']['amountPaid'] else null end as \"Order Price\" from ORDER_SCHEMA.ORDER_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Customer Address, String, \"\", \"\"), (Order Price, Integer, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Customer Address, String, VARCHAR(65536), \"\"), (Order Price, Integer, BIGINT, \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredMultiBindingMapping.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredMultiBindingMapping.java index afc683e14f3..2fb91519a2c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredMultiBindingMapping.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredMultiBindingMapping.java @@ -30,12 +30,12 @@ public void testSemiStructuredPropertyAccessFromSingleBindingMapping() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Address Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Address Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".ADDRESS_DETAILS['name']::varchar as \"Address Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Address Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Address Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -47,12 +47,12 @@ public void testSemiStructuredPropertyAccessFromMultipleBindingMapping() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\"), (Address Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\"), (Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Legal Name\", \"\"), (\"Address Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Legal Name\", \"root\".ADDRESS_DETAILS['name']::varchar as \"Address Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\"), (Address Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\"), (Address Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -64,12 +64,12 @@ public void testSemiStructuredRelOpWithJoinPropertyAccessFromMultipleBindingMapp String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\"), (Address Name, String, \"\", \"\"), (Manager Firm Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\"), (Address Name, String, VARCHAR(65536), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Legal Name\", \"\"), (\"Address Name\", \"\"), (\"Manager Firm Legal Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Legal Name\", \"root\".ADDRESS_DETAILS['name']::varchar as \"Address Name\", \"person_table_1\".FIRM_DETAILS['legalName']::varchar as \"Manager Firm Legal Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_1\" on (\"root\".MANAGERID = \"person_table_1\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\"), (Address Name, String, \"\", \"\"), (Manager Firm Legal Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\"), (Address Name, String, VARCHAR(65536), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredParseJsonMapping.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredParseJsonMapping.java index f428effa1c8..b87714ced0e 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredParseJsonMapping.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredParseJsonMapping.java @@ -29,12 +29,12 @@ public void testParseJsonInMapping() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Manager Firm Legal Name, String, \"\", \"\"), (Manager Manager Firm Legal Name, String, \"\", \"\"), (Manager Manager Firm Legal Name Dup1, String, \"\", \"\"), (Manager Manager Firm Legal Name Dup2, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name Dup1, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name Dup2, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Manager Firm Legal Name\", \"\"), (\"Manager Manager Firm Legal Name\", \"\"), (\"Manager Manager Firm Legal Name Dup1\", \"\"), (\"Manager Manager Firm Legal Name Dup2\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", parse_json(\"root\".FIRM_DETAILS)['legalName']::varchar as \"Firm Name\", parse_json(\"person_table_varchar_1\".FIRM_DETAILS)['legalName']::varchar as \"Manager Firm Legal Name\", parse_json(\"person_table_varchar_2\".FIRM_DETAILS)['legalName']::varchar as \"Manager Manager Firm Legal Name\", parse_json(\"person_table_varchar_3\".FIRM_DETAILS)['legalName']::varchar as \"Manager Manager Firm Legal Name Dup1\", parse_json(\"person_table_varchar_5\".FIRM_DETAILS)['legalName']::varchar as \"Manager Manager Firm Legal Name Dup2\" from PERSON_SCHEMA.PERSON_TABLE_VARCHAR as \"root\" left outer join PERSON_SCHEMA.PERSON_TABLE_VARCHAR as \"person_table_varchar_1\" on (\"root\".MANAGERID = \"person_table_varchar_1\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE_VARCHAR as \"person_table_varchar_2\" on (\"person_table_varchar_1\".MANAGERID = \"person_table_varchar_2\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE_VARCHAR as \"person_table_varchar_3\" on (\"person_table_varchar_1\".MANAGERID = \"person_table_varchar_3\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE_VARCHAR as \"person_table_varchar_4\" on (\"root\".MANAGERID = \"person_table_varchar_4\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE_VARCHAR as \"person_table_varchar_5\" on (\"person_table_varchar_4\".MANAGERID = \"person_table_varchar_5\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Manager Firm Legal Name, String, \"\", \"\"), (Manager Manager Firm Legal Name, String, \"\", \"\"), (Manager Manager Firm Legal Name Dup1, String, \"\", \"\"), (Manager Manager Firm Legal Name Dup2, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name Dup1, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name Dup2, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredTypeFunctions.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredTypeFunctions.java index b5f29208b96..1cded8b153e 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredTypeFunctions.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSemiStructuredTypeFunctions.java @@ -29,12 +29,12 @@ public void testSemiStructuredTypeNameFunctionUsageInProjectWithFunctions() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Customer Address Type, String, \"\", \"\"), (Payment Type, String, \"\", \"\")]\n" + + " type = TDS[(Customer Address Type, String, VARCHAR(65536), \"\"), (Payment Type, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Customer Address Type\", \"\"), (\"Payment Type\", \"\")]\n" + " sql = select \"root\".CUSTOMER['customerAddress']['@type']::varchar as \"Customer Address Type\", \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar as \"Payment Type\" from ORDER_SCHEMA.ORDER_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Customer Address Type, String, \"\", \"\"), (Payment Type, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Customer Address Type, String, VARCHAR(65536), \"\"), (Payment Type, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -45,12 +45,12 @@ public void testSemiStructuredTypeNameFunctionUsageInProjectWithColSpecs() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Customer Address Type, String, \"\", \"\"), (Payment Type, String, \"\", \"\")]\n" + + " type = TDS[(Customer Address Type, String, VARCHAR(65536), \"\"), (Payment Type, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Customer Address Type\", \"\"), (\"Payment Type\", \"\")]\n" + " sql = select \"root\".CUSTOMER['customerAddress']['@type']::varchar as \"Customer Address Type\", \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar as \"Payment Type\" from ORDER_SCHEMA.ORDER_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Customer Address Type, String, \"\", \"\"), (Payment Type, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Customer Address Type, String, VARCHAR(65536), \"\"), (Payment Type, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -61,12 +61,12 @@ public void testSemiStructuredTypeNameFunctionUsageInFilter() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Order Id, Integer, INT, \"\"), (Customer Address Type, String, \"\", \"\")]\n" + + " type = TDS[(Order Id, Integer, INT, \"\"), (Customer Address Type, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Order Id\", INT), (\"Customer Address Type\", \"\")]\n" + " sql = select \"root\".ORDERID as \"Order Id\", \"root\".CUSTOMER['customerAddress']['@type']::varchar as \"Customer Address Type\" from ORDER_SCHEMA.ORDER_TABLE as \"root\" where \"root\".CUSTOMER['transactionDetails']['payment']['@type']::varchar = 'CashOnDeliveryPayment'\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Order Id, Integer, INT, \"\"), (Customer Address Type, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Order Id, Integer, INT, \"\"), (Customer Address Type, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -77,12 +77,12 @@ public void testSemiStructuredTypeNameFunctionUsageAfterFlattenFunction() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Order Id, Integer, INT, \"\"), (Product Type, String, \"\", \"\")]\n" + + " type = TDS[(Order Id, Integer, INT, \"\"), (Product Type, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Order Id\", INT), (\"Product Type\", \"\")]\n" + " sql = select \"root\".ORDERID as \"Order Id\", \"ss_flatten_0\".VALUE['@type']::varchar as \"Product Type\" from ORDER_SCHEMA.ORDER_TABLE as \"root\" inner join lateral flatten(input => \"root\".CUSTOMER['products'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Order Id, Integer, INT, \"\"), (Product Type, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Order Id, Integer, INT, \"\"), (Product Type, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -93,12 +93,12 @@ public void testSemiStructuredTypeNameFunctionUsageAfterFlattenColSpec() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Order Id, Integer, INT, \"\"), (Product Type, String, \"\", \"\")]\n" + + " type = TDS[(Order Id, Integer, INT, \"\"), (Product Type, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Order Id\", INT), (\"Product Type\", \"\")]\n" + " sql = select \"root\".ORDERID as \"Order Id\", \"ss_flatten_0\".VALUE['@type']::varchar as \"Product Type\" from ORDER_SCHEMA.ORDER_TABLE as \"root\" inner join lateral flatten(input => \"root\".CUSTOMER['products'], outer => true, recursive => false, mode => 'array') as \"ss_flatten_0\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Order Id, Integer, INT, \"\"), (Product Type, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Order Id, Integer, INT, \"\"), (Product Type, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -109,12 +109,12 @@ public void testSemiStructuredTypeNameFunctionUsageAfterArrayElementAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Order Id, Integer, INT, \"\"), (Product 0 Type, String, \"\", \"\"), (Product 1 Type, String, \"\", \"\")]\n" + + " type = TDS[(Order Id, Integer, INT, \"\"), (Product 0 Type, String, VARCHAR(65536), \"\"), (Product 1 Type, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Order Id\", INT), (\"Product 0 Type\", \"\"), (\"Product 1 Type\", \"\")]\n" + " sql = select \"root\".ORDERID as \"Order Id\", \"root\".CUSTOMER['products'][0]['@type']::varchar as \"Product 0 Type\", \"root\".CUSTOMER['products'][1]['@type']::varchar as \"Product 1 Type\" from ORDER_SCHEMA.ORDER_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Order Id, Integer, INT, \"\"), (Product 0 Type, String, \"\", \"\"), (Product 1 Type, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Order Id, Integer, INT, \"\"), (Product 0 Type, String, VARCHAR(65536), \"\"), (Product 1 Type, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSimpleSemiStructuredMapping.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSimpleSemiStructuredMapping.java index c0b02e1fdd8..72938ed2d58 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSimpleSemiStructuredMapping.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-dbExtension/legend-engine-xt-relationalStore-snowflake/legend-engine-xt-relationalStore-snowflake-execution/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSnowflakeSimpleSemiStructuredMapping.java @@ -30,12 +30,12 @@ public void testSingleSemiStructuredPropertyAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Firm Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(Firm Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Firm Legal Name\", \"\")]\n" + " sql = select \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Legal Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Firm Legal Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Firm Legal Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -47,12 +47,12 @@ public void testCombinedPrimitiveAndSemiStructuredPropertyAccessParallel() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Legal Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Legal Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -64,12 +64,12 @@ public void testCombinedPrimitiveAndSemiStructuredPropertyAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Out Col, String, \"\", \"\")]\n" + + " type = TDS[(Out Col, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Out Col\", \"\")]\n" + " sql = select concat(\"root\".FIRSTNAME, ' : ', \"root\".FIRM_DETAILS['legalName']::varchar) as \"Out Col\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Out Col, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Out Col, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -81,12 +81,12 @@ public void testCombinedComplexAndSemiStructuredPropertyAccessParallel() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Manager First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(Manager First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Manager First Name\", VARCHAR(100)), (\"Firm Legal Name\", \"\")]\n" + " sql = select \"person_table_1\".FIRSTNAME as \"Manager First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Legal Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_1\" on (\"root\".MANAGERID = \"person_table_1\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Manager First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Manager First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -98,12 +98,12 @@ public void testCombinedComplexAndSemiStructuredPropertyAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Out Col, String, \"\", \"\")]\n" + + " type = TDS[(Out Col, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Out Col\", \"\")]\n" + " sql = select concat(case when \"person_table_1\".FIRSTNAME is null then 'NULL' else \"person_table_1\".FIRSTNAME end, ' : ', \"root\".FIRM_DETAILS['legalName']::varchar) as \"Out Col\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_1\" on (\"root\".MANAGERID = \"person_table_1\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Out Col, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Out Col, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -115,12 +115,12 @@ public void testNestedSemiStructuredPropertyAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Firm Address Name, String, \"\", \"\")]\n" + + " type = TDS[(Firm Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Firm Address Name\", \"\")]\n" + " sql = select \"root\".FIRM_DETAILS['address']['name']::varchar as \"Firm Address Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Firm Address Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Firm Address Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -132,12 +132,12 @@ public void testMultipleSemiStructuredPropertyAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Firm Legal Name, String, \"\", \"\"), (Firm Address Name, String, \"\", \"\")]\n" + + " type = TDS[(Firm Legal Name, String, VARCHAR(65536), \"\"), (Firm Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Firm Legal Name\", \"\"), (\"Firm Address Name\", \"\")]\n" + " sql = select \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Legal Name\", \"root\".FIRM_DETAILS['address']['name']::varchar as \"Firm Address Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Firm Legal Name, String, \"\", \"\"), (Firm Address Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Firm Legal Name, String, VARCHAR(65536), \"\"), (Firm Address Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -149,12 +149,12 @@ public void testMultipleSemiStructuredPropertyAccessCombined() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Firm Legal Name And Address Name, String, \"\", \"\")]\n" + + " type = TDS[(Firm Legal Name And Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Firm Legal Name And Address Name\", \"\")]\n" + " sql = select concat(\"root\".FIRM_DETAILS['legalName']::varchar, \"root\".FIRM_DETAILS['address']['name']::varchar) as \"Firm Legal Name And Address Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Firm Legal Name And Address Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(Firm Legal Name And Address Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -183,12 +183,12 @@ public void testGroupByWithSemiStructuredProperty() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(Address, String, \"\", \"\"), (Names, String, VARCHAR(200), \"\")]\n" + + " type = TDS[(Address, String, VARCHAR(65536), \"\"), (Names, String, VARCHAR(200), \"\")]\n" + " resultColumns = [(\"Address\", \"\"), (\"Names\", \"\")]\n" + " sql = select \"root\".FIRM_DETAILS['address']['name']::varchar as \"Address\", listagg(\"root\".FIRSTNAME, ';') as \"Names\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" group by \"Address\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(Address, String, \"\", \"\"), (Names, String, VARCHAR(200), \"\")]\n"; + String TDSType = " type = TDS[(Address, String, VARCHAR(65536), \"\"), (Names, String, VARCHAR(200), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -217,12 +217,12 @@ public void testIsEmptyCheckOnSemiStructuredPrimitivePropertyAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Street, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Street, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"First Address Street\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", case when \"root\".FIRM_DETAILS['address']['street']::varchar is null then 'NULL' else \"root\".FIRM_DETAILS['address']['street']::varchar end as \"First Address Street\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Street, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Street, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -234,12 +234,12 @@ public void testIsEmptyCheckOnSemiStructuredPropertyAccessAfterAt() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Line, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Line, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"First Address Line\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", case when \"root\".FIRM_DETAILS['address']['lines'][2]['details']::varchar is null then 'NULL' else \"root\".FIRM_DETAILS['address']['lines'][2]['details']::varchar end as \"First Address Line\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Line, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Line, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -251,12 +251,12 @@ public void testSemiStructuredDifferentDataTypePropertyAccess() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\"), (Firm Employee Count, Integer, \"\", \"\"), (Firm MNC, Boolean, \"\", \"\"), (Firm Est Date, StrictDate, \"\", \"\"), (Firm Last Update, DateTime, \"\", \"\"), (Firm Address Street, String, \"\", \"\"), (Firm Entity Type, simple::model::EntityType, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\"), (Firm Employee Count, Integer, BIGINT, \"\"), (Firm MNC, Boolean, BIT, \"\"), (Firm Est Date, StrictDate, DATE, \"\"), (Firm Last Update, DateTime, TIMESTAMP, \"\"), (Firm Address Street, String, VARCHAR(65536), \"\"), (Firm Entity Type, simple::model::EntityType, \"\", \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Legal Name\", \"\"), (\"Firm Employee Count\", \"\"), (\"Firm MNC\", \"\"), (\"Firm Est Date\", \"\"), (\"Firm Last Update\", \"\"), (\"Firm Address Street\", \"\"), (\"Firm Entity Type\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Legal Name\", \"root\".FIRM_DETAILS['employeeCount'] as \"Firm Employee Count\", \"root\".FIRM_DETAILS['mnc'] as \"Firm MNC\", \"root\".FIRM_DETAILS['estDate']::date as \"Firm Est Date\", \"root\".FIRM_DETAILS['lastUpdate']::timestamp as \"Firm Last Update\", \"root\".FIRM_DETAILS['address']['street']::varchar as \"Firm Address Street\", \"root\".FIRM_DETAILS['entityType']::varchar as \"Firm Entity Type\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\"), (Firm Employee Count, Integer, \"\", \"\"), (Firm MNC, Boolean, \"\", \"\"), (Firm Est Date, StrictDate, \"\", \"\"), (Firm Last Update, DateTime, \"\", \"\"), (Firm Address Street, String, \"\", \"\"), (Firm Entity Type, simple::model::EntityType, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\"), (Firm Employee Count, Integer, BIGINT, \"\"), (Firm MNC, Boolean, BIT, \"\"), (Firm Est Date, StrictDate, DATE, \"\"), (Firm Last Update, DateTime, TIMESTAMP, \"\"), (Firm Address Street, String, VARCHAR(65536), \"\"), (Firm Entity Type, simple::model::EntityType, \"\", \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -268,12 +268,12 @@ public void testSemiStructuredArrayElementAccessPrimitive() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Other Name 0, String, \"\", \"\"), (Firm Other Name 1, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Other Name 0, String, VARCHAR(65536), \"\"), (Firm Other Name 1, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Other Name 0\", \"\"), (\"Firm Other Name 1\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['otherNames'][0]::varchar as \"Firm Other Name 0\", \"root\".FIRM_DETAILS['otherNames'][1]::varchar as \"Firm Other Name 1\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Other Name 0, String, \"\", \"\"), (Firm Other Name 1, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Other Name 0, String, VARCHAR(65536), \"\"), (Firm Other Name 1, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -285,12 +285,12 @@ public void testSemiStructuredArrayElementAccessComplex() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Line 0, String, \"\", \"\"), (Firm Address Line 1, String, \"\", \"\"), (Firm Address Line 2, String, \"\", \"\"), (Firm Address Line 3, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Line 0, String, VARCHAR(65536), \"\"), (Firm Address Line 1, String, VARCHAR(65536), \"\"), (Firm Address Line 2, String, VARCHAR(65536), \"\"), (Firm Address Line 3, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address Line 0\", \"\"), (\"Firm Address Line 1\", \"\"), (\"Firm Address Line 2\", \"\"), (\"Firm Address Line 3\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['address']['lines'][0]['details']::varchar as \"Firm Address Line 0\", \"root\".FIRM_DETAILS['address']['lines'][1]['details']::varchar as \"Firm Address Line 1\", \"root\".FIRM_DETAILS['address']['lines'][2]['details']::varchar as \"Firm Address Line 2\", \"root\".FIRM_DETAILS['address']['lines'][3]['details']::varchar as \"Firm Address Line 3\" from PERSON_SCHEMA.PERSON_TABLE as \"root\"\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Line 0, String, \"\", \"\"), (Firm Address Line 1, String, \"\", \"\"), (Firm Address Line 2, String, \"\", \"\"), (Firm Address Line 3, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Line 0, String, VARCHAR(65536), \"\"), (Firm Address Line 1, String, VARCHAR(65536), \"\"), (Firm Address Line 2, String, VARCHAR(65536), \"\"), (Firm Address Line 3, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -302,12 +302,12 @@ public void testSemiStructuredPropertyAccessAtNestedProperty() String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Manager Firm Name, String, \"\", \"\"), (Manager Manager Firm Name, String, \"\", \"\"), (Manager Manager Manager Firm Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Manager Firm Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Manager Firm Name\", \"\"), (\"Manager Manager Firm Name\", \"\"), (\"Manager Manager Manager Firm Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"person_table_1\".FIRM_DETAILS['legalName']::varchar as \"Manager Firm Name\", \"person_table_2\".FIRM_DETAILS['legalName']::varchar as \"Manager Manager Firm Name\", \"person_table_3\".FIRM_DETAILS['legalName']::varchar as \"Manager Manager Manager Firm Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_1\" on (\"root\".MANAGERID = \"person_table_1\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_2\" on (\"person_table_1\".MANAGERID = \"person_table_2\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_3\" on (\"person_table_2\".MANAGERID = \"person_table_3\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Manager Firm Name, String, \"\", \"\"), (Manager Manager Firm Name, String, \"\", \"\"), (Manager Manager Manager Firm Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Manager Firm Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } @@ -319,12 +319,12 @@ public void testSemiStructuredPropertyAccessAtNestedPropertyWithProjectFunctions String snowflakeExpected = " Relational\n" + " (\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Manager Firm Name, String, \"\", \"\"), (Manager Manager Firm Name, String, \"\", \"\"), (Manager Manager Manager Firm Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Manager Firm Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Manager Firm Name\", \"\"), (\"Manager Manager Firm Name\", \"\"), (\"Manager Manager Manager Firm Name\", \"\")]\n" + " sql = select \"root\".FIRSTNAME as \"First Name\", \"root\".FIRM_DETAILS['legalName']::varchar as \"Firm Name\", \"person_table_1\".FIRM_DETAILS['legalName']::varchar as \"Manager Firm Name\", \"person_table_2\".FIRM_DETAILS['legalName']::varchar as \"Manager Manager Firm Name\", \"person_table_3\".FIRM_DETAILS['legalName']::varchar as \"Manager Manager Manager Firm Name\" from PERSON_SCHEMA.PERSON_TABLE as \"root\" left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_1\" on (\"root\".MANAGERID = \"person_table_1\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_2\" on (\"person_table_1\".MANAGERID = \"person_table_2\".ID) left outer join PERSON_SCHEMA.PERSON_TABLE as \"person_table_3\" on (\"person_table_2\".MANAGERID = \"person_table_3\".ID)\n" + " connection = RelationalDatabaseConnection(type = \"Snowflake\")\n" + " )\n"; - String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Manager Firm Name, String, \"\", \"\"), (Manager Manager Firm Name, String, \"\", \"\"), (Manager Manager Manager Firm Name, String, \"\", \"\")]\n"; + String TDSType = " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Manager Firm Name, String, VARCHAR(65536), \"\")]\n"; Assert.assertEquals(wrapPreAndFinallyExecutionSqlQuery(TDSType, snowflakeExpected), snowflakePlan); } diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestExtractFromSemiStructuredJoin.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestExtractFromSemiStructuredJoin.java index d7f0fff3fd7..8fa30338f8b 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestExtractFromSemiStructuredJoin.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestExtractFromSemiStructuredJoin.java @@ -42,7 +42,7 @@ public void testJoinOnSemiStructuredProperty() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Last Name, String, VARCHAR(100), \"\"), (Firm/Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Last Name, String, VARCHAR(100), \"\"), (Firm/Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Last Name\", VARCHAR(100)), (\"Firm/Legal Name\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.LASTNAME as `Last Name`, `firm_table_0`.FIRM_DETAILS::$legalName as `Firm/Legal Name` from PERSON_SCHEMA.PERSON_TABLE as `root` left outer join FIRM_SCHEMA.FIRM_TABLE as `firm_table_0` on (json_extract_bigint(`root`.FIRM, 'ID') = json_extract_bigint(`firm_table_0`.FIRM_DETAILS, 'ID'))\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestExtractFromSemiStructuredSimple.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestExtractFromSemiStructuredSimple.java index 55ecb6269bc..d0c4f3e3681 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestExtractFromSemiStructuredSimple.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestExtractFromSemiStructuredSimple.java @@ -34,7 +34,7 @@ public void testDotAndBracketNotationAccess() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Id, Integer, INT, \"\"), (Dot Only, StrictDate, \"\", \"\"), (Bracket Only, DateTime, \"\", \"\"), (Dot & Bracket, String, \"\", \"\")]\n" + + " type = TDS[(Id, Integer, INT, \"\"), (Dot Only, StrictDate, DATE, \"\"), (Bracket Only, DateTime, TIMESTAMP, \"\"), (Dot & Bracket, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Id\", INT), (\"Dot Only\", \"\"), (\"Bracket Only\", \"\"), (\"Dot & Bracket\", \"\")]\n" + " sql = select `root`.ID as `Id`, date(json_extract_string(`root`.FIRM_DETAILS, 'dates', 'estDate')) as `Dot Only`, timestamp(json_extract_string(`root`.FIRM_DETAILS, 'dates', 'last Update')) as `Bracket Only`, json_extract_string(`root`.FIRM_DETAILS, 'address', 'lines', '1', 'details') as `Dot & Bracket` from FIRM_SCHEMA.FIRM_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -56,7 +56,7 @@ public void testArrayElementNoFlattenAccess() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Id, Integer, INT, \"\"), (Second Line of Address, String, \"\", \"\")]\n" + + " type = TDS[(Id, Integer, INT, \"\"), (Second Line of Address, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Id\", INT), (\"Second Line of Address\", \"\")]\n" + " sql = select `root`.ID as `Id`, json_extract_string(`root`.FIRM_DETAILS, 'address', 'lines', '1', 'details') as `Second Line of Address` from FIRM_SCHEMA.FIRM_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -101,7 +101,7 @@ public void testAllDataTypesAccess() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Id, Integer, INT, \"\"), (Legal Name, String, \"\", \"\"), (Est Date, StrictDate, \"\", \"\"), (Mnc, Boolean, \"\", \"\"), (Employee Count, Integer, \"\", \"\"), (Revenue, Float, \"\", \"\"), (Last Update, DateTime, \"\", \"\")]\n" + + " type = TDS[(Id, Integer, INT, \"\"), (Legal Name, String, VARCHAR(65536), \"\"), (Est Date, StrictDate, DATE, \"\"), (Mnc, Boolean, BIT, \"\"), (Employee Count, Integer, BIGINT, \"\"), (Revenue, Float, FLOAT, \"\"), (Last Update, DateTime, TIMESTAMP, \"\")]\n" + " resultColumns = [(\"Id\", INT), (\"Legal Name\", \"\"), (\"Est Date\", \"\"), (\"Mnc\", \"\"), (\"Employee Count\", \"\"), (\"Revenue\", \"\"), (\"Last Update\", \"\")]\n" + " sql = select `root`.ID as `Id`, json_extract_string(`root`.FIRM_DETAILS, 'legalName') as `Legal Name`, date(json_extract_string(`root`.FIRM_DETAILS, 'dates', 'estDate')) as `Est Date`, json_extract_json(`root`.FIRM_DETAILS, 'mnc') as `Mnc`, json_extract_bigint(`root`.FIRM_DETAILS, 'employeeCount') as `Employee Count`, json_extract_double(`root`.FIRM_DETAILS, 'revenue') as `Revenue`, timestamp(json_extract_string(`root`.FIRM_DETAILS, 'dates', 'last Update')) as `Last Update` from FIRM_SCHEMA.FIRM_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredInheritanceMapping.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredInheritanceMapping.java index e503825ada0..b613037365b 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredInheritanceMapping.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredInheritanceMapping.java @@ -34,7 +34,7 @@ public void testSemiStructuredPropertyAccessAtBaseClass() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address Name\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::address::$name as `Firm Address Name` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -60,7 +60,7 @@ public void testSemiStructuredPropertyAccessAtSubClass() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address 0 Line No\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::address::`lines`::`0`::lineno !:> bigint as `Firm Address 0 Line No` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -86,7 +86,7 @@ public void testSemiStructuredPropertyAccessAtSubClassNested() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, \"\", \"\"), (Firm Address Street, String, \"\", \"\"), (Firm Address City, String, \"\", \"\"), (Firm Address State, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, BIGINT, \"\"), (Firm Address Street, String, VARCHAR(65536), \"\"), (Firm Address City, String, VARCHAR(65536), \"\"), (Firm Address State, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address 0 Line No\", \"\"), (\"Firm Address Street\", \"\"), (\"Firm Address City\", \"\"), (\"Firm Address State\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::address::`lines`::`0`::lineno !:> bigint as `Firm Address 0 Line No`, `root`.FIRM_DETAILS::address::`lines`::`0`::$street as `Firm Address Street`, `root`.FIRM_DETAILS::address::`lines`::`1`::$city as `Firm Address City`, `root`.FIRM_DETAILS::address::`lines`::`2`::$state as `Firm Address State` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -112,7 +112,7 @@ public void testSemiStructuredPropertyAccessAtSubClassNestedUsingProjectWithFunc String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, \"\", \"\"), (Firm Address Street, String, \"\", \"\"), (Firm Address City, String, \"\", \"\"), (Firm Address State, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address 0 Line No, Integer, BIGINT, \"\"), (Firm Address Street, String, VARCHAR(65536), \"\"), (Firm Address City, String, VARCHAR(65536), \"\"), (Firm Address State, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address 0 Line No\", \"\"), (\"Firm Address Street\", \"\"), (\"Firm Address City\", \"\"), (\"Firm Address State\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::address::`lines`::`0`::lineno !:> bigint as `Firm Address 0 Line No`, `root`.FIRM_DETAILS::address::`lines`::`0`::$street as `Firm Address Street`, `root`.FIRM_DETAILS::address::`lines`::`1`::$city as `Firm Address City`, `root`.FIRM_DETAILS::address::`lines`::`2`::$state as `Firm Address State` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredJoinChainMapping.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredJoinChainMapping.java index 1480823989e..258b7ae20ce 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredJoinChainMapping.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredJoinChainMapping.java @@ -31,7 +31,7 @@ public void testSingleJoinInChain() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Manager Firm Legal Name\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `person_table_1`.FIRM_DETAILS::$legalName as `Manager Firm Legal Name` from PERSON_SCHEMA.PERSON_TABLE as `root` left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_1` on (`root`.MANAGERID = `person_table_1`.ID)\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -48,7 +48,7 @@ public void testMultipleJoinsInChain() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, \"\", \"\"), (Manager Manager Firm Legal Name, String, \"\", \"\"), (Manager Manager Firm Legal Name Dup1, String, \"\", \"\"), (Manager Manager Firm Legal Name Dup2, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name Dup1, String, VARCHAR(65536), \"\"), (Manager Manager Firm Legal Name Dup2, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Manager Firm Legal Name\", \"\"), (\"Manager Manager Firm Legal Name\", \"\"), (\"Manager Manager Firm Legal Name Dup1\", \"\"), (\"Manager Manager Firm Legal Name Dup2\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `person_table_1`.FIRM_DETAILS::$legalName as `Manager Firm Legal Name`, `person_table_2`.FIRM_DETAILS::$legalName as `Manager Manager Firm Legal Name`, `person_table_3`.FIRM_DETAILS::$legalName as `Manager Manager Firm Legal Name Dup1`, `person_table_5`.FIRM_DETAILS::$legalName as `Manager Manager Firm Legal Name Dup2` from PERSON_SCHEMA.PERSON_TABLE as `root` left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_1` on (`root`.MANAGERID = `person_table_1`.ID) left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_2` on (`person_table_1`.MANAGERID = `person_table_2`.ID) left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_3` on (`person_table_1`.MANAGERID = `person_table_3`.ID) left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_4` on (`root`.MANAGERID = `person_table_4`.ID) left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_5` on (`person_table_4`.MANAGERID = `person_table_5`.ID)\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredMatching.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredMatching.java index 7449710072f..f823d23ed0a 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredMatching.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredMatching.java @@ -33,7 +33,7 @@ public void testSemiStructuredMatchComplexProperty() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Customer Address, String, \"\", \"\")]\n" + + " type = TDS[(Customer Address, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Customer Address\", \"\")]\n" + " sql = select case when `root`.CUSTOMER::customerAddress::$@type in ('BillingAddress') then `root`.CUSTOMER::customerAddress::$billAddress when `root`.CUSTOMER::customerAddress::$@type in ('ShippingAddress') then `root`.CUSTOMER::customerAddress::$shipAddress else 'Default Address' end as `Customer Address` from ORDER_SCHEMA.ORDER_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -61,7 +61,7 @@ public void testSemiStructuredMatchWithMultipleProject() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Customer Address, String, \"\", \"\"), (Order Price, Integer, \"\", \"\")]\n" + + " type = TDS[(Customer Address, String, VARCHAR(65536), \"\"), (Order Price, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"Customer Address\", \"\"), (\"Order Price\", \"\")]\n" + " sql = select case when `root`.CUSTOMER::customerAddress::$@type in ('BillingAddress') then `root`.CUSTOMER::customerAddress::$billAddress when `root`.CUSTOMER::customerAddress::$@type in ('ShippingAddress') then `root`.CUSTOMER::customerAddress::$shipAddress else null end as `Customer Address`, case when `root`.CUSTOMER::transactionDetails::payment::$@type in ('CashOnDeliveryPayment') then `root`.CUSTOMER::transactionDetails::payment::amountToBePaid !:> bigint when `root`.CUSTOMER::transactionDetails::payment::$@type in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then `root`.CUSTOMER::transactionDetails::payment::amountPaid !:> bigint else null end as `Order Price` from ORDER_SCHEMA.ORDER_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -89,7 +89,7 @@ public void testSemiStructuredMatchWithComplexFilter() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Customer Address, String, \"\", \"\")]\n" + + " type = TDS[(Customer Address, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Customer Address\", \"\")]\n" + " sql = select case when `root`.CUSTOMER::customerAddress::$@type in ('BillingAddress') then `root`.CUSTOMER::customerAddress::$billAddress when `root`.CUSTOMER::customerAddress::$@type in ('ShippingAddress') then `root`.CUSTOMER::customerAddress::$shipAddress else null end as `Customer Address` from ORDER_SCHEMA.ORDER_TABLE as `root` where case when `root`.CUSTOMER::transactionDetails::payment::$@type in ('CashOnDeliveryPayment') then `root`.CUSTOMER::transactionDetails::payment::amountToBePaid !:> bigint when `root`.CUSTOMER::transactionDetails::payment::$@type in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then `root`.CUSTOMER::transactionDetails::payment::amountPaid !:> bigint else null end < 200\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -115,7 +115,7 @@ public void testSemiStructuredMatchWithVariableAccess() String memSQLExpected = "Sequence\n" + "(\n" + - " type = TDS[(Max Amount Flag, Boolean, \"\", \"\")]\n" + + " type = TDS[(Max Amount Flag, Boolean, BIT, \"\")]\n" + " (\n" + " Allocation\n" + " (\n" + @@ -134,7 +134,7 @@ public void testSemiStructuredMatchWithVariableAccess() " )\n" + " Relational\n" + " (\n" + - " type = TDS[(Max Amount Flag, Boolean, \"\", \"\")]\n" + + " type = TDS[(Max Amount Flag, Boolean, BIT, \"\")]\n" + " resultColumns = [(\"Max Amount Flag\", \"\")]\n" + " sql = select case when `root`.CUSTOMER::transactionDetails::payment::$@type in ('CashOnDeliveryPayment') then case when `root`.CUSTOMER::transactionDetails::payment::amountToBePaid !:> bigint < ${maxAmount} then 'true' else 'false' end when `root`.CUSTOMER::transactionDetails::payment::$@type in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then case when `root`.CUSTOMER::transactionDetails::payment::amountPaid !:> bigint < ${maxAmount} then 'true' else 'false' end else null end as `Max Amount Flag` from ORDER_SCHEMA.ORDER_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -164,7 +164,7 @@ public void testSemiStructuredMatchMultilevel() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Amount, Integer, \"\", \"\")]\n" + + " type = TDS[(Amount, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"Amount\", \"\")]\n" + " sql = select case when `root`.CUSTOMER::transactionDetails::payment::$@type in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then case when `root`.CUSTOMER::transactionDetails::payment::$@type in ('WalletPrepaidPayment') then `root`.CUSTOMER::transactionDetails::payment::walletTransactionAmount !:> bigint when `root`.CUSTOMER::transactionDetails::payment::$@type in ('CardPrepaidPayment') then `root`.CUSTOMER::transactionDetails::payment::cardTransactionAmount !:> bigint when `root`.CUSTOMER::transactionDetails::payment::$@type in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then `root`.CUSTOMER::transactionDetails::payment::amountPaid !:> bigint else null end when `root`.CUSTOMER::transactionDetails::payment::$@type in ('CashOnDeliveryPayment') then `root`.CUSTOMER::transactionDetails::payment::amountToBePaid !:> bigint else null end as `Amount` from ORDER_SCHEMA.ORDER_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -192,7 +192,7 @@ public void testSemiStructuredMatchWithMultipleProjectUsingCol() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Customer Address, String, \"\", \"\"), (Order Price, Integer, \"\", \"\")]\n" + + " type = TDS[(Customer Address, String, VARCHAR(65536), \"\"), (Order Price, Integer, BIGINT, \"\")]\n" + " resultColumns = [(\"Customer Address\", \"\"), (\"Order Price\", \"\")]\n" + " sql = select case when `root`.CUSTOMER::customerAddress::$@type in ('BillingAddress') then `root`.CUSTOMER::customerAddress::$billAddress when `root`.CUSTOMER::customerAddress::$@type in ('ShippingAddress') then `root`.CUSTOMER::customerAddress::$shipAddress else null end as `Customer Address`, case when `root`.CUSTOMER::transactionDetails::payment::$@type in ('CashOnDeliveryPayment') then `root`.CUSTOMER::transactionDetails::payment::amountToBePaid !:> bigint when `root`.CUSTOMER::transactionDetails::payment::$@type in ('PrepaidPayment', 'WalletPrepaidPayment', 'CardPrepaidPayment') then `root`.CUSTOMER::transactionDetails::payment::amountPaid !:> bigint else null end as `Order Price` from ORDER_SCHEMA.ORDER_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredMultiBindingMapping.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredMultiBindingMapping.java index 026e780fc9d..2f4b9397a6c 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredMultiBindingMapping.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSemiStructuredMultiBindingMapping.java @@ -33,7 +33,7 @@ public void testSemiStructuredPropertyAccessFromSingleBindingMapping() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Address Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Address Name\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.ADDRESS_DETAILS::$name as `Address Name` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -58,7 +58,7 @@ public void testSemiStructuredPropertyAccessFromMultipleBindingMapping() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\"), (Address Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\"), (Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Legal Name\", \"\"), (\"Address Name\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::$legalName as `Firm Legal Name`, `root`.ADDRESS_DETAILS::$name as `Address Name` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -83,7 +83,7 @@ public void testSemiStructuredRelOpWithJoinPropertyAccessFromMultipleBindingMapp String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\"), (Address Name, String, \"\", \"\"), (Manager Firm Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\"), (Address Name, String, VARCHAR(65536), \"\"), (Manager Firm Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Legal Name\", \"\"), (\"Address Name\", \"\"), (\"Manager Firm Legal Name\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::$legalName as `Firm Legal Name`, `root`.ADDRESS_DETAILS::$name as `Address Name`, `person_table_1`.FIRM_DETAILS::$legalName as `Manager Firm Legal Name` from PERSON_SCHEMA.PERSON_TABLE as `root` left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_1` on (`root`.MANAGERID = `person_table_1`.ID)\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSimpleSemiStructuredMapping.java b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSimpleSemiStructuredMapping.java index b3f716ad1b7..4849e0d4a89 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSimpleSemiStructuredMapping.java +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-execution/legend-engine-xt-relationalStore-executionPlan/src/test/java/org/finos/legend/engine/plan/execution/stores/relational/test/semiStructured/TestSimpleSemiStructuredMapping.java @@ -34,7 +34,7 @@ public void testSingleSemiStructuredPropertyAccess() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Firm Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(Firm Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Firm Legal Name\", \"\")]\n" + " sql = select `root`.FIRM_DETAILS::$legalName as `Firm Legal Name` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -60,7 +60,7 @@ public void testCombinedPrimitiveAndSemiStructuredPropertyAccessParallel() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Legal Name\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::$legalName as `Firm Legal Name` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -86,7 +86,7 @@ public void testCombinedPrimitiveAndSemiStructuredPropertyAccess() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Out Col, String, \"\", \"\")]\n" + + " type = TDS[(Out Col, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Out Col\", \"\")]\n" + " sql = select concat(`root`.FIRSTNAME, ' : ', `root`.FIRM_DETAILS::$legalName) as `Out Col` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -112,7 +112,7 @@ public void testCombinedComplexAndSemiStructuredPropertyAccessParallel() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Manager First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\")]\n" + + " type = TDS[(Manager First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Manager First Name\", VARCHAR(100)), (\"Firm Legal Name\", \"\")]\n" + " sql = select `person_table_1`.FIRSTNAME as `Manager First Name`, `root`.FIRM_DETAILS::$legalName as `Firm Legal Name` from PERSON_SCHEMA.PERSON_TABLE as `root` left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_1` on (`root`.MANAGERID = `person_table_1`.ID)\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -138,7 +138,7 @@ public void testCombinedComplexAndSemiStructuredPropertyAccess() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Out Col, String, \"\", \"\")]\n" + + " type = TDS[(Out Col, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Out Col\", \"\")]\n" + " sql = select concat(case when `person_table_1`.FIRSTNAME is null then 'NULL' else `person_table_1`.FIRSTNAME end, ' : ', `root`.FIRM_DETAILS::$legalName) as `Out Col` from PERSON_SCHEMA.PERSON_TABLE as `root` left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_1` on (`root`.MANAGERID = `person_table_1`.ID)\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -164,7 +164,7 @@ public void testNestedSemiStructuredPropertyAccess() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Firm Address Name, String, \"\", \"\")]\n" + + " type = TDS[(Firm Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Firm Address Name\", \"\")]\n" + " sql = select `root`.FIRM_DETAILS::address::$name as `Firm Address Name` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -190,7 +190,7 @@ public void testMultipleSemiStructuredPropertyAccess() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Firm Legal Name, String, \"\", \"\"), (Firm Address Name, String, \"\", \"\")]\n" + + " type = TDS[(Firm Legal Name, String, VARCHAR(65536), \"\"), (Firm Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Firm Legal Name\", \"\"), (\"Firm Address Name\", \"\")]\n" + " sql = select `root`.FIRM_DETAILS::$legalName as `Firm Legal Name`, `root`.FIRM_DETAILS::address::$name as `Firm Address Name` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -216,7 +216,7 @@ public void testMultipleSemiStructuredPropertyAccessCombined() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Firm Legal Name And Address Name, String, \"\", \"\")]\n" + + " type = TDS[(Firm Legal Name And Address Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"Firm Legal Name And Address Name\", \"\")]\n" + " sql = select concat(`root`.FIRM_DETAILS::$legalName, `root`.FIRM_DETAILS::address::$name) as `Firm Legal Name And Address Name` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -265,7 +265,7 @@ public void testGroupByWithSemiStructuredProperty() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(Address, String, \"\", \"\"), (Names, String, VARCHAR(200), \"\")]\n" + + " type = TDS[(Address, String, VARCHAR(65536), \"\"), (Names, String, VARCHAR(200), \"\")]\n" + " resultColumns = [(\"Address\", \"\"), (\"Names\", \"\")]\n" + " sql = select `root`.FIRM_DETAILS::address::$name as `Address`, group_concat(`root`.FIRSTNAME separator ';') as `Names` from PERSON_SCHEMA.PERSON_TABLE as `root` group by `Address`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -313,7 +313,7 @@ public void testIsEmptyCheckOnSemiStructuredPrimitivePropertyAccess() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Street, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Street, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"First Address Street\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, case when `root`.FIRM_DETAILS::address::$street is null then 'NULL' else `root`.FIRM_DETAILS::address::$street end as `First Address Street` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -339,7 +339,7 @@ public void testIsEmptyCheckOnSemiStructuredPropertyAccessAfterAt() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Line, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (First Address Line, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"First Address Line\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, case when `root`.FIRM_DETAILS::address::`lines`::`2`::$details is null then 'NULL' else `root`.FIRM_DETAILS::address::`lines`::`2`::$details end as `First Address Line` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -365,7 +365,7 @@ public void testSemiStructuredDifferentDataTypePropertyAccess() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, \"\", \"\"), (Firm Employee Count, Integer, \"\", \"\"), (Firm Revenue, Float, \"\", \"\"), (Firm MNC, Boolean, \"\", \"\"), (Firm Est Date, StrictDate, \"\", \"\"), (Firm Last Update, DateTime, \"\", \"\"), (Firm Address Street, String, \"\", \"\"), (Firm Entity Type, simple::model::EntityType, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Legal Name, String, VARCHAR(65536), \"\"), (Firm Employee Count, Integer, BIGINT, \"\"), (Firm Revenue, Float, FLOAT, \"\"), (Firm MNC, Boolean, BIT, \"\"), (Firm Est Date, StrictDate, DATE, \"\"), (Firm Last Update, DateTime, TIMESTAMP, \"\"), (Firm Address Street, String, VARCHAR(65536), \"\"), (Firm Entity Type, simple::model::EntityType, \"\", \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Legal Name\", \"\"), (\"Firm Employee Count\", \"\"), (\"Firm Revenue\", \"\"), (\"Firm MNC\", \"\"), (\"Firm Est Date\", \"\"), (\"Firm Last Update\", \"\"), (\"Firm Address Street\", \"\"), (\"Firm Entity Type\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::$legalName as `Firm Legal Name`, `root`.FIRM_DETAILS::employeeCount !:> bigint as `Firm Employee Count`, `root`.FIRM_DETAILS::%revenue as `Firm Revenue`, `root`.FIRM_DETAILS::mnc as `Firm MNC`, date(`root`.FIRM_DETAILS::$estDate) as `Firm Est Date`, timestamp(`root`.FIRM_DETAILS::$lastUpdate) as `Firm Last Update`, `root`.FIRM_DETAILS::address::$street as `Firm Address Street`, `root`.FIRM_DETAILS::$entityType as `Firm Entity Type` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -393,7 +393,7 @@ public void testSemiStructuredArrayElementAccessPrimitive() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Other Name 0, String, \"\", \"\"), (Firm Other Name 1, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Other Name 0, String, VARCHAR(65536), \"\"), (Firm Other Name 1, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Other Name 0\", \"\"), (\"Firm Other Name 1\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::otherNames::$`0` as `Firm Other Name 0`, `root`.FIRM_DETAILS::otherNames::$`1` as `Firm Other Name 1` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -419,7 +419,7 @@ public void testSemiStructuredArrayElementAccessComplex() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Line 0, String, \"\", \"\"), (Firm Address Line 1, String, \"\", \"\"), (Firm Address Line 2, String, \"\", \"\"), (Firm Address Line 3, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Address Line 0, String, VARCHAR(65536), \"\"), (Firm Address Line 1, String, VARCHAR(65536), \"\"), (Firm Address Line 2, String, VARCHAR(65536), \"\"), (Firm Address Line 3, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Address Line 0\", \"\"), (\"Firm Address Line 1\", \"\"), (\"Firm Address Line 2\", \"\"), (\"Firm Address Line 3\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::address::`lines`::`0`::$details as `Firm Address Line 0`, `root`.FIRM_DETAILS::address::`lines`::`1`::$details as `Firm Address Line 1`, `root`.FIRM_DETAILS::address::`lines`::`2`::$details as `Firm Address Line 2`, `root`.FIRM_DETAILS::address::`lines`::`3`::$details as `Firm Address Line 3` from PERSON_SCHEMA.PERSON_TABLE as `root`\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -445,7 +445,7 @@ public void testSemiStructuredPropertyAccessAtNestedProperty() String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Manager Firm Name, String, \"\", \"\"), (Manager Manager Firm Name, String, \"\", \"\"), (Manager Manager Manager Firm Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Manager Firm Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Manager Firm Name\", \"\"), (\"Manager Manager Firm Name\", \"\"), (\"Manager Manager Manager Firm Name\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::$legalName as `Firm Name`, `person_table_1`.FIRM_DETAILS::$legalName as `Manager Firm Name`, `person_table_2`.FIRM_DETAILS::$legalName as `Manager Manager Firm Name`, `person_table_3`.FIRM_DETAILS::$legalName as `Manager Manager Manager Firm Name` from PERSON_SCHEMA.PERSON_TABLE as `root` left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_1` on (`root`.MANAGERID = `person_table_1`.ID) left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_2` on (`person_table_1`.MANAGERID = `person_table_2`.ID) left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_3` on (`person_table_2`.MANAGERID = `person_table_3`.ID)\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + @@ -471,7 +471,7 @@ public void testSemiStructuredPropertyAccessAtNestedPropertyWithProjectFunctions String memSQLExpected = "Relational\n" + "(\n" + - " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, \"\", \"\"), (Manager Firm Name, String, \"\", \"\"), (Manager Manager Firm Name, String, \"\", \"\"), (Manager Manager Manager Firm Name, String, \"\", \"\")]\n" + + " type = TDS[(First Name, String, VARCHAR(100), \"\"), (Firm Name, String, VARCHAR(65536), \"\"), (Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Firm Name, String, VARCHAR(65536), \"\"), (Manager Manager Manager Firm Name, String, VARCHAR(65536), \"\")]\n" + " resultColumns = [(\"First Name\", VARCHAR(100)), (\"Firm Name\", \"\"), (\"Manager Firm Name\", \"\"), (\"Manager Manager Firm Name\", \"\"), (\"Manager Manager Manager Firm Name\", \"\")]\n" + " sql = select `root`.FIRSTNAME as `First Name`, `root`.FIRM_DETAILS::$legalName as `Firm Name`, `person_table_1`.FIRM_DETAILS::$legalName as `Manager Firm Name`, `person_table_2`.FIRM_DETAILS::$legalName as `Manager Manager Firm Name`, `person_table_3`.FIRM_DETAILS::$legalName as `Manager Manager Manager Firm Name` from PERSON_SCHEMA.PERSON_TABLE as `root` left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_1` on (`root`.MANAGERID = `person_table_1`.ID) left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_2` on (`person_table_1`.MANAGERID = `person_table_2`.ID) left outer join PERSON_SCHEMA.PERSON_TABLE as `person_table_3` on (`person_table_2`.MANAGERID = `person_table_3`.ID)\n" + " connection = RelationalDatabaseConnection(type = \"MemSQL\")\n" + diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/executionPlan/tests/executionPlanTest.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/executionPlan/tests/executionPlanTest.pure index bb188e7500c..43f8deb84b8 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/executionPlan/tests/executionPlanTest.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/executionPlan/tests/executionPlanTest.pure @@ -829,7 +829,7 @@ function <> meta::pure::executionPlan::tests::testIfEnumParameterInPr let resultForIf = $generatedPlanForIf->planToString(meta::relational::extension::relationalExtensions()); let expected = 'Sequence\n'+ '(\n'+ - ' type = TDS[(name, String, "", ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ + ' type = TDS[(name, String, VARCHAR(65536), ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ ' (\n'+ ' FunctionParametersValidationNode\n'+ ' (\n'+ @@ -837,7 +837,7 @@ function <> meta::pure::executionPlan::tests::testIfEnumParameterInPr ' )\n'+ ' Relational\n'+ ' (\n'+ - ' type = TDS[(name, String, "", ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ + ' type = TDS[(name, String, VARCHAR(65536), ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ ' resultColumns = [("name", ""), ("active", INT)]\n'+ ' sql = select case when \'${yesOrNo}\' = \'NO\' then \'InActive User\' else "root".name end as "name", "root".active as "active" from employeeTable as "root"\n'+ ' connection = TestDatabaseConnection(type = "H2")\n'+ @@ -856,7 +856,7 @@ function <> meta::pure::executionPlan::tests::testIfEnumParameterWith let resultForIf = $generatedPlanForIf->planToString(meta::relational::extension::relationalExtensions()); let expected = 'Sequence\n'+ '(\n'+ - ' type = TDS[(name, String, "", ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ + ' type = TDS[(name, String, VARCHAR(65536), ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ ' (\n'+ ' FunctionParametersValidationNode\n'+ ' (\n'+ @@ -864,7 +864,7 @@ function <> meta::pure::executionPlan::tests::testIfEnumParameterWith ' )\n'+ ' Relational\n'+ ' (\n'+ - ' type = TDS[(name, String, "", ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ + ' type = TDS[(name, String, VARCHAR(65536), ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ ' resultColumns = [("name", ""), ("active", INT)]\n'+ ' sql = select case when (${optionalVarPlaceHolderOperationSelector(yesOrNo, equalEnumOperationSelector(enumMap_meta_relational_tests_mapping_enumeration_model_mapping_employeeTestMapping_Active(yesOrNo), \'"root".active in (${enumMap_meta_relational_tests_mapping_enumeration_model_mapping_employeeTestMapping_Active(yesOrNo)})\', \'"root".active = ${enumMap_meta_relational_tests_mapping_enumeration_model_mapping_employeeTestMapping_Active(yesOrNo)}\'), \'0 = 1\')}) then "root".name else \'InActive User\' end as "name", "root".active as "active" from employeeTable as "root"\n'+ ' connection = TestDatabaseConnection(type = "H2")\n'+ @@ -883,7 +883,7 @@ function <> meta::pure::executionPlan::tests::testIfOpFilterEnumValue let resultForIf = $generatedPlanForIf->planToString(meta::relational::extension::relationalExtensions()); let expected = 'Relational\n'+ '(\n'+ - ' type = TDS[(name, String, "", ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ + ' type = TDS[(name, String, VARCHAR(65536), ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ ' resultColumns = [("name", ""), ("active", INT)]\n'+ ' sql = select case when "root".active = 0 then \'InActive User\' else "root".name end as "name", "root".active as "active" from employeeTable as "root"\n'+ ' connection = TestDatabaseConnection(type = "H2")\n'+ @@ -899,7 +899,7 @@ function <> meta::pure::executionPlan::tests::testOptionalEnumParamet let resultForIf = $generatedPlanForIf->planToString(meta::relational::extension::relationalExtensions()); let expected = 'Sequence\n'+ '(\n'+ - ' type = TDS[(name, String, "", ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ + ' type = TDS[(name, String, VARCHAR(65536), ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ ' (\n'+ ' FunctionParametersValidationNode\n'+ ' (\n'+ @@ -907,7 +907,7 @@ function <> meta::pure::executionPlan::tests::testOptionalEnumParamet ' )\n'+ ' Relational\n'+ ' (\n'+ - ' type = TDS[(name, String, "", ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ + ' type = TDS[(name, String, VARCHAR(65536), ""), (active, meta::relational::tests::mapping::enumeration::model::domain::YesNo, INT, "", Active)]\n'+ ' resultColumns = [("name", ""), ("active", INT)]\n'+ ' sql = select case when (${optionalVarPlaceHolderOperationSelector(yesOrNo![], equalEnumOperationSelector(enumMap_meta_relational_tests_mapping_enumeration_model_mapping_employeeTestMapping_Active(yesOrNo![]), \'"root".active in (${enumMap_meta_relational_tests_mapping_enumeration_model_mapping_employeeTestMapping_Active(yesOrNo![])})\', \'"root".active = ${enumMap_meta_relational_tests_mapping_enumeration_model_mapping_employeeTestMapping_Active(yesOrNo![])}\'), \'0 = 1\')}) then \'InActive User\' else "root".name end as "name", "root".active as "active" from employeeTable as "root"\n'+ ' connection = TestDatabaseConnection(type = "H2")\n'+ @@ -1986,7 +1986,7 @@ function <> meta::pure::executionPlan::tests::testModelConnectionSimp let expected = 'Relational\n'+ '(\n'+ - ' type = TDS[(legalName, String, "", ""), (Firm Instance Count, Integer, INT, "")]\n'+ + ' type = TDS[(legalName, String, VARCHAR(65536), ""), (Firm Instance Count, Integer, INT, "")]\n'+ ' resultColumns = [("legalName", VARCHAR(200)), ("Firm Instance Count", "")]\n'+ ' sql = select "root".name as "legalName", count("root".name) OVER (Partition By "root".name ) as "Firm Instance Count" from Firm as "root"\n'+ ' connection = TestDatabaseConnection(type = "H2")\n'+ @@ -2011,7 +2011,7 @@ function <> meta::pure::executionPlan::tests::testModelConnectionDeep let expected = 'Relational\n'+ '(\n'+ - ' type = TDS[(firstName, String, "", ""), (lastName, String, "", "")]\n'+ + ' type = TDS[(firstName, String, VARCHAR(65536), ""), (lastName, String, VARCHAR(65536), "")]\n'+ ' resultColumns = [("firstName", ""), ("lastName", "")]\n'+ ' sql = select concat(substring("root".fullname, 0, LOCATE(\' \', "root".fullname)), \'XX\') as "firstName", concat(substring("root".fullname, (LOCATE(\' \', "root".fullname) + 1), char_length("root".fullname)), \'ZZ\') as "lastName" from SPerson as "root"\n'+ ' connection = TestDatabaseConnection(type = "H2")\n'+ @@ -2031,7 +2031,7 @@ function <> meta::pure::executionPlan::tests::testModelConnectionJoin let expected = 'Relational\n'+ '(\n'+ - ' type = TDS[(legalName, String, "", ""), (lastName, String, "", "")]\n'+ + ' type = TDS[(legalName, String, VARCHAR(65536), ""), (lastName, String, VARCHAR(65536), "")]\n'+ ' resultColumns = [("legalName", VARCHAR(200)), ("lastName", "")]\n'+ ' sql = select "root".name as "legalName", substring("person_0".fullname, (LOCATE(\' \', "person_0".fullname) + 1), char_length("person_0".fullname)) as "lastName" from Firm as "root" left outer join Person as "person_0" on ("person_0".firm = "root".name)\n'+ ' connection = TestDatabaseConnection(type = "H2")\n'+ @@ -2053,7 +2053,7 @@ function <> meta::pure::executionPlan::tests::testModelConnectionAgg( let expected = 'Relational\n'+ '(\n'+ - ' type = TDS[(FirstName, String, "", ""), (PersonCount, Integer, INT, "")]\n'+ + ' type = TDS[(FirstName, String, VARCHAR(65536), ""), (PersonCount, Integer, INT, "")]\n'+ ' resultColumns = [("FirstName", ""), ("PersonCount", "")]\n'+ ' sql = select substring("root".fullname, 0, LOCATE(\' \', "root".fullname)) as "FirstName", count(substring("root".fullname, (LOCATE(\' \', "root".fullname) + 1), char_length("root".fullname))) as "PersonCount" from SPerson as "root" group by "FirstName"\n'+ ' connection = TestDatabaseConnection(type = "H2")\n'+ @@ -2081,7 +2081,7 @@ function <> meta::pure::executionPlan::tests::testModelConnectionMult let expected = 'Relational\n'+ '(\n'+ - ' type = TDS[(FirstName, String, "", ""), (PersonCount, Integer, INT, ""), (PersonCountViaSize, Integer, INT, "")]\n'+ + ' type = TDS[(FirstName, String, VARCHAR(65536), ""), (PersonCount, Integer, INT, ""), (PersonCountViaSize, Integer, INT, "")]\n'+ ' resultColumns = [("FirstName", ""), ("PersonCount", ""), ("PersonCountViaSize", "")]\n'+ ' sql = select substring("root".fullname, 0, LOCATE(\' \', "root".fullname)) as "FirstName", count(substring("root".fullname, (LOCATE(\' \', "root".fullname) + 1), char_length("root".fullname))) as "PersonCount", count(substring("root".fullname, 0, LOCATE(\' \', "root".fullname))) as "PersonCountViaSize" from SPerson as "root" group by "FirstName"\n'+ ' connection = TestDatabaseConnection(type = "H2")\n'+ diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/modelToModelToRelational/m2m2rShowcase.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/modelToModelToRelational/m2m2rShowcase.pure index 8f303a87f5b..f1940fb0d1a 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/modelToModelToRelational/m2m2rShowcase.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/modelToModelToRelational/m2m2rShowcase.pure @@ -17,7 +17,7 @@ function <> meta::relational::tests::m2m2r::tes meta::relational::extension::relationalExtensions(), noDebug())->planToString( meta::relational::extension::relationalExtensions()); let expected ='Relational\n' + '(\n' + - ' type = TDS[(name, String, "", ""), (prop1, Boolean, "", "")]\n' + + ' type = TDS[(name, String, VARCHAR(65536), ""), (prop1, Boolean, BIT, "")]\n' + ' resultColumns = [("name", VARCHAR(200)), ("prop1", "")]\n' + ' sql = select "root".name as "name", "sourceannouncement_0".name = \'ha\' as "prop1" from S.sourceEntitlement as "root" left outer join S.SourceAnnouncement as "sourceannouncement_0" on ("root".id = "sourceannouncement_0".id)\n' + ' connection = RelationalDatabaseConnection(type = "H2")\n' + @@ -37,7 +37,7 @@ function <> meta::relational::tests::m2m2r::tes let expected = 'Relational\n' + '(\n' + - ' type = TDS[(name, String, "", ""), (prop2, String, "", "")]\n' + + ' type = TDS[(name, String, VARCHAR(65536), ""), (prop2, String, VARCHAR(65536), "")]\n' + ' resultColumns = [("name", VARCHAR(200)), ("prop2", "")]\n' + ' sql = select "root".name as "name", case when "sourceannouncement_0".description like \'%RECEIVE CASH%\' then \'Cash\' else \'Stock\' end as "prop2" from S.sourceEntitlement as "root" left outer join S.SourceAnnouncement as "sourceannouncement_0" on ("root".id = "sourceannouncement_0".id)\n' + ' connection = RelationalDatabaseConnection(type = "H2")\n' + @@ -57,7 +57,7 @@ function <> meta::relational::tests::m2m2r::tes let expectedLegacyH2 = 'Relational\n' + '(\n' + - ' type = TDS[(name, String, "", ""), (prop3, Number, "", "")]\n' + + ' type = TDS[(name, String, VARCHAR(65536), ""), (prop3, Number, FLOAT, "")]\n' + ' resultColumns = [("name", VARCHAR(200)), ("prop3", "")]\n' + ' sql = select "root".name as "name", case when "sourceannouncement_0".basis = 0.0 then 0.0 else (((1.0 * "root".entitledQuantity) / "sourceannouncement_0".basis) * "sourceannouncement_0".grossRate) end as "prop3" from S.sourceEntitlement as "root" left outer join S.SourceAnnouncement as "sourceannouncement_0" on ("root".id = "sourceannouncement_0".id)\n' + ' connection = RelationalDatabaseConnection(type = "H2")\n' + @@ -65,7 +65,7 @@ function <> meta::relational::tests::m2m2r::tes let expectedNewH2 = 'Relational\n' + '(\n' + - ' type = TDS[(name, String, "", ""), (prop3, Number, "", "")]\n' + + ' type = TDS[(name, String, VARCHAR(65536), ""), (prop3, Number, FLOAT, "")]\n' + ' resultColumns = [("name", VARCHAR(200)), ("prop3", "")]\n' + ' sql = select "root".name as "name", case when "sourceannouncement_0".basis = CAST(0.0 AS FLOAT) then CAST(0.0 AS FLOAT) else (((1.0 * "root".entitledQuantity) / "sourceannouncement_0".basis) * "sourceannouncement_0".grossRate) end as "prop3" from S.sourceEntitlement as "root" left outer join S.SourceAnnouncement as "sourceannouncement_0" on ("root".id = "sourceannouncement_0".id)\n' + ' connection = RelationalDatabaseConnection(type = "H2")\n' + @@ -85,7 +85,7 @@ function <> meta::relational::tests::m2m2r::tes meta::relational::extension::relationalExtensions(), noDebug())->planToString( meta::relational::extension::relationalExtensions()); let expected = 'Sequence\n' + '(\n' + - ' type = TDS[(name, String, "", ""), (prop4, Boolean, "", "")]\n' + + ' type = TDS[(name, String, VARCHAR(65536), ""), (prop4, Boolean, BIT, "")]\n' + ' (\n' + ' FunctionParametersValidationNode\n' + ' (\n' + @@ -93,7 +93,7 @@ function <> meta::relational::tests::m2m2r::tes ' )\n' + ' Relational\n' + ' (\n' + - ' type = TDS[(name, String, "", ""), (prop4, Boolean, "", "")]\n' + + ' type = TDS[(name, String, VARCHAR(65536), ""), (prop4, Boolean, BIT, "")]\n' + ' resultColumns = [("name", VARCHAR(200)), ("prop4", "")]\n' + ' sql = select "root".name as "name", "sourceannouncement_0".name = \'${accountNum?replace("\'", "\'\'")}\' as "prop4" from S.sourceEntitlement as "root" left outer join S.SourceAnnouncement as "sourceannouncement_0" on ("root".id = "sourceannouncement_0".id) where "sourceannouncement_0".name = \'${accountNum?replace("\'", "\'\'")}\'\n' + ' connection = RelationalDatabaseConnection(type = "H2")\n' + @@ -117,7 +117,7 @@ function <> meta::relational::tests::m2m2r::tes let expected = 'Relational\n'+ '(\n'+ - ' type = TDS[(name, String, "", ""), (prop1, Boolean, "", "")]\n'+ + ' type = TDS[(name, String, VARCHAR(65536), ""), (prop1, Boolean, BIT, "")]\n'+ ' resultColumns = [("name", VARCHAR(200)), ("prop1", "")]\n'+ ' sql = select "root".name as "name", "sourceannouncement_0".name = \'ha\' as "prop1" from S.sourceEntitlement as "root" left outer join S.SourceAnnouncement as "sourceannouncement_0" on ("root".id = "sourceannouncement_0".id) order by "name"\n'+ ' connection = RelationalDatabaseConnection(type = "H2")\n'+ diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/relationalMappingExecution.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/relationalMappingExecution.pure index 3506669588b..d846573f32a 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/relationalMappingExecution.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/relationalMappingExecution.pure @@ -82,10 +82,20 @@ function meta::relational::mapping::generateInstantiationExecutionNode(sq:meta:: sourceDataType = if($p.second.relationalType->isNotEmpty(), | $p.second.relationalType, | $p.second.propertyMapping->match([ - rpm: RelationalPropertyMapping[0..1] | $rpm->getRelationalTypeFromRelationalPropertyMapping($p.first), - cpm: meta::pure::router::clustering::CrossSetImplementationPrimtivePropertyMapping[0..1] | $cpm.sourcePropertyMapping->match([rpm: RelationalPropertyMapping[0..1] | $rpm->getRelationalTypeFromRelationalPropertyMapping($p.first), pm: PropertyMapping[0..1] | []]), - pm: PropertyMapping[0..1] | [] - ])) + rpm0: RelationalPropertyMapping[0] | meta::relational::mapping::inferSourceDataType($p.second.type->toOne()), + rpm1: RelationalPropertyMapping[1] | + let relationalType = $rpm1->meta::relational::mapping::getRelationalTypeFromRelationalPropertyMapping($p.first); + if ($relationalType->isEmpty(), | meta::relational::mapping::inferSourceDataType($p.second.type->toOne()), | $relationalType);, + cpm: meta::pure::router::clustering::CrossSetImplementationPrimtivePropertyMapping[0..1] | $cpm.sourcePropertyMapping->match([ + rpm0: RelationalPropertyMapping[0] | meta::relational::mapping::inferSourceDataType($p.second.type->toOne()), + rpm1: RelationalPropertyMapping[1] | + let relationalType = $rpm1->meta::relational::mapping::getRelationalTypeFromRelationalPropertyMapping($p.first); + if ($relationalType->isEmpty(), | meta::relational::mapping::inferSourceDataType($p.second.type->toOne()), | $relationalType);, + pm: PropertyMapping[0..1] | []] + ), + pm: PropertyMapping[0..1] | []; + ]) + ) ); ) ); @@ -145,14 +155,9 @@ function meta::relational::mapping::generateInstantiationExecutionNode(sq:meta:: ]); } -function <> meta::relational::mapping::getRelationalTypeFromRelationalPropertyMapping(r:RelationalPropertyMapping[0..1], propertyName:String[1]):meta::relational::metamodel::datatype::DataType[0..1] +function <> meta::relational::mapping::getRelationalTypeFromRelationalPropertyMapping(r:RelationalPropertyMapping[1], propertyName:String[1]):meta::relational::metamodel::datatype::DataType[0..1] { - - if($r->isEmpty(), - | [] //TO FIX: support all existing tests before introducing a fail fail( 'Unsupported plan execution - check that you are setting Path Types - no type found for column '+$propertyName );, - ,| $r->toOne().relationalOperationElement->inferRelationalType(false); - )->cast(@meta::relational::metamodel::datatype::DataType); - + $r->toOne().relationalOperationElement->inferRelationalType(false)->cast(@meta::relational::metamodel::datatype::DataType) } function meta::relational::mapping::generateSQLExecutionNode(query:SQLQuery[1], connection:DatabaseConnection[1], enumMapSupportFunctions:String[*], extensions:Extension[*]):ExecutionNode[1] @@ -739,3 +744,25 @@ function meta::relational::mapping::getPropertyTargetSetImplementation(sourceSet ]); } +function meta::relational::mapping::pureTypeToRelationalTypeMap(): Map[1] +{ + meta::relational::transform::fromPure::pureTypeToDataTypeMap() + ->put(String, ^meta::relational::metamodel::datatype::Varchar(size = 65536)) + ->put(Integer, ^meta::relational::metamodel::datatype::BigInt()) +} + +function meta::relational::mapping::inferSourceDataType(type: Any[1]): meta::relational::metamodel::datatype::DataType[0..1] +{ + if ($type->instanceOf(PrimitiveType), + | + let inferedSourceDataType = meta::relational::mapping::pureTypeToRelationalTypeMap()->get($type); + if ( + $inferedSourceDataType->isEmpty(), + | [], + | $inferedSourceDataType->cast(@meta::relational::metamodel::datatype::DataType)->toOne());, + | if ($type->instanceOf(EnumerationMapping), + | meta::relational::mapping::pureTypeToRelationalTypeMap()->get(String)->cast(@meta::relational::metamodel::datatype::DataType)->toOne(), + | [] + ) + ); +} \ No newline at end of file diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testCanRouteWrappedFunctions.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testCanRouteWrappedFunctions.pure index 2c9e7debd0a..44e91c4732b 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testCanRouteWrappedFunctions.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testCanRouteWrappedFunctions.pure @@ -32,7 +32,7 @@ function <> meta::relational::tests::tds::window::routing::testExecut meta::external::store::relational::tests::testRuntime(), relationalExtensions()); let expectedPlan ='Sequence\n'+ '(\n'+ - ' type = TDS[(firstName, String, VARCHAR(200), ""), (lastName, String, VARCHAR(200), ""), (id, Integer, "", ""), (ageSum, Integer, INT, ""), (olapcolumn, Integer, INT, "")]\n'+ + ' type = TDS[(firstName, String, VARCHAR(200), ""), (lastName, String, VARCHAR(200), ""), (id, Integer, BIGINT, ""), (ageSum, Integer, INT, ""), (olapcolumn, Integer, INT, "")]\n'+ ' (\n'+ ' FunctionParametersValidationNode\n'+ ' (\n'+ @@ -40,7 +40,7 @@ function <> meta::relational::tests::tds::window::routing::testExecut ' )\n'+ ' Relational\n'+ ' (\n'+ - ' type = TDS[(firstName, String, VARCHAR(200), ""), (lastName, String, VARCHAR(200), ""), (id, Integer, "", ""), (ageSum, Integer, INT, ""), (olapcolumn, Integer, INT, "")]\n'+ + ' type = TDS[(firstName, String, VARCHAR(200), ""), (lastName, String, VARCHAR(200), ""), (id, Integer, BIGINT, ""), (ageSum, Integer, INT, ""), (olapcolumn, Integer, INT, "")]\n'+ ' resultColumns = [("firstName", VARCHAR(200)), ("lastName", VARCHAR(200)), ("id", ""), ("ageSum", ""), ("olapcolumn", "")]\n'+ ' sql = select "root".firstname as "firstName", "root".lastname as "lastName", char_length("root".id) as "id", sum("root".age) as "ageSum", count(sum("root".age)) OVER (Partition By "root".firstname,"root".lastname Order By char_length("root".id) ASC) as "olapcolumn" from AccountSchema.AccountTable as "root" where ("root".age > ${limit} and "root".firstname like \'D%\') group by "firstName","lastName","id"\n'+ ' connection = TestDatabaseConnection(type = "H2")\n'+ diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testTDSExtend.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testTDSExtend.pure index 79ebb8fde1d..a9fe4f101ba 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testTDSExtend.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testTDSExtend.pure @@ -45,7 +45,7 @@ function <> meta::relational::tests::tds::tdsExtend::testFunctionOnVa let plan = executionPlan({ var:String[1]| Person.all()->project(p|$p.firstName,'firstName') ->extend(^BasicColumnSpecification(func={r:TDSRow[1]|$var}, name='var'))}, simpleRelationalMapping, meta::external::store::relational::tests::testRuntime(), meta::relational::extension::relationalExtensions()); - assertEquals('Sequence ( type = TDS[(firstName, String, VARCHAR(200), ""), (var, String, "", "")] ( FunctionParametersValidationNode ( functionParameters = [var:String[1]] ) Relational ( type = TDS[(firstName, String, VARCHAR(200), ""), (var, String, "", "")] resultColumns = [("firstName", VARCHAR(200)), ("var", "")] sql = select "root".FIRSTNAME as "firstName", \'${var?replace("\'", "\'\'")}\' as "var" from personTable as "root" connection = TestDatabaseConnection(type = "H2") ) ) ) ', $plan->planToString(meta::relational::extension::relationalExtensions())->replace('\n',' ')); + assertEquals('Sequence ( type = TDS[(firstName, String, VARCHAR(200), ""), (var, String, VARCHAR(65536), "")] ( FunctionParametersValidationNode ( functionParameters = [var:String[1]] ) Relational ( type = TDS[(firstName, String, VARCHAR(200), ""), (var, String, VARCHAR(65536), "")] resultColumns = [("firstName", VARCHAR(200)), ("var", "")] sql = select "root".FIRSTNAME as "firstName", \'${var?replace("\'", "\'\'")}\' as "var" from personTable as "root" connection = TestDatabaseConnection(type = "H2") ) ) ) ', $plan->planToString(meta::relational::extension::relationalExtensions())->replace('\n',' ')); } function <> meta::relational::tests::tds::tdsExtend::testFunctionOnStringLiteral():Boolean[1] diff --git a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testTDSJoin.pure b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testTDSJoin.pure index a45e536c1dc..b631fe1a287 100644 --- a/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testTDSJoin.pure +++ b/legend-engine-xts-relationalStore/legend-engine-xt-relationalStore-generation/legend-engine-xt-relationalStore-pure/src/main/resources/core_relational/relational/tds/tests/testTDSJoin.pure @@ -1118,6 +1118,30 @@ function <> meta::relational::tests::tds::tdsJoin::al assertSameElements(['Smith','Johnson','Hill','Allen','Roberts','Hill','Harris','Peter','John','John','Anthony','Fabrice','Oliver','David'], $result.values.rows->map(r|$r.values->makeString(','))); } +function <> meta::relational::tests::tds::tdsJoin::alloy::testJoinWithExtendWithDigestOnColumnsOnBothQueries():Boolean[1] +{ + let result = execute({|testJoinTDS_Person.all() + ->meta::pure::tds::project([p|$p.personID, p|$p.firstName, p|$p.lastName, p|$p.employerID], ['personID', 'firstName','lastName', 'eID']) + ->meta::pure::tds::extensions::extendWithDigestOnColumns('hash1', meta::pure::functions::hash::HashType.MD5, ['firstName', 'lastName']) + ->join(testJoinTDS_Firm.all() + ->meta::pure::tds::project([p|$p.legalName, p|$p.firmID], ['firmName','fID']) + ->meta::pure::tds::extensions::extendWithDigestOnColumns('hash2', meta::pure::functions::hash::HashType.MD5,['legalName']), + JoinType.LEFT_OUTER, {a,b|($a.getInteger('eID')) == $b.getInteger('fID')} + ) + }, testJoinTDSMappingTwoDatabase, twoDBRunTime(), meta::relational::extension::relationalExtensions()); + assertSize($result.values.rows, 7 ); + assertSameElements([ + '1,Peter,Smith,1,ee0af362d8c1e4fa8c805dfeadd1aa37,Firm X,1,d41d8cd98f00b204e9800998ecf8427e', + '2,John,Johnson,1,f8758ee5b78e87c2c62f4bed81ce3537,Firm X,1,d41d8cd98f00b204e9800998ecf8427e', + '3,John,Hill,1,5a60b85c13b6c8273a6d2d55ff6a7815,Firm X,1,d41d8cd98f00b204e9800998ecf8427e', + '4,Anthony,Allen,1,aceae9411805b964e79dd85254a18a64,Firm X,1,d41d8cd98f00b204e9800998ecf8427e', + '5,Fabrice,Roberts,2,78e0713429c21373986cd56e497ece2f,Firm A,2,d41d8cd98f00b204e9800998ecf8427e', + '6,Oliver,Hill,3,ab43019b868088e113c5d313a7f5ca40,Firm B,3,d41d8cd98f00b204e9800998ecf8427e', + '7,David,Harris,4,988f1ea1ec2cdacc3bb1dff202d4160a,Firm C,4,d41d8cd98f00b204e9800998ecf8427e' + ], + $result.values.rows->map(r|$r.values->makeString(','))); +} + ###Relational Database meta::relational::tests::tds::tdsJoin::database2 (