Skip to content

Commit

Permalink
add tableInt to rel to trino tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGe00 committed Jul 18, 2024
1 parent 93e873c commit 0dc5ce1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1000,13 +1000,13 @@ public void testIntCastToBigIntDuringComparison() {
// We're testing that a comparison between INT and BIGINT sees a cast on the more restrictive type to the
// less restrictive type and not the other way around. In other words, the INT is cast to BIGINT.
RelNode relNode = TestUtils.getHiveToRelConverter().convertSql(
"SELECT CASE WHEN a_integer = a_bigint THEN 'abc' ELSE 'def' END FROM test.table_from_utc_timestamp");
"SELECT CASE WHEN int_col = bigint_col THEN 'abc' ELSE 'def' END FROM test.tableInt");
RelToTrinoConverter relToTrinoConverter = TestUtils.getRelToTrinoConverter();
String expandedSql = relToTrinoConverter.convert(relNode);

String expected =
"SELECT CASE WHEN CAST(\"table_from_utc_timestamp\".\"a_integer\" AS BIGINT) = \"table_from_utc_timestamp\".\"a_bigint\" THEN 'abc' ELSE 'def' END\n"
+ "FROM \"test\".\"table_from_utc_timestamp\" AS \"table_from_utc_timestamp\"";
"SELECT CASE WHEN CAST(\"tableint\".\"int_col\" AS BIGINT) = \"tableint\".\"bigint_col\" THEN 'abc' ELSE 'def' END\n"
+ "FROM \"test\".\"tableint\" AS \"tableint\"";
assertEquals(expandedSql, expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,9 @@ public static void initializeTablesAndViews(HiveConf conf) throws HiveException,
run(driver,
"CREATE TABLE IF NOT EXISTS test.tableFour(icol int, scol string, acol array<string>, mcol map<string, string>)");

run(driver,
"CREATE TABLE IF NOT EXISTS test.tableInt(tinyint_col tinyint, smallint_col smallint, int_col int, bigint_col bigint)");

}

public static HiveConf loadResourceHiveConf() {
Expand Down

0 comments on commit 0dc5ce1

Please sign in to comment.