You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "ad1happy2go (via GitHub)" <gi...@apache.org> on 2023/06/26 11:50:47 UTC
[GitHub] [hudi] ad1happy2go commented on issue #9032: [SUPPORT] NPE when reading from a CDC-enabled table but written with BULK_INSERT
ad1happy2go commented on issue #9032:
URL: https://github.com/apache/hudi/issues/9032#issuecomment-1607304355
@zaza I tried to reproduce the issue with hudi 0.13.1, but I am seeing the appropriate behaviour only for bulk insert too. All CDC rows are coming as inserts which is expected for bulk insert.
Can you let me know on exactly what scenario you are getting NullPointerException? Is it intermittent?
Code I tried -
```
val path="file:///tmp/output/issue_9032_4"
val dataGen = new DataGenerator
val inserts = convertToStringList(dataGen.generateInserts(10))
val df = spark.read.json(spark.sparkContext.parallelize(inserts, 2))
val options = Map(
"hoodie.table.name" -> "line_items",
"hoodie.datasource.write.recordkey.field" -> "uuid",
"hoodie.datasource.write.precombine.field" -> "ts",
"hoodie.datasource.write.partitionpath.field" -> "partitionpath",
"hoodie.parquet.max.file.size" -> "125829120",
"hoodie.parquet.small.file.limit" -> "104857600",
"hoodie.index.type" -> "BLOOM",
"hoodie.bloom.index.use.metadata" -> "true",
"hoodie.cleaner.policy" -> "KEEP_LATEST_COMMITS",
"hoodie.cleaner.commits.retained" -> "168",
"hoodie.keep.min.commits" -> "173",
"hoodie.keep.max.commits" -> "174"
)
df.write.format("hudi").options(options).option(DataSourceWriteOptions.OPERATION.key, "bulk_insert").option(HoodieTableConfig.NAME.key(), "line_items")
.option(HoodieTableConfig.CDC_ENABLED.key, "true")
.option(HoodieTableConfig.CDC_SUPPLEMENTAL_LOGGING_MODE.key, HoodieCDCSupplementalLoggingMode.data_before_after.name())
.mode("append")
.save(path);
spark.readStream.format("hudi").option("hoodie.datasource.query.incremental.format", "cdc").option("hoodie.datasource.query.type", "incremental")
.load(path)
.writeStream.foreachBatch { (batch: Dataset[Row], _: Long) => batch.show(false); }.start.awaitTermination;
```
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org