Skip to content

Commit 6c39439

Browse files
authored
Upgrading to rs 0.39 (#196)
* Upgrading to rs 0.38 * Updating yarn lock
1 parent a6ab81a commit 6c39439

18 files changed

+167
-158
lines changed

.github/workflows/docs.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Install latest Rust nightly
1515
uses: dtolnay/rust-toolchain@stable
1616
with:
17-
toolchain: nightly-2024-02-23
17+
toolchain: nightly-2024-03-28
1818
components: rustfmt, clippy
1919
- name: Install ghp-import
2020
uses: actions/setup-python@v5

.github/workflows/test-js.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Install latest Rust nightly
1919
uses: dtolnay/rust-toolchain@stable
2020
with:
21-
toolchain: nightly-2024-02-23
21+
toolchain: nightly-2024-03-28
2222
components: rustfmt, clippy
2323
- run: yarn --version
2424
- name: Install Node Dependencies
@@ -43,7 +43,7 @@ jobs:
4343
- name: Install latest Rust nightly
4444
uses: dtolnay/rust-toolchain@stable
4545
with:
46-
toolchain: nightly-2024-02-23
46+
toolchain: nightly-2024-03-28
4747
components: rustfmt, clippy
4848
- name: Bun version
4949
uses: oven-sh/setup-bun@v1

Cargo.toml

+9-11
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ repository = "https://github.com/pola-rs/nodejs-polars"
1313
crate-type = ["cdylib", "lib"]
1414

1515
[dependencies]
16-
ahash = "0.8.7"
16+
ahash = "0.8.11"
1717
bincode = "1.3.3"
18-
napi = { version = "2.16.1", default-features = false, features = [
18+
napi = { version = "2.16.2", default-features = false, features = [
1919
"napi8",
2020
"serde-json",
2121
] }
22-
napi-derive = { version = "2.16.1", default-features = false }
23-
polars-core = { git = "https://github.com/pola-rs/polars.git", rev = "3e2cab8de39b2721ce3830c3958b3b0796b32258", default-features = false }
24-
polars-io = { git = "https://github.com/pola-rs/polars.git", rev = "3e2cab8de39b2721ce3830c3958b3b0796b32258", default-features = false }
25-
polars-lazy = { git = "https://github.com/pola-rs/polars.git", rev = "3e2cab8de39b2721ce3830c3958b3b0796b32258", default-features = false }
22+
napi-derive = { version = "2.16.2", default-features = false }
23+
polars-core = { git = "https://github.com/pola-rs/polars.git", rev = "37c630320da0d0d3270d283cdafbf6b8402de069", default-features = false }
24+
polars-io = { git = "https://github.com/pola-rs/polars.git", rev = "37c630320da0d0d3270d283cdafbf6b8402de069", default-features = false }
25+
polars-lazy = { git = "https://github.com/pola-rs/polars.git", rev = "37c630320da0d0d3270d283cdafbf6b8402de069", default-features = false }
2626
thiserror = "1"
2727
smartstring = { version = "1" }
2828
serde_json = { version = "1" }
29-
either = "1.10.0"
29+
either = "1.11.0"
3030

3131
[dependencies.polars]
3232
features = [
@@ -91,7 +91,6 @@ features = [
9191
"peaks",
9292
"string_pad",
9393
"cov",
94-
"group_by_list",
9594
"sql",
9695
"binary_encoding",
9796
"rolling_window",
@@ -154,18 +153,17 @@ features = [
154153
"peaks",
155154
"string_pad",
156155
"cov",
157-
"group_by_list",
158156
"http",
159157
"cloud",
160158
"aws",
161159
"gcp",
162160
"azure"
163161
]
164162
git = "https://github.com/pola-rs/polars.git"
165-
rev = "3e2cab8de39b2721ce3830c3958b3b0796b32258"
163+
rev = "37c630320da0d0d3270d283cdafbf6b8402de069"
166164

167165
[build-dependencies]
168-
napi-build = "2.1.2"
166+
napi-build = "2.1.3"
169167

170168
[profile.release]
171169
codegen-units = 1

bun.lockb

-130 KB
Binary file not shown.

package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@
5454
"precommit": "yarn lint && yarn test"
5555
},
5656
"devDependencies": {
57-
"@biomejs/biome": "^1.6.3",
58-
"@napi-rs/cli": "^2.18.0",
57+
"@biomejs/biome": "^1.6.4",
58+
"@napi-rs/cli": "^2.18.1",
5959
"@types/chance": "^1.1.6",
6060
"@types/jest": "^29.5.12",
61-
"@types/node": "^20.11.30",
61+
"@types/node": "^20.12.7",
6262
"chance": "^1.1.11",
6363
"jest": "^29.7.0",
6464
"source-map-support": "^0.5.21",
6565
"ts-jest": "^29.1.2",
6666
"ts-node": "^10.9.2",
67-
"typedoc": "^0.25.12",
68-
"typescript": "5.4.3"
67+
"typedoc": "^0.25.13",
68+
"typescript": "5.4.5"
6969
},
7070
"packageManager": "[email protected]",
7171
"workspaces": [

polars/dataframe.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -2337,7 +2337,6 @@ export const _DataFrame = (_df: any): DataFrame => {
23372337
if (typeof opts === "number") {
23382338
return wrap("slice", opts, length);
23392339
}
2340-
23412340
return wrap("slice", opts.offset, opts.length);
23422341
},
23432342
sort(arg, descending = false, maintain_order = false) {
@@ -2350,8 +2349,7 @@ export const _DataFrame = (_df: any): DataFrame => {
23502349
.sort(arg, descending, maintain_order)
23512350
.collectSync({ noOptimization: true, stringCache: false });
23522351
}
2353-
2354-
return wrap("sort", arg, descending, maintain_order, true, false);
2352+
return wrap("sort", arg, descending, true, maintain_order);
23552353
},
23562354
std() {
23572355
return this.lazy().std().collectSync();

polars/io.ts

-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ interface ScanParquetOptions {
483483
rechunk?: boolean;
484484
lowMemory?: boolean;
485485
useStatistics?: boolean;
486-
hivePartitioning?: boolean;
487486
cloudOptions?: Map<string, string>;
488487
retries?: number;
489488
}

polars/lazy/dataframe.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -962,12 +962,10 @@ export const _LazyDataFrame = (_ldf: any): LazyDataFrame => {
962962
return this.sort(arg.by, arg.descending, arg.maintain_order);
963963
}
964964
if (typeof arg === "string") {
965-
return wrap("sort", arg, descending, maintain_order, true, false);
965+
return wrap("sort", arg, descending, true, maintain_order);
966966
}
967-
descending = [descending].flat(3) as any;
968967
const by = selectionToExprList(arg, false);
969-
970-
return wrap("sortByExprs", by, descending, maintain_order, true);
968+
return wrap("sortByExprs", by, descending, true, maintain_order);
971969
},
972970
std() {
973971
return _LazyDataFrame(_ldf.std());

polars/lazy/expr/list.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ export const ExprListFunctions = (_expr: any): ExprList => {
4949
},
5050
get(index: number | Expr) {
5151
if (Expr.isExpr(index)) {
52-
return wrap("listGet", index._expr);
52+
return wrap("listGet", index._expr, true);
5353
}
54-
return wrap("listGet", pli.lit(index));
54+
return wrap("listGet", pli.lit(index), true);
5555
},
5656
head(n = 5) {
5757
return this.slice(0, n);

polars/series/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,6 @@ export function _Series(_s: any): Series {
16861686
},
16871687
sort(options?) {
16881688
options = { descending: false, nullsLast: false, ...(options ?? {}) };
1689-
16901689
return wrap("sort", options.descending, options.nullsLast);
16911690
},
16921691
sub(field) {

rust-toolchain

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2024-02-23
1+
nightly-2024-03-28

src/conversion.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ pub struct WriteCsvOptions {
568568
pub date_format: Option<String>,
569569
pub time_format: Option<String>,
570570
pub float_precision: Option<i64>,
571-
pub null_value: Option<String>
571+
pub null_value: Option<String>,
572572
}
573573

574574
#[napi(object)]

src/dataframe.rs

+16-12
Original file line numberDiff line numberDiff line change
@@ -773,19 +773,16 @@ impl JsDataFrame {
773773
by_column: String,
774774
descending: bool,
775775
nulls_last: bool,
776-
multithreaded: bool,
777776
maintain_order: bool,
778777
) -> napi::Result<JsDataFrame> {
779778
let df = self
780779
.df
781-
.sort_with_options(
782-
&by_column,
783-
SortOptions {
784-
descending,
785-
nulls_last,
786-
multithreaded,
787-
maintain_order,
788-
},
780+
.sort(
781+
[&by_column],
782+
SortMultipleOptions::default()
783+
.with_order_descending(descending)
784+
.with_nulls_last(nulls_last)
785+
.with_maintain_order(maintain_order),
789786
)
790787
.map_err(JsPolarsErr::from)?;
791788
Ok(JsDataFrame::new(df))
@@ -798,7 +795,12 @@ impl JsDataFrame {
798795
maintain_order: bool,
799796
) -> napi::Result<()> {
800797
self.df
801-
.sort_in_place([&by_column], descending, maintain_order)
798+
.sort_in_place(
799+
[&by_column],
800+
SortMultipleOptions::default()
801+
.with_order_descending(descending)
802+
.with_maintain_order(maintain_order),
803+
)
802804
.map_err(JsPolarsErr::from)?;
803805
Ok(())
804806
}
@@ -1321,8 +1323,10 @@ impl JsDataFrame {
13211323
let time_format = options.time_format;
13221324
let datetime_format = options.datetime_format;
13231325
let float_precision: Option<usize> = options.float_precision.map(|fp| fp as usize);
1324-
let null_value = options.null_value.unwrap_or(SerializeOptions::default().null);
1325-
1326+
let null_value = options
1327+
.null_value
1328+
.unwrap_or(SerializeOptions::default().null);
1329+
13261330
match path_or_buffer.get_type()? {
13271331
ValueType::String => {
13281332
let path: napi::JsString = unsafe { path_or_buffer.cast() };

src/lazy/dataframe.rs

+27-22
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::dataframe::JsDataFrame;
33
use crate::prelude::*;
44
use polars::prelude::{col, lit, ClosedWindow, JoinType};
55
use polars_io::cloud::CloudOptions;
6-
use polars_io::RowIndex;
6+
use polars_io::{HiveOptions, RowIndex};
77
use std::collections::HashMap;
88
use std::num::NonZeroUsize;
99
use std::path::PathBuf;
@@ -134,34 +134,37 @@ impl JsLazyFrame {
134134
pub fn sort(
135135
&self,
136136
by_column: String,
137-
reverse: bool,
137+
descending: bool,
138138
nulls_last: bool,
139-
multithreaded: bool,
140139
maintain_order: bool,
141140
) -> JsLazyFrame {
142141
let ldf = self.ldf.clone();
143142
ldf.sort(
144-
&by_column,
145-
SortOptions {
146-
descending: reverse,
147-
nulls_last,
148-
multithreaded,
149-
maintain_order,
150-
},
143+
[&by_column],
144+
SortMultipleOptions::default()
145+
.with_order_descending(descending)
146+
.with_nulls_last(nulls_last)
147+
.with_maintain_order(maintain_order),
151148
)
152149
.into()
153150
}
154151
#[napi(catch_unwind)]
155152
pub fn sort_by_exprs(
156153
&self,
157154
by_column: Vec<&JsExpr>,
158-
reverse: Vec<bool>,
155+
descending: bool,
159156
nulls_last: bool,
160157
maintain_order: bool,
161158
) -> JsLazyFrame {
162159
let ldf = self.ldf.clone();
163-
ldf.sort_by_exprs(by_column.to_exprs(), reverse, nulls_last, maintain_order)
164-
.into()
160+
ldf.sort_by_exprs(
161+
by_column.to_exprs(),
162+
SortMultipleOptions::default()
163+
.with_order_descending(descending)
164+
.with_nulls_last(nulls_last)
165+
.with_maintain_order(maintain_order),
166+
)
167+
.into()
165168
}
166169
#[napi(catch_unwind)]
167170
pub fn cache(&self) -> JsLazyFrame {
@@ -229,7 +232,7 @@ impl JsLazyFrame {
229232
let closed_window = closed.0;
230233
let ldf = self.ldf.clone();
231234
let by = by.to_exprs();
232-
let lazy_gb = ldf.group_by_rolling(
235+
let lazy_gb = ldf.rolling(
233236
index_column.inner.clone(),
234237
by,
235238
RollingGroupOptions {
@@ -711,8 +714,7 @@ pub struct ScanParquetOptions {
711714
pub rechunk: Option<bool>,
712715
pub low_memory: Option<bool>,
713716
pub use_statistics: Option<bool>,
714-
pub hive_partitioning: Option<bool>,
715-
pub cloud_options: Option<HashMap::<String, String>>,
717+
pub cloud_options: Option<HashMap<String, String>>,
716718
pub retries: Option<i64>,
717719
}
718720

@@ -725,14 +727,14 @@ pub fn scan_parquet(path: String, options: ScanParquetOptions) -> napi::Result<J
725727
let rechunk = options.rechunk.unwrap_or(false);
726728
let low_memory = options.low_memory.unwrap_or(false);
727729
let use_statistics = options.use_statistics.unwrap_or(false);
728-
730+
729731
let mut cloud_options: Option<CloudOptions> = if let Some(o) = options.cloud_options {
730732
let co: Vec<(String, String)> = o.into_iter().map(|kv: (String, String)| kv).collect();
731733
Some(CloudOptions::from_untyped_config(&path, co).map_err(JsPolarsErr::from)?)
732734
} else {
733735
None
734736
};
735-
737+
736738
let retries = options.retries.unwrap_or_else(|| 2) as usize;
737739
if retries > 0 {
738740
cloud_options =
@@ -744,7 +746,6 @@ pub fn scan_parquet(path: String, options: ScanParquetOptions) -> napi::Result<J
744746
});
745747
}
746748

747-
let hive_partitioning: bool = options.hive_partitioning.unwrap_or(false);
748749
let args = ScanArgsParquet {
749750
n_rows,
750751
cache,
@@ -754,7 +755,11 @@ pub fn scan_parquet(path: String, options: ScanParquetOptions) -> napi::Result<J
754755
low_memory,
755756
cloud_options,
756757
use_statistics,
757-
hive_partitioning,
758+
// TODO: Support Hive partitioning.
759+
hive_options: HiveOptions {
760+
enabled: false,
761+
..Default::default()
762+
},
758763
};
759764
let lf = LazyFrame::scan_parquet(path, args).map_err(JsPolarsErr::from)?;
760765
Ok(lf.into())
@@ -774,14 +779,14 @@ pub fn scan_ipc(path: String, options: ScanIPCOptions) -> napi::Result<JsLazyFra
774779
let n_rows = options.n_rows.map(|i| i as usize);
775780
let cache = options.cache.unwrap_or(true);
776781
let rechunk = options.rechunk.unwrap_or(false);
777-
let memmap = options.memmap.unwrap_or(true);
782+
let memory_map = options.memmap.unwrap_or(true);
778783
let row_index: Option<RowIndex> = options.row_count.map(|rc| rc.into());
779784
let args = ScanArgsIpc {
780785
n_rows,
781786
cache,
782787
rechunk,
783788
row_index,
784-
memmap,
789+
memory_map,
785790
cloud_options: Default::default(),
786791
};
787792
let lf = LazyFrame::scan_ipc(path, args).map_err(JsPolarsErr::from)?;

0 commit comments

Comments
 (0)