Skip to content

Add Variant value class for Parquet Variant - #41920

Draft
tarun-google wants to merge 1 commit into
apache:masterfrom
tarun-google:variant-1-value-class
Draft

tarun-google wants to merge 1 commit into
apache:masterfrom
tarun-google:variant-1-value-class

Conversation

@tarun-google

Copy link
Copy Markdown
Contributor

Beam has no way to represent Variant (semi-structured) data, so it can't exchange Variant values with Iceberg v3, Spark or Flink. This first PR adds a read-only Java value class for the Parquet Variant v1 binary encoding; schema integration and JSON support follow in separate PRs.

Design doc: https://docs.google.com/document/d/1m9EQEbGbx6tDEBD7ZTGllYQyHkwY8ACSjfOTTNUVwAk/edit

Changes:

  • Add read-only Variant class that wraps Parquet Variant metadata and value bytes without copying
  • Add typed getters for every primitive type, plus object and array navigation
  • Add logical equals and hashCode following the spec's equivalence classes
  • Add tests for all apache/parquet-testing Variant vectors, large objects and malformed input

Tested:
$ ./gradlew :sdks:java:core:test --tests 'org.apache.beam.sdk.schemas.variant.*'
:sdks:java:core:checkstyleMain :sdks:java:core:checkstyleTest :sdks:java:core:spotbugsMain
BUILD SUCCESSFUL in 8m 42s
VariantTest: tests=11, failures=0, errors=0, skipped=0

Beam has no way to represent Variant (semi-structured) data, so it can't exchange
Variant values with Iceberg v3, Spark or Flink. This first PR adds a read-only Java
value class for the Parquet Variant v1 binary encoding; schema integration and JSON
support follow in separate PRs.

Design doc: https://docs.google.com/document/d/1m9EQEbGbx6tDEBD7ZTGllYQyHkwY8ACSjfOTTNUVwAk/edit

Changes:
- Add read-only Variant class that wraps Parquet Variant metadata and value bytes without copying
- Add typed getters for every primitive type, plus object and array navigation
- Add logical equals and hashCode following the spec's equivalence classes
- Add tests for all apache/parquet-testing Variant vectors, large objects and malformed input

Tested:
$ ./gradlew :sdks:java:core:test --tests 'org.apache.beam.sdk.schemas.variant.*' \
    :sdks:java:core:checkstyleMain :sdks:java:core:checkstyleTest :sdks:java:core:spotbugsMain
BUILD SUCCESSFUL in 8m 42s
VariantTest: tests=11, failures=0, errors=0, skipped=0
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.

1 participant