wgtmac commented on code in PR #1068:
URL: https://github.com/apache/iceberg-cpp/pull/1068#discussion_r4644056487
##########
src/iceberg/test/file_scan_task_reader_test.cc:
##########
@@ -421,6 +424,165 @@ class FileScanTaskReaderTest : public TempFileTestBase {
std::shared_ptr<Schema> projected_schema_;
};
+TEST_F(FileScanTaskReaderTest, IdentityPartitionConstantsSurviveJsonAndSplit) {
+ auto physical = std::make_shared<Schema>(
+ std::vector<SchemaField>{SchemaField::MakeRequired(1, "id", int32())});
+ ICEBERG_UNWRAP_OR_FAIL(auto file, MakeDataFile(physical, "[[1], [2], [3]]"));
+ ICEBERG_UNWRAP_OR_FAIL(
+ auto spec, PartitionSpec::Make(7, {{2, 1000, "name",
Transform::Identity()}}));
+ file->partition_spec_id = 7;
+ file->partition = PartitionValues({Literal::String("CN")});
+ FileScanTask task(file, {}, nullptr, std::move(spec));
+ ICEBERG_UNWRAP_OR_FAIL(
+ auto json, ToJson(task, {{7,
std::const_pointer_cast<PartitionSpec>(task.spec())}},
+ *table_schema_));
+ ICEBERG_UNWRAP_OR_FAIL(auto parsed, FileScanTaskFromJson(json));
+ ASSERT_NE(parsed->spec(), nullptr);
+ EXPECT_EQ(parsed->spec()->spec_id(), 7);
+ ICEBERG_UNWRAP_OR_FAIL(
+ auto split, FileScanTask::MakeSplit(parsed->data_file(), 0,
parsed->length(), {},
+ nullptr, parsed->spec()));
Review Comment:
Use a proper subrange and assert is_split(); this range is canonicalized to
a whole-file task, so it does not cover spec propagation through the
partial-split constructor.
--
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]