eric9204 commented on issue #6965:
URL: https://github.com/apache/hudi/issues/6965#issuecomment-1301754534
@nsivabalan @xiarixiaoyao I have tested it, and this case can reproduce the
same issue. Hope this can help you.
```
import org.apache.spark.SparkConf
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.streaming.{OutputMode,Trigger}
object RatePerMicroBatchSourceTest {
def main(args: Array[String]): Unit = {
val sparkConf = new SparkConf()
sparkConf.set("spark.serializer",
"org.apache.spark.serializer.KryoSerializer")
.set("spark.sql.shuffle.partitions", "4")
val spark =
SparkSession.builder().config(sparkConf).master("local[6]").getOrCreate()
val dataFrame = spark.readStream
.format("rate")
.option("rowsPerBatch", 4)
.option("numPartitions", 4)
.option("startTimestamp", 0)
.option("advanceMillisPerBatch", 1000)
.load()
dataFrame.createTempView("t")
val resultDf = spark.sql(
"""
|select timestamp,value,date_format(now(),'yyyyMMddHHmm') as part
from t
|""".stripMargin)
resultDf.writeStream
.queryName("RateStreamSource")
.format("hudi")
.options(getHudiConfig)
.outputMode(OutputMode.Append())
.trigger(Trigger.ProcessingTime("10 seconds"))
.start()
.awaitTermination()
}
def getHudiConfig = {
Map(
"hoodie.datasource.write.operation" -> "insert",
"hoodie.merge.allow.duplicate.on.inserts" -> "true",
"hoodie.datasource.write.table.type" -> "MERGE_ON_READ",
"hoodie.datasource.write.precombine.field" -> "timestamp",
"hoodie.datasource.write.recordkey.field" -> "value",
"hoodie.datasource.write.partitionpath.field" -> "part",
"hoodie.table.name" -> "rateHudiTest",
"hoodie.datasource.write.keygenerator.class" ->
"org.apache.hudi.keygen.SimpleKeyGenerator",
"hoodie.datasource.write.drop.partition.columns" -> "false",
"hoodie.upsert.shuffle.parallelism" -> "4",
"hoodie.insert.shuffle.parallelism" -> "4",
"hoodie.datasource.compaction.async.enable" -> "false",
"hoodie.compact.inline" -> "true",
"hoodie.compact.inline.max.delta.commits" -> "3",
"hoodie.index.type" -> "BUCKET",
"hoodie.bucket.index.num.buckets" -> "4",
"hoodie.bucket.index.hash.field" -> "value",
"hoodie.storage.layout.partitioner.class" ->
"org.apache.hudi.table.action.commit.SparkBucketIndexPartitioner",
"hoodie.storage.layout.type" -> "BUCKET",
"hoodie.metadata.enable" -> "true",
"hoodie.embed.timeline.server" -> "false",
"path" -> "/tmp/hudi/rateHudiTest",
"checkpointLocation" -> "/tmp/hudi/ckp",
"hoodie.datasource.hive_sync.enable" -> "true",
"hoodie.datasource.hive_sync.username" -> "****",
"hoodie.datasource.hive_sync.database" -> "default",
"hoodie.datasource.hive_sync.table" -> "rateHudiTest",
"hoodie.datasource.hive_sync.password" -> "****",
"hoodie.datasource.hive_sync.jdbcurl" ->
"jdbc:hive2://localhost:10000",
"hoodie.datasource.hive_sync.partition_extractor_class" ->
"org.apache.hudi.hive.MultiPartKeysValueExtractor",
"hoodie.datasource.hive_sync.partition_fields" -> "part",
"hoodie.datasource.write.hive_style_partitioning" -> "false"
)
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]