ad1happy2go commented on issue #8894:
URL: https://github.com/apache/hudi/issues/8894#issuecomment-1579948734
@soumilshah1995 Why do you think the folder should be deleted. It should not
be in order to support time-travel and incremental queries. In latest data I
see it deleted, tried this -
```
assert spark.read.format("hudi").load(path).where("state='Alabama'").count()
> 0
# ============DELETE PARTITION ================
df_hudi = spark.read.format("org.apache.hudi").load(path)
df_hudi.createOrReplaceTempView("hudi")
print("***",df_hudi.count())
hudi_options = {}
try:
spark.createDataFrame([], StructType([])) \
.write \
.format("org.apache.hudi") \
.options(**hudi_options) \
.option("hoodie.datasource.hive_sync.enable", False) \
.option("hoodie.datasource.write.operation", "delete_partition") \
.option("hoodie.datasource.write.partitions.to.delete", "Alabama") \
.mode("append") \
.save(path)
print("1.. ", e)
except Exception as e:
print("Error 1", e)
try:
spark.createDataFrame([], StructType([])) \
.write \
.format("org.apache.hudi") \
.options(**hudi_options) \
.option("hoodie.datasource.hive_sync.enable", False) \
.option("hoodie.datasource.write.operation", "delete_partition") \
.option("hoodie.datasource.write.partitions.to.delete",
"state=Alabama") \
.mode("append") \
.save(path)
print("2.. ", e)
except Exception as e:
print("Error 2", e)
assert spark.read.format("hudi").load(path).where("state='Alabama'").count()
== 0```
--
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]