AP24110011695 opened a new pull request, #76935:
URL: https://github.com/apache/airflow/pull/76935
<!-- SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICENSE-2.0 -->
## What's changed
`ZipXComArg.resolve()` and `ConcatXComArg.resolve()` both accept dict
upstreams — the guards literally say "XCom zip expects sequence or dict" /
"XCom concat expects sequence or dict" — but only `_MapResult` learned to
handle dicts (#75022). The other two positional result classes still treated a
dict as a key-value map:
- `_ZipResult._get_or_fill` indexed the dict by key, so zipping an upstream
that returned `{"a": 1, "b": 2}` silently produced tuples filled with the raw
`NOTSET` sentinel object (no `fillvalue` given), and an int-keyed dict like
`{0: "x"}` returned values *by key* instead of by position.
- `_ConcatResult.__getitem__` iterated the dict, yielding bare keys —
inconsistent with the `(key, value)` convention `map()` established in #75022.
Both now convert a dict upstream to `items()` tuples, following the
convention documented in the mapping docs by #75022. Probed on current `main`
(f5a99435): `_ZipResult(values=[{"a": 1, "b": 2}])[0]` returned `(ArgNotSet,)`
before this change, and `(("a", 1),)` after.
## Tests
Three end-to-end tests in `test_xcom_arg.py` (same harness style as
`test_xcom_map_dict` from #75022): zip over a dict, zip with `fillvalue` mixing
a dict and a list, and concat over a dict + list with negative indices.
Verified failing-first at the result-class level locally (the pre-fix
assertions returned the sentinel tuples / bare keys shown above); the full
harness runs in CI where the DAG import chain is available.
AI disclosure: drafted with AI assistance, verified locally by probing the
result classes on current main before and after the change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]