Skip to content

Commit

Permalink
Implement to_column for alias expr
Browse files Browse the repository at this point in the history
  • Loading branch information
lewiszlw committed Feb 6, 2024
1 parent 3be9b63 commit 85cc5b8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bustubx/src/expression/alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::common::ScalarValue;
use crate::error::BustubxResult;
use crate::expression::{Expr, ExprTrait};
use crate::storage::Tuple;
use crate::BustubxError;

#[derive(Clone, PartialEq, Eq, Debug)]
pub struct Alias {
Expand All @@ -26,10 +25,11 @@ impl ExprTrait for Alias {
}

fn to_column(&self, input_schema: &Schema) -> BustubxResult<Column> {
Err(BustubxError::Plan(format!(
"expr {:?} as column not supported",
self
)))
Ok(Column::new(
self.name.clone(),
self.data_type(input_schema)?,
self.nullable(input_schema)?,
))
}
}

Expand Down

0 comments on commit 85cc5b8

Please sign in to comment.