justinpakzad commented on PR #75022:
URL: https://github.com/apache/airflow/pull/75022#issuecomment-6696972217

   > The fix is correct for `expand()`: each `map()` callable now gets the same 
`(key, value)` item that `expand()` passes for a dict. The two inline points 
are not blocking.
   > 
   > **Smaller observations**
   > 
   > * nit: The `map()` callable now receives `(key, value)` tuples for a dict, 
but no docs say so. One sentence in 
`airflow-core/docs/authoring-and-scheduling/dynamic-task-mapping.rst`, under 
"Transforming expanding data", would cover it.
   > * Follow-up, not for this PR: `zip()` and `concat()` also accept dicts, 
and they still differ from `expand()`. On `main`, `_ZipResult([{"a": 1, "b": 
2}, [1, 2]])[0]` silently returns `(NOTSET, 1)`, because `_get_or_fill` treats 
the `KeyError` as a missing item. `_ConcatResult([{"a": 1}])[0]` returns only 
the key `"a"`. This probably deserves its own issue.
   > * See the inline comments for the other two points.
   
   Thanks for the review Sahar! All comments have been addressed. The dict 
branch in `__getitem__` has been simplified as per your suggestion, I added a 
new line in the docs, and updated the PR description to mention the change.
   
   Note - I've dropped the `test_map_result_dict_getitem` and 
`test_map_result_dict_getitem_out_of_range` tests since they were originally 
added for the manual bounds check, but now that it's been simplified they 
aren't needed (we would be testing Python stdlib behavior and the e2e test 
already covers the (key, value) tuple behavior).
   
   Happy to open a follow up to fix `zip()` and take a closer look at 
`concat()` as well. 
   


-- 
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]

Reply via email to