Skip to content

Commit

Permalink
Implement schema for create index/table
Browse files Browse the repository at this point in the history
  • Loading branch information
lewiszlw committed Feb 1, 2024
1 parent 6749fa8 commit 4d3bc09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bustubx/src/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::catalog::Schema;
use crate::catalog::{Column, DataType};
use crate::common::ScalarValue;
use crate::storage::Tuple;
use crate::{BustubxError, BustubxResult};
use crate::{BustubxResult};

pub trait ExprTrait {
/// Get the data type of this expression, given the schema of the input
Expand Down
12 changes: 8 additions & 4 deletions bustubx/src/planner/logical_plan_v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mod table_scan;
mod util;
mod values;

use crate::catalog::SchemaRef;
use crate::catalog::{Column, DataType, Schema, SchemaRef};
pub use create_index::CreateIndex;
pub use create_table::CreateTable;
pub use empty_relation::EmptyRelation;
Expand All @@ -21,6 +21,7 @@ pub use join::Join;
pub use limit::Limit;
pub use project::Project;
pub use sort::{OrderByExpr, Sort};
use std::sync::Arc;
pub use table_scan::TableScan;
pub use util::*;
pub use values::Values;
Expand All @@ -43,10 +44,13 @@ pub enum LogicalPlanV2 {
impl LogicalPlanV2 {
pub fn schema(&self) -> &SchemaRef {
match self {

Check failure on line 46 in bustubx/src/planner/logical_plan_v2/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot return value referencing temporary value

Check failure on line 46 in bustubx/src/planner/logical_plan_v2/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot return value referencing temporary value

Check failure on line 46 in bustubx/src/planner/logical_plan_v2/mod.rs

View workflow job for this annotation

GitHub Actions / Test Suite

cannot return value referencing temporary value
LogicalPlanV2::CreateTable(_) => todo!(),
LogicalPlanV2::CreateIndex(_) => todo!(),
LogicalPlanV2::CreateTable(_) => &Arc::new(Schema::empty()),
LogicalPlanV2::CreateIndex(_) => &Arc::new(Schema::empty()),
LogicalPlanV2::Filter(Filter { input, .. }) => input.schema(),
LogicalPlanV2::Insert(_) => todo!(),
LogicalPlanV2::Insert(_) => &Arc::new(Schema::new(vec![Column::new(
"insert_rows".to_string(),
DataType::Int32,
)])),
LogicalPlanV2::Join(Join { schema, .. }) => schema,
LogicalPlanV2::Limit(Limit { input, .. }) => input.schema(),
LogicalPlanV2::Project(Project { schema, .. }) => schema,
Expand Down

0 comments on commit 4d3bc09

Please sign in to comment.