Skip to content

Commit

Permalink
[native] Add e2e table format test with native worker
Browse files Browse the repository at this point in the history
This is followup e2e test for #23923

For a partitioned table, when respect_table_format is set to false,
and table_format and hive_storage_format is different, the newly
added partition should use hive_storage_format.
  • Loading branch information
kewang1024 committed Nov 12, 2024
1 parent 6f8c610 commit d1e7b5e
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,34 @@ public void testCreateTableWithUnsupportedFormats()
}
}

@Test
public void testTableFormats()
{
Session session = Session.builder(getSession())
.setSystemProperty("scale_writers", "true")
.setSystemProperty("table_writer_merge_operator_enabled", "true")
.setSystemProperty("task_writer_count", "1")
.setSystemProperty("task_partitioned_writer_count", "2")
.setCatalogSessionProperty("hive", "collect_column_statistics_on_write", "true")
.setCatalogSessionProperty("hive", "orc_compression_codec", "ZSTD")
.setCatalogSessionProperty("hive", "compression_codec", "NONE")
.setCatalogSessionProperty("hive", "hive_storage_format", "PARQUET")
.setCatalogSessionProperty("hive", "respect_table_format", "false").build();
String tmpTableName = generateRandomTableName();

for (String tableFormat : TABLE_FORMATS) {
try {
getQueryRunner().execute(session, String.format("CREATE TABLE %s (name VARCHAR, regionkey BIGINT, nationkey BIGINT) WITH (format = '%s', partitioned_by = ARRAY['regionkey','nationkey'])", tmpTableName, tableFormat));
// With different storage_format for partition than table format
getQueryRunner().execute(session, String.format("INSERT INTO %s SELECT name, regionkey, nationkey FROM nation", tmpTableName));
// TODO add support for presto to query each partition's format then verify written format is correct
}
finally {
dropTableIfExists(tmpTableName);
}
}
}

@Test
public void testCreateUnpartitionedTableAsSelect()
{
Expand Down

0 comments on commit d1e7b5e

Please sign in to comment.