Skip to content

Commit

Permalink
Update testSnowflakeToSQLString.pure
Browse files Browse the repository at this point in the history
  • Loading branch information
PrateekGarg-gs authored Aug 28, 2023
1 parent ad23509 commit f4c9696
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function <<test.Test>> meta::relational::tests::sqlToString::snowflake::testToSQ
['firstName', 'age']),
meta::relational::tests::simpleRelationalMapping,
meta::relational::runtime::DatabaseType.Snowflake, meta::relational::extension::relationalExtensions());
assertEquals('select "root".FIRSTNAME as "firstName", sum("root".AGE) as "age" from personTable as "root" group by "root".FIRSTNAME', $s);
assertEquals('select "root".FIRSTNAME as "firstName", sum("root".AGE) as "age" from personTable as "root" group by "firstName"', $s);
}

function <<test.Test>> meta::relational::tests::sqlToString::snowflake::testToSQLStringWithOrderbySnowflake():Boolean[1]
Expand All @@ -39,7 +39,7 @@ function <<test.Test>> meta::relational::tests::sqlToString::snowflake::testToSQ
['firstName', 'age'])->sort(asc('age'))->limit(5),
meta::relational::tests::simpleRelationalMapping,
meta::relational::runtime::DatabaseType.Snowflake, meta::relational::extension::relationalExtensions());
assertEquals('select "root".FIRSTNAME as "firstName", sum("root".AGE) as "age" from personTable as "root" group by "root".FIRSTNAME order by "age" limit 5', $s);
assertEquals('select "root".FIRSTNAME as "firstName", sum("root".AGE) as "age" from personTable as "root" group by "firstName" order by "age" limit 5', $s);
}

function <<test.Test>> meta::relational::tests::sqlToString::snowflake::testToSqlGenerationIndexOf():Boolean[1]
Expand Down Expand Up @@ -183,4 +183,14 @@ function <<test.Test>> meta::relational::tests::sqlToString::snowflake::testJoin
let fn = {|Firm.all()->project([f|$f.legalName, f|['A', 'B', 'C']->joinStrings('*')], ['legalName', 'employeesFirstName'])};
let snowflakeSql = toSQLString($fn, meta::relational::tests::simpleRelationalMapping, meta::relational::runtime::DatabaseType.Snowflake, meta::relational::extension::relationalExtensions());
assertEquals('select "root".LEGALNAME as "legalName", concat(\'A\', \'*\', \'B\', \'*\', \'C\') as "employeesFirstName" from firmTable as "root"', $snowflakeSql);
}
}

function <<test.Test>> meta::relational::tests::sqlToString::snowflake::simpleGroupByOnNumberColumnName():Boolean[1]
{
let fn = {|Trade.all()
->project([t|$t.quantity, t|$t.product.name], ['quantity', '90.01'])
->groupBy('90.01', agg('cnt', x|$x, y| $y->count()))};

let snowflakeSql = toSQLString($fn, meta::relational::tests::simpleRelationalMapping, meta::relational::runtime::DatabaseType.Snowflake, meta::relational::extension::relationalExtensions());
assertEquals('select "productTable_d#5_d#2_m2".NAME as "90.01", count(*) as "cnt" from tradeTable as "root" left outer join productSchema.productTable as "productTable_d#5_d#2_m2" on ("root".prodId = "productTable_d#5_d#2_m2".ID) group by "90.01"', $snowflakeSql);
}

0 comments on commit f4c9696

Please sign in to comment.