Skip to content

Conversation

@HeartLinked
Copy link
Contributor

@HeartLinked HeartLinked commented Nov 7, 2025

  • Removing schema_ member from PartitionSpec, Making PartitionType() method require a Schema parameter instead of using the stored schema.
  • Add table_schema_ in ManifestEntryAdapter.
  • Fix bug in ManifestEntryAdapter::init(v1/v2/v3) to use table_schema in metadata_["schema"].
  • Fix error in related test.

Copy link
Member

@wgtmac wgtmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main feedback is that we need to keep the schema parameter because we eventually need it to create bound partition spec.

/// \param[out] default_spec_id The default partition spec ID.
/// \param[out] partition_specs The list of partition specs.
Status ParsePartitionSpecs(const nlohmann::json& json, int8_t format_version,
const std::shared_ptr<Schema>& current_schema,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, let's keep it.

for (const auto& spec_json : spec_array) {
ICEBERG_ASSIGN_OR_RAISE(auto spec,
PartitionSpecFromJson(current_schema, spec_json));
ICEBERG_ASSIGN_OR_RAISE(auto spec, PartitionSpecFromJson(spec_json));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

std::shared_ptr<Schema> schema) {
if (fields_.empty()) {
return nullptr;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation allows using partition_type_ cache based on tableschema_, but the given schema parameter may belong to a different schema version, which could lead to correctness issues.
Suggest adding schema_id to the cache key to ensure consistency.

such as:
std::unordered_map<int32_t, std::shared_ptr> partition_type_cache_;

@wgtmac wgtmac changed the title refactor: decouple PartitionSpec from Schema refactor: change PartitionSpec to be independent of Schema Nov 10, 2025
Copy link
Collaborator

@zhjwpku zhjwpku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@wgtmac wgtmac merged commit bb02a15 into apache:main Nov 11, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants