Skip to content

Commit

Permalink
Silence some spurious clippy warnings. (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpschorr authored Jan 15, 2025
1 parent 3647c56 commit 59dbbcc
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 4 deletions.
12 changes: 12 additions & 0 deletions partiql-conformance-test-generator/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ pub mod spec {
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub enum Assertion {
SyntaxSuccess(SyntaxSuccessAssertion),
SyntaxFail(SyntaxFailAssertion),
Expand Down Expand Up @@ -138,28 +140,38 @@ pub mod spec {
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub struct SyntaxSuccessAssertion {
pub result: String,
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub struct SyntaxFailAssertion {
pub result: String,
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub struct StaticAnalysisFailAssertion {
pub result: String,
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub struct EvaluationSuccessAssertion {
pub result: String,
pub output: Element,
pub eval_mode: EvaluationModeList,
}

#[derive(Debug, Clone)]
// Assertions model the partiql-tests DSL; there are some spurious warnings before code generation.
#[allow(dead_code)]
pub struct EvaluationFailAssertion {
pub result: String,
pub eval_mode: EvaluationModeList,
Expand Down
4 changes: 3 additions & 1 deletion partiql-conformance-tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ fn main() -> miette::Result<()> {
.arg("fmt")
.arg("--")
.spawn()
.expect("cargo fmt of tests/ failed");
.expect("cargo fmt of tests/ failed")
.wait()
.expect("cargo fmt of tests/ failed to exit");

Ok(())
}
12 changes: 12 additions & 0 deletions partiql-eval/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,21 @@ regex-syntax = "0.8"
rustc-hash = "2"
delegate = "0.13"

serde = { version = "1", features = ["derive"], optional = true }

[dev-dependencies]
criterion = "0.5"


[features]
default = []
serde = [
"dep:serde",
"rust_decimal/serde-with-str",
"partiql-logical/serde",
"partiql-value/serde",
]

[[bench]]
name = "bench_eval"
harness = false
3 changes: 3 additions & 0 deletions partiql-eval/src/eval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ use unicase::UniCase;
use crate::eval::evaluable::{EvalType, Evaluable};
use crate::plan::EvaluationMode;

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

pub(crate) mod eval_expr_wrapper;
pub mod evaluable;
pub mod expr;
Expand Down
3 changes: 0 additions & 3 deletions partiql-value/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ pub use sort::*;
pub use tuple::*;
pub use value::*;

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

#[cfg(test)]
mod tests {
use super::*;
Expand Down
6 changes: 6 additions & 0 deletions partiql/tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ impl From<Box<dyn Error>> for TestError<'_> {
}
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn parse(statement: &str) -> ParserResult<'_> {
partiql_parser::Parser::default().parse(statement)
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn lower(
Expand All @@ -72,6 +74,7 @@ pub fn lower(
planner.lower(parsed)
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn compile(
Expand All @@ -83,6 +86,7 @@ pub fn compile(
planner.compile(&logical)
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn evaluate(mut plan: EvalPlan, bindings: MapBindings<Value>) -> EvalResult {
Expand All @@ -93,6 +97,7 @@ pub fn evaluate(mut plan: EvalPlan, bindings: MapBindings<Value>) -> EvalResult
plan.execute_mut(&ctx)
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn eval_query_with_catalog<'a>(
Expand All @@ -107,6 +112,7 @@ pub fn eval_query_with_catalog<'a>(
Ok(evaluate(plan, bindings)?)
}

#[allow(dead_code)]
#[track_caller]
#[inline]
pub fn eval_query(statement: &str, mode: EvaluationMode) -> Result<Evaluated, TestError<'_>> {
Expand Down
1 change: 1 addition & 0 deletions partiql/tests/comparisons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub fn eval_op(op: &str) {
fn op_values() -> [Value; 4] {
[
Value::Integer(1),
#[allow(clippy::approx_constant)]
Value::Real(3.14.into()),
Value::Boolean(true),
Value::String("foo".to_string().into()),
Expand Down
2 changes: 2 additions & 0 deletions partiql/tests/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ fn pretty_val() {
tuple!(("n", 9)),
tuple!(("n", 10))
);

#[allow(clippy::approx_constant)]
let t_val = tuple!(
("foo", true),
("-foo", false),
Expand Down

1 comment on commit 59dbbcc

@github-actions
Copy link

Choose a reason for hiding this comment

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

PartiQL (rust) Benchmark

Benchmark suite Current: 59dbbcc Previous: 3647c56 Ratio
arith_agg-avg 773594 ns/iter (± 4076) 778823 ns/iter (± 4235) 0.99
arith_agg-avg_distinct 857665 ns/iter (± 5095) 862469 ns/iter (± 14558) 0.99
arith_agg-count 822309 ns/iter (± 44600) 824616 ns/iter (± 20684) 1.00
arith_agg-count_distinct 852355 ns/iter (± 10718) 862385 ns/iter (± 25442) 0.99
arith_agg-min 826952 ns/iter (± 39267) 829546 ns/iter (± 3251) 1.00
arith_agg-min_distinct 866099 ns/iter (± 32879) 867717 ns/iter (± 9625) 1.00
arith_agg-max 834860 ns/iter (± 30814) 839271 ns/iter (± 3509) 0.99
arith_agg-max_distinct 868044 ns/iter (± 3176) 867308 ns/iter (± 3488) 1.00
arith_agg-sum 832122 ns/iter (± 2947) 829345 ns/iter (± 2584) 1.00
arith_agg-sum_distinct 860507 ns/iter (± 8300) 863063 ns/iter (± 17521) 1.00
arith_agg-avg-count-min-max-sum 990002 ns/iter (± 6705) 1007676 ns/iter (± 6642) 0.98
arith_agg-avg-count-min-max-sum-group_by 1278229 ns/iter (± 28446) 1262956 ns/iter (± 28389) 1.01
arith_agg-avg-count-min-max-sum-group_by-group_as 1870588 ns/iter (± 10252) 1895714 ns/iter (± 7046) 0.99
arith_agg-avg_distinct-count_distinct-min_distinct-max_distinct-sum_distinct 1191863 ns/iter (± 16141) 1204549 ns/iter (± 11239) 0.99
arith_agg-avg_distinct-count_distinct-min_distinct-max_distinct-sum_distinct-group_by 1461233 ns/iter (± 40502) 1483475 ns/iter (± 12157) 0.99
arith_agg-avg_distinct-count_distinct-min_distinct-max_distinct-sum_distinct-group_by-group_as 2075422 ns/iter (± 12211) 2081734 ns/iter (± 8508) 1.00
parse-1 5436 ns/iter (± 346) 5605 ns/iter (± 88) 0.97
parse-15 47354 ns/iter (± 198) 47958 ns/iter (± 112) 0.99
parse-30 92881 ns/iter (± 419) 94102 ns/iter (± 428) 0.99
compile-1 4142 ns/iter (± 9) 4242 ns/iter (± 25) 0.98
compile-15 30301 ns/iter (± 128) 30977 ns/iter (± 278) 0.98
compile-30 62895 ns/iter (± 743) 63911 ns/iter (± 219) 0.98
plan-1 69940 ns/iter (± 1149) 70381 ns/iter (± 503) 0.99
plan-15 1097476 ns/iter (± 80703) 1096120 ns/iter (± 6850) 1.00
plan-30 2192204 ns/iter (± 9567) 2193417 ns/iter (± 17025) 1.00
eval-1 12168571 ns/iter (± 111834) 12444594 ns/iter (± 193410) 0.98
eval-15 78372842 ns/iter (± 1204765) 78434654 ns/iter (± 1473407) 1.00
eval-30 149908935 ns/iter (± 1993148) 149096079 ns/iter (± 763485) 1.01
join 9891 ns/iter (± 28) 9890 ns/iter (± 250) 1.00
simple 2558 ns/iter (± 19) 2498 ns/iter (± 5) 1.02
simple-no 486 ns/iter (± 1) 460 ns/iter (± 3) 1.06
numbers 48 ns/iter (± 0) 48 ns/iter (± 0) 1
parse-simple 766 ns/iter (± 2) 760 ns/iter (± 9) 1.01
parse-ion 2495 ns/iter (± 7) 2271 ns/iter (± 27) 1.10
parse-group 7387 ns/iter (± 22) 7149 ns/iter (± 12) 1.03
parse-complex 19209 ns/iter (± 258) 18629 ns/iter (± 194) 1.03
parse-complex-fexpr 26160 ns/iter (± 114) 25853 ns/iter (± 104) 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.