mirror of
https://github.com/nushell/nushell.git
synced 2025-05-29 14:21:45 +02:00
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:
parent
9bb7f0c7dc
commit
058ce0ed2d
@ -54,6 +54,7 @@ url.workspace = true
|
||||
[dependencies.polars]
|
||||
features = [
|
||||
"arg_where",
|
||||
"bigidx",
|
||||
"checked_arithmetic",
|
||||
"cloud",
|
||||
"concat_str",
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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),
|
||||
|
@ -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(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user