ericm-db opened a new pull request, #53872:
URL: https://github.com/apache/spark/pull/53872
### What changes were proposed in this pull request?
This PR adds Spark Connect support for the `DataStreamReader.name()` method,
which allows users to specify a name for streaming sources. The implementation
includes:
1. **Protobuf changes**: Added `source_name` field to the `DataSource`
message
2. **Scala Connect**: Added `name()` method with validation to Connect
`DataStreamReader`
3. **Python Connect**: Added `name()` method to Python Connect
`DataStreamReader`
4. **Server-side planner**: Updated `SparkConnectPlanner` to extract and
pass source names
5. **Comprehensive tests**: Added test suites for both Scala and Python
Connect
### Why are the changes needed?
The classic Spark `DataStreamReader` has a `name()` method that allows users
to specify names for streaming sources, used in checkpoint metadata for source
evolution. This functionality was not available in Spark Connect, creating an
API gap between classic and Connect modes.
This PR enables API parity by providing full Connect support for streaming
source naming.
### Does this PR introduce _any_ user-facing change?
Yes. Users can now call `name()` on `DataStreamReader` in Spark Connect:
**Scala:**
```scala
spark.readStream.format("parquet").schema("id
LONG").name("my_source").load(path)
```
**Python:**
```python
spark.readStream.format("parquet").schema("id
LONG").name("my_source").load(path)
```
Names must contain only ASCII letters, digits, and underscores.
### How was this patch tested?
Added comprehensive test coverage:
1. **Scala Connect tests** (`DataStreamReaderNameSuite`): Valid/invalid name
validation, method chaining, different data sources, query execution
2. **Python Connect tests** (`test_streaming_reader_name.py`): Valid/invalid
name validation, type checking, method chaining, different formats, query
execution
All tests enable required streaming source evolution configs.
### Was this patch authored or co-authored using generative AI tooling?
No.
--
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]