Skip to content

Commit

Permalink
Upgrade sqlite3-parser #185
Browse files Browse the repository at this point in the history
  • Loading branch information
jussisaurio committed Jul 24, 2024
1 parent 6108c9c commit 9eb6852
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 24 deletions.
5 changes: 2 additions & 3 deletions Cargo.lock

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

8 changes: 6 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ libc = "0.2.155"
log = "0.4.20"
nix = { version = "0.29.0", features = ["fs"] }
sieve-cache = "0.1.4"
sqlite3-parser = "0.11.0"
sqlite3-parser = "0.13.0"
thiserror = "1.0.61"
getrandom = { version = "0.2.15", features = ["js"] }
regex = "1.10.5"
Expand All @@ -46,7 +46,11 @@ julian_day_converter = "0.3.2"
pprof = { version = "0.12.1", features = ["criterion", "flamegraph"] }

[dev-dependencies]
criterion = { version = "0.5", features = ["html_reports", "async", "async_futures"] }
criterion = { version = "0.5", features = [
"html_reports",
"async",
"async_futures",
] }
rstest = "0.18.2"
rusqlite = "0.29.0"
tempfile = "3.8.0"
Expand Down
8 changes: 4 additions & 4 deletions core/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ fn create_table(
}
}
}
for column in columns {
let name = column.col_name.0.to_string();
let ty = match column.col_type {
for (col_name, col_def) in columns {
let name = col_name.0.to_string();
let ty = match col_def.col_type {
Some(data_type) => {
let type_name = data_type.name.as_str();
if type_name.contains("INTEGER") {
Expand All @@ -247,7 +247,7 @@ fn create_table(
}
None => Type::Null,
};
let mut primary_key = column.constraints.iter().any(|c| {
let mut primary_key = col_def.constraints.iter().any(|c| {
matches!(
c.constraint,
sqlite3_parser::ast::ColumnConstraint::PrimaryKey { .. }
Expand Down
2 changes: 2 additions & 0 deletions core/translate/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ pub fn translate_expr(
distinctness: _,
args,
filter_over: _,
order_by: _,
} => {
let args_count = if let Some(args) = args { args.len() } else { 0 };
let func_type: Option<Func> =
Expand Down Expand Up @@ -613,6 +614,7 @@ pub fn analyze_expr<'a>(expr: &'a Expr, column_info_out: &mut ColumnInfo<'a>) {
distinctness: _,
args,
filter_over: _,
order_by: _,
} => {
let args_count = if let Some(args) = args { args.len() } else { 0 };
let func_type =
Expand Down
30 changes: 15 additions & 15 deletions core/translate/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ pub struct SrcTable<'a> {

impl SrcTable<'_> {
pub fn is_outer_join(&self) -> bool {
matches!(
self.join_info,
Some(ast::JoinedSelectTable {
operator: JoinOperator::TypedJoin {
natural: false,
join_type: Some(
JoinType::Left
| JoinType::LeftOuter
| JoinType::Right
| JoinType::RightOuter
)
},
..
})
)
if let Some(ast::JoinedSelectTable {
operator: JoinOperator::TypedJoin(Some(join_type)),
..
}) = self.join_info
{
if *join_type == JoinType::LEFT | JoinType::OUTER {
true
} else if *join_type == JoinType::RIGHT | JoinType::OUTER {
true
} else {
false
}
} else {
false
}
}
}

Expand Down

0 comments on commit 9eb6852

Please sign in to comment.