Repository navigation
Fix indexing mapped task results with a NumPy integer - #73400
Eason09053360 wants to merge 1 commit into
Conversation
LazyXComSequence.__getitem__ converted index-like keys through __index__ but then raised TypeError unconditionally anyway, so the conversion was dead code: objects such as numpy.int64 - routinely produced by argmax and by pandas - could never index a mapped task's results, even though the slice path has coerced them correctly since the same commit introduced both. The message also read the type name after the key was overwritten, so an integer-like key was reported as "not int", giving no clue what was actually passed.
|
Hello @Eason09053360 - thank you for your contributions to Apache Airflow! The Airflow community has introduced a limit of 5 open pull requests at a time for contributors without write access to the repository. You currently have 33 open pull requests, so - as a one-time step of introducing the limit - we closed the ones where maintainers have not engaged yet:
These pull requests stay open because maintainers are already engaged in them - they count towards your limit:
This is not a judgement of you or of your changes. We never told contributors before that opening many pull requests at once was a problem, so there is nothing to feel bad about - and nothing is lost: your branches, commits and the review history stay where they are. What we ask you to do is to make your first prioritization decision: choose which of the pull requests above matter most to you, and reopen them (up to 5 open at a time, including the ones still open) with the "Reopen pull request" button or While your pull requests are waiting for review, the most valuable thing you can do is help in other ways - reviewing other contributors' pull requests, helping with issues, and taking part in the discussions on the devlist and Slack. Why we introduced the limit, what it means for you and how to reopen or restore a pull request is explained in https://github.com/apache/airflow/blob/main/contributing-docs/32_open_pull_request_limit.rst. Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting |
Why
LazyXComSequence.__getitem__coerces index-like keys through__index__, but theraise TypeErrorsits outside theif, so it fires unconditionally and the coerced value is thrown away. Indexing a mapped task's results with anumpy.int64(whatargmaxreturns) therefore always fails, while the slice path has accepted the same keys since_coerce_slice_indexlanded in the same commit (#50117).keyis also overwritten before the message is built, so an integer-like key is reported as...not int.What
lazy_sequence.py: raise only when__index__is absent, and beforekeyis reassigned.test_lazy_sequence.py:test_getitem_index_likecovers this branch, which had no coverage at all .That is why the dead coercion went unnoticed.
test_getitem_rejects_non_indexguards the reorderedraise; it passes onmaintoo.LazySelectSequenceinairflow-core/src/airflow/utils/db.pystill rejects such keys, but is not on the Dag-authoring path. Happy to align it in a follow-up.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines