hubgeter commented on code in PR #69376:
URL: https://github.com/apache/doris/pull/69376#discussion_r4384669032


##########
be/test/exec/sink/writer/iceberg/iceberg_partition_writer_test.cpp:
##########
@@ -184,6 +184,31 @@ TEST_F(VIcebergPartitionWriterTest, 
MissingPolicyKeepsCollectionEnabledForRollin
     EXPECT_TRUE(collect_column_stats(*writer));
 }
 
+TEST_F(VIcebergPartitionWriterTest, UnsupportedParquetCodecDoesNotCreateFile) {
+    VExprContextSPtrs output_exprs;
+    iceberg::Schema schema(std::vector<iceberg::NestedField> {});
+    std::string schema_json;
+    std::map<std::string, std::string> hadoop_conf;
+    IPartitionWriterBase::WriteInfo write_info;
+    write_info.file_type = TFileType::FILE_LOCAL;
+    write_info.write_path = ".";
+    auto writer = std::make_unique<VIcebergPartitionWriter>(
+            make_table_sink(std::nullopt), std::vector<std::string> {}, 
output_exprs, schema,
+            &schema_json, std::vector<std::string> {}, std::move(write_info),
+            "unsupported_parquet_codec_" + UniqueId::gen_uid().to_string(), 0,
+            TFileFormatType::FORMAT_PARQUET, TFileCompressType::ZLIB, 
hadoop_conf);
+
+    MockRuntimeState state;
+    Status status = writer->open(&state, nullptr, nullptr);
+
+    EXPECT_FALSE(status.ok());
+    EXPECT_NE(std::string::npos, status.to_string().find("Unsupported compress 
type"));
+    ASSERT_NE(nullptr, writer->_fs);
+    bool exists = true;
+    ASSERT_TRUE(writer->_fs->exists(writer->_path, &exists).ok());
+    EXPECT_FALSE(exists);

Review Comment:
   Addressed in 93f7478d888: the test now instruments 
LocalFileSystem::create_file_impl and asserts zero calls, while retaining the 
null writer and final file-absence checks.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to