Skip to content

Commit

Permalink
Add more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
xuyu committed Feb 8, 2025
1 parent 23c29b1 commit cdc5265
Showing 1 changed file with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5193,14 +5193,17 @@ private void checkLiteral2(String expression, String expected) {
String expectedFirebolt = expectedPostgresql;
String expectedStarRocks = "SELECT DATE_TRUNC('MINUTE', `hire_date`)\n"
+ "FROM `foodmart`.`employee`";
String expectedTrino = "SELECT DATE_TRUNC('MINUTE', \"hire_date\")\n"
+ "FROM \"foodmart\".\"employee\"";
sql(query)
.withClickHouse().ok(expectedClickHouse)
.withFirebolt().ok(expectedFirebolt)
.withHsqldb().ok(expectedHsqldb)
.withOracle().ok(expectedOracle)
.withPostgresql().ok(expectedPostgresql)
.withPresto().ok(expectedPresto)
.withStarRocks().ok(expectedStarRocks);
.withStarRocks().ok(expectedStarRocks)
.withTrino().ok(expectedTrino);
}

@Test void testFetchMssql() {
Expand Down Expand Up @@ -8090,9 +8093,14 @@ private void checkLiteral2(String expression, String expected) {
+ "FROM \"foodmart\".\"employee\"\n"
+ "WHERE 10 = CAST('10' AS INTEGER) AND \"birth_date\" = CAST('1914-02-02' AS DATE) OR "
+ "\"hire_date\" = CAST('1996-01-01 ' || '00:00:00' AS TIMESTAMP)";
final String expectedTrino = "SELECT \"employee_id\"\n"
+ "FROM \"foodmart\".\"employee\"\n"
+ "WHERE 10 = CAST('10' AS INTEGER) AND \"birth_date\" = CAST('1914-02-02' AS DATE) OR "
+ "\"hire_date\" = CAST('1996-01-01 ' || '00:00:00' AS TIMESTAMP)";
sql(query)
.ok(expected)
.withPresto().ok(expectedPresto);
.withPresto().ok(expectedPresto)
.withTrino().ok(expectedTrino);
}

@Test void testDialectQuoteStringLiteral() {
Expand Down Expand Up @@ -8881,11 +8889,14 @@ private void checkLiteral2(String expression, String expected) {
final String expectedSpark = "SELECT MAP ('k1', 'v1', 'k2', 'v2')\n"
+ "FROM (VALUES (0)) `t` (`ZERO`)";
final String expectedHive = "SELECT MAP ('k1', 'v1', 'k2', 'v2')";
final String expectedTrino = "SELECT MAP (ARRAY['k1', 'k2'], ARRAY['v1', 'v2'])\n"
+ "FROM (VALUES (0)) AS \"t\" (\"ZERO\")";
sql(query)
.withPresto().ok(expectedPresto)
.withStarRocks().ok(expectedStarRocks)
.withSpark().ok(expectedSpark)
.withHive().ok(expectedHive);
.withHive().ok(expectedHive)
.withTrino().ok(expectedTrino);
}

@Test void testMapValueConstructorWithArray() {
Expand All @@ -8894,9 +8905,12 @@ private void checkLiteral2(String expression, String expected) {
+ "FROM (VALUES (0)) AS \"t\" (\"ZERO\")";
final String expectedSpark = "SELECT MAP (ARRAY ('k1', 'k2'), ARRAY ('v1', 'v2'))\n"
+ "FROM (VALUES (0)) `t` (`ZERO`)";
final String expectedTrino = "SELECT MAP (ARRAY['k1', 'k2'], ARRAY['v1', 'v2'])\n"
+ "FROM (VALUES (0)) AS \"t\" (\"ZERO\")";
sql(query)
.withPresto().ok(expectedPresto)
.withSpark().ok(expectedSpark);
.withSpark().ok(expectedSpark)
.withTrino().ok(expectedTrino);
}

/** Test case for
Expand Down

0 comments on commit cdc5265

Please sign in to comment.