Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-50492][SS] Fix java.util.NoSuchElementException when event time column is dropped after dropDuplicatesWithinWatermark #49065

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,9 @@ case class Deduplicate(
}

case class DeduplicateWithinWatermark(keys: Seq[Attribute], child: LogicalPlan) extends UnaryNode {
// Ensure that references include event time columns so they are not pruned away.
override def references: AttributeSet = AttributeSet(keys) ++
AttributeSet(child.output.filter(_.metadata.contains(EventTimeWatermark.delayKey)))
override def maxRows: Option[Long] = child.maxRows
override def output: Seq[Attribute] = child.output
final override val nodePatterns: Seq[TreePattern] = Seq(DISTINCT_LIKE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,18 @@ class StreamingDeduplicationWithinWatermarkSuite extends StateStoreMetricsTest {
)
}
}

test("SPARK-50492: drop event time column after dropDuplicatesWithinWatermark") {
val inputData = MemoryStream[(Int, Int)]
val result = inputData.toDS()
.withColumn("first", timestamp_seconds($"_1"))
.withWatermark("first", "10 seconds")
.dropDuplicatesWithinWatermark("_2")
.select("_2")

testStream(result, Append)(
AddData(inputData, (1, 2)),
CheckAnswer(2)
)
}
}
Loading