Skip to content

Commit 192c5c9

Browse files
committed
fix: resolve CI failures after executor de-generic refactor
1 parent 4ee5c66 commit 192c5c9

40 files changed

Lines changed: 177 additions & 186 deletions

examples/transaction.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ mod app {
4141
pub fn run() -> Result<(), DatabaseError> {
4242
reset_example_dir()?;
4343
// Optimistic transactions are currently backed by RocksDB.
44-
let database = DataBaseBuilder::path(EXAMPLE_DB_PATH).build_optimistic()?;
45-
database
46-
.run("create table if not exists t1 (c1 int primary key, c2 int)")?
47-
.done()?;
44+
let mut database = DataBaseBuilder::path(EXAMPLE_DB_PATH).build_optimistic()?;
45+
database.ddl("create table if not exists t1 (c1 int primary key, c2 int)")?;
4846
let mut transaction = database.new_transaction()?;
4947

5048
transaction
@@ -65,6 +63,7 @@ mod app {
6563
Tuple::new(None, vec![DataValue::Int32(1), DataValue::Int32(1)])
6664
);
6765
assert!(iter.next().is_none());
66+
iter.done()?;
6867

6968
let mut tx2 = database.new_transaction()?;
7069
tx2.run("update t1 set c2 = 99 where c1 = 0")?.done()?;
@@ -79,7 +78,7 @@ mod app {
7978
);
8079
drop(tx2);
8180

82-
database.run("drop table t1")?.done()?;
81+
database.ddl("drop table t1")?;
8382

8483
Ok(())
8584
}

src/binder/expr.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,12 @@ impl<'a, T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'a, '_, T
357357
}
358358
if let Some(table) = table_name.or(bind_table_name) {
359359
let (source, position_offset) =
360-
match Self::resolve_source_columns_in_scope(&self.context, &table) {
360+
match Self::resolve_source_columns_in_scope(&self.context, table) {
361361
Ok(source) => source,
362362
Err(err) => {
363363
if let Some(parent) = self.parent {
364364
self.context.mark_outer_ref();
365-
Self::resolve_source_columns_in_scope(parent, &table)
366-
.map_err(|_| err)?
365+
Self::resolve_source_columns_in_scope(parent, table).map_err(|_| err)?
367366
} else {
368367
return Err(err);
369368
}

src/binder/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,11 @@ impl UsingColumn {
181181
}
182182

183183
fn left_expr(&self) -> ScalarExpression {
184-
ScalarExpression::column_expr(self.left_column.clone(), self.left_position)
184+
ScalarExpression::column_expr(self.left_column, self.left_position)
185185
}
186186

187187
fn right_expr(&self) -> ScalarExpression {
188-
ScalarExpression::column_expr(self.right_column.clone(), self.right_position)
188+
ScalarExpression::column_expr(self.right_column, self.right_position)
189189
}
190190

191191
pub(crate) fn visible_expr(
@@ -529,9 +529,9 @@ impl<'a, T: Transaction> BinderContext<'a, T> {
529529
}
530530
let using_column = UsingColumn::new(
531531
join_type,
532-
left_column.clone(),
532+
*left_column,
533533
left_position,
534-
right_column.clone(),
534+
*right_column,
535535
right_position,
536536
);
537537
self.using.insert(name, using_column);

src/binder/parser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,7 @@ where
13411341
T: Transaction,
13421342
A: AsRef<[(&'static str, DataValue)]>,
13431343
{
1344+
#[allow(clippy::wrong_self_convention)]
13441345
pub(crate) fn from_sql(
13451346
self,
13461347
from: Vec<TableWithJoins>,

src/binder/select.rs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ where
433433
T: Transaction,
434434
A: AsRef<[(&'static str, DataValue)]>,
435435
{
436+
#[allow(clippy::wrong_self_convention)]
436437
pub(crate) fn from_plan(
437438
self,
438439
plan: LogicalPlan,
@@ -504,26 +505,27 @@ where
504505
|binder, orderby| bind_sort_field(binder, self.arena, orderby),
505506
)?;
506507
}
507-
508508
if !self.binder.context.agg_calls.is_empty()
509509
|| !self.binder.context.group_by_exprs.is_empty()
510510
{
511511
let agg_calls = std::mem::take(&mut self.binder.context.agg_calls);
512512
let group_by_exprs = std::mem::take(&mut self.binder.context.group_by_exprs);
513+
let output_exprs = self
514+
.select_list
515+
.iter_mut()
516+
.chain(having_orderby.0.iter_mut())
517+
.chain(
518+
having_orderby
519+
.1
520+
.iter_mut()
521+
.flat_map(|fields| fields.iter_mut().map(|field| &mut field.expr)),
522+
);
513523
self.binder.bind_aggregate_output_exprs_with_outputs(
514524
&agg_calls,
515525
&group_by_exprs,
516-
self.select_list.iter_mut(),
526+
output_exprs,
517527
self.arena,
518528
)?;
519-
if let Some(orderby) = having_orderby.1.as_mut() {
520-
self.binder.bind_aggregate_output_exprs_with_outputs(
521-
&agg_calls,
522-
&group_by_exprs,
523-
orderby.iter_mut().map(|field| &mut field.expr),
524-
self.arena,
525-
)?;
526-
}
527529
self.plan = self
528530
.binder
529531
.bind_aggregate(self.plan, agg_calls, group_by_exprs)?;
@@ -1062,7 +1064,7 @@ impl<'a: 'b, 'b, T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'
10621064
let source_column = arena.column(column);
10631065
(
10641066
source_column.clone(),
1065-
source_column.id().unwrap_or(ColumnId::new()),
1067+
source_column.id().unwrap_or_default(),
10661068
matches!(
10671069
&source_column.summary().relation,
10681070
ColumnRelation::Table { is_temp: true, .. }
@@ -1107,7 +1109,7 @@ impl<'a: 'b, 'b, T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'
11071109
let mut source_column = column_catalog.clone();
11081110
source_column.set_ref_table(
11091111
source_name.clone(),
1110-
column_catalog.id().unwrap_or(ColumnId::new()),
1112+
column_catalog.id().unwrap_or_default(),
11111113
true,
11121114
);
11131115
source_column
@@ -1303,7 +1305,7 @@ impl<'a: 'b, 'b, T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'
13031305
else {
13041306
continue;
13051307
};
1306-
if !fn_not_on_using(&column) {
1308+
if !fn_not_on_using(column) {
13071309
continue;
13081310
}
13091311
exprs.push(ScalarExpression::column_expr(
@@ -1318,7 +1320,7 @@ impl<'a: 'b, 'b, T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'
13181320
}
13191321

13201322
for (position, column) in source.schema().iter().enumerate() {
1321-
if !fn_not_on_using(&column) {
1323+
if !fn_not_on_using(column) {
13221324
continue;
13231325
}
13241326
exprs.push(ScalarExpression::column_expr(
@@ -1523,6 +1525,7 @@ impl<'a: 'b, 'b, T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'
15231525
Vec::new()
15241526
}
15251527

1528+
#[allow(clippy::too_many_arguments)]
15261529
fn prepare_mark_apply(
15271530
predicate: &mut ScalarExpression,
15281531
output_column: &ColumnRef,
@@ -2270,11 +2273,11 @@ mod tests {
22702273
true,
22712274
ColumnDesc::new(LogicalType::Integer, None, false, None).unwrap(),
22722275
));
2273-
let right_schema = vec![right_column.clone()];
2276+
let right_schema = vec![right_column];
22742277
let mut expr = ScalarExpression::Binary {
22752278
op: crate::expression::BinaryOperator::Eq,
22762279
left_expr: Box::new(ScalarExpression::column_expr(left_column, 0)),
2277-
right_expr: Box::new(ScalarExpression::column_expr(right_column.clone(), 0)),
2280+
right_expr: Box::new(ScalarExpression::column_expr(right_column, 0)),
22782281
evaluator: None,
22792282
ty: LogicalType::Boolean,
22802283
};

src/db.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ impl<S: Storage> State<S> {
508508
BinderContext::new(
509509
self.table_cache(),
510510
self.view_cache(),
511-
&*transaction,
511+
transaction,
512512
self.scala_functions(),
513513
self.table_functions(),
514514
),
@@ -1832,7 +1832,7 @@ pub(crate) mod test {
18321832
let collect_ids = |sql: &str| -> Result<Vec<i32>, DatabaseError> {
18331833
let mut iter = kite_sql.run(sql)?;
18341834
let mut ids = Vec::new();
1835-
while let Some(row) = iter.next() {
1835+
for row in iter.by_ref() {
18361836
let row = row?;
18371837
ids.push(row.values[0].i32().unwrap());
18381838
}
@@ -1964,7 +1964,7 @@ pub(crate) mod test {
19641964
let collect_ids = |sql: &str| -> Result<Vec<i32>, DatabaseError> {
19651965
let mut iter = kite_sql.run(sql)?;
19661966
let mut ids = Vec::new();
1967-
while let Some(row) = iter.next() {
1967+
for row in iter.by_ref() {
19681968
let row = row?;
19691969
ids.push(row.values[0].i32().unwrap());
19701970
}

src/execution/ddl/change_column.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ impl<'a> ExecutorNode<'a> for ChangeColumn {
102102
};
103103
if let Some(index_name) = affected_index_name {
104104
return Err(DatabaseError::UnsupportedStmt(format!(
105-
"cannot alter type of indexed column `{}`; drop index `{}` first",
106-
old_column_name, index_name
105+
"cannot alter type of indexed column `{old_column_name}`; drop index `{index_name}` first"
107106
)));
108107
}
109108
}

src/execution/dml/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl<'a> ExecutorNode<'a> for Analyze {
117117
while runtime.next_tuple(input, plan_arena)? {
118118
let tuple = runtime.result_tuple();
119119
for State { exprs, builder, .. } in builders.iter_mut() {
120-
let values = Projection::projection(tuple, &exprs)?;
120+
let values = Projection::projection(tuple, exprs)?;
121121

122122
if values.len() == 1 {
123123
builder.append(&values[0])?;

src/execution/dml/copy_from_file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ mod tests {
176176
schema_ref: columns,
177177
};
178178

179-
let mut transaction = db.storage.transaction()?;
179+
let transaction = db.storage.transaction()?;
180180
let mut executor = crate::execution::execute_input_mut::<_, CopyFromFile>(
181181
op,
182182
(
@@ -185,7 +185,7 @@ mod tests {
185185
db.state.meta_cache(),
186186
),
187187
plan_arena,
188-
&mut transaction,
188+
&transaction,
189189
);
190190

191191
let result = executor.next().expect("copy from file should yield once")?;

src/execution/dml/copy_to_file.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ mod tests {
164164
db.run("insert into t1 values (3, 2.1, 'Kite')")?.done()?;
165165

166166
let plan_arena = crate::planner::PlanArena::new(db.state.table_arena());
167-
let mut transaction = db.storage.transaction()?;
167+
let transaction = db.storage.transaction()?;
168168
let table = transaction
169169
.table(db.state.table_cache(), "t1".to_string().into())?
170170
.unwrap();
@@ -179,7 +179,7 @@ mod tests {
179179
db.state.meta_cache(),
180180
),
181181
plan_arena,
182-
&mut transaction,
182+
&transaction,
183183
);
184184

185185
let tuple = executor.next().expect("executor should yield once")?;

0 commit comments

Comments
 (0)