kevinjqliu opened a new issue, #18601:
URL: https://github.com/apache/iceberg/issues/18601

   ### Apache Iceberg version
   
   1.12.0 (latest release)
   
   ### Query engine
   
   Spark
   
   ### Please describe the bug 🐞
   
   Vectorized reads of a projected shredded VARIANT fail when `SparkBatch` 
can't detect shredding at plan time. Detection relies on the 
`write.parquet.shred-variants` table property and per-file variant lower 
bounds. Shredding can be enabled via session conf or write option, and shredded 
arrays never get variant bounds.
   
   **Repro** (Spark 4.1, main):
   
   ```sql
   CREATE TABLE t (id BIGINT, v VARIANT) USING iceberg TBLPROPERTIES 
('format-version'='3');
   SET spark.sql.iceberg.shred-variants=true;
   INSERT INTO t VALUES (1, parse_json('{"a": [1, 2]}')), (2, parse_json('{"a": 
[3]}'));
   
   SELECT id, v FROM t;  -- fails
   SET spark.sql.iceberg.vectorization.enabled=false;
   SELECT id, v FROM t;  -- OK
   ```
   
   ```
   java.lang.UnsupportedOperationException: Unsupported variant: shredded 
typed_value primitive
     at 
org.apache.iceberg.arrow.vectorized.VectorizedVariantVisitor.primitive(VectorizedVariantVisitor.java:97)
     ...
     at 
org.apache.iceberg.spark.data.vectorized.VectorizedSparkParquetReaders.buildReader(VectorizedSparkParquetReaders.java:61)
   ```
   
   Originally raised in #17736 (closed unmerged). Related to #18430, which 
covers the unprojected case; its fix #18434 doesn't address this one.
   
   ### Willingness to contribute
   
   - [ ] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


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