deniskuzZ commented on code in PR #6515:
URL: https://github.com/apache/hive/pull/6515#discussion_r3364862408
##########
ql/src/java/org/apache/hadoop/hive/ql/optimizer/ppr/PartExprEvalUtils.java:
##########
@@ -82,9 +87,15 @@ static public Object evalExprWithPart(ExprNodeDesc expr,
Partition p) throws Hiv
partNames.add(entry.getKey());
ObjectInspector oi =
PrimitiveObjectInspectorFactory.getPrimitiveWritableObjectInspector
(TypeInfoFactory.getPrimitiveTypeInfo(partKeyTypes[i++]));
- partValues.add(ObjectInspectorConverters.getConverter(
- PrimitiveObjectInspectorFactory.javaStringObjectInspector, oi)
- .convert(entry.getValue()));
+
+ String partitionValue = entry.getValue();
+ if (partitionValue.equals(defaultPartitionName)) {
+ partValues.add(null); // Null for default partition.
+ } else {
+ partValues.add(ObjectInspectorConverters.getConverter(
+ PrimitiveObjectInspectorFactory.javaStringObjectInspector, oi)
+ .convert(partitionValue));
+ }
Review Comment:
````
Non-Iceberg pcr_t1
(NULL and '' both land in ds=__HIVE_DEFAULT_PARTITION__)
┌────────────────┬─────────────────────────────────────────┬─────────────────────────────────────────┬─────────────────┐
│ Query │ WITHOUT fix │
WITH fix │ Changed by fix? │
├────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────┼─────────────────┤
│ ds is null │ (none) ❌ │ C, D →
ds=NULL │ ✅ fixed │
├────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────┼─────────────────┤
│ ds is not null │ A, B │ A, B
│ no │
├────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────┼─────────────────┤
│ ds = 'null' │ B │ B
│ no │
├────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────┼─────────────────┤
│ ds > 'A' │ C, D, B → ds=__HIVE_DEFAULT_PARTITION__ │ C, D, B →
ds=__HIVE_DEFAULT_PARTITION__ │ no │
├────────────────┼─────────────────────────────────────────┼─────────────────────────────────────────┼─────────────────┤
│ ds < 'A' │ A │ A
│ no │
└────────────────┴─────────────────────────────────────────┴─────────────────────────────────────────┴─────────────────┘
Iceberg ice_01
(NULL → null partition; '' → real ds='')
┌────────────────┬─────────────┬──────────┬─────────────────┐
│ Query │ WITHOUT fix │ WITH fix │ Changed by fix? │
├────────────────┼─────────────┼──────────┼─────────────────┤
│ ds is null │ (none) ❌ │ C │ ✅ fixed │
├────────────────┼─────────────┼──────────┼─────────────────┤
│ ds is not null │ A, B, D │ A, B, D │ no │
├────────────────┼─────────────┼──────────┼─────────────────┤
│ ds = 'null' │ B │ B │ no │
├────────────────┼─────────────┼──────────┼─────────────────┤
│ ds > 'A' │ B │ B │ no │
├────────────────┼─────────────┼──────────┼─────────────────┤
│ ds < 'A' │ D, A │ A, D │ no (same set) │
└────────────────┴─────────────┴──────────┴─────────────────┘
````
- The fix changes exactly one query on each table type: ds is null
(previously returned nothing — the bug)
- Range queries (>, <) are unchanged before/after on both table types → no
regression.
- Iceberg is fully SQL-correct throughout because it never conflates NULL
with ''.
PR scope is NULL semantics only.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]