casgie commented on code in PR #54180:
URL: https://github.com/apache/spark/pull/54180#discussion_r2787711246
##########
python/docs/source/tutorial/sql/python_data_source.rst:
##########
@@ -534,14 +535,14 @@ The following example demonstrates how to implement a
basic Data Source using Ar
class ArrowBatchDataSourceReader(DataSourceReader):
def __init__(self, schema, options):
self.schema: str = schema
+ self.arrow_schema = to_arrow_schema(self.schema)
self.options = options
def read(self, partition):
# Create Arrow Record Batch
keys = pa.array([1, 2, 3, 4, 5], type=pa.int32())
values = pa.array(["one", "two", "three", "four", "five"],
type=pa.string())
- schema = pa.schema([("key", pa.int32()), ("value", pa.string())])
- record_batch = pa.RecordBatch.from_arrays([keys, values],
schema=schema)
+ record_batch = pa.RecordBatch.from_arrays([keys, values],
schema=self.arrow_schema)
Review Comment:
Yes, that is the core idea of this PR, to avoid specifying the arrow schema
**and** the PySpark schema.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]