Skip to content

ArrowCursor converts GetQueryResults fallback values twice in the fetch methods #1021

Description

@laughingman7743

Problem

With managed query result storage (no S3 output location), ArrowCursor builds its table from GetQueryResults rows that _fetch_all_rows() has already converted with DefaultTypeConverter, and then AthenaArrowResultSet._fetch() converts every value again with self.converters (pyathena/arrow/result_set.py, _as_arrow_from_api() and _fetch()).
The Arrow converters expect strings, so the fetch methods fail or decode twice.

Measured on master 785be36 (2026-10-03) with the managed work group, fetchone() after execute():

Query Result
SELECT DATE '2026-10-03' (datetime.date(2026, 10, 3),)
SELECT DECIMAL '1.25' (Decimal('1.25'),)
SELECT CAST('12:34:56' AS TIME) TypeError: strptime() argument 1 must be str, not datetime.time
SELECT X'0102' TypeError: a bytes-like object is required, not 'str'
SELECT json_parse('{"a":1}') TypeError: the JSON object must be str, bytes or bytearray, not dict
SELECT CAST('{"a":1}' AS JSON) ({'a': 1},), while as_arrow() holds the string '{"a":1}' (decoded twice)

Affected since managed query result storage support was added in v3.28.0 (83566ef, #664).
PolarsCursor had the same double conversion and was fixed in #1005.

Expected

On the GetQueryResults fallback, the fetch methods return the values that as_arrow() holds, without converting them again.

Found while measuring #1018.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions