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

Using rs-0.40 #211

Merged
merged 11 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install latest Rust nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2024-04-15
toolchain: nightly-2024-05-14
components: rustfmt, clippy
- name: Install ghp-import
uses: actions/setup-python@v5
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/test-js.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
node: ["18", "20"]
steps:
- uses: actions/checkout@v4
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
Expand All @@ -18,9 +20,10 @@ jobs:
- name: Install latest Rust nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2024-04-15
toolchain: nightly-2024-05-14
components: rustfmt, clippy
- run: yarn --version
- name: Check yarn version
run: yarn --version
- name: Install Node Dependencies
run: yarn install
- name: Build Binary
Expand All @@ -43,7 +46,7 @@ jobs:
- name: Install latest Rust nightly
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2024-04-15
toolchain: nightly-2024-05-14
components: rustfmt, clippy
- name: Bun version
uses: oven-sh/setup-bun@v1
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
20
874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.1.cjs

This file was deleted.

4 changes: 2 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules
compressionLevel: mixed

yarnPath: .yarn/releases/yarn-3.6.1.cjs
enableGlobalCache: false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this for?

Copy link
Collaborator Author

@Bidek56 Bidek56 May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were using a local yarn file which did not match the yarn version from package.json
Apparently Node corepack is the new way.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd prefer to not change the yarnrc in this PR.

AFAICT, the current implementation works fine with corepack

> corepack enable
> yarn
> yarn build:debug

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want a separate PR for corepack?
The current implementation work fine due to this file but that's out of sync with what's in package.json

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's just go with this.

compressionLevel: mixed
enableGlobalCache: false
nodeLinker: node-modules

the main thing I wanted to avoid was using yarn's linker as it makes things more difficult for contributors.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ crate-type = ["cdylib", "lib"]
[dependencies]
ahash = "0.8.11"
bincode = "1.3.3"
napi = { version = "2.16.4", default-features = false, features = [
napi = { version = "2.16.6", default-features = false, features = [
"napi8",
"serde-json",
] }
napi-derive = { version = "2.16.3", default-features = false }
polars-core = { git = "https://github.com/pola-rs/polars.git", rev = "4c57688d204fad3d0d5e4586ecd0405ead7baeb2", default-features = false }
polars-io = { git = "https://github.com/pola-rs/polars.git", rev = "4c57688d204fad3d0d5e4586ecd0405ead7baeb2", default-features = false }
polars-lazy = { git = "https://github.com/pola-rs/polars.git", rev = "4c57688d204fad3d0d5e4586ecd0405ead7baeb2", default-features = false }
napi-derive = { version = "2.16.5", default-features = false }
polars-core = { git = "https://github.com/pola-rs/polars.git", rev = "7bc70141f4dad7863a2026849522551abb274f00", default-features = false }
polars-io = { git = "https://github.com/pola-rs/polars.git", rev = "7bc70141f4dad7863a2026849522551abb274f00", default-features = false }
polars-lazy = { git = "https://github.com/pola-rs/polars.git", rev = "7bc70141f4dad7863a2026849522551abb274f00", default-features = false }
thiserror = "1"
smartstring = { version = "1" }
serde_json = { version = "1" }
Expand Down Expand Up @@ -160,7 +160,7 @@ features = [
"azure"
]
git = "https://github.com/pola-rs/polars.git"
rev = "4c57688d204fad3d0d5e4586ecd0405ead7baeb2"
rev = "7bc70141f4dad7863a2026849522551abb274f00"

[build-dependencies]
napi-build = "2.1.3"
Expand Down
6 changes: 3 additions & 3 deletions __tests__/dataframe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ describe("dataframe", () => {
describe: ["mean", "std", "min", "max", "median"],
a: [2, 1, 1, 3, 2],
b: [null, null, "a", "c", null],
c: [0.6666666666666666, 0.5773502588272095, 0, 1, 1],
c: [0.6666666666666666, 0.5773502691896258, 0, 1, 1],
});

expect(actual).toFrameEqual(expected);
});
test("drop", () => {
Expand Down Expand Up @@ -1504,8 +1503,9 @@ describe("join", () => {
const expected = pl.DataFrame({
foo: [1, 2, 3, null],
bar: [6, 7, 8, null],
ham: ["a", "b", "c", "d"],
ham: ["a", "b", "c", null],
apple: ["x", null, null, "y"],
ham_right: ["a", null, null, "d"],
Bidek56 marked this conversation as resolved.
Show resolved Hide resolved
foo_right: [1, null, null, 10],
});
expect(actual).toFrameEqual(expected);
Expand Down
13 changes: 7 additions & 6 deletions __tests__/lazyframe.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("lazyframe", () => {
})
.lazy();
let actual = df.describeOptimizedPlan().replace(/\s+/g, " ");
const expected = `DF ["foo", "bar"]; PROJECT */2 COLUMNS; SELECTION: "None"`;
const expected = `DF ["foo", "bar"]; PROJECT */2 COLUMNS; SELECTION: None`;
expect(actual).toEqual(expected);
actual = df.describePlan().replace(/\s+/g, " ");
expect(actual).toEqual(expected);
Expand Down Expand Up @@ -601,11 +601,12 @@ describe("lazyframe", () => {
})
.collectSync();
const expected = pl.DataFrame({
foo: [1, 2, 3, null],
bar: [6, 7, 8, null],
ham: ["a", "b", "c", "d"],
apple: ["x", null, null, "y"],
fooright: [1, null, null, 10],
foo: [1, null, 2, 3],
bar: [6, null, 7, 8],
ham: ["a", null, "b", "c"],
apple: ["x", "y", null, null],
hamright: ["a", "d", null, null],
fooright: [1, 10, null, null],
});
expect(actual).toFrameEqualIgnoringOrder(expected);
});
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@
"precommit": "yarn lint && yarn test"
},
"devDependencies": {
"@biomejs/biome": "^1.7.0",
"@napi-rs/cli": "^2.18.2",
"@biomejs/biome": "^1.7.3",
"@napi-rs/cli": "^2.18.3",
"@types/chance": "^1.1.6",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.7",
"@types/node": "^20.12.12",
"chance": "^1.1.11",
"jest": "^29.7.0",
"source-map-support": "^0.5.21",
"ts-jest": "^29.1.2",
"ts-jest": "^29.1.3",
"ts-node": "^10.9.2",
"typedoc": "^0.25.13",
"typescript": "5.4.5"
},
"packageManager": "yarn@4.0.2",
"packageManager": "yarn@4.2.2",
"workspaces": [
"benches"
]
Expand Down
4 changes: 2 additions & 2 deletions polars/lazy/expr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ export const _Expr = (_expr: any): Expr => {
throw new Error("window size is required");
}
const callOpts = {
windowSize: `${windowSize}i`,
windowSize: windowSize,
weights: opts?.["weights"] ?? weights,
minPeriods: opts?.["minPeriods"] ?? minPeriods ?? windowSize,
center: opts?.["center"] ?? center ?? false,
Expand Down Expand Up @@ -1459,7 +1459,7 @@ export const _Expr = (_expr: any): Expr => {
"rollingQuantile",
val.quantile,
val.interpolation ?? "nearest",
`${windowSize}i`,
windowSize,
val?.["weights"] ?? weights ?? null,
val?.["minPeriods"] ?? minPeriods ?? windowSize,
val?.["center"] ?? center ?? false,
Expand Down
2 changes: 1 addition & 1 deletion polars/lazy/expr/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export const ExprStringFunctions = (_expr: any): StringNamespace => {
return wrap("strJsonDecode", dtype, inferSchemaLength);
},
jsonPathMatch(pat: string) {
return wrap("strJsonPathMatch", pat);
return wrap("strJsonPathMatch", [pat]);
},
lengths() {
return wrap("strLengths");
Expand Down
2 changes: 1 addition & 1 deletion polars/series/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export const SeriesStringFunctions = (_s: any): StringNamespace => {
return wrap("strJsonDecode", dtype, inferSchemaLength);
},
jsonPathMatch(pat: string) {
return wrap("strJsonPathMatch", pat);
return wrap("strJsonPathMatch", [pat]);
},
lengths() {
return wrap("strLengths");
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2024-04-15
nightly-2024-05-14
33 changes: 6 additions & 27 deletions src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,41 +498,20 @@ impl FromNapiValue for Wrap<u64> {

#[napi(object)]
pub struct JsRollingOptions {
pub window_size: String,
pub window_size: i16,
pub weights: Option<Vec<f64>>,
pub min_periods: i64,
pub center: bool,
pub ddof: Option<u8>,
}

impl From<JsRollingOptions> for RollingOptionsImpl<'static> {
impl From<JsRollingOptions> for RollingOptionsFixedWindow {
fn from(o: JsRollingOptions) -> Self {
RollingOptionsImpl {
window_size: Duration::parse(&o.window_size),
RollingOptionsFixedWindow {
window_size: o.window_size as usize,
weights: o.weights,
min_periods: o.min_periods as usize,
center: o.center,
by: None,
tu: None,
tz: None,
closed_window: None,
fn_params: Some(Arc::new(RollingVarParams {
ddof: o.ddof.unwrap_or(1),
}) as Arc<dyn Any + Send + Sync>),
..Default::default()
}
}
}

impl From<JsRollingOptions> for RollingOptions {
fn from(o: JsRollingOptions) -> Self {
RollingOptions {
window_size: Duration::parse(&o.window_size),
weights: o.weights,
min_periods: o.min_periods as usize,
center: o.center,
by: None,
closed_window: None,
fn_params: Some(Arc::new(RollingVarParams {
ddof: o.ddof.unwrap_or(1),
}) as Arc<dyn Any + Send + Sync>),
Expand All @@ -550,7 +529,7 @@ pub struct JsRowCount {
impl From<JsRowCount> for RowIndex {
fn from(o: JsRowCount) -> Self {
RowIndex {
name: o.name,
name: o.name.into(),
offset: o.offset,
}
}
Expand Down Expand Up @@ -832,7 +811,7 @@ impl FromNapiValue for Wrap<JoinType> {
let parsed = match s.as_ref() {
"inner" => JoinType::Inner,
"left" => JoinType::Left,
"outer" => JoinType::Outer { coalesce: true },
"outer" => JoinType::Outer,
"semi" => JoinType::Semi,
"anti" => JoinType::Anti,
"cross" => JoinType::Cross,
Expand Down
Loading