Skip to content

aroig/datafusion-cast-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DataFusion Struct Field Reordering Bug Reproducer

This is a minimal reproducer for a bug in Apache DataFusion where struct field casting maps values by position instead of by field name.

Bug Description

When casting a struct from one field order to another, DataFusion incorrectly maps values by position rather than by field name.

  • Input: {b: 3, a: 4} with field order [b, a]
  • Target: Field order [a, b]
  • Expected: {a: 4, b: 3} (mapped by field name)
  • Actual: {a: 3, b: 4} (mapped by position - BUG!)

How to Run

cd datafusion_bug
cargo run

Expected Output

The reproducer will show:

❌ BUG: Values mapped by position instead of field name!
   Expected (field name mapping):
     Source a=4 → Target a=4
     Source b=3 → Target b=3
   Actual (position mapping):
     Source position[0]=3 → Target a=3 (WRONG)  
     Source position[1]=4 → Target b=4 (WRONG)
   DataFusion incorrectly maps struct fields by position, not by name!

Environment

  • DataFusion version: 49.0
  • Arrow version: 55.0

This bug affects any system using DataFusion for struct type casting where field order changes between source and target schemas.

About

Reproducer example for a datafusion cast issue

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages