-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Summary
In TypedValueConverter._convert_typed_struct(), the unnamed struct path splits values using:
values = [v.strip() for v in inner.split(",")]This naive split does not respect nested structures. If an unnamed struct field contains a nested struct or array with commas (e.g., {Alice, {x=1, y=2}, 30}), the split will incorrectly break the nested value.
The named struct path correctly uses _split_array_items() which respects brace/bracket grouping.
Current impact
Low — Athena's unnamed ROW format (positional fields without = separators) is relatively uncommon in practice, and nested complex types within unnamed structs are even rarer. The named struct and JSON paths handle nesting correctly.
Proposal
Replace inner.split(",") with _split_array_items(inner) in the unnamed struct branch to match the named struct path's behavior.
This is a one-line change:
# Before
values = [v.strip() for v in inner.split(",")]
# After
values = _split_array_items(inner)Location
pyathena/parser.py, TypedValueConverter._convert_typed_struct(), around the "Unnamed struct" comment.