Skip to content

Commit

Permalink
Cleanup & format
Browse files Browse the repository at this point in the history
  • Loading branch information
jpschorr committed Nov 18, 2024
1 parent 6ba5963 commit 7add534
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 16 deletions.
6 changes: 2 additions & 4 deletions partiql-eval/src/plan.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use itertools::{Either, Itertools};
use ordered_float::OrderedFloat;
use partiql_logical as logical;
use partiql_logical::{
AggFunc, BagOperator, BinaryOp, BindingsOp, CallName, GroupingStrategy, IsTypeExpr, JoinKind,
Lit, LogicalPlan, OpId, PathComponent, Pattern, PatternMatchExpr, SearchedCase, SetQuantifier,
LogicalPlan, OpId, PathComponent, Pattern, PatternMatchExpr, SearchedCase, SetQuantifier,
SortSpecNullOrder, SortSpecOrder, Type, UnaryOp, ValueExpr, VarRefType,
};
use petgraph::prelude::StableGraph;
Expand All @@ -25,8 +24,8 @@ use crate::eval::expr::{
};
use crate::eval::EvalPlan;
use partiql_catalog::catalog::{Catalog, FunctionEntryFunction};
use partiql_value::Value;
use partiql_value::Value::Null;
use partiql_value::{Bag, List, Tuple, Value};

#[macro_export]
macro_rules! correct_num_args_or_err {
Expand Down Expand Up @@ -787,7 +786,6 @@ mod tests {
use partiql_catalog::catalog::PartiqlCatalog;
use partiql_logical::CallExpr;
use partiql_logical::ExprQuery;
use partiql_value::Value;

#[test]
fn test_logical_to_eval_plan_bad_num_arguments() {
Expand Down
5 changes: 2 additions & 3 deletions partiql-logical-planner/src/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use itertools::Itertools;
use once_cell::sync::Lazy;
use partiql_logical as logical;
use partiql_logical::{SetQuantifier, ValueExpr};
use partiql_value::Value;
use std::collections::HashMap;
use std::fmt::Debug;

Expand Down Expand Up @@ -241,7 +240,7 @@ fn function_call_def_trim() -> CallDef {
output: Box::new(|mut args| {
args.insert(
0,
ValueExpr::Lit(Box::new(logical::Lit::String(" ".to_string().into()))),
ValueExpr::Lit(Box::new(logical::Lit::String(" ".to_string()))),
);

logical::ValueExpr::Call(logical::CallExpr {
Expand All @@ -255,7 +254,7 @@ fn function_call_def_trim() -> CallDef {
output: Box::new(|mut args| {
args.insert(
0,
ValueExpr::Lit(Box::new(logical::Lit::String(" ".to_string().into()))),
ValueExpr::Lit(Box::new(logical::Lit::String(" ".to_string()))),
);
logical::ValueExpr::Call(logical::CallExpr {
name: logical::CallName::BTrim,
Expand Down
2 changes: 1 addition & 1 deletion partiql-logical-planner/src/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use partiql_logical::{
};
use std::borrow::Cow;

use partiql_value::{BindingsName, Value};
use partiql_value::BindingsName;

use std::collections::{HashMap, HashSet};

Expand Down
2 changes: 1 addition & 1 deletion partiql-logical-planner/src/typer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use partiql_types::{
type_string, type_struct, type_undefined, ArrayType, BagType, PartiqlShape,
PartiqlShapeBuilder, ShapeResultError, Static, StructConstraint, StructField, StructType,
};
use partiql_value::{BindingsName, Value};
use partiql_value::BindingsName;
use petgraph::algo::toposort;
use petgraph::graph::NodeIndex;
use petgraph::prelude::StableGraph;
Expand Down
2 changes: 1 addition & 1 deletion partiql-logical/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use partiql_common::catalog::ObjectId;
/// assert_eq!(3, p.operators().len());
/// assert_eq!(2, p.flows().len());
/// ```
use partiql_value::{BindingsName, Value};
use partiql_value::BindingsName;
use rust_decimal::Decimal as RustDecimal;
use std::collections::HashMap;
use std::fmt::{Debug, Display, Formatter};
Expand Down
10 changes: 5 additions & 5 deletions partiql-logical/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl From<Value> for Lit {
Value::Missing => Lit::Missing,
Value::Boolean(b) => Lit::Bool(b),
Value::Integer(n) => Lit::Int64(n),
Value::Real(f) => Lit::Double(f.into()),
Value::Real(f) => Lit::Double(f),
Value::Decimal(d) => Lit::Decimal(*d),
Value::String(s) => Lit::String(*s),
Value::Blob(bytes) => {

Check warning on line 17 in partiql-logical/src/util.rs

View workflow job for this annotation

GitHub Actions / clippy

unused variable: `bytes`

warning: unused variable: `bytes` --> partiql-logical/src/util.rs:17:25 | 17 | Value::Blob(bytes) => { | ^^^^^ help: if this is intentional, prefix it with an underscore: `_bytes` | = note: `#[warn(unused_variables)]` on by default
Expand Down Expand Up @@ -53,18 +53,18 @@ impl From<Lit> for Value {
Lit::Int8(n) => Value::Integer(n.into()),
Lit::Int16(n) => Value::Integer(n.into()),
Lit::Int32(n) => Value::Integer(n.into()),
Lit::Int64(n) => Value::Integer(n.into()),
Lit::Int64(n) => Value::Integer(n),
Lit::Decimal(d) => Value::Decimal(d.into()),
Lit::Double(f) => Value::Real(f.into()),
Lit::Double(f) => Value::Real(f),
Lit::Bool(b) => Value::Boolean(b),
Lit::String(s) => Value::String(s.into()),
Lit::BoxDocument(contents, typ) => {

Check warning on line 61 in partiql-logical/src/util.rs

View workflow job for this annotation

GitHub Actions / clippy

unused variable: `typ`

warning: unused variable: `typ` --> partiql-logical/src/util.rs:61:40 | 61 | Lit::BoxDocument(contents, typ) => { | ^^^ help: if this is intentional, prefix it with an underscore: `_typ`
parse_embedded_ion_str(&String::from_utf8_lossy(contents.as_slice()))
.expect("TODO ion parsing error")
}
Lit::Struct(strct) => Value::from(Tuple::from(Tuple::from_iter(
Lit::Struct(strct) => Value::from(Tuple::from_iter(
strct.into_iter().map(|(k, v)| (k, Value::from(v))),
))),
)),
Lit::Bag(bag) => Value::from(Bag::from_iter(bag.into_iter().map(Value::from))),
Lit::List(list) => Value::from(List::from_iter(list.into_iter().map(Value::from))),
}
Expand Down
2 changes: 1 addition & 1 deletion partiql-parser/src/parse/parse_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use partiql_ast::ast;
use crate::parse::parser_state::ParserState;
use crate::ParseError;
use bitflags::bitflags;
use partiql_ast::ast::{AstNode, Expr, Lit, LitField};
use partiql_ast::ast::{Expr, Lit};
use partiql_common::node::NodeIdGenerator;
use partiql_common::syntax::location::{ByteOffset, BytePosition};

Expand Down

0 comments on commit 7add534

Please sign in to comment.