Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename to Trino in product tests #24583

Merged
merged 1 commit into from
Dec 27, 2024
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 @@ -113,10 +113,10 @@ public void shouldDisplayVersion()
throws IOException
{
launchTrinoCli("--version");
assertThat(trino.readRemainingOutputLines()).containsExactly("Trino CLI " + readPrestoCliVersion());
assertThat(trino.readRemainingOutputLines()).containsExactly("Trino CLI " + readTrinoCliVersion());
}

private static String readPrestoCliVersion()
private static String readTrinoCliVersion()
{
try {
String version = Resources.toString(Resources.getResource("trino-cli-version.txt"), UTF_8).trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,16 +313,16 @@ private void launchTrinoCliWithServerArgument(String... arguments)
requireNonNull(ldapServerAddress, "ldapServerAddress is null");
requireNonNull(ldapUserPassword, "ldapUserPassword is null");

ImmutableList.Builder<String> prestoClientOptions = ImmutableList.builder();
prestoClientOptions.add(
ImmutableList.Builder<String> trinoClientOptions = ImmutableList.builder();
trinoClientOptions.add(
"--server", ldapServerAddress,
"--truststore-path", ldapTruststorePath,
"--truststore-password", ldapTruststorePassword,
"--user", ldapUserName,
"--password");

prestoClientOptions.add(arguments);
ProcessBuilder processBuilder = getProcessBuilder(prestoClientOptions.build());
trinoClientOptions.add(arguments);
ProcessBuilder processBuilder = getProcessBuilder(trinoClientOptions.build());
processBuilder.environment().put("TRINO_PASSWORD", ldapUserPassword);
trino = new TrinoCliProcess(processBuilder.start());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class TestDeltaLakeCreateTableAsSelectCompatibility
{
@Test(groups = {DELTA_LAKE_DATABRICKS, DELTA_LAKE_DATABRICKS_113, DELTA_LAKE_DATABRICKS_122, DELTA_LAKE_DATABRICKS_133, DELTA_LAKE_DATABRICKS_143, PROFILE_SPECIFIC_TESTS})
@Flaky(issue = DATABRICKS_COMMUNICATION_FAILURE_ISSUE, match = DATABRICKS_COMMUNICATION_FAILURE_MATCH)
public void testPrestoTypesWithDatabricks()
public void testTrinoTypesWithDatabricks()
{
String tableName = "test_dl_ctas_" + randomNameSuffix();

Expand All @@ -63,8 +63,8 @@ public void testPrestoTypesWithDatabricks()
.containsOnly(row(7));

QueryResult databricksResult = onDelta().executeQuery(format("SELECT * FROM default.%s", tableName));
QueryResult prestoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\"", tableName));
assertThat(databricksResult).containsOnly(prestoResult.rows().stream()
QueryResult trinoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\"", tableName));
assertThat(databricksResult).containsOnly(trinoResult.rows().stream()
.map(QueryAssert.Row::new)
.collect(toImmutableList()));
}
Expand All @@ -75,7 +75,7 @@ public void testPrestoTypesWithDatabricks()

@Test(groups = {DELTA_LAKE_DATABRICKS, PROFILE_SPECIFIC_TESTS})
@Flaky(issue = DATABRICKS_COMMUNICATION_FAILURE_ISSUE, match = DATABRICKS_COMMUNICATION_FAILURE_MATCH)
public void testPrestoTimestampsWithDatabricks()
public void testTrinoTimestampsWithDatabricks()
{
String tableName = "test_dl_ctas_timestamps_" + randomNameSuffix();

Expand All @@ -90,8 +90,8 @@ public void testPrestoTimestampsWithDatabricks()
.containsOnly(row(4));

QueryResult databricksResult = onDelta().executeQuery("SELECT id, date_format(timestamp_in_utc, \"yyyy-MM-dd HH:mm:ss.SSS\"), date_format(timestamp_in_new_york, \"yyyy-MM-dd HH:mm:ss.SSS\"), date_format(timestamp_in_warsaw, \"yyyy-MM-dd HH:mm:ss.SSS\") FROM default." + tableName);
QueryResult prestoResult = onTrino().executeQuery("SELECT id, format('%1$tF %1$tT.%1$tL', timestamp_in_utc), format('%1$tF %1$tT.%1$tL', timestamp_in_new_york), format('%1$tF %1$tT.%1$tL', timestamp_in_warsaw) FROM delta.default.\"" + tableName + "\"");
assertThat(databricksResult).containsOnly(prestoResult.rows().stream()
QueryResult trinoResult = onTrino().executeQuery("SELECT id, format('%1$tF %1$tT.%1$tL', timestamp_in_utc), format('%1$tF %1$tT.%1$tL', timestamp_in_new_york), format('%1$tF %1$tT.%1$tL', timestamp_in_warsaw) FROM delta.default.\"" + tableName + "\"");
assertThat(databricksResult).containsOnly(trinoResult.rows().stream()
.map(QueryAssert.Row::new)
.collect(toImmutableList()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,23 @@ public void testUpdatesFromDatabricks()

try {
QueryResult databricksResult = onDelta().executeQuery(format("SELECT * FROM default.%s ORDER BY id", tableName));
QueryResult prestoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName));
assertThat(databricksResult).containsExactlyInOrder(toRows(prestoResult));
QueryResult trinoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName));
assertThat(databricksResult).containsExactlyInOrder(toRows(trinoResult));

onDelta().executeQuery(format("UPDATE default.%s SET value = 'France' WHERE id = 2", tableName));
databricksResult = onDelta().executeQuery(format("SELECT * FROM default.%s ORDER BY id", tableName));
prestoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName));
assertThat(databricksResult).containsExactlyInOrder(toRows(prestoResult));
trinoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName));
assertThat(databricksResult).containsExactlyInOrder(toRows(trinoResult));

onDelta().executeQuery(format("UPDATE default.%s SET value = 'Spain' WHERE id = 2", tableName));
databricksResult = onDelta().executeQuery(format("SELECT * FROM default.%s ORDER BY id", tableName));
prestoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName));
assertThat(databricksResult).containsExactlyInOrder(toRows(prestoResult));
trinoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName));
assertThat(databricksResult).containsExactlyInOrder(toRows(trinoResult));

onDelta().executeQuery(format("UPDATE default.%s SET value = 'Portugal' WHERE id = 2", tableName));
databricksResult = onDelta().executeQuery(format("SELECT * FROM default.%s ORDER BY id", tableName));
prestoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName));
assertThat(databricksResult).containsExactlyInOrder(toRows(prestoResult));
trinoResult = onTrino().executeQuery(format("SELECT * FROM delta.default.\"%s\" ORDER BY id", tableName));
assertThat(databricksResult).containsExactlyInOrder(toRows(trinoResult));
}
finally {
dropDeltaTableWithRetry("default." + tableName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testArrayIndexingInView()
{
onHive().executeQuery("DROP TABLE IF EXISTS test_hive_view_array_index_table");
onHive().executeQuery("CREATE TABLE test_hive_view_array_index_table(an_index int, an_array array<string>)");
onHive().executeQuery("INSERT INTO TABLE test_hive_view_array_index_table SELECT 1, array('presto','hive') FROM nation WHERE n_nationkey = 1");
onHive().executeQuery("INSERT INTO TABLE test_hive_view_array_index_table SELECT 1, array('trino','hive') FROM nation WHERE n_nationkey = 1");

// literal array index
onHive().executeQuery("DROP VIEW IF EXISTS test_hive_view_array_index_view");
Expand Down Expand Up @@ -761,7 +761,7 @@ public void testRunAsInvoker()

protected static void assertViewQuery(String query, Consumer<QueryAssert> assertion)
{
// Ensure Hive and Presto view compatibility by comparing the results
// Ensure Hive and Trino view compatibility by comparing the results
assertion.accept(assertThat(onHive().executeQuery(query)));
assertion.accept(assertThat(onTrino().executeQuery(query)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,17 +203,17 @@ protected void doTestHiveCoercion(HiveTableDefinition tableDefinition)
Function<Engine, Map<String, List<Object>>> expected = engine -> expectedValuesForEngineProvider(engine, tableName, booleanToVarcharVal);

// For Trino, remove unsupported columns
List<String> prestoReadColumns = removeUnsupportedColumnsForTrino(allColumns, tableName);
Map<String, List<Object>> expectedPrestoResults = expected.apply(Engine.TRINO);
List<String> trinoReadColumns = removeUnsupportedColumnsForTrino(allColumns, tableName);
Map<String, List<Object>> expectedTrinoResults = expected.apply(Engine.TRINO);
// In case of unpartitioned tables we don't support all the column coercion thereby making this assertion conditional
if (expectedExceptionsWithTrinoContext().isEmpty()) {
assertThat(ImmutableSet.copyOf(prestoReadColumns)).isEqualTo(expectedPrestoResults.keySet());
assertThat(ImmutableSet.copyOf(trinoReadColumns)).isEqualTo(expectedTrinoResults.keySet());
}
String prestoSelectQuery = format("SELECT %s FROM %s", String.join(", ", prestoReadColumns), tableName);
assertQueryResults(Engine.TRINO, prestoSelectQuery, expectedPrestoResults, prestoReadColumns, 2);
String trinoSelectQuery = format("SELECT %s FROM %s", String.join(", ", trinoReadColumns), tableName);
assertQueryResults(Engine.TRINO, trinoSelectQuery, expectedTrinoResults, trinoReadColumns, 2);

// Additional assertions for VARBINARY coercion
if (prestoReadColumns.contains("binary_to_string")) {
if (trinoReadColumns.contains("binary_to_string")) {
List<Object> hexRepresentedValue = ImmutableList.of("58EFBFBDEFBFBDEFBFBDEFBFBD", "58EFBFBDEFBFBDEFBFBDEFBFBD58");

if (tableName.toLowerCase(ENGLISH).contains("orc")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void saveResourceOnHdfs(String resource, String location)
public Object[][] avroSchemaLocations()
{
return new Object[][] {
{"file:///docker/trino-product-tests/avro/original_schema.avsc"}, // mounted in hadoop and presto containers
{"file:///docker/trino-product-tests/avro/original_schema.avsc"}, // mounted in hadoop and trino containers
{"hdfs://hadoop-master:9000/user/hive/warehouse/TestAvroSchemaUrl/schemas/original_schema.avsc"},
{"hdfs:///user/hive/warehouse/TestAvroSchemaUrl/schemas/original_schema.avsc"},
{"/user/hive/warehouse/TestAvroSchemaUrl/schemas/original_schema.avsc"}, // `avro.schema.url` can actually be path on HDFS (not URL)
Expand Down Expand Up @@ -149,16 +149,16 @@ public void testAvroSchemaUrlInSerdeProperties()

@Test(dataProvider = "avroSchemaLocations", groups = STORAGE_FORMATS)
@Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH)
public void testPrestoCreatedTable(String schemaLocation)
public void testTrinoCreatedTable(String schemaLocation)
{
onTrino().executeQuery("DROP TABLE IF EXISTS test_avro_schema_url_presto");
onTrino().executeQuery(format("CREATE TABLE test_avro_schema_url_presto (dummy_col VARCHAR) WITH (format='AVRO', avro_schema_url='%s')", schemaLocation));
onTrino().executeQuery("INSERT INTO test_avro_schema_url_presto VALUES ('some text', 123042)");
onTrino().executeQuery("DROP TABLE IF EXISTS test_avro_schema_url_trino");
onTrino().executeQuery(format("CREATE TABLE test_avro_schema_url_trino (dummy_col VARCHAR) WITH (format='AVRO', avro_schema_url='%s')", schemaLocation));
onTrino().executeQuery("INSERT INTO test_avro_schema_url_trino VALUES ('some text', 123042)");

assertThat(onHive().executeQuery("SELECT * FROM test_avro_schema_url_presto")).containsExactlyInOrder(row("some text", 123042));
assertThat(onTrino().executeQuery("SELECT * FROM test_avro_schema_url_presto")).containsExactlyInOrder(row("some text", 123042));
assertThat(onHive().executeQuery("SELECT * FROM test_avro_schema_url_trino")).containsExactlyInOrder(row("some text", 123042));
assertThat(onTrino().executeQuery("SELECT * FROM test_avro_schema_url_trino")).containsExactlyInOrder(row("some text", 123042));

onTrino().executeQuery("DROP TABLE test_avro_schema_url_presto");
onTrino().executeQuery("DROP TABLE test_avro_schema_url_trino");
}

@Test(groups = STORAGE_FORMATS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class TestGrantRevoke
* Pre-requisites for the tests in this class:
*
* (1) hive.properties file should have this property set: hive.security=sql-standard
* (2) tempto-configuration.yaml file should have definitions for the following connections to Presto server:
* (2) tempto-configuration.yaml file should have definitions for the following connections to Trino server:
* - "alice@trino" that has "jdbc_user: alice"
* - "bob@trino" that has "jdbc_user: bob"
* - "charlie@trino" that has "jdbc_user: charlie"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class TestHiveBasicTableStatistics
@Test
public void testCreateUnpartitioned()
{
String tableName = "test_basic_statistics_unpartitioned_ctas_presto";
String tableName = "test_basic_statistics_unpartitioned_ctas_trino";

onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName));
onTrino().executeQuery(format("CREATE TABLE %s AS SELECT * FROM nation", tableName));
Expand All @@ -61,7 +61,7 @@ public void testCreateUnpartitioned()
@Test
public void testCreateExternalUnpartitioned()
{
String tableName = "test_basic_statistics_external_unpartitioned_presto";
String tableName = "test_basic_statistics_external_unpartitioned_trino";

onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName));

Expand All @@ -87,7 +87,7 @@ public void testCreateExternalUnpartitioned()
@Test
public void testCreateTableWithNoData()
{
String tableName = "test_basic_statistics_unpartitioned_ctas_presto_with_no_data";
String tableName = "test_basic_statistics_unpartitioned_ctas_trino_with_no_data";

onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName));
onTrino().executeQuery(format("CREATE TABLE %s AS SELECT * FROM nation WITH NO DATA", tableName));
Expand All @@ -104,7 +104,7 @@ public void testCreateTableWithNoData()
@Test
public void testInsertUnpartitioned()
{
String tableName = "test_basic_statistics_unpartitioned_insert_presto";
String tableName = "test_basic_statistics_unpartitioned_insert_trino";

onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName));
onTrino().executeQuery(format("" +
Expand Down Expand Up @@ -140,7 +140,7 @@ public void testInsertUnpartitioned()
@Test
public void testCreatePartitioned()
{
String tableName = "test_basic_statistics_partitioned_ctas_presto";
String tableName = "test_basic_statistics_partitioned_ctas_trino";

onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName));
onTrino().executeQuery(format("" +
Expand Down Expand Up @@ -252,7 +252,7 @@ public void testAnalyzeUnpartitioned()
@Test
public void testInsertPartitioned()
{
String tableName = "test_basic_statistics_partitioned_insert_presto";
String tableName = "test_basic_statistics_partitioned_insert_trino";

onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName));
onTrino().executeQuery(format("" +
Expand Down Expand Up @@ -294,7 +294,7 @@ public void testInsertPartitioned()
@Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH)
public void testInsertBucketed()
{
String tableName = "test_basic_statistics_bucketed_insert_presto";
String tableName = "test_basic_statistics_bucketed_insert_trino";

onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName));
onTrino().executeQuery(format("" +
Expand Down Expand Up @@ -333,7 +333,7 @@ public void testInsertBucketed()
@Test
public void testInsertBucketedPartitioned()
{
String tableName = "test_basic_statistics_bucketed_partitioned_insert_presto";
String tableName = "test_basic_statistics_bucketed_partitioned_insert_trino";

onTrino().executeQuery(format("DROP TABLE IF EXISTS %s", tableName));
onTrino().executeQuery(format("" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1403,9 +1403,9 @@ public void testComputeStatisticsForTableWithOnlyDateColumns()

@Test
@Flaky(issue = RETRYABLE_FAILURES_ISSUES, match = RETRYABLE_FAILURES_MATCH)
public void testMixedHiveAndPrestoStatistics()
public void testMixedHiveAndTrinoStatistics()
{
String tableName = "test_mixed_hive_and_presto_statistics";
String tableName = "test_mixed_hive_and_trino_statistics";
onHive().executeQuery(format("DROP TABLE IF EXISTS %s", tableName));
onHive().executeQuery(format("CREATE TABLE %s (a INT) PARTITIONED BY (p INT) STORED AS ORC TBLPROPERTIES ('transactional' = 'false')", tableName));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void testArrayIndexingInView()
"[hive]\n" +
"\n" +
"actual rows:\n" +
"[presto]");
"[trino]");
}

@Override
Expand Down
Loading
Loading