Skip to content

Conversation

@yaooqinn
Copy link
Member

@yaooqinn yaooqinn commented Jul 2, 2025

What changes were proposed in this pull request?

When I read a map column with a UDT nested, I encountered:

Caused by: java.lang.IllegalArgumentException: Spark type: ... doesn't match the type: ... in column vector
	at org.apache.spark.sql.execution.datasources.parquet.ParquetColumnVector.<init>(ParquetColumnVector.java:80)
	at org.apache.spark.sql.execution.datasources.parquet.ParquetColumnVector.<init>(ParquetColumnVector.java:139)

This PR adds a recursive loop to omit the UDT

Why are the changes needed?

Add UDT missing features

Does this PR introduce any user-facing change?

No

How was this patch tested?

New Tests

Was this patch authored or co-authored using generative AI tooling?

no

@github-actions github-actions bot added the SQL label Jul 2, 2025
val targetType = sparkReadType.map {
case udt: UserDefinedType[_] => udt.sqlType
case otherType => otherType
_.transformRecursively { case t: UserDefinedType[_] => t.sqlType }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question. What about ORC file format?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dongjoon-hyun, good question. I have an umbrella ticket for udt improvements. Let me check other formats or readers with followups if necessary

@dongjoon-hyun
Copy link
Member

cc @peter-toth

@yaooqinn yaooqinn closed this in 0c6d7fd Jul 3, 2025
@yaooqinn yaooqinn deleted the SPARK-52651 branch July 3, 2025 01:49
@yaooqinn
Copy link
Member Author

yaooqinn commented Jul 3, 2025

Merged to master, thank you @dongjoon-hyun @peter-toth

dongjoon-hyun pushed a commit that referenced this pull request Sep 24, 2025
…ith null DataType

### What changes were proposed in this pull request?
Check whether the parameter DataType is null in ColumnVector constructor before transforming it

### Why are the changes needed?
A subclass of ColumnVector, e.g. Iceberg's [ConstantColumnVector](https://github.com/apache/iceberg/blob/main/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ConstantColumnVector.java#L41), could be created with null `DataType`. It throws NPE after #51349, which can be verified by failed tests in [integrating Spark 4.1.0-preview1 in Iceberg](apache/iceberg#14155)

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
UT.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes #52423 from manuzhang/SPARK-53678.

Authored-by: manuzhang <owenzhang1990@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
huangxiaopingRD pushed a commit to huangxiaopingRD/spark that referenced this pull request Nov 25, 2025
…ith null DataType

### What changes were proposed in this pull request?
Check whether the parameter DataType is null in ColumnVector constructor before transforming it

### Why are the changes needed?
A subclass of ColumnVector, e.g. Iceberg's [ConstantColumnVector](https://github.com/apache/iceberg/blob/main/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/data/vectorized/ConstantColumnVector.java#L41), could be created with null `DataType`. It throws NPE after apache#51349, which can be verified by failed tests in [integrating Spark 4.1.0-preview1 in Iceberg](apache/iceberg#14155)

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
UT.

### Was this patch authored or co-authored using generative AI tooling?
No.

Closes apache#52423 from manuzhang/SPARK-53678.

Authored-by: manuzhang <owenzhang1990@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants