Repository navigation
Conversation
Compare field documentation during schema equality so metadata deduplication retains doc-only updates. Cover nested fields, metadata round trips, unchanged docs, and historical schema reuse; align existing deserialization expectations with their fixture docs.
| bool SchemaField::Equals(const SchemaField& other) const { | ||
| return field_id_ == other.field_id_ && name_ == other.name_ && *type_ == *other.type_ && | ||
| optional_ == other.optional_ && | ||
| optional_ == other.optional_ && doc_ == other.doc_ && |
There was a problem hiding this comment.
nit: doc_ is a plain std::string, so no-doc and doc set to empty compare equal here, while Java's Objects.equals at Types.java:983 treats null and empty as different schemas.
There was a problem hiding this comment.
Thanks for pointing this out. The current C++ API already represents both an absent doc and an explicitly empty doc as an empty std::string. Deserialization defaults a missing doc to an empty string, and serialization omits empty docs, so that distinction is lost before equality is checked. This PR preserves that existing behavior while making changes to the doc string participate in schema equality. Matching Java’s null-versus-empty semantics would require a separate change to the doc representation, API, and serialization.
Changing only a field's documentation through
SetCurrentSchemasilently reuses the previous schema ID and discards the new doc. IncludedocinSchemaFieldequality so schema deduplication records doc-only changes, including nested fields, while preserving the existing default-value comparisons.Add regressions for required/optional fields, nested struct/list/map fields, doc replacement/addition/removal, metadata JSON round trips, identical-schema deduplication, and historical schema ID reuse. Update two metadata deserialization expectations to include the doc already present in their JSON fixtures.
Validation:
schema_test,table_test, andjson_serde_teston the PR branch based on current upstreammain.clang-formatandgit diff --check.