From 10a9a17b8c4f7cecc315abb7df97f588238fba57 Mon Sep 17 00:00:00 2001 From: Jack Wright <56345+ayax79@users.noreply.github.com> Date: Sat, 13 Apr 2024 11:00:46 -0700 Subject: [PATCH] Two consecutive calls to into-lazy should not fail (#12505) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description From @maxim-uvarov's [post](https://discord.com/channels/601130461678272522/1227612017171501136/1228656319704203375). When calling `to-lazy` back to back in a pipeline, an error should not occur: ``` > [[a b]; [6 2] [1 4] [4 1]] | polars into-lazy | polars into-lazy Error: nu::shell::cant_convert × Can't convert to NuDataFrame. ╭─[entry #1:1:30] 1 │ [[a b]; [6 2] [1 4] [4 1]] | polars into-lazy | polars into-lazy · ────────┬─────── · ╰── can't convert NuLazyFrameCustomValue to NuDataFrame ╰──── ``` This pull request ensures that custom value's of NuLazyFrameCustomValue are properly converted when passed in. Co-authored-by: Jack Wright --- .../nu_plugin_polars/src/dataframe/values/nu_dataframe/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/nu_plugin_polars/src/dataframe/values/nu_dataframe/mod.rs b/crates/nu_plugin_polars/src/dataframe/values/nu_dataframe/mod.rs index 7fe44a75b0..209acf594c 100644 --- a/crates/nu_plugin_polars/src/dataframe/values/nu_dataframe/mod.rs +++ b/crates/nu_plugin_polars/src/dataframe/values/nu_dataframe/mod.rs @@ -162,7 +162,9 @@ impl NuDataFrame { for value in iter { match value { - Value::Custom { .. } => return Self::try_from_value(plugin, &value), + Value::Custom { .. } => { + return Self::try_from_value_coerce(plugin, &value, value.span()); + } Value::List { vals, .. } => { let record = vals .into_iter()