fixing cache drop issues on pivot
This commit is contained in:
parent
a467939f67
commit
53b3831a9d
|
@ -9,7 +9,7 @@ use polars_ops::pivot::pivot;
|
||||||
use crate::{
|
use crate::{
|
||||||
dataframe::values::utils::convert_columns_string,
|
dataframe::values::utils::convert_columns_string,
|
||||||
values::{CustomValueSupport, PolarsPluginObject},
|
values::{CustomValueSupport, PolarsPluginObject},
|
||||||
PolarsPlugin,
|
Cacheable, PolarsPlugin,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::super::values::NuDataFrame;
|
use super::super::values::NuDataFrame;
|
||||||
|
@ -126,7 +126,8 @@ fn command_eager(
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let res = NuDataFrame::new(false, pivoted);
|
let res = NuDataFrame::new(false, pivoted);
|
||||||
res.to_pipeline_data(plugin, engine, call.head)
|
res.cache(plugin, engine, call.head)?
|
||||||
|
.to_pipeline_data(plugin, engine, call.head)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_column_datatypes<T: AsRef<str>>(
|
fn check_column_datatypes<T: AsRef<str>>(
|
||||||
|
|
|
@ -3,6 +3,7 @@ use std::cmp::Ordering;
|
||||||
use cache::cache_commands;
|
use cache::cache_commands;
|
||||||
pub use cache::{Cache, Cacheable};
|
pub use cache::{Cache, Cacheable};
|
||||||
use dataframe::{stub::PolarsCmd, values::CustomValueType};
|
use dataframe::{stub::PolarsCmd, values::CustomValueType};
|
||||||
|
use log::debug;
|
||||||
use nu_plugin::{EngineInterface, Plugin, PluginCommand};
|
use nu_plugin::{EngineInterface, Plugin, PluginCommand};
|
||||||
|
|
||||||
mod cache;
|
mod cache;
|
||||||
|
@ -72,6 +73,7 @@ impl Plugin for PolarsPlugin {
|
||||||
engine: &EngineInterface,
|
engine: &EngineInterface,
|
||||||
custom_value: Box<dyn CustomValue>,
|
custom_value: Box<dyn CustomValue>,
|
||||||
) -> Result<(), LabeledError> {
|
) -> Result<(), LabeledError> {
|
||||||
|
debug!("cache_value_dropped called {:?}", custom_value);
|
||||||
if !self.disable_cache_drop {
|
if !self.disable_cache_drop {
|
||||||
let id = CustomValueType::try_from_custom_value(custom_value)?.id();
|
let id = CustomValueType::try_from_custom_value(custom_value)?.id();
|
||||||
let _ = self.cache.remove(engine, &id, false);
|
let _ = self.cache.remove(engine, &id, false);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user