JingsongLi commented on code in PR #6145:
URL: https://github.com/apache/paimon/pull/6145#discussion_r2299859023
##########
paimon-format/src/test/java/org/apache/paimon/format/TextCompressionTest.java:
##########
@@ -65,6 +66,41 @@ public abstract class TextCompressionTest {
/** Returns the file extension for the format. */
protected abstract String getFormatExtension();
+ /**
+ * Test case for when a file has a compression extension but the
corresponding compression codec
+ * is not available or cannot be found.
+ */
+ @Test
+ void testWriteFileWithCompressionExtensionButCompressionNotFound() throws
IOException {
+ // Use a fictional compression extension that doesn't have a
corresponding codec
+ String fileName = "test_unsupported." + getFormatExtension() + ".xyz";
+ Options options = new Options();
+ options.set(CoreOptions.FILE_COMPRESSION, "xyz"); // Non-existent
compression type
+
+ FileFormat format = createFileFormat(options);
+ Path filePath = new Path(tempDir.resolve(fileName).toString());
+ FileIO fileIO = new LocalFileIO();
+
+ // Attempt to write with unsupported compression should handle
gracefully
+ FormatWriterFactory writerFactory =
format.createWriterFactory(rowType);
+
+ // This should either:
+ // 1. Fall back to no compression and succeed, or
+ // 2. Throw an appropriate exception
+ try (FormatWriter writer =
Review Comment:
Use `assertThrows`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]