Only mark collected dataframes as from_lazy=false when collect is called from the collect command. (#12571)

I had previously changed NuLazyFrame::collect to set the NuDataFrame's
from_lazy field to false to prevent conversion back to a lazy frame. It
appears there are cases where this should happen. Instead, I am only
setting from_lazy=false inside the `polars collect` command.

[Related discord
message](https://discord.com/channels/601130461678272522/1227612017171501136/1230600465159421993)

Co-authored-by: Jack Wright <jack.wright@disqo.com>
This commit is contained in:
Jack Wright 2024-04-18 15:10:38 -07:00 committed by GitHub
parent 9a265847e2
commit cc7b5c5a26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -64,7 +64,9 @@ impl PluginCommand for LazyCollect {
let value = input.into_value(call.head);
match PolarsPluginObject::try_from_value(plugin, &value)? {
PolarsPluginObject::NuLazyFrame(lazy) => {
let eager = lazy.collect(call.head)?;
let mut eager = lazy.collect(call.head)?;
// We don't want this converted back to a lazy frame
eager.from_lazy = true;
Ok(PipelineData::Value(
eager
.cache(plugin, engine, call.head)?

View File

@ -64,7 +64,7 @@ impl NuLazyFrame {
help: None,
inner: vec![],
})
.map(|df| NuDataFrame::new(false, df))
.map(|df| NuDataFrame::new(true, df))
}
pub fn apply_with_expr<F>(self, expr: NuExpression, f: F) -> Self