You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "wForget (via GitHub)" <gi...@apache.org> on 2025/09/26 04:24:47 UTC

[I] Check if struct type has duplicate keys when converting to ArrowSchema [datafusion-comet]

wForget opened a new issue, #2457:
URL: https://github.com/apache/datafusion-comet/issues/2457

   ### Describe the bug
   
   In the failed test case of #2444, I found that the struct type with duplicate keys will be deduplicated when converted to arrowType, which causes `RowToColumanr` to lose some columns.
   
   error:
   
   ```
   Job aborted due to stage failure: Task 0 in stage 7.0 failed 1 times, most recent failure: Lost task 0.0 in stage 7.0 (TID 9) (10.5.155.10 executor driver): java.lang.IndexOutOfBoundsException: Index 2 out of bounds for length 2
   	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
   	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
   	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
   	at java.base/java.util.Objects.checkIndex(Objects.java:361)
   	at java.base/java.util.ArrayList.get(ArrayList.java:427)
   	at org.apache.comet.vector.CometStructVector.getChild(CometStructVector.java:55)
   	at org.apache.spark.sql.vectorized.ColumnarRow.isNullAt(ColumnarRow.java:101)
   ```
   
   ### Steps to reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   _No response_


-- 
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: github-unsubscribe@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Check if struct type has duplicate keys when converting to ArrowSchema [datafusion-comet]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on issue #2457:
URL: https://github.com/apache/datafusion-comet/issues/2457#issuecomment-4152357363

   @andygrove Thanks for providing this informations. Duplicate fields should be a relatively rare case, and falling back to spark when encountering them should be sufficient. I will close this issue.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Check if struct type has duplicate keys when converting to ArrowSchema [datafusion-comet]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on issue #2457:
URL: https://github.com/apache/datafusion-comet/issues/2457#issuecomment-3406633271

   This PR does not make comet plan fallback when there is struct type with duplicate keys, but instead throws an exception. As comment on https://github.com/apache/datafusion-comet/issues/2457#issuecomment-3336738317, we are capable of supporting struct with duplicate keys, so I will mark this PR as draft and look forward to more discussions.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Check if struct type has duplicate keys when converting to ArrowSchema [datafusion-comet]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on issue #2457:
URL: https://github.com/apache/datafusion-comet/issues/2457#issuecomment-3336738317

   This is actually related to the default `CONFLICT_REPLACE` conflict policy of StructVector, which will replace the existing field with the newer one when there is a conflict. We can change this behavior by adding `-Darrow.struct.conflict.policy=CONFLICT_APPEND`.
   
   https://github.com/apache/arrow-java/blob/f38e72f5a46e30f44c28ff407eb522a5e5c266c0/vector/src/main/java/org/apache/arrow/vector/complex/AbstractStructVector.java#L65-L75


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Check if struct type has duplicate keys when converting to ArrowSchema [datafusion-comet]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget commented on issue #2457:
URL: https://github.com/apache/datafusion-comet/issues/2457#issuecomment-3336742133

   But I would prefer to reject this behavior, like spark does.
   
   https://github.com/apache/spark/blob/cb283404d3b229f18b8508793098aa6759af46a7/sql/api/src/main/scala/org/apache/spark/sql/util/ArrowUtils.scala#L212


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Check if struct type has duplicate keys when converting to ArrowSchema [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on issue #2457:
URL: https://github.com/apache/datafusion-comet/issues/2457#issuecomment-4144871957

   This appears to have been fixed through multiple layers of validation that now prevent duplicate struct field names from reaching the Arrow schema conversion:
   
   1. **CreateNamedStruct** (`structs.scala`) — rejects duplicate field names, falls back to Spark (commit abd9f858e)
   2. **Shuffle** (`QueryPlanSerde.scala`) — rejects structs with duplicate field names (commit 9203f1734)
   3. **Native DataFusion scan** (`CometScanRule.scala`) — rejects duplicates in case-insensitive mode (commit f6d84b138)
   4. **Rust error handling** (`errors.rs`) — converts DataFusion deduplication errors to proper Spark errors instead of crashing (commit 9929745d7)
   
   @wForget can this issue be closed?


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [I] Check if struct type has duplicate keys when converting to ArrowSchema [datafusion-comet]

Posted by "wForget (via GitHub)" <gi...@apache.org>.
wForget closed issue #2457: Check if struct type has duplicate keys when converting to ArrowSchema
URL: https://github.com/apache/datafusion-comet/issues/2457


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org