shubham19may opened a new pull request, #14498:
URL: https://github.com/apache/iceberg/pull/14498

   Fixes: #14430 & #14046
   
   #### Description
   
   This PR fixed two critical issues preventing vectorized Arrow Reads in 
iceberg when:
   
   1. Reading Parquet files with `TIMESTAMP_MILLIS` encoding.
   2. Using shaded Arrow classes in runtime JARs (e.g., `iceberg-spark-runtime`)
   
   Error:
   
   ```bash
   java.lang.ClassCastException: class 
org.apache.iceberg.shaded.org.apache.arrow.vector.TimeStampMicroTZVector cannot 
be cast to class org.apache.iceberg.shaded.org.apache.arrow.vector.BigIntVector 
(org.apache.iceberg.shaded.org.apache.arrow.vector.TimeStampMicroTZVector and 
org.apache.iceberg.shaded.org.apache.arrow.vector.BigIntVector are in unnamed 
module of loader 'app')
   ```
   
   Cause: when reading parquet files with `TIMESTAMP_MILLIS` logical type 
annotation, the **VectorizedArrowReader** incorrectly allocated a 
*TimeStampMicroTZVector* based on iceberg schema (which expects microsecond 
precision), but the actual reader (*TimeStampMicroTZVector*) writes raw long 
values that require a BigIntVector.
   
   Fix:
   
   * Explicitly create a **`Field`** with **`ArrowType.Int(Long.SIZE, true)`** 
type
   * Allocate a **`BigIntVector`** that matches what *TimestampMillisReader* 
expects and return **`ReadType.TIMESTAMP_MILLIS`** to trigger 
millisecond-to-microsecond conversion
   
   Also, setting **`arrow.memory.allocation.manager.type=Netty`**, if already 
not set.
   
   ### Testing
   
   1. Creating a Parquet file with 
**`spark.sql.parquet.outputTimestampType=TIMESTAMP_MILLIS`**
   2. Sending the parquet file path to the Iceberg Table to consider it as a 
data file (an `AddFile()` API)
   3. Querying with **`spark.sql.iceberg.vectorization.enabled=true`**
   4. Confirming successful vectorized reads with correct timestamp values


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