polars
polars copied to clipboard
fix(rust): fix specified column order for read_csv
fix #13066
in fn parse_csv()
, we use get_projection()
, which uses the projection that contains the correct columns and order. That function mentions:
we also need to sort the projection to have predictable output
, which happens via sort_unstable()
, which leads to a different order of the projection/columns.
In my fix, we now take the original projection and use that to fetch the matching column names, and when all the chunks of data are processed, I reorder the dataframe (if column_names was specified), into the order that was initially passed.
I would expect this reordering to be present somewhere already, but I couldn't find it