Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: bump polars to unreleased 2023-12-21 version #601

Merged
merged 35 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a5bf90a
chore: bump polars to unreleased 2023-12-16 version [skip ci]
eitsupi Dec 17, 2023
715b920
Merge branch 'main' into bump-polars-to-py-0.20.0
etiennebacher Dec 17, 2023
2f83d6c
Merge branch 'main' into bump-polars-to-py-0.20.0
eitsupi Dec 18, 2023
3a92643
feat: raise on not supported aggregates [ci skip]
eitsupi Dec 19, 2023
2d3179e
feat: warn if `by` columns is not sorted in rolling aggregations [ski…
eitsupi Dec 19, 2023
4c733db
fix: rename `str_json_extract` to `str_json_decode` [skip ci]
eitsupi Dec 19, 2023
c9c7139
feat: move categorical ordering into dtype [skip ci]
eitsupi Dec 19, 2023
4d7a92b
feat: multi-character comments in read_csv [skip ci]
eitsupi Dec 19, 2023
f1290d6
fix: rename `series_equal` to `equals` [skip ci]
eitsupi Dec 19, 2023
2e8e696
feat!: preserve left and right join keys in outer joins [skip ci]
eitsupi Dec 19, 2023
41fe4d6
chore: more comment [skip ci]
eitsupi Dec 19, 2023
fca66c7
feat: raise on not supported aggregates [ci skip]
eitsupi Dec 19, 2023
ad5d961
fix!: rename frame_equal to equals [skip ci]
eitsupi Dec 19, 2023
2afb151
perf: improve rolling algorithm [skip ci]
eitsupi Dec 19, 2023
9e06573
chore: regen extendr-wrappers.R [skip ci]
eitsupi Dec 19, 2023
477ab22
chore: update scan_csv in R side [skip ci]
eitsupi Dec 19, 2023
722f9e5
chore: rename frame_equal to equals in R side [skip ci]
eitsupi Dec 19, 2023
20bcc64
refactor!: rename series_equal to equals [skip ci]
eitsupi Dec 19, 2023
27c5bed
chore: update rolling functions in R side [skip ci]
eitsupi Dec 19, 2023
1f4d0e0
chore: rename json_extract to json_decode in R side [skip ci]
eitsupi Dec 19, 2023
f149bb0
fix: some fixes for unit test
eitsupi Dec 19, 2023
0120520
Merge branch 'main' into bump-polars-to-py-0.20.0
eitsupi Dec 19, 2023
33341f3
fix new outer join behaviour
etiennebacher Dec 22, 2023
68361f8
sink_csv doesn't always order rows in the same way
etiennebacher Dec 22, 2023
328fcf7
$count() doesn't count missing values anymore
etiennebacher Dec 22, 2023
b92baaa
chore: bump polars
eitsupi Dec 22, 2023
9286567
docs: fix example of <DataFrame>$describe
eitsupi Dec 22, 2023
dfb2805
refactor(test): ensure remove tempfiles
eitsupi Dec 22, 2023
341cb35
test: fix sorting issue
eitsupi Dec 22, 2023
47e808d
Revert "refactor(test): ensure remove tempfiles"
eitsupi Dec 22, 2023
9c99c98
docs: update news
eitsupi Dec 22, 2023
d5dd36c
implement `$replace()`
etiennebacher Dec 22, 2023
b4c11ba
Merge remote-tracking branch 'upstream/main' into bump-polars-to-py-0…
eitsupi Dec 23, 2023
b5a6ea4
docs: update news
eitsupi Dec 23, 2023
93a971f
test: update snapshot
eitsupi Dec 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions R/datatype.R
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ DataType_constructors = list(
and_then(DataType$new_struct) |>
unwrap("in pl$Struct:")
}

# TODO: Categorical
eitsupi marked this conversation as resolved.
Show resolved Hide resolved
)

#' Create Datetime DataType
Expand Down
80 changes: 48 additions & 32 deletions src/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ serde_json = "*"
smartstring = "1.0.1"
state = "0.6.0"
thiserror = "1.0.51"
polars-core = { git = "https://github.com/pola-rs/polars.git", rev = "b13afbecac039205dacbaca766ecca4bf441b347", default-features = false }
polars-lazy = { git = "https://github.com/pola-rs/polars.git", rev = "b13afbecac039205dacbaca766ecca4bf441b347", default-features = false }
polars-core = { git = "https://github.com/pola-rs/polars.git", rev = "f96d2cd5b70ee8d7412971d0d057f3f523a91bb1", default-features = false }
polars-lazy = { git = "https://github.com/pola-rs/polars.git", rev = "f96d2cd5b70ee8d7412971d0d057f3f523a91bb1", default-features = false }
either = "1"
#features copied from node-polars

Expand Down Expand Up @@ -141,4 +141,4 @@ features = [
"zip_with",
]
git = "https://github.com/pola-rs/polars.git"
rev = "b13afbecac039205dacbaca766ecca4bf441b347"
rev = "f96d2cd5b70ee8d7412971d0d057f3f523a91bb1"
2 changes: 1 addition & 1 deletion src/rust/src/conversion_r_to_s.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ fn recursive_robjname2series_tree(x: &Robj, name: &str) -> pl::PolarsResult<Seri
.expect("as_character_factor() enforces same type"),
name,
)
.cast(&pl::DataType::Categorical(None))
.cast(&pl::DataType::Categorical(None, Default::default()))
.expect("as matched"),
)),

Expand Down
2 changes: 1 addition & 1 deletion src/rust/src/conversion_s_to_r.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub fn pl_series_to_list(
.set_class(["rpolars_raw_list", "list"])
.expect("this class label is always valid")
}),
Categorical(_) => s
Categorical(_, _) => s
.categorical()
.map(|ca| extendr_api::call!("factor", ca.iter_str().collect_robj()).unwrap()),
List(_) => {
Expand Down
56 changes: 37 additions & 19 deletions src/rust/src/lazy/dataframe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,43 +183,61 @@ impl RPolarsLazyFrame {
self.0.clone().last().into()
}

fn max(&self) -> Self {
self.0.clone().max().into()
fn max(&self) -> RResult<Self> {
let ldf = self.0.clone();
let out = ldf.max().map_err(polars_to_rpolars_err)?;
Ok(out.into())
}

fn min(&self) -> Self {
self.0.clone().min().into()
fn min(&self) -> RResult<Self> {
let ldf = self.0.clone();
let out = ldf.min().map_err(polars_to_rpolars_err)?;
Ok(out.into())
}

fn mean(&self) -> Self {
self.0.clone().mean().into()
fn mean(&self) -> RResult<Self> {
let ldf = self.0.clone();
let out = ldf.mean().map_err(polars_to_rpolars_err)?;
Ok(out.into())
}

fn median(&self) -> Self {
self.0.clone().median().into()
fn median(&self) -> RResult<Self> {
let ldf = self.0.clone();
let out = ldf.median().map_err(polars_to_rpolars_err)?;
Ok(out.into())
}

fn sum(&self) -> Self {
self.0.clone().sum().into()
fn sum(&self) -> RResult<Self> {
let ldf = self.0.clone();
let out = ldf.sum().map_err(polars_to_rpolars_err)?;
Ok(out.into())
}

pub fn std(&self, ddof: Robj) -> Result<Self, String> {
Ok(self.clone().0.std(robj_to!(u8, ddof)?).into())
fn std(&self, ddof: Robj) -> RResult<Self> {
let ldf = self.0.clone();
let out = ldf
.std(robj_to!(u8, ddof)?)
.map_err(polars_to_rpolars_err)?;
Ok(out.into())
}

pub fn var(&self, ddof: Robj) -> Result<Self, String> {
Ok(self.clone().0.var(robj_to!(u8, ddof)?).into())
fn var(&self, ddof: Robj) -> RResult<Self> {
let ldf = self.0.clone();
let out = ldf
.var(robj_to!(u8, ddof)?)
.map_err(polars_to_rpolars_err)?;
Ok(out.into())
}

pub fn quantile(&self, quantile: Robj, interpolation: Robj) -> RResult<Self> {
Ok(self
.clone()
.0
fn quantile(&self, quantile: Robj, interpolation: Robj) -> RResult<Self> {
let ldf = self.0.clone();
let out = ldf
.quantile(
robj_to!(PLExpr, quantile)?,
robj_to!(new_quantile_interpolation_option, interpolation)?,
)
.into())
.map_err(polars_to_rpolars_err)?;
Ok(out.into())
}

fn shift(&self, periods: Robj) -> Result<Self, String> {
Expand Down
Loading