vinothchandar opened a new issue #3323:
URL: https://github.com/apache/hudi/issues/3323
**Describe the problem you faced**
A clear and concise description of the problem.
**To Reproduce**
Steps to reproduce the behavior:
```
from pyspark.sql import SparkSession
spark = (
SparkSession.builder.appName("Hudi_Data_Processing_Framework")
.config("spark.serializer",
"org.apache.spark.serializer.KryoSerializer")
.config("spark.sql.hive.convertMetastoreParquet", "false")
.config(
"spark.jars.packages",
"org.apache.hudi:hudi-spark3-bundle_2.12:0.8.0,org.apache.spark:spark-avro_2.12:3.0.2"
)
.getOrCreate()
)
input_df = spark.createDataFrame(
[
(100, "2015-01-01", "2015-01-01T01:01:01.010101Z", 10),
(101, "2015-01-01", "2015-01-01T01:01:01.010101Z", 10),
(102, "2015-01-01", "2015-01-01T01:01:01.010101Z", 10),
(103, "2015-01-01", "2015-01-01T01:01:01.010101Z", 10),
(104, "2015-01-01", "2015-01-01T01:01:01.010101Z", 10),
(105, "2015-01-01", "2015-01-01T01:01:01.010101Z", 10),
],
("acctid", "date", "ts", "deposit"),
)
hudi_options = {'hoodie.table.name': 'compaction',
'hoodie.datasource.write.table.type': 'MERGE_ON_READ',
'hoodie.datasource.write.operation': 'upsert',
'hoodie.datasource.write.recordkey.field': 'acctid',
'hoodie.datasource.write.partitionpath.field': 'date',
'hoodie.datasource.write.precombine.field': 'ts',
'hoodie.datasource.write.hive_style_partitioning': 'true',
'hoodie.upsert.shuffle.parallelism': 2,
'hoodie.insert.shuffle.parallelism': 2,
'hoodie.delete.shuffle.parallelism': 2
}
# INSERT
(
input_df.write.format("org.apache.hudi")
.options(**hudi_options)
.mode("append")
.save("/tmp/hudi_incr1")
)
# UPDATE deposit to **11** for key 100
update_df = spark.createDataFrame(
[(100, "2015-01-01", "2015-01-01T11:01:01.000000Z", 11)], ("acctid",
"date", "ts", "deposit"))
update_df.write.format("org.apache.hudi").options(**hudi_options).mode("append").save("/tmp/hudi_incr1")
# UPDATE deposit to **12** for key 100
update_df = spark.createDataFrame(
[(100, "2015-01-01", "2015-01-01T12:01:01.000000Z", 12)], ("acctid",
"date", "ts", "deposit"))
update_df.write.format("org.apache.hudi").options(**hudi_options).mode("append").save("/tmp/hudi_incr1")
# UPDATE deposit to **13** for key 100
update_df = spark.createDataFrame(
[(100, "2015-01-01", "2015-01-01T13:01:01.000000Z", 13)], ("acctid",
"date", "ts", "deposit"))
update_df.write.format("org.apache.hudi").options(**hudi_options).mode("append").save("/tmp/hudi_incr1")
output_df = spark.read.format("org.apache.hudi").load(
"/tmp/hudi_incr1/"
)
output_df.show()
first_commit = '20210721080013' # As per this particular run
output_df = (spark.read
.option("hoodie.datasource.query.type", "incremental")
.option("hoodie.datasource.read.begin.instanttime",
first_commit)
# .option("hoodie.datasource.read.end.instanttime", last_commit)
.format("org.apache.hudi")
.load("/tmp/hudi_incr1/"))
output_df.show()
```
**Expected behavior**
A clear and concise description of what you expected to happen.
**Environment Description**
* Hudi version :
* Spark version :
* Hive version :
* Hadoop version :
* Storage (HDFS/S3/GCS..) :
* Running on Docker? (yes/no) :
**Additional context**
Add any other context about the problem here.
**Stacktrace**
```Add the stacktrace of the error.```
--
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]