Skip to content

Commit

Permalink
Scaffoling for LazyGroupBy
Browse files Browse the repository at this point in the history
  • Loading branch information
brianshih1 committed Jun 28, 2023
1 parent f82ff11 commit be27db5
Show file tree
Hide file tree
Showing 31 changed files with 634 additions and 37 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
debug/
/target/
target/
.DS_Store
.DS_Store
pkg/
125 changes: 118 additions & 7 deletions Cargo.lock

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

8 changes: 8 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[dependencies]
ahash = "0.8.3"
arrow2 = { version = "0.17.1", features = [
Expand All @@ -25,3 +28,8 @@ rand = "0.8.5"
rayon = "1.7.0"
smartstring = "1.0.1"
xxhash-rust = { version = "0.8.6", features = ["xxh3"] }
wasm-bindgen = "0.2.63"
wee_alloc = { version = "0.4.5", optional = true }

[dev-dependencies]
wasm-bindgen-test = "0.3.13"
2 changes: 1 addition & 1 deletion src/chunked_array/sort_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ mod sort_i32 {
let arr = ChunkedArray::new("s", &vec![12, 1, 5, 8]);
let sorted = arr.sort(true);
println!("arr: {:?}", &sorted);
assert_eq!(sorted.to_vec(), vec![1, 5, 8, 12]);
assert_eq!(sorted.to_vec(), vec![12, 8, 5, 1]);
}

#[test]
Expand Down
16 changes: 5 additions & 11 deletions src/dataframe/groupby/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@ mod mod_test;
use super::DataFrame;

#[derive(Debug)]
pub enum GroupsProxy {
Idx(GroupsIdx),
Slice,
}

#[derive(Debug)]
pub struct GroupsIdx {
first: Vec<u32>,
all: Vec<Vec<u32>>,
pub struct GroupsProxy {
pub first: Vec<u32>,
pub all: Vec<Vec<u32>>,
}

impl DataFrame {
Expand Down Expand Up @@ -87,10 +81,10 @@ impl DataFrame {
})
.collect();
let (first_indices, grouped_indices) = join_group_indices(tuples);
GroupsProxy::Idx(GroupsIdx {
GroupsProxy {
first: first_indices,
all: grouped_indices,
})
}
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/dataframe/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ impl DataFrame {
}

pub fn get_index_with_name(&self, name: &str) -> usize {
self.columns.iter().position(|c| c.name() == name).unwrap()
let col = self.columns.iter().position(|c| c.name() == name);
if col.is_none() {
panic!("column not found for name: {name}");
}
col.unwrap()
}

// For now, makes all the chunks
Expand Down
11 changes: 11 additions & 0 deletions src/js_little_dataframe/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use wasm_bindgen::prelude::*;

#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
}

#[wasm_bindgen]
pub fn greet() {
alert("Hello, wasm-game-of-life!");
}
4 changes: 4 additions & 0 deletions src/js_little_dataframe/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as Foo from "../../pkg"

const foo = "bar"
console.log("YO")
Loading

0 comments on commit be27db5

Please sign in to comment.