Expose flag to not maintain order on polars concat (#15145)

This commit is contained in:
Jack Wright 2025-02-19 19:50:57 -08:00 committed by GitHub
parent c504c93a1d
commit 3d58c3f70e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -34,6 +34,11 @@ impl PluginCommand for ConcatDF {
.switch("rechunk", "Rechunk the resulting dataframe", None)
.switch("to-supertypes", "Cast to supertypes", None)
.switch("diagonal", "Concatenate dataframes diagonally", None)
.switch(
"no-maintain-order",
"Do not maintain order. The default behavior is to maintain order.",
None,
)
.switch(
"from-partitioned-ds",
"Concatenate dataframes from a partitioned dataset",
@ -109,6 +114,7 @@ fn command_lazy(
let to_supertypes = call.has_flag("to-supertypes")?;
let diagonal = call.has_flag("diagonal")?;
let from_partitioned_ds = call.has_flag("from-partitioned-ds")?;
let maintain_order = !call.has_flag("no-maintain-order")?;
let mut dataframes = call
.rest::<Value>(0)?
.iter()
@ -133,8 +139,7 @@ fn command_lazy(
to_supertypes,
diagonal,
from_partitioned_ds,
// todo - expose maintain order
..Default::default()
maintain_order,
};
let res: NuLazyFrame = polars::prelude::concat(&dataframes, args)