yihua opened a new issue, #20823:
URL: https://github.com/apache/hudi/issues/20823

   A row whose string partition value is empty is written to the default 
partition (`p=__HIVE_DEFAULT_PARTITION__`) and reads back as null, as it does 
for a Spark datasource table. On the DataFrame read path, an equality filter on 
the empty string still returns the row, and reports `''` as its partition value:
   
   ```scala
   spark.sql("create table t (id int, p string) using hudi tblproperties 
(primaryKey = 'id') partitioned by (p) location '/tmp/t'")
   spark.sql("insert into t values (1, ''), (2, 'x')")
   spark.read.format("hudi").load("/tmp/t").where("id = 1").select("id", 
"p").show()  // [1, null]
   spark.read.format("hudi").load("/tmp/t").where("p = ''").select("id", 
"p").show()  // [1, ''], expected no rows
   ```
   
   A Spark parquet table with the same rows returns nothing for `p = ''`, and 
so does Hudi through the catalog table and with more than one partition column. 
A literal `'__HIVE_DEFAULT_PARTITION__'` behaves the same way.
   
   `SparkHoodieTableFileIndex#tryPushDownPartitionPredicates` turns equalities 
that bind every partition column into a partition path and takes the partition 
values from the literals. The path formatter maps `''` to the default partition 
directory, so the file index lists that partition and gives it the value `''` 
instead of null.
   
   Proposal: do not bind an empty or default-partition literal as a static 
partition value, so the predicate is evaluated against the value parsed from 
the path (null), as Spark does.
   


-- 
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]

Reply via email to