Summary
TypeSignatureParser.parse() extracts the inner content of a parameterized type using:
inner = type_str[paren_idx + 1 : -1].strip()
This assumes the closing ) is always the last character of the string. If a type signature has a modifier after the closing parenthesis — such as timestamp(3) with time zone — the parser would incorrectly truncate the trailing text.
Current impact
Low — Athena's current DDL type system does not produce this pattern in result_set_type_hints contexts. The timestamp with time zone type is returned by Athena metadata as a flat string (no parenthesized parameter), so this does not affect real-world usage today.
Proposal
Either:
- Handle trailing modifiers by finding the matching
) instead of assuming it's at [-1]
- Document the limitation explicitly in the type hint docs (e.g., "type signatures must not contain trailing modifiers after the closing parenthesis")
Option 2 is probably sufficient unless Athena/Trino introduces new parameterized types with modifiers.
Location
pyathena/parser.py, TypeSignatureParser.parse() method.
Summary
TypeSignatureParser.parse()extracts the inner content of a parameterized type using:This assumes the closing
)is always the last character of the string. If a type signature has a modifier after the closing parenthesis — such astimestamp(3) with time zone— the parser would incorrectly truncate the trailing text.Current impact
Low — Athena's current DDL type system does not produce this pattern in
result_set_type_hintscontexts. Thetimestamp with time zonetype is returned by Athena metadata as a flat string (no parenthesized parameter), so this does not affect real-world usage today.Proposal
Either:
)instead of assuming it's at[-1]Option 2 is probably sufficient unless Athena/Trino introduces new parameterized types with modifiers.
Location
pyathena/parser.py,TypeSignatureParser.parse()method.