Github user uncleGen commented on a diff in the pull request:
https://github.com/apache/spark/pull/17052#discussion_r104651490
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/Source.scala
---
@@ -57,10 +60,31 @@ trait Source {
def getBatch(start: Option[Offset], end: Offset): DataFrame
/**
+ * In a streaming query, stream relation will be cut into a series of
batch relations.
+ * We need to mark the batch relation as streaming, i.e. data coming
from a stream source,
+ * so we can apply those streaming strategies to it.
+ */
+ def markAsStreaming(df: DataFrame): DataFrame = {
+ val markAsStreaming = df.logicalPlan transform {
+ case logicalRDD @ LogicalRDD(_, _, _, _, false) =>
+ logicalRDD.dataFromStreaming = true
+ logicalRDD
+ case logicalRelation @ LogicalRelation(_, _, _, false) =>
+ logicalRelation.dataFromStreaming = true
+ logicalRelation
+ case localRelation @ LocalRelation(_, _, false) =>
+ localRelation.dataFromStreaming = true
+ localRelation
+ }
+
--- End diff --
add a new parameter `dataFromStreaming ` to the constructor of
LogicalRelation, LogicalRDD and LocalRelation. `dataFromStreaming ` indicate if
this relation comes from a streaming source. In a streaming query, stream
relation will be cut into a series of batch relations.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]