apache/iceberg

Spark: Fix map value decoding in test helpers for older versions

Offen

#17.717 geöffnet am 19.08.2026

 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (1.915 Forks)batch import
good first issuespark

Repository-Metriken

Stars
 (5.146 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Problem

The map comparison helpers decode both keys and values with the map key type:

Object actualKey = actualKeys.get(i, convert(keyType));
Object actualValue = actualValues.get(i, convert(keyType));

The value must be decoded with convert(valueType). When the key and value types differ, the current assertions may decode the value incorrectly and do not validate what they appear to validate.

PR #14984 fixes GenericsHelpers for Spark 4.2 and will also fix the duplicate in Spark 4.2 TestHelpers. The same issue remains in both helpers for:

  • spark/v3.5
  • spark/v4.0
  • spark/v4.1

Proposed fix

Update the remaining six occurrences to use:

Object actualValue = actualValues.get(i, convert(valueType));

Add or confirm coverage using a map whose key and value have different Spark types.

Context

Identified while reviewing Spark 4.2 support in #14984: https://github.com/apache/iceberg/pull/14984#discussion_r3788259735

Contributor Guide