@@ -1623,7 +1623,11 @@ def _sink_callback(
1623
1623
# uses apply without returning to make this operation terminal
1624
1624
self .apply (_sink_callback , metadata = True )
1625
1625
1626
- def concat (self , other : "StreamingDataFrame" ) -> "StreamingDataFrame" :
1626
+ def concat (
1627
+ self ,
1628
+ other : "StreamingDataFrame" ,
1629
+ stream_id : Optional [str ] = None ,
1630
+ ) -> "StreamingDataFrame" :
1627
1631
"""
1628
1632
Concatenate two StreamingDataFrames together and return a new one.
1629
1633
The transformations applied on this new StreamingDataFrame will update data
@@ -1650,7 +1654,7 @@ def concat(self, other: "StreamingDataFrame") -> "StreamingDataFrame":
1650
1654
self ._registry .require_time_alignment ()
1651
1655
1652
1656
return self .__dataframe_clone__ (
1653
- * self .topics , * other .topics , stream = merged_stream
1657
+ * self .topics , * other .topics , stream = merged_stream , stream_id = stream_id
1654
1658
)
1655
1659
1656
1660
def join_latest (
@@ -1726,11 +1730,11 @@ def right_func(value, key, timestamp, headers):
1726
1730
retention_ms = retention_ms ,
1727
1731
)
1728
1732
1733
+ right = right .update (right_func , metadata = True ).filter (lambda value : False )
1729
1734
left = self .apply (left_func , metadata = True ).filter (
1730
1735
lambda value : value is not DISCARDED
1731
1736
)
1732
- right = right .update (right_func , metadata = True ).filter (lambda value : False )
1733
- return left .concat (right )
1737
+ return left .concat (right , stream_id = f"{ self .stream_id } -{ right .stream_id } " )
1734
1738
1735
1739
def ensure_topics_copartitioned (self , * topics : Topic ):
1736
1740
topics = topics or self ._topics
@@ -1766,7 +1770,11 @@ def _add_update(
1766
1770
self ._stream = self ._stream .add_update (func , metadata = metadata ) # type: ignore[call-overload]
1767
1771
return self
1768
1772
1769
- def register_store (self , store_type : Optional [StoreTypes ] = None ):
1773
+ def register_store (
1774
+ self ,
1775
+ stream_id : Optional [str ] = None ,
1776
+ store_type : Optional [StoreTypes ] = None ,
1777
+ ):
1770
1778
"""
1771
1779
Register the default store for the current stream_id in StateStoreManager.
1772
1780
"""
@@ -1776,7 +1784,7 @@ def register_store(self, store_type: Optional[StoreTypes] = None):
1776
1784
changelog_topic_config = self ._topic_manager .derive_topic_config (self ._topics )
1777
1785
1778
1786
self ._processing_context .state_manager .register_store (
1779
- stream_id = self .stream_id ,
1787
+ stream_id = stream_id or self .stream_id ,
1780
1788
store_type = store_type ,
1781
1789
changelog_config = changelog_topic_config ,
1782
1790
)
@@ -1938,8 +1946,10 @@ def wrapper(value: Any, key: Any, timestamp: int, headers: Any) -> Any:
1938
1946
return wrapper
1939
1947
1940
1948
1941
- def _get_transaction (sdf : StreamingDataFrame ) -> PartitionTransaction :
1949
+ def _get_transaction (
1950
+ sdf : StreamingDataFrame , stream_id : Optional [str ] = None
1951
+ ) -> PartitionTransaction :
1942
1952
return sdf .processing_context .checkpoint .get_store_transaction (
1943
- stream_id = sdf .stream_id ,
1953
+ stream_id = stream_id or sdf .stream_id ,
1944
1954
partition = message_context ().partition ,
1945
1955
)
0 commit comments