dtenedor commented on code in PR #60679:
URL: https://github.com/apache/spark/pull/60679#discussion_r4622161475


##########
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java:
##########
@@ -889,7 +947,7 @@ public Optional<Integer> appendObjects(int length, Object 
value) {
         appendStruct(false);
         for (int j = 0; j < row.values().length; ++j) {
           Object element = row.values()[j];
-          if (childColumns[j].appendObjects(1, element).isEmpty()) {
+          if (childColumns[j].appendObjects(1, element, 
fillNullsAndWideDecimals).isEmpty()) {

Review Comment:
   Thanks, good catch. Fixed in cf70f0f1: a default that contains a map 
anywhere now keeps the old behavior, so a NULL or wide-decimal field next to a 
map fails with the old error instead of returning a map with dropped entries. 
`appendObjects` checks for a map once, at the public entry point, before 
filling anything.
   
   I added your example (`named_struct('n', CAST(NULL AS INT), 'm', map('a', 1, 
'b', 2))`), and the same shape with a wide decimal instead of the NULL, to the 
columns the test expects to keep the old error. With the map check removed, the 
test fails because those columns read without an error. The check can go once 
SPARK-60940 fixes the map branch.
   



##########
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/WritableColumnVector.java:
##########
@@ -825,19 +856,46 @@ public final int appendStruct(boolean isNull) {
    * or Optional.empty() otherwise.
    */
   public Optional<Integer> appendObjects(int length, Object value) {
+    boolean fillNullsAndWideDecimals = hasNullOrWideDecimal(value) &&

Review Comment:
   Agreed, done in cf70f0f1. `WritableColumnVector` no longer reads the conf:
   
   - The two-argument `appendObjects` always fills, and the new public 
`appendObjects(length, value, fillNullsAndWideDecimals)` takes the setting.
   - `VectorizedParquetRecordReader.initBatch` reads the legacy conf from its 
Hadoop configuration, the same way it reads 
`LEGACY_PARQUET_RETURN_NULL_STRUCT_IF_ALL_FIELDS_MISSING`, and passes it to 
`ParquetColumnVector`.
   - `OrcFileFormat` and `OrcPartitionReaderFactory` read it on the driver and 
pass it to a new `OrcColumnarBatchReader` constructor. The existing 
two-argument constructor keeps the default.
   
   The legacy-flag test still reproduces the old failure for both formats, so 
the session setting reaches both readers.
   



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

Reply via email to