Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/binder/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<'a, T: Transaction> Binder<'a, T> {
let mut rows = Vec::with_capacity(expr_rows.len());
for expr_row in expr_rows {
if expr_row.len() != values_len {
return Err(DatabaseError::ValuesLenNotSame());
return Err(DatabaseError::ValuesLenMismatch(expr_row.len(), values_len));
}
let mut row = Vec::with_capacity(expr_row.len());

Expand Down
23 changes: 22 additions & 1 deletion src/binder/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use crate::catalog::{ColumnCatalog, ColumnSummary, TableName};
use crate::errors::DatabaseError;
use crate::execution::volcano::dql::join::joins_nullable;
use crate::expression::{AliasType, BinaryOperator};
use crate::planner::operator::insert::InsertOperator;
use crate::planner::operator::join::JoinCondition;
use crate::planner::operator::sort::{SortField, SortOperator};
use crate::planner::operator::union::UnionOperator;
Expand All @@ -30,7 +31,8 @@ use crate::types::LogicalType;
use itertools::Itertools;
use sqlparser::ast::{
Distinct, Expr, Ident, Join, JoinConstraint, JoinOperator, Offset, OrderByExpr, Query, Select,
SelectItem, SetExpr, SetOperator, SetQuantifier, TableAlias, TableFactor, TableWithJoins,
SelectInto, SelectItem, SetExpr, SetOperator, SetQuantifier, TableAlias, TableFactor,
TableWithJoins,
};

impl<'a, T: Transaction> Binder<'a, T> {
Expand Down Expand Up @@ -111,6 +113,25 @@ impl<'a, T: Transaction> Binder<'a, T> {

plan = self.bind_project(plan, select_list)?;

if let Some(SelectInto {
name,
unlogged,
temporary,
..
}) = &select.into
{
if *unlogged || *temporary {
todo!()
}
plan = LogicalPlan::new(
Operator::Insert(InsertOperator {
table_name: Arc::new(lower_case_name(name)?),
is_overwrite: false,
}),
vec![plan],
)
}

Ok(plan)
}

Expand Down
2 changes: 0 additions & 2 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,6 @@ pub enum DatabaseError {
AmbiguousColumn(String),
#[error("values length not match, expect {0}, got {1}")]
ValuesLenMismatch(usize, usize),
#[error("values list must all be the same length")]
ValuesLenNotSame(),
#[error("binary operator types mismatch: {0} != {1}")]
BinaryOpTypeMismatch(String, String),
#[error("subquery error: {0}")]
Expand Down
Loading