move to polars bigidx (#15177)

Fixes [#15157](https://github.com/nushell/nushell/issues/15157)

# Description
Utilizes the polar's bigidx feature to support massive datasets.
This commit is contained in:
Jack Wright 2025-02-25 15:29:56 -08:00 committed by GitHub
parent 9bb7f0c7dc
commit 058ce0ed2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 8 additions and 7 deletions

View File

@ -54,6 +54,7 @@ url.workspace = true
[dependencies.polars]
features = [
"arg_where",
"bigidx",
"checked_arithmetic",
"cloud",
"concat_str",

View File

@ -137,7 +137,7 @@ fn command_lazy(
call: &EvaluatedCall,
lazy: NuLazyFrame,
) -> Result<PipelineData, ShellError> {
let rows: Option<u32> = call.opt(0)?;
let rows: Option<u64> = call.opt(0)?;
let rows = rows.unwrap_or(1);
let res: NuLazyFrame = lazy.to_polars().limit(rows).into();

View File

@ -111,8 +111,8 @@ fn command_lazy(
call: &EvaluatedCall,
lazy: NuLazyFrame,
) -> Result<PipelineData, ShellError> {
let rows: Option<u32> = call.opt(0)?;
let rows = rows.unwrap_or(DEFAULT_ROWS as u32);
let rows: Option<u64> = call.opt(0)?;
let rows = rows.unwrap_or(DEFAULT_ROWS as u64);
let res: NuLazyFrame = lazy.to_polars().tail(rows).into();

View File

@ -106,7 +106,7 @@ fn command(
let casted = match index.dtype() {
DataType::UInt32 | DataType::UInt64 | DataType::Int32 | DataType::Int64 => index
.cast(&DataType::UInt32)
.cast(&DataType::UInt64)
.map_err(|e| ShellError::GenericError {
error: "Error casting index list".into(),
msg: e.to_string(),
@ -123,7 +123,7 @@ fn command(
}),
}?;
let indices = casted.u32().map_err(|e| ShellError::GenericError {
let indices = casted.u64().map_err(|e| ShellError::GenericError {
error: "Error casting index list".into(),
msg: e.to_string(),
span: Some(index_span),

View File

@ -99,7 +99,7 @@ fn command(
let casted = match indices.dtype() {
DataType::UInt32 | DataType::UInt64 | DataType::Int32 | DataType::Int64 => indices
.as_ref()
.cast(&DataType::UInt32, CastOptions::default())
.cast(&DataType::UInt64, CastOptions::default())
.map_err(|e| ShellError::GenericError {
error: "Error casting indices".into(),
msg: e.to_string(),
@ -117,7 +117,7 @@ fn command(
}?;
let indices = casted
.u32()
.u64()
.map_err(|e| ShellError::GenericError {
error: "Error casting indices".into(),
msg: e.to_string(),