Skip to content

GH-1530: [Java] Support TimeStamp*TZ map keys and values in ComplexCopier - #1531

Open
jbonofre wants to merge 1 commit into
apache:mainfrom
jbonofre:gh-1530-map-timestamp-tz
Open

jbonofre wants to merge 1 commit into
apache:mainfrom
jbonofre:gh-1530-map-timestamp-tz

Conversation

@jbonofre

Copy link
Copy Markdown
Member

What's Changed

Follow-up to #1414.

  • UnionMapWriter overrides timeStampSecTZ(), timeStampMilliTZ(), timeStampMicroTZ() and timeStampNanoTZ(). After key() or value(), they return the writer of the key or value field, as decimal() and fixedSizeBinary() do. Before, they returned the map writer itself, so a write went into the entries vector (which was then promoted to a union) and writeNull() nulled the whole entry. As with decimal(), the field must already exist; it is created with its timezone by timeStamp*TZ(MapVector.KEY_NAME or MapVector.VALUE_NAME, timezone).
  • ComplexCopier creates the target key or value field with the source timezone, as the struct path does, so TZ map keys and values are copied instead of throwing UnsupportedOperationException. A key or value backed by a union throws an UnsupportedOperationException with a clear message, as in the struct path.

Tests

  • TestComplexCopier#testCopyMapOfTimeStampTZVector replaces the test that expected the throw. It copies a map with Europe/Paris millisecond keys and America/Sao_Paulo nanosecond values, including a null value and a null map, into an empty map, and compares the fields and the vectors.
  • TestMapVector#testTimeStampTZWriter writes TZ keys and values with UnionMapWriter, and checks that the timezones are kept and that a null value doesn't null the entry.

Both tests fail on main.

Closes #1530.

…plexCopier

UnionMapWriter returned itself from the TimeStamp*TZ getters after key()
or value(), so writes went into the entries vector and writeNull() nulled
the whole entry. The getters now return the key or value field writer, as
decimal() and fixedSizeBinary() do.

ComplexCopier creates the key or value field with the source timezone, so
TZ map keys and values are copied instead of throwing.

Closes apache#1530.
@jbonofre jbonofre added the bug-fix PRs that fix a big. label Nov 28, 2026
@github-actions github-actions Bot added this to the 20.1.0 milestone Nov 28, 2026
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.

[Java] UnionMapWriter and ComplexCopier don't support TimeStamp*TZ map keys and values

1 participant