diff --git a/bustubx/src/planner/logical_planner/logical_planner.rs b/bustubx/src/planner/logical_planner/logical_planner.rs index e45512f..2b5d92d 100644 --- a/bustubx/src/planner/logical_planner/logical_planner.rs +++ b/bustubx/src/planner/logical_planner/logical_planner.rs @@ -1,5 +1,5 @@ use crate::{BustubxError, BustubxResult}; -use sqlparser::ast::{Ident, JoinConstraint, JoinOperator, Statement, TableFactor, TableWithJoins}; +use sqlparser::ast::{JoinConstraint, JoinOperator, Statement, TableFactor, TableWithJoins}; use std::sync::Arc; use crate::catalog::{Catalog, DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME}; diff --git a/bustubx/src/planner/logical_planner/plan_create_index.rs b/bustubx/src/planner/logical_planner/plan_create_index.rs index c4f489d..3c14bae 100644 --- a/bustubx/src/planner/logical_planner/plan_create_index.rs +++ b/bustubx/src/planner/logical_planner/plan_create_index.rs @@ -1,20 +1,17 @@ -use crate::common::table_ref::TableReference; -use crate::expression::{ColumnExpr, Expr}; +use crate::expression::Expr; use crate::planner::logical_plan::LogicalPlan; use crate::planner::logical_plan_v2::{CreateIndex, LogicalPlanV2}; use crate::planner::operator::LogicalOperator; use crate::{BustubxError, BustubxResult}; -use itertools::Itertools; -use sqlparser::ast::{ObjectName, OrderByExpr}; use super::LogicalPlanner; impl<'a> LogicalPlanner<'a> { pub fn plan_create_index( &self, - index_name: &ObjectName, - table_name: &ObjectName, - columns: &Vec, + index_name: &sqlparser::ast::ObjectName, + table_name: &sqlparser::ast::ObjectName, + columns: &Vec, ) -> LogicalPlan { let table = self.bind_base_table_by_name(table_name.to_string().as_str(), None); let columns = columns @@ -44,9 +41,9 @@ impl<'a> LogicalPlanner<'a> { pub fn plan_create_index_v2( &self, - index_name: &ObjectName, - table_name: &ObjectName, - columns: &Vec, + index_name: &sqlparser::ast::ObjectName, + table_name: &sqlparser::ast::ObjectName, + columns: &Vec, ) -> BustubxResult { let index_name = index_name .0 diff --git a/bustubx/src/planner/logical_planner/plan_create_table.rs b/bustubx/src/planner/logical_planner/plan_create_table.rs index da07e71..8a4b2a2 100644 --- a/bustubx/src/planner/logical_planner/plan_create_table.rs +++ b/bustubx/src/planner/logical_planner/plan_create_table.rs @@ -1,5 +1,4 @@ use crate::BustubxResult; -use sqlparser::ast::{ColumnDef, ObjectName}; use crate::catalog::Column; use crate::catalog::Schema; @@ -12,8 +11,8 @@ use super::LogicalPlanner; impl<'a> LogicalPlanner<'a> { pub fn plan_create_table( &self, - name: &ObjectName, - column_defs: &Vec, + name: &sqlparser::ast::ObjectName, + column_defs: &Vec, ) -> LogicalPlan { let table_name = name.to_string(); let columns = column_defs @@ -29,8 +28,8 @@ impl<'a> LogicalPlanner<'a> { pub fn plan_create_table_v2( &self, - name: &ObjectName, - column_defs: &Vec, + name: &sqlparser::ast::ObjectName, + column_defs: &Vec, ) -> BustubxResult { let name = self.plan_table_name(name)?; let mut columns = vec![]; diff --git a/bustubx/src/planner/logical_planner/plan_insert.rs b/bustubx/src/planner/logical_planner/plan_insert.rs index 57d4f9a..72b03d8 100644 --- a/bustubx/src/planner/logical_planner/plan_insert.rs +++ b/bustubx/src/planner/logical_planner/plan_insert.rs @@ -1,6 +1,5 @@ use crate::expression::{Cast, Expr}; use crate::BustubxResult; -use sqlparser::ast::{Ident, ObjectName, Query, SetExpr}; use std::sync::Arc; use crate::planner::logical_plan::LogicalPlan; @@ -12,11 +11,11 @@ use super::LogicalPlanner; impl<'a> LogicalPlanner<'a> { pub fn plan_insert( &self, - table_name: &ObjectName, - columns_ident: &Vec, - source: &Query, + table_name: &sqlparser::ast::ObjectName, + columns_ident: &Vec, + source: &sqlparser::ast::Query, ) -> LogicalPlan { - if let SetExpr::Values(values) = source.body.as_ref() { + if let sqlparser::ast::SetExpr::Values(values) = source.body.as_ref() { if let Some(table_info) = self .context .catalog @@ -71,9 +70,9 @@ impl<'a> LogicalPlanner<'a> { pub fn plan_insert_v2( &self, - table_name: &ObjectName, - columns_ident: &Vec, - source: &Query, + table_name: &sqlparser::ast::ObjectName, + columns_ident: &Vec, + source: &sqlparser::ast::Query, ) -> BustubxResult { let values = self.plan_set_expr(source.body.as_ref())?; let table = self.plan_table_name(table_name)?;