Merge pull request #214 from penberg/185-upgrade-sqlite3-parser

This commit is contained in:
Pekka Enberg
2024-07-24 14:13:30 +03:00
committed by GitHub
5 changed files with 29 additions and 24 deletions

5
Cargo.lock generated
View File

@@ -1699,9 +1699,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "sqlite3-parser"
version = "0.11.0"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b64003a3617746eb65b39e6dc422139a2f99cfd54683fc973f4763eb786e0c1"
checksum = "eb5307dad6cb84730ce8bdefde56ff4cf95fe516972d52e2bbdc8a8cd8f2520b"
dependencies = [
"bitflags 2.6.0",
"cc",
@@ -1712,7 +1712,6 @@ dependencies = [
"phf",
"phf_codegen",
"phf_shared",
"smallvec",
"uncased",
]

View File

@@ -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"
@@ -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"

View File

@@ -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") {
@@ -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 { .. }

View File

@@ -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> =
@@ -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 =

View File

@@ -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
}
}
}