From 2f1e8ecf7576691fa13a320241ad511a6282843d Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Mon, 14 Aug 2023 12:43:01 +0200 Subject: [PATCH] Add Hive coverage with native format session toggles `TestHiveConnectorTest.testWithAllStorageFormats` is supposed to exercise format configurations, including different reader/writer implementations. For example it exercised two Parquet writers until 13392860aad16167c1b93d9275ceee270b3287c8 when one was removed. This commit adds same improved test coverage for other file formats which have two execution paths. --- .../plugin/hive/BaseHiveConnectorTest.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/BaseHiveConnectorTest.java b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/BaseHiveConnectorTest.java index e671dd5ca5a5..978579d5f158 100644 --- a/plugin/trino-hive/src/test/java/io/trino/plugin/hive/BaseHiveConnectorTest.java +++ b/plugin/trino-hive/src/test/java/io/trino/plugin/hive/BaseHiveConnectorTest.java @@ -8822,7 +8822,25 @@ private List getAllTestingHiveStorageFormat() // REGEX format is read-only continue; } - formats.add(new TestingHiveStorageFormat(getSession(), hiveStorageFormat)); + + Session defaultSession = getSession(); + String catalogName = defaultSession.getCatalog().orElseThrow(); + for (boolean enabled : List.of(true, false)) { + Session session = Session.builder(defaultSession) + .setCatalogSessionProperty(catalogName, "avro_native_reader_enabled", Boolean.toString(enabled)) + .setCatalogSessionProperty(catalogName, "avro_native_writer_enabled", Boolean.toString(enabled)) + .setCatalogSessionProperty(catalogName, "csv_native_reader_enabled", Boolean.toString(enabled)) + .setCatalogSessionProperty(catalogName, "csv_native_writer_enabled", Boolean.toString(enabled)) + .setCatalogSessionProperty(catalogName, "json_native_reader_enabled", Boolean.toString(enabled)) + .setCatalogSessionProperty(catalogName, "json_native_writer_enabled", Boolean.toString(enabled)) + .setCatalogSessionProperty(catalogName, "regex_native_reader_enabled", Boolean.toString(enabled)) + .setCatalogSessionProperty(catalogName, "text_file_native_reader_enabled", Boolean.toString(enabled)) + .setCatalogSessionProperty(catalogName, "text_file_native_writer_enabled", Boolean.toString(enabled)) + .setCatalogSessionProperty(catalogName, "sequence_file_native_reader_enabled", Boolean.toString(enabled)) + .setCatalogSessionProperty(catalogName, "sequence_file_native_writer_enabled", Boolean.toString(enabled)) + .build(); + formats.add(new TestingHiveStorageFormat(session, hiveStorageFormat)); + } } return formats.build(); }