Pyarrow data type, default to small type and fix large type override #1859
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.
Rationale for this change
#1669 made the change to infer the type when reading, and not default pyarrow data types to the large type. Originally, default to large type was introduced by #986.
I found a bug in #1669 where type promotion from string->binary defaults to large_binary (#1669 (comment)). Which led to to find that we still use large type in
_ConvertToArrowSchema
. Furthermore, I found that we did not respectPYARROW_USE_LARGE_TYPES_ON_READ=True
when reading.This PR is a continuation of #1669.
pyarrow.use-large-types-on-read
to default valueFalse
_ConvertToArrowSchema
to use small data type instead of largePYARROW_USE_LARGE_TYPES_ON_READ
is enabled (set toTrue
),ArrowScan
andArrowProjectionVisitor
and should cast to large typePYARROW_USE_LARGE_TYPES_ON_READ
toTrue
This PR should help us infer the data type when reading while keeping the
PYARROW_USE_LARGE_TYPES_ON_READ
override behavior until deprecation.Are these changes tested?
Yes
Are there any user-facing changes?
No