You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by "nsivabalan (via GitHub)" <gi...@apache.org> on 2023/04/28 05:13:27 UTC
[GitHub] [hudi] nsivabalan commented on issue #5869: [SUPPORT] There are duplicate values in HUDI MOR table for different partition and not updating values in same partition for GLOBAL_BLOOM
nsivabalan commented on issue #5869:
URL: https://github.com/apache/hudi/issues/5869#issuecomment-1527002010
Not reproducible w/ https://github.com/apache/hudi/pull/8490
```
import org.apache.spark.sql.SaveMode._
import org.apache.hudi.DataSourceReadOptions._
import org.apache.hudi.DataSourceWriteOptions._
import org.apache.spark.sql.{DataFrame, Row, SparkSession}
import scala.collection.mutable
val tableName = "hudi5869"
val spark = SparkSession.builder.enableHiveSupport.getOrCreate
val basePath = "/tmp/hudi5869/"
import spark.implicits._
// spark-shell
val hudiOptions = mutable.Map(
"hoodie.table.name" -> tableName,
"hoodie.datasource.write.table.type" -> "MERGE_ON_READ",
"hoodie.datasource.write.operation" -> "upsert",
"hoodie.datasource.write.recordkey.field" -> "id",
"hoodie.datasource.write.precombine.field" -> "last_update_time",
"hoodie.datasource.write.partitionpath.field" -> "creation_date",
"hoodie.index.type" -> "GLOBAL_BLOOM",
"hoodie.bloom.index.update.partition.path" -> "true",
"hoodie.compact.inline" -> "true",
"hoodie.datasource.write.keygenerator.class" -> "org.apache.hudi.keygen.ComplexKeyGenerator"
)
val df = Seq(
("100", "2015-01-01", "1","a"),
("101", "2015-01-01", "1","a")
).toDF("id", "creation_date", "last_update_time", "new_col")
df.write.format("hudi").
options(hudiOptions).
mode(Append).
save(basePath)
spark.read.format("hudi").load(basePath).show(false)
val df1 = Seq(
("100", "2015-01-02", "2","b"),
("101", "2015-01-01", "2","b")
).toDF("id", "creation_date", "last_update_time", "new_col")
df1.write.format("hudi").
options(hudiOptions).
mode(Append).
save(basePath)
spark.read.format("hudi").load(basePath).show(false)
```
Output:
```
scala> spark.read.format("hudi").load(basePath).show(false)
+-------------------+---------------------+------------------+----------------------+---------------------------------------------------------------------------+---+-------------+----------------+-------+
|_hoodie_commit_time|_hoodie_commit_seqno |_hoodie_record_key|_hoodie_partition_path|_hoodie_file_name |id |creation_date|last_update_time|new_col|
+-------------------+---------------------+------------------+----------------------+---------------------------------------------------------------------------+---+-------------+----------------+-------+
|20230427220827516 |20230427220827516_0_1|id:101 |2015-01-01 |f183954a-9d23-4192-a1ed-8efc25e4e77f-0 |101|2015-01-01 |2 |b |
|20230427220827516 |20230427220827516_1_0|id:100 |2015-01-02 |b395a368-8e9a-46c8-8660-c78cfd53d06f-0_1-275-1770_20230427220827516.parquet|100|2015-01-02 |2 |b |
+-------------------+---------------------+------------------+----------------------+---------------------------------------------------------------------------+---+-------------+----------------+-------+
```
--
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