displaying span information, creation time, and size with polars ls (#12472)

# Description
`polars ls` is already different that `dfr ls`. Currently it just shows
the cache key, columns, rows, and type. I have added:
- creation time
- size
- span contents
-  span start and end

<img width="1471" alt="Screenshot 2024-04-10 at 17 27 06"
src="https://github.com/nushell/nushell/assets/56345/545918b7-7c96-4c25-bc01-b9e2b659a408">

# Tests + Formatting
Done

Co-authored-by: Jack Wright <jack.wright@disqo.com>
This commit is contained in:
Jack Wright
2024-04-12 07:23:46 -07:00
committed by GitHub
parent 872945ae8e
commit b9c2f9ee56
8 changed files with 128 additions and 73 deletions

View File

@ -66,14 +66,16 @@ impl PluginCommand for LazyCollect {
PolarsPluginObject::NuLazyFrame(lazy) => {
let eager = lazy.collect(call.head)?;
Ok(PipelineData::Value(
eager.cache(plugin, engine)?.into_value(call.head),
eager
.cache(plugin, engine, call.head)?
.into_value(call.head),
None,
))
}
PolarsPluginObject::NuDataFrame(df) => {
// just return the dataframe, add to cache again to be safe
Ok(PipelineData::Value(
df.cache(plugin, engine)?.into_value(call.head),
df.cache(plugin, engine, call.head)?.into_value(call.head),
None,
))
}

View File

@ -54,7 +54,7 @@ impl PluginCommand for ToLazyFrame {
let df = NuDataFrame::try_from_iter(plugin, input.into_iter(), maybe_schema)?;
let lazy = NuLazyFrame::from_dataframe(df);
Ok(PipelineData::Value(
lazy.cache(plugin, engine)?.into_value(call.head),
lazy.cache(plugin, engine, call.head)?.into_value(call.head),
None,
))
}