Skip to content

Commit b5965dc

Browse files
authored
refactor: reduce runtime dependencies (#351)
* refactor: reduce runtime dependencies * fix: enable wasm feature for wasm-pack targets * fix: keep null count in histogram bucket estimate
1 parent 561007d commit b5965dc

75 files changed

Lines changed: 619 additions & 477 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 5 additions & 126 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ lmdb = ["dep:lmdb", "dep:lmdb-sys"]
3737
pprof = ["pprof/criterion", "pprof/flamegraph"]
3838
python = ["parser", "dep:pyo3"]
3939
shell = ["parser", "dep:comfy-table", "dep:rustyline"]
40+
wasm = [
41+
"dep:js-sys",
42+
"dep:wasm-bindgen",
43+
"parser",
44+
]
4045

4146
[[bench]]
4247
name = "query_bench"
@@ -45,17 +50,10 @@ harness = false
4550
required-features = ["pprof"]
4651

4752
[dependencies]
48-
ahash = { version = "0.8" }
4953
bumpalo = { version = "3", default-features = false, features = ["collections"] }
50-
byteorder = { version = "1" }
51-
fixedbitset = { version = "0.4" }
52-
itertools = { version = "0.12" }
5354
ordered-float = { version = "4" }
5455
paste = { version = "1" }
55-
recursive = { version = "0.1" }
5656
kite_sql_serde_macros = { version = "0.2.1", path = "kite_sql_serde_macros" }
57-
siphasher = { version = "1" }
58-
ulid = { version = "1" }
5957

6058
# Optional dependencies for features
6159
comfy-table = { version = "7", default-features = false, optional = true }
@@ -84,16 +82,8 @@ rocksdb = { version = "0.23", optional = true, default-features = false, feature
8482
rustyline = { version = "14", default-features = false, optional = true }
8583

8684
[target.'cfg(target_arch = "wasm32")'.dependencies]
87-
wasm-bindgen = { version = "0.2.106" }
88-
web-sys = { version = "0.3.83", features = [
89-
"Storage",
90-
"Window",
91-
] }
92-
base64 = { version = "0.21" }
93-
getrandom = { version = "0.2", features = ["js"] }
94-
getrandom_03 = { package = "getrandom", version = "0.3", features = ["wasm_js"] }
95-
js-sys = { version = "0.3.83" }
96-
once_cell = { version = "1" }
85+
wasm-bindgen = { version = "0.2.106", optional = true }
86+
js-sys = { version = "0.3.83", optional = true }
9787

9888
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
9989
wasm-bindgen-test = "0.3.56"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ build:
3030

3131
## Build the WebAssembly package (artifact goes to ./pkg).
3232
wasm-build:
33-
$(WASM_PACK) build --release --target nodejs
33+
$(WASM_PACK) build --release --target nodejs -- --features wasm
3434

3535
## Execute wasm-bindgen tests under Node.js (wasm32 target).
3636
test-wasm:
37-
$(WASM_PACK) test --node -- --package kite_sql --lib
37+
$(WASM_PACK) test --node -- --features wasm --package kite_sql --lib
3838

3939
## Run the sqllogictest harness against the configured .slt suite.
4040
test-slt:

src/binder/aggregate.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
use ahash::RandomState;
16-
use itertools::Itertools;
1715
use std::collections::HashSet;
1816

1917
use super::{Binder, QueryBindStep};
@@ -266,7 +264,7 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
266264
group_raw_exprs.push(expr);
267265
}
268266
}
269-
let mut group_raw_set: HashSet<&ScalarExpression, RandomState> =
267+
let mut group_raw_set: HashSet<&ScalarExpression> =
270268
HashSet::from_iter(group_raw_exprs.iter().copied());
271269

272270
for expr in select_items {
@@ -275,7 +273,7 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
275273
}
276274
group_raw_set.remove(expr);
277275

278-
if !group_raw_exprs.iter().contains(&expr) {
276+
if !group_raw_exprs.contains(&expr) {
279277
return Err(DatabaseError::AggMiss(format!(
280278
"`{expr}` must appear in the GROUP BY clause or be used in an aggregate function"
281279
)));

src/binder/create_view.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use crate::planner::operator::Operator;
2222
use crate::planner::{Childrens, LogicalPlan};
2323
use crate::storage::Transaction;
2424
use crate::types::value::DataValue;
25-
use ulid::Ulid;
2625

2726
impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A> {
2827
pub(crate) fn bind_create_view(
@@ -52,7 +51,7 @@ impl<T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'_, '_, T, A>
5251
)
5352
};
5453
let mut column = ColumnCatalog::new(output_name, nullable, desc);
55-
column.set_ref_table(view_name.clone(), Ulid::new(), true);
54+
column.set_ref_table(view_name.clone(), 0, true);
5655
let output_column = arena.alloc_column(column);
5756

5857
exprs.push(ScalarExpression::Alias {

0 commit comments

Comments
 (0)