From 5908d3b6d004eb7798acdc5fe014490b0d95de9f Mon Sep 17 00:00:00 2001 From: aastha25 Date: Wed, 14 Jun 2023 11:02:10 -0700 Subject: [PATCH] enable test and rename var --- .../linkedin/coral/trino/rel2trino/RelToTrinoConverter.java | 6 ++++-- .../coral/trino/rel2trino/HiveToTrinoConverterTest.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/coral-trino/src/main/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverter.java b/coral-trino/src/main/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverter.java index 069b6500a..47b87a6e8 100644 --- a/coral-trino/src/main/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverter.java +++ b/coral-trino/src/main/java/com/linkedin/coral/trino/rel2trino/RelToTrinoConverter.java @@ -87,9 +87,11 @@ public String convert(RelNode relNode) { RelNode rel = convertRel(relNode, configs); SqlNode sqlNode = convertToSqlNode(rel); - SqlNode transformedSqlNode = sqlNode.accept(new DataTypeDerivedSqlCallConverter(_hiveMetastoreClient, sqlNode)); + SqlNode sqlNodeWithRelDataTypeDerivedConversions = + sqlNode.accept(new DataTypeDerivedSqlCallConverter(_hiveMetastoreClient, sqlNode)); - SqlNode sqlNodeWithUDFOperatorConverted = transformedSqlNode.accept(new CoralToTrinoSqlCallConverter(configs)); + SqlNode sqlNodeWithUDFOperatorConverted = + sqlNodeWithRelDataTypeDerivedConversions.accept(new CoralToTrinoSqlCallConverter(configs)); return sqlNodeWithUDFOperatorConverted.accept(new TrinoSqlRewriter()).toSqlString(TrinoSqlDialect.INSTANCE) .toString(); } 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 1806669e5..6c90a42a0 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 @@ -462,7 +462,7 @@ public void testCastNestedTimestampToDecimal() { "SELECT CAST(\"to_unixtime\"(\"with_timezone\"(CAST(\"table_from_utc_timestamp\".\"a_date\" AS TIMESTAMP), 'UTC')) AS DECIMAL(10, 0)) AS \"d\"\n" + "FROM \"test\".\"table_from_utc_timestamp\" AS \"table_from_utc_timestamp\""; String expandedSql = relToTrinoConverter.convert(relNode); - // assertEquals(expandedSql, targetSql); + assertEquals(expandedSql, targetSql); relNode = TestUtils.getHiveToRelConverter().convertSql( "SELECT CAST(from_utc_timestamp(a_date, 'America/Los_Angeles') AS DECIMAL(10, 0)) AS d\nFROM test.table_from_utc_timestamp");