-
Notifications
You must be signed in to change notification settings - Fork 116
Do not convert ArrowCursor fallback values twice #1023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
laughingman7743
merged 2 commits into
master
from
fix/1021-arrow-fallback-double-conversion
Oct 3, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent review (relayed): FINDINGS (1 regression, 3 pre-existing)
Reviewer: Codex CLI 0.160.0, model
gpt-6-astra, reasoning effort high, sandboxread-only, session01a101ff-9276-7291-8c1f-de87bbbae0cc. Static review only. Snapshot: detached worktree at head70a1b877bb8abb3d25f07fd1459ab9dc6ebbe548, base33d3a0700b90f3fe73a98768bbc01d1581a17960. The prompt contained the literal diff and the intended behavior only. Afterwards, the snapshot and the PR worktree were clean at70a1b877.Covered (reviewer): S3 CSV, UNLOAD Parquet and metadata replacement, API fallback, failed and empty construction, sync/async/aio callers, fetch batching, exhaustion, and close, column names, converters, and the changed test and comment.
Findings and author verification:
pyathena/arrow/result_set.py:151: cachingself.convertersin__init__ignoresconverter.set(...)calls made afterexecute(), whereas the base resolved the converters at fetch time. Verified by reading the code. Action: fix.pyathena/result_set.py:748:_rows_to_columnar()keys the columns by name, so on the fallbackSELECT 1 AS x, 2 AS xcollapses into one column. Verified by reading the code. Action: report to the maintainer; out of scope.pyathena/result_set.py:721:_fetch_all_rows()checks every page for a header row, while_pre_fetch()checks only the first page. A later page whose first row equals the column names loses that row. Verified by reading the code. Action: report to the maintainer; out of scope.pyathena/arrow/result_set.py:432:close()assigns a list to_batches, so a later_fetch()raisesTypeError. Already noted in round one; out of scope.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repair: 808cc34 (finding 1)
__init__now records onlyself._convert_rows = bool(self.output_location)._fetch()resolvesself.convertersonce per record batch when it converts rows, and leaves the rows unchanged on the fallback. Aconverter.set()afterexecute()reaches the next fetched batch again, and the converters are still built once per batch instead of once per cell.Validation:
just lintpassed.DefaultArrowTypeConverter,execute(json_parse(...)), thenconverter.set("json", lambda v: ("raw", v)),fetchone()returned(('raw', '{"a":1}'),).tests/pyathena/arrowandtests/pyathena/aio/arrow: 105 passed, includingtest_fetch_all_rows[managed].Self-review of the repair: round one (behavior) and round two (claims) found nothing. The comment ("The fetch methods convert only the values read from a result file") matches both branches. The fix is now one boolean, with no cached state that a converter change can miss.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Independent follow-up (relayed): CLEAN for
70a1b877..808cc34ffaec7b2d433d7232966a6716bd0bdc5a.Reviewer: Codex CLI 0.160.0,
gpt-6-astra, effort high,read-only, session01a10207-a155-73d2-a876-602195cfec74. Static review; afterwards, the snapshot was clean at808cc34f. Covered: S3 CSV/TXT, UNLOAD Parquet and schema metadata, the GetQueryResults fallback, failed and empty construction, converter mutation, batch buffering, fetch methods, exhaustion, close, and the comment. The S3 converters are resolved per fetched batch, so aconverter.set()afterexecute()applies again. Rows already buffered keep their conversion, as on master. Fallback rows get no second conversion. No regressions.