[ 
https://issues.apache.org/jira/browse/SPARK-40659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17612849#comment-17612849
 ] 

Raghu Angadi commented on SPARK-40659:
--------------------------------------

For 1): No schema evolution is necessary. We keep reading old and latest 
messages.

For 2): Schema evolution is for this case so that we don't drop fields.

Say a streaming application reads from Kafka and writes all the fields to a 
delta table. This pipeline keeps running for a long time. Meanwhile customer 
adds a new field 'zip_code' to the schema. What should happen?
 * (a) Without schema evolution: 'zip_code' field would be dropped and would 
not appear in the destination table.
 * (b) With schema evolution: we create new column 'zip_code' and populate the 
column.

We want to have (b). In terms of implementation, if throw a specific error, 
structured streaming stops the pipeline and restarts, which will fetch the new 
schema and handle 'zip_code' correctly. 

> Schema evolution for protobuf (and Avro too?)
> ---------------------------------------------
>
>                 Key: SPARK-40659
>                 URL: https://issues.apache.org/jira/browse/SPARK-40659
>             Project: Spark
>          Issue Type: Improvement
>          Components: Structured Streaming
>    Affects Versions: 3.3.0
>            Reporter: Raghu Angadi
>            Priority: Major
>
> Protobuf & Avro should support schema evolution in streaming. We need to 
> throw a specific error message when we detect newer version of the the schema 
> in schema registry.
> A couple of options for detecting version change at runtime:
>  * How do we detect newer version from schema registry? It is contacted only 
> during planning currently.
>  * We could detect version id in coming messages.
>  ** What if the id in the incoming message is newer than what our 
> schema-registry reports after the restart?
>  *** This indicates delayed syncs between customers schema-registry servers 
> (should be rare). We can keep erroring out until it is fixed.
>  *** Make sure we log the schema id used during planning.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to