Skip to content
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 @@ -33,7 +33,7 @@ import org.apache.kafka.common.TopicPartition
import org.scalatest.concurrent.PatienceConfiguration.Timeout
import org.scalatest.time.SpanSugar._

import org.apache.spark.sql.{ForeachWriter, SparkSession}
import org.apache.spark.sql.{Dataset, ForeachWriter, SparkSession}
import org.apache.spark.sql.execution.datasources.v2.StreamingDataSourceV2Relation
import org.apache.spark.sql.execution.exchange.ReusedExchangeExec
import org.apache.spark.sql.execution.streaming._
Expand Down Expand Up @@ -900,7 +900,7 @@ abstract class KafkaMicroBatchSourceSuiteBase extends KafkaSourceSuiteBase {
}
testUtils.waitUntilOffsetAppears(topicPartition, 5)

val q = ds.writeStream.foreachBatch { (ds, epochId) =>
val q = ds.writeStream.foreachBatch { (ds: Dataset[String], epochId: Long) =>
if (epochId == 0) {
// Send more message before the tasks of the current batch start reading the current batch
// data, so that the executors will prefetch messages in the next batch and drop them. In
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ class ForeachBatchSinkSuite extends StreamTest {
}
assert(ex1.getMessage.contains("foreachBatch function cannot be null"))
val ex2 = intercept[AnalysisException] {
ds.writeStream.foreachBatch((_, _) => {}).trigger(Trigger.Continuous("1 second")).start()
ds.writeStream.foreachBatch((_: Dataset[Int], _: Long) => {})
.trigger(Trigger.Continuous("1 second")).start()
}
assert(ex2.getMessage.contains("'foreachBatch' is not supported with continuous trigger"))
val ex3 = intercept[AnalysisException] {
ds.writeStream.foreachBatch((_, _) => {}).partitionBy("value").start()
ds.writeStream.foreachBatch((_: Dataset[Int], _: Long) => {}).partitionBy("value").start()
}
assert(ex3.getMessage.contains("'foreachBatch' does not support partitioning"))
}
Expand Down