Describe the bug
We have observed that casting a struct with fields of the same type, to a schema that re-orders the fields, miss-assigns the values. It appears like the values are assigned positionally, instead of by field name.
To Reproduce
I've prepared a reproducing example here: https://github.com/aroig/datafusion-cast-bug
Just do cargo run to reproduce.
Expected behavior
I would expect that casting {"b": 3, "a": 4}, to schema {"a": Int, "b": Int} would produce {"a": 4, "b": 3}, however the obtained result is {"a": 3, "b": 4}, as if the values are assigned positionally instead of by field name.
Additional context
No response
Describe the bug
We have observed that casting a struct with fields of the same type, to a schema that re-orders the fields, miss-assigns the values. It appears like the values are assigned positionally, instead of by field name.
To Reproduce
I've prepared a reproducing example here: https://github.com/aroig/datafusion-cast-bug
Just do
cargo runto reproduce.Expected behavior
I would expect that casting
{"b": 3, "a": 4}, to schema{"a": Int, "b": Int}would produce{"a": 4, "b": 3}, however the obtained result is{"a": 3, "b": 4}, as if the values are assigned positionally instead of by field name.Additional context
No response