Skip to content

GH-1473: Keep columns with equal Fields and the schema metadata in VectorSchemaRoot - #1474

Merged
jbonofre merged 1 commit into
apache:mainfrom
jbonofre:schema-root-followups
Nov 15, 2026
Merged

jbonofre merged 1 commit into
apache:mainfrom
jbonofre:schema-root-followups

Conversation

@jbonofre

Copy link
Copy Markdown
Member

What's Changed

Follow-up to #1389, which this PR is based on: until #1389 is merged, only the last commit is new.

  • JsonFileWriter and JsonFileReader look each vector up by position instead of through getVector(Field), so columns with equal Fields (such as duplicate names with the same type) no longer share one vector. A JSON round trip of x: [1], x: [2] read back x: [null], x: [2] before.
  • The Field lookup of VectorSchemaRoot keeps the first of the columns with equal Fields, as getVector(String) documents, instead of the last.
  • syncSchema() keeps the custom metadata of the schema.
  • Review comments on GH-390: Refresh vector lookup when synchronizing the schema #1389: the constructor and syncSchema() share the code that builds the lookup, the comments say the old keys no longer match because the promoted Field is structurally different, an assertion that could not fail is dropped, and the JSON round trip after a schema sync moved to TestJSONFile.

TestJSONFile covers a JSON round trip of duplicate columns through both read() and read(VectorSchemaRoot), and TestVectorSchemaRoot covers the lookup of duplicate columns and the metadata after syncSchema().

Closes #1473.

@jbonofre jbonofre added the bug-fix PRs that fix a big. label Nov 14, 2026
@github-actions github-actions Bot added this to the 20.0.0 milestone Nov 14, 2026
… in VectorSchemaRoot

JsonFileWriter and JsonFileReader look each vector up by position, so
columns with equal Fields no longer share one vector. The Field lookup
keeps the first of such columns, as getVector(String) documents, and
syncSchema() keeps the custom metadata of the schema.

Also addresses review comments on apache#1389: the constructor and
syncSchema() share the code that builds the lookup, and the JSON round
trip after a schema sync moved to TestJSONFile.

Closes apache#1473.
@jbonofre
jbonofre force-pushed the schema-root-followups branch from 1ef4de2 to a199967 Compare November 15, 2026 05:52
@jbonofre
jbonofre merged commit 9f5a080 into apache:main Nov 15, 2026
22 checks passed
@jbonofre
jbonofre deleted the schema-root-followups branch November 15, 2026 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PRs that fix a big.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VectorSchemaRoot loses columns with equal Fields in JSON files, and syncSchema() drops the schema metadata

1 participant