thswlsqls opened a new pull request, #10876:
URL: https://github.com/apache/paimon/pull/10876

   
   ### Purpose
   
   fix #10875
   
   - `VariantGet.cast` and `BaseVariantReader.create` matched the map key with 
`equals(DataTypes.STRING())`, which also compares nullability, so a `MAP<STRING 
NOT NULL, ...>` target became an invalid cast (NULL for try, exception 
otherwise).
   - Spark 4.1 variant pushdown hits this by default: `SparkTypeUtils` makes 
map keys NOT NULL, so `try_variant_get(v, '$.m', 'map<string,int>')` returns 
NULL. Found by code trace and unit reproduction, not an end-to-end Spark run.
   - Match the key with `equalsIgnoreNullable`, as Spark matches `MapType(_: 
StringType, _, _)`, the pattern ported in #6652. The unreachable nested branch 
in `create` is dropped.
   
   ### Tests
   
   - Existing map extraction tests only use nullable keys.
   - Added `GenericVariantTest#testVariantGetMapWithNotNullStringKey` (try and 
strict, nested in an array, INT key stays invalid), 
`BaseVariantReaderTest#testMapReaderWithNotNullStringKey` (shredded object), 
and a NOT NULL key case in `PaimonShreddingUtilsTest#testAssembleAllTypes`; all 
fail without the fix.
   - `mvn -pl paimon-common -DfailIfNoTests=false clean install` (JDK 11): 
BUILD SUCCESS, including checkstyle, spotless and rat.
   
   
   


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