map_funcs Expression Audits#
Audit notes for expressions in this category that have been audited. Absence of an entry means the expression has not been audited yet, not that it is unsupported. See the user guide Spark Expression Support for current support status.
element_at#
Spark 3.4.3 (audited 2026-05-27): identical to 3.5.8.
Spark 3.5.8 (audited 2026-05-27): baseline.
ElementAt(left, right, defaultValueOutOfBound, failOnError) extends GetMapValueUtil; the parser routeselement_at(<array>, ...)to one overload andelement_at(<map>, ...)to another. CometCometElementAtonly supportsArrayTypeinput;MapTypeinput falls back.Spark 4.0.1 (audited 2026-05-27): adds
nullIntolerant: Booleanfield; semantics unchanged.Spark 4.1.1 (audited 2026-05-27): identical to 4.0.1.
map_contains_key#
Spark 3.4.3 (audited 2026-05-27): identical to 3.5.8.
Spark 3.5.8 (audited 2026-05-27): baseline.
MapContainsKey(left, right) extends RuntimeReplaceable with InheritAnalysisRules; the analyzer rewrites toArrayContains(MapKeys(left), right). Comet routes viaCometMapContainsKeywhich emits the equivalentarray_has(map_keys(map), key).Spark 4.0.1 (audited 2026-05-27): semantics unchanged; minor trait refactors.
Spark 4.1.1 (audited 2026-05-27): identical to 4.0.1.
map_entries#
Spark 3.4.3 (audited 2026-05-27): identical to 3.5.8.
Spark 3.5.8 (audited 2026-05-27): baseline.
MapEntries(child)returns an array of structs<key, value>. Wired to nativemap_entries.Spark 4.0.1 (audited 2026-05-27): semantics unchanged.
Spark 4.1.1 (audited 2026-05-27): identical to 4.0.1.
map_from_arrays#
Spark 3.4.3 (audited 2026-05-27): identical to 3.5.8.
Spark 3.5.8 (audited 2026-05-27): baseline.
MapFromArrays(left, right) extends BinaryExpression with NullIntolerant; Spark usesArrayBasedMapBuilderto detect duplicate keys (subject tospark.sql.mapKeyDedupPolicy) and rejects null keys withRuntimeException("Cannot use null as map key"). CometCometMapFromArrayswraps the inputs inCaseWhen(IsNotNull(left) AND IsNotNull(right), map(left, right), null)so NULL-array inputs return NULL rather than triggering the previously reported native crash (#3327).Spark 4.0.1 (audited 2026-05-27): semantics unchanged;
NullIntoleranttrait replaced bynullIntolerant: Boolean.Spark 4.1.1 (audited 2026-05-27): identical to 4.0.1.
map_from_entries#
Spark 3.4.3 (audited 2026-05-27): identical to 3.5.8.
Spark 3.5.8 (audited 2026-05-27): baseline.
MapFromEntries(child) extends UnaryExpression with NullIntolerant; expects an array of structs and produces a map. Wired asCometScalarFunction("map_from_entries").Spark 4.0.1 (audited 2026-05-27): semantics unchanged; trait refactor.
Spark 4.1.1 (audited 2026-05-27): identical to 4.0.1.
Known limitation: input arrays where the struct’s key or value type contains
BinaryTypeare markedIncompatibleand fall back unlessspark.comet.expression.MapFromEntries.allowIncompatible=true.
map_keys#
Spark 3.4.3 (audited 2026-05-27): identical to 3.5.8.
Spark 3.5.8 (audited 2026-05-27): baseline.
MapKeys(child)returns the map’s keys as an array. Wired to nativemap_keys.Spark 4.0.1 (audited 2026-05-27): semantics unchanged.
Spark 4.1.1 (audited 2026-05-27): identical to 4.0.1.
map_values#
Spark 3.4.3 (audited 2026-05-27): identical to 3.5.8.
Spark 3.5.8 (audited 2026-05-27): baseline.
MapValues(child)returns the map’s values as an array. Wired to nativemap_values.Spark 4.0.1 (audited 2026-05-27): semantics unchanged.
Spark 4.1.1 (audited 2026-05-27): identical to 4.0.1.
str_to_map#
Spark 3.4.3 (audited 2026-05-27): identical to 3.5.8.
Spark 3.5.8 (audited 2026-05-27): baseline.
StringToMap(text, pairDelim, keyValueDelim) extends TernaryExpression; splitstextonpairDelim, then each pair onkeyValueDelim(default","and":"). UsesArrayBasedMapBuilderfor duplicate-key handling. Wired asCometScalarFunction("str_to_map").Spark 4.0.1 (audited 2026-05-27):
inputTypeswidened toStringTypeNonCSAICollation; usesCollationAwareUTF8String.splitSQLwith acollationId. Runtime unchanged forUTF8_BINARY.Spark 4.1.1 (audited 2026-05-27): adds the
legacySplitTruncateflag (driven byspark.sql.legacy.truncateForEmptyRegexSplit) to bothsplitSQLcalls (https://github.com/apache/datafusion-comet/issues/4477). The Comet native impl does not honour this flag; behaviour matches the non-legacy default.