From 591053c55753e00341bd739c00f9ff09ae6e8141 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Mon, 10 Feb 2025 18:17:40 +0200 Subject: Remove typechecking --- log_db/src/common.rs | 87 ---------------------------------------------------- 1 file changed, 87 deletions(-) (limited to 'log_db/src/common.rs') diff --git a/log_db/src/common.rs b/log_db/src/common.rs index a450c28..2b40f52 100644 --- a/log_db/src/common.rs +++ b/log_db/src/common.rs @@ -183,58 +183,6 @@ pub enum IndexableValue { String(String), } -/// A primitive type -#[derive(Debug, Clone)] -pub enum PrimitiveType { - Int, - Decimal, - String, - Bytes, -} - -/// A primitive type + a nullability bit -#[derive(Debug, Clone)] -pub struct Type { - pub primitive: PrimitiveType, - pub nullable: bool, -} - -impl Type { - pub fn int() -> Self { - Type { - primitive: PrimitiveType::Int, - nullable: false, - } - } - - pub fn decimal() -> Self { - Type { - primitive: PrimitiveType::Decimal, - nullable: false, - } - } - - pub fn string() -> Self { - Type { - primitive: PrimitiveType::String, - nullable: false, - } - } - - pub fn bytes() -> Self { - Type { - primitive: PrimitiveType::Bytes, - nullable: false, - } - } - - pub fn nullable(&mut self) -> Self { - let mut new = self.clone(); - new.nullable = true; - new - } -} - #[derive(Debug, Clone)] pub enum Value { Null, @@ -341,41 +289,6 @@ impl Value { } } -pub fn type_check(value: &Value, value_type: &Type) -> bool { - match (value, value_type) { - ( - Value::Int(_), - Type { - primitive: PrimitiveType::Int, - .. - }, - ) => true, - ( - Value::Decimal(_), - Type { - primitive: PrimitiveType::Decimal, - .. - }, - ) => true, - ( - Value::Bytes(_), - Type { - primitive: PrimitiveType::Bytes, - .. - }, - ) => true, - ( - Value::String(_), - Type { - primitive: PrimitiveType::String, - .. - }, - ) => true, - (Value::Null, Type { nullable: true, .. }) => true, - _ => false, - } -} - pub fn get_secondary_memtable_index_by_field( sks: &Vec, field: &Field, -- cgit v1.3