From ab5d153ee22176399ad9dc742dd439d3686c4301 Mon Sep 17 00:00:00 2001 From: Marius Grama Date: Mon, 27 May 2024 22:27:44 +0200 Subject: [PATCH] Showcase nested subquery translation failure --- .../coral/trino/rel2trino/HiveToTrinoConverterTest.java | 4 +++- .../java/com/linkedin/coral/trino/rel2trino/TestUtils.java | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 7f5cb2ce9..8b03eeda8 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 @@ -236,7 +236,9 @@ public Object[][] viewTestCasesProvider() { { "test", "view_union_no_casting", "SELECT \"table_with_mixed_columns\".\"a_tinyint\" AS \"a_tinyint\", \"table_with_mixed_columns\".\"a_smallint\" AS \"a_smallint\", \"table_with_mixed_columns\".\"a_integer\" AS \"a_integer\", \"table_with_mixed_columns\".\"a_bigint\" AS \"a_bigint\", \"table_with_mixed_columns\".\"a_float\" AS \"a_float\"\n" + "FROM \"test\".\"table_with_mixed_columns\" AS \"table_with_mixed_columns\"\n" + "UNION ALL\n" + "SELECT \"table_with_mixed_columns0\".\"a_tinyint\" AS \"a_tinyint\", \"table_with_mixed_columns0\".\"a_smallint\" AS \"a_smallint\", \"table_with_mixed_columns0\".\"a_integer\" AS \"a_integer\", \"table_with_mixed_columns0\".\"a_bigint\" AS \"a_bigint\", \"table_with_mixed_columns0\".\"a_float\" AS \"a_float\"\n" - + "FROM \"test\".\"table_with_mixed_columns\" AS \"table_with_mixed_columns0\"" } }; + + "FROM \"test\".\"table_with_mixed_columns\" AS \"table_with_mixed_columns0\"" }, + { "test", "view_max_values", "SELECT value FROM \"test\".\"table_id_value\" WHERE id IN (SELECT MAX(id) FROM \"test\".\"table_id_value\")" } }; + } @Test 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..04a7c936d 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 @@ -413,6 +413,9 @@ public static void initializeTablesAndViews(HiveConf conf) throws HiveException, + "UNION ALL\n" + "SELECT a_tinyint, a_smallint, a_integer, a_bigint, a_float FROM test.table_with_mixed_columns"); + run(driver, "CREATE TABLE test.table_id_value (id int, value varchar(255))"); + run(driver, "CREATE VIEW IF NOT EXISTS test.view_max_values AS \n" + + "SELECT value FROM test.table_id_value WHERE id IN (SELECT MAX(id) FROM test.table_id_value)"); // Tables used in RelToTrinoConverterTest run(driver, "CREATE TABLE IF NOT EXISTS test.tableOne(icol int, dcol double, scol string, tcol timestamp, acol array)");