Skip to content

Commit

Permalink
Add Hive coverage with native format session toggles
Browse files Browse the repository at this point in the history
`TestHiveConnectorTest.testWithAllStorageFormats` is supposed to exercise
format configurations, including different reader/writer
implementations. For example it exercised two Parquet writers until
1339286 when one was removed. This
commit adds same improved test coverage for other file formats which
have two execution paths.
  • Loading branch information
findepi committed Aug 14, 2023
1 parent cb9b476 commit 2f1e8ec
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8822,7 +8822,25 @@ private List<TestingHiveStorageFormat> 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();
}
Expand Down

0 comments on commit 2f1e8ec

Please sign in to comment.