Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public void testUint8()
.addRoundTrip("UInt8", "0", SMALLINT, "SMALLINT '0'") // min value in ClickHouse
.addRoundTrip("UInt8", "255", SMALLINT, "SMALLINT '255'") // max value in ClickHouse
.addRoundTrip("Nullable(UInt8)", "NULL", SMALLINT, "CAST(null AS SMALLINT)")
.execute(getQueryRunner(), clickhouseCreateTrinoInsert("tpch.test_uint8"));
.execute(getQueryRunner(), clickhouseCreateAndTrinoInsert("tpch.test_uint8"));
}

@Test
Expand Down Expand Up @@ -279,7 +279,7 @@ public void testUint16()
.addRoundTrip("UInt16", "0", INTEGER, "0") // min value in ClickHouse
.addRoundTrip("UInt16", "65535", INTEGER, "65535") // max value in ClickHouse
.addRoundTrip("Nullable(UInt16)", "NULL", INTEGER, "CAST(null AS INTEGER)")
.execute(getQueryRunner(), clickhouseCreateTrinoInsert("tpch.test_uint16"));
.execute(getQueryRunner(), clickhouseCreateAndTrinoInsert("tpch.test_uint16"));
}

@Test
Expand Down Expand Up @@ -315,7 +315,7 @@ public void testUint32()
.addRoundTrip("UInt32", "BIGINT '0'", BIGINT, "BIGINT '0'") // min value in ClickHouse
.addRoundTrip("UInt32", "BIGINT '4294967295'", BIGINT, "BIGINT '4294967295'") // max value in ClickHouse
.addRoundTrip("Nullable(UInt32)", "NULL", BIGINT, "CAST(null AS BIGINT)")
.execute(getQueryRunner(), clickhouseCreateTrinoInsert("tpch.test_uint32"));
.execute(getQueryRunner(), clickhouseCreateAndTrinoInsert("tpch.test_uint32"));
}

@Test
Expand Down Expand Up @@ -351,7 +351,7 @@ public void testUint64()
.addRoundTrip("UInt64", "CAST('0' AS decimal(20, 0))", createDecimalType(20), "CAST('0' AS decimal(20, 0))") // min value in ClickHouse
.addRoundTrip("UInt64", "CAST('18446744073709551615' AS decimal(20, 0))", createDecimalType(20), "CAST('18446744073709551615' AS decimal(20, 0))") // max value in ClickHouse
.addRoundTrip("Nullable(UInt64)", "NULL", createDecimalType(20), "CAST(null AS decimal(20, 0))")
.execute(getQueryRunner(), clickhouseCreateTrinoInsert("tpch.test_uint64"));
.execute(getQueryRunner(), clickhouseCreateAndTrinoInsert("tpch.test_uint64"));
}

@Test
Expand Down Expand Up @@ -625,12 +625,18 @@ public void testDate(ZoneId sessionZone)
.addRoundTrip("date", "DATE '1983-10-01'", DATE, "DATE '1983-10-01'")
.addRoundTrip("date", "DATE '2106-02-07'", DATE, "DATE '2106-02-07'") // max value in ClickHouse
.execute(getQueryRunner(), session, clickhouseCreateAndInsert("tpch.test_date"))
.execute(getQueryRunner(), session, trinoCreateAsSelect(session, "test_date"));
.execute(getQueryRunner(), session, trinoCreateAsSelect(session, "test_date"))
.execute(getQueryRunner(), session, trinoCreateAsSelect("test_date"))
.execute(getQueryRunner(), session, trinoCreateAndInsert(session, "test_date"))
.execute(getQueryRunner(), session, trinoCreateAndInsert("test_date"));

// Null
SqlDataTypeTest.create()
.addRoundTrip("date", "NULL", DATE, "CAST(NULL AS DATE)")
.execute(getQueryRunner(), session, trinoCreateAsSelect(session, "test_date"));
.execute(getQueryRunner(), session, trinoCreateAsSelect(session, "test_date"))
.execute(getQueryRunner(), session, trinoCreateAsSelect("test_date"))
.execute(getQueryRunner(), session, trinoCreateAndInsert(session, "test_date"))
.execute(getQueryRunner(), session, trinoCreateAndInsert("test_date"));
SqlDataTypeTest.create()
.addRoundTrip("Nullable(date)", "NULL", DATE, "CAST(NULL AS DATE)")
.execute(getQueryRunner(), session, clickhouseCreateAndInsert("tpch.test_date"));
Expand Down Expand Up @@ -663,8 +669,10 @@ public void testTimestamp(ZoneId sessionZone)
.addRoundTrip("timestamp(0)", "timestamp '2018-10-28 01:33:17'", createTimestampType(0), "TIMESTAMP '2018-10-28 01:33:17'") // time doubled in JVM zone
.addRoundTrip("timestamp(0)", "timestamp '2018-10-28 03:33:33'", createTimestampType(0), "TIMESTAMP '2018-10-28 03:33:33'") // time double in Vilnius
.addRoundTrip("timestamp(0)", "timestamp '2105-12-31 23:59:59'", createTimestampType(0), "TIMESTAMP '2105-12-31 23:59:59'") // max value in ClickHouse
.execute(getQueryRunner(), session, trinoCreateAsSelect("tpch.test_timestamp"))
.execute(getQueryRunner(), session, trinoCreateAndInsert("tpch.test_timestamp"));
.execute(getQueryRunner(), session, trinoCreateAsSelect(session, "test_timestamp"))
.execute(getQueryRunner(), session, trinoCreateAsSelect("test_timestamp"))
.execute(getQueryRunner(), session, trinoCreateAndInsert(session, "test_timestamp"))
.execute(getQueryRunner(), session, trinoCreateAndInsert("test_timestamp"));

addTimestampRoundTrips("timestamp")
.execute(getQueryRunner(), session, clickhouseCreateAndInsert("tpch.test_timestamp"));
Expand Down Expand Up @@ -764,7 +772,7 @@ public void testIp()
.addRoundTrip("IPv6", "IPADDRESS 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'", IPADDRESS, "IPADDRESS 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff'")
.addRoundTrip("Nullable(IPv4)", "NULL", IPADDRESS, "CAST(NULL AS IPADDRESS)")
.addRoundTrip("Nullable(IPv6)", "NULL", IPADDRESS, "CAST(NULL AS IPADDRESS)")
.execute(getQueryRunner(), clickhouseCreateTrinoInsert("tpch.test_ip"));
.execute(getQueryRunner(), clickhouseCreateAndTrinoInsert("tpch.test_ip"));
}

private static Session mapStringAsVarcharSession()
Expand Down Expand Up @@ -801,7 +809,7 @@ private DataSetup clickhouseCreateAndInsert(String tableNamePrefix)
return new CreateAndInsertDataSetup(new ClickHouseSqlExecutor(clickhouseServer::execute), tableNamePrefix);
}

private DataSetup clickhouseCreateTrinoInsert(String tableNamePrefix)
private DataSetup clickhouseCreateAndTrinoInsert(String tableNamePrefix)
{
return new CreateAndTrinoInsertDataSetup(new ClickHouseSqlExecutor(clickhouseServer::execute), new TrinoSqlExecutor(getQueryRunner()), tableNamePrefix);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ public void testTimeFromTrino(ZoneId sessionZone)
.addRoundTrip("TIME(5)", "NULL", createTimeType(5), "CAST(NULL AS TIME(5))")
.addRoundTrip("TIME(6)", "NULL", createTimeType(6), "CAST(NULL AS TIME(6))")

.execute(getQueryRunner(), session, trinoCreateAsSelect(session, "test_time"))
.execute(getQueryRunner(), session, trinoCreateAsSelect("test_time"))
.execute(getQueryRunner(), session, trinoCreateAndInsert(session, "test_time"))
.execute(getQueryRunner(), session, trinoCreateAndInsert("test_time"));
Expand Down
Loading