Polars: Check to see if the cache is empty before enabling GC. More logging (#13286)

There was a bug where anytime the plugin cache remove was called, the
plugin gc was turned back on. This probably happened when I added the
reference counter logic.
This commit is contained in:
Jack Wright
2024-07-03 04:44:26 -07:00
committed by GitHub
parent 0cfd5fbece
commit 8316a1597e
4 changed files with 112 additions and 5 deletions

View File

@ -27,6 +27,7 @@ pub enum PolarsPluginType {
NuExpression,
NuLazyGroupBy,
NuWhen,
NuPolarsTestData,
}
impl fmt::Display for PolarsPluginType {
@ -37,6 +38,7 @@ impl fmt::Display for PolarsPluginType {
Self::NuExpression => write!(f, "NuExpression"),
Self::NuLazyGroupBy => write!(f, "NuLazyGroupBy"),
Self::NuWhen => write!(f, "NuWhen"),
Self::NuPolarsTestData => write!(f, "NuPolarsTestData"),
}
}
}
@ -48,6 +50,7 @@ pub enum PolarsPluginObject {
NuExpression(NuExpression),
NuLazyGroupBy(NuLazyGroupBy),
NuWhen(NuWhen),
NuPolarsTestData(Uuid, String),
}
impl PolarsPluginObject {
@ -95,6 +98,7 @@ impl PolarsPluginObject {
Self::NuExpression(_) => PolarsPluginType::NuExpression,
Self::NuLazyGroupBy(_) => PolarsPluginType::NuLazyGroupBy,
Self::NuWhen(_) => PolarsPluginType::NuWhen,
Self::NuPolarsTestData(_, _) => PolarsPluginType::NuPolarsTestData,
}
}
@ -105,6 +109,7 @@ impl PolarsPluginObject {
PolarsPluginObject::NuExpression(e) => e.id,
PolarsPluginObject::NuLazyGroupBy(lg) => lg.id,
PolarsPluginObject::NuWhen(w) => w.id,
PolarsPluginObject::NuPolarsTestData(id, _) => *id,
}
}
@ -115,6 +120,9 @@ impl PolarsPluginObject {
PolarsPluginObject::NuExpression(e) => e.into_value(span),
PolarsPluginObject::NuLazyGroupBy(lg) => lg.into_value(span),
PolarsPluginObject::NuWhen(w) => w.into_value(span),
PolarsPluginObject::NuPolarsTestData(id, s) => {
Value::string(format!("{id}:{s}"), Span::test_data())
}
}
}
}