-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-53696][PYTHON][CONNECT][SQL] Default to bytes for BinaryType in PySpark #52467
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
xianzhe-databricks
wants to merge
33
commits into
apache:master
from
xianzhe-databricks:binary-type-defaults-to-bytes-v2
Closed
Changes from 22 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
ac5d83c
first commit
xianzhe-databricks 1e702c9
data source related
xianzhe-databricks 659fe4e
add conf on connect
xianzhe-databricks e791532
add partial tests
xianzhe-databricks 6787bfc
Update python/pyspark/sql/tests/arrow/test_arrow_binary_as_bytes_udf.py
HyukjinKwon 453298d
add tests for spark connect
xianzhe-databricks c859ce7
resolve with remote
xianzhe-databricks 09bfef3
lint
xianzhe-databricks 238e2b7
fix ci
xianzhe-databricks 8db164c
add docs
xianzhe-databricks b10fc9d
add tests for arrow python udtf
xianzhe-databricks 7d3cf56
add a shield
xianzhe-databricks 922c1a4
rename conf' also make classic dataframe API work with the conf
xianzhe-databricks 16e8428
add size
xianzhe-databricks fd5fcb2
apply binary as bytes consistently in all cases
xianzhe-databricks fd687f2
reformat
xianzhe-databricks ee5d2c2
remove usearrow
xianzhe-databricks 31f52c8
udf test restructure
xianzhe-databricks d63d7b3
doc
xianzhe-databricks 91aed20
fix ci
xianzhe-databricks 9ce5dfd
fix foreach partition
xianzhe-databricks e488e3b
add tests for nested structure
xianzhe-databricks 4683449
address comments
xianzhe-databricks 852f9d9
fix build and simplify tests
xianzhe-databricks b933d61
address comments
xianzhe-databricks fa202b1
move utils
xianzhe-databricks 9d0c72e
hope to fix mypy
xianzhe-databricks 78f54b9
Fix mypy errors for binary_as_bytes parameter
xianzhe-databricks 61562df
Fix mypy error: add type ignore comment for field converter call
xianzhe-databricks 1bcc68e
doc
xianzhe-databricks f6d87de
minor change on migration guide
xianzhe-databricks b8b7cc0
merge with master
xianzhe-databricks 1a72098
nits
xianzhe-databricks 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -854,14 +854,17 @@ class ArrowBatchUDFSerializer(ArrowStreamArrowUDFSerializer): | |
int_to_decimal_coercion_enabled : bool | ||
If True, applies additional coercions in Python before converting to Arrow | ||
This has performance penalties. | ||
binary_as_bytes : bool | ||
If True, binary type will be deserialized as bytes, otherwise as bytearray. | ||
""" | ||
|
||
def __init__( | ||
self, | ||
timezone, | ||
safecheck, | ||
input_types, | ||
int_to_decimal_coercion_enabled=False, | ||
int_to_decimal_coercion_enabled, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the default value for |
||
binary_as_bytes, | ||
): | ||
super().__init__( | ||
timezone=timezone, | ||
|
@@ -871,6 +874,7 @@ def __init__( | |
) | ||
self._input_types = input_types | ||
self._int_to_decimal_coercion_enabled = int_to_decimal_coercion_enabled | ||
self._binary_as_bytes = binary_as_bytes | ||
|
||
def load_stream(self, stream): | ||
""" | ||
|
@@ -887,7 +891,9 @@ def load_stream(self, stream): | |
List of columns containing list of Python values. | ||
""" | ||
converters = [ | ||
ArrowTableToRowsConversion._create_converter(dt, none_on_identity=True) | ||
ArrowTableToRowsConversion._create_converter( | ||
dt, none_on_identity=True, binary_as_bytes=self._binary_as_bytes | ||
) | ||
for dt in self._input_types | ||
] | ||
|
||
|
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.
Uh oh!
There was an error while loading. Please reload this page.