From 0dc5ce149daa82ec89c0b73d4eccecda44cec661 Mon Sep 17 00:00:00 2001 From: Kevin Ge Date: Thu, 18 Jul 2024 13:57:44 -0400 Subject: [PATCH] add tableInt to rel to trino tests --- .../coral/trino/rel2trino/HiveToTrinoConverterTest.java | 6 +++--- .../java/com/linkedin/coral/trino/rel2trino/TestUtils.java | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java b/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java index ecc515a05..f9ea69a49 100644 --- a/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java +++ b/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/HiveToTrinoConverterTest.java @@ -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); } } diff --git a/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java b/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java index 148085261..3e6f088f8 100644 --- a/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java +++ b/coral-trino/src/test/java/com/linkedin/coral/trino/rel2trino/TestUtils.java @@ -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, mcol map)"); + 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() {