github-actions[bot] commented on code in PR #69376:
URL: https://github.com/apache/doris/pull/69376#discussion_r4384572174
##########
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:
[P2] Assert that file creation is never attempted
This test also passes with the pre-fix Iceberg writer: unsupported ZLIB sets
`open_status`, then `_defer_file_cleanup()` resets `_file_writer` (whose
`LocalFileWriter` destructor closes and deletes the file) and deletes `_path`.
Consequently the error checks and `exists == false` all succeed after a
create-then-delete cycle, so moving validation back below `create_file()` would
go undetected. Count calls through the existing
`LocalFileSystem::create_file_impl` sync point and assert zero, while retaining
the final absence check.
--
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]