From 7b41972763f5673ac936daf49d21b5c02690d926 Mon Sep 17 00:00:00 2001 From: Sean Smith Date: Sat, 21 Dec 2024 18:12:57 -0600 Subject: [PATCH] more --- crates/docgen/src/markdown_table.rs | 6 +- crates/rayexec_bullet/src/array/mod.rs | 78 ++--- .../rayexec_bullet/src/compute/cast/array.rs | 248 +++++++------ .../rayexec_bullet/src/compute/cast/scalar.rs | 322 ++++++++++------- crates/rayexec_bullet/src/compute/date.rs | 14 +- crates/rayexec_bullet/src/datatype.rs | 328 +++++++++--------- crates/rayexec_bullet/src/executor/builder.rs | 4 +- .../src/executor/scalar/binary.rs | 8 +- .../src/executor/scalar/fill.rs | 14 +- .../src/executor/scalar/unary.rs | 12 +- .../src/executor/scalar/uniform.rs | 8 +- crates/rayexec_bullet/src/field.rs | 14 +- .../rayexec_bullet/src/format/pretty/table.rs | 76 ++-- crates/rayexec_bullet/src/ipc/batch.rs | 21 +- crates/rayexec_bullet/src/ipc/schema.rs | 72 ++-- crates/rayexec_bullet/src/ipc/stream.rs | 10 +- crates/rayexec_bullet/src/scalar/mod.rs | 58 ++-- crates/rayexec_csv/src/reader.rs | 32 +- crates/rayexec_delta/src/protocol/table.rs | 26 +- crates/rayexec_execution/src/arrays/batch.rs | 6 + .../src/arrays/flat_array.rs | 9 + .../operators/hash_aggregate/hash_table.rs | 27 +- .../execution/operators/hash_aggregate/mod.rs | 4 +- .../operators/hash_join/condition.rs | 4 +- .../operators/hash_join/global_hash_table.rs | 6 +- .../src/execution/operators/hash_join/mod.rs | 10 +- .../operators/util/outer_join_tracker.rs | 12 +- .../src/expr/aggregate_expr.rs | 4 +- .../rayexec_execution/src/expr/arith_expr.rs | 4 +- .../rayexec_execution/src/expr/case_expr.rs | 4 +- .../rayexec_execution/src/expr/cast_expr.rs | 4 +- .../rayexec_execution/src/expr/column_expr.rs | 4 +- .../src/expr/grouping_set_expr.rs | 6 +- crates/rayexec_execution/src/expr/mod.rs | 14 +- .../rayexec_execution/src/expr/negate_expr.rs | 6 +- .../src/expr/physical/case_expr.rs | 4 +- .../src/expr/physical/cast_expr.rs | 4 +- .../src/expr/physical/mod.rs | 6 +- .../src/expr/physical/scalar_function_expr.rs | 70 +++- .../src/expr/subquery_expr.rs | 4 +- .../rayexec_execution/src/expr/unnest_expr.rs | 8 +- .../rayexec_execution/src/expr/window_expr.rs | 4 +- .../src/functions/aggregate/builtin/avg.rs | 24 +- .../src/functions/aggregate/builtin/corr.rs | 8 +- .../src/functions/aggregate/builtin/count.rs | 8 +- .../src/functions/aggregate/builtin/covar.rs | 14 +- .../src/functions/aggregate/builtin/first.rs | 10 +- .../src/functions/aggregate/builtin/minmax.rs | 12 +- .../functions/aggregate/builtin/regr_avg.rs | 14 +- .../functions/aggregate/builtin/regr_count.rs | 8 +- .../functions/aggregate/builtin/regr_r2.rs | 8 +- .../functions/aggregate/builtin/regr_slope.rs | 8 +- .../src/functions/aggregate/builtin/stddev.rs | 26 +- .../functions/aggregate/builtin/string_agg.rs | 8 +- .../src/functions/aggregate/builtin/sum.rs | 28 +- .../src/functions/aggregate/mod.rs | 4 +- .../src/functions/aggregate/states.rs | 9 +- .../src/functions/implicit.rs | 55 +-- crates/rayexec_execution/src/functions/mod.rs | 30 +- .../src/functions/scalar/builtin/arith/add.rs | 108 +++--- .../src/functions/scalar/builtin/arith/div.rs | 108 +++--- .../src/functions/scalar/builtin/arith/mul.rs | 126 +++---- .../src/functions/scalar/builtin/arith/rem.rs | 92 ++--- .../src/functions/scalar/builtin/arith/sub.rs | 102 +++--- .../src/functions/scalar/builtin/boolean.rs | 44 +-- .../functions/scalar/builtin/comparison.rs | 96 ++--- .../scalar/builtin/datetime/date_part.rs | 8 +- .../scalar/builtin/datetime/date_trunc.rs | 10 +- .../scalar/builtin/datetime/epoch.rs | 14 +- .../src/functions/scalar/builtin/is.rs | 26 +- .../scalar/builtin/list/list_extract.rs | 40 +-- .../scalar/builtin/list/list_values.rs | 27 +- .../src/functions/scalar/builtin/mod.rs | 1 + .../src/functions/scalar/builtin/negate.rs | 32 +- .../functions/scalar/builtin/numeric/abs.rs | 4 +- .../functions/scalar/builtin/numeric/acos.rs | 4 +- .../functions/scalar/builtin/numeric/asin.rs | 4 +- .../functions/scalar/builtin/numeric/atan.rs | 4 +- .../functions/scalar/builtin/numeric/cbrt.rs | 4 +- .../functions/scalar/builtin/numeric/ceil.rs | 4 +- .../functions/scalar/builtin/numeric/cos.rs | 4 +- .../scalar/builtin/numeric/degrees.rs | 4 +- .../functions/scalar/builtin/numeric/exp.rs | 4 +- .../functions/scalar/builtin/numeric/floor.rs | 4 +- .../functions/scalar/builtin/numeric/isnan.rs | 14 +- .../functions/scalar/builtin/numeric/ln.rs | 4 +- .../functions/scalar/builtin/numeric/log.rs | 6 +- .../functions/scalar/builtin/numeric/mod.rs | 10 +- .../scalar/builtin/numeric/radians.rs | 4 +- .../functions/scalar/builtin/numeric/sin.rs | 4 +- .../functions/scalar/builtin/numeric/sqrt.rs | 4 +- .../functions/scalar/builtin/numeric/tan.rs | 4 +- .../src/functions/scalar/builtin/random.rs | 8 +- .../scalar/builtin/similarity/l2_distance.rs | 16 +- .../functions/scalar/builtin/string/ascii.rs | 10 +- .../functions/scalar/builtin/string/case.rs | 16 +- .../functions/scalar/builtin/string/concat.rs | 12 +- .../scalar/builtin/string/contains.rs | 14 +- .../scalar/builtin/string/ends_with.rs | 14 +- .../functions/scalar/builtin/string/length.rs | 26 +- .../functions/scalar/builtin/string/like.rs | 14 +- .../functions/scalar/builtin/string/pad.rs | 22 +- .../scalar/builtin/string/regexp_replace.rs | 10 +- .../functions/scalar/builtin/string/repeat.rs | 10 +- .../scalar/builtin/string/starts_with.rs | 10 +- .../scalar/builtin/string/substring.rs | 28 +- .../functions/scalar/builtin/string/trim.rs | 18 +- .../functions/scalar/builtin/temp_add_2.rs | 68 ++++ .../src/functions/scalar/mod.rs | 8 +- .../src/functions/table/builtin/series.rs | 8 +- .../src/functions/table/builtin/system.rs | 78 +++-- .../src/functions/table/builtin/unnest.rs | 6 +- .../src/logical/binder/bind_context.rs | 16 +- .../src/logical/binder/bind_copy.rs | 4 +- .../src/logical/binder/bind_describe.rs | 4 +- .../src/logical/binder/bind_explain.rs | 4 +- .../src/logical/binder/bind_insert.rs | 6 +- .../logical/binder/bind_query/bind_from.rs | 4 +- .../logical/binder/bind_query/bind_select.rs | 6 +- .../logical/binder/bind_query/bind_values.rs | 4 +- .../binder/bind_query/select_expr_expander.rs | 8 +- .../src/logical/binder/bind_set.rs | 9 +- .../src/logical/binder/expr_binder.rs | 20 +- .../src/logical/binder/table_list.rs | 8 +- .../src/logical/logical_scan.rs | 4 +- .../src/logical/planner/plan_subquery.rs | 12 +- .../src/logical/planner/plan_unnest.rs | 4 +- .../src/logical/resolver/mod.rs | 36 +- .../src/optimizer/expr_rewrite/const_fold.rs | 4 +- crates/rayexec_iceberg/src/spec/schema.rs | 40 +-- crates/rayexec_parquet/src/reader/mod.rs | 56 +-- .../rayexec_parquet/src/reader/primitive.rs | 34 +- crates/rayexec_parquet/src/reader/varlen.rs | 6 +- crates/rayexec_parquet/src/schema.rs | 118 +++---- crates/rayexec_parquet/src/writer/mod.rs | 30 +- crates/rayexec_postgres/src/lib.rs | 40 +-- crates/rayexec_slt/src/convert.rs | 22 +- crates/rayexec_unity_catalog/src/functions.rs | 22 +- crates/rayexec_wasm/src/session.rs | 4 +- test_bin/integration_slt_hybrid.rs | 10 +- 140 files changed, 2003 insertions(+), 1701 deletions(-) create mode 100644 crates/rayexec_execution/src/functions/scalar/builtin/temp_add_2.rs diff --git a/crates/docgen/src/markdown_table.rs b/crates/docgen/src/markdown_table.rs index f9094d565..21ae99d9f 100644 --- a/crates/docgen/src/markdown_table.rs +++ b/crates/docgen/src/markdown_table.rs @@ -55,7 +55,7 @@ pub fn write_markdown_table<'a>( #[cfg(test)] mod tests { use rayexec_bullet::array::ArrayOld; - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::field::Field; use super::*; @@ -69,8 +69,8 @@ mod tests { .unwrap(); let schema = Schema::new([ - Field::new("Numbers", DataType::Int32, false), - Field::new("Strings", DataType::Utf8, false), + Field::new("Numbers", DataTypeOld::Int32, false), + Field::new("Strings", DataTypeOld::Utf8, false), ]); let mut buf = String::new(); diff --git a/crates/rayexec_bullet/src/array/mod.rs b/crates/rayexec_bullet/src/array/mod.rs index 3c8f48f8c..09441ac15 100644 --- a/crates/rayexec_bullet/src/array/mod.rs +++ b/crates/rayexec_bullet/src/array/mod.rs @@ -5,7 +5,7 @@ use half::f16; use rayexec_error::{not_implemented, RayexecError, Result, ResultExt}; use crate::bitmap::Bitmap; -use crate::datatype::DataType; +use crate::datatype::DataTypeOld; use crate::executor::builder::{ArrayBuilder, BooleanBuffer, GermanVarlenBuffer, PrimitiveBuffer}; use crate::executor::physical_type::{ PhysicalAnyOld, @@ -54,7 +54,7 @@ pub type LogicalSelection = SharedOrOwned; #[derive(Debug, Clone, PartialEq)] pub struct ArrayOld { /// Data type of the array. - pub(crate) datatype: DataType, + pub(crate) datatype: DataTypeOld, /// Selection of rows for the array. /// /// If set, this provides logical row mapping on top of the underlying data. @@ -81,7 +81,7 @@ impl ArrayOld { let data = UntypedNullStorage(1); ArrayOld { - datatype: DataType::Null, + datatype: DataTypeOld::Null, selection: Some(selection.into()), validity: Some(validity.into()), data: data.into(), @@ -89,7 +89,7 @@ impl ArrayOld { } /// Creates a new typed array with all values being set to null. - pub fn new_typed_null_array(datatype: DataType, len: usize) -> Result { + pub fn new_typed_null_array(datatype: DataTypeOld, len: usize) -> Result { // Create physical array data of length 1, and use a selection vector to // extend it out to the desired size. let data = datatype.physical_type()?.zeroed_array_data(1); @@ -104,7 +104,7 @@ impl ArrayOld { }) } - pub fn new_with_array_data(datatype: DataType, data: impl Into) -> Self { + pub fn new_with_array_data(datatype: DataTypeOld, data: impl Into) -> Self { ArrayOld { datatype, selection: None, @@ -114,7 +114,7 @@ impl ArrayOld { } pub fn new_with_validity_and_array_data( - datatype: DataType, + datatype: DataTypeOld, validity: impl Into, data: impl Into, ) -> Self { @@ -127,7 +127,7 @@ impl ArrayOld { } pub fn new_with_validity_selection_and_array_data( - datatype: DataType, + datatype: DataTypeOld, validity: impl Into, selection: impl Into, data: impl Into, @@ -140,7 +140,7 @@ impl ArrayOld { } } - pub fn datatype(&self) -> &DataType { + pub fn datatype(&self) -> &DataTypeOld { &self.datatype } @@ -247,7 +247,7 @@ impl ArrayOld { pub fn physical_type(&self) -> PhysicalType { match self.data.physical_type() { PhysicalType::Binary => match self.datatype { - DataType::Utf8 => PhysicalType::Utf8, + DataTypeOld::Utf8 => PhysicalType::Utf8, _ => PhysicalType::Binary, }, other => other, @@ -452,67 +452,67 @@ impl ArrayOld { /// Ignores validity and selectivitity. pub fn physical_scalar(&self, idx: usize) -> Result { Ok(match &self.datatype { - DataType::Null => match &self.data { + DataTypeOld::Null => match &self.data { ArrayData::UntypedNull(_) => ScalarValue::Null, _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Boolean => match &self.data { + DataTypeOld::Boolean => match &self.data { ArrayData::Boolean(arr) => arr.as_ref().as_ref().value(idx).into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Float16 => match &self.data { + DataTypeOld::Float16 => match &self.data { ArrayData::Float16(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Float32 => match &self.data { + DataTypeOld::Float32 => match &self.data { ArrayData::Float32(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Float64 => match &self.data { + DataTypeOld::Float64 => match &self.data { ArrayData::Float64(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Int8 => match &self.data { + DataTypeOld::Int8 => match &self.data { ArrayData::Int8(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Int16 => match &self.data { + DataTypeOld::Int16 => match &self.data { ArrayData::Int16(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Int32 => match &self.data { + DataTypeOld::Int32 => match &self.data { ArrayData::Int32(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Int64 => match &self.data { + DataTypeOld::Int64 => match &self.data { ArrayData::Int64(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Int128 => match &self.data { + DataTypeOld::Int128 => match &self.data { ArrayData::Int64(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::UInt8 => match &self.data { + DataTypeOld::UInt8 => match &self.data { ArrayData::UInt8(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::UInt16 => match &self.data { + DataTypeOld::UInt16 => match &self.data { ArrayData::UInt16(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::UInt32 => match &self.data { + DataTypeOld::UInt32 => match &self.data { ArrayData::UInt32(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::UInt64 => match &self.data { + DataTypeOld::UInt64 => match &self.data { ArrayData::UInt64(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::UInt128 => match &self.data { + DataTypeOld::UInt128 => match &self.data { ArrayData::UInt64(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Decimal64(m) => match &self.data { + DataTypeOld::Decimal64(m) => match &self.data { ArrayData::Int64(arr) => ScalarValue::Decimal64(Decimal64Scalar { precision: m.precision, scale: m.scale, @@ -520,7 +520,7 @@ impl ArrayOld { }), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Decimal128(m) => match &self.data { + DataTypeOld::Decimal128(m) => match &self.data { ArrayData::Int128(arr) => ScalarValue::Decimal128(Decimal128Scalar { precision: m.precision, scale: m.scale, @@ -528,26 +528,26 @@ impl ArrayOld { }), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Date32 => match &self.data { + DataTypeOld::Date32 => match &self.data { ArrayData::Int32(arr) => ScalarValue::Date32(arr.as_ref().as_ref()[idx]), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Date64 => match &self.data { + DataTypeOld::Date64 => match &self.data { ArrayData::Int64(arr) => ScalarValue::Date64(arr.as_ref().as_ref()[idx]), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Timestamp(m) => match &self.data { + DataTypeOld::Timestamp(m) => match &self.data { ArrayData::Int64(arr) => ScalarValue::Timestamp(TimestampScalar { unit: m.unit, value: arr.as_ref().as_ref()[idx], }), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Interval => match &self.data { + DataTypeOld::Interval => match &self.data { ArrayData::Interval(arr) => arr.as_ref().as_ref()[idx].into(), _other => return Err(array_not_valid_for_type_err(&self.datatype)), }, - DataType::Utf8 => { + DataTypeOld::Utf8 => { let v = match &self.data { ArrayData::Binary(BinaryData::Binary(arr)) => arr .get(idx) @@ -563,7 +563,7 @@ impl ArrayOld { let s = std::str::from_utf8(v).context("binary data not valid utf8")?; s.into() } - DataType::Binary => { + DataTypeOld::Binary => { let v = match &self.data { ArrayData::Binary(BinaryData::Binary(arr)) => arr .get(idx) @@ -578,8 +578,8 @@ impl ArrayOld { }; v.into() } - DataType::Struct(_) => not_implemented!("get value: struct"), - DataType::List(_) => match &self.data { + DataTypeOld::Struct(_) => not_implemented!("get value: struct"), + DataTypeOld::List(_) => match &self.data { ArrayData::List(list) => { let meta = list .metadata @@ -769,7 +769,7 @@ impl ArrayOld { } } -fn array_not_valid_for_type_err(datatype: &DataType) -> RayexecError { +fn array_not_valid_for_type_err(datatype: &DataTypeOld) -> RayexecError { RayexecError::new(format!("Array data not valid for data type: {datatype}")) } @@ -813,7 +813,7 @@ impl FromIterator for ArrayOld { } ArrayOld { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, selection: None, validity: None, data: ArrayData::Binary(BinaryData::German(Arc::new(german))), @@ -832,7 +832,7 @@ impl<'a> FromIterator<&'a str> for ArrayOld { } ArrayOld { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, selection: None, validity: None, data: ArrayData::Binary(BinaryData::German(Arc::new(german))), @@ -846,7 +846,7 @@ macro_rules! impl_primitive_from_iter { fn from_iter>(iter: T) -> Self { let vals: Vec<_> = iter.into_iter().collect(); ArrayOld { - datatype: DataType::$variant, + datatype: DataTypeOld::$variant, selection: None, validity: None, data: ArrayData::$variant(Arc::new(vals.into())), @@ -874,7 +874,7 @@ impl FromIterator for ArrayOld { fn from_iter>(iter: T) -> Self { let vals: Bitmap = iter.into_iter().collect(); ArrayOld { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, selection: None, validity: None, data: ArrayData::Boolean(Arc::new(vals.into())), diff --git a/crates/rayexec_bullet/src/compute/cast/array.rs b/crates/rayexec_bullet/src/compute/cast/array.rs index fc8491c18..f1a162523 100644 --- a/crates/rayexec_bullet/src/compute/cast/array.rs +++ b/crates/rayexec_bullet/src/compute/cast/array.rs @@ -50,7 +50,7 @@ use super::parse::{ }; use crate::array::{ArrayData, ArrayOld}; use crate::bitmap::Bitmap; -use crate::datatype::{DataType, TimeUnit}; +use crate::datatype::{DataTypeOld, TimeUnit}; use crate::executor::builder::{ArrayBuilder, BooleanBuffer, GermanVarlenBuffer, PrimitiveBuffer}; use crate::executor::physical_type::{ PhysicalBoolOld, @@ -74,14 +74,14 @@ use crate::executor::scalar::UnaryExecutor; use crate::scalar::decimal::{Decimal128Type, Decimal64Type, DecimalType}; use crate::storage::{AddressableStorage, PrimitiveStorage}; -pub fn cast_array(arr: &ArrayOld, to: DataType, behavior: CastFailBehavior) -> Result { +pub fn cast_array(arr: &ArrayOld, to: DataTypeOld, behavior: CastFailBehavior) -> Result { if arr.datatype() == &to { // TODO: Cow? return Ok(arr.clone()); } let arr = match arr.datatype() { - DataType::Null => { + DataTypeOld::Null => { // Can cast NULL to anything else. let data = to.physical_type()?.zeroed_array_data(arr.logical_len()); let validity = Bitmap::new_with_all_false(arr.logical_len()); @@ -89,123 +89,131 @@ pub fn cast_array(arr: &ArrayOld, to: DataType, behavior: CastFailBehavior) -> R } // String to anything else. - DataType::Utf8 => cast_from_utf8(arr, to, behavior)?, + DataTypeOld::Utf8 => cast_from_utf8(arr, to, behavior)?, // Primitive numerics to other primitive numerics. - DataType::Int8 if to.is_primitive_numeric() => { + DataTypeOld::Int8 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::Int16 if to.is_primitive_numeric() => { + DataTypeOld::Int16 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::Int32 if to.is_primitive_numeric() => { + DataTypeOld::Int32 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::Int64 if to.is_primitive_numeric() => { + DataTypeOld::Int64 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::Int128 if to.is_primitive_numeric() => { + DataTypeOld::Int128 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::UInt8 if to.is_primitive_numeric() => { + DataTypeOld::UInt8 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::UInt16 if to.is_primitive_numeric() => { + DataTypeOld::UInt16 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::UInt32 if to.is_primitive_numeric() => { + DataTypeOld::UInt32 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::UInt64 if to.is_primitive_numeric() => { + DataTypeOld::UInt64 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::UInt128 if to.is_primitive_numeric() => { + DataTypeOld::UInt128 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::Float16 if to.is_primitive_numeric() => { + DataTypeOld::Float16 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::Float32 if to.is_primitive_numeric() => { + DataTypeOld::Float32 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } - DataType::Float64 if to.is_primitive_numeric() => { + DataTypeOld::Float64 if to.is_primitive_numeric() => { cast_primitive_numeric_helper::(arr, to, behavior)? } // Int to date32 - DataType::Int8 if to == DataType::Date32 => { + DataTypeOld::Int8 if to == DataTypeOld::Date32 => { cast_primitive_numeric::(arr, to, behavior)? } - DataType::Int16 if to == DataType::Date32 => { + DataTypeOld::Int16 if to == DataTypeOld::Date32 => { cast_primitive_numeric::(arr, to, behavior)? } - DataType::Int32 if to == DataType::Date32 => { + DataTypeOld::Int32 if to == DataTypeOld::Date32 => { cast_primitive_numeric::(arr, to, behavior)? } - DataType::UInt8 if to == DataType::Date32 => { + DataTypeOld::UInt8 if to == DataTypeOld::Date32 => { cast_primitive_numeric::(arr, to, behavior)? } - DataType::UInt16 if to == DataType::Date32 => { + DataTypeOld::UInt16 if to == DataTypeOld::Date32 => { cast_primitive_numeric::(arr, to, behavior)? } // Int to decimal. - DataType::Int8 if to.is_decimal() => { + DataTypeOld::Int8 if to.is_decimal() => { cast_int_to_decimal_helper::(arr, to, behavior)? } - DataType::Int16 if to.is_decimal() => { + DataTypeOld::Int16 if to.is_decimal() => { cast_int_to_decimal_helper::(arr, to, behavior)? } - DataType::Int32 if to.is_decimal() => { + DataTypeOld::Int32 if to.is_decimal() => { cast_int_to_decimal_helper::(arr, to, behavior)? } - DataType::Int64 if to.is_decimal() => { + DataTypeOld::Int64 if to.is_decimal() => { cast_int_to_decimal_helper::(arr, to, behavior)? } - DataType::Int128 if to.is_decimal() => { + DataTypeOld::Int128 if to.is_decimal() => { cast_int_to_decimal_helper::(arr, to, behavior)? } - DataType::UInt8 if to.is_decimal() => { + DataTypeOld::UInt8 if to.is_decimal() => { cast_int_to_decimal_helper::(arr, to, behavior)? } - DataType::UInt16 if to.is_decimal() => { + DataTypeOld::UInt16 if to.is_decimal() => { cast_int_to_decimal_helper::(arr, to, behavior)? } - DataType::UInt32 if to.is_decimal() => { + DataTypeOld::UInt32 if to.is_decimal() => { cast_int_to_decimal_helper::(arr, to, behavior)? } - DataType::UInt64 if to.is_decimal() => { + DataTypeOld::UInt64 if to.is_decimal() => { cast_int_to_decimal_helper::(arr, to, behavior)? } - DataType::UInt128 if to.is_decimal() => { + DataTypeOld::UInt128 if to.is_decimal() => { cast_int_to_decimal_helper::(arr, to, behavior)? } // Float to decimal. - DataType::Float32 if to.is_decimal() => { + DataTypeOld::Float32 if to.is_decimal() => { cast_float_to_decimal_helper::(arr, to, behavior)? } - DataType::Float64 if to.is_decimal() => { + DataTypeOld::Float64 if to.is_decimal() => { cast_float_to_decimal_helper::(arr, to, behavior)? } // Decimal to decimal - DataType::Decimal64(_) if to.is_decimal() => { + DataTypeOld::Decimal64(_) if to.is_decimal() => { decimal_rescale_helper::(arr, to, behavior)? } - DataType::Decimal128(_) if to.is_decimal() => { + DataTypeOld::Decimal128(_) if to.is_decimal() => { decimal_rescale_helper::(arr, to, behavior)? } // Decimal to float. - DataType::Decimal64(_) => match to { - DataType::Float32 => cast_decimal_to_float::(arr, to, behavior)?, - DataType::Float64 => cast_decimal_to_float::(arr, to, behavior)?, + DataTypeOld::Decimal64(_) => match to { + DataTypeOld::Float32 => { + cast_decimal_to_float::(arr, to, behavior)? + } + DataTypeOld::Float64 => { + cast_decimal_to_float::(arr, to, behavior)? + } other => return Err(RayexecError::new(format!("Unhandled data type: {other}"))), }, - DataType::Decimal128(_) => match to { - DataType::Float32 => cast_decimal_to_float::(arr, to, behavior)?, - DataType::Float64 => cast_decimal_to_float::(arr, to, behavior)?, + DataTypeOld::Decimal128(_) => match to { + DataTypeOld::Float32 => { + cast_decimal_to_float::(arr, to, behavior)? + } + DataTypeOld::Float64 => { + cast_decimal_to_float::(arr, to, behavior)? + } other => return Err(RayexecError::new(format!("Unhandled data type: {other}"))), }, @@ -224,7 +232,7 @@ pub fn cast_array(arr: &ArrayOld, to: DataType, behavior: CastFailBehavior) -> R fn decimal_rescale_helper<'a, S>( arr: &'a ArrayOld, - to: DataType, + to: DataTypeOld, behavior: CastFailBehavior, ) -> Result where @@ -232,15 +240,15 @@ where S::Type<'a>: PrimInt, { match to { - DataType::Decimal64(_) => decimal_rescale::(arr, to, behavior), - DataType::Decimal128(_) => decimal_rescale::(arr, to, behavior), + DataTypeOld::Decimal64(_) => decimal_rescale::(arr, to, behavior), + DataTypeOld::Decimal128(_) => decimal_rescale::(arr, to, behavior), other => Err(RayexecError::new(format!("Unhandled data type: {other}"))), } } pub fn decimal_rescale<'a, S, D>( arr: &'a ArrayOld, - to: DataType, + to: DataTypeOld, behavior: CastFailBehavior, ) -> Result where @@ -293,7 +301,7 @@ where fn cast_float_to_decimal_helper<'a, S>( arr: &'a ArrayOld, - to: DataType, + to: DataTypeOld, behavior: CastFailBehavior, ) -> Result where @@ -301,15 +309,15 @@ where S::Type<'a>: Float, { match to { - DataType::Decimal64(_) => cast_float_to_decimal::(arr, to, behavior), - DataType::Decimal128(_) => cast_float_to_decimal::(arr, to, behavior), + DataTypeOld::Decimal64(_) => cast_float_to_decimal::(arr, to, behavior), + DataTypeOld::Decimal128(_) => cast_float_to_decimal::(arr, to, behavior), other => Err(RayexecError::new(format!("Unhandled data type: {other}"))), } } fn cast_float_to_decimal<'a, S, D>( arr: &'a ArrayOld, - to: DataType, + to: DataTypeOld, behavior: CastFailBehavior, ) -> Result where @@ -357,7 +365,7 @@ where // TODO: Weird to specify both the float generic and datatype. pub fn cast_decimal_to_float<'a, S, F>( arr: &'a ArrayOld, - to: DataType, + to: DataTypeOld, behavior: CastFailBehavior, ) -> Result where @@ -395,7 +403,7 @@ where fn cast_int_to_decimal_helper<'a, S>( arr: &'a ArrayOld, - to: DataType, + to: DataTypeOld, behavior: CastFailBehavior, ) -> Result where @@ -403,15 +411,15 @@ where S::Type<'a>: PrimInt, { match to { - DataType::Decimal64(_) => cast_int_to_decimal::(arr, to, behavior), - DataType::Decimal128(_) => cast_int_to_decimal::(arr, to, behavior), + DataTypeOld::Decimal64(_) => cast_int_to_decimal::(arr, to, behavior), + DataTypeOld::Decimal128(_) => cast_int_to_decimal::(arr, to, behavior), other => Err(RayexecError::new(format!("Unhandled data type: {other}"))), } } fn cast_int_to_decimal<'a, S, D>( arr: &'a ArrayOld, - to: DataType, + to: DataTypeOld, behavior: CastFailBehavior, ) -> Result where @@ -477,7 +485,7 @@ where fn cast_primitive_numeric_helper<'a, S>( arr: &'a ArrayOld, - to: DataType, + to: DataTypeOld, behavior: CastFailBehavior, ) -> Result where @@ -485,26 +493,26 @@ where S::Type<'a>: ToPrimitive, { match to { - DataType::Int8 => cast_primitive_numeric::(arr, to, behavior), - DataType::Int16 => cast_primitive_numeric::(arr, to, behavior), - DataType::Int32 => cast_primitive_numeric::(arr, to, behavior), - DataType::Int64 => cast_primitive_numeric::(arr, to, behavior), - DataType::Int128 => cast_primitive_numeric::(arr, to, behavior), - DataType::UInt8 => cast_primitive_numeric::(arr, to, behavior), - DataType::UInt16 => cast_primitive_numeric::(arr, to, behavior), - DataType::UInt32 => cast_primitive_numeric::(arr, to, behavior), - DataType::UInt64 => cast_primitive_numeric::(arr, to, behavior), - DataType::UInt128 => cast_primitive_numeric::(arr, to, behavior), - DataType::Float16 => cast_primitive_numeric::(arr, to, behavior), - DataType::Float32 => cast_primitive_numeric::(arr, to, behavior), - DataType::Float64 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::Int8 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::Int16 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::Int32 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::Int64 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::Int128 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::UInt8 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::UInt16 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::UInt32 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::UInt64 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::UInt128 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::Float16 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::Float32 => cast_primitive_numeric::(arr, to, behavior), + DataTypeOld::Float64 => cast_primitive_numeric::(arr, to, behavior), other => Err(RayexecError::new(format!("Unhandled data type: {other}"))), } } pub fn cast_primitive_numeric<'a, S, T>( arr: &'a ArrayOld, - datatype: DataType, + datatype: DataTypeOld, behavior: CastFailBehavior, ) -> Result where @@ -531,46 +539,54 @@ where pub fn cast_from_utf8( arr: &ArrayOld, - datatype: DataType, + datatype: DataTypeOld, behavior: CastFailBehavior, ) -> Result { match datatype { - DataType::Boolean => cast_parse_bool(arr, behavior), - DataType::Int8 => cast_parse_primitive(arr, datatype, behavior, Int8Parser::default()), - DataType::Int16 => cast_parse_primitive(arr, datatype, behavior, Int16Parser::default()), - DataType::Int32 => cast_parse_primitive(arr, datatype, behavior, Int32Parser::default()), - DataType::Int64 => cast_parse_primitive(arr, datatype, behavior, Int64Parser::default()), - DataType::Int128 => cast_parse_primitive(arr, datatype, behavior, Int128Parser::default()), - DataType::UInt8 => cast_parse_primitive(arr, datatype, behavior, UInt8Parser::default()), - DataType::UInt16 => cast_parse_primitive(arr, datatype, behavior, UInt16Parser::default()), - DataType::UInt32 => cast_parse_primitive(arr, datatype, behavior, UInt32Parser::default()), - DataType::UInt64 => cast_parse_primitive(arr, datatype, behavior, UInt64Parser::default()), - DataType::UInt128 => { + DataTypeOld::Boolean => cast_parse_bool(arr, behavior), + DataTypeOld::Int8 => cast_parse_primitive(arr, datatype, behavior, Int8Parser::default()), + DataTypeOld::Int16 => cast_parse_primitive(arr, datatype, behavior, Int16Parser::default()), + DataTypeOld::Int32 => cast_parse_primitive(arr, datatype, behavior, Int32Parser::default()), + DataTypeOld::Int64 => cast_parse_primitive(arr, datatype, behavior, Int64Parser::default()), + DataTypeOld::Int128 => { + cast_parse_primitive(arr, datatype, behavior, Int128Parser::default()) + } + DataTypeOld::UInt8 => cast_parse_primitive(arr, datatype, behavior, UInt8Parser::default()), + DataTypeOld::UInt16 => { + cast_parse_primitive(arr, datatype, behavior, UInt16Parser::default()) + } + DataTypeOld::UInt32 => { + cast_parse_primitive(arr, datatype, behavior, UInt32Parser::default()) + } + DataTypeOld::UInt64 => { + cast_parse_primitive(arr, datatype, behavior, UInt64Parser::default()) + } + DataTypeOld::UInt128 => { cast_parse_primitive(arr, datatype, behavior, UInt128Parser::default()) } - DataType::Float16 => { + DataTypeOld::Float16 => { cast_parse_primitive(arr, datatype, behavior, Float16Parser::default()) } - DataType::Float32 => { + DataTypeOld::Float32 => { cast_parse_primitive(arr, datatype, behavior, Float32Parser::default()) } - DataType::Float64 => { + DataTypeOld::Float64 => { cast_parse_primitive(arr, datatype, behavior, Float64Parser::default()) } - DataType::Decimal64(m) => cast_parse_primitive( + DataTypeOld::Decimal64(m) => cast_parse_primitive( arr, datatype, behavior, Decimal64Parser::new(m.precision, m.scale), ), - DataType::Decimal128(m) => cast_parse_primitive( + DataTypeOld::Decimal128(m) => cast_parse_primitive( arr, datatype, behavior, Decimal128Parser::new(m.precision, m.scale), ), - DataType::Date32 => cast_parse_primitive(arr, datatype, behavior, Date32Parser), - DataType::Interval => { + DataTypeOld::Date32 => cast_parse_primitive(arr, datatype, behavior, Date32Parser), + DataTypeOld::Interval => { cast_parse_primitive(arr, datatype, behavior, IntervalParser::default()) } other => Err(RayexecError::new(format!( @@ -581,54 +597,56 @@ pub fn cast_from_utf8( pub fn cast_to_utf8(arr: &ArrayOld, behavior: CastFailBehavior) -> Result { match arr.datatype() { - DataType::Boolean => { + DataTypeOld::Boolean => { cast_format::(arr, BoolFormatter::default(), behavior) } - DataType::Int8 => cast_format::(arr, Int8Formatter::default(), behavior), - DataType::Int16 => { + DataTypeOld::Int8 => { + cast_format::(arr, Int8Formatter::default(), behavior) + } + DataTypeOld::Int16 => { cast_format::(arr, Int16Formatter::default(), behavior) } - DataType::Int32 => { + DataTypeOld::Int32 => { cast_format::(arr, Int32Formatter::default(), behavior) } - DataType::Int64 => { + DataTypeOld::Int64 => { cast_format::(arr, Int64Formatter::default(), behavior) } - DataType::Int128 => { + DataTypeOld::Int128 => { cast_format::(arr, Int128Formatter::default(), behavior) } - DataType::UInt8 => { + DataTypeOld::UInt8 => { cast_format::(arr, UInt8Formatter::default(), behavior) } - DataType::UInt16 => { + DataTypeOld::UInt16 => { cast_format::(arr, UInt16Formatter::default(), behavior) } - DataType::UInt32 => { + DataTypeOld::UInt32 => { cast_format::(arr, UInt32Formatter::default(), behavior) } - DataType::UInt64 => { + DataTypeOld::UInt64 => { cast_format::(arr, UInt64Formatter::default(), behavior) } - DataType::UInt128 => { + DataTypeOld::UInt128 => { cast_format::(arr, UInt128Formatter::default(), behavior) } - DataType::Float32 => { + DataTypeOld::Float32 => { cast_format::(arr, Float32Formatter::default(), behavior) } - DataType::Float64 => { + DataTypeOld::Float64 => { cast_format::(arr, Float64Formatter::default(), behavior) } - DataType::Decimal64(m) => cast_format::( + DataTypeOld::Decimal64(m) => cast_format::( arr, Decimal64Formatter::new(m.precision, m.scale), behavior, ), - DataType::Decimal128(m) => cast_format::( + DataTypeOld::Decimal128(m) => cast_format::( arr, Decimal128Formatter::new(m.precision, m.scale), behavior, ), - DataType::Timestamp(m) => match m.unit { + DataTypeOld::Timestamp(m) => match m.unit { TimeUnit::Second => cast_format::( arr, TimestampSecondsFormatter::default(), @@ -671,7 +689,7 @@ where let output = UnaryExecutor::execute::( arr, ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::with_len(arr.logical_len()), }, |v, buf| { @@ -691,7 +709,7 @@ fn cast_parse_bool(arr: &ArrayOld, behavior: CastFailBehavior) -> Result( arr, ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(arr.logical_len()), }, |v, buf| match BoolParser.parse(v) { @@ -705,7 +723,7 @@ fn cast_parse_bool(arr: &ArrayOld, behavior: CastFailBehavior) -> Result( arr: &ArrayOld, - datatype: DataType, + datatype: DataTypeOld, behavior: CastFailBehavior, mut parser: P, ) -> Result @@ -740,7 +758,7 @@ mod tests { fn array_cast_utf8_to_i32() { let arr = ArrayOld::from_iter(["13", "18", "123456789"]); - let got = cast_array(&arr, DataType::Int32, CastFailBehavior::Error).unwrap(); + let got = cast_array(&arr, DataTypeOld::Int32, CastFailBehavior::Error).unwrap(); assert_eq!(ScalarValue::from(13), got.logical_value(0).unwrap()); assert_eq!(ScalarValue::from(18), got.logical_value(1).unwrap()); @@ -750,14 +768,14 @@ mod tests { #[test] fn array_cast_utf8_to_i32_overflow_error() { let arr = ArrayOld::from_iter(["13", "18", "123456789000000"]); - cast_array(&arr, DataType::Int32, CastFailBehavior::Error).unwrap_err(); + cast_array(&arr, DataTypeOld::Int32, CastFailBehavior::Error).unwrap_err(); } #[test] fn array_cast_utf8_to_i32_overflow_null() { let arr = ArrayOld::from_iter(["13", "18", "123456789000000"]); - let got = cast_array(&arr, DataType::Int32, CastFailBehavior::Null).unwrap(); + let got = cast_array(&arr, DataTypeOld::Int32, CastFailBehavior::Null).unwrap(); assert_eq!(ScalarValue::from(13), got.logical_value(0).unwrap()); assert_eq!(ScalarValue::from(18), got.logical_value(1).unwrap()); @@ -768,9 +786,9 @@ mod tests { fn array_cast_null_to_f32() { let arr = ArrayOld::new_untyped_null_array(3); - let got = cast_array(&arr, DataType::Float32, CastFailBehavior::Error).unwrap(); + let got = cast_array(&arr, DataTypeOld::Float32, CastFailBehavior::Error).unwrap(); - assert_eq!(&DataType::Float32, got.datatype()); + assert_eq!(&DataTypeOld::Float32, got.datatype()); assert_eq!(ScalarValue::Null, got.logical_value(0).unwrap()); assert_eq!(ScalarValue::Null, got.logical_value(1).unwrap()); @@ -780,14 +798,14 @@ mod tests { #[test] fn array_cast_decimal64_to_f64() { let arr = ArrayOld::new_with_array_data( - DataType::Decimal64(DecimalTypeMeta { + DataTypeOld::Decimal64(DecimalTypeMeta { precision: 10, scale: 3, }), PrimitiveStorage::from(vec![1500_i64, 2000_i64, 2500_i64]), ); - let got = cast_array(&arr, DataType::Float64, CastFailBehavior::Error).unwrap(); + let got = cast_array(&arr, DataTypeOld::Float64, CastFailBehavior::Error).unwrap(); assert_eq!(ScalarValue::Float64(1.5), got.logical_value(0).unwrap()); assert_eq!(ScalarValue::Float64(2.0), got.logical_value(1).unwrap()); diff --git a/crates/rayexec_bullet/src/compute/cast/scalar.rs b/crates/rayexec_bullet/src/compute/cast/scalar.rs index 33843c89b..d11ea86da 100644 --- a/crates/rayexec_bullet/src/compute/cast/scalar.rs +++ b/crates/rayexec_bullet/src/compute/cast/scalar.rs @@ -19,234 +19,314 @@ use super::parse::{ UInt8Parser, }; use crate::compute::cast::parse::{BoolParser, Date32Parser, IntervalParser}; -use crate::datatype::DataType; +use crate::datatype::DataTypeOld; use crate::scalar::decimal::{Decimal128Scalar, Decimal64Scalar}; use crate::scalar::{OwnedScalarValue, ScalarValue}; // TODO: Try to remove this. -pub fn cast_scalar(scalar: ScalarValue, to: &DataType) -> Result { +pub fn cast_scalar(scalar: ScalarValue, to: &DataTypeOld) -> Result { if &scalar.datatype() == to { return Ok(scalar.into_owned()); } Ok(match (scalar, to) { - (ScalarValue::UInt8(v), DataType::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), - (ScalarValue::UInt8(v), DataType::Int16) => ScalarValue::Int16(cast_primitive_numeric(v)?), - (ScalarValue::UInt8(v), DataType::Int32) => ScalarValue::Int32(cast_primitive_numeric(v)?), - (ScalarValue::UInt8(v), DataType::Int64) => ScalarValue::Int64(cast_primitive_numeric(v)?), - (ScalarValue::UInt8(v), DataType::UInt8) => ScalarValue::UInt8(cast_primitive_numeric(v)?), - (ScalarValue::UInt8(v), DataType::UInt16) => { + (ScalarValue::UInt8(v), DataTypeOld::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), + (ScalarValue::UInt8(v), DataTypeOld::Int16) => { + ScalarValue::Int16(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt8(v), DataTypeOld::Int32) => { + ScalarValue::Int32(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt8(v), DataTypeOld::Int64) => { + ScalarValue::Int64(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt8(v), DataTypeOld::UInt8) => { + ScalarValue::UInt8(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt8(v), DataTypeOld::UInt16) => { ScalarValue::UInt16(cast_primitive_numeric(v)?) } - (ScalarValue::UInt8(v), DataType::UInt32) => { + (ScalarValue::UInt8(v), DataTypeOld::UInt32) => { ScalarValue::UInt32(cast_primitive_numeric(v)?) } - (ScalarValue::UInt8(v), DataType::UInt64) => { + (ScalarValue::UInt8(v), DataTypeOld::UInt64) => { ScalarValue::UInt64(cast_primitive_numeric(v)?) } - (ScalarValue::UInt8(v), DataType::Float32) => { + (ScalarValue::UInt8(v), DataTypeOld::Float32) => { ScalarValue::Float32(cast_primitive_numeric(v)?) } - (ScalarValue::UInt8(v), DataType::Float64) => { + (ScalarValue::UInt8(v), DataTypeOld::Float64) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } // From UInt16 - (ScalarValue::UInt16(v), DataType::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), - (ScalarValue::UInt16(v), DataType::Int16) => ScalarValue::Int16(cast_primitive_numeric(v)?), - (ScalarValue::UInt16(v), DataType::Int32) => ScalarValue::Int32(cast_primitive_numeric(v)?), - (ScalarValue::UInt16(v), DataType::Int64) => ScalarValue::Int64(cast_primitive_numeric(v)?), - (ScalarValue::UInt16(v), DataType::UInt8) => ScalarValue::UInt8(cast_primitive_numeric(v)?), - (ScalarValue::UInt16(v), DataType::UInt16) => { + (ScalarValue::UInt16(v), DataTypeOld::Int8) => { + ScalarValue::Int8(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt16(v), DataTypeOld::Int16) => { + ScalarValue::Int16(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt16(v), DataTypeOld::Int32) => { + ScalarValue::Int32(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt16(v), DataTypeOld::Int64) => { + ScalarValue::Int64(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt16(v), DataTypeOld::UInt8) => { + ScalarValue::UInt8(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt16(v), DataTypeOld::UInt16) => { ScalarValue::UInt16(cast_primitive_numeric(v)?) } - (ScalarValue::UInt16(v), DataType::UInt32) => { + (ScalarValue::UInt16(v), DataTypeOld::UInt32) => { ScalarValue::UInt32(cast_primitive_numeric(v)?) } - (ScalarValue::UInt16(v), DataType::UInt64) => { + (ScalarValue::UInt16(v), DataTypeOld::UInt64) => { ScalarValue::UInt64(cast_primitive_numeric(v)?) } - (ScalarValue::UInt16(v), DataType::Float32) => { + (ScalarValue::UInt16(v), DataTypeOld::Float32) => { ScalarValue::Float32(cast_primitive_numeric(v)?) } - (ScalarValue::UInt16(v), DataType::Float64) => { + (ScalarValue::UInt16(v), DataTypeOld::Float64) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } // From UInt32 - (ScalarValue::UInt32(v), DataType::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), - (ScalarValue::UInt32(v), DataType::Int16) => ScalarValue::Int16(cast_primitive_numeric(v)?), - (ScalarValue::UInt32(v), DataType::Int32) => ScalarValue::Int32(cast_primitive_numeric(v)?), - (ScalarValue::UInt32(v), DataType::Int64) => ScalarValue::Int64(cast_primitive_numeric(v)?), - (ScalarValue::UInt32(v), DataType::UInt8) => ScalarValue::UInt8(cast_primitive_numeric(v)?), - (ScalarValue::UInt32(v), DataType::UInt16) => { + (ScalarValue::UInt32(v), DataTypeOld::Int8) => { + ScalarValue::Int8(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt32(v), DataTypeOld::Int16) => { + ScalarValue::Int16(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt32(v), DataTypeOld::Int32) => { + ScalarValue::Int32(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt32(v), DataTypeOld::Int64) => { + ScalarValue::Int64(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt32(v), DataTypeOld::UInt8) => { + ScalarValue::UInt8(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt32(v), DataTypeOld::UInt16) => { ScalarValue::UInt16(cast_primitive_numeric(v)?) } - (ScalarValue::UInt32(v), DataType::UInt32) => { + (ScalarValue::UInt32(v), DataTypeOld::UInt32) => { ScalarValue::UInt32(cast_primitive_numeric(v)?) } - (ScalarValue::UInt32(v), DataType::UInt64) => { + (ScalarValue::UInt32(v), DataTypeOld::UInt64) => { ScalarValue::UInt64(cast_primitive_numeric(v)?) } - (ScalarValue::UInt32(v), DataType::Float32) => { + (ScalarValue::UInt32(v), DataTypeOld::Float32) => { ScalarValue::Float32(cast_primitive_numeric(v)?) } - (ScalarValue::UInt32(v), DataType::Float64) => { + (ScalarValue::UInt32(v), DataTypeOld::Float64) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } // From UInt64 - (ScalarValue::UInt64(v), DataType::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), - (ScalarValue::UInt64(v), DataType::Int16) => ScalarValue::Int16(cast_primitive_numeric(v)?), - (ScalarValue::UInt64(v), DataType::Int32) => ScalarValue::Int32(cast_primitive_numeric(v)?), - (ScalarValue::UInt64(v), DataType::Int64) => ScalarValue::Int64(cast_primitive_numeric(v)?), - (ScalarValue::UInt64(v), DataType::UInt8) => ScalarValue::UInt8(cast_primitive_numeric(v)?), - (ScalarValue::UInt64(v), DataType::UInt16) => { + (ScalarValue::UInt64(v), DataTypeOld::Int8) => { + ScalarValue::Int8(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt64(v), DataTypeOld::Int16) => { + ScalarValue::Int16(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt64(v), DataTypeOld::Int32) => { + ScalarValue::Int32(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt64(v), DataTypeOld::Int64) => { + ScalarValue::Int64(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt64(v), DataTypeOld::UInt8) => { + ScalarValue::UInt8(cast_primitive_numeric(v)?) + } + (ScalarValue::UInt64(v), DataTypeOld::UInt16) => { ScalarValue::UInt16(cast_primitive_numeric(v)?) } - (ScalarValue::UInt64(v), DataType::UInt32) => { + (ScalarValue::UInt64(v), DataTypeOld::UInt32) => { ScalarValue::UInt32(cast_primitive_numeric(v)?) } - (ScalarValue::UInt64(v), DataType::UInt64) => { + (ScalarValue::UInt64(v), DataTypeOld::UInt64) => { ScalarValue::UInt64(cast_primitive_numeric(v)?) } - (ScalarValue::UInt64(v), DataType::Float32) => { + (ScalarValue::UInt64(v), DataTypeOld::Float32) => { ScalarValue::Float32(cast_primitive_numeric(v)?) } - (ScalarValue::UInt64(v), DataType::Float64) => { + (ScalarValue::UInt64(v), DataTypeOld::Float64) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } // From Int8 - (ScalarValue::Int8(v), DataType::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), - (ScalarValue::Int8(v), DataType::Int16) => ScalarValue::Int16(cast_primitive_numeric(v)?), - (ScalarValue::Int8(v), DataType::Int32) => ScalarValue::Int32(cast_primitive_numeric(v)?), - (ScalarValue::Int8(v), DataType::Int64) => ScalarValue::Int64(cast_primitive_numeric(v)?), - (ScalarValue::Int8(v), DataType::UInt8) => ScalarValue::UInt8(cast_primitive_numeric(v)?), - (ScalarValue::Int8(v), DataType::UInt16) => ScalarValue::UInt16(cast_primitive_numeric(v)?), - (ScalarValue::Int8(v), DataType::UInt32) => ScalarValue::UInt32(cast_primitive_numeric(v)?), - (ScalarValue::Int8(v), DataType::UInt64) => ScalarValue::UInt64(cast_primitive_numeric(v)?), - (ScalarValue::Int8(v), DataType::Float32) => { + (ScalarValue::Int8(v), DataTypeOld::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), + (ScalarValue::Int8(v), DataTypeOld::Int16) => { + ScalarValue::Int16(cast_primitive_numeric(v)?) + } + (ScalarValue::Int8(v), DataTypeOld::Int32) => { + ScalarValue::Int32(cast_primitive_numeric(v)?) + } + (ScalarValue::Int8(v), DataTypeOld::Int64) => { + ScalarValue::Int64(cast_primitive_numeric(v)?) + } + (ScalarValue::Int8(v), DataTypeOld::UInt8) => { + ScalarValue::UInt8(cast_primitive_numeric(v)?) + } + (ScalarValue::Int8(v), DataTypeOld::UInt16) => { + ScalarValue::UInt16(cast_primitive_numeric(v)?) + } + (ScalarValue::Int8(v), DataTypeOld::UInt32) => { + ScalarValue::UInt32(cast_primitive_numeric(v)?) + } + (ScalarValue::Int8(v), DataTypeOld::UInt64) => { + ScalarValue::UInt64(cast_primitive_numeric(v)?) + } + (ScalarValue::Int8(v), DataTypeOld::Float32) => { ScalarValue::Float32(cast_primitive_numeric(v)?) } - (ScalarValue::Int8(v), DataType::Float64) => { + (ScalarValue::Int8(v), DataTypeOld::Float64) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } // From Int16 - (ScalarValue::Int16(v), DataType::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), - (ScalarValue::Int16(v), DataType::Int16) => ScalarValue::Int16(cast_primitive_numeric(v)?), - (ScalarValue::Int16(v), DataType::Int32) => ScalarValue::Int32(cast_primitive_numeric(v)?), - (ScalarValue::Int16(v), DataType::Int64) => ScalarValue::Int64(cast_primitive_numeric(v)?), - (ScalarValue::Int16(v), DataType::UInt8) => ScalarValue::UInt8(cast_primitive_numeric(v)?), - (ScalarValue::Int16(v), DataType::UInt16) => { + (ScalarValue::Int16(v), DataTypeOld::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), + (ScalarValue::Int16(v), DataTypeOld::Int16) => { + ScalarValue::Int16(cast_primitive_numeric(v)?) + } + (ScalarValue::Int16(v), DataTypeOld::Int32) => { + ScalarValue::Int32(cast_primitive_numeric(v)?) + } + (ScalarValue::Int16(v), DataTypeOld::Int64) => { + ScalarValue::Int64(cast_primitive_numeric(v)?) + } + (ScalarValue::Int16(v), DataTypeOld::UInt8) => { + ScalarValue::UInt8(cast_primitive_numeric(v)?) + } + (ScalarValue::Int16(v), DataTypeOld::UInt16) => { ScalarValue::UInt16(cast_primitive_numeric(v)?) } - (ScalarValue::Int16(v), DataType::UInt32) => { + (ScalarValue::Int16(v), DataTypeOld::UInt32) => { ScalarValue::UInt32(cast_primitive_numeric(v)?) } - (ScalarValue::Int16(v), DataType::UInt64) => { + (ScalarValue::Int16(v), DataTypeOld::UInt64) => { ScalarValue::UInt64(cast_primitive_numeric(v)?) } - (ScalarValue::Int16(v), DataType::Float32) => { + (ScalarValue::Int16(v), DataTypeOld::Float32) => { ScalarValue::Float32(cast_primitive_numeric(v)?) } - (ScalarValue::Int16(v), DataType::Float64) => { + (ScalarValue::Int16(v), DataTypeOld::Float64) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } // From Int32 - (ScalarValue::Int32(v), DataType::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), - (ScalarValue::Int32(v), DataType::Int16) => ScalarValue::Int16(cast_primitive_numeric(v)?), - (ScalarValue::Int32(v), DataType::Int32) => ScalarValue::Int32(cast_primitive_numeric(v)?), - (ScalarValue::Int32(v), DataType::Int64) => ScalarValue::Int64(cast_primitive_numeric(v)?), - (ScalarValue::Int32(v), DataType::UInt8) => ScalarValue::UInt8(cast_primitive_numeric(v)?), - (ScalarValue::Int32(v), DataType::UInt16) => { + (ScalarValue::Int32(v), DataTypeOld::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), + (ScalarValue::Int32(v), DataTypeOld::Int16) => { + ScalarValue::Int16(cast_primitive_numeric(v)?) + } + (ScalarValue::Int32(v), DataTypeOld::Int32) => { + ScalarValue::Int32(cast_primitive_numeric(v)?) + } + (ScalarValue::Int32(v), DataTypeOld::Int64) => { + ScalarValue::Int64(cast_primitive_numeric(v)?) + } + (ScalarValue::Int32(v), DataTypeOld::UInt8) => { + ScalarValue::UInt8(cast_primitive_numeric(v)?) + } + (ScalarValue::Int32(v), DataTypeOld::UInt16) => { ScalarValue::UInt16(cast_primitive_numeric(v)?) } - (ScalarValue::Int32(v), DataType::UInt32) => { + (ScalarValue::Int32(v), DataTypeOld::UInt32) => { ScalarValue::UInt32(cast_primitive_numeric(v)?) } - (ScalarValue::Int32(v), DataType::UInt64) => { + (ScalarValue::Int32(v), DataTypeOld::UInt64) => { ScalarValue::UInt64(cast_primitive_numeric(v)?) } - (ScalarValue::Int32(v), DataType::Float32) => { + (ScalarValue::Int32(v), DataTypeOld::Float32) => { ScalarValue::Float32(cast_primitive_numeric(v)?) } - (ScalarValue::Int32(v), DataType::Float64) => { + (ScalarValue::Int32(v), DataTypeOld::Float64) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } // From Int64 - (ScalarValue::Int64(v), DataType::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), - (ScalarValue::Int64(v), DataType::Int16) => ScalarValue::Int16(cast_primitive_numeric(v)?), - (ScalarValue::Int64(v), DataType::Int32) => ScalarValue::Int32(cast_primitive_numeric(v)?), - (ScalarValue::Int64(v), DataType::Int64) => ScalarValue::Int64(cast_primitive_numeric(v)?), - (ScalarValue::Int64(v), DataType::UInt8) => ScalarValue::UInt8(cast_primitive_numeric(v)?), - (ScalarValue::Int64(v), DataType::UInt16) => { + (ScalarValue::Int64(v), DataTypeOld::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), + (ScalarValue::Int64(v), DataTypeOld::Int16) => { + ScalarValue::Int16(cast_primitive_numeric(v)?) + } + (ScalarValue::Int64(v), DataTypeOld::Int32) => { + ScalarValue::Int32(cast_primitive_numeric(v)?) + } + (ScalarValue::Int64(v), DataTypeOld::Int64) => { + ScalarValue::Int64(cast_primitive_numeric(v)?) + } + (ScalarValue::Int64(v), DataTypeOld::UInt8) => { + ScalarValue::UInt8(cast_primitive_numeric(v)?) + } + (ScalarValue::Int64(v), DataTypeOld::UInt16) => { ScalarValue::UInt16(cast_primitive_numeric(v)?) } - (ScalarValue::Int64(v), DataType::UInt32) => { + (ScalarValue::Int64(v), DataTypeOld::UInt32) => { ScalarValue::UInt32(cast_primitive_numeric(v)?) } - (ScalarValue::Int64(v), DataType::UInt64) => { + (ScalarValue::Int64(v), DataTypeOld::UInt64) => { ScalarValue::UInt64(cast_primitive_numeric(v)?) } - (ScalarValue::Int64(v), DataType::Float32) => { + (ScalarValue::Int64(v), DataTypeOld::Float32) => { ScalarValue::Float32(cast_primitive_numeric(v)?) } - (ScalarValue::Int64(v), DataType::Float64) => { + (ScalarValue::Int64(v), DataTypeOld::Float64) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } // From Float32 - (ScalarValue::Float32(v), DataType::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), - (ScalarValue::Float32(v), DataType::Int16) => { + (ScalarValue::Float32(v), DataTypeOld::Int8) => { + ScalarValue::Int8(cast_primitive_numeric(v)?) + } + (ScalarValue::Float32(v), DataTypeOld::Int16) => { ScalarValue::Int16(cast_primitive_numeric(v)?) } - (ScalarValue::Float32(v), DataType::Int32) => { + (ScalarValue::Float32(v), DataTypeOld::Int32) => { ScalarValue::Int32(cast_primitive_numeric(v)?) } - (ScalarValue::Float32(v), DataType::Int64) => { + (ScalarValue::Float32(v), DataTypeOld::Int64) => { ScalarValue::Int64(cast_primitive_numeric(v)?) } - (ScalarValue::Float32(v), DataType::UInt8) => { + (ScalarValue::Float32(v), DataTypeOld::UInt8) => { ScalarValue::UInt8(cast_primitive_numeric(v)?) } - (ScalarValue::Float32(v), DataType::UInt16) => { + (ScalarValue::Float32(v), DataTypeOld::UInt16) => { ScalarValue::UInt16(cast_primitive_numeric(v)?) } - (ScalarValue::Float32(v), DataType::UInt32) => { + (ScalarValue::Float32(v), DataTypeOld::UInt32) => { ScalarValue::UInt32(cast_primitive_numeric(v)?) } - (ScalarValue::Float32(v), DataType::UInt64) => { + (ScalarValue::Float32(v), DataTypeOld::UInt64) => { ScalarValue::UInt64(cast_primitive_numeric(v)?) } - (ScalarValue::Float32(v), DataType::Float32) => { + (ScalarValue::Float32(v), DataTypeOld::Float32) => { ScalarValue::Float32(cast_primitive_numeric(v)?) } - (ScalarValue::Float32(v), DataType::Float64) => { + (ScalarValue::Float32(v), DataTypeOld::Float64) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } // From Float64 - (ScalarValue::Float64(v), DataType::Int8) => ScalarValue::Int8(cast_primitive_numeric(v)?), - (ScalarValue::Float64(v), DataType::Int16) => { + (ScalarValue::Float64(v), DataTypeOld::Int8) => { + ScalarValue::Int8(cast_primitive_numeric(v)?) + } + (ScalarValue::Float64(v), DataTypeOld::Int16) => { ScalarValue::Int16(cast_primitive_numeric(v)?) } - (ScalarValue::Float64(v), DataType::Int32) => { + (ScalarValue::Float64(v), DataTypeOld::Int32) => { ScalarValue::Int32(cast_primitive_numeric(v)?) } - (ScalarValue::Float64(v), DataType::Int64) => { + (ScalarValue::Float64(v), DataTypeOld::Int64) => { ScalarValue::Int64(cast_primitive_numeric(v)?) } - (ScalarValue::Float64(v), DataType::UInt8) => { + (ScalarValue::Float64(v), DataTypeOld::UInt8) => { ScalarValue::UInt8(cast_primitive_numeric(v)?) } - (ScalarValue::Float64(v), DataType::UInt16) => { + (ScalarValue::Float64(v), DataTypeOld::UInt16) => { ScalarValue::UInt16(cast_primitive_numeric(v)?) } - (ScalarValue::Float64(v), DataType::UInt32) => { + (ScalarValue::Float64(v), DataTypeOld::UInt32) => { ScalarValue::UInt32(cast_primitive_numeric(v)?) } - (ScalarValue::Float64(v), DataType::UInt64) => { + (ScalarValue::Float64(v), DataTypeOld::UInt64) => { ScalarValue::UInt64(cast_primitive_numeric(v)?) } - (ScalarValue::Float64(v), DataType::Float32) => { + (ScalarValue::Float64(v), DataTypeOld::Float32) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } - (ScalarValue::Float64(v), DataType::Float64) => { + (ScalarValue::Float64(v), DataTypeOld::Float64) => { ScalarValue::Float64(cast_primitive_numeric(v)?) } @@ -254,7 +334,7 @@ pub fn cast_scalar(scalar: ScalarValue, to: &DataType) -> Result cast_from_utf8_scalar(v.as_ref(), datatype)?, // To Utf8 - (v, DataType::Utf8) => ScalarValue::Utf8(v.to_string().into()), + (v, DataTypeOld::Utf8) => ScalarValue::Utf8(v.to_string().into()), (scalar, to) => { return Err(RayexecError::new(format!( @@ -265,26 +345,26 @@ pub fn cast_scalar(scalar: ScalarValue, to: &DataType) -> Result Result { - fn parse>(mut parser: P, v: &str, datatype: &DataType) -> Result { +fn cast_from_utf8_scalar(v: &str, datatype: &DataTypeOld) -> Result { + fn parse>(mut parser: P, v: &str, datatype: &DataTypeOld) -> Result { parser .parse(v) .ok_or_else(|| RayexecError::new(format!("Failed to parse as 'v' as {datatype}"))) } Ok(match datatype { - DataType::Boolean => ScalarValue::Boolean(parse(BoolParser, v, datatype)?), - DataType::Int8 => ScalarValue::Int8(parse(Int8Parser::default(), v, datatype)?), - DataType::Int16 => ScalarValue::Int16(parse(Int16Parser::default(), v, datatype)?), - DataType::Int32 => ScalarValue::Int32(parse(Int32Parser::default(), v, datatype)?), - DataType::Int64 => ScalarValue::Int64(parse(Int64Parser::default(), v, datatype)?), - DataType::UInt8 => ScalarValue::UInt8(parse(UInt8Parser::default(), v, datatype)?), - DataType::UInt16 => ScalarValue::UInt16(parse(UInt16Parser::default(), v, datatype)?), - DataType::UInt32 => ScalarValue::UInt32(parse(UInt32Parser::default(), v, datatype)?), - DataType::UInt64 => ScalarValue::UInt64(parse(UInt64Parser::default(), v, datatype)?), - DataType::Float32 => ScalarValue::Float32(parse(Float32Parser::default(), v, datatype)?), - DataType::Float64 => ScalarValue::Float64(parse(Float64Parser::default(), v, datatype)?), - DataType::Decimal64(meta) => ScalarValue::Decimal64(Decimal64Scalar { + DataTypeOld::Boolean => ScalarValue::Boolean(parse(BoolParser, v, datatype)?), + DataTypeOld::Int8 => ScalarValue::Int8(parse(Int8Parser::default(), v, datatype)?), + DataTypeOld::Int16 => ScalarValue::Int16(parse(Int16Parser::default(), v, datatype)?), + DataTypeOld::Int32 => ScalarValue::Int32(parse(Int32Parser::default(), v, datatype)?), + DataTypeOld::Int64 => ScalarValue::Int64(parse(Int64Parser::default(), v, datatype)?), + DataTypeOld::UInt8 => ScalarValue::UInt8(parse(UInt8Parser::default(), v, datatype)?), + DataTypeOld::UInt16 => ScalarValue::UInt16(parse(UInt16Parser::default(), v, datatype)?), + DataTypeOld::UInt32 => ScalarValue::UInt32(parse(UInt32Parser::default(), v, datatype)?), + DataTypeOld::UInt64 => ScalarValue::UInt64(parse(UInt64Parser::default(), v, datatype)?), + DataTypeOld::Float32 => ScalarValue::Float32(parse(Float32Parser::default(), v, datatype)?), + DataTypeOld::Float64 => ScalarValue::Float64(parse(Float64Parser::default(), v, datatype)?), + DataTypeOld::Decimal64(meta) => ScalarValue::Decimal64(Decimal64Scalar { precision: meta.precision, scale: meta.scale, value: parse( @@ -293,7 +373,7 @@ fn cast_from_utf8_scalar(v: &str, datatype: &DataType) -> Result ScalarValue::Decimal128(Decimal128Scalar { + DataTypeOld::Decimal128(meta) => ScalarValue::Decimal128(Decimal128Scalar { precision: meta.precision, scale: meta.scale, value: parse( @@ -302,8 +382,10 @@ fn cast_from_utf8_scalar(v: &str, datatype: &DataType) -> Result ScalarValue::Date32(parse(Date32Parser, v, datatype)?), - DataType::Interval => ScalarValue::Interval(parse(IntervalParser::default(), v, datatype)?), + DataTypeOld::Date32 => ScalarValue::Date32(parse(Date32Parser, v, datatype)?), + DataTypeOld::Interval => { + ScalarValue::Interval(parse(IntervalParser::default(), v, datatype)?) + } other => { return Err(RayexecError::new(format!( "Unable to cast utf8 scalar to {other}" diff --git a/crates/rayexec_bullet/src/compute/date.rs b/crates/rayexec_bullet/src/compute/date.rs index 280c1ca8f..c9808ad78 100644 --- a/crates/rayexec_bullet/src/compute/date.rs +++ b/crates/rayexec_bullet/src/compute/date.rs @@ -2,7 +2,7 @@ use chrono::{DateTime, Datelike, NaiveDate, Timelike, Utc}; use rayexec_error::{not_implemented, RayexecError, Result}; use crate::array::ArrayOld; -use crate::datatype::{DataType, DecimalTypeMeta, TimeUnit}; +use crate::datatype::{DataTypeOld, DecimalTypeMeta, TimeUnit}; use crate::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use crate::executor::physical_type::{PhysicalI32Old, PhysicalI64Old}; use crate::executor::scalar::UnaryExecutor; @@ -72,7 +72,7 @@ pub enum DatePart { pub fn extract_date_part(part: DatePart, arr: &ArrayOld) -> Result { let datatype = arr.datatype(); match datatype { - DataType::Date32 => match part { + DataTypeOld::Date32 => match part { DatePart::Microseconds => date32_extract_with_fn(arr, extract_microseconds), DatePart::Milliseconds => date32_extract_with_fn(arr, extract_milliseconds), DatePart::Second => date32_extract_with_fn(arr, extract_seconds), @@ -85,7 +85,7 @@ pub fn extract_date_part(part: DatePart, arr: &ArrayOld) -> Result { DatePart::Year => date32_extract_with_fn(arr, extract_year), other => not_implemented!("Extract {other:?} from {datatype}"), }, - DataType::Date64 => match part { + DataTypeOld::Date64 => match part { DatePart::Microseconds => date64_extract_with_fn(arr, extract_microseconds), DatePart::Milliseconds => date64_extract_with_fn(arr, extract_milliseconds), DatePart::Second => date64_extract_with_fn(arr, extract_seconds), @@ -98,7 +98,7 @@ pub fn extract_date_part(part: DatePart, arr: &ArrayOld) -> Result { DatePart::Year => date64_extract_with_fn(arr, extract_year), other => not_implemented!("Extract {other:?} from {datatype}"), }, - DataType::Timestamp(m) => match part { + DataTypeOld::Timestamp(m) => match part { DatePart::Microseconds => timestamp_extract_with_fn(m.unit, arr, extract_microseconds), DatePart::Milliseconds => timestamp_extract_with_fn(m.unit, arr, extract_milliseconds), DatePart::Second => timestamp_extract_with_fn(m.unit, arr, extract_seconds), @@ -151,7 +151,7 @@ where UnaryExecutor::execute::( arr, ArrayBuilder { - datatype: DataType::Decimal64(DecimalTypeMeta { + datatype: DataTypeOld::Decimal64(DecimalTypeMeta { precision: Decimal64Type::MAX_PRECISION, scale: Decimal64Type::DEFAULT_SCALE, }), @@ -171,7 +171,7 @@ where UnaryExecutor::execute::( arr, ArrayBuilder { - datatype: DataType::Decimal64(DecimalTypeMeta { + datatype: DataTypeOld::Decimal64(DecimalTypeMeta { precision: Decimal64Type::MAX_PRECISION, scale: Decimal64Type::DEFAULT_SCALE, }), @@ -192,7 +192,7 @@ where UnaryExecutor::execute::( arr, ArrayBuilder { - datatype: DataType::Decimal64(DecimalTypeMeta { + datatype: DataTypeOld::Decimal64(DecimalTypeMeta { precision: Decimal64Type::MAX_PRECISION, scale: Decimal64Type::DEFAULT_SCALE, }), diff --git a/crates/rayexec_bullet/src/datatype.rs b/crates/rayexec_bullet/src/datatype.rs index ce2b606d0..993ff8f88 100644 --- a/crates/rayexec_bullet/src/datatype.rs +++ b/crates/rayexec_bullet/src/datatype.rs @@ -292,11 +292,11 @@ impl ProtoConv for StructTypeMeta { /// Metadata associated with lists. #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct ListTypeMeta { - pub datatype: Box, + pub datatype: Box, } impl ListTypeMeta { - pub fn new(element_type: DataType) -> Self { + pub fn new(element_type: DataTypeOld) -> Self { ListTypeMeta { datatype: Box::new(element_type), } @@ -314,7 +314,9 @@ impl ProtoConv for ListTypeMeta { fn from_proto(proto: Self::ProtoType) -> Result { Ok(Self { - datatype: Box::new(DataType::from_proto(*proto.datatype.required("datatype")?)?), + datatype: Box::new(DataTypeOld::from_proto( + *proto.datatype.required("datatype")?, + )?), }) } } @@ -326,7 +328,7 @@ impl ProtoConv for ListTypeMeta { /// Some types may include additional metadata, which acts to refine the type /// even further. #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] -pub enum DataType { +pub enum DataTypeOld { /// Constant null columns. Null, Boolean, @@ -363,7 +365,7 @@ pub enum DataType { List(ListTypeMeta), } -impl DataType { +impl DataTypeOld { /// Try to create a default data type from the the data type id. /// /// Errors on attempts to create a data type from an id that we either don't @@ -374,37 +376,37 @@ impl DataType { DataTypeId::Any => { return Err(RayexecError::new("Cannot create a default Any datatype")) } - DataTypeId::Null => DataType::Null, - DataTypeId::Boolean => DataType::Boolean, - DataTypeId::Int8 => DataType::Int8, - DataTypeId::Int16 => DataType::Int16, - DataTypeId::Int32 => DataType::Int32, - DataTypeId::Int64 => DataType::Int64, - DataTypeId::Int128 => DataType::Int128, - DataTypeId::UInt8 => DataType::UInt8, - DataTypeId::UInt16 => DataType::UInt16, - DataTypeId::UInt32 => DataType::UInt32, - DataTypeId::UInt64 => DataType::UInt64, - DataTypeId::UInt128 => DataType::UInt128, - DataTypeId::Float16 => DataType::Float16, - DataTypeId::Float32 => DataType::Float32, - DataTypeId::Float64 => DataType::Float64, - DataTypeId::Decimal64 => DataType::Decimal64(DecimalTypeMeta::new( + DataTypeId::Null => DataTypeOld::Null, + DataTypeId::Boolean => DataTypeOld::Boolean, + DataTypeId::Int8 => DataTypeOld::Int8, + DataTypeId::Int16 => DataTypeOld::Int16, + DataTypeId::Int32 => DataTypeOld::Int32, + DataTypeId::Int64 => DataTypeOld::Int64, + DataTypeId::Int128 => DataTypeOld::Int128, + DataTypeId::UInt8 => DataTypeOld::UInt8, + DataTypeId::UInt16 => DataTypeOld::UInt16, + DataTypeId::UInt32 => DataTypeOld::UInt32, + DataTypeId::UInt64 => DataTypeOld::UInt64, + DataTypeId::UInt128 => DataTypeOld::UInt128, + DataTypeId::Float16 => DataTypeOld::Float16, + DataTypeId::Float32 => DataTypeOld::Float32, + DataTypeId::Float64 => DataTypeOld::Float64, + DataTypeId::Decimal64 => DataTypeOld::Decimal64(DecimalTypeMeta::new( Decimal64Type::MAX_PRECISION, Decimal64Type::DEFAULT_SCALE, )), - DataTypeId::Decimal128 => DataType::Decimal128(DecimalTypeMeta::new( + DataTypeId::Decimal128 => DataTypeOld::Decimal128(DecimalTypeMeta::new( Decimal128Type::MAX_PRECISION, Decimal128Type::DEFAULT_SCALE, )), - DataTypeId::Timestamp => DataType::Timestamp(TimestampTypeMeta { + DataTypeId::Timestamp => DataTypeOld::Timestamp(TimestampTypeMeta { unit: TimeUnit::Microsecond, }), - DataTypeId::Date32 => DataType::Date32, - DataTypeId::Date64 => DataType::Date64, - DataTypeId::Interval => DataType::Interval, - DataTypeId::Utf8 => DataType::Utf8, - DataTypeId::Binary => DataType::Binary, + DataTypeId::Date32 => DataTypeOld::Date32, + DataTypeId::Date64 => DataTypeOld::Date64, + DataTypeId::Interval => DataTypeOld::Interval, + DataTypeId::Utf8 => DataTypeOld::Utf8, + DataTypeId::Binary => DataTypeOld::Binary, DataTypeId::Struct => { return Err(RayexecError::new("Cannot create a default Struct datatype")) } @@ -417,126 +419,126 @@ impl DataType { /// Get the data type id from the data type. pub const fn datatype_id(&self) -> DataTypeId { match self { - DataType::Null => DataTypeId::Null, - DataType::Boolean => DataTypeId::Boolean, - DataType::Int8 => DataTypeId::Int8, - DataType::Int16 => DataTypeId::Int16, - DataType::Int32 => DataTypeId::Int32, - DataType::Int64 => DataTypeId::Int64, - DataType::Int128 => DataTypeId::Int128, - DataType::UInt8 => DataTypeId::UInt8, - DataType::UInt16 => DataTypeId::UInt16, - DataType::UInt32 => DataTypeId::UInt32, - DataType::UInt64 => DataTypeId::UInt64, - DataType::UInt128 => DataTypeId::UInt128, - DataType::Float16 => DataTypeId::Float16, - DataType::Float32 => DataTypeId::Float32, - DataType::Float64 => DataTypeId::Float64, - DataType::Decimal64(_) => DataTypeId::Decimal64, - DataType::Decimal128(_) => DataTypeId::Decimal128, - DataType::Timestamp(_) => DataTypeId::Timestamp, - DataType::Date32 => DataTypeId::Date32, - DataType::Date64 => DataTypeId::Date64, - DataType::Interval => DataTypeId::Interval, - DataType::Utf8 => DataTypeId::Utf8, - DataType::Binary => DataTypeId::Binary, - DataType::Struct(_) => DataTypeId::Struct, - DataType::List(_) => DataTypeId::List, + DataTypeOld::Null => DataTypeId::Null, + DataTypeOld::Boolean => DataTypeId::Boolean, + DataTypeOld::Int8 => DataTypeId::Int8, + DataTypeOld::Int16 => DataTypeId::Int16, + DataTypeOld::Int32 => DataTypeId::Int32, + DataTypeOld::Int64 => DataTypeId::Int64, + DataTypeOld::Int128 => DataTypeId::Int128, + DataTypeOld::UInt8 => DataTypeId::UInt8, + DataTypeOld::UInt16 => DataTypeId::UInt16, + DataTypeOld::UInt32 => DataTypeId::UInt32, + DataTypeOld::UInt64 => DataTypeId::UInt64, + DataTypeOld::UInt128 => DataTypeId::UInt128, + DataTypeOld::Float16 => DataTypeId::Float16, + DataTypeOld::Float32 => DataTypeId::Float32, + DataTypeOld::Float64 => DataTypeId::Float64, + DataTypeOld::Decimal64(_) => DataTypeId::Decimal64, + DataTypeOld::Decimal128(_) => DataTypeId::Decimal128, + DataTypeOld::Timestamp(_) => DataTypeId::Timestamp, + DataTypeOld::Date32 => DataTypeId::Date32, + DataTypeOld::Date64 => DataTypeId::Date64, + DataTypeOld::Interval => DataTypeId::Interval, + DataTypeOld::Utf8 => DataTypeId::Utf8, + DataTypeOld::Binary => DataTypeId::Binary, + DataTypeOld::Struct(_) => DataTypeId::Struct, + DataTypeOld::List(_) => DataTypeId::List, } } pub fn physical_type(&self) -> Result { Ok(match self { - DataType::Null => PhysicalType::UntypedNull, - DataType::Boolean => PhysicalType::Boolean, - DataType::Int8 => PhysicalType::Int8, - DataType::Int16 => PhysicalType::Int16, - DataType::Int32 => PhysicalType::Int32, - DataType::Int64 => PhysicalType::Int64, - DataType::Int128 => PhysicalType::Int128, - DataType::UInt8 => PhysicalType::UInt8, - DataType::UInt16 => PhysicalType::UInt16, - DataType::UInt32 => PhysicalType::UInt32, - DataType::UInt64 => PhysicalType::UInt64, - DataType::UInt128 => PhysicalType::UInt128, - DataType::Float16 => PhysicalType::Float16, - DataType::Float32 => PhysicalType::Float32, - DataType::Float64 => PhysicalType::Float64, - DataType::Decimal64(_) => PhysicalType::Int64, - DataType::Decimal128(_) => PhysicalType::Int128, - DataType::Timestamp(_) => PhysicalType::Int64, - DataType::Date32 => PhysicalType::Int32, - DataType::Date64 => PhysicalType::Int64, - DataType::Interval => PhysicalType::Interval, - DataType::Utf8 => PhysicalType::Utf8, - DataType::Binary => PhysicalType::Binary, - DataType::Struct(_) => not_implemented!("struct data type to physical type"), - DataType::List(_) => PhysicalType::List, + DataTypeOld::Null => PhysicalType::UntypedNull, + DataTypeOld::Boolean => PhysicalType::Boolean, + DataTypeOld::Int8 => PhysicalType::Int8, + DataTypeOld::Int16 => PhysicalType::Int16, + DataTypeOld::Int32 => PhysicalType::Int32, + DataTypeOld::Int64 => PhysicalType::Int64, + DataTypeOld::Int128 => PhysicalType::Int128, + DataTypeOld::UInt8 => PhysicalType::UInt8, + DataTypeOld::UInt16 => PhysicalType::UInt16, + DataTypeOld::UInt32 => PhysicalType::UInt32, + DataTypeOld::UInt64 => PhysicalType::UInt64, + DataTypeOld::UInt128 => PhysicalType::UInt128, + DataTypeOld::Float16 => PhysicalType::Float16, + DataTypeOld::Float32 => PhysicalType::Float32, + DataTypeOld::Float64 => PhysicalType::Float64, + DataTypeOld::Decimal64(_) => PhysicalType::Int64, + DataTypeOld::Decimal128(_) => PhysicalType::Int128, + DataTypeOld::Timestamp(_) => PhysicalType::Int64, + DataTypeOld::Date32 => PhysicalType::Int32, + DataTypeOld::Date64 => PhysicalType::Int64, + DataTypeOld::Interval => PhysicalType::Interval, + DataTypeOld::Utf8 => PhysicalType::Utf8, + DataTypeOld::Binary => PhysicalType::Binary, + DataTypeOld::Struct(_) => not_implemented!("struct data type to physical type"), + DataTypeOld::List(_) => PhysicalType::List, }) } /// Return if this datatype is null. pub const fn is_null(&self) -> bool { - matches!(self, DataType::Null) + matches!(self, DataTypeOld::Null) } /// Return if this datatype is a list. pub const fn is_list(&self) -> bool { - matches!(self, DataType::List(_)) + matches!(self, DataTypeOld::List(_)) } pub const fn is_utf8(&self) -> bool { - matches!(self, DataType::Utf8) + matches!(self, DataTypeOld::Utf8) } pub const fn is_primitive_numeric(&self) -> bool { matches!( self, - DataType::Int8 - | DataType::Int16 - | DataType::Int32 - | DataType::Int64 - | DataType::Int128 - | DataType::UInt8 - | DataType::UInt16 - | DataType::UInt32 - | DataType::UInt64 - | DataType::UInt128 - | DataType::Float16 - | DataType::Float32 - | DataType::Float64 + DataTypeOld::Int8 + | DataTypeOld::Int16 + | DataTypeOld::Int32 + | DataTypeOld::Int64 + | DataTypeOld::Int128 + | DataTypeOld::UInt8 + | DataTypeOld::UInt16 + | DataTypeOld::UInt32 + | DataTypeOld::UInt64 + | DataTypeOld::UInt128 + | DataTypeOld::Float16 + | DataTypeOld::Float32 + | DataTypeOld::Float64 ) } pub const fn is_numeric(&self) -> bool { matches!( self, - DataType::Int8 - | DataType::Int16 - | DataType::Int32 - | DataType::Int64 - | DataType::Int128 - | DataType::UInt8 - | DataType::UInt16 - | DataType::UInt32 - | DataType::UInt64 - | DataType::UInt128 - | DataType::Float32 - | DataType::Float64 - | DataType::Decimal64(_) - | DataType::Decimal128(_) + DataTypeOld::Int8 + | DataTypeOld::Int16 + | DataTypeOld::Int32 + | DataTypeOld::Int64 + | DataTypeOld::Int128 + | DataTypeOld::UInt8 + | DataTypeOld::UInt16 + | DataTypeOld::UInt32 + | DataTypeOld::UInt64 + | DataTypeOld::UInt128 + | DataTypeOld::Float32 + | DataTypeOld::Float64 + | DataTypeOld::Decimal64(_) + | DataTypeOld::Decimal128(_) ) } pub const fn is_float(&self) -> bool { matches!( self, - DataType::Float16 | DataType::Float32 | DataType::Float64 + DataTypeOld::Float16 | DataTypeOld::Float32 | DataTypeOld::Float64 ) } pub const fn is_decimal(&self) -> bool { - matches!(self, DataType::Decimal64(_) | DataType::Decimal128(_)) + matches!(self, DataTypeOld::Decimal64(_) | DataTypeOld::Decimal128(_)) } pub fn try_get_decimal_type_meta(&self) -> Result { @@ -550,7 +552,7 @@ impl DataType { } } -impl ProtoConv for DataType { +impl ProtoConv for DataTypeOld { type ProtoType = rayexec_proto::generated::schema::DataType; fn to_proto(&self) -> Result { @@ -558,31 +560,31 @@ impl ProtoConv for DataType { use rayexec_proto::generated::schema::EmptyMeta; let value = match self { - DataType::Null => Value::TypeNull(EmptyMeta {}), - DataType::Boolean => Value::TypeBoolean(EmptyMeta {}), - DataType::Int8 => Value::TypeInt8(EmptyMeta {}), - DataType::Int16 => Value::TypeInt16(EmptyMeta {}), - DataType::Int32 => Value::TypeInt32(EmptyMeta {}), - DataType::Int64 => Value::TypeInt64(EmptyMeta {}), - DataType::Int128 => Value::TypeInt128(EmptyMeta {}), - DataType::UInt8 => Value::TypeUint8(EmptyMeta {}), - DataType::UInt16 => Value::TypeUint16(EmptyMeta {}), - DataType::UInt32 => Value::TypeUint32(EmptyMeta {}), - DataType::UInt64 => Value::TypeUint64(EmptyMeta {}), - DataType::UInt128 => Value::TypeUint128(EmptyMeta {}), - DataType::Float16 => Value::TypeFloat16(EmptyMeta {}), - DataType::Float32 => Value::TypeFloat32(EmptyMeta {}), - DataType::Float64 => Value::TypeFloat64(EmptyMeta {}), - DataType::Decimal64(m) => Value::TypeDecimal64(m.to_proto()?), - DataType::Decimal128(m) => Value::TypeDecimal128(m.to_proto()?), - DataType::Timestamp(m) => Value::TypeTimestamp(m.to_proto()?), - DataType::Date32 => Value::TypeDate32(EmptyMeta {}), - DataType::Date64 => Value::TypeDate64(EmptyMeta {}), - DataType::Interval => Value::TypeInterval(EmptyMeta {}), - DataType::Utf8 => Value::TypeUtf8(EmptyMeta {}), - DataType::Binary => Value::TypeBinary(EmptyMeta {}), - DataType::Struct(m) => Value::TypeStruct(m.to_proto()?), - DataType::List(m) => Value::TypeList(Box::new(m.to_proto()?)), + DataTypeOld::Null => Value::TypeNull(EmptyMeta {}), + DataTypeOld::Boolean => Value::TypeBoolean(EmptyMeta {}), + DataTypeOld::Int8 => Value::TypeInt8(EmptyMeta {}), + DataTypeOld::Int16 => Value::TypeInt16(EmptyMeta {}), + DataTypeOld::Int32 => Value::TypeInt32(EmptyMeta {}), + DataTypeOld::Int64 => Value::TypeInt64(EmptyMeta {}), + DataTypeOld::Int128 => Value::TypeInt128(EmptyMeta {}), + DataTypeOld::UInt8 => Value::TypeUint8(EmptyMeta {}), + DataTypeOld::UInt16 => Value::TypeUint16(EmptyMeta {}), + DataTypeOld::UInt32 => Value::TypeUint32(EmptyMeta {}), + DataTypeOld::UInt64 => Value::TypeUint64(EmptyMeta {}), + DataTypeOld::UInt128 => Value::TypeUint128(EmptyMeta {}), + DataTypeOld::Float16 => Value::TypeFloat16(EmptyMeta {}), + DataTypeOld::Float32 => Value::TypeFloat32(EmptyMeta {}), + DataTypeOld::Float64 => Value::TypeFloat64(EmptyMeta {}), + DataTypeOld::Decimal64(m) => Value::TypeDecimal64(m.to_proto()?), + DataTypeOld::Decimal128(m) => Value::TypeDecimal128(m.to_proto()?), + DataTypeOld::Timestamp(m) => Value::TypeTimestamp(m.to_proto()?), + DataTypeOld::Date32 => Value::TypeDate32(EmptyMeta {}), + DataTypeOld::Date64 => Value::TypeDate64(EmptyMeta {}), + DataTypeOld::Interval => Value::TypeInterval(EmptyMeta {}), + DataTypeOld::Utf8 => Value::TypeUtf8(EmptyMeta {}), + DataTypeOld::Binary => Value::TypeBinary(EmptyMeta {}), + DataTypeOld::Struct(m) => Value::TypeStruct(m.to_proto()?), + DataTypeOld::List(m) => Value::TypeList(Box::new(m.to_proto()?)), }; Ok(Self::ProtoType { value: Some(value) }) } @@ -591,36 +593,36 @@ impl ProtoConv for DataType { use rayexec_proto::generated::schema::data_type::Value; Ok(match proto.value.required("value")? { - Value::TypeNull(_) => DataType::Null, - Value::TypeBoolean(_) => DataType::Boolean, - Value::TypeInt8(_) => DataType::Int8, - Value::TypeInt16(_) => DataType::Int16, - Value::TypeInt32(_) => DataType::Int32, - Value::TypeInt64(_) => DataType::Int64, - Value::TypeInt128(_) => DataType::Int128, - Value::TypeUint8(_) => DataType::UInt8, - Value::TypeUint16(_) => DataType::UInt16, - Value::TypeUint32(_) => DataType::UInt32, - Value::TypeUint64(_) => DataType::UInt64, - Value::TypeUint128(_) => DataType::UInt128, - Value::TypeFloat16(_) => DataType::Float16, - Value::TypeFloat32(_) => DataType::Float32, - Value::TypeFloat64(_) => DataType::Float64, - Value::TypeDecimal64(m) => DataType::Decimal64(DecimalTypeMeta::from_proto(m)?), - Value::TypeDecimal128(m) => DataType::Decimal128(DecimalTypeMeta::from_proto(m)?), - Value::TypeTimestamp(m) => DataType::Timestamp(TimestampTypeMeta::from_proto(m)?), - Value::TypeDate32(_) => DataType::Date32, - Value::TypeDate64(_) => DataType::Date64, - Value::TypeInterval(_) => DataType::Interval, - Value::TypeUtf8(_) => DataType::Utf8, - Value::TypeBinary(_) => DataType::Binary, - Value::TypeStruct(m) => DataType::Struct(StructTypeMeta::from_proto(m)?), - Value::TypeList(m) => DataType::List(ListTypeMeta::from_proto(*m)?), + Value::TypeNull(_) => DataTypeOld::Null, + Value::TypeBoolean(_) => DataTypeOld::Boolean, + Value::TypeInt8(_) => DataTypeOld::Int8, + Value::TypeInt16(_) => DataTypeOld::Int16, + Value::TypeInt32(_) => DataTypeOld::Int32, + Value::TypeInt64(_) => DataTypeOld::Int64, + Value::TypeInt128(_) => DataTypeOld::Int128, + Value::TypeUint8(_) => DataTypeOld::UInt8, + Value::TypeUint16(_) => DataTypeOld::UInt16, + Value::TypeUint32(_) => DataTypeOld::UInt32, + Value::TypeUint64(_) => DataTypeOld::UInt64, + Value::TypeUint128(_) => DataTypeOld::UInt128, + Value::TypeFloat16(_) => DataTypeOld::Float16, + Value::TypeFloat32(_) => DataTypeOld::Float32, + Value::TypeFloat64(_) => DataTypeOld::Float64, + Value::TypeDecimal64(m) => DataTypeOld::Decimal64(DecimalTypeMeta::from_proto(m)?), + Value::TypeDecimal128(m) => DataTypeOld::Decimal128(DecimalTypeMeta::from_proto(m)?), + Value::TypeTimestamp(m) => DataTypeOld::Timestamp(TimestampTypeMeta::from_proto(m)?), + Value::TypeDate32(_) => DataTypeOld::Date32, + Value::TypeDate64(_) => DataTypeOld::Date64, + Value::TypeInterval(_) => DataTypeOld::Interval, + Value::TypeUtf8(_) => DataTypeOld::Utf8, + Value::TypeBinary(_) => DataTypeOld::Binary, + Value::TypeStruct(m) => DataTypeOld::Struct(StructTypeMeta::from_proto(m)?), + Value::TypeList(m) => DataTypeOld::List(ListTypeMeta::from_proto(*m)?), }) } } -impl fmt::Display for DataType { +impl fmt::Display for DataTypeOld { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Null => write!(f, "Null"), @@ -657,7 +659,7 @@ impl fmt::Display for DataType { .join(", ") ) } - DataType::List(meta) => write!(f, "List[{}]", meta.datatype), + DataTypeOld::List(meta) => write!(f, "List[{}]", meta.datatype), } } } diff --git a/crates/rayexec_bullet/src/executor/builder.rs b/crates/rayexec_bullet/src/executor/builder.rs index 10f96e7ad..adf24caf7 100644 --- a/crates/rayexec_bullet/src/executor/builder.rs +++ b/crates/rayexec_bullet/src/executor/builder.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use super::physical_type::{AsBytes, VarlenType}; use crate::array::{ArrayData, BinaryData}; use crate::bitmap::Bitmap; -use crate::datatype::DataType; +use crate::datatype::DataTypeOld; use crate::storage::{ BooleanStorage, GermanLargeMetadata, @@ -18,7 +18,7 @@ use crate::storage::{ #[derive(Debug)] pub struct ArrayBuilder { - pub datatype: DataType, + pub datatype: DataTypeOld, pub buffer: B, } diff --git a/crates/rayexec_bullet/src/executor/scalar/binary.rs b/crates/rayexec_bullet/src/executor/scalar/binary.rs index e43968fbe..ef2e25b65 100644 --- a/crates/rayexec_bullet/src/executor/scalar/binary.rs +++ b/crates/rayexec_bullet/src/executor/scalar/binary.rs @@ -95,7 +95,7 @@ mod tests { use selection::SelectionVector; use super::*; - use crate::datatype::DataType; + use crate::datatype::DataTypeOld; use crate::executor::builder::{GermanVarlenBuffer, PrimitiveBuffer}; use crate::executor::physical_type::{PhysicalI32Old, PhysicalUtf8Old}; use crate::scalar::ScalarValue; @@ -106,7 +106,7 @@ mod tests { let right = ArrayOld::from_iter([4, 5, 6]); let builder = ArrayBuilder { - datatype: DataType::Int32, + datatype: DataTypeOld::Int32, buffer: PrimitiveBuffer::::with_len(3), }; @@ -129,7 +129,7 @@ mod tests { let right = ArrayOld::from_iter(["hello", "world", "goodbye!"]); let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(3), }; @@ -172,7 +172,7 @@ mod tests { &left, &right, ArrayBuilder { - datatype: DataType::Int32, + datatype: DataTypeOld::Int32, buffer: PrimitiveBuffer::with_len(3), }, |a, b, buf| buf.put(&(a + b)), diff --git a/crates/rayexec_bullet/src/executor/scalar/fill.rs b/crates/rayexec_bullet/src/executor/scalar/fill.rs index 11e1f1a82..ec19d8c9d 100644 --- a/crates/rayexec_bullet/src/executor/scalar/fill.rs +++ b/crates/rayexec_bullet/src/executor/scalar/fill.rs @@ -4,7 +4,7 @@ use rayexec_error::{RayexecError, Result}; use crate::array::{ArrayData, ArrayOld}; use crate::bitmap::Bitmap; -use crate::datatype::DataType; +use crate::datatype::DataTypeOld; use crate::executor::builder::{ ArrayBuilder, ArrayDataBuffer, @@ -285,7 +285,7 @@ pub(crate) fn concat_with_exact_total_len( } } -fn concat_lists(datatype: DataType, arrays: &[&ArrayOld], total_len: usize) -> Result { +fn concat_lists(datatype: DataTypeOld, arrays: &[&ArrayOld], total_len: usize) -> Result { let inner_arrays = arrays .iter() .map(|arr| match arr.array_data() { @@ -551,7 +551,7 @@ where #[cfg(test)] mod tests { use super::*; - use crate::datatype::DataType; + use crate::datatype::DataTypeOld; use crate::executor::builder::PrimitiveBuffer; use crate::executor::physical_type::PhysicalI32Old; use crate::scalar::ScalarValue; @@ -559,7 +559,7 @@ mod tests { #[test] fn fill_simple_linear() { let mut state = FillState::new(ArrayBuilder { - datatype: DataType::Int32, + datatype: DataTypeOld::Int32, buffer: PrimitiveBuffer::::with_len(3), }); @@ -582,7 +582,7 @@ mod tests { #[test] fn fill_repeated() { let mut state = FillState::new(ArrayBuilder { - datatype: DataType::Int32, + datatype: DataTypeOld::Int32, buffer: PrimitiveBuffer::::with_len(3), }); @@ -605,7 +605,7 @@ mod tests { #[test] fn fill_out_of_order() { let mut state = FillState::new(ArrayBuilder { - datatype: DataType::Int32, + datatype: DataTypeOld::Int32, buffer: PrimitiveBuffer::::with_len(3), }); @@ -628,7 +628,7 @@ mod tests { #[test] fn fill_from_different_arrays() { let mut state = FillState::new(ArrayBuilder { - datatype: DataType::Int32, + datatype: DataTypeOld::Int32, buffer: PrimitiveBuffer::::with_len(6), }); diff --git a/crates/rayexec_bullet/src/executor/scalar/unary.rs b/crates/rayexec_bullet/src/executor/scalar/unary.rs index 4ac7d8a50..2c54faf00 100644 --- a/crates/rayexec_bullet/src/executor/scalar/unary.rs +++ b/crates/rayexec_bullet/src/executor/scalar/unary.rs @@ -152,7 +152,7 @@ mod tests { use selection::SelectionVector; use super::*; - use crate::datatype::DataType; + use crate::datatype::DataTypeOld; use crate::executor::builder::{GermanVarlenBuffer, PrimitiveBuffer}; use crate::executor::physical_type::{PhysicalI32Old, PhysicalUtf8Old}; use crate::scalar::ScalarValue; @@ -161,7 +161,7 @@ mod tests { fn int32_inc_by_2() { let array = ArrayOld::from_iter([1, 2, 3]); let builder = ArrayBuilder { - datatype: DataType::Int32, + datatype: DataTypeOld::Int32, buffer: PrimitiveBuffer::::with_len(3), }; @@ -181,7 +181,7 @@ mod tests { let array = ArrayOld::from_iter(["a", "bb", "ccc", "dddd"]); let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(4), }; @@ -213,7 +213,7 @@ mod tests { let array = ArrayOld::from_iter(["a", "bb", "ccc", "dddd"]); let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(4), }; @@ -247,7 +247,7 @@ mod tests { let array = ArrayOld::from_iter(["a", "bb", "ccc", "dddd"]); let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(4), }; @@ -281,7 +281,7 @@ mod tests { array.select_mut(selection); let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(array.logical_len()), }; diff --git a/crates/rayexec_bullet/src/executor/scalar/uniform.rs b/crates/rayexec_bullet/src/executor/scalar/uniform.rs index a4a82ea9d..732a0e2d3 100644 --- a/crates/rayexec_bullet/src/executor/scalar/uniform.rs +++ b/crates/rayexec_bullet/src/executor/scalar/uniform.rs @@ -109,7 +109,7 @@ mod tests { use selection::SelectionVector; use super::*; - use crate::datatype::DataType; + use crate::datatype::DataTypeOld; use crate::executor::builder::GermanVarlenBuffer; use crate::executor::physical_type::PhysicalUtf8Old; use crate::scalar::ScalarValue; @@ -121,7 +121,7 @@ mod tests { let third = ArrayOld::from_iter(["dog", "cat", "horse"]); let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(3), }; @@ -156,7 +156,7 @@ mod tests { let third = ArrayOld::from_iter(["dog", "cat", "horse"]); let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(3), }; @@ -189,7 +189,7 @@ mod tests { let third = ArrayOld::from_iter(["dog", "cat", "horse"]); let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(3), }; diff --git a/crates/rayexec_bullet/src/field.rs b/crates/rayexec_bullet/src/field.rs index 42a296378..b847f2616 100644 --- a/crates/rayexec_bullet/src/field.rs +++ b/crates/rayexec_bullet/src/field.rs @@ -2,18 +2,18 @@ use rayexec_error::{OptionExt, Result}; use rayexec_proto::ProtoConv; use serde::{Deserialize, Serialize}; -use crate::datatype::DataType; +use crate::datatype::DataTypeOld; /// A named field. #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] pub struct Field { pub name: String, - pub datatype: DataType, + pub datatype: DataTypeOld, pub nullable: bool, } impl Field { - pub fn new(name: impl Into, datatype: DataType, nullable: bool) -> Self { + pub fn new(name: impl Into, datatype: DataTypeOld, nullable: bool) -> Self { Field { name: name.into(), datatype, @@ -36,7 +36,7 @@ impl ProtoConv for Field { fn from_proto(proto: Self::ProtoType) -> Result { Ok(Self { name: proto.name, - datatype: DataType::from_proto(proto.datatype.required("datatype")?)?, + datatype: DataTypeOld::from_proto(proto.datatype.required("datatype")?)?, nullable: proto.nullable, }) } @@ -120,7 +120,7 @@ impl ProtoConv for Schema { /// Represents the output types of a batch. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct TypeSchema { - pub types: Vec, + pub types: Vec, } impl TypeSchema { @@ -129,7 +129,7 @@ impl TypeSchema { TypeSchema { types: Vec::new() } } - pub fn new(types: impl IntoIterator) -> Self { + pub fn new(types: impl IntoIterator) -> Self { TypeSchema { types: types.into_iter().collect(), } @@ -158,7 +158,7 @@ impl ProtoConv for TypeSchema { let types = proto .types .into_iter() - .map(DataType::from_proto) + .map(DataTypeOld::from_proto) .collect::>>()?; Ok(Self { types }) } diff --git a/crates/rayexec_bullet/src/format/pretty/table.rs b/crates/rayexec_bullet/src/format/pretty/table.rs index 8530e3a9b..ea0328ad5 100644 --- a/crates/rayexec_bullet/src/format/pretty/table.rs +++ b/crates/rayexec_bullet/src/format/pretty/table.rs @@ -9,7 +9,7 @@ use textwrap::{fill_inplace, wrap}; use super::display::{table_width, Alignment, PrettyFooter, PrettyHeader, PrettyValues}; use crate::array::ArrayOld; use crate::batch::BatchOld; -use crate::datatype::DataType; +use crate::datatype::DataTypeOld; use crate::field::Schema; use crate::format::{FormatOptions, Formatter}; @@ -520,7 +520,7 @@ impl ColumnValues { /// Turn a column name and type into column values. pub fn try_from_column_name_and_type( name: &str, - typ: &DataType, + typ: &DataTypeOld, max_width: Option, ) -> Result { let mut buf = name.to_string(); @@ -816,8 +816,8 @@ mod tests { #[test] fn no_batches_with_columns() { let schema = Schema::new([ - Field::new("a", DataType::Int64, false), - Field::new("b", DataType::Utf8, false), + Field::new("a", DataTypeOld::Int64, false), + Field::new("b", DataTypeOld::Utf8, false), ]); let table = pretty_format_batches(&schema, &[], 80, None).unwrap(); @@ -837,8 +837,8 @@ mod tests { #[test] fn simple_single_batch() { let schema = Schema::new(vec![ - Field::new("a", DataType::Utf8, true), - Field::new("b", DataType::Int32, true), + Field::new("a", DataTypeOld::Utf8, true), + Field::new("b", DataTypeOld::Int32, true), ]); let batch = BatchOld::try_new(vec![ @@ -868,9 +868,9 @@ mod tests { #[test] fn multiline_values() { let schema = Schema::new(vec![ - Field::new("c1", DataType::Utf8, true), - Field::new("c2", DataType::Int32, true), - Field::new("c3", DataType::Utf8, true), + Field::new("c1", DataTypeOld::Utf8, true), + Field::new("c2", DataTypeOld::Int32, true), + Field::new("c3", DataTypeOld::Utf8, true), ]); let batch = BatchOld::try_new(vec![ @@ -902,8 +902,8 @@ mod tests { #[test] fn multiple_small_batches() { let schema = Schema::new([ - Field::new("a", DataType::Utf8, true), - Field::new("b", DataType::Int32, true), + Field::new("a", DataTypeOld::Utf8, true), + Field::new("b", DataTypeOld::Int32, true), ]); let batch = BatchOld::try_new(vec![ @@ -935,12 +935,16 @@ mod tests { #[test] fn multiple_small_batches_with_max_rows() { let schema = Schema::new(vec![ - Field::new("a", DataType::Utf8, true), - Field::new("b", DataType::Int32, true), + Field::new("a", DataTypeOld::Utf8, true), + Field::new("b", DataTypeOld::Int32, true), ]); let create_batch = |s, n| { - BatchOld::try_new([ArrayOld::from_iter([Some(s)]), ArrayOld::from_iter([Some(n)])]).unwrap() + BatchOld::try_new([ + ArrayOld::from_iter([Some(s)]), + ArrayOld::from_iter([Some(n)]), + ]) + .unwrap() }; let batches = vec![ @@ -976,8 +980,8 @@ mod tests { #[test] fn large_batch_with_max_rows() { let schema = Schema::new(vec![ - Field::new("a", DataType::Utf8, true), - Field::new("b", DataType::Int32, true), + Field::new("a", DataTypeOld::Utf8, true), + Field::new("b", DataTypeOld::Int32, true), ]); let a_vals: Vec<_> = (0..10).map(|v| v.to_string()).collect(); @@ -1013,8 +1017,8 @@ mod tests { #[test] fn large_batch_with_odd_max_rows() { let schema = Schema::new(vec![ - Field::new("a", DataType::Utf8, true), - Field::new("b", DataType::Int32, true), + Field::new("a", DataTypeOld::Utf8, true), + Field::new("b", DataTypeOld::Int32, true), ]); let a_vals: Vec<_> = (0..10).map(|v| Some(v.to_string())).collect(); @@ -1049,10 +1053,10 @@ mod tests { #[test] fn multiple_small_batches_with_max_width_and_long_value() { let schema = Schema::new(vec![ - Field::new("a", DataType::Utf8, true), - Field::new("b", DataType::Int32, true), - Field::new("c", DataType::Utf8, true), - Field::new("d", DataType::Utf8, true), + Field::new("a", DataTypeOld::Utf8, true), + Field::new("b", DataTypeOld::Int32, true), + Field::new("c", DataTypeOld::Utf8, true), + Field::new("d", DataTypeOld::Utf8, true), ]); let create_batch = |a, b, c, d| { @@ -1099,10 +1103,10 @@ mod tests { #[test] fn multiple_small_batches_with_max_width_and_long_value_first() { let schema = Schema::new(vec![ - Field::new("a", DataType::Utf8, true), - Field::new("b", DataType::Int32, true), - Field::new("c", DataType::Utf8, true), - Field::new("d", DataType::Utf8, true), + Field::new("a", DataTypeOld::Utf8, true), + Field::new("b", DataTypeOld::Int32, true), + Field::new("c", DataTypeOld::Utf8, true), + Field::new("d", DataTypeOld::Utf8, true), ]); let create_batch = |a, b, c, d| { @@ -1144,9 +1148,9 @@ mod tests { #[test] fn multiple_small_batches_with_max_width_and_long_column_name() { let schema = Schema::new(vec![ - Field::new("a", DataType::Utf8, true), - Field::new("thisisasomewhatlongcolumn", DataType::Int32, true), - Field::new("c", DataType::Utf8, true), + Field::new("a", DataTypeOld::Utf8, true), + Field::new("thisisasomewhatlongcolumn", DataTypeOld::Int32, true), + Field::new("c", DataTypeOld::Utf8, true), ]); let create_batch = |a, b, c| { @@ -1186,10 +1190,10 @@ mod tests { #[test] fn multiple_small_batches_with_max_width_and_long_column_name_even_num_cols() { let schema = Schema::new(vec![ - Field::new("a", DataType::Utf8, true), - Field::new("thisisasomewhatlongcolumn", DataType::Int32, true), - Field::new("c", DataType::Utf8, true), - Field::new("d", DataType::Utf8, true), + Field::new("a", DataTypeOld::Utf8, true), + Field::new("thisisasomewhatlongcolumn", DataTypeOld::Int32, true), + Field::new("c", DataTypeOld::Utf8, true), + Field::new("d", DataTypeOld::Utf8, true), ]); let create_batch = |a, b, c, d| { @@ -1233,7 +1237,7 @@ mod tests { // https://github.com/GlareDB/glaredb/issues/1790 let fields: Vec<_> = (0..30) - .map(|i| Field::new(i.to_string(), DataType::Int8, true)) + .map(|i| Field::new(i.to_string(), DataTypeOld::Int8, true)) .collect(); let schema = Schema::new(fields); @@ -1263,8 +1267,8 @@ mod tests { // - first record of first batch and last record of last batch should be printed let schema = Schema::new(vec![ - Field::new("a", DataType::Utf8, true), - Field::new("b", DataType::Int32, true), + Field::new("a", DataTypeOld::Utf8, true), + Field::new("b", DataTypeOld::Int32, true), ]); // First record should be printed. diff --git a/crates/rayexec_bullet/src/ipc/batch.rs b/crates/rayexec_bullet/src/ipc/batch.rs index 7031a7760..b08a31a4f 100644 --- a/crates/rayexec_bullet/src/ipc/batch.rs +++ b/crates/rayexec_bullet/src/ipc/batch.rs @@ -9,11 +9,11 @@ use super::compression::CompressionType; use super::gen::message::{FieldNode as IpcFieldNode, RecordBatch as IpcRecordBatch}; use super::gen::schema::Buffer as IpcBuffer; use super::IpcConfig; -use crate::array::{ArrayOld, ArrayData, BinaryData}; +use crate::array::{ArrayData, ArrayOld, BinaryData}; use crate::batch::BatchOld; use crate::bitmap::Bitmap; use crate::bitutil::byte_ceil; -use crate::datatype::DataType; +use crate::datatype::DataTypeOld; use crate::executor::physical_type::PhysicalType; use crate::field::Schema; use crate::ipc::gen::message::RecordBatchBuilder; @@ -87,7 +87,7 @@ impl<'a> BufferReader<'a> { } } -fn decode_array(buffers: &mut BufferReader, datatype: &DataType) -> Result { +fn decode_array(buffers: &mut BufferReader, datatype: &DataTypeOld) -> Result { let node = buffers.try_next_node()?; let len = node.length() as usize; // Validity buffer always exists for primitive+varlen arrays even if there's @@ -329,12 +329,15 @@ mod tests { #[test] fn simple_batch_roundtrip() { - let batch = - BatchOld::try_new([ArrayOld::from_iter([3, 2, 1]), ArrayOld::from_iter([9, 8, 7])]).unwrap(); + let batch = BatchOld::try_new([ + ArrayOld::from_iter([3, 2, 1]), + ArrayOld::from_iter([9, 8, 7]), + ]) + .unwrap(); let schema = Schema::new([ - Field::new("f1", DataType::Int32, true), - Field::new("f2", DataType::Int32, true), + Field::new("f1", DataTypeOld::Int32, true), + Field::new("f2", DataTypeOld::Int32, true), ]); roundtrip(schema, batch); @@ -344,14 +347,14 @@ mod tests { fn utf8_roundtrip() { let batch = BatchOld::try_new([ArrayOld::from_iter(["mario", "peach", "yoshi"])]).unwrap(); - let schema = Schema::new([Field::new("f1", DataType::Utf8, true)]); + let schema = Schema::new([Field::new("f1", DataTypeOld::Utf8, true)]); roundtrip(schema, batch); } #[test] fn decimal128_roundtrip() { - let datatype = DataType::Decimal128(DecimalTypeMeta::new(4, 2)); + let datatype = DataTypeOld::Decimal128(DecimalTypeMeta::new(4, 2)); let arr = ArrayOld::new_with_array_data( datatype.clone(), PrimitiveStorage::from(vec![1000_i128, 1200, 1250]), diff --git a/crates/rayexec_bullet/src/ipc/schema.rs b/crates/rayexec_bullet/src/ipc/schema.rs index af24a5fda..5df7184ad 100644 --- a/crates/rayexec_bullet/src/ipc/schema.rs +++ b/crates/rayexec_bullet/src/ipc/schema.rs @@ -9,7 +9,7 @@ use super::gen::schema::{ Type as IpcType, }; use super::IpcConfig; -use crate::datatype::{DataType, DecimalTypeMeta}; +use crate::datatype::{DataTypeOld, DecimalTypeMeta}; use crate::field::{Field, Schema}; use crate::ipc::gen::schema::{ BoolBuilder, @@ -45,26 +45,26 @@ pub fn ipc_to_field(field: IpcField, _conf: &IpcConfig) -> Result { } let datatype = match field.type_type() { - IpcType::Null => DataType::Null, - IpcType::Bool => DataType::Boolean, + IpcType::Null => DataTypeOld::Null, + IpcType::Bool => DataTypeOld::Boolean, IpcType::Int => { let int_type = field.type__as_int().unwrap(); if int_type.is_signed() { match int_type.bitWidth() { - 8 => DataType::Int8, - 16 => DataType::Int16, - 32 => DataType::Int32, - 64 => DataType::Int64, + 8 => DataTypeOld::Int8, + 16 => DataTypeOld::Int16, + 32 => DataTypeOld::Int32, + 64 => DataTypeOld::Int64, other => { return Err(RayexecError::new(format!("Unsupported int size: {other}"))) } } } else { match int_type.bitWidth() { - 8 => DataType::UInt8, - 16 => DataType::UInt16, - 32 => DataType::UInt32, - 64 => DataType::UInt64, + 8 => DataTypeOld::UInt8, + 16 => DataTypeOld::UInt16, + 32 => DataTypeOld::UInt32, + 64 => DataTypeOld::UInt64, other => { return Err(RayexecError::new(format!("Unsupported int size: {other}"))) } @@ -79,8 +79,8 @@ pub fn ipc_to_field(field: IpcField, _conf: &IpcConfig) -> Result { }; match dec_type.bitWidth() { - 64 => DataType::Decimal64(meta), - 128 => DataType::Decimal128(meta), + 64 => DataTypeOld::Decimal64(meta), + 128 => DataTypeOld::Decimal128(meta), other => { return Err(RayexecError::new(format!( "Unsupported decimal size: {other}" @@ -91,8 +91,8 @@ pub fn ipc_to_field(field: IpcField, _conf: &IpcConfig) -> Result { IpcType::FloatingPoint => { let float_type = field.type__as_floating_point().unwrap(); match float_type.precision() { - IpcPrecision::SINGLE => DataType::Float32, - IpcPrecision::DOUBLE => DataType::Float64, + IpcPrecision::SINGLE => DataTypeOld::Float32, + IpcPrecision::DOUBLE => DataTypeOld::Float64, other => { return Err(RayexecError::new(format!( "Unsupported float precision: {:?}", @@ -101,8 +101,8 @@ pub fn ipc_to_field(field: IpcField, _conf: &IpcConfig) -> Result { } } } - IpcType::Utf8 | IpcType::LargeUtf8 => DataType::Utf8, - IpcType::Binary | IpcType::LargeBinary => DataType::Binary, + IpcType::Utf8 | IpcType::LargeUtf8 => DataTypeOld::Utf8, + IpcType::Binary | IpcType::LargeBinary => DataTypeOld::Binary, other => { return Err(RayexecError::new(format!( "Unsupported ipc type: {:?}", @@ -145,24 +145,24 @@ pub fn field_to_ipc<'a>( let empty_children: Vec> = Vec::new(); let (datatype, type_, children) = match &field.datatype { - DataType::Null => ( + DataTypeOld::Null => ( IpcType::Null, NullBuilder::new(builder).finish().as_union_value(), empty_children.clone(), ), - DataType::Boolean => ( + DataTypeOld::Boolean => ( IpcType::Bool, BoolBuilder::new(builder).finish().as_union_value(), empty_children.clone(), ), - DataType::Int8 | DataType::Int16 | DataType::Int32 | DataType::Int64 => { + DataTypeOld::Int8 | DataTypeOld::Int16 | DataTypeOld::Int32 | DataTypeOld::Int64 => { let mut int_builder = IntBuilder::new(builder); int_builder.add_is_signed(true); match &field.datatype { - DataType::Int8 => int_builder.add_bitWidth(8), - DataType::Int16 => int_builder.add_bitWidth(16), - DataType::Int32 => int_builder.add_bitWidth(32), - DataType::Int64 => int_builder.add_bitWidth(64), + DataTypeOld::Int8 => int_builder.add_bitWidth(8), + DataTypeOld::Int16 => int_builder.add_bitWidth(16), + DataTypeOld::Int32 => int_builder.add_bitWidth(32), + DataTypeOld::Int64 => int_builder.add_bitWidth(64), _ => unreachable!(), } ( @@ -171,14 +171,14 @@ pub fn field_to_ipc<'a>( empty_children.clone(), ) } - DataType::UInt8 | DataType::UInt16 | DataType::UInt32 | DataType::UInt64 => { + DataTypeOld::UInt8 | DataTypeOld::UInt16 | DataTypeOld::UInt32 | DataTypeOld::UInt64 => { let mut int_builder = IntBuilder::new(builder); int_builder.add_is_signed(false); match &field.datatype { - DataType::UInt8 => int_builder.add_bitWidth(8), - DataType::UInt16 => int_builder.add_bitWidth(16), - DataType::UInt32 => int_builder.add_bitWidth(32), - DataType::UInt64 => int_builder.add_bitWidth(64), + DataTypeOld::UInt8 => int_builder.add_bitWidth(8), + DataTypeOld::UInt16 => int_builder.add_bitWidth(16), + DataTypeOld::UInt32 => int_builder.add_bitWidth(32), + DataTypeOld::UInt64 => int_builder.add_bitWidth(64), _ => unreachable!(), } ( @@ -187,13 +187,13 @@ pub fn field_to_ipc<'a>( empty_children.clone(), ) } - DataType::Decimal64(m) | DataType::Decimal128(m) => { + DataTypeOld::Decimal64(m) | DataTypeOld::Decimal128(m) => { let mut dec_builder = DecimalBuilder::new(builder); dec_builder.add_scale(m.scale as i32); dec_builder.add_precision(m.precision as i32); match &field.datatype { - DataType::Decimal64(_) => dec_builder.add_bitWidth(64), - DataType::Decimal128(_) => dec_builder.add_bitWidth(128), + DataTypeOld::Decimal64(_) => dec_builder.add_bitWidth(64), + DataTypeOld::Decimal128(_) => dec_builder.add_bitWidth(128), _ => unreachable!(), } ( @@ -202,7 +202,7 @@ pub fn field_to_ipc<'a>( empty_children.clone(), ) } - DataType::Utf8 => ( + DataTypeOld::Utf8 => ( IpcType::Utf8, Utf8Builder::new(builder).finish().as_union_value(), empty_children.clone(), @@ -245,8 +245,8 @@ mod tests { #[test] fn simple_schema_roundtrip() { let schema = Schema::new([ - Field::new("f1", DataType::Int32, true), - Field::new("f2", DataType::Utf8, true), + Field::new("f1", DataTypeOld::Int32, true), + Field::new("f2", DataTypeOld::Utf8, true), ]); roundtrip(schema); @@ -256,7 +256,7 @@ mod tests { fn decimal_roundtrip() { let schema = Schema::new([Field::new( "f1", - DataType::Decimal64(DecimalTypeMeta { + DataTypeOld::Decimal64(DecimalTypeMeta { precision: 4, scale: 2, }), diff --git a/crates/rayexec_bullet/src/ipc/stream.rs b/crates/rayexec_bullet/src/ipc/stream.rs index 785daf3cd..aee0b42ad 100644 --- a/crates/rayexec_bullet/src/ipc/stream.rs +++ b/crates/rayexec_bullet/src/ipc/stream.rs @@ -232,7 +232,7 @@ mod tests { use super::*; use crate::batch::BatchOld; - use crate::datatype::DataType; + use crate::datatype::DataTypeOld; use crate::field::{Field, Schema}; struct SharedVecWriter { @@ -279,7 +279,7 @@ mod tests { fn read_no_batches() { let (reader, writer) = test_reader_writer(); - let schema = Schema::new([Field::new("c1", DataType::UInt32, true)]); + let schema = Schema::new([Field::new("c1", DataTypeOld::UInt32, true)]); let _ = StreamWriter::try_new(writer, &schema, IpcConfig::default()).unwrap(); let mut s_reader = StreamReader::try_new(reader, IpcConfig::default()).unwrap(); @@ -293,8 +293,8 @@ mod tests { let (reader, writer) = test_reader_writer(); let schema = Schema::new([ - Field::new("c1", DataType::UInt32, true), - Field::new("c2", DataType::Int64, true), + Field::new("c1", DataTypeOld::UInt32, true), + Field::new("c2", DataTypeOld::Int64, true), ]); let mut s_writer = StreamWriter::try_new(writer, &schema, IpcConfig::default()).unwrap(); @@ -316,7 +316,7 @@ mod tests { fn roundtrip_multiple() { let (reader, writer) = test_reader_writer(); - let schema = Schema::new([Field::new("c1", DataType::UInt32, true)]); + let schema = Schema::new([Field::new("c1", DataTypeOld::UInt32, true)]); let mut s_writer = StreamWriter::try_new(writer, &schema, IpcConfig::default()).unwrap(); let mut s_reader = StreamReader::try_new(reader, IpcConfig::default()).unwrap(); diff --git a/crates/rayexec_bullet/src/scalar/mod.rs b/crates/rayexec_bullet/src/scalar/mod.rs index 796dd05df..009166733 100644 --- a/crates/rayexec_bullet/src/scalar/mod.rs +++ b/crates/rayexec_bullet/src/scalar/mod.rs @@ -14,7 +14,7 @@ use rayexec_proto::ProtoConv; use serde::{Deserialize, Serialize}; use timestamp::TimestampScalar; -use crate::array::{ArrayOld, ArrayData}; +use crate::array::{ArrayData, ArrayOld}; use crate::bitmap::Bitmap; use crate::compute::cast::format::{ BoolFormatter, @@ -42,7 +42,7 @@ use crate::compute::cast::format::{ UInt64Formatter, UInt8Formatter, }; -use crate::datatype::{DataType, DecimalTypeMeta, ListTypeMeta, TimeUnit, TimestampTypeMeta}; +use crate::datatype::{DataTypeOld, DecimalTypeMeta, ListTypeMeta, TimeUnit, TimestampTypeMeta}; use crate::executor::scalar::concat; use crate::selection::SelectionVector; use crate::storage::{ @@ -122,42 +122,42 @@ impl Hash for ScalarValue<'_> { pub type OwnedScalarValue = ScalarValue<'static>; impl ScalarValue<'_> { - pub fn datatype(&self) -> DataType { + pub fn datatype(&self) -> DataTypeOld { match self { - ScalarValue::Null => DataType::Null, - ScalarValue::Boolean(_) => DataType::Boolean, - ScalarValue::Float16(_) => DataType::Float16, - ScalarValue::Float32(_) => DataType::Float32, - ScalarValue::Float64(_) => DataType::Float64, - ScalarValue::Int8(_) => DataType::Int8, - ScalarValue::Int16(_) => DataType::Int16, - ScalarValue::Int32(_) => DataType::Int32, - ScalarValue::Int64(_) => DataType::Int64, - ScalarValue::Int128(_) => DataType::Int128, - ScalarValue::UInt8(_) => DataType::UInt8, - ScalarValue::UInt16(_) => DataType::UInt16, - ScalarValue::UInt32(_) => DataType::UInt32, - ScalarValue::UInt64(_) => DataType::UInt64, - ScalarValue::UInt128(_) => DataType::UInt128, + ScalarValue::Null => DataTypeOld::Null, + ScalarValue::Boolean(_) => DataTypeOld::Boolean, + ScalarValue::Float16(_) => DataTypeOld::Float16, + ScalarValue::Float32(_) => DataTypeOld::Float32, + ScalarValue::Float64(_) => DataTypeOld::Float64, + ScalarValue::Int8(_) => DataTypeOld::Int8, + ScalarValue::Int16(_) => DataTypeOld::Int16, + ScalarValue::Int32(_) => DataTypeOld::Int32, + ScalarValue::Int64(_) => DataTypeOld::Int64, + ScalarValue::Int128(_) => DataTypeOld::Int128, + ScalarValue::UInt8(_) => DataTypeOld::UInt8, + ScalarValue::UInt16(_) => DataTypeOld::UInt16, + ScalarValue::UInt32(_) => DataTypeOld::UInt32, + ScalarValue::UInt64(_) => DataTypeOld::UInt64, + ScalarValue::UInt128(_) => DataTypeOld::UInt128, ScalarValue::Decimal64(v) => { - DataType::Decimal64(DecimalTypeMeta::new(v.precision, v.scale)) + DataTypeOld::Decimal64(DecimalTypeMeta::new(v.precision, v.scale)) } ScalarValue::Decimal128(v) => { - DataType::Decimal128(DecimalTypeMeta::new(v.precision, v.scale)) + DataTypeOld::Decimal128(DecimalTypeMeta::new(v.precision, v.scale)) } - ScalarValue::Date32(_) => DataType::Date32, - ScalarValue::Date64(_) => DataType::Date64, - ScalarValue::Timestamp(v) => DataType::Timestamp(TimestampTypeMeta::new(v.unit)), - ScalarValue::Interval(_) => DataType::Interval, - ScalarValue::Utf8(_) => DataType::Utf8, - ScalarValue::Binary(_) => DataType::Binary, + ScalarValue::Date32(_) => DataTypeOld::Date32, + ScalarValue::Date64(_) => DataTypeOld::Date64, + ScalarValue::Timestamp(v) => DataTypeOld::Timestamp(TimestampTypeMeta::new(v.unit)), + ScalarValue::Interval(_) => DataTypeOld::Interval, + ScalarValue::Utf8(_) => DataTypeOld::Utf8, + ScalarValue::Binary(_) => DataTypeOld::Binary, ScalarValue::Struct(_fields) => unimplemented!(), // TODO: Fill out the meta ScalarValue::List(list) => match list.first() { - Some(first) => DataType::List(ListTypeMeta { + Some(first) => DataTypeOld::List(ListTypeMeta { datatype: Box::new(first.datatype()), }), - None => DataType::List(ListTypeMeta { - datatype: Box::new(DataType::Null), + None => DataTypeOld::List(ListTypeMeta { + datatype: Box::new(DataTypeOld::Null), }), }, } diff --git a/crates/rayexec_csv/src/reader.rs b/crates/rayexec_csv/src/reader.rs index 18a0e58e2..44f317abc 100644 --- a/crates/rayexec_csv/src/reader.rs +++ b/crates/rayexec_csv/src/reader.rs @@ -26,7 +26,7 @@ use rayexec_bullet::array::{ArrayData, ArrayOld}; use rayexec_bullet::batch::BatchOld; use rayexec_bullet::bitmap::Bitmap; use rayexec_bullet::compute::cast::parse::{BoolParser, Float64Parser, Int64Parser, Parser}; -use rayexec_bullet::datatype::{DataType, TimeUnit, TimestampTypeMeta}; +use rayexec_bullet::datatype::{DataTypeOld, TimeUnit, TimestampTypeMeta}; use rayexec_bullet::executor::builder::{ArrayDataBuffer, GermanVarlenBuffer}; use rayexec_bullet::field::{Field, Schema}; use rayexec_bullet::storage::{BooleanStorage, PrimitiveStorage}; @@ -170,13 +170,15 @@ enum CandidateType { } impl CandidateType { - const fn as_datatype(&self) -> DataType { + const fn as_datatype(&self) -> DataTypeOld { match self { - Self::Boolean => DataType::Boolean, - Self::Int64 => DataType::Int64, - Self::Float64 => DataType::Float64, - Self::Timestamp => DataType::Timestamp(TimestampTypeMeta::new(TimeUnit::Microsecond)), - Self::Utf8 => DataType::Utf8, + Self::Boolean => DataTypeOld::Boolean, + Self::Int64 => DataTypeOld::Int64, + Self::Float64 => DataTypeOld::Float64, + Self::Timestamp => { + DataTypeOld::Timestamp(TimestampTypeMeta::new(TimeUnit::Microsecond)) + } + Self::Utf8 => DataTypeOld::Utf8, } } @@ -232,7 +234,7 @@ pub struct CsvSchema { impl CsvSchema { /// Create a new schema using gnerated names. - pub fn new_with_generated_names(types: Vec) -> Self { + pub fn new_with_generated_names(types: Vec) -> Self { let schema = Schema::new(types.into_iter().enumerate().map(|(idx, typ)| Field { name: format!("column{idx}"), datatype: typ, @@ -456,22 +458,22 @@ impl AsyncCsvStream { let mut arrs = Vec::with_capacity(schema.fields.len()); for (idx, field) in schema.fields.iter().enumerate() { let arr = match &field.datatype { - DataType::Boolean => Self::build_boolean(&completed, idx, skip_records)?, - DataType::Int64 => Self::build_primitive( + DataTypeOld::Boolean => Self::build_boolean(&completed, idx, skip_records)?, + DataTypeOld::Int64 => Self::build_primitive( &field.datatype, &completed, idx, skip_records, Int64Parser::new(), )?, - DataType::Float64 => Self::build_primitive( + DataTypeOld::Float64 => Self::build_primitive( &field.datatype, &completed, idx, skip_records, Float64Parser::new(), )?, - DataType::Utf8 => Self::build_utf8(&completed, idx, skip_records)?, + DataTypeOld::Utf8 => Self::build_utf8(&completed, idx, skip_records)?, other => return Err(RayexecError::new(format!("Unhandled data type: {other}"))), }; @@ -503,14 +505,14 @@ impl AsyncCsvStream { } Ok(ArrayOld::new_with_validity_and_array_data( - DataType::Boolean, + DataTypeOld::Boolean, validity, BooleanStorage::from(values), )) } fn build_primitive( - datatype: &DataType, + datatype: &DataTypeOld, completed: &CompletedRecords, field_idx: usize, skip_records: usize, @@ -565,7 +567,7 @@ impl AsyncCsvStream { } Ok(ArrayOld::new_with_validity_and_array_data( - DataType::Utf8, + DataTypeOld::Utf8, validity, values.into_data(), )) diff --git a/crates/rayexec_delta/src/protocol/table.rs b/crates/rayexec_delta/src/protocol/table.rs index 80ba4ee2c..6aca283fd 100644 --- a/crates/rayexec_delta/src/protocol/table.rs +++ b/crates/rayexec_delta/src/protocol/table.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use futures::{StreamExt, TryStreamExt}; use rayexec_bullet::batch::BatchOld; -use rayexec_bullet::datatype::{DataType, DecimalTypeMeta, TimeUnit, TimestampTypeMeta}; +use rayexec_bullet::datatype::{DataTypeOld, DecimalTypeMeta, TimeUnit, TimestampTypeMeta}; use rayexec_bullet::field::{Field, Schema}; use rayexec_bullet::scalar::decimal::{Decimal128Type, DecimalType}; use rayexec_error::{not_implemented, RayexecError, Result, ResultExt}; @@ -258,22 +258,22 @@ pub fn schema_from_struct_type(typ: StructType) -> Result { fn struct_field_to_field(field: StructField) -> Result { let datatype = match field.typ { SchemaType::Primitive(prim) => match prim { - PrimitiveType::String => DataType::Utf8, - PrimitiveType::Long => DataType::Int64, - PrimitiveType::Integer => DataType::Int32, - PrimitiveType::Short => DataType::Int16, - PrimitiveType::Byte => DataType::Int8, - PrimitiveType::Float => DataType::Float32, - PrimitiveType::Double => DataType::Float64, - PrimitiveType::Decimal => DataType::Decimal128(DecimalTypeMeta::new( + PrimitiveType::String => DataTypeOld::Utf8, + PrimitiveType::Long => DataTypeOld::Int64, + PrimitiveType::Integer => DataTypeOld::Int32, + PrimitiveType::Short => DataTypeOld::Int16, + PrimitiveType::Byte => DataTypeOld::Int8, + PrimitiveType::Float => DataTypeOld::Float32, + PrimitiveType::Double => DataTypeOld::Float64, + PrimitiveType::Decimal => DataTypeOld::Decimal128(DecimalTypeMeta::new( Decimal128Type::MAX_PRECISION, Decimal128Type::DEFAULT_SCALE, )), - PrimitiveType::Boolean => DataType::Boolean, - PrimitiveType::Binary => DataType::Binary, - PrimitiveType::Date => DataType::Timestamp(TimestampTypeMeta::new(TimeUnit::Second)), // TODO: This is just year/month/day + PrimitiveType::Boolean => DataTypeOld::Boolean, + PrimitiveType::Binary => DataTypeOld::Binary, + PrimitiveType::Date => DataTypeOld::Timestamp(TimestampTypeMeta::new(TimeUnit::Second)), // TODO: This is just year/month/day PrimitiveType::Timestamp => { - DataType::Timestamp(TimestampTypeMeta::new(TimeUnit::Microsecond)) + DataTypeOld::Timestamp(TimestampTypeMeta::new(TimeUnit::Microsecond)) } }, SchemaType::Struct(_) => not_implemented!("delta struct"), diff --git a/crates/rayexec_execution/src/arrays/batch.rs b/crates/rayexec_execution/src/arrays/batch.rs index 89f7f9342..d07293027 100644 --- a/crates/rayexec_execution/src/arrays/batch.rs +++ b/crates/rayexec_execution/src/arrays/batch.rs @@ -7,6 +7,7 @@ use super::buffer::string_view::StringViewHeap; use super::buffer::ArrayBuffer; use super::buffer_manager::{BufferManager, NopBufferManager}; use super::datatype::DataType; +use super::flat_array::FlatSelection; /// Collection of arrays with equal capacity. #[derive(Debug)] @@ -130,6 +131,11 @@ where self.num_rows } + /// Generate a selection that will select all rows in order for this batch. + pub fn generate_selection(&self) -> FlatSelection { + FlatSelection::linear(self.num_rows) + } + pub fn arrays(&self) -> &[Array] { &self.arrays } diff --git a/crates/rayexec_execution/src/arrays/flat_array.rs b/crates/rayexec_execution/src/arrays/flat_array.rs index 9ea7da86e..ac9365097 100644 --- a/crates/rayexec_execution/src/arrays/flat_array.rs +++ b/crates/rayexec_execution/src/arrays/flat_array.rs @@ -108,6 +108,15 @@ impl<'a> FlatSelection<'a> { } } +impl<'a> IntoIterator for FlatSelection<'a> { + type Item = usize; + type IntoIter = FlatSelectionIter<'a>; + + fn into_iter(self) -> Self::IntoIter { + FlatSelectionIter { idx: 0, sel: self } + } +} + #[derive(Debug)] pub struct FlatSelectionIter<'a> { idx: usize, diff --git a/crates/rayexec_execution/src/execution/operators/hash_aggregate/hash_table.rs b/crates/rayexec_execution/src/execution/operators/hash_aggregate/hash_table.rs index bde248f64..bdc070b29 100644 --- a/crates/rayexec_execution/src/execution/operators/hash_aggregate/hash_table.rs +++ b/crates/rayexec_execution/src/execution/operators/hash_aggregate/hash_table.rs @@ -86,7 +86,12 @@ impl HashTable { self.entries.len() } - pub fn insert(&mut self, groups: &[ArrayOld], hashes: &[u64], inputs: &[ArrayOld]) -> Result<()> { + pub fn insert( + &mut self, + groups: &[ArrayOld], + hashes: &[u64], + inputs: &[ArrayOld], + ) -> Result<()> { // Find and create groups as needed. self.find_or_create_groups(groups, hashes)?; @@ -480,7 +485,7 @@ const fn is_power_of_2(v: usize) -> bool { #[cfg(test)] mod tests { use rayexec_bullet::bitmap::Bitmap; - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use super::*; use crate::expr; @@ -503,7 +508,7 @@ mod tests { /// Plans a SUM aggregate, and assumes the input can be casted to an Int64. fn make_planned_aggregate(cols: I, input_idx: usize) -> PlannedAggregateFunction where - I: IntoIterator, + I: IntoIterator, { let (names, types): (Vec<_>, Vec<_>) = cols .into_iter() @@ -513,7 +518,7 @@ mod tests { let mut table_list = TableList::empty(); let table_ref = table_list.push_table(None, types, names).unwrap(); - let input = expr::cast(expr::col_ref(table_ref, input_idx), DataType::Int64); + let input = expr::cast(expr::col_ref(table_ref, input_idx), DataTypeOld::Int64); Sum.plan(&table_list, vec![input]).unwrap() } @@ -525,7 +530,7 @@ mod tests { let hashes = [4, 5, 4]; // Hashes for group values. - let agg = make_planned_aggregate([("g", DataType::Utf8), ("i", DataType::Int32)], 1); + let agg = make_planned_aggregate([("g", DataTypeOld::Utf8), ("i", DataTypeOld::Int32)], 1); let mut table = make_hash_table(agg); table.insert(&groups, &hashes, &inputs).unwrap(); @@ -544,7 +549,7 @@ mod tests { let inputs2 = [ArrayOld::from_iter::<[i64; 3]>([1, 2, 3])]; let hashes2 = [4, 5, 6]; - let agg = make_planned_aggregate([("g", DataType::Utf8), ("i", DataType::Int32)], 1); + let agg = make_planned_aggregate([("g", DataTypeOld::Utf8), ("i", DataTypeOld::Int32)], 1); let mut table = make_hash_table(agg); table.insert(&groups1, &hashes1, &inputs1).unwrap(); table.insert(&groups2, &hashes2, &inputs2).unwrap(); @@ -560,7 +565,7 @@ mod tests { let hashes = [4, 4, 4]; - let agg = make_planned_aggregate([("g", DataType::Utf8), ("i", DataType::Int32)], 1); + let agg = make_planned_aggregate([("g", DataTypeOld::Utf8), ("i", DataTypeOld::Int32)], 1); let mut table = make_hash_table(agg); table.insert(&groups, &hashes, &inputs).unwrap(); @@ -576,7 +581,7 @@ mod tests { let hashes = vec![44; 17]; // All hashes collide. - let agg = make_planned_aggregate([("g", DataType::Int32), ("i", DataType::Int32)], 1); + let agg = make_planned_aggregate([("g", DataTypeOld::Int32), ("i", DataTypeOld::Int32)], 1); let mut table = make_hash_table(agg); table.insert(&groups, &hashes, &inputs).unwrap(); @@ -593,7 +598,7 @@ mod tests { let hashes = vec![44; 33]; // All hashes collide. - let agg = make_planned_aggregate([("g", DataType::Int32), ("i", DataType::Int32)], 1); + let agg = make_planned_aggregate([("g", DataTypeOld::Int32), ("i", DataTypeOld::Int32)], 1); let mut table = make_hash_table(agg); table.insert(&groups, &hashes, &inputs).unwrap(); @@ -605,7 +610,7 @@ mod tests { let groups1 = [ArrayOld::from_iter(["g1", "g2", "g1"])]; let inputs1 = [ArrayOld::from_iter::<[i64; 3]>([1, 2, 3])]; - let agg = make_planned_aggregate([("g", DataType::Utf8), ("i", DataType::Int32)], 1); + let agg = make_planned_aggregate([("g", DataTypeOld::Utf8), ("i", DataTypeOld::Int32)], 1); let hashes = vec![4, 5, 4]; let mut t1 = make_hash_table(agg.clone()); @@ -631,7 +636,7 @@ mod tests { let groups1 = [ArrayOld::from_iter(["g1", "g2", "g1"])]; let inputs1 = [ArrayOld::from_iter::<[i64; 3]>([1, 2, 3])]; - let agg = make_planned_aggregate([("g", DataType::Utf8), ("i", DataType::Int32)], 1); + let agg = make_planned_aggregate([("g", DataTypeOld::Utf8), ("i", DataTypeOld::Int32)], 1); let hashes = vec![4, 5, 4]; // First hash table, we're merging everything into this one. diff --git a/crates/rayexec_execution/src/execution/operators/hash_aggregate/mod.rs b/crates/rayexec_execution/src/execution/operators/hash_aggregate/mod.rs index b8777ba06..0f4b04e4e 100644 --- a/crates/rayexec_execution/src/execution/operators/hash_aggregate/mod.rs +++ b/crates/rayexec_execution/src/execution/operators/hash_aggregate/mod.rs @@ -16,7 +16,7 @@ use parking_lot::Mutex; use rayexec_bullet::array::ArrayOld; use rayexec_bullet::batch::BatchOld; use rayexec_bullet::bitmap::Bitmap; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalU64Old; use rayexec_bullet::executor::scalar::{HashExecutor, UnaryExecutor}; @@ -436,7 +436,7 @@ impl ExecutableOperator for PhysicalHashAggregate { // on the output. for grouping_function in &self.grouping_functions { let builder = ArrayBuilder { - datatype: DataType::UInt64, + datatype: DataTypeOld::UInt64, buffer: PrimitiveBuffer::with_len(group_ids.logical_len()), }; diff --git a/crates/rayexec_execution/src/execution/operators/hash_join/condition.rs b/crates/rayexec_execution/src/execution/operators/hash_join/condition.rs index 5606bde34..2c8caa699 100644 --- a/crates/rayexec_execution/src/execution/operators/hash_join/condition.rs +++ b/crates/rayexec_execution/src/execution/operators/hash_join/condition.rs @@ -127,14 +127,14 @@ impl LeftPrecomputedJoinConditions { let result = condition .function .function_impl - .execute(&[&left_precomputed, right_arr.as_ref()])?; + .execute_old(&[&left_precomputed, right_arr.as_ref()])?; results.push(result); } // AND the results. let refs: Vec<_> = results.iter().collect(); - let out = AndImpl.execute(&refs)?; + let out = AndImpl.execute_old(&refs)?; // Generate a selection for the left and right selections. let mut select_the_selection = SelectionVector::with_capacity(out.logical_len()); diff --git a/crates/rayexec_execution/src/execution/operators/hash_join/global_hash_table.rs b/crates/rayexec_execution/src/execution/operators/hash_join/global_hash_table.rs index 23b04d8d4..26a6f5660 100644 --- a/crates/rayexec_execution/src/execution/operators/hash_join/global_hash_table.rs +++ b/crates/rayexec_execution/src/execution/operators/hash_join/global_hash_table.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use hashbrown::raw::RawTable; use rayexec_bullet::batch::BatchOld; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::selection::SelectionVector; use rayexec_error::Result; @@ -34,7 +34,7 @@ pub struct GlobalHashTable { /// Column types for left side of join. /// /// Used when generating the left columns for a RIGHT OUTER join. - left_types: Vec, + left_types: Vec, /// If we're a right join. right_join: bool, /// If we're a mark join. @@ -47,7 +47,7 @@ pub struct GlobalHashTable { impl GlobalHashTable { /// Merge many partition hash tables into a new global hash table. pub fn new( - left_types: Vec, + left_types: Vec, right_join: bool, is_mark: bool, partition_tables: Vec, diff --git a/crates/rayexec_execution/src/execution/operators/hash_join/mod.rs b/crates/rayexec_execution/src/execution/operators/hash_join/mod.rs index cdadc0304..442d04e17 100644 --- a/crates/rayexec_execution/src/execution/operators/hash_join/mod.rs +++ b/crates/rayexec_execution/src/execution/operators/hash_join/mod.rs @@ -11,7 +11,7 @@ use global_hash_table::GlobalHashTable; use parking_lot::Mutex; use partition_hash_table::PartitionHashTable; use rayexec_bullet::batch::BatchOld; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::scalar::HashExecutor; use rayexec_error::{OptionExt, RayexecError, Result}; @@ -128,10 +128,10 @@ pub struct PhysicalHashJoin { conditions: Vec, /// Types for the batches we'll be receiving from the left side. Used during /// RIGHT joins to produce null columns on the left side. - left_types: Vec, + left_types: Vec, /// Types for the batches we'll be receiving from the right side. Used /// during LEFT joins to produce null columns on the right side. - right_types: Vec, + right_types: Vec, } impl PhysicalHashJoin { @@ -145,8 +145,8 @@ impl PhysicalHashJoin { join_type: JoinType, equality_inidices: &[usize], conditions: Vec, - left_types: Vec, - right_types: Vec, + left_types: Vec, + right_types: Vec, ) -> Self { assert!(!equality_inidices.is_empty()); diff --git a/crates/rayexec_execution/src/execution/operators/util/outer_join_tracker.rs b/crates/rayexec_execution/src/execution/operators/util/outer_join_tracker.rs index cb20778cd..9e9058ca7 100644 --- a/crates/rayexec_execution/src/execution/operators/util/outer_join_tracker.rs +++ b/crates/rayexec_execution/src/execution/operators/util/outer_join_tracker.rs @@ -1,9 +1,9 @@ use std::sync::Arc; -use rayexec_bullet::array::{ArrayOld, ArrayData}; +use rayexec_bullet::array::{ArrayData, ArrayOld}; use rayexec_bullet::batch::BatchOld; use rayexec_bullet::bitmap::Bitmap; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::selection::SelectionVector; use rayexec_error::Result; @@ -59,7 +59,7 @@ pub struct LeftOuterJoinDrainState { batches: Vec, /// Types for the right side of the join. Used to create the (typed) null /// columns for left rows that weren't visited. - right_types: Vec, + right_types: Vec, /// Current batch we're draining. batch_idx: usize, /// How many batches to skip on each iteration. @@ -76,7 +76,7 @@ impl LeftOuterJoinDrainState { skip: usize, tracker: LeftOuterJoinTracker, batches: Vec, - right_types: Vec, + right_types: Vec, ) -> Self { LeftOuterJoinDrainState { tracker, @@ -106,7 +106,7 @@ impl LeftOuterJoinDrainState { .iter() .cloned() .chain([ArrayOld::new_with_array_data( - DataType::Boolean, + DataTypeOld::Boolean, ArrayData::Boolean(Arc::new(bitmap.clone().into())), )]); @@ -231,7 +231,7 @@ impl RightOuterJoinTracker { /// Returns None if all row on the right were visited. pub fn into_unvisited( self, - left_types: &[DataType], + left_types: &[DataTypeOld], right: &BatchOld, ) -> Result> { let selection = SelectionVector::from_iter(self.unvisited.index_iter()); diff --git a/crates/rayexec_execution/src/expr/aggregate_expr.rs b/crates/rayexec_execution/src/expr/aggregate_expr.rs index 5a743c991..fa3f81001 100644 --- a/crates/rayexec_execution/src/expr/aggregate_expr.rs +++ b/crates/rayexec_execution/src/expr/aggregate_expr.rs @@ -1,6 +1,6 @@ use std::fmt; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use super::Expression; @@ -19,7 +19,7 @@ pub struct AggregateExpr { } impl AggregateExpr { - pub fn datatype(&self, _bind_context: &BindContext) -> Result { + pub fn datatype(&self, _bind_context: &BindContext) -> Result { Ok(self.agg.return_type.clone()) } } diff --git a/crates/rayexec_execution/src/expr/arith_expr.rs b/crates/rayexec_execution/src/expr/arith_expr.rs index 6e69ad2b3..dacbf964c 100644 --- a/crates/rayexec_execution/src/expr/arith_expr.rs +++ b/crates/rayexec_execution/src/expr/arith_expr.rs @@ -1,6 +1,6 @@ use std::fmt; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use super::{AsScalarFunction, Expression}; @@ -50,7 +50,7 @@ pub struct ArithExpr { } impl ArithExpr { - pub fn datatype(&self, table_list: &TableList) -> Result { + pub fn datatype(&self, table_list: &TableList) -> Result { // TODO: Be more efficient here. Ok(self .op diff --git a/crates/rayexec_execution/src/expr/case_expr.rs b/crates/rayexec_execution/src/expr/case_expr.rs index cc9997f6b..ecca30fde 100644 --- a/crates/rayexec_execution/src/expr/case_expr.rs +++ b/crates/rayexec_execution/src/expr/case_expr.rs @@ -1,6 +1,6 @@ use std::fmt; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::{RayexecError, Result}; use super::Expression; @@ -41,7 +41,7 @@ pub struct CaseExpr { } impl CaseExpr { - pub fn datatype(&self, table_list: &TableList) -> Result { + pub fn datatype(&self, table_list: &TableList) -> Result { let mut case_iter = self.cases.iter(); let datatype = match case_iter.next() { Some(case) => case.then.datatype(table_list)?, diff --git a/crates/rayexec_execution/src/expr/cast_expr.rs b/crates/rayexec_execution/src/expr/cast_expr.rs index 99bbeeb36..9609ae111 100644 --- a/crates/rayexec_execution/src/expr/cast_expr.rs +++ b/crates/rayexec_execution/src/expr/cast_expr.rs @@ -1,13 +1,13 @@ use std::fmt; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use super::Expression; use crate::explain::context_display::{ContextDisplay, ContextDisplayMode, ContextDisplayWrapper}; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct CastExpr { - pub to: DataType, + pub to: DataTypeOld, pub expr: Box, } diff --git a/crates/rayexec_execution/src/expr/column_expr.rs b/crates/rayexec_execution/src/expr/column_expr.rs index b7be02979..0a2aaa3d7 100644 --- a/crates/rayexec_execution/src/expr/column_expr.rs +++ b/crates/rayexec_execution/src/expr/column_expr.rs @@ -1,6 +1,6 @@ use std::fmt; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use crate::explain::context_display::{ContextDisplay, ContextDisplayMode}; @@ -23,7 +23,7 @@ impl ColumnExpr { } } - pub fn datatype(&self, table_list: &TableList) -> Result { + pub fn datatype(&self, table_list: &TableList) -> Result { let (_, datatype) = table_list.get_column(self.table_scope, self.column)?; Ok(datatype.clone()) } diff --git a/crates/rayexec_execution/src/expr/grouping_set_expr.rs b/crates/rayexec_execution/src/expr/grouping_set_expr.rs index 710f37d6f..0f1c00f1c 100644 --- a/crates/rayexec_execution/src/expr/grouping_set_expr.rs +++ b/crates/rayexec_execution/src/expr/grouping_set_expr.rs @@ -1,7 +1,7 @@ use std::fmt; use fmtutil::IntoDisplayableSlice; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use super::Expression; use crate::explain::context_display::{ContextDisplay, ContextDisplayMode, ContextDisplayWrapper}; @@ -12,8 +12,8 @@ pub struct GroupingSetExpr { } impl GroupingSetExpr { - pub fn datatype(&self) -> DataType { - DataType::UInt64 + pub fn datatype(&self) -> DataTypeOld { + DataTypeOld::UInt64 } } diff --git a/crates/rayexec_execution/src/expr/mod.rs b/crates/rayexec_execution/src/expr/mod.rs index e2239e201..bbbaec8e3 100644 --- a/crates/rayexec_execution/src/expr/mod.rs +++ b/crates/rayexec_execution/src/expr/mod.rs @@ -32,7 +32,7 @@ use grouping_set_expr::GroupingSetExpr; use is_expr::IsExpr; use literal_expr::LiteralExpr; use negate_expr::NegateExpr; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::scalar::{OwnedScalarValue, ScalarValue}; use rayexec_error::{RayexecError, Result}; use scalar_function_expr::ScalarFunctionExpr; @@ -69,17 +69,17 @@ impl Expression { /// /// The provided table list is used when resolving the return type for a /// column expression. - pub fn datatype(&self, table_list: &TableList) -> Result { + pub fn datatype(&self, table_list: &TableList) -> Result { Ok(match self { Self::Aggregate(expr) => expr.agg.return_type.clone(), Self::Arith(expr) => expr.datatype(table_list)?, - Self::Between(_) => DataType::Boolean, + Self::Between(_) => DataTypeOld::Boolean, Self::Case(expr) => expr.datatype(table_list)?, Self::Cast(expr) => expr.to.clone(), Self::Column(expr) => expr.datatype(table_list)?, - Self::Comparison(_) => DataType::Boolean, - Self::Conjunction(_) => DataType::Boolean, - Self::Is(_) => DataType::Boolean, + Self::Comparison(_) => DataTypeOld::Boolean, + Self::Conjunction(_) => DataTypeOld::Boolean, + Self::Is(_) => DataTypeOld::Boolean, Self::Literal(expr) => expr.literal.datatype(), Self::Negate(expr) => expr.datatype(table_list)?, Self::ScalarFunction(expr) => expr.function.return_type.clone(), @@ -543,7 +543,7 @@ pub fn lit(scalar: impl Into) -> Expression { }) } -pub fn cast(expr: Expression, to: DataType) -> Expression { +pub fn cast(expr: Expression, to: DataTypeOld) -> Expression { Expression::Cast(CastExpr { to, expr: Box::new(expr), diff --git a/crates/rayexec_execution/src/expr/negate_expr.rs b/crates/rayexec_execution/src/expr/negate_expr.rs index 1514a011c..3bb5cf12a 100644 --- a/crates/rayexec_execution/src/expr/negate_expr.rs +++ b/crates/rayexec_execution/src/expr/negate_expr.rs @@ -1,6 +1,6 @@ use std::fmt; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use super::{AsScalarFunction, Expression}; @@ -31,9 +31,9 @@ pub struct NegateExpr { } impl NegateExpr { - pub fn datatype(&self, table_list: &TableList) -> Result { + pub fn datatype(&self, table_list: &TableList) -> Result { Ok(match self.op { - NegateOperator::Not => DataType::Boolean, + NegateOperator::Not => DataTypeOld::Boolean, NegateOperator::Negate => { // Sure self.op diff --git a/crates/rayexec_execution/src/expr/physical/case_expr.rs b/crates/rayexec_execution/src/expr/physical/case_expr.rs index 8972623bd..fa196fbae 100644 --- a/crates/rayexec_execution/src/expr/physical/case_expr.rs +++ b/crates/rayexec_execution/src/expr/physical/case_expr.rs @@ -116,7 +116,7 @@ impl fmt::Display for PhysicalCaseExpr { #[cfg(test)] mod tests { - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::scalar::ScalarValue; use super::*; @@ -139,7 +139,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); diff --git a/crates/rayexec_execution/src/expr/physical/cast_expr.rs b/crates/rayexec_execution/src/expr/physical/cast_expr.rs index a646436c2..2d778b57c 100644 --- a/crates/rayexec_execution/src/expr/physical/cast_expr.rs +++ b/crates/rayexec_execution/src/expr/physical/cast_expr.rs @@ -5,7 +5,7 @@ use rayexec_bullet::array::ArrayOld; use rayexec_bullet::batch::BatchOld; use rayexec_bullet::compute::cast::array::cast_array; use rayexec_bullet::compute::cast::behavior::CastFailBehavior; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::{OptionExt, Result}; use rayexec_proto::ProtoConv; @@ -15,7 +15,7 @@ use crate::proto::DatabaseProtoConv; #[derive(Debug, Clone)] pub struct PhysicalCastExpr { - pub to: DataType, + pub to: DataTypeOld, pub expr: Box, } diff --git a/crates/rayexec_execution/src/expr/physical/mod.rs b/crates/rayexec_execution/src/expr/physical/mod.rs index bdc16bc27..fea6d9b9f 100644 --- a/crates/rayexec_execution/src/expr/physical/mod.rs +++ b/crates/rayexec_execution/src/expr/physical/mod.rs @@ -191,7 +191,7 @@ impl DatabaseProtoConv for PhysicalSortExpression { #[cfg(test)] mod tests { use planner::PhysicalExpressionPlanner; - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use super::*; use crate::expr; @@ -209,7 +209,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -236,7 +236,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); diff --git a/crates/rayexec_execution/src/expr/physical/scalar_function_expr.rs b/crates/rayexec_execution/src/expr/physical/scalar_function_expr.rs index 5d8da93b4..000b364b0 100644 --- a/crates/rayexec_execution/src/expr/physical/scalar_function_expr.rs +++ b/crates/rayexec_execution/src/expr/physical/scalar_function_expr.rs @@ -31,7 +31,7 @@ impl PhysicalScalarFunctionExpr { .collect::>>()?; let refs: Vec<_> = inputs.iter().map(|a| a.as_ref()).collect(); // Can I not? - let mut out = self.function.function_impl.execute(&refs)?; + let mut out = self.function.function_impl.execute_old(&refs)?; // If function is provided no input, it's expected to return an // array of length 1. We extend the array here so that it's the @@ -69,7 +69,7 @@ impl PhysicalScalarFunctionExpr { validity: &mut output.validity, }; - self.function.function_impl.execute2(&state.buffer, out)?; + self.function.function_impl.execute(&state.buffer, out)?; Ok(()) } @@ -116,3 +116,69 @@ impl DatabaseProtoConv for PhysicalScalarFunctionExpr { // }) } } + +#[cfg(test)] +mod tests { + use rayexec_bullet::datatype::DataTypeOld; + + use super::*; + use crate::arrays::buffer::physical_type::PhysicalI32; + use crate::arrays::buffer::Int32Builder; + use crate::arrays::buffer_manager::NopBufferManager; + use crate::arrays::datatype::DataType; + use crate::expr::column_expr::ColumnExpr; + use crate::expr::physical::column_expr::PhysicalColumnExpr; + use crate::expr::Expression; + use crate::functions::scalar::builtin::temp_add_2::TempAdd2; + use crate::functions::scalar::ScalarFunction; + use crate::logical::binder::table_list::TableList; + + fn make_temp_add_2() -> PlannedScalarFunction { + let mut table_list = TableList::empty(); + let table_ref = table_list + .push_table(None, vec![DataTypeOld::Int32], vec!["col".to_string()]) + .unwrap(); + + TempAdd2 + .plan( + &table_list, + vec![Expression::Column(ColumnExpr { + table_scope: table_ref, + column: 0, + })], + ) + .unwrap() + } + + #[test] + fn eval_simple() { + let mut batch = Batch::from_arrays( + [Array::new_with_buffer( + DataType::Int32, + Int32Builder::from_iter([4, 5, 6]).unwrap(), + )], + true, + ) + .unwrap(); + + let expr = PhysicalScalarFunctionExpr { + function: make_temp_add_2(), + inputs: vec![PhysicalScalarExpression::Column(PhysicalColumnExpr { + idx: 0, + })], + }; + + let mut state = ExpressionState { + buffer: Batch::new(&NopBufferManager, [DataType::Int32], 4096).unwrap(), + inputs: vec![ExpressionState::empty()], + }; + + let mut out = Array::new(&NopBufferManager, DataType::Int32, 3).unwrap(); + + expr.eval(&mut batch, &mut state, FlatSelection::linear(3), &mut out) + .unwrap(); + + let out_slice = out.data().try_as_slice::().unwrap(); + assert_eq!(&[6, 7, 8], out_slice); + } +} diff --git a/crates/rayexec_execution/src/expr/subquery_expr.rs b/crates/rayexec_execution/src/expr/subquery_expr.rs index 3a21c713d..199efdac9 100644 --- a/crates/rayexec_execution/src/expr/subquery_expr.rs +++ b/crates/rayexec_execution/src/expr/subquery_expr.rs @@ -1,7 +1,7 @@ use std::fmt; use std::hash::Hash; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use super::comparison_expr::ComparisonOperator; @@ -31,7 +31,7 @@ pub struct SubqueryExpr { pub bind_idx: BindScopeRef, pub subquery: Box, pub subquery_type: SubqueryType, - pub return_type: DataType, + pub return_type: DataTypeOld, } impl SubqueryExpr { diff --git a/crates/rayexec_execution/src/expr/unnest_expr.rs b/crates/rayexec_execution/src/expr/unnest_expr.rs index 205495c30..9a8042505 100644 --- a/crates/rayexec_execution/src/expr/unnest_expr.rs +++ b/crates/rayexec_execution/src/expr/unnest_expr.rs @@ -1,6 +1,6 @@ use std::fmt; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::{RayexecError, Result}; use super::Expression; @@ -15,12 +15,12 @@ pub struct UnnestExpr { } impl UnnestExpr { - pub fn datatype(&self, table_list: &TableList) -> Result { + pub fn datatype(&self, table_list: &TableList) -> Result { let child_datatype = self.expr.datatype(table_list)?; match child_datatype { - DataType::Null => Ok(DataType::Null), - DataType::List(list) => Ok(list.datatype.as_ref().clone()), + DataTypeOld::Null => Ok(DataTypeOld::Null), + DataTypeOld::List(list) => Ok(list.datatype.as_ref().clone()), other => Err(RayexecError::new(format!( "Unsupported datatype for UNNEST: {other}" ))), diff --git a/crates/rayexec_execution/src/expr/window_expr.rs b/crates/rayexec_execution/src/expr/window_expr.rs index 3f7ea6ffe..96ecf34cc 100644 --- a/crates/rayexec_execution/src/expr/window_expr.rs +++ b/crates/rayexec_execution/src/expr/window_expr.rs @@ -1,7 +1,7 @@ use std::fmt; use fmtutil::IntoDisplayableSlice; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use super::Expression; @@ -77,7 +77,7 @@ pub struct WindowExpr { } impl WindowExpr { - pub fn datatype(&self, _bind_context: &BindContext) -> Result { + pub fn datatype(&self, _bind_context: &BindContext) -> Result { Ok(self.agg.return_type.clone()) } } diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/avg.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/avg.rs index fd90ab921..61eb1741a 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/avg.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/avg.rs @@ -5,7 +5,7 @@ use std::ops::AddAssign; use num_traits::AsPrimitive; use rayexec_bullet::array::ArrayOld; use rayexec_bullet::bitmap::Bitmap; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::AggregateState; use rayexec_bullet::executor::builder::{ArrayBuilder, ArrayDataBuffer, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::{PhysicalF64Old, PhysicalI64Old}; @@ -83,21 +83,21 @@ impl AggregateFunction for Avg { let (function_impl, return_type): (Box, _) = match inputs[0].datatype(table_list)? { - DataType::Int64 => (Box::new(AvgInt64Impl), DataType::Float64), - DataType::Float64 => (Box::new(AvgFloat64Impl), DataType::Float64), - dt @ DataType::Decimal64(_) => { + DataTypeOld::Int64 => (Box::new(AvgInt64Impl), DataTypeOld::Float64), + DataTypeOld::Float64 => (Box::new(AvgFloat64Impl), DataTypeOld::Float64), + dt @ DataTypeOld::Decimal64(_) => { // Datatype only used in order to convert decimal to float // at the end. This always returns Float64. ( Box::new(AvgDecimalImpl::::new(dt)), - DataType::Float64, + DataTypeOld::Float64, ) } - dt @ DataType::Decimal128(_) => { + dt @ DataTypeOld::Decimal128(_) => { // See above ( Box::new(AvgDecimalImpl::::new(dt)), - DataType::Float64, + DataTypeOld::Float64, ) } @@ -115,12 +115,12 @@ impl AggregateFunction for Avg { #[derive(Debug, Clone)] pub struct AvgDecimalImpl { - datatype: DataType, + datatype: DataTypeOld, _d: PhantomData, } impl AvgDecimalImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { AvgDecimalImpl { datatype, _d: PhantomData, @@ -138,7 +138,7 @@ where let state_finalize = move |states: &mut [AvgStateDecimal]| { let mut builder = ArrayBuilder { - datatype: DataType::Float64, + datatype: DataTypeOld::Float64, buffer: PrimitiveBuffer::with_len(states.len()), }; @@ -180,7 +180,7 @@ impl AggregateFunctionImpl for AvgFloat64Impl { fn new_states(&self) -> Box { new_unary_aggregate_states::( AvgStateF64::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } @@ -192,7 +192,7 @@ impl AggregateFunctionImpl for AvgInt64Impl { fn new_states(&self) -> Box { new_unary_aggregate_states::( AvgStateF64::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/corr.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/corr.rs index 789eede72..9110054c6 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/corr.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/corr.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::AggregateState; use rayexec_bullet::executor::physical_type::PhysicalF64Old; use rayexec_error::Result; @@ -58,9 +58,9 @@ impl AggregateFunction for Corr { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float64, DataType::Float64) => Ok(PlannedAggregateFunction { + (DataTypeOld::Float64, DataTypeOld::Float64) => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(CorrImpl), }), @@ -76,7 +76,7 @@ impl AggregateFunctionImpl for CorrImpl { fn new_states(&self) -> Box { new_binary_aggregate_states::( CorrelationState::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/count.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/count.rs index 5ef0ebd7b..2d346c530 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/count.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/count.rs @@ -1,4 +1,4 @@ -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::AggregateState; use rayexec_bullet::executor::physical_type::PhysicalAnyOld; use rayexec_error::Result; @@ -26,7 +26,7 @@ impl Count { pub fn count_star(&self) -> PlannedAggregateFunction { PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Int64, + return_type: DataTypeOld::Int64, inputs: vec![expr::lit(true)], function_impl: Box::new(CountNonNullImpl), } @@ -63,7 +63,7 @@ impl AggregateFunction for Count { Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Int64, + return_type: DataTypeOld::Int64, inputs, function_impl: Box::new(CountNonNullImpl), }) @@ -77,7 +77,7 @@ impl AggregateFunctionImpl for CountNonNullImpl { fn new_states(&self) -> Box { new_unary_aggregate_states::( CountNonNullState::default, - move |states| primitive_finalize(DataType::Int64, states), + move |states| primitive_finalize(DataTypeOld::Int64, states), ) } } diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/covar.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/covar.rs index 5a3903884..e00c42b46 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/covar.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/covar.rs @@ -1,7 +1,7 @@ use std::fmt::Debug; use std::marker::PhantomData; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::AggregateState; use rayexec_bullet::executor::physical_type::PhysicalF64Old; use rayexec_error::Result; @@ -56,9 +56,9 @@ impl AggregateFunction for CovarPop { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float64, DataType::Float64) => Ok(PlannedAggregateFunction { + (DataTypeOld::Float64, DataTypeOld::Float64) => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(CovarPopImpl), }), @@ -74,7 +74,7 @@ impl AggregateFunctionImpl for CovarPopImpl { fn new_states(&self) -> Box { new_binary_aggregate_states::( CovarState::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } @@ -114,9 +114,9 @@ impl AggregateFunction for CovarSamp { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float64, DataType::Float64) => Ok(PlannedAggregateFunction { + (DataTypeOld::Float64, DataTypeOld::Float64) => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(CovarSampImpl), }), @@ -132,7 +132,7 @@ impl AggregateFunctionImpl for CovarSampImpl { fn new_states(&self) -> Box { new_binary_aggregate_states::( CovarState::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/first.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/first.rs index 6213cfab3..bb9df50ba 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/first.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/first.rs @@ -3,7 +3,7 @@ use std::marker::PhantomData; use half::f16; use rayexec_bullet::array::ArrayData; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::{AggregateState, StateFinalizer}; use rayexec_bullet::executor::builder::{ArrayBuilder, GermanVarlenBuffer}; use rayexec_bullet::executor::physical_type::{ @@ -150,7 +150,7 @@ impl AggregateFunction for First { /// FIRST aggregate impl for utf8 and binary. #[derive(Debug, Clone)] pub struct FirstBinaryImpl { - datatype: DataType, + datatype: DataTypeOld, } impl AggregateFunctionImpl for FirstBinaryImpl { @@ -189,7 +189,7 @@ impl AggregateFunctionImpl for FirstBoolImpl { fn new_states(&self) -> Box { new_unary_aggregate_states::( FirstState::::default, - move |states| boolean_finalize(DataType::Boolean, states), + move |states| boolean_finalize(DataTypeOld::Boolean, states), ) } } @@ -197,13 +197,13 @@ impl AggregateFunctionImpl for FirstBoolImpl { // TODO: Remove T #[derive(Debug, Clone)] pub struct FirstPrimitiveImpl { - datatype: DataType, + datatype: DataTypeOld, _s: PhantomData, _t: PhantomData, } impl FirstPrimitiveImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { FirstPrimitiveImpl { datatype, _s: PhantomData, diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/minmax.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/minmax.rs index 26be73e1d..d33f14c83 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/minmax.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/minmax.rs @@ -3,7 +3,7 @@ use std::marker::PhantomData; use half::f16; use rayexec_bullet::array::ArrayData; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::{AggregateState, StateFinalizer}; use rayexec_bullet::executor::builder::{ArrayBuilder, GermanVarlenBuffer}; use rayexec_bullet::executor::physical_type::{ @@ -254,12 +254,12 @@ pub type MaxBinaryImpl = MinMaxBinaryImpl; #[derive(Debug)] pub struct MinMaxBinaryImpl { - datatype: DataType, + datatype: DataTypeOld, _m: PhantomData, } impl MinMaxBinaryImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { MinMaxBinaryImpl { datatype, _m: PhantomData, @@ -310,7 +310,7 @@ where { fn new_states(&self) -> Box { new_unary_aggregate_states::(M::default, move |states| { - boolean_finalize(DataType::Boolean, states) + boolean_finalize(DataTypeOld::Boolean, states) }) } } @@ -327,14 +327,14 @@ pub type MaxPrimitiveImpl = MinMaxPrimitiveImpl, S, T>; // TODO: Remove T #[derive(Debug)] pub struct MinMaxPrimitiveImpl { - datatype: DataType, + datatype: DataTypeOld, _m: PhantomData, _s: PhantomData, _t: PhantomData, } impl MinMaxPrimitiveImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { MinMaxPrimitiveImpl { datatype, _m: PhantomData, diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/regr_avg.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/regr_avg.rs index 30fe93aa2..d9b15e2ee 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/regr_avg.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/regr_avg.rs @@ -1,7 +1,7 @@ use std::fmt::Debug; use std::marker::PhantomData; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::AggregateState; use rayexec_bullet::executor::physical_type::PhysicalF64Old; use rayexec_error::Result; @@ -56,9 +56,9 @@ impl AggregateFunction for RegrAvgY { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float64, DataType::Float64) => Ok(PlannedAggregateFunction { + (DataTypeOld::Float64, DataTypeOld::Float64) => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(RegrAvgYImpl), }), @@ -74,7 +74,7 @@ impl AggregateFunctionImpl for RegrAvgYImpl { fn new_states(&self) -> Box { new_binary_aggregate_states::( RegrAvgState::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } @@ -121,9 +121,9 @@ impl AggregateFunction for RegrAvgX { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float64, DataType::Float64) => Ok(PlannedAggregateFunction { + (DataTypeOld::Float64, DataTypeOld::Float64) => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(RegrAvgXImpl), }), @@ -139,7 +139,7 @@ impl AggregateFunctionImpl for RegrAvgXImpl { fn new_states(&self) -> Box { new_binary_aggregate_states::( RegrAvgState::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/regr_count.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/regr_count.rs index 2658a525f..0c661d1f7 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/regr_count.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/regr_count.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::AggregateState; use rayexec_bullet::executor::physical_type::PhysicalAnyOld; use rayexec_error::Result; @@ -55,9 +55,9 @@ impl AggregateFunction for RegrCount { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float64, DataType::Float64) => Ok(PlannedAggregateFunction { + (DataTypeOld::Float64, DataTypeOld::Float64) => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(RegrCountImpl), }), @@ -73,7 +73,7 @@ impl AggregateFunctionImpl for RegrCountImpl { fn new_states(&self) -> Box { new_binary_aggregate_states::( RegrCountState::default, - move |states| primitive_finalize(DataType::Int64, states), + move |states| primitive_finalize(DataTypeOld::Int64, states), ) } } diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/regr_r2.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/regr_r2.rs index b0fc3e897..d4ac4f577 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/regr_r2.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/regr_r2.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::AggregateState; use rayexec_bullet::executor::physical_type::PhysicalF64Old; use rayexec_error::Result; @@ -56,9 +56,9 @@ impl AggregateFunction for RegrR2 { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float64, DataType::Float64) => Ok(PlannedAggregateFunction { + (DataTypeOld::Float64, DataTypeOld::Float64) => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(RegrR2Impl), }), @@ -74,7 +74,7 @@ impl AggregateFunctionImpl for RegrR2Impl { fn new_states(&self) -> Box { new_binary_aggregate_states::( RegrR2State::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/regr_slope.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/regr_slope.rs index 290bfd90d..e20f87e44 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/regr_slope.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/regr_slope.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::AggregateState; use rayexec_bullet::executor::physical_type::PhysicalF64Old; use rayexec_error::Result; @@ -57,9 +57,9 @@ impl AggregateFunction for RegrSlope { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float64, DataType::Float64) => Ok(PlannedAggregateFunction { + (DataTypeOld::Float64, DataTypeOld::Float64) => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(RegrSlopeImpl), }), @@ -75,7 +75,7 @@ impl AggregateFunctionImpl for RegrSlopeImpl { fn new_states(&self) -> Box { new_binary_aggregate_states::( RegrSlopeState::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/stddev.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/stddev.rs index ac399486e..0bda07bac 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/stddev.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/stddev.rs @@ -1,7 +1,7 @@ use std::fmt::Debug; use std::marker::PhantomData; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::AggregateState; use rayexec_bullet::executor::physical_type::PhysicalF64Old; use rayexec_error::Result; @@ -53,9 +53,9 @@ impl AggregateFunction for StddevPop { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Float64 => Ok(PlannedAggregateFunction { + DataTypeOld::Float64 => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(StddevPopImpl), }), @@ -71,7 +71,7 @@ impl AggregateFunctionImpl for StddevPopImpl { fn new_states(&self) -> Box { new_unary_aggregate_states::( VarianceState::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } @@ -112,9 +112,9 @@ impl AggregateFunction for StddevSamp { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Float64 => Ok(PlannedAggregateFunction { + DataTypeOld::Float64 => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(StddevSampImpl), }), @@ -130,7 +130,7 @@ impl AggregateFunctionImpl for StddevSampImpl { fn new_states(&self) -> Box { new_unary_aggregate_states::( VarianceState::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } @@ -167,9 +167,9 @@ impl AggregateFunction for VarPop { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Float64 => Ok(PlannedAggregateFunction { + DataTypeOld::Float64 => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(VarPopImpl), }), @@ -185,7 +185,7 @@ impl AggregateFunctionImpl for VarPopImpl { fn new_states(&self) -> Box { new_unary_aggregate_states::( VarianceState::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } @@ -222,9 +222,9 @@ impl AggregateFunction for VarSamp { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Float64 => Ok(PlannedAggregateFunction { + DataTypeOld::Float64 => Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(VarSampImpl), }), @@ -240,7 +240,7 @@ impl AggregateFunctionImpl for VarSampImpl { fn new_states(&self) -> Box { new_unary_aggregate_states::( VarianceState::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/string_agg.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/string_agg.rs index 4d6336a5f..232b9bb3a 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/string_agg.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/string_agg.rs @@ -1,6 +1,6 @@ use std::fmt::Debug; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::{AggregateState, StateFinalizer}; use rayexec_bullet::executor::builder::{ArrayBuilder, GermanVarlenBuffer}; use rayexec_bullet::executor::physical_type::PhysicalUtf8Old; @@ -57,7 +57,7 @@ impl AggregateFunction for StringAgg { .collect::>>()?; match &datatypes[0] { - DataType::Utf8 => (), + DataTypeOld::Utf8 => (), _ => return Err(invalid_input_types_error(self, &datatypes)), } @@ -79,7 +79,7 @@ impl AggregateFunction for StringAgg { Ok(PlannedAggregateFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(StringAggImpl { sep }), }) @@ -101,7 +101,7 @@ impl AggregateFunctionImpl for StringAggImpl { new_unary_aggregate_states::(state_init, move |states| { let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(states.len()), }; StateFinalizer::finalize(states, builder) diff --git a/crates/rayexec_execution/src/functions/aggregate/builtin/sum.rs b/crates/rayexec_execution/src/functions/aggregate/builtin/sum.rs index fd9f81c37..8bcacb01a 100644 --- a/crates/rayexec_execution/src/functions/aggregate/builtin/sum.rs +++ b/crates/rayexec_execution/src/functions/aggregate/builtin/sum.rs @@ -4,7 +4,7 @@ use std::ops::AddAssign; use num_traits::CheckedAdd; use rayexec_bullet::array::ArrayData; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::aggregate::AggregateState; use rayexec_bullet::executor::physical_type::{PhysicalF64Old, PhysicalI64Old}; use rayexec_bullet::scalar::decimal::{Decimal128Type, Decimal64Type, DecimalType}; @@ -81,17 +81,17 @@ impl AggregateFunction for Sum { let (function_impl, return_type): (Box, _) = match inputs[0].datatype(table_list)? { - DataType::Int64 => (Box::new(SumInt64Impl), DataType::Int64), - DataType::Float64 => (Box::new(SumFloat64Impl), DataType::Float64), - DataType::Decimal64(m) => { - let datatype = DataType::Decimal64(m); + DataTypeOld::Int64 => (Box::new(SumInt64Impl), DataTypeOld::Int64), + DataTypeOld::Float64 => (Box::new(SumFloat64Impl), DataTypeOld::Float64), + DataTypeOld::Decimal64(m) => { + let datatype = DataTypeOld::Decimal64(m); ( Box::new(SumDecimalImpl::::new(datatype.clone())), datatype, ) } - DataType::Decimal128(m) => { - let datatype = DataType::Decimal128(m); + DataTypeOld::Decimal128(m) => { + let datatype = DataTypeOld::Decimal128(m); ( Box::new(SumDecimalImpl::::new(datatype.clone())), datatype, @@ -116,7 +116,7 @@ impl AggregateFunctionImpl for SumInt64Impl { fn new_states(&self) -> Box { new_unary_aggregate_states::( SumStateCheckedAdd::::default, - move |states| primitive_finalize(DataType::Int64, states), + move |states| primitive_finalize(DataTypeOld::Int64, states), ) } } @@ -128,19 +128,19 @@ impl AggregateFunctionImpl for SumFloat64Impl { fn new_states(&self) -> Box { new_unary_aggregate_states::( SumStateAdd::::default, - move |states| primitive_finalize(DataType::Float64, states), + move |states| primitive_finalize(DataTypeOld::Float64, states), ) } } #[derive(Debug, Clone)] pub struct SumDecimalImpl { - datatype: DataType, + datatype: DataTypeOld, _d: PhantomData, } impl SumDecimalImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { SumDecimalImpl { datatype, _d: PhantomData, @@ -238,7 +238,7 @@ mod tests { let mut table_list = TableList::empty(); let table_ref = table_list - .push_table(None, vec![DataType::Int64], vec!["c0".to_string()]) + .push_table(None, vec![DataTypeOld::Int64], vec!["c0".to_string()]) .unwrap(); let specialized = Sum @@ -317,7 +317,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Utf8, DataType::Int64], + vec![DataTypeOld::Utf8, DataTypeOld::Int64], vec!["col1".to_string(), "col2".to_string()], ) .unwrap(); @@ -439,7 +439,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Utf8, DataType::Int64], + vec![DataTypeOld::Utf8, DataTypeOld::Int64], vec!["col1".to_string(), "col2".to_string()], ) .unwrap(); diff --git a/crates/rayexec_execution/src/functions/aggregate/mod.rs b/crates/rayexec_execution/src/functions/aggregate/mod.rs index 275e0be72..e0db466a2 100644 --- a/crates/rayexec_execution/src/functions/aggregate/mod.rs +++ b/crates/rayexec_execution/src/functions/aggregate/mod.rs @@ -5,7 +5,7 @@ use std::fmt::Debug; use std::hash::Hash; use dyn_clone::DynClone; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::aggregate::RowToStateMapping; use rayexec_error::Result; use states::AggregateGroupStates; @@ -48,7 +48,7 @@ impl Eq for dyn AggregateFunction {} #[derive(Debug, Clone)] pub struct PlannedAggregateFunction { pub function: Box, - pub return_type: DataType, + pub return_type: DataTypeOld, pub inputs: Vec, pub function_impl: Box, } diff --git a/crates/rayexec_execution/src/functions/aggregate/states.rs b/crates/rayexec_execution/src/functions/aggregate/states.rs index 44f060dc6..bc48c0468 100644 --- a/crates/rayexec_execution/src/functions/aggregate/states.rs +++ b/crates/rayexec_execution/src/functions/aggregate/states.rs @@ -4,7 +4,7 @@ use std::fmt::Debug; use std::marker::PhantomData; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::aggregate::{ AggregateState, BinaryNonNullUpdater, @@ -229,7 +229,10 @@ pub fn untyped_null_finalize(states: &mut [State]) -> Result { Ok(ArrayOld::new_untyped_null_array(states.len())) } -pub fn boolean_finalize(datatype: DataType, states: &mut [State]) -> Result +pub fn boolean_finalize( + datatype: DataTypeOld, + states: &mut [State], +) -> Result where State: AggregateState, { @@ -241,7 +244,7 @@ where } pub fn primitive_finalize( - datatype: DataType, + datatype: DataTypeOld, states: &mut [State], ) -> Result where diff --git a/crates/rayexec_execution/src/functions/implicit.rs b/crates/rayexec_execution/src/functions/implicit.rs index 44f6ab0b8..22e1ce430 100644 --- a/crates/rayexec_execution/src/functions/implicit.rs +++ b/crates/rayexec_execution/src/functions/implicit.rs @@ -1,4 +1,4 @@ -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; /// Score that should be used if no cast is needed. pub const NO_CAST_SCORE: u32 = 400; @@ -11,7 +11,7 @@ pub const NO_CAST_SCORE: u32 = 400; /// /// This is a best-effort attempt to determine if casting from one type to /// another is valid and won't lose precision. -pub const fn implicit_cast_score(have: &DataType, want: DataTypeId) -> Option { +pub const fn implicit_cast_score(have: &DataTypeOld, want: DataTypeId) -> Option { // Cast NULL to anything. if have.is_null() { return Some(target_score(want)); @@ -19,22 +19,22 @@ pub const fn implicit_cast_score(have: &DataType, want: DataTypeId) -> Option return int8_cast_score(want), - DataType::Int16 => return int16_cast_score(want), - DataType::Int32 => return int32_cast_score(want), - DataType::Int64 => return int64_cast_score(want), - DataType::UInt8 => return uint8_cast_score(want), - DataType::UInt16 => return uint16_cast_score(want), - DataType::UInt32 => return uint32_cast_score(want), - DataType::UInt64 => return uint64_cast_score(want), + DataTypeOld::Int8 => return int8_cast_score(want), + DataTypeOld::Int16 => return int16_cast_score(want), + DataTypeOld::Int32 => return int32_cast_score(want), + DataTypeOld::Int64 => return int64_cast_score(want), + DataTypeOld::UInt8 => return uint8_cast_score(want), + DataTypeOld::UInt16 => return uint16_cast_score(want), + DataTypeOld::UInt32 => return uint32_cast_score(want), + DataTypeOld::UInt64 => return uint64_cast_score(want), // Float casts - DataType::Float16 => return float16_cast_score(want), - DataType::Float32 => return float32_cast_score(want), - DataType::Float64 => return float64_cast_score(want), + DataTypeOld::Float16 => return float16_cast_score(want), + DataTypeOld::Float32 => return float32_cast_score(want), + DataTypeOld::Float64 => return float64_cast_score(want), // String casts - DataType::Utf8 => match want { + DataTypeOld::Utf8 => match want { DataTypeId::Int8 | DataTypeId::Int16 | DataTypeId::Int32 @@ -230,17 +230,17 @@ mod tests { #[test] fn implicit_cast_from_utf8() { - assert!(implicit_cast_score(&DataType::Utf8, DataTypeId::Int32).is_some()); - assert!(implicit_cast_score(&DataType::Utf8, DataTypeId::Timestamp).is_some()); - assert!(implicit_cast_score(&DataType::Utf8, DataTypeId::Interval).is_some()); + assert!(implicit_cast_score(&DataTypeOld::Utf8, DataTypeId::Int32).is_some()); + assert!(implicit_cast_score(&DataTypeOld::Utf8, DataTypeId::Timestamp).is_some()); + assert!(implicit_cast_score(&DataTypeOld::Utf8, DataTypeId::Interval).is_some()); } #[test] fn never_implicit_to_utf8() { // ...except when we're casting from utf8 utf8 - assert!(implicit_cast_score(&DataType::Int16, DataTypeId::Utf8).is_none()); + assert!(implicit_cast_score(&DataTypeOld::Int16, DataTypeId::Utf8).is_none()); assert!(implicit_cast_score( - &DataType::Timestamp(TimestampTypeMeta::new(TimeUnit::Millisecond)), + &DataTypeOld::Timestamp(TimestampTypeMeta::new(TimeUnit::Millisecond)), DataTypeId::Utf8 ) .is_none()); @@ -249,29 +249,30 @@ mod tests { #[test] fn integer_casts() { // Valid - assert!(implicit_cast_score(&DataType::Int16, DataTypeId::Int64).is_some()); - assert!(implicit_cast_score(&DataType::Int16, DataTypeId::Decimal64).is_some()); - assert!(implicit_cast_score(&DataType::Int16, DataTypeId::Float32).is_some()); + assert!(implicit_cast_score(&DataTypeOld::Int16, DataTypeId::Int64).is_some()); + assert!(implicit_cast_score(&DataTypeOld::Int16, DataTypeId::Decimal64).is_some()); + assert!(implicit_cast_score(&DataTypeOld::Int16, DataTypeId::Float32).is_some()); // Not valid - assert!(implicit_cast_score(&DataType::Int16, DataTypeId::UInt64).is_none()); + assert!(implicit_cast_score(&DataTypeOld::Int16, DataTypeId::UInt64).is_none()); } #[test] fn float_casts() { // Valid - assert!(implicit_cast_score(&DataType::Float64, DataTypeId::Decimal64).is_some()); + assert!(implicit_cast_score(&DataTypeOld::Float64, DataTypeId::Decimal64).is_some()); // Not valid - assert!(implicit_cast_score(&DataType::Float64, DataTypeId::Int64).is_none()); + assert!(implicit_cast_score(&DataTypeOld::Float64, DataTypeId::Int64).is_none()); } #[test] fn prefer_cast_int32_to_int64() { // https://github.com/GlareDB/rayexec/issues/229 - let to_int64_score = implicit_cast_score(&DataType::Int32, DataTypeId::Int64).unwrap(); - let to_float32_score = implicit_cast_score(&DataType::Int32, DataTypeId::Float32).unwrap(); + let to_int64_score = implicit_cast_score(&DataTypeOld::Int32, DataTypeId::Int64).unwrap(); + let to_float32_score = + implicit_cast_score(&DataTypeOld::Int32, DataTypeId::Float32).unwrap(); assert!( to_int64_score > to_float32_score, diff --git a/crates/rayexec_execution/src/functions/mod.rs b/crates/rayexec_execution/src/functions/mod.rs index c4221355f..cce00ed2d 100644 --- a/crates/rayexec_execution/src/functions/mod.rs +++ b/crates/rayexec_execution/src/functions/mod.rs @@ -12,7 +12,7 @@ use std::fmt::Display; use documentation::Documentation; use fmtutil::IntoDisplayableSlice; use implicit::{implicit_cast_score, NO_CAST_SCORE}; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_error::{RayexecError, Result}; /// Function signature. @@ -68,7 +68,7 @@ impl Signature { } /// Return if inputs given data types exactly satisfy the signature. - fn exact_match(&self, inputs: &[DataType]) -> bool { + fn exact_match(&self, inputs: &[DataTypeOld]) -> bool { if self.positional_args.len() != inputs.len() && !self.is_variadic() { return false; } @@ -141,7 +141,7 @@ pub trait FunctionInfo { /// Get the signature for a function if it's an exact match for the inputs. /// /// If there are no exact signatures for these types, None will be retuned. - fn exact_signature(&self, inputs: &[DataType]) -> Option<&Signature> { + fn exact_signature(&self, inputs: &[DataTypeOld]) -> Option<&Signature> { self.signatures().iter().find(|sig| sig.exact_match(inputs)) } @@ -152,7 +152,7 @@ pub trait FunctionInfo { /// /// Candidates are returned in sorted order with the highest cast score /// being first. - fn candidate(&self, inputs: &[DataType]) -> Vec { + fn candidate(&self, inputs: &[DataTypeOld]) -> Vec { CandidateSignature::find_candidates(inputs, self.signatures()) } } @@ -188,7 +188,7 @@ impl CandidateSignature { /// /// This will return a sorted vec where the first element is the candidate /// with the highest score. - fn find_candidates(inputs: &[DataType], sigs: &[Signature]) -> Vec { + fn find_candidates(inputs: &[DataTypeOld], sigs: &[Signature]) -> Vec { let mut candidates = Vec::new(); let mut buf = Vec::new(); @@ -223,7 +223,7 @@ impl CandidateSignature { /// /// Returns true if everything is able to be implicitly cast, false otherwise. fn compare_and_fill_types( - have: &[DataType], + have: &[DataTypeOld], want: &[DataTypeId], variadic: Option, buf: &mut Vec, @@ -293,7 +293,7 @@ impl CandidateSignature { /// Get the best common data type that we can cast to for the given inputs. Returns None /// if there isn't a common data type. - fn best_datatype_for_variadic_any(inputs: &[DataType]) -> Option { + fn best_datatype_for_variadic_any(inputs: &[DataTypeOld]) -> Option { let mut best_type = None; let mut best_total_score = 0; @@ -369,7 +369,7 @@ pub fn plan_check_num_args_one_of( // TODO: Include valid signatures in the error pub fn invalid_input_types_error(func: &impl FunctionInfo, got: &[T]) -> RayexecError where - T: Borrow + Display, + T: Borrow + Display, { // TODO: Include relevant valid signatures. What "relevant" means and how we // determine that is stil tbd. @@ -386,7 +386,7 @@ mod tests { #[test] fn find_candidate_no_match() { - let inputs = &[DataType::Int64]; + let inputs = &[DataTypeOld::Int64]; let sigs = &[Signature { positional_args: &[DataTypeId::List], variadic_arg: None, @@ -401,7 +401,7 @@ mod tests { #[test] fn find_candidate_simple_no_variadic() { - let inputs = &[DataType::Int64]; + let inputs = &[DataTypeOld::Int64]; let sigs = &[Signature { positional_args: &[DataTypeId::Int64], variadic_arg: None, @@ -420,7 +420,7 @@ mod tests { #[test] fn find_candidate_simple_with_variadic() { - let inputs = &[DataType::Int64, DataType::Int64, DataType::Int64]; + let inputs = &[DataTypeOld::Int64, DataTypeOld::Int64, DataTypeOld::Int64]; let sigs = &[Signature { positional_args: &[], variadic_arg: Some(DataTypeId::Any), @@ -443,14 +443,18 @@ mod tests { #[test] fn best_datatype_for_ints_and_floats() { - let inputs = &[DataType::Int64, DataType::Float64, DataType::Int64]; + let inputs = &[DataTypeOld::Int64, DataTypeOld::Float64, DataTypeOld::Int64]; let best = CandidateSignature::best_datatype_for_variadic_any(inputs); assert_eq!(Some(DataTypeId::Float64), best); } #[test] fn best_datatype_for_floats() { - let inputs = &[DataType::Float64, DataType::Float64, DataType::Float64]; + let inputs = &[ + DataTypeOld::Float64, + DataTypeOld::Float64, + DataTypeOld::Float64, + ]; let best = CandidateSignature::best_datatype_for_variadic_any(inputs); assert_eq!(Some(DataTypeId::Float64), best); } diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/arith/add.rs b/crates/rayexec_execution/src/functions/scalar/builtin/arith/add.rs index 8652c59cc..0e145e0c0 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/arith/add.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/arith/add.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use std::marker::PhantomData; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::{ PhysicalF16Old, @@ -99,79 +99,79 @@ impl ScalarFunction for Add { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float16, DataType::Float16) => ( - Box::new(AddImpl::::new(DataType::Float16)), - DataType::Float16, + (DataTypeOld::Float16, DataTypeOld::Float16) => ( + Box::new(AddImpl::::new(DataTypeOld::Float16)), + DataTypeOld::Float16, ), - (DataType::Float32, DataType::Float32) => ( - Box::new(AddImpl::::new(DataType::Float32)), - DataType::Float32, + (DataTypeOld::Float32, DataTypeOld::Float32) => ( + Box::new(AddImpl::::new(DataTypeOld::Float32)), + DataTypeOld::Float32, ), - (DataType::Float64, DataType::Float64) => ( - Box::new(AddImpl::::new(DataType::Float64)), - DataType::Float64, + (DataTypeOld::Float64, DataTypeOld::Float64) => ( + Box::new(AddImpl::::new(DataTypeOld::Float64)), + DataTypeOld::Float64, ), - (DataType::Int8, DataType::Int8) => ( - Box::new(AddImpl::::new(DataType::Int8)), - DataType::Int8, + (DataTypeOld::Int8, DataTypeOld::Int8) => ( + Box::new(AddImpl::::new(DataTypeOld::Int8)), + DataTypeOld::Int8, ), - (DataType::Int16, DataType::Int16) => ( - Box::new(AddImpl::::new(DataType::Int16)), - DataType::Int16, + (DataTypeOld::Int16, DataTypeOld::Int16) => ( + Box::new(AddImpl::::new(DataTypeOld::Int16)), + DataTypeOld::Int16, ), - (DataType::Int32, DataType::Int32) => ( - Box::new(AddImpl::::new(DataType::Int32)), - DataType::Int32, + (DataTypeOld::Int32, DataTypeOld::Int32) => ( + Box::new(AddImpl::::new(DataTypeOld::Int32)), + DataTypeOld::Int32, ), - (DataType::Int64, DataType::Int64) => ( - Box::new(AddImpl::::new(DataType::Int64)), - DataType::Int64, + (DataTypeOld::Int64, DataTypeOld::Int64) => ( + Box::new(AddImpl::::new(DataTypeOld::Int64)), + DataTypeOld::Int64, ), - (DataType::Int128, DataType::Int128) => ( - Box::new(AddImpl::::new(DataType::Int128)), - DataType::Int128, + (DataTypeOld::Int128, DataTypeOld::Int128) => ( + Box::new(AddImpl::::new(DataTypeOld::Int128)), + DataTypeOld::Int128, ), - (DataType::UInt8, DataType::UInt8) => ( - Box::new(AddImpl::::new(DataType::UInt8)), - DataType::UInt8, + (DataTypeOld::UInt8, DataTypeOld::UInt8) => ( + Box::new(AddImpl::::new(DataTypeOld::UInt8)), + DataTypeOld::UInt8, ), - (DataType::UInt16, DataType::UInt16) => ( - Box::new(AddImpl::::new(DataType::UInt16)), - DataType::UInt16, + (DataTypeOld::UInt16, DataTypeOld::UInt16) => ( + Box::new(AddImpl::::new(DataTypeOld::UInt16)), + DataTypeOld::UInt16, ), - (DataType::UInt32, DataType::UInt32) => ( - Box::new(AddImpl::::new(DataType::UInt32)), - DataType::UInt32, + (DataTypeOld::UInt32, DataTypeOld::UInt32) => ( + Box::new(AddImpl::::new(DataTypeOld::UInt32)), + DataTypeOld::UInt32, ), - (DataType::UInt64, DataType::UInt64) => ( - Box::new(AddImpl::::new(DataType::UInt64)), - DataType::UInt64, + (DataTypeOld::UInt64, DataTypeOld::UInt64) => ( + Box::new(AddImpl::::new(DataTypeOld::UInt64)), + DataTypeOld::UInt64, ), - (DataType::UInt128, DataType::UInt128) => ( - Box::new(AddImpl::::new(DataType::UInt128)), - DataType::UInt128, + (DataTypeOld::UInt128, DataTypeOld::UInt128) => ( + Box::new(AddImpl::::new(DataTypeOld::UInt128)), + DataTypeOld::UInt128, ), // TODO: Split out decimal (for scaling) - datatypes @ (DataType::Decimal64(_), DataType::Decimal64(_)) => ( + datatypes @ (DataTypeOld::Decimal64(_), DataTypeOld::Decimal64(_)) => ( Box::new(AddImpl::::new(datatypes.0.clone())), datatypes.0, ), - datatypes @ (DataType::Decimal128(_), DataType::Decimal128(_)) => ( + datatypes @ (DataTypeOld::Decimal128(_), DataTypeOld::Decimal128(_)) => ( Box::new(AddImpl::::new(datatypes.0.clone())), datatypes.0, ), // Date + days - (DataType::Date32, DataType::Int32) => ( - Box::new(AddImpl::::new(DataType::Date32)), - DataType::Date32, + (DataTypeOld::Date32, DataTypeOld::Int32) => ( + Box::new(AddImpl::::new(DataTypeOld::Date32)), + DataTypeOld::Date32, ), // Days + date // Note both are represented as i32 physical type, we don't need to worry about flipping the sides. - (DataType::Int32, DataType::Date32) => ( - Box::new(AddImpl::::new(DataType::Date32)), - DataType::Date32, + (DataTypeOld::Int32, DataTypeOld::Date32) => ( + Box::new(AddImpl::::new(DataTypeOld::Date32)), + DataTypeOld::Date32, ), // TODO: Interval @@ -189,12 +189,12 @@ impl ScalarFunction for Add { #[derive(Debug, Clone)] pub struct AddImpl { - datatype: DataType, + datatype: DataTypeOld, _s: PhantomData, } impl AddImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { AddImpl { datatype, _s: PhantomData, @@ -208,7 +208,7 @@ where for<'a> S::Type<'a>: std::ops::Add> + Default + Copy, ArrayData: From>>, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let a = inputs[0]; let b = inputs[1]; @@ -223,7 +223,7 @@ where #[cfg(test)] mod tests { - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use super::*; use crate::expr; @@ -238,7 +238,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -250,7 +250,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([5, 7, 9]); assert_eq!(expected, out); diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/arith/div.rs b/crates/rayexec_execution/src/functions/scalar/builtin/arith/div.rs index b635a628d..e19fcecae 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/arith/div.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/arith/div.rs @@ -4,7 +4,7 @@ use std::marker::PhantomData; use rayexec_bullet::array::{ArrayData, ArrayOld}; use rayexec_bullet::compute::cast::array::cast_decimal_to_float; use rayexec_bullet::compute::cast::behavior::CastFailBehavior; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::{ PhysicalF16Old, @@ -105,67 +105,67 @@ impl ScalarFunction for Div { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float16, DataType::Float16) => ( - Box::new(DivImpl::::new(DataType::Float16)), - DataType::Float16, + (DataTypeOld::Float16, DataTypeOld::Float16) => ( + Box::new(DivImpl::::new(DataTypeOld::Float16)), + DataTypeOld::Float16, ), - (DataType::Float32, DataType::Float32) => ( - Box::new(DivImpl::::new(DataType::Float32)), - DataType::Float32, + (DataTypeOld::Float32, DataTypeOld::Float32) => ( + Box::new(DivImpl::::new(DataTypeOld::Float32)), + DataTypeOld::Float32, ), - (DataType::Float64, DataType::Float64) => ( - Box::new(DivImpl::::new(DataType::Float64)), - DataType::Float64, + (DataTypeOld::Float64, DataTypeOld::Float64) => ( + Box::new(DivImpl::::new(DataTypeOld::Float64)), + DataTypeOld::Float64, ), - (DataType::Int8, DataType::Int8) => ( - Box::new(DivImpl::::new(DataType::Int8)), - DataType::Int8, + (DataTypeOld::Int8, DataTypeOld::Int8) => ( + Box::new(DivImpl::::new(DataTypeOld::Int8)), + DataTypeOld::Int8, ), - (DataType::Int16, DataType::Int16) => ( - Box::new(DivImpl::::new(DataType::Int16)), - DataType::Int16, + (DataTypeOld::Int16, DataTypeOld::Int16) => ( + Box::new(DivImpl::::new(DataTypeOld::Int16)), + DataTypeOld::Int16, ), - (DataType::Int32, DataType::Int32) => ( - Box::new(DivImpl::::new(DataType::Int32)), - DataType::Int32, + (DataTypeOld::Int32, DataTypeOld::Int32) => ( + Box::new(DivImpl::::new(DataTypeOld::Int32)), + DataTypeOld::Int32, ), - (DataType::Int64, DataType::Int64) => ( - Box::new(DivImpl::::new(DataType::Int64)), - DataType::Int64, + (DataTypeOld::Int64, DataTypeOld::Int64) => ( + Box::new(DivImpl::::new(DataTypeOld::Int64)), + DataTypeOld::Int64, ), - (DataType::Int128, DataType::Int128) => ( - Box::new(DivImpl::::new(DataType::Int128)), - DataType::Int128, + (DataTypeOld::Int128, DataTypeOld::Int128) => ( + Box::new(DivImpl::::new(DataTypeOld::Int128)), + DataTypeOld::Int128, ), - (DataType::UInt8, DataType::UInt8) => ( - Box::new(DivImpl::::new(DataType::UInt8)), - DataType::UInt8, + (DataTypeOld::UInt8, DataTypeOld::UInt8) => ( + Box::new(DivImpl::::new(DataTypeOld::UInt8)), + DataTypeOld::UInt8, ), - (DataType::UInt16, DataType::UInt16) => ( - Box::new(DivImpl::::new(DataType::UInt16)), - DataType::UInt16, + (DataTypeOld::UInt16, DataTypeOld::UInt16) => ( + Box::new(DivImpl::::new(DataTypeOld::UInt16)), + DataTypeOld::UInt16, ), - (DataType::UInt32, DataType::UInt32) => ( - Box::new(DivImpl::::new(DataType::UInt32)), - DataType::UInt32, + (DataTypeOld::UInt32, DataTypeOld::UInt32) => ( + Box::new(DivImpl::::new(DataTypeOld::UInt32)), + DataTypeOld::UInt32, ), - (DataType::UInt64, DataType::UInt64) => ( - Box::new(DivImpl::::new(DataType::UInt64)), - DataType::UInt64, + (DataTypeOld::UInt64, DataTypeOld::UInt64) => ( + Box::new(DivImpl::::new(DataTypeOld::UInt64)), + DataTypeOld::UInt64, ), - (DataType::UInt128, DataType::UInt128) => ( - Box::new(DivImpl::::new(DataType::UInt128)), - DataType::UInt128, + (DataTypeOld::UInt128, DataTypeOld::UInt128) => ( + Box::new(DivImpl::::new(DataTypeOld::UInt128)), + DataTypeOld::UInt128, ), // Decimals - (DataType::Decimal64(_), DataType::Decimal64(_)) => ( + (DataTypeOld::Decimal64(_), DataTypeOld::Decimal64(_)) => ( Box::new(DecimalDivImpl::::new()), - DataType::Float64, + DataTypeOld::Float64, ), - (DataType::Decimal128(_), DataType::Decimal128(_)) => ( + (DataTypeOld::Decimal128(_), DataTypeOld::Decimal128(_)) => ( Box::new(DecimalDivImpl::::new()), - DataType::Float64, + DataTypeOld::Float64, ), // TODO: Interval, dates @@ -198,23 +198,23 @@ impl ScalarFunctionImpl for DecimalDivImpl where D: DecimalType, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let a = inputs[0]; let b = inputs[1]; let a = cast_decimal_to_float::( a, - DataType::Float64, + DataTypeOld::Float64, CastFailBehavior::Error, )?; let b = cast_decimal_to_float::( b, - DataType::Float64, + DataTypeOld::Float64, CastFailBehavior::Error, )?; let builder = ArrayBuilder { - datatype: DataType::Float64, + datatype: DataTypeOld::Float64, buffer: PrimitiveBuffer::with_len(a.logical_len()), }; @@ -229,12 +229,12 @@ where #[derive(Debug, Clone)] pub struct DivImpl { - datatype: DataType, + datatype: DataTypeOld, _s: PhantomData, } impl DivImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { DivImpl { datatype, _s: PhantomData, @@ -248,7 +248,7 @@ where for<'a> S::Type<'a>: std::ops::Div> + Default + Copy, ArrayData: From>>, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let a = inputs[0]; let b = inputs[1]; @@ -263,7 +263,7 @@ where #[cfg(test)] mod tests { - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use super::*; use crate::expr; @@ -278,7 +278,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -290,7 +290,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([4, 2, 2]); assert_eq!(expected, out); diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/arith/mul.rs b/crates/rayexec_execution/src/functions/scalar/builtin/arith/mul.rs index 77c64995c..ef15d7a7a 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/arith/mul.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/arith/mul.rs @@ -3,7 +3,7 @@ use std::marker::PhantomData; use num_traits::{NumCast, PrimInt}; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::{DataType, DataTypeId, DecimalTypeMeta}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld, DecimalTypeMeta}; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::{ PhysicalF16Old, @@ -116,76 +116,76 @@ impl ScalarFunction for Mul { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float16, DataType::Float16) => ( - Box::new(MulImpl::::new(DataType::Float16)), - DataType::Float16, + (DataTypeOld::Float16, DataTypeOld::Float16) => ( + Box::new(MulImpl::::new(DataTypeOld::Float16)), + DataTypeOld::Float16, ), - (DataType::Float32, DataType::Float32) => ( - Box::new(MulImpl::::new(DataType::Float32)), - DataType::Float32, + (DataTypeOld::Float32, DataTypeOld::Float32) => ( + Box::new(MulImpl::::new(DataTypeOld::Float32)), + DataTypeOld::Float32, ), - (DataType::Float64, DataType::Float64) => ( - Box::new(MulImpl::::new(DataType::Float64)), - DataType::Float64, + (DataTypeOld::Float64, DataTypeOld::Float64) => ( + Box::new(MulImpl::::new(DataTypeOld::Float64)), + DataTypeOld::Float64, ), - (DataType::Int8, DataType::Int8) => ( - Box::new(MulImpl::::new(DataType::Int8)), - DataType::Int8, + (DataTypeOld::Int8, DataTypeOld::Int8) => ( + Box::new(MulImpl::::new(DataTypeOld::Int8)), + DataTypeOld::Int8, ), - (DataType::Int16, DataType::Int16) => ( - Box::new(MulImpl::::new(DataType::Int16)), - DataType::Int16, + (DataTypeOld::Int16, DataTypeOld::Int16) => ( + Box::new(MulImpl::::new(DataTypeOld::Int16)), + DataTypeOld::Int16, ), - (DataType::Int32, DataType::Int32) => ( - Box::new(MulImpl::::new(DataType::Int32)), - DataType::Int32, + (DataTypeOld::Int32, DataTypeOld::Int32) => ( + Box::new(MulImpl::::new(DataTypeOld::Int32)), + DataTypeOld::Int32, ), - (DataType::Int64, DataType::Int64) => ( - Box::new(MulImpl::::new(DataType::Int64)), - DataType::Int64, + (DataTypeOld::Int64, DataTypeOld::Int64) => ( + Box::new(MulImpl::::new(DataTypeOld::Int64)), + DataTypeOld::Int64, ), - (DataType::Int128, DataType::Int128) => ( - Box::new(MulImpl::::new(DataType::Int128)), - DataType::Int128, + (DataTypeOld::Int128, DataTypeOld::Int128) => ( + Box::new(MulImpl::::new(DataTypeOld::Int128)), + DataTypeOld::Int128, ), - (DataType::UInt8, DataType::UInt8) => ( - Box::new(MulImpl::::new(DataType::UInt8)), - DataType::UInt8, + (DataTypeOld::UInt8, DataTypeOld::UInt8) => ( + Box::new(MulImpl::::new(DataTypeOld::UInt8)), + DataTypeOld::UInt8, ), - (DataType::UInt16, DataType::UInt16) => ( - Box::new(MulImpl::::new(DataType::UInt16)), - DataType::UInt16, + (DataTypeOld::UInt16, DataTypeOld::UInt16) => ( + Box::new(MulImpl::::new(DataTypeOld::UInt16)), + DataTypeOld::UInt16, ), - (DataType::UInt32, DataType::UInt32) => ( - Box::new(MulImpl::::new(DataType::UInt32)), - DataType::UInt32, + (DataTypeOld::UInt32, DataTypeOld::UInt32) => ( + Box::new(MulImpl::::new(DataTypeOld::UInt32)), + DataTypeOld::UInt32, ), - (DataType::UInt64, DataType::UInt64) => ( - Box::new(MulImpl::::new(DataType::UInt64)), - DataType::UInt64, + (DataTypeOld::UInt64, DataTypeOld::UInt64) => ( + Box::new(MulImpl::::new(DataTypeOld::UInt64)), + DataTypeOld::UInt64, ), - (DataType::UInt128, DataType::UInt128) => ( - Box::new(MulImpl::::new(DataType::UInt128)), - DataType::UInt128, + (DataTypeOld::UInt128, DataTypeOld::UInt128) => ( + Box::new(MulImpl::::new(DataTypeOld::UInt128)), + DataTypeOld::UInt128, ), // Decimal - (DataType::Decimal64(a), DataType::Decimal64(b)) => { + (DataTypeOld::Decimal64(a), DataTypeOld::Decimal64(b)) => { // Since we're multiplying, might as well go wide as possible. // Eventually we'll want to bumpt up to 128 if the precision is // over some threshold to be more resilient to overflows. let precision = Decimal64Type::MAX_PRECISION; let scale = a.scale + b.scale; - let return_type = DataType::Decimal64(DecimalTypeMeta { precision, scale }); + let return_type = DataTypeOld::Decimal64(DecimalTypeMeta { precision, scale }); ( Box::new(DecimalMulImpl::::new(return_type.clone())), return_type, ) } - (DataType::Decimal128(a), DataType::Decimal128(b)) => { + (DataTypeOld::Decimal128(a), DataTypeOld::Decimal128(b)) => { let precision = Decimal128Type::MAX_PRECISION; let scale = a.scale + b.scale; - let return_type = DataType::Decimal128(DecimalTypeMeta { precision, scale }); + let return_type = DataTypeOld::Decimal128(DecimalTypeMeta { precision, scale }); ( Box::new(DecimalMulImpl::::new(return_type.clone())), return_type, @@ -193,21 +193,21 @@ impl ScalarFunction for Mul { } // Interval - (DataType::Interval, DataType::Int32) => ( + (DataTypeOld::Interval, DataTypeOld::Int32) => ( Box::new(IntervalMulImpl::::new()), - DataType::Interval, + DataTypeOld::Interval, ), - (DataType::Interval, DataType::Int64) => ( + (DataTypeOld::Interval, DataTypeOld::Int64) => ( Box::new(IntervalMulImpl::::new()), - DataType::Interval, + DataTypeOld::Interval, ), - (DataType::Int32, DataType::Interval) => ( + (DataTypeOld::Int32, DataTypeOld::Interval) => ( Box::new(IntervalMulImpl::::new()), - DataType::Interval, + DataTypeOld::Interval, ), - (DataType::Int64, DataType::Interval) => ( + (DataTypeOld::Int64, DataTypeOld::Interval) => ( Box::new(IntervalMulImpl::::new()), - DataType::Interval, + DataTypeOld::Interval, ), // TODO: Date @@ -239,7 +239,7 @@ where Rhs: PhysicalStorageOld, for<'a> Rhs::Type<'a>: PrimInt, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let (lhs, rhs) = if LHS_RHS_FLIPPED { (inputs[1], inputs[0]) } else { @@ -247,7 +247,7 @@ where }; let builder = ArrayBuilder { - datatype: DataType::Interval, + datatype: DataTypeOld::Interval, buffer: PrimitiveBuffer::::with_len(lhs.logical_len()), }; @@ -264,12 +264,12 @@ where #[derive(Debug, Clone)] pub struct DecimalMulImpl { - datatype: DataType, + datatype: DataTypeOld, _d: PhantomData, } impl DecimalMulImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { DecimalMulImpl { datatype, _d: PhantomData, @@ -282,7 +282,7 @@ where D: DecimalType, ArrayData: From>, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let a = inputs[0]; let b = inputs[1]; @@ -299,12 +299,12 @@ where #[derive(Debug, Clone)] pub struct MulImpl { - datatype: DataType, + datatype: DataTypeOld, _s: PhantomData, } impl MulImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { MulImpl { datatype, _s: PhantomData, @@ -318,7 +318,7 @@ where for<'a> S::Type<'a>: std::ops::Mul> + Default + Copy, ArrayData: From>>, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let a = inputs[0]; let b = inputs[1]; @@ -333,7 +333,7 @@ where #[cfg(test)] mod tests { - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use super::*; use crate::expr; @@ -348,7 +348,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -360,7 +360,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([4, 10, 18]); assert_eq!(expected, out); diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/arith/rem.rs b/crates/rayexec_execution/src/functions/scalar/builtin/arith/rem.rs index 0c8f45d0f..833332d15 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/arith/rem.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/arith/rem.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use std::marker::PhantomData; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::{ PhysicalF16Old, @@ -113,57 +113,57 @@ impl ScalarFunction for Rem { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float16, DataType::Float16) => ( - Box::new(RemImpl::::new(DataType::Float16)), - DataType::Float16, + (DataTypeOld::Float16, DataTypeOld::Float16) => ( + Box::new(RemImpl::::new(DataTypeOld::Float16)), + DataTypeOld::Float16, ), - (DataType::Float32, DataType::Float32) => ( - Box::new(RemImpl::::new(DataType::Float32)), - DataType::Float32, + (DataTypeOld::Float32, DataTypeOld::Float32) => ( + Box::new(RemImpl::::new(DataTypeOld::Float32)), + DataTypeOld::Float32, ), - (DataType::Float64, DataType::Float64) => ( - Box::new(RemImpl::::new(DataType::Float64)), - DataType::Float64, + (DataTypeOld::Float64, DataTypeOld::Float64) => ( + Box::new(RemImpl::::new(DataTypeOld::Float64)), + DataTypeOld::Float64, ), - (DataType::Int8, DataType::Int8) => ( - Box::new(RemImpl::::new(DataType::Int8)), - DataType::Int8, + (DataTypeOld::Int8, DataTypeOld::Int8) => ( + Box::new(RemImpl::::new(DataTypeOld::Int8)), + DataTypeOld::Int8, ), - (DataType::Int16, DataType::Int16) => ( - Box::new(RemImpl::::new(DataType::Int16)), - DataType::Int16, + (DataTypeOld::Int16, DataTypeOld::Int16) => ( + Box::new(RemImpl::::new(DataTypeOld::Int16)), + DataTypeOld::Int16, ), - (DataType::Int32, DataType::Int32) => ( - Box::new(RemImpl::::new(DataType::Int32)), - DataType::Int32, + (DataTypeOld::Int32, DataTypeOld::Int32) => ( + Box::new(RemImpl::::new(DataTypeOld::Int32)), + DataTypeOld::Int32, ), - (DataType::Int64, DataType::Int64) => ( - Box::new(RemImpl::::new(DataType::Int64)), - DataType::Int64, + (DataTypeOld::Int64, DataTypeOld::Int64) => ( + Box::new(RemImpl::::new(DataTypeOld::Int64)), + DataTypeOld::Int64, ), - (DataType::Int128, DataType::Int128) => ( - Box::new(RemImpl::::new(DataType::Int128)), - DataType::Int128, + (DataTypeOld::Int128, DataTypeOld::Int128) => ( + Box::new(RemImpl::::new(DataTypeOld::Int128)), + DataTypeOld::Int128, ), - (DataType::UInt8, DataType::UInt8) => ( - Box::new(RemImpl::::new(DataType::UInt8)), - DataType::UInt8, + (DataTypeOld::UInt8, DataTypeOld::UInt8) => ( + Box::new(RemImpl::::new(DataTypeOld::UInt8)), + DataTypeOld::UInt8, ), - (DataType::UInt16, DataType::UInt16) => ( - Box::new(RemImpl::::new(DataType::UInt16)), - DataType::UInt16, + (DataTypeOld::UInt16, DataTypeOld::UInt16) => ( + Box::new(RemImpl::::new(DataTypeOld::UInt16)), + DataTypeOld::UInt16, ), - (DataType::UInt32, DataType::UInt32) => ( - Box::new(RemImpl::::new(DataType::UInt32)), - DataType::UInt32, + (DataTypeOld::UInt32, DataTypeOld::UInt32) => ( + Box::new(RemImpl::::new(DataTypeOld::UInt32)), + DataTypeOld::UInt32, ), - (DataType::UInt64, DataType::UInt64) => ( - Box::new(RemImpl::::new(DataType::UInt64)), - DataType::UInt64, + (DataTypeOld::UInt64, DataTypeOld::UInt64) => ( + Box::new(RemImpl::::new(DataTypeOld::UInt64)), + DataTypeOld::UInt64, ), - (DataType::UInt128, DataType::UInt128) => ( - Box::new(RemImpl::::new(DataType::UInt128)), - DataType::UInt128, + (DataTypeOld::UInt128, DataTypeOld::UInt128) => ( + Box::new(RemImpl::::new(DataTypeOld::UInt128)), + DataTypeOld::UInt128, ), // TODO: Interval, date, decimal @@ -181,12 +181,12 @@ impl ScalarFunction for Rem { #[derive(Debug, Clone)] pub struct RemImpl { - datatype: DataType, + datatype: DataTypeOld, _s: PhantomData, } impl RemImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { RemImpl { datatype, _s: PhantomData, @@ -200,7 +200,7 @@ where for<'a> S::Type<'a>: std::ops::Rem> + Default + Copy, ArrayData: From>>, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let a = inputs[0]; let b = inputs[1]; @@ -215,7 +215,7 @@ where #[cfg(test)] mod tests { - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use super::*; use crate::expr; @@ -230,7 +230,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -242,7 +242,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([0, 1, 0]); assert_eq!(expected, out); diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/arith/sub.rs b/crates/rayexec_execution/src/functions/scalar/builtin/arith/sub.rs index 1b41fe0f9..e5306157a 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/arith/sub.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/arith/sub.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use std::marker::PhantomData; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::{ PhysicalF16Old, @@ -112,73 +112,73 @@ impl ScalarFunction for Sub { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Float16, DataType::Float16) => ( - Box::new(SubImpl::::new(DataType::Float16)), - DataType::Float16, + (DataTypeOld::Float16, DataTypeOld::Float16) => ( + Box::new(SubImpl::::new(DataTypeOld::Float16)), + DataTypeOld::Float16, ), - (DataType::Float32, DataType::Float32) => ( - Box::new(SubImpl::::new(DataType::Float32)), - DataType::Float32, + (DataTypeOld::Float32, DataTypeOld::Float32) => ( + Box::new(SubImpl::::new(DataTypeOld::Float32)), + DataTypeOld::Float32, ), - (DataType::Float64, DataType::Float64) => ( - Box::new(SubImpl::::new(DataType::Float64)), - DataType::Float64, + (DataTypeOld::Float64, DataTypeOld::Float64) => ( + Box::new(SubImpl::::new(DataTypeOld::Float64)), + DataTypeOld::Float64, ), - (DataType::Int8, DataType::Int8) => ( - Box::new(SubImpl::::new(DataType::Int8)), - DataType::Int8, + (DataTypeOld::Int8, DataTypeOld::Int8) => ( + Box::new(SubImpl::::new(DataTypeOld::Int8)), + DataTypeOld::Int8, ), - (DataType::Int16, DataType::Int16) => ( - Box::new(SubImpl::::new(DataType::Int16)), - DataType::Int16, + (DataTypeOld::Int16, DataTypeOld::Int16) => ( + Box::new(SubImpl::::new(DataTypeOld::Int16)), + DataTypeOld::Int16, ), - (DataType::Int32, DataType::Int32) => ( - Box::new(SubImpl::::new(DataType::Int32)), - DataType::Int32, + (DataTypeOld::Int32, DataTypeOld::Int32) => ( + Box::new(SubImpl::::new(DataTypeOld::Int32)), + DataTypeOld::Int32, ), - (DataType::Int64, DataType::Int64) => ( - Box::new(SubImpl::::new(DataType::Int64)), - DataType::Int64, + (DataTypeOld::Int64, DataTypeOld::Int64) => ( + Box::new(SubImpl::::new(DataTypeOld::Int64)), + DataTypeOld::Int64, ), - (DataType::Int128, DataType::Int128) => ( - Box::new(SubImpl::::new(DataType::Int128)), - DataType::Int128, + (DataTypeOld::Int128, DataTypeOld::Int128) => ( + Box::new(SubImpl::::new(DataTypeOld::Int128)), + DataTypeOld::Int128, ), - (DataType::UInt8, DataType::UInt8) => ( - Box::new(SubImpl::::new(DataType::UInt8)), - DataType::UInt8, + (DataTypeOld::UInt8, DataTypeOld::UInt8) => ( + Box::new(SubImpl::::new(DataTypeOld::UInt8)), + DataTypeOld::UInt8, ), - (DataType::UInt16, DataType::UInt16) => ( - Box::new(SubImpl::::new(DataType::UInt16)), - DataType::UInt16, + (DataTypeOld::UInt16, DataTypeOld::UInt16) => ( + Box::new(SubImpl::::new(DataTypeOld::UInt16)), + DataTypeOld::UInt16, ), - (DataType::UInt32, DataType::UInt32) => ( - Box::new(SubImpl::::new(DataType::UInt32)), - DataType::UInt32, + (DataTypeOld::UInt32, DataTypeOld::UInt32) => ( + Box::new(SubImpl::::new(DataTypeOld::UInt32)), + DataTypeOld::UInt32, ), - (DataType::UInt64, DataType::UInt64) => ( - Box::new(SubImpl::::new(DataType::UInt64)), - DataType::UInt64, + (DataTypeOld::UInt64, DataTypeOld::UInt64) => ( + Box::new(SubImpl::::new(DataTypeOld::UInt64)), + DataTypeOld::UInt64, ), - (DataType::UInt128, DataType::UInt128) => ( - Box::new(SubImpl::::new(DataType::UInt128)), - DataType::UInt128, + (DataTypeOld::UInt128, DataTypeOld::UInt128) => ( + Box::new(SubImpl::::new(DataTypeOld::UInt128)), + DataTypeOld::UInt128, ), // TODO: Split out decimal (for scaling) - datatypes @ (DataType::Decimal64(_), DataType::Decimal64(_)) => ( + datatypes @ (DataTypeOld::Decimal64(_), DataTypeOld::Decimal64(_)) => ( Box::new(SubImpl::::new(datatypes.0.clone())), datatypes.0, ), - datatypes @ (DataType::Decimal128(_), DataType::Decimal128(_)) => ( + datatypes @ (DataTypeOld::Decimal128(_), DataTypeOld::Decimal128(_)) => ( Box::new(SubImpl::::new(datatypes.0.clone())), datatypes.0, ), // Date + days - (DataType::Date32, DataType::Int32) => ( - Box::new(SubImpl::::new(DataType::Date32)), - DataType::Date32, + (DataTypeOld::Date32, DataTypeOld::Int32) => ( + Box::new(SubImpl::::new(DataTypeOld::Date32)), + DataTypeOld::Date32, ), // TODO: Interval @@ -196,12 +196,12 @@ impl ScalarFunction for Sub { #[derive(Debug, Clone)] pub struct SubImpl { - datatype: DataType, + datatype: DataTypeOld, _s: PhantomData, } impl SubImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { SubImpl { datatype, _s: PhantomData, @@ -215,7 +215,7 @@ where for<'a> S::Type<'a>: std::ops::Sub> + Default + Copy, ArrayData: From>>, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let a = inputs[0]; let b = inputs[1]; @@ -230,7 +230,7 @@ where #[cfg(test)] mod tests { - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use super::*; use crate::expr; @@ -245,7 +245,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -257,7 +257,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([3, 3, 3]); assert_eq!(expected, out); diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/boolean.rs b/crates/rayexec_execution/src/functions/scalar/builtin/boolean.rs index 84497d2df..08e6833ce 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/boolean.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/boolean.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use rayexec_bullet::array::ArrayOld; use rayexec_bullet::bitmap::Bitmap; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, BooleanBuffer}; use rayexec_bullet::executor::physical_type::PhysicalBoolOld; use rayexec_bullet::executor::scalar::{BinaryExecutor, TernaryExecutor, UniformExecutor}; @@ -53,13 +53,13 @@ impl ScalarFunction for And { .map(|input| input.datatype(table_list)) .collect::>>()?; - if !datatypes.iter().all(|dt| dt == &DataType::Boolean) { + if !datatypes.iter().all(|dt| dt == &DataTypeOld::Boolean) { return Err(invalid_input_types_error(self, &datatypes)); } Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl: Box::new(AndImpl), }) @@ -70,11 +70,11 @@ impl ScalarFunction for And { pub struct AndImpl; impl ScalarFunctionImpl for AndImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { match inputs.len() { 0 => { let mut array = ArrayOld::new_with_array_data( - DataType::Boolean, + DataTypeOld::Boolean, BooleanStorage::from(Bitmap::new_with_val(false, 1)), ); array.set_physical_validity(0, false); @@ -88,7 +88,7 @@ impl ScalarFunctionImpl for AndImpl { a, b, ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(a.logical_len()), }, |a, b, buf| buf.put(&(a && b)), @@ -103,7 +103,7 @@ impl ScalarFunctionImpl for AndImpl { b, c, ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(a.logical_len()), }, |a, b, c, buf| buf.put(&(a && b && c)), @@ -114,7 +114,7 @@ impl ScalarFunctionImpl for AndImpl { UniformExecutor::execute::( inputs, ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(len), }, |bools, buf| buf.put(&(bools.iter().all(|b| *b))), @@ -161,13 +161,13 @@ impl ScalarFunction for Or { .map(|input| input.datatype(table_list)) .collect::>>()?; - if !datatypes.iter().all(|dt| dt == &DataType::Boolean) { + if !datatypes.iter().all(|dt| dt == &DataTypeOld::Boolean) { return Err(invalid_input_types_error(self, &datatypes)); } Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl: Box::new(OrImpl), }) @@ -178,11 +178,11 @@ impl ScalarFunction for Or { pub struct OrImpl; impl ScalarFunctionImpl for OrImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { match inputs.len() { 0 => { let mut array = ArrayOld::new_with_array_data( - DataType::Boolean, + DataTypeOld::Boolean, BooleanStorage::from(Bitmap::new_with_val(false, 1)), ); array.set_physical_validity(0, false); @@ -196,7 +196,7 @@ impl ScalarFunctionImpl for OrImpl { a, b, ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(a.logical_len()), }, |a, b, buf| buf.put(&(a || b)), @@ -207,7 +207,7 @@ impl ScalarFunctionImpl for OrImpl { UniformExecutor::execute::( inputs, ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(len), }, |bools, buf| buf.put(&(bools.iter().any(|b| *b))), @@ -233,7 +233,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Boolean, DataType::Boolean], + vec![DataTypeOld::Boolean, DataTypeOld::Boolean], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -245,7 +245,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); assert_eq!(ScalarValue::from(true), out.logical_value(0).unwrap()); assert_eq!(ScalarValue::from(false), out.logical_value(1).unwrap()); @@ -262,7 +262,11 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Boolean, DataType::Boolean, DataType::Boolean], + vec![ + DataTypeOld::Boolean, + DataTypeOld::Boolean, + DataTypeOld::Boolean, + ], vec!["a".to_string(), "b".to_string(), "c".to_string()], ) .unwrap(); @@ -278,7 +282,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b, &c]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b, &c]).unwrap(); assert_eq!(ScalarValue::from(false), out.logical_value(0).unwrap()); assert_eq!(ScalarValue::from(true), out.logical_value(1).unwrap()); @@ -294,7 +298,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Boolean, DataType::Boolean], + vec![DataTypeOld::Boolean, DataTypeOld::Boolean], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -306,7 +310,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); assert_eq!(ScalarValue::from(true), out.logical_value(0).unwrap()); assert_eq!(ScalarValue::from(true), out.logical_value(1).unwrap()); diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/comparison.rs b/crates/rayexec_execution/src/functions/scalar/builtin/comparison.rs index bc9679a94..8a60ff648 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/comparison.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/comparison.rs @@ -5,7 +5,7 @@ use std::marker::PhantomData; use rayexec_bullet::array::{ArrayData, ArrayOld}; use rayexec_bullet::compute::cast::array::decimal_rescale; use rayexec_bullet::compute::cast::behavior::CastFailBehavior; -use rayexec_bullet::datatype::{DataType, DataTypeId, DecimalTypeMeta}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld, DecimalTypeMeta}; use rayexec_bullet::executor::builder::{ArrayBuilder, BooleanBuffer}; use rayexec_bullet::executor::physical_type::{ PhysicalBinaryOld, @@ -209,7 +209,7 @@ impl ScalarFunction for Eq { ) -> Result { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, function_impl: new_comparison_impl::(self, &inputs, table_list)?, inputs, }) @@ -254,7 +254,7 @@ impl ScalarFunction for Neq { ) -> Result { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, function_impl: new_comparison_impl::(self, &inputs, table_list)?, inputs, }) @@ -295,7 +295,7 @@ impl ScalarFunction for Lt { ) -> Result { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, function_impl: new_comparison_impl::(self, &inputs, table_list)?, inputs, }) @@ -336,7 +336,7 @@ impl ScalarFunction for LtEq { ) -> Result { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, function_impl: new_comparison_impl::(self, &inputs, table_list)?, inputs, }) @@ -377,7 +377,7 @@ impl ScalarFunction for Gt { ) -> Result { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, function_impl: new_comparison_impl::(self, &inputs, table_list)?, inputs, }) @@ -418,7 +418,7 @@ impl ScalarFunction for GtEq { ) -> Result { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, function_impl: new_comparison_impl::(self, &inputs, table_list)?, inputs, }) @@ -516,74 +516,74 @@ fn new_comparison_impl( inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Boolean, DataType::Boolean) => { + (DataTypeOld::Boolean, DataTypeOld::Boolean) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Int8, DataType::Int8) => { + (DataTypeOld::Int8, DataTypeOld::Int8) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Int16, DataType::Int16) => { + (DataTypeOld::Int16, DataTypeOld::Int16) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Int32, DataType::Int32) => { + (DataTypeOld::Int32, DataTypeOld::Int32) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Int64, DataType::Int64) => { + (DataTypeOld::Int64, DataTypeOld::Int64) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Int128, DataType::Int128) => { + (DataTypeOld::Int128, DataTypeOld::Int128) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::UInt8, DataType::UInt8) => { + (DataTypeOld::UInt8, DataTypeOld::UInt8) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::UInt16, DataType::UInt16) => { + (DataTypeOld::UInt16, DataTypeOld::UInt16) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::UInt32, DataType::UInt32) => { + (DataTypeOld::UInt32, DataTypeOld::UInt32) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::UInt64, DataType::UInt64) => { + (DataTypeOld::UInt64, DataTypeOld::UInt64) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::UInt128, DataType::UInt128) => { + (DataTypeOld::UInt128, DataTypeOld::UInt128) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Float16, DataType::Float16) => { + (DataTypeOld::Float16, DataTypeOld::Float16) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Float32, DataType::Float32) => { + (DataTypeOld::Float32, DataTypeOld::Float32) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Float64, DataType::Float64) => { + (DataTypeOld::Float64, DataTypeOld::Float64) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Decimal64(left), DataType::Decimal64(right)) => Box::new( + (DataTypeOld::Decimal64(left), DataTypeOld::Decimal64(right)) => Box::new( RescalingComparisionImpl::::new(left, right), ), - (DataType::Decimal128(left), DataType::Decimal128(right)) => Box::new( + (DataTypeOld::Decimal128(left), DataTypeOld::Decimal128(right)) => Box::new( RescalingComparisionImpl::::new(left, right), ), - (DataType::Timestamp(_), DataType::Timestamp(_)) => { + (DataTypeOld::Timestamp(_), DataTypeOld::Timestamp(_)) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Interval, DataType::Interval) => { + (DataTypeOld::Interval, DataTypeOld::Interval) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Date32, DataType::Date32) => { + (DataTypeOld::Date32, DataTypeOld::Date32) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Date64, DataType::Date64) => { + (DataTypeOld::Date64, DataTypeOld::Date64) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Utf8, DataType::Utf8) => { + (DataTypeOld::Utf8, DataTypeOld::Utf8) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::Binary, DataType::Binary) => { + (DataTypeOld::Binary, DataTypeOld::Binary) => { Box::new(BaseComparisonImpl::::new()) } - (DataType::List(m1), DataType::List(m2)) if m1 == m2 => { + (DataTypeOld::List(m1), DataTypeOld::List(m2)) if m1 == m2 => { // TODO: We'll want to figure out casting for lists. Box::new(ListComparisonImpl::::new(m1.datatype.physical_type()?)) } @@ -660,12 +660,12 @@ impl ScalarFunctionImpl for ListComparisonImpl where O: ComparisonOperation, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let left = inputs[0]; let right = inputs[1]; let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(left.logical_len()), }; @@ -797,12 +797,12 @@ where S: PhysicalStorageOld, for<'a> S::Type<'a>: PartialEq + PartialOrd, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let left = inputs[0]; let right = inputs[1]; let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(left.logical_len()), }; @@ -845,12 +845,12 @@ where T: DecimalType, ArrayData: From>, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let left = inputs[0]; let right = inputs[1]; let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(left.logical_len()), }; @@ -908,7 +908,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -920,7 +920,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([false, true, false]); assert_eq!(expected, out); @@ -935,7 +935,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -947,7 +947,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([true, false, true]); assert_eq!(expected, out); @@ -962,7 +962,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -974,7 +974,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([true, false, true]); assert_eq!(expected, out); @@ -989,7 +989,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -1001,7 +1001,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([true, true, true]); assert_eq!(expected, out); @@ -1016,7 +1016,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -1028,7 +1028,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([false, false, false]); assert_eq!(expected, out); @@ -1043,7 +1043,7 @@ mod tests { let table_ref = table_list .push_table( None, - vec![DataType::Int32, DataType::Int32], + vec![DataTypeOld::Int32, DataTypeOld::Int32], vec!["a".to_string(), "b".to_string()], ) .unwrap(); @@ -1055,7 +1055,7 @@ mod tests { ) .unwrap(); - let out = planned.function_impl.execute(&[&a, &b]).unwrap(); + let out = planned.function_impl.execute_old(&[&a, &b]).unwrap(); let expected = ArrayOld::from_iter([false, true, false]); assert_eq!(expected, out); diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/datetime/date_part.rs b/crates/rayexec_execution/src/functions/scalar/builtin/datetime/date_part.rs index 93200c32a..3e95aafac 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/datetime/date_part.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/datetime/date_part.rs @@ -1,6 +1,6 @@ use rayexec_bullet::array::ArrayOld; use rayexec_bullet::compute::date::{self, extract_date_part}; -use rayexec_bullet::datatype::{DataType, DataTypeId, DecimalTypeMeta}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld, DecimalTypeMeta}; use rayexec_bullet::scalar::decimal::{Decimal64Type, DecimalType}; use rayexec_error::Result; use rayexec_parser::ast; @@ -79,10 +79,10 @@ impl ScalarFunction for DatePart { let part = convert_ast_date_part(part); match &datatypes[1] { - DataType::Date32 | DataType::Date64 | DataType::Timestamp(_) => { + DataTypeOld::Date32 | DataTypeOld::Date64 | DataTypeOld::Timestamp(_) => { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Decimal64(DecimalTypeMeta::new( + return_type: DataTypeOld::Decimal64(DecimalTypeMeta::new( Decimal64Type::MAX_PRECISION, Decimal64Type::DEFAULT_SCALE, )), @@ -101,7 +101,7 @@ pub struct DatePartImpl { } impl ScalarFunctionImpl for DatePartImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { // First input ignored (the constant "part" to extract) extract_date_part(self.part, inputs[1]) } diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/datetime/date_trunc.rs b/crates/rayexec_execution/src/functions/scalar/builtin/datetime/date_trunc.rs index ebd557503..0bca10b1b 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/datetime/date_trunc.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/datetime/date_trunc.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId, TimeUnit, TimestampTypeMeta}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld, TimeUnit, TimestampTypeMeta}; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalI64Old; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -80,9 +80,9 @@ impl ScalarFunction for DateTrunc { let field = field.parse::()?; match &datatypes[1] { - DataType::Timestamp(m) => Ok(PlannedScalarFunction { + DataTypeOld::Timestamp(m) => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Timestamp(TimestampTypeMeta { unit: m.unit }), + return_type: DataTypeOld::Timestamp(TimestampTypeMeta { unit: m.unit }), inputs, function_impl: Box::new(DateTruncImpl { input_unit: m.unit, @@ -140,7 +140,7 @@ pub struct DateTruncImpl { } impl ScalarFunctionImpl for DateTruncImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = &inputs[1]; let trunc = match self.input_unit { @@ -182,7 +182,7 @@ impl ScalarFunctionImpl for DateTruncImpl { }; let builder = ArrayBuilder { - datatype: DataType::Timestamp(TimestampTypeMeta { + datatype: DataTypeOld::Timestamp(TimestampTypeMeta { unit: self.input_unit, }), buffer: PrimitiveBuffer::with_len(input.logical_len()), diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/datetime/epoch.rs b/crates/rayexec_execution/src/functions/scalar/builtin/datetime/epoch.rs index aa311940e..5d539fa72 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/datetime/epoch.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/datetime/epoch.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId, TimeUnit, TimestampTypeMeta}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld, TimeUnit, TimestampTypeMeta}; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalI64Old; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -43,9 +43,9 @@ impl ScalarFunction for Epoch { ) -> Result { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Int64 => Ok(PlannedScalarFunction { + DataTypeOld::Int64 => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Timestamp(TimestampTypeMeta { + return_type: DataTypeOld::Timestamp(TimestampTypeMeta { unit: TimeUnit::Microsecond, }), inputs, @@ -85,9 +85,9 @@ impl ScalarFunction for EpochMs { ) -> Result { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Int64 => Ok(PlannedScalarFunction { + DataTypeOld::Int64 => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Timestamp(TimestampTypeMeta { + return_type: DataTypeOld::Timestamp(TimestampTypeMeta { unit: TimeUnit::Microsecond, }), inputs, @@ -102,7 +102,7 @@ impl ScalarFunction for EpochMs { pub struct EpochImpl; impl ScalarFunctionImpl for EpochImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; to_timestamp::(input) } @@ -110,7 +110,7 @@ impl ScalarFunctionImpl for EpochImpl { fn to_timestamp(input: &ArrayOld) -> Result { let builder = ArrayBuilder { - datatype: DataType::Timestamp(TimestampTypeMeta { + datatype: DataTypeOld::Timestamp(TimestampTypeMeta { unit: TimeUnit::Microsecond, }), buffer: PrimitiveBuffer::with_len(input.logical_len()), diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/is.rs b/crates/rayexec_execution/src/functions/scalar/builtin/is.rs index 3fdccc282..a488d647f 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/is.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/is.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, BooleanBuffer}; use rayexec_bullet::executor::physical_type::{PhysicalAnyOld, PhysicalBoolOld}; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -47,7 +47,7 @@ impl ScalarFunction for IsNull { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl: Box::new(CheckNullImpl::), }) @@ -90,7 +90,7 @@ impl ScalarFunction for IsNotNull { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl: Box::new(CheckNullImpl::), }) @@ -101,7 +101,7 @@ impl ScalarFunction for IsNotNull { pub struct CheckNullImpl; impl ScalarFunctionImpl for CheckNullImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; let (initial, updated) = if IS_NULL { @@ -114,7 +114,7 @@ impl ScalarFunctionImpl for CheckNullImpl { }; let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len_and_default_value(input.logical_len(), initial), }; let array = UnaryExecutor::execute::(input, builder, |_, buf| { @@ -123,7 +123,7 @@ impl ScalarFunctionImpl for CheckNullImpl { // Drop validity. let data = array.into_array_data(); - Ok(ArrayOld::new_with_array_data(DataType::Boolean, data)) + Ok(ArrayOld::new_with_array_data(DataTypeOld::Boolean, data)) } } @@ -163,7 +163,7 @@ impl ScalarFunction for IsTrue { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl: Box::new(CheckBoolImpl::), }) @@ -206,7 +206,7 @@ impl ScalarFunction for IsNotTrue { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl: Box::new(CheckBoolImpl::), }) @@ -249,7 +249,7 @@ impl ScalarFunction for IsFalse { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl: Box::new(CheckBoolImpl::), }) @@ -292,7 +292,7 @@ impl ScalarFunction for IsNotFalse { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl: Box::new(CheckBoolImpl::), }) @@ -303,13 +303,13 @@ impl ScalarFunction for IsNotFalse { pub struct CheckBoolImpl; impl ScalarFunctionImpl for CheckBoolImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; let initial = NOT; let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len_and_default_value(input.logical_len(), initial), }; let array = UnaryExecutor::execute::(input, builder, |val, buf| { @@ -319,6 +319,6 @@ impl ScalarFunctionImpl for CheckBoolImpl meta.datatype.as_ref().clone(), + DataTypeOld::List(meta) => meta.datatype.as_ref().clone(), other => { return Err(RayexecError::new(format!( "Cannot index into non-list type, got {other}", @@ -115,12 +115,12 @@ impl ScalarFunction for ListExtract { #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct ListExtractImpl { - inner_datatype: DataType, + inner_datatype: DataTypeOld, index: usize, } impl ScalarFunctionImpl for ListExtractImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; extract(input, self.index) } @@ -136,112 +136,112 @@ fn extract(array: &ArrayOld, idx: usize) -> Result { PhysicalType::UntypedNull => not_implemented!("NULL list extract"), PhysicalType::Boolean => { let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::Int8 => { let builder = ArrayBuilder { - datatype: DataType::Int8, + datatype: DataTypeOld::Int8, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::Int16 => { let builder = ArrayBuilder { - datatype: DataType::Int16, + datatype: DataTypeOld::Int16, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::Int32 => { let builder = ArrayBuilder { - datatype: DataType::Int32, + datatype: DataTypeOld::Int32, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::Int64 => { let builder = ArrayBuilder { - datatype: DataType::Int64, + datatype: DataTypeOld::Int64, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::Int128 => { let builder = ArrayBuilder { - datatype: DataType::Int128, + datatype: DataTypeOld::Int128, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::UInt8 => { let builder = ArrayBuilder { - datatype: DataType::UInt8, + datatype: DataTypeOld::UInt8, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::UInt16 => { let builder = ArrayBuilder { - datatype: DataType::UInt16, + datatype: DataTypeOld::UInt16, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::UInt32 => { let builder = ArrayBuilder { - datatype: DataType::UInt32, + datatype: DataTypeOld::UInt32, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::UInt64 => { let builder = ArrayBuilder { - datatype: DataType::UInt64, + datatype: DataTypeOld::UInt64, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::UInt128 => { let builder = ArrayBuilder { - datatype: DataType::UInt128, + datatype: DataTypeOld::UInt128, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::Float16 => { let builder = ArrayBuilder { - datatype: DataType::Float16, + datatype: DataTypeOld::Float16, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::Float32 => { let builder = ArrayBuilder { - datatype: DataType::Float32, + datatype: DataTypeOld::Float32, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::Float64 => { let builder = ArrayBuilder { - datatype: DataType::Float64, + datatype: DataTypeOld::Float64, buffer: PrimitiveBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::Utf8 => { let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) } PhysicalType::Binary => { let builder = ArrayBuilder { - datatype: DataType::Binary, + datatype: DataTypeOld::Binary, buffer: GermanVarlenBuffer::<[u8]>::with_len(array.logical_len()), }; extract_inner::(builder, array, data.inner_array(), idx) diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/list/list_values.rs b/crates/rayexec_execution/src/functions/scalar/builtin/list/list_values.rs index 01e524e05..add559eb1 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/list/list_values.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/list/list_values.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId, ListTypeMeta}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld, ListTypeMeta}; use rayexec_bullet::executor::scalar::concat; use rayexec_bullet::storage::ListStorage; use rayexec_error::{RayexecError, Result}; @@ -45,8 +45,8 @@ impl ScalarFunction for ListValues { let first = match inputs.first() { Some(expr) => expr.datatype(table_list)?, None => { - let return_type = DataType::List(ListTypeMeta { - datatype: Box::new(DataType::Null), + let return_type = DataTypeOld::List(ListTypeMeta { + datatype: Box::new(DataTypeOld::Null), }); return Ok(PlannedScalarFunction { function: Box::new(*self), @@ -69,7 +69,7 @@ impl ScalarFunction for ListValues { } } - let return_type = DataType::List(ListTypeMeta { + let return_type = DataTypeOld::List(ListTypeMeta { datatype: Box::new(first.clone()), }); @@ -86,24 +86,31 @@ impl ScalarFunction for ListValues { #[derive(Debug, Clone)] pub struct ListValuesImpl { - list_datatype: DataType, + list_datatype: DataTypeOld, } impl ScalarFunctionImpl for ListValuesImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { if inputs.is_empty() { let inner_type = match &self.list_datatype { - DataType::List(l) => l.datatype.as_ref(), + DataTypeOld::List(l) => l.datatype.as_ref(), other => panic!("invalid data type: {other}"), }; - let data = ListStorage::empty_list(ArrayOld::new_typed_null_array(inner_type.clone(), 1)?); - return Ok(ArrayOld::new_with_array_data(self.list_datatype.clone(), data)); + let data = + ListStorage::empty_list(ArrayOld::new_typed_null_array(inner_type.clone(), 1)?); + return Ok(ArrayOld::new_with_array_data( + self.list_datatype.clone(), + data, + )); } let out = concat(inputs)?; let data = ListStorage::single_list(out); - Ok(ArrayOld::new_with_array_data(self.list_datatype.clone(), data)) + Ok(ArrayOld::new_with_array_data( + self.list_datatype.clone(), + data, + )) } } diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/mod.rs b/crates/rayexec_execution/src/functions/scalar/builtin/mod.rs index 39215d973..bb5bc3309 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/mod.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/mod.rs @@ -10,6 +10,7 @@ pub mod random; pub mod similarity; pub mod string; pub mod struct_funcs; +pub mod temp_add_2; use std::sync::LazyLock; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/negate.rs b/crates/rayexec_execution/src/functions/scalar/builtin/negate.rs index f44cc41c2..15260c7f3 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/negate.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/negate.rs @@ -1,7 +1,7 @@ use std::marker::PhantomData; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, BooleanBuffer, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::{ PhysicalBoolOld, @@ -61,14 +61,14 @@ impl ScalarFunction for Negate { // TODO: Interval let function_impl: Box = match dt.clone() { - dt @ DataType::Int8 => Box::new(NegateImpl::::new(dt)), - dt @ DataType::Int16 => Box::new(NegateImpl::::new(dt)), - dt @ DataType::Int32 => Box::new(NegateImpl::::new(dt)), - dt @ DataType::Int64 => Box::new(NegateImpl::::new(dt)), - dt @ DataType::Int128 => Box::new(NegateImpl::::new(dt)), - dt @ DataType::Float16 => Box::new(NegateImpl::::new(dt)), - dt @ DataType::Float32 => Box::new(NegateImpl::::new(dt)), - dt @ DataType::Float64 => Box::new(NegateImpl::::new(dt)), + dt @ DataTypeOld::Int8 => Box::new(NegateImpl::::new(dt)), + dt @ DataTypeOld::Int16 => Box::new(NegateImpl::::new(dt)), + dt @ DataTypeOld::Int32 => Box::new(NegateImpl::::new(dt)), + dt @ DataTypeOld::Int64 => Box::new(NegateImpl::::new(dt)), + dt @ DataTypeOld::Int128 => Box::new(NegateImpl::::new(dt)), + dt @ DataTypeOld::Float16 => Box::new(NegateImpl::::new(dt)), + dt @ DataTypeOld::Float32 => Box::new(NegateImpl::::new(dt)), + dt @ DataTypeOld::Float64 => Box::new(NegateImpl::::new(dt)), other => return Err(invalid_input_types_error(self, &[other])), }; @@ -83,12 +83,12 @@ impl ScalarFunction for Negate { #[derive(Debug, Clone)] pub struct NegateImpl { - datatype: DataType, // TODO: Would be nice not needing to store this. + datatype: DataTypeOld, // TODO: Would be nice not needing to store this. _s: PhantomData, } impl NegateImpl { - fn new(datatype: DataType) -> Self { + fn new(datatype: DataTypeOld) -> Self { NegateImpl { datatype, _s: PhantomData, @@ -102,7 +102,7 @@ where for<'a> S::Type<'a>: std::ops::Neg> + Default + Copy, ArrayData: From>>, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { use std::ops::Neg; let a = inputs[0]; @@ -150,9 +150,9 @@ impl ScalarFunction for Not { ) -> Result { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Boolean => Ok(PlannedScalarFunction { + DataTypeOld::Boolean => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl: Box::new(NotImpl), }), @@ -165,11 +165,11 @@ impl ScalarFunction for Not { pub struct NotImpl; impl ScalarFunctionImpl for NotImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { UnaryExecutor::execute::( inputs[0], ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(inputs[0].logical_len()), }, |b, buf| buf.put(&(!b)), diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/abs.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/abs.rs index 317459899..504fec1f6 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/abs.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/abs.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for AbsOp { const NAME: &'static str = "abs"; const DESCRIPTION: &'static str = "Compute the absolute value of a number"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/acos.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/acos.rs index e0138cb0d..de4228b40 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/acos.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/acos.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for AcosOp { const NAME: &'static str = "acos"; const DESCRIPTION: &'static str = "Compute the arccosine of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/asin.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/asin.rs index 8c405c2b8..d7dc705eb 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/asin.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/asin.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for AsinOp { const NAME: &'static str = "asin"; const DESCRIPTION: &'static str = "Compute the arcsine of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/atan.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/atan.rs index 31737a43c..b285f0168 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/atan.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/atan.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for AtanOp { const NAME: &'static str = "atan"; const DESCRIPTION: &'static str = "Compute the arctangent of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/cbrt.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/cbrt.rs index 2f1b9f977..fbb7b184c 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/cbrt.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/cbrt.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for CbrtOp { const NAME: &'static str = "cbrt"; const DESCRIPTION: &'static str = "Compute the cube root of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/ceil.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/ceil.rs index 48bad4591..4d8c754f2 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/ceil.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/ceil.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for CeilOp { const NAME: &'static str = "ceil"; const DESCRIPTION: &'static str = "Round number up"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/cos.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/cos.rs index 178f75eac..240eb81e5 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/cos.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/cos.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for CosOp { const NAME: &'static str = "cos"; const DESCRIPTION: &'static str = "Compute the cosine of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/degrees.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/degrees.rs index 9892195ab..1698b8de4 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/degrees.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/degrees.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for DegreesOp { const NAME: &'static str = "degrees"; const DESCRIPTION: &'static str = "Converts radians to degrees"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/exp.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/exp.rs index 34c60c647..a25478813 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/exp.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/exp.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for ExpOp { const NAME: &'static str = "exp"; const DESCRIPTION: &'static str = "Compute `e ^ val`"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/floor.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/floor.rs index 58c9bd386..1ba10a7c6 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/floor.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/floor.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for FloorOp { const NAME: &'static str = "floor"; const DESCRIPTION: &'static str = "Round number down"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/isnan.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/isnan.rs index b92cb5ed6..0f8dabd6b 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/isnan.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/isnan.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; use num_traits::Float; use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, BooleanBuffer}; use rayexec_bullet::executor::physical_type::{ PhysicalF16Old, @@ -71,15 +71,15 @@ impl ScalarFunction for IsNan { plan_check_num_args(self, &inputs, 1)?; let function_impl: Box = match inputs[0].datatype(table_list)? { - DataType::Float16 => Box::new(IsNanImpl::::new()), - DataType::Float32 => Box::new(IsNanImpl::::new()), - DataType::Float64 => Box::new(IsNanImpl::::new()), + DataTypeOld::Float16 => Box::new(IsNanImpl::::new()), + DataTypeOld::Float32 => Box::new(IsNanImpl::::new()), + DataTypeOld::Float64 => Box::new(IsNanImpl::::new()), other => return Err(invalid_input_types_error(self, &[other])), }; Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl, }) @@ -102,10 +102,10 @@ where S: PhysicalStorageOld, for<'a> S::Type<'a>: Float, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(input.logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/ln.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/ln.rs index e366c6f5d..5f4a908f9 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/ln.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/ln.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for LnOp { const NAME: &'static str = "ln"; const DESCRIPTION: &'static str = "Compute natural log of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/log.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/log.rs index 3baca42f8..af8e9bf80 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/log.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/log.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for LogOp { const NAME: &'static str = "log"; const DESCRIPTION: &'static str = "Compute base-10 log of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, @@ -41,7 +41,7 @@ impl UnaryInputNumericOperation for LogOp2 { const NAME: &'static str = "log2"; const DESCRIPTION: &'static str = "Compute base-2 log of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/mod.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/mod.rs index c38e9459b..29e6eeadf 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/mod.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/mod.rs @@ -34,7 +34,7 @@ pub use log::*; use num_traits::Float; pub use radians::*; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::physical_type::{ PhysicalF16Old, PhysicalF32Old, @@ -81,7 +81,7 @@ pub trait UnaryInputNumericOperation: Debug + Clone + Copy + Sync + Send + 'stat const NAME: &'static str; const DESCRIPTION: &'static str; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, @@ -122,7 +122,7 @@ impl ScalarFunction for UnaryInputNumericScalar (), + DataTypeOld::Float16 | DataTypeOld::Float32 | DataTypeOld::Float64 => (), other => return Err(invalid_input_types_error(self, &[other])), } @@ -140,12 +140,12 @@ impl ScalarFunction for UnaryInputNumericScalar { - ret: DataType, + ret: DataTypeOld, _op: PhantomData, } impl ScalarFunctionImpl for UnaryInputNumericScalarImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; match input.physical_type() { PhysicalType::Float16 => O::execute_float::(input, self.ret.clone()), diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/radians.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/radians.rs index df4b337ca..bf33bcfaf 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/radians.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/radians.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for RadiansOp { const NAME: &'static str = "radians"; const DESCRIPTION: &'static str = "Converts degrees to radians"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/sin.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/sin.rs index d24ef319b..7902fa0af 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/sin.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/sin.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for SinOp { const NAME: &'static str = "sin"; const DESCRIPTION: &'static str = "Compute the sin of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/sqrt.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/sqrt.rs index b11e5df1c..afcb4e487 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/sqrt.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/sqrt.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for SqrtOp { const NAME: &'static str = "sqrt"; const DESCRIPTION: &'static str = "Compute the square root of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/tan.rs b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/tan.rs index 16d95bca8..184a7fac4 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/numeric/tan.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/numeric/tan.rs @@ -1,6 +1,6 @@ use num_traits::Float; use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalStorageOld; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -18,7 +18,7 @@ impl UnaryInputNumericOperation for TanOp { const NAME: &'static str = "tan"; const DESCRIPTION: &'static str = "Compute the tangent of value"; - fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataType) -> Result + fn execute_float<'a, S>(input: &'a ArrayOld, ret: DataTypeOld) -> Result where S: PhysicalStorageOld, S::Type<'a>: Float + Default, diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/random.rs b/crates/rayexec_execution/src/functions/scalar/builtin/random.rs index 51a1ea856..39cbbcf69 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/random.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/random.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::storage::PrimitiveStorage; use rayexec_error::Result; use serde::{Deserialize, Serialize}; @@ -51,7 +51,7 @@ impl ScalarFunction for Random { plan_check_num_args(self, &inputs, 0)?; Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl: Box::new(RandomImpl), }) @@ -62,11 +62,11 @@ impl ScalarFunction for Random { pub struct RandomImpl; impl ScalarFunctionImpl for RandomImpl { - fn execute(&self, _inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, _inputs: &[&ArrayOld]) -> Result { // TODO: Need to pass in dummy input to produce all unique values. let val = rand::random::(); Ok(ArrayOld::new_with_array_data( - DataType::Float64, + DataTypeOld::Float64, PrimitiveStorage::from(vec![val]), )) } diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/similarity/l2_distance.rs b/crates/rayexec_execution/src/functions/scalar/builtin/similarity/l2_distance.rs index ce0c8cb0d..ea9cd6d77 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/similarity/l2_distance.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/similarity/l2_distance.rs @@ -3,7 +3,7 @@ use std::ops::AddAssign; use num_traits::{AsPrimitive, Float}; use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::{ PhysicalF16Old, @@ -65,15 +65,15 @@ impl ScalarFunction for L2Distance { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::List(a), DataType::List(b)) => { + (DataTypeOld::List(a), DataTypeOld::List(b)) => { match (a.datatype.as_ref(), b.datatype.as_ref()) { - (DataType::Float16, DataType::Float16) => { + (DataTypeOld::Float16, DataTypeOld::Float16) => { Box::new(L2DistanceImpl::::new()) } - (DataType::Float32, DataType::Float32) => { + (DataTypeOld::Float32, DataTypeOld::Float32) => { Box::new(L2DistanceImpl::::new()) } - (DataType::Float64, DataType::Float64) => { + (DataTypeOld::Float64, DataTypeOld::Float64) => { Box::new(L2DistanceImpl::::new()) } (a, b) => return Err(invalid_input_types_error(self, &[a, b])), @@ -84,7 +84,7 @@ impl ScalarFunction for L2Distance { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Float64, + return_type: DataTypeOld::Float64, inputs, function_impl, }) @@ -110,12 +110,12 @@ where S: PhysicalStorageOld, for<'a> S::Type<'a>: Float + AddAssign + AsPrimitive + Default + Copy, { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let a = inputs[0]; let b = inputs[1]; let builder = ArrayBuilder { - datatype: DataType::Float64, + datatype: DataTypeOld::Float64, buffer: PrimitiveBuffer::with_len(a.logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/ascii.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/ascii.rs index 1f3245231..761dbae8d 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/ascii.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/ascii.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::PhysicalUtf8Old; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -46,9 +46,9 @@ impl ScalarFunction for Ascii { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Utf8 => Ok(PlannedScalarFunction { + DataTypeOld::Utf8 => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Int32, + return_type: DataTypeOld::Int32, inputs, function_impl: Box::new(AsciiImpl), }), @@ -61,10 +61,10 @@ impl ScalarFunction for Ascii { pub struct AsciiImpl; impl ScalarFunctionImpl for AsciiImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; let builder = ArrayBuilder { - datatype: DataType::Int32, + datatype: DataTypeOld::Int32, buffer: PrimitiveBuffer::with_len(inputs[0].logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/case.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/case.rs index 345d36f52..30a99a206 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/case.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/case.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::{ArrayData, ArrayOld}; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, GermanVarlenBuffer}; use rayexec_bullet::executor::physical_type::PhysicalUtf8Old; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -45,9 +45,9 @@ impl ScalarFunction for Lower { ) -> Result { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Utf8 => Ok(PlannedScalarFunction { + DataTypeOld::Utf8 => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(LowerImpl), }), @@ -60,7 +60,7 @@ impl ScalarFunction for Lower { pub struct LowerImpl; impl ScalarFunctionImpl for LowerImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; case_convert_execute(input, str::to_lowercase) } @@ -100,9 +100,9 @@ impl ScalarFunction for Upper { ) -> Result { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Utf8 => Ok(PlannedScalarFunction { + DataTypeOld::Utf8 => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(UpperImpl), }), @@ -115,7 +115,7 @@ impl ScalarFunction for Upper { pub struct UpperImpl; impl ScalarFunctionImpl for UpperImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; case_convert_execute(input, str::to_uppercase) } @@ -131,7 +131,7 @@ where }; let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len_and_data_capacity(input.logical_len(), cap), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/concat.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/concat.rs index 8cdd59d11..10ba7c7da 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/concat.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/concat.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, GermanVarlenBuffer}; use rayexec_bullet::executor::physical_type::PhysicalUtf8Old; use rayexec_bullet::executor::scalar::{BinaryExecutor, UniformExecutor}; @@ -51,13 +51,13 @@ impl ScalarFunction for Concat { .map(|input| input.datatype(table_list)) .collect::>>()?; - if !datatypes.iter().all(|dt| dt == &DataType::Utf8) { + if !datatypes.iter().all(|dt| dt == &DataTypeOld::Utf8) { return Err(invalid_input_types_error(self, &datatypes)); } Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(StringConcatImpl), }) @@ -68,7 +68,7 @@ impl ScalarFunction for Concat { pub struct StringConcatImpl; impl ScalarFunctionImpl for StringConcatImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { match inputs.len() { 0 => { let mut array = ArrayOld::from_iter([""]); @@ -88,7 +88,7 @@ impl ScalarFunctionImpl for StringConcatImpl { a, b, ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::with_len(a.logical_len()), }, |a, b, buf| { @@ -105,7 +105,7 @@ impl ScalarFunctionImpl for StringConcatImpl { UniformExecutor::execute::( inputs, ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::with_len(inputs[0].logical_len()), }, |strings, buf| { diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/contains.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/contains.rs index a3d3b1796..037a9d82e 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/contains.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/contains.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, BooleanBuffer}; use rayexec_bullet::executor::physical_type::PhysicalUtf8Old; use rayexec_bullet::executor::scalar::{BinaryExecutor, UnaryExecutor}; @@ -51,7 +51,7 @@ impl ScalarFunction for Contains { .collect::>>()?; match (&datatypes[0], &datatypes[1]) { - (DataType::Utf8, DataType::Utf8) => (), + (DataTypeOld::Utf8, DataTypeOld::Utf8) => (), (a, b) => return Err(invalid_input_types_error(self, &[a, b])), } @@ -69,7 +69,7 @@ impl ScalarFunction for Contains { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl, }) @@ -82,9 +82,9 @@ pub struct StringContainsConstantImpl { } impl ScalarFunctionImpl for StringContainsConstantImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(inputs[0].logical_len()), }; @@ -98,9 +98,9 @@ impl ScalarFunctionImpl for StringContainsConstantImpl { pub struct StringContainsImpl; impl ScalarFunctionImpl for StringContainsImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(inputs[0].logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/ends_with.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/ends_with.rs index 548c9a772..606e0fcda 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/ends_with.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/ends_with.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, BooleanBuffer}; use rayexec_bullet::executor::physical_type::PhysicalUtf8Old; use rayexec_bullet::executor::scalar::{BinaryExecutor, UnaryExecutor}; @@ -55,7 +55,7 @@ impl ScalarFunction for EndsWith { .collect::>>()?; match (&datatypes[0], &datatypes[1]) { - (DataType::Utf8, DataType::Utf8) => (), + (DataTypeOld::Utf8, DataTypeOld::Utf8) => (), (a, b) => return Err(invalid_input_types_error(self, &[a, b])), } @@ -73,7 +73,7 @@ impl ScalarFunction for EndsWith { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl, }) @@ -86,9 +86,9 @@ pub struct EndsWithConstantImpl { } impl ScalarFunctionImpl for EndsWithConstantImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(inputs[0].logical_len()), }; @@ -102,9 +102,9 @@ impl ScalarFunctionImpl for EndsWithConstantImpl { pub struct EndsWithImpl; impl ScalarFunctionImpl for EndsWithImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(inputs[0].logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/length.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/length.rs index c2e04b060..9ac8c92ad 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/length.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/length.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, PrimitiveBuffer}; use rayexec_bullet::executor::physical_type::{PhysicalBinaryOld, PhysicalUtf8Old}; use rayexec_bullet::executor::scalar::UnaryExecutor; @@ -49,9 +49,9 @@ impl ScalarFunction for Length { ) -> Result { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Utf8 => Ok(PlannedScalarFunction { + DataTypeOld::Utf8 => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Int64, + return_type: DataTypeOld::Int64, inputs, function_impl: Box::new(StrLengthImpl), }), @@ -64,11 +64,11 @@ impl ScalarFunction for Length { pub struct StrLengthImpl; impl ScalarFunctionImpl for StrLengthImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; let builder = ArrayBuilder { - datatype: DataType::Int64, + datatype: DataTypeOld::Int64, buffer: PrimitiveBuffer::with_len(input.logical_len()), }; @@ -130,9 +130,9 @@ impl ScalarFunction for ByteLength { ) -> Result { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Utf8 | DataType::Binary => Ok(PlannedScalarFunction { + DataTypeOld::Utf8 | DataTypeOld::Binary => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Int64, + return_type: DataTypeOld::Int64, inputs, function_impl: Box::new(ByteLengthImpl), }), @@ -145,11 +145,11 @@ impl ScalarFunction for ByteLength { pub struct ByteLengthImpl; impl ScalarFunctionImpl for ByteLengthImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; let builder = ArrayBuilder { - datatype: DataType::Int64, + datatype: DataTypeOld::Int64, buffer: PrimitiveBuffer::with_len(input.logical_len()), }; @@ -207,9 +207,9 @@ impl ScalarFunction for BitLength { ) -> Result { plan_check_num_args(self, &inputs, 1)?; match inputs[0].datatype(table_list)? { - DataType::Utf8 | DataType::Binary => Ok(PlannedScalarFunction { + DataTypeOld::Utf8 | DataTypeOld::Binary => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Int64, + return_type: DataTypeOld::Int64, inputs, function_impl: Box::new(BitLengthImpl), }), @@ -222,11 +222,11 @@ impl ScalarFunction for BitLength { pub struct BitLengthImpl; impl ScalarFunctionImpl for BitLengthImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let input = inputs[0]; let builder = ArrayBuilder { - datatype: DataType::Int64, + datatype: DataTypeOld::Int64, buffer: PrimitiveBuffer::with_len(input.logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/like.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/like.rs index ee2eb9ffb..619a5dcf4 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/like.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/like.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, BooleanBuffer}; use rayexec_bullet::executor::physical_type::PhysicalUtf8Old; use rayexec_bullet::executor::scalar::{BinaryExecutor, UnaryExecutor}; @@ -53,7 +53,7 @@ impl ScalarFunction for Like { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Utf8, DataType::Utf8) => (), + (DataTypeOld::Utf8, DataTypeOld::Utf8) => (), (a, b) => return Err(invalid_input_types_error(self, &[a, b])), } @@ -71,7 +71,7 @@ impl ScalarFunction for Like { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl, }) @@ -84,9 +84,9 @@ pub struct LikeConstImpl { } impl ScalarFunctionImpl for LikeConstImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(inputs[0].logical_len()), }; @@ -101,9 +101,9 @@ impl ScalarFunctionImpl for LikeConstImpl { pub struct LikeImpl; impl ScalarFunctionImpl for LikeImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(inputs[0].logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/pad.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/pad.rs index 0e2e8e50c..892884ae1 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/pad.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/pad.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, GermanVarlenBuffer}; use rayexec_bullet::executor::physical_type::{PhysicalI64Old, PhysicalUtf8Old}; use rayexec_bullet::executor::scalar::{BinaryExecutor, TernaryExecutor}; @@ -73,11 +73,11 @@ impl ScalarFunction for LeftPad { match inputs.len() { 2 => match (&datatypes[0], &datatypes[1]) { - (DataType::Utf8, DataType::Int64) => (), + (DataTypeOld::Utf8, DataTypeOld::Int64) => (), (a, b) => return Err(invalid_input_types_error(self, &[a, b])), }, 3 => match (&datatypes[0], &datatypes[1], &datatypes[2]) { - (DataType::Utf8, DataType::Int64, DataType::Utf8) => (), + (DataTypeOld::Utf8, DataTypeOld::Int64, DataTypeOld::Utf8) => (), (a, b, c) => return Err(invalid_input_types_error(self, &[a, b, c])), }, other => unreachable!("num inputs checked, got {other}"), @@ -85,7 +85,7 @@ impl ScalarFunction for LeftPad { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(LeftPadImpl), }) @@ -96,10 +96,10 @@ impl ScalarFunction for LeftPad { pub struct LeftPadImpl; impl ScalarFunctionImpl for LeftPadImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let mut string_buf = String::new(); let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(inputs[0].logical_len()), }; @@ -188,11 +188,11 @@ impl ScalarFunction for RightPad { match inputs.len() { 2 => match (&datatypes[0], &datatypes[1]) { - (DataType::Utf8, DataType::Int64) => (), + (DataTypeOld::Utf8, DataTypeOld::Int64) => (), (a, b) => return Err(invalid_input_types_error(self, &[a, b])), }, 3 => match (&datatypes[0], &datatypes[1], &datatypes[2]) { - (DataType::Utf8, DataType::Int64, DataType::Utf8) => (), + (DataTypeOld::Utf8, DataTypeOld::Int64, DataTypeOld::Utf8) => (), (a, b, c) => return Err(invalid_input_types_error(self, &[a, b, c])), }, other => unreachable!("num inputs checked, got {other}"), @@ -200,7 +200,7 @@ impl ScalarFunction for RightPad { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(RightPadImpl), }) @@ -211,10 +211,10 @@ impl ScalarFunction for RightPad { pub struct RightPadImpl; impl ScalarFunctionImpl for RightPadImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let mut string_buf = String::new(); let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(inputs[0].logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/regexp_replace.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/regexp_replace.rs index 4bab148ab..2a1d004b5 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/regexp_replace.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/regexp_replace.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, GermanVarlenBuffer}; use rayexec_bullet::executor::physical_type::PhysicalUtf8Old; use rayexec_bullet::executor::scalar::{BinaryExecutor, TernaryExecutor, UnaryExecutor}; @@ -53,7 +53,7 @@ impl ScalarFunction for RegexpReplace { .collect::>>()?; for datatype in &datatypes { - if datatype != &DataType::Utf8 { + if datatype != &DataTypeOld::Utf8 { return Err(invalid_input_types_error(self, &datatypes)); } } @@ -81,7 +81,7 @@ impl ScalarFunction for RegexpReplace { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(RegexpReplaceImpl { pattern, @@ -98,9 +98,9 @@ pub struct RegexpReplaceImpl { } impl ScalarFunctionImpl for RegexpReplaceImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(inputs[0].logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/repeat.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/repeat.rs index 81c5d6a8e..ef33a3249 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/repeat.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/repeat.rs @@ -1,7 +1,7 @@ use std::fmt::Debug; use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, GermanVarlenBuffer}; use rayexec_bullet::executor::physical_type::{PhysicalI64Old, PhysicalUtf8Old}; use rayexec_bullet::executor::scalar::BinaryExecutor; @@ -50,9 +50,9 @@ impl ScalarFunction for Repeat { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Utf8, DataType::Int64) => Ok(PlannedScalarFunction { + (DataTypeOld::Utf8, DataTypeOld::Int64) => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(RepeatUtf8Impl), }), @@ -65,7 +65,7 @@ impl ScalarFunction for Repeat { pub struct RepeatUtf8Impl; impl ScalarFunctionImpl for RepeatUtf8Impl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let strings = inputs[0]; let nums = inputs[1]; @@ -77,7 +77,7 @@ impl ScalarFunctionImpl for RepeatUtf8Impl { strings, nums, ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::with_len(strings.logical_len()), }, |s, num, buf| { diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/starts_with.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/starts_with.rs index 69496f74b..9b87224cd 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/starts_with.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/starts_with.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, BooleanBuffer}; use rayexec_bullet::executor::physical_type::PhysicalUtf8Old; use rayexec_bullet::executor::scalar::{BinaryExecutor, UnaryExecutor}; @@ -55,7 +55,7 @@ impl ScalarFunction for StartsWith { inputs[0].datatype(table_list)?, inputs[1].datatype(table_list)?, ) { - (DataType::Utf8, DataType::Utf8) => (), + (DataTypeOld::Utf8, DataTypeOld::Utf8) => (), (a, b) => return Err(invalid_input_types_error(self, &[a, b])), } @@ -71,7 +71,7 @@ impl ScalarFunction for StartsWith { Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Boolean, + return_type: DataTypeOld::Boolean, inputs, function_impl: Box::new(StartsWithImpl { constant }), }) @@ -84,9 +84,9 @@ pub struct StartsWithImpl { } impl ScalarFunctionImpl for StartsWithImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let builder = ArrayBuilder { - datatype: DataType::Boolean, + datatype: DataTypeOld::Boolean, buffer: BooleanBuffer::with_len(inputs[0].logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/substring.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/substring.rs index 4d3daf536..0856664c0 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/substring.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/substring.rs @@ -1,5 +1,5 @@ use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, GermanVarlenBuffer}; use rayexec_bullet::executor::physical_type::{PhysicalI64Old, PhysicalUtf8Old}; use rayexec_bullet::executor::scalar::{BinaryExecutor, TernaryExecutor}; @@ -79,21 +79,23 @@ impl ScalarFunction for Substring { match datatypes.len() { 2 => match (&datatypes[0], &datatypes[1]) { - (DataType::Utf8, DataType::Int64) => Ok(PlannedScalarFunction { + (DataTypeOld::Utf8, DataTypeOld::Int64) => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(SubstringFromImpl), }), (a, b) => Err(invalid_input_types_error(self, &[a, b])), }, 3 => match (&datatypes[0], &datatypes[1], &datatypes[2]) { - (DataType::Utf8, DataType::Int64, DataType::Int64) => Ok(PlannedScalarFunction { - function: Box::new(*self), - return_type: DataType::Utf8, - inputs, - function_impl: Box::new(SubstringFromToImpl), - }), + (DataTypeOld::Utf8, DataTypeOld::Int64, DataTypeOld::Int64) => { + Ok(PlannedScalarFunction { + function: Box::new(*self), + return_type: DataTypeOld::Utf8, + inputs, + function_impl: Box::new(SubstringFromToImpl), + }) + } (a, b, c) => Err(invalid_input_types_error(self, &[a, b, c])), }, _ => Err(invalid_input_types_error(self, &datatypes)), @@ -105,13 +107,13 @@ impl ScalarFunction for Substring { pub struct SubstringFromImpl; impl ScalarFunctionImpl for SubstringFromImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let len = inputs[0].logical_len(); BinaryExecutor::execute::( inputs[0], inputs[1], ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::with_len(len), }, |s, from, buf| buf.put(substring_from(s, from)), @@ -123,14 +125,14 @@ impl ScalarFunctionImpl for SubstringFromImpl { pub struct SubstringFromToImpl; impl ScalarFunctionImpl for SubstringFromToImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let len = inputs[0].logical_len(); TernaryExecutor::execute::( inputs[0], inputs[1], inputs[2], ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::with_len(len), }, |s, from, count, buf| buf.put(substring_from_count(s, from, count)), diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/string/trim.rs b/crates/rayexec_execution/src/functions/scalar/builtin/string/trim.rs index 7eb5fb26d..bcf312d68 100644 --- a/crates/rayexec_execution/src/functions/scalar/builtin/string/trim.rs +++ b/crates/rayexec_execution/src/functions/scalar/builtin/string/trim.rs @@ -2,7 +2,7 @@ use std::fmt::Debug; use std::marker::PhantomData; use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::builder::{ArrayBuilder, GermanVarlenBuffer}; use rayexec_bullet::executor::physical_type::PhysicalUtf8Old; use rayexec_bullet::executor::scalar::{BinaryExecutor, UnaryExecutor}; @@ -188,18 +188,18 @@ impl ScalarFunction for Trim { match datatypes.len() { 1 => match &datatypes[0] { - DataType::Utf8 => Ok(PlannedScalarFunction { + DataTypeOld::Utf8 => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(TrimWhitespaceImpl::::new()), }), a => Err(invalid_input_types_error(self, &[a])), }, 2 => match (&datatypes[0], &datatypes[1]) { - (DataType::Utf8, DataType::Utf8) => Ok(PlannedScalarFunction { + (DataTypeOld::Utf8, DataTypeOld::Utf8) => Ok(PlannedScalarFunction { function: Box::new(*self), - return_type: DataType::Utf8, + return_type: DataTypeOld::Utf8, inputs, function_impl: Box::new(TrimPatternImpl::::new()), }), @@ -222,9 +222,9 @@ impl TrimWhitespaceImpl { } impl ScalarFunctionImpl for TrimWhitespaceImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(inputs[0].logical_len()), }; @@ -247,9 +247,9 @@ impl TrimPatternImpl { } impl ScalarFunctionImpl for TrimPatternImpl { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { let builder = ArrayBuilder { - datatype: DataType::Utf8, + datatype: DataTypeOld::Utf8, buffer: GermanVarlenBuffer::::with_len(inputs[0].logical_len()), }; diff --git a/crates/rayexec_execution/src/functions/scalar/builtin/temp_add_2.rs b/crates/rayexec_execution/src/functions/scalar/builtin/temp_add_2.rs new file mode 100644 index 000000000..57c50f265 --- /dev/null +++ b/crates/rayexec_execution/src/functions/scalar/builtin/temp_add_2.rs @@ -0,0 +1,68 @@ +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; +use rayexec_error::Result; + +use super::ScalarFunction; +use crate::arrays::batch::Batch; +use crate::arrays::buffer::physical_type::PhysicalI32; +use crate::arrays::executor::scalar::unary::UnaryExecutor; +use crate::arrays::executor::OutBuffer; +use crate::expr::Expression; +use crate::functions::scalar::{PlannedScalarFunction, ScalarFunctionImpl}; +use crate::functions::{invalid_input_types_error, plan_check_num_args, FunctionInfo, Signature}; +use crate::logical::binder::table_list::TableList; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct TempAdd2; + +impl FunctionInfo for TempAdd2 { + fn name(&self) -> &'static str { + "temp_add_2" + } + + fn signatures(&self) -> &[Signature] { + &[Signature { + positional_args: &[DataTypeId::Int32], + variadic_arg: None, + return_type: DataTypeId::Int32, + doc: None, + }] + } +} + +impl ScalarFunction for TempAdd2 { + fn plan( + &self, + table_list: &TableList, + inputs: Vec, + ) -> Result { + plan_check_num_args(self, &inputs, 1)?; + + let datatype = inputs[0].datatype(table_list)?; + if datatype != DataTypeOld::Int32 { + return Err(invalid_input_types_error(self, &[datatype])); + } + + Ok(PlannedScalarFunction { + function: Box::new(*self), + return_type: DataTypeOld::Int32, + inputs, + function_impl: Box::new(TempAdd2Impl), + }) + } +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct TempAdd2Impl; + +impl ScalarFunctionImpl for TempAdd2Impl { + fn execute(&self, batch: &Batch, out: OutBuffer) -> Result<()> { + let input = batch.get_array(0)?; + + UnaryExecutor::execute::( + input, + batch.generate_selection(), + out, + |&v, buf| buf.put(&(v + 2)), + ) + } +} diff --git a/crates/rayexec_execution/src/functions/scalar/mod.rs b/crates/rayexec_execution/src/functions/scalar/mod.rs index a188c4f40..d2e4d964f 100644 --- a/crates/rayexec_execution/src/functions/scalar/mod.rs +++ b/crates/rayexec_execution/src/functions/scalar/mod.rs @@ -5,7 +5,7 @@ use std::hash::Hash; use dyn_clone::DynClone; use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use super::FunctionInfo; @@ -78,7 +78,7 @@ pub struct PlannedScalarFunction { /// serialized/deserializing planned functions. pub function: Box, /// Return type of the functions. - pub return_type: DataType, + pub return_type: DataTypeOld, /// Inputs to the functions. pub inputs: Vec, /// The function implmentation. @@ -106,11 +106,11 @@ impl Hash for PlannedScalarFunction { } pub trait ScalarFunctionImpl: Debug + Sync + Send + DynClone { - fn execute(&self, inputs: &[&ArrayOld]) -> Result { + fn execute_old(&self, inputs: &[&ArrayOld]) -> Result { unimplemented!() } - fn execute2(&self, batch: &Batch, out: OutBuffer) -> Result<()> { + fn execute(&self, batch: &Batch, out: OutBuffer) -> Result<()> { unimplemented!() } } diff --git a/crates/rayexec_execution/src/functions/table/builtin/series.rs b/crates/rayexec_execution/src/functions/table/builtin/series.rs index 786a48d47..7a417f37b 100644 --- a/crates/rayexec_execution/src/functions/table/builtin/series.rs +++ b/crates/rayexec_execution/src/functions/table/builtin/series.rs @@ -3,7 +3,7 @@ use std::task::{Context, Waker}; use rayexec_bullet::array::ArrayOld; use rayexec_bullet::batch::BatchOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::physical_type::PhysicalI64Old; use rayexec_bullet::executor::scalar::UnaryExecutor; use rayexec_bullet::field::{Field, Schema}; @@ -97,7 +97,7 @@ impl InOutPlanner for GenerateSeriesInOutPlanner { .collect::>>()?; for datatype in &datatypes { - if datatype != &DataType::Int64 { + if datatype != &DataTypeOld::Int64 { return Err(invalid_input_types_error(&GenerateSeries, &datatypes)); } } @@ -113,7 +113,7 @@ impl InOutPlanner for GenerateSeriesInOutPlanner { named_inputs, function_impl: TableFunctionImpl::InOut(Box::new(GenerateSeriesInOutImpl)), cardinality: StatisticsValue::Unknown, - schema: Schema::new([Field::new("generate_series", DataType::Int64, false)]), + schema: Schema::new([Field::new("generate_series", DataTypeOld::Int64, false)]), }) } } @@ -195,7 +195,7 @@ impl SeriesParams { self.curr = *last + self.step; } - ArrayOld::new_with_array_data(DataType::Int64, PrimitiveStorage::from(series)) + ArrayOld::new_with_array_data(DataTypeOld::Int64, PrimitiveStorage::from(series)) } } diff --git a/crates/rayexec_execution/src/functions/table/builtin/system.rs b/crates/rayexec_execution/src/functions/table/builtin/system.rs index d035ebcfd..24e08b774 100644 --- a/crates/rayexec_execution/src/functions/table/builtin/system.rs +++ b/crates/rayexec_execution/src/functions/table/builtin/system.rs @@ -8,7 +8,7 @@ use parking_lot::Mutex; use rayexec_bullet::array::ArrayOld; use rayexec_bullet::batch::BatchOld; use rayexec_bullet::bitmap::Bitmap; -use rayexec_bullet::datatype::{DataType, DataTypeId, ListTypeMeta}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld, ListTypeMeta}; use rayexec_bullet::executor::builder::{ArrayDataBuffer, GermanVarlenBuffer}; use rayexec_bullet::field::{Field, Schema}; use rayexec_bullet::scalar::OwnedScalarValue; @@ -55,8 +55,8 @@ impl SystemFunctionImpl for ListDatabasesImpl { fn schema() -> Schema { Schema::new([ - Field::new("database_name", DataType::Utf8, false), - Field::new("datasource", DataType::Utf8, false), + Field::new("database_name", DataTypeOld::Utf8, false), + Field::new("datasource", DataTypeOld::Utf8, false), ]) } @@ -79,8 +79,8 @@ impl SystemFunctionImpl for ListDatabasesImpl { } BatchOld::try_new([ - ArrayOld::new_with_array_data(DataType::Utf8, database_names.into_data()), - ArrayOld::new_with_array_data(DataType::Utf8, datasources.into_data()), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, database_names.into_data()), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, datasources.into_data()), ]) } } @@ -95,24 +95,24 @@ impl SystemFunctionImpl for ListFunctionsImpl { fn schema() -> Schema { Schema::new([ - Field::new("database_name", DataType::Utf8, false), - Field::new("schema_name", DataType::Utf8, false), - Field::new("function_name", DataType::Utf8, false), - Field::new("function_type", DataType::Utf8, false), + Field::new("database_name", DataTypeOld::Utf8, false), + Field::new("schema_name", DataTypeOld::Utf8, false), + Field::new("function_name", DataTypeOld::Utf8, false), + Field::new("function_type", DataTypeOld::Utf8, false), Field::new( "argument_types", - DataType::List(ListTypeMeta::new(DataType::Utf8)), + DataTypeOld::List(ListTypeMeta::new(DataTypeOld::Utf8)), false, ), Field::new( "argument_names", - DataType::List(ListTypeMeta::new(DataType::Utf8)), + DataTypeOld::List(ListTypeMeta::new(DataTypeOld::Utf8)), false, ), - Field::new("return_type", DataType::Utf8, false), - Field::new("description", DataType::Utf8, true), - Field::new("example", DataType::Utf8, true), - Field::new("example_output", DataType::Utf8, true), + Field::new("return_type", DataTypeOld::Utf8, false), + Field::new("description", DataTypeOld::Utf8, true), + Field::new("example", DataTypeOld::Utf8, true), + Field::new("example_output", DataTypeOld::Utf8, true), ]) } @@ -232,33 +232,37 @@ impl SystemFunctionImpl for ListFunctionsImpl { })?; BatchOld::try_new([ - ArrayOld::new_with_array_data(DataType::Utf8, database_names), - ArrayOld::new_with_array_data(DataType::Utf8, schema_names), - ArrayOld::new_with_array_data(DataType::Utf8, function_names), - ArrayOld::new_with_array_data(DataType::Utf8, function_types), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, database_names), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, schema_names), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, function_names), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, function_types), ArrayOld::new_with_array_data( - DataType::List(ListTypeMeta::new(DataType::Utf8)), + DataTypeOld::List(ListTypeMeta::new(DataTypeOld::Utf8)), ListStorage::try_new( argument_types_metadatas, - ArrayOld::new_with_array_data(DataType::Utf8, argument_types), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, argument_types), )?, ), ArrayOld::new_with_array_data( - DataType::List(ListTypeMeta::new(DataType::Utf8)), + DataTypeOld::List(ListTypeMeta::new(DataTypeOld::Utf8)), ListStorage::try_new( argument_names_metadatas, - ArrayOld::new_with_array_data(DataType::Utf8, argument_names), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, argument_names), )?, ), - ArrayOld::new_with_array_data(DataType::Utf8, return_types), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, return_types), ArrayOld::new_with_validity_and_array_data( - DataType::Utf8, + DataTypeOld::Utf8, descriptions_validity, descriptions, ), - ArrayOld::new_with_validity_and_array_data(DataType::Utf8, examples_validity, examples), ArrayOld::new_with_validity_and_array_data( - DataType::Utf8, + DataTypeOld::Utf8, + examples_validity, + examples, + ), + ArrayOld::new_with_validity_and_array_data( + DataTypeOld::Utf8, example_outputs_validity, example_outputs, ), @@ -276,9 +280,9 @@ impl SystemFunctionImpl for ListTablesImpl { fn schema() -> Schema { Schema::new([ - Field::new("database_name", DataType::Utf8, false), - Field::new("schema_name", DataType::Utf8, false), - Field::new("table_name", DataType::Utf8, false), + Field::new("database_name", DataTypeOld::Utf8, false), + Field::new("schema_name", DataTypeOld::Utf8, false), + Field::new("table_name", DataTypeOld::Utf8, false), ]) } @@ -309,9 +313,9 @@ impl SystemFunctionImpl for ListTablesImpl { })?; BatchOld::try_new([ - ArrayOld::new_with_array_data(DataType::Utf8, database_names), - ArrayOld::new_with_array_data(DataType::Utf8, schema_names), - ArrayOld::new_with_array_data(DataType::Utf8, table_names), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, database_names), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, schema_names), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, table_names), ]) } } @@ -326,8 +330,8 @@ impl SystemFunctionImpl for ListSchemasImpl { fn schema() -> Schema { Schema::new([ - Field::new("database_name", DataType::Utf8, false), - Field::new("schema_name", DataType::Utf8, false), + Field::new("database_name", DataTypeOld::Utf8, false), + Field::new("schema_name", DataTypeOld::Utf8, false), ]) } @@ -349,8 +353,8 @@ impl SystemFunctionImpl for ListSchemasImpl { })?; BatchOld::try_new([ - ArrayOld::new_with_array_data(DataType::Utf8, database_names), - ArrayOld::new_with_array_data(DataType::Utf8, schema_names), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, database_names), + ArrayOld::new_with_array_data(DataTypeOld::Utf8, schema_names), ]) } } diff --git a/crates/rayexec_execution/src/functions/table/builtin/unnest.rs b/crates/rayexec_execution/src/functions/table/builtin/unnest.rs index 4e6e2ecf3..cad9f3818 100644 --- a/crates/rayexec_execution/src/functions/table/builtin/unnest.rs +++ b/crates/rayexec_execution/src/functions/table/builtin/unnest.rs @@ -3,7 +3,7 @@ use std::task::{Context, Waker}; use rayexec_bullet::array::{ArrayData, ArrayOld}; use rayexec_bullet::batch::BatchOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::executor::physical_type::{PhysicalList, PhysicalType}; use rayexec_bullet::executor::scalar::UnaryExecutor; use rayexec_bullet::field::{Field, Schema}; @@ -82,8 +82,8 @@ impl InOutPlanner for Unnest { let datatype = positional_inputs[0].datatype(table_list)?; let return_type = match datatype { - DataType::List(m) => *m.datatype, - DataType::Null => DataType::Null, + DataTypeOld::List(m) => *m.datatype, + DataTypeOld::Null => DataTypeOld::Null, other => return Err(invalid_input_types_error(self, &[other])), }; diff --git a/crates/rayexec_execution/src/logical/binder/bind_context.rs b/crates/rayexec_execution/src/logical/binder/bind_context.rs index 1a0d4c743..afa188292 100644 --- a/crates/rayexec_execution/src/logical/binder/bind_context.rs +++ b/crates/rayexec_execution/src/logical/binder/bind_context.rs @@ -1,7 +1,7 @@ use std::collections::{HashMap, HashSet}; use std::fmt; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::{RayexecError, Result}; use super::bind_query::BoundQuery; @@ -88,7 +88,7 @@ pub struct BoundCte { /// Column names, possibly aliased. pub column_names: Vec, /// Column types. - pub column_types: Vec, + pub column_types: Vec, /// The bound plan representing the CTE. pub bound: Box, /// Materialization reference for the CTE. @@ -429,7 +429,7 @@ impl BindContext { pub fn new_ephemeral_table_with_columns( &mut self, - column_types: Vec, + column_types: Vec, column_names: Vec, ) -> Result { let table_idx = self.tables.tables.len(); @@ -481,7 +481,7 @@ impl BindContext { pub fn new_ephemeral_table_from_types( &mut self, generated_prefix: &str, - types: Vec, + types: Vec, ) -> Result { let names = (0..types.len()) .map(|idx| format!("{generated_prefix}_{idx}")) @@ -494,7 +494,7 @@ impl BindContext { &mut self, table: TableRef, name: impl Into, - datatype: DataType, + datatype: DataTypeOld, ) -> Result { let table = self.get_table_mut(table)?; let idx = table.column_types.len(); @@ -503,7 +503,7 @@ impl BindContext { Ok(idx) } - pub fn get_column(&self, table_ref: TableRef, col_idx: usize) -> Result<(&str, &DataType)> { + pub fn get_column(&self, table_ref: TableRef, col_idx: usize) -> Result<(&str, &DataTypeOld)> { self.tables.get_column(table_ref, col_idx) } @@ -519,7 +519,7 @@ impl BindContext { &mut self, bind_ref: BindScopeRef, alias: Option, - column_types: Vec, + column_types: Vec, column_names: Vec, ) -> Result { if let Some(alias) = &alias { @@ -669,7 +669,7 @@ pub(crate) mod testutil { pub fn columns_in_scope( bind_context: &BindContext, scope: BindScopeRef, - ) -> Vec<(String, DataType)> { + ) -> Vec<(String, DataTypeOld)> { bind_context .iter_tables_in_scope(scope) .unwrap() diff --git a/crates/rayexec_execution/src/logical/binder/bind_copy.rs b/crates/rayexec_execution/src/logical/binder/bind_copy.rs index 2a788cadd..fd9d73660 100644 --- a/crates/rayexec_execution/src/logical/binder/bind_copy.rs +++ b/crates/rayexec_execution/src/logical/binder/bind_copy.rs @@ -1,4 +1,4 @@ -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::field::{Field, Schema}; use rayexec_error::{RayexecError, Result}; use rayexec_io::location::FileLocation; @@ -49,7 +49,7 @@ impl<'a> CopyBinder<'a> { bind_context.push_table( self.current, None, - vec![DataType::UInt64], + vec![DataTypeOld::UInt64], vec!["rows_copied".to_string()], )?; diff --git a/crates/rayexec_execution/src/logical/binder/bind_describe.rs b/crates/rayexec_execution/src/logical/binder/bind_describe.rs index b6da1f366..dd13c23d9 100644 --- a/crates/rayexec_execution/src/logical/binder/bind_describe.rs +++ b/crates/rayexec_execution/src/logical/binder/bind_describe.rs @@ -1,4 +1,4 @@ -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::field::{Field, Schema}; use rayexec_error::Result; use rayexec_parser::ast; @@ -34,7 +34,7 @@ impl<'a> DescribeBinder<'a> { let table_ref = bind_context.push_table( self.current, None, - vec![DataType::Utf8, DataType::Utf8], + vec![DataTypeOld::Utf8, DataTypeOld::Utf8], vec!["column_name".to_string(), "datatype".to_string()], )?; diff --git a/crates/rayexec_execution/src/logical/binder/bind_explain.rs b/crates/rayexec_execution/src/logical/binder/bind_explain.rs index 977df25d6..b31fa73ae 100644 --- a/crates/rayexec_execution/src/logical/binder/bind_explain.rs +++ b/crates/rayexec_execution/src/logical/binder/bind_explain.rs @@ -1,4 +1,4 @@ -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use rayexec_parser::ast; @@ -58,7 +58,7 @@ impl<'a> ExplainBinder<'a> { bind_context.push_table( self.current, None, - vec![DataType::Utf8, DataType::Utf8], + vec![DataTypeOld::Utf8, DataTypeOld::Utf8], vec!["plan_type".to_string(), "plan".to_string()], )?; diff --git a/crates/rayexec_execution/src/logical/binder/bind_insert.rs b/crates/rayexec_execution/src/logical/binder/bind_insert.rs index 38f9f945c..1b56fd92a 100644 --- a/crates/rayexec_execution/src/logical/binder/bind_insert.rs +++ b/crates/rayexec_execution/src/logical/binder/bind_insert.rs @@ -1,4 +1,4 @@ -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::{RayexecError, Result}; use rayexec_parser::ast; @@ -59,7 +59,7 @@ impl<'a> InsertBinder<'a> { bind_context.push_table( self.current, None, - vec![DataType::UInt64], + vec![DataTypeOld::UInt64], vec!["rows_inserted".to_string()], )?; @@ -90,7 +90,7 @@ impl<'a> InsertBinder<'a> { .map(|c| &c.datatype); // Types from the source plan. - let source_types: Vec<(TableRef, usize, &DataType)> = bind_context + let source_types: Vec<(TableRef, usize, &DataTypeOld)> = bind_context .iter_tables_in_scope(source_scope)? .flat_map(|t| { let table_ref = t.reference; diff --git a/crates/rayexec_execution/src/logical/binder/bind_query/bind_from.rs b/crates/rayexec_execution/src/logical/binder/bind_query/bind_from.rs index 87d07f0aa..41d46c8e0 100644 --- a/crates/rayexec_execution/src/logical/binder/bind_query/bind_from.rs +++ b/crates/rayexec_execution/src/logical/binder/bind_query/bind_from.rs @@ -1,7 +1,7 @@ use std::collections::{HashMap, HashSet}; use std::sync::Arc; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::{not_implemented, RayexecError, Result}; use rayexec_parser::ast; @@ -142,7 +142,7 @@ impl<'a> FromBinder<'a> { bind_context: &mut BindContext, mut default_alias: Option, mut default_column_aliases: Vec, - column_types: Vec, + column_types: Vec, from_alias: Option, ) -> Result { match from_alias { diff --git a/crates/rayexec_execution/src/logical/binder/bind_query/bind_select.rs b/crates/rayexec_execution/src/logical/binder/bind_query/bind_select.rs index 53fadadd4..9cdd7c41a 100644 --- a/crates/rayexec_execution/src/logical/binder/bind_query/bind_select.rs +++ b/crates/rayexec_execution/src/logical/binder/bind_query/bind_select.rs @@ -155,7 +155,7 @@ impl<'a> SelectBinder<'a> { #[cfg(test)] mod tests { - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use super::*; use crate::logical::binder::bind_context::testutil::columns_in_scope; @@ -194,8 +194,8 @@ mod tests { let cols = columns_in_scope(&bind_context, bind_context.root_scope_ref()); let expected = vec![ - ("?column?".to_string(), DataType::Int32), - ("my_alias".to_string(), DataType::Int32), + ("?column?".to_string(), DataTypeOld::Int32), + ("my_alias".to_string(), DataTypeOld::Int32), ]; assert_eq!(expected, cols); diff --git a/crates/rayexec_execution/src/logical/binder/bind_query/bind_values.rs b/crates/rayexec_execution/src/logical/binder/bind_query/bind_values.rs index cbb970033..c7c6d6e03 100644 --- a/crates/rayexec_execution/src/logical/binder/bind_query/bind_values.rs +++ b/crates/rayexec_execution/src/logical/binder/bind_query/bind_values.rs @@ -1,4 +1,4 @@ -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::{RayexecError, Result}; use rayexec_parser::ast; @@ -79,7 +79,7 @@ impl<'a> ValuesBinder<'a> { } for (expr, datatype) in row.iter().zip(&mut types) { - if datatype == &DataType::Null { + if datatype == &DataTypeOld::Null { // Replace with current expression type. *datatype = expr.datatype(bind_context.get_table_list())?; } diff --git a/crates/rayexec_execution/src/logical/binder/bind_query/select_expr_expander.rs b/crates/rayexec_execution/src/logical/binder/bind_query/select_expr_expander.rs index 00f7410e4..1a5896198 100644 --- a/crates/rayexec_execution/src/logical/binder/bind_query/select_expr_expander.rs +++ b/crates/rayexec_execution/src/logical/binder/bind_query/select_expr_expander.rs @@ -292,7 +292,7 @@ impl<'a> SelectExprExpander<'a> { #[cfg(test)] mod tests { use ast::ObjectReference; - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use super::*; @@ -332,7 +332,7 @@ mod tests { schema: Some("s1".to_string()), table: "t1".to_string(), }), - vec![DataType::Utf8, DataType::Utf8], + vec![DataTypeOld::Utf8, DataTypeOld::Utf8], vec!["c1".to_string(), "c2".to_string()], ) .unwrap(); @@ -377,7 +377,7 @@ mod tests { schema: Some("s1".to_string()), table: "t1".to_string(), }), - vec![DataType::Utf8, DataType::Utf8], + vec![DataTypeOld::Utf8, DataTypeOld::Utf8], vec!["c1".to_string(), "c2".to_string()], ) .unwrap(); @@ -390,7 +390,7 @@ mod tests { schema: Some("s1".to_string()), table: "t2".to_string(), }), - vec![DataType::Utf8, DataType::Utf8], + vec![DataTypeOld::Utf8, DataTypeOld::Utf8], vec!["c3".to_string(), "c4".to_string()], ) .unwrap(); diff --git a/crates/rayexec_execution/src/logical/binder/bind_set.rs b/crates/rayexec_execution/src/logical/binder/bind_set.rs index b37516ef6..830b20cf2 100644 --- a/crates/rayexec_execution/src/logical/binder/bind_set.rs +++ b/crates/rayexec_execution/src/logical/binder/bind_set.rs @@ -1,4 +1,4 @@ -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use rayexec_parser::ast; @@ -84,7 +84,12 @@ impl<'a> SetVarBinder<'a> { let name = show.reference.pop()?; // TODO: Allow compound references? let var = self.config.get_as_scalar(&name)?; - bind_context.push_table(self.current, None, vec![DataType::Utf8], vec![name.clone()])?; + bind_context.push_table( + self.current, + None, + vec![DataTypeOld::Utf8], + vec![name.clone()], + )?; Ok(Node { node: LogicalShowVar { name, value: var }, diff --git a/crates/rayexec_execution/src/logical/binder/expr_binder.rs b/crates/rayexec_execution/src/logical/binder/expr_binder.rs index 9fc0cf5d9..39a772c7e 100644 --- a/crates/rayexec_execution/src/logical/binder/expr_binder.rs +++ b/crates/rayexec_execution/src/logical/binder/expr_binder.rs @@ -1,5 +1,5 @@ use fmtutil::IntoDisplayableSlice; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::scalar::interval::Interval; use rayexec_bullet::scalar::{OwnedScalarValue, ScalarValue}; use rayexec_error::{not_implemented, RayexecError, Result}; @@ -758,7 +758,7 @@ impl<'a> BaseExpressionBinder<'a> { })) } None => Ok(Expression::Cast(CastExpr { - to: DataType::Interval, + to: DataTypeOld::Interval, expr: Box::new(expr), })), } @@ -1005,7 +1005,7 @@ impl<'a> BaseExpressionBinder<'a> { let return_type = if subquery_type == SubqueryType::Scalar { query_return_type.clone() } else { - DataType::Boolean + DataTypeOld::Boolean }; if matches!( @@ -1383,8 +1383,8 @@ impl<'a> BaseExpressionBinder<'a> { } match input.datatype(bind_context.get_table_list())? { - DataType::Decimal64(m) => decimal64_meta = Some(m), - DataType::Decimal128(m) => decimal128_meta = Some(m), + DataTypeOld::Decimal64(m) => decimal64_meta = Some(m), + DataTypeOld::Decimal128(m) => decimal128_meta = Some(m), _ => (), } } @@ -1392,12 +1392,12 @@ impl<'a> BaseExpressionBinder<'a> { for input in &mut inputs { if let Expression::Cast(cast) = input { match &mut cast.to { - DataType::Decimal64(curr) => { + DataTypeOld::Decimal64(curr) => { if let Some(m) = decimal64_meta { *curr = m; } } - DataType::Decimal128(curr) => { + DataTypeOld::Decimal128(curr) => { if let Some(m) = decimal128_meta { *curr = m; } @@ -1458,7 +1458,7 @@ impl<'a> BaseExpressionBinder<'a> { .map(|(input, cast_to)| { Ok(match cast_to { CastType::Cast { to, .. } => Expression::Cast(CastExpr { - to: DataType::try_default_datatype(to)?, + to: DataTypeOld::try_default_datatype(to)?, expr: Box::new(input), }), CastType::NoCastNeeded => input, @@ -1507,7 +1507,7 @@ impl<'a> BaseExpressionBinder<'a> { .map(|(input, cast_to)| { Ok(match cast_to { CastType::Cast { to, .. } => Expression::Cast(CastExpr { - to: DataType::try_default_datatype(to)?, + to: DataTypeOld::try_default_datatype(to)?, expr: Box::new(input), }), CastType::NoCastNeeded => input, @@ -1560,7 +1560,7 @@ impl<'a> BaseExpressionBinder<'a> { .map(|(input, cast_to)| { Ok(match cast_to { CastType::Cast { to, .. } => Expression::Cast(CastExpr { - to: DataType::try_default_datatype(to)?, + to: DataTypeOld::try_default_datatype(to)?, expr: Box::new(input), }), CastType::NoCastNeeded => input, diff --git a/crates/rayexec_execution/src/logical/binder/table_list.rs b/crates/rayexec_execution/src/logical/binder/table_list.rs index 9776b8fe3..fd9586e21 100644 --- a/crates/rayexec_execution/src/logical/binder/table_list.rs +++ b/crates/rayexec_execution/src/logical/binder/table_list.rs @@ -1,6 +1,6 @@ use std::fmt; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::{RayexecError, Result}; use serde::{Deserialize, Serialize}; @@ -70,7 +70,7 @@ impl fmt::Display for TableAlias { pub struct Table { pub reference: TableRef, pub alias: Option, - pub column_types: Vec, + pub column_types: Vec, pub column_names: Vec, } @@ -110,7 +110,7 @@ impl TableList { pub fn push_table( &mut self, alias: Option, - column_types: Vec, + column_types: Vec, column_names: Vec, ) -> Result { if column_types.len() != column_names.len() { @@ -133,7 +133,7 @@ impl TableList { Ok(reference) } - pub fn get_column(&self, table_ref: TableRef, col_idx: usize) -> Result<(&str, &DataType)> { + pub fn get_column(&self, table_ref: TableRef, col_idx: usize) -> Result<(&str, &DataTypeOld)> { let table = self.get(table_ref)?; let name = table .column_names diff --git a/crates/rayexec_execution/src/logical/logical_scan.rs b/crates/rayexec_execution/src/logical/logical_scan.rs index 56f1e2e46..127f02e2a 100644 --- a/crates/rayexec_execution/src/logical/logical_scan.rs +++ b/crates/rayexec_execution/src/logical/logical_scan.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use super::binder::bind_context::BindContext; @@ -52,7 +52,7 @@ pub struct LogicalScan { /// Table reference representing output of this scan. pub table_ref: TableRef, /// Types representing all columns from the source. - pub types: Vec, + pub types: Vec, /// Names for all columns from the source. pub names: Vec, /// Positional column projections. diff --git a/crates/rayexec_execution/src/logical/planner/plan_subquery.rs b/crates/rayexec_execution/src/logical/planner/plan_subquery.rs index f73ce50be..8790f1586 100644 --- a/crates/rayexec_execution/src/logical/planner/plan_subquery.rs +++ b/crates/rayexec_execution/src/logical/planner/plan_subquery.rs @@ -1,6 +1,6 @@ use std::collections::{BTreeSet, HashMap}; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::scalar::ScalarValue; use rayexec_error::{not_implemented, RayexecError, Result}; @@ -180,7 +180,7 @@ impl SubqueryPlanner { bind_context.push_column_for_table( mark_table, "__generated_visited_bool", - DataType::Boolean, + DataTypeOld::Boolean, )?; *plan = LogicalOperator::MagicJoin(Node { @@ -223,7 +223,7 @@ impl SubqueryPlanner { bind_context.push_column_for_table( mark_table, "__generated_visited_bool", - DataType::Boolean, + DataTypeOld::Boolean, )?; conditions.push(ComparisonCondition { @@ -399,14 +399,14 @@ impl SubqueryPlanner { bind_context.push_column_for_table( agg_table, "__generated_count", - DataType::Int64, + DataTypeOld::Int64, )?; let projection_table = bind_context.new_ephemeral_table()?; bind_context.push_column_for_table( projection_table, "__generated_exists", - DataType::Boolean, + DataTypeOld::Boolean, )?; let subquery_exists_plan = LogicalOperator::Project(Node { @@ -487,7 +487,7 @@ impl SubqueryPlanner { bind_context.push_column_for_table( mark_table, "__generated_visited_bool", - DataType::Boolean, + DataTypeOld::Boolean, )?; let subquery_table = subquery_plan.get_output_table_refs(bind_context)[0]; diff --git a/crates/rayexec_execution/src/logical/planner/plan_unnest.rs b/crates/rayexec_execution/src/logical/planner/plan_unnest.rs index bb6ab25b4..93a89930c 100644 --- a/crates/rayexec_execution/src/logical/planner/plan_unnest.rs +++ b/crates/rayexec_execution/src/logical/planner/plan_unnest.rs @@ -1,4 +1,4 @@ -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_error::Result; use crate::expr::column_expr::ColumnExpr; @@ -78,7 +78,7 @@ impl UnnestPlanner { // Need to store the type that's being produced from the unnest, so // unwrap the list data type. let datatype = match expr.datatype(bind_context.get_table_list())? { - DataType::List(list) => list.datatype.as_ref().clone(), + DataTypeOld::List(list) => list.datatype.as_ref().clone(), other => other, }; diff --git a/crates/rayexec_execution/src/logical/resolver/mod.rs b/crates/rayexec_execution/src/logical/resolver/mod.rs index df2c71a70..c1cf96ff2 100644 --- a/crates/rayexec_execution/src/logical/resolver/mod.rs +++ b/crates/rayexec_execution/src/logical/resolver/mod.rs @@ -11,7 +11,7 @@ pub mod resolved_table_function; use std::collections::HashMap; use expr_resolver::ExpressionResolver; -use rayexec_bullet::datatype::{DataType, DecimalTypeMeta, TimeUnit, TimestampTypeMeta}; +use rayexec_bullet::datatype::{DataTypeOld, DecimalTypeMeta, TimeUnit, TimestampTypeMeta}; use rayexec_bullet::scalar::decimal::{Decimal128Type, Decimal64Type, DecimalType}; use rayexec_bullet::scalar::{OwnedScalarValue, ScalarValue}; use rayexec_error::{OptionExt, RayexecError, Result}; @@ -63,7 +63,7 @@ impl AstMeta for ResolvedMeta { /// Index into the functions bind list in bind data. type FunctionReference = ResolveListIdx; type SubqueryOptions = ResolvedSubqueryOptions; - type DataType = DataType; + type DataType = DataTypeOld; type CopyToDestination = FileLocation; type CopyToOptions = CopyToArgs; /// SHOW statements will be converted to views if need during the resolve @@ -1123,16 +1123,16 @@ impl<'a> Resolver<'a> { .collect() } - fn ast_datatype_to_exec_datatype(datatype: ast::DataType) -> Result { + fn ast_datatype_to_exec_datatype(datatype: ast::DataType) -> Result { Ok(match datatype { - ast::DataType::Varchar(_) => DataType::Utf8, - ast::DataType::TinyInt => DataType::Int8, - ast::DataType::SmallInt => DataType::Int16, - ast::DataType::Integer => DataType::Int32, - ast::DataType::BigInt => DataType::Int64, - ast::DataType::Half => DataType::Float16, - ast::DataType::Real => DataType::Float32, - ast::DataType::Double => DataType::Float64, + ast::DataType::Varchar(_) => DataTypeOld::Utf8, + ast::DataType::TinyInt => DataTypeOld::Int8, + ast::DataType::SmallInt => DataTypeOld::Int16, + ast::DataType::Integer => DataTypeOld::Int32, + ast::DataType::BigInt => DataTypeOld::Int64, + ast::DataType::Half => DataTypeOld::Float16, + ast::DataType::Real => DataTypeOld::Float32, + ast::DataType::Double => DataTypeOld::Float64, ast::DataType::Decimal(prec, scale) => { // - Precision cannot be negative. // - Specifying just precision defaults to a 0 scale. @@ -1160,28 +1160,28 @@ impl<'a> Resolver<'a> { } if prec <= Decimal64Type::MAX_PRECISION { - DataType::Decimal64(DecimalTypeMeta::new(prec, scale)) + DataTypeOld::Decimal64(DecimalTypeMeta::new(prec, scale)) } else if prec <= Decimal128Type::MAX_PRECISION { - DataType::Decimal128(DecimalTypeMeta::new(prec, scale)) + DataTypeOld::Decimal128(DecimalTypeMeta::new(prec, scale)) } else { return Err(RayexecError::new( "Decimal precision too big for max decimal size", )); } } - None => DataType::Decimal64(DecimalTypeMeta::new( + None => DataTypeOld::Decimal64(DecimalTypeMeta::new( Decimal64Type::MAX_PRECISION, Decimal64Type::DEFAULT_SCALE, )), } } - ast::DataType::Bool => DataType::Boolean, - ast::DataType::Date => DataType::Date32, + ast::DataType::Bool => DataTypeOld::Boolean, + ast::DataType::Date => DataTypeOld::Date32, ast::DataType::Timestamp => { // Microsecond matches postgres default. - DataType::Timestamp(TimestampTypeMeta::new(TimeUnit::Microsecond)) + DataTypeOld::Timestamp(TimestampTypeMeta::new(TimeUnit::Microsecond)) } - ast::DataType::Interval => DataType::Interval, + ast::DataType::Interval => DataTypeOld::Interval, }) } } diff --git a/crates/rayexec_execution/src/optimizer/expr_rewrite/const_fold.rs b/crates/rayexec_execution/src/optimizer/expr_rewrite/const_fold.rs index cc4741eae..cd273d7a2 100644 --- a/crates/rayexec_execution/src/optimizer/expr_rewrite/const_fold.rs +++ b/crates/rayexec_execution/src/optimizer/expr_rewrite/const_fold.rs @@ -58,7 +58,7 @@ fn maybe_fold(table_list: &TableList, expr: &mut Expression) -> Result<()> { #[cfg(test)] mod tests { - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use super::*; use crate::expr::{add, and, cast, col_ref, lit}; @@ -77,7 +77,7 @@ mod tests { #[test] fn fold_string_to_float_cast() { - let expr = cast(lit("3.1"), DataType::Float64); + let expr = cast(lit("3.1"), DataTypeOld::Float64); let expected = lit(3.1_f64); diff --git a/crates/rayexec_iceberg/src/spec/schema.rs b/crates/rayexec_iceberg/src/spec/schema.rs index 737aba9b0..06e7890a0 100644 --- a/crates/rayexec_iceberg/src/spec/schema.rs +++ b/crates/rayexec_iceberg/src/spec/schema.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use std::sync::LazyLock; use rayexec_bullet::datatype::{ - DataType, + DataTypeOld, DecimalTypeMeta, ListTypeMeta, TimeUnit, @@ -39,32 +39,32 @@ pub enum PrimitiveType { Binary, } -impl TryFrom for DataType { +impl TryFrom for DataTypeOld { type Error = RayexecError; fn try_from(value: PrimitiveType) -> Result { Ok(match value { - PrimitiveType::Boolean => DataType::Boolean, - PrimitiveType::Int => DataType::Int32, - PrimitiveType::Long => DataType::Int64, - PrimitiveType::Float => DataType::Float32, - PrimitiveType::Double => DataType::Float64, - PrimitiveType::Decimal { p, s } => DataType::Decimal128(DecimalTypeMeta { + PrimitiveType::Boolean => DataTypeOld::Boolean, + PrimitiveType::Int => DataTypeOld::Int32, + PrimitiveType::Long => DataTypeOld::Int64, + PrimitiveType::Float => DataTypeOld::Float32, + PrimitiveType::Double => DataTypeOld::Float64, + PrimitiveType::Decimal { p, s } => DataTypeOld::Decimal128(DecimalTypeMeta { precision: p, scale: s as i8, }), - PrimitiveType::Date => DataType::Date32, + PrimitiveType::Date => DataTypeOld::Date32, PrimitiveType::Time => { - DataType::Timestamp(TimestampTypeMeta::new(TimeUnit::Microsecond)) + DataTypeOld::Timestamp(TimestampTypeMeta::new(TimeUnit::Microsecond)) } // TODO: Possibly `Time32` instead? PrimitiveType::Timestamp => { - DataType::Timestamp(TimestampTypeMeta::new(TimeUnit::Microsecond)) + DataTypeOld::Timestamp(TimestampTypeMeta::new(TimeUnit::Microsecond)) } PrimitiveType::Timestamptz => not_implemented!("Timestamp with timezone"), - PrimitiveType::String => DataType::Utf8, - PrimitiveType::Uuid => DataType::Utf8, + PrimitiveType::String => DataTypeOld::Utf8, + PrimitiveType::Uuid => DataTypeOld::Utf8, PrimitiveType::Fixed(_) => not_implemented!("Fixed sized binary"), - PrimitiveType::Binary => DataType::Binary, + PrimitiveType::Binary => DataTypeOld::Binary, }) } } @@ -157,7 +157,7 @@ pub enum AnyType { Map(MapType), } -impl TryFrom<&AnyType> for DataType { +impl TryFrom<&AnyType> for DataTypeOld { type Error = RayexecError; fn try_from(value: &AnyType) -> Result { @@ -179,12 +179,12 @@ pub struct ListType { pub element: Box, } -impl TryFrom<&ListType> for DataType { +impl TryFrom<&ListType> for DataTypeOld { type Error = RayexecError; fn try_from(value: &ListType) -> Result { - let typ = DataType::try_from(value.element.as_ref())?; - Ok(DataType::List(ListTypeMeta::new(typ))) + let typ = DataTypeOld::try_from(value.element.as_ref())?; + Ok(DataTypeOld::List(ListTypeMeta::new(typ))) } } @@ -199,7 +199,7 @@ pub struct MapType { pub value: Box, } -impl TryFrom<&MapType> for DataType { +impl TryFrom<&MapType> for DataTypeOld { type Error = RayexecError; fn try_from(_value: &MapType) -> Result { @@ -225,7 +225,7 @@ pub struct StructType { pub fields: Vec, } -impl TryFrom<&StructType> for DataType { +impl TryFrom<&StructType> for DataTypeOld { type Error = RayexecError; fn try_from(_value: &StructType) -> Result { diff --git a/crates/rayexec_parquet/src/reader/mod.rs b/crates/rayexec_parquet/src/reader/mod.rs index 644bb1668..d13cd18c9 100644 --- a/crates/rayexec_parquet/src/reader/mod.rs +++ b/crates/rayexec_parquet/src/reader/mod.rs @@ -18,10 +18,10 @@ use parquet::data_type::Int96; use parquet::file::reader::{ChunkReader, Length, SerializedPageReader}; use parquet::schema::types::ColumnDescPtr; use primitive::PrimitiveArrayReader; -use rayexec_bullet::array::{ArrayOld, ArrayData}; +use rayexec_bullet::array::{ArrayData, ArrayOld}; use rayexec_bullet::batch::BatchOld; use rayexec_bullet::bitmap::Bitmap; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::field::Schema; use rayexec_error::{RayexecError, Result, ResultExt}; use rayexec_execution::storage::table_storage::Projections; @@ -45,7 +45,7 @@ pub trait ArrayBuilder: Send { /// Create a new array builder based on the provided type. pub fn builder_for_type

( batch_size: usize, - datatype: DataType, + datatype: DataTypeOld, physical: PhysicalType, desc: ColumnDescPtr, ) -> Result>> @@ -53,58 +53,64 @@ where P: PageReader + 'static, { match (&datatype, physical) { - (DataType::Boolean, _) => Ok(Box::new(PrimitiveArrayReader::::new( + (DataTypeOld::Boolean, _) => Ok(Box::new(PrimitiveArrayReader::::new( batch_size, datatype, desc, ))), - (DataType::Int16, _) => Ok(Box::new(PrimitiveArrayReader::::new( + (DataTypeOld::Int16, _) => Ok(Box::new(PrimitiveArrayReader::::new( batch_size, datatype, desc, ))), - (DataType::Int32, _) => Ok(Box::new(PrimitiveArrayReader::::new( + (DataTypeOld::Int32, _) => Ok(Box::new(PrimitiveArrayReader::::new( batch_size, datatype, desc, ))), - (DataType::UInt16, PhysicalType::INT32) => Ok(Box::new( + (DataTypeOld::UInt16, PhysicalType::INT32) => Ok(Box::new( PrimitiveArrayReader::::new(batch_size, datatype, desc), )), - (DataType::Int64, _) => Ok(Box::new(PrimitiveArrayReader::::new( + (DataTypeOld::Int64, _) => Ok(Box::new(PrimitiveArrayReader::::new( batch_size, datatype, desc, ))), - (DataType::Timestamp(_), PhysicalType::INT64) => Ok(Box::new( - PrimitiveArrayReader::::new(batch_size, datatype, desc), - )), - (DataType::Timestamp(_), PhysicalType::INT96) => { + (DataTypeOld::Timestamp(_), PhysicalType::INT64) => { + Ok(Box::new(PrimitiveArrayReader::::new( + batch_size, datatype, desc, + ))) + } + (DataTypeOld::Timestamp(_), PhysicalType::INT96) => { Ok(Box::new(PrimitiveArrayReader::::new( batch_size, datatype, desc, ))) } - (DataType::Float32, _) => Ok(Box::new(PrimitiveArrayReader::::new( + (DataTypeOld::Float32, _) => Ok(Box::new(PrimitiveArrayReader::::new( batch_size, datatype, desc, ))), - (DataType::Float64, _) => Ok(Box::new(PrimitiveArrayReader::::new( + (DataTypeOld::Float64, _) => Ok(Box::new(PrimitiveArrayReader::::new( batch_size, datatype, desc, ))), - (DataType::Date32, _) => Ok(Box::new(PrimitiveArrayReader::::new( + (DataTypeOld::Date32, _) => Ok(Box::new(PrimitiveArrayReader::::new( batch_size, datatype, desc, ))), - (DataType::Decimal64(_), PhysicalType::INT32) => Ok(Box::new( - PrimitiveArrayReader::::new(batch_size, datatype, desc), - )), - (DataType::Decimal64(_), PhysicalType::INT64) => Ok(Box::new( - PrimitiveArrayReader::::new(batch_size, datatype, desc), - )), - (DataType::Decimal128(_), PhysicalType::INT32) => { + (DataTypeOld::Decimal64(_), PhysicalType::INT32) => { + Ok(Box::new(PrimitiveArrayReader::::new( + batch_size, datatype, desc, + ))) + } + (DataTypeOld::Decimal64(_), PhysicalType::INT64) => { + Ok(Box::new(PrimitiveArrayReader::::new( + batch_size, datatype, desc, + ))) + } + (DataTypeOld::Decimal128(_), PhysicalType::INT32) => { Ok(Box::new(PrimitiveArrayReader::::new( batch_size, datatype, desc, ))) } - (DataType::Decimal128(_), PhysicalType::INT64) => { + (DataTypeOld::Decimal128(_), PhysicalType::INT64) => { Ok(Box::new(PrimitiveArrayReader::::new( batch_size, datatype, desc, ))) } - (DataType::Utf8, _) => Ok(Box::new(VarlenArrayReader::

::new( + (DataTypeOld::Utf8, _) => Ok(Box::new(VarlenArrayReader::

::new( batch_size, datatype, desc, ))), - (DataType::Binary, _) => Ok(Box::new(VarlenArrayReader::

::new( + (DataTypeOld::Binary, _) => Ok(Box::new(VarlenArrayReader::

::new( batch_size, datatype, desc, ))), other => Err(RayexecError::new(format!( diff --git a/crates/rayexec_parquet/src/reader/primitive.rs b/crates/rayexec_parquet/src/reader/primitive.rs index 818ab24e2..4e92aff15 100644 --- a/crates/rayexec_parquet/src/reader/primitive.rs +++ b/crates/rayexec_parquet/src/reader/primitive.rs @@ -7,7 +7,7 @@ use rayexec_bullet::array::{ArrayData, ArrayOld}; use rayexec_bullet::bitmap::Bitmap; use rayexec_bullet::compute::cast::array::cast_array; use rayexec_bullet::compute::cast::behavior::CastFailBehavior; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::storage::{BooleanStorage, PrimitiveStorage}; use rayexec_error::{RayexecError, Result}; @@ -21,7 +21,7 @@ use super::{ pub struct PrimitiveArrayReader { batch_size: usize, - datatype: DataType, + datatype: DataTypeOld, values_reader: ValuesReader, P>, values_buffer: Vec, } @@ -33,7 +33,7 @@ where T::T: Copy + Default, Vec: IntoArrayData, { - pub fn new(batch_size: usize, datatype: DataType, desc: ColumnDescPtr) -> Self { + pub fn new(batch_size: usize, datatype: DataTypeOld, desc: ColumnDescPtr) -> Self { PrimitiveArrayReader { batch_size, datatype, @@ -67,20 +67,20 @@ where // E.g. we may need to convert physical INT64 -> Decimal128. If that // happens, we'll apply cast after building. let (array_data, build_type) = match (T::get_physical_type(), &self.datatype) { - (PhysicalType::BOOLEAN, DataType::Boolean) => (data.into_array_data(), self.datatype.clone()), - (PhysicalType::INT32, DataType::Int16) => (data.into_array_data(), DataType::Int32), - (PhysicalType::INT32, DataType::Int32) => (data.into_array_data(), self.datatype.clone()), - (PhysicalType::INT32, DataType::UInt16) => (data.into_array_data(), DataType::Int32), - (PhysicalType::INT32, DataType::Date32) => (data.into_array_data(), self.datatype.clone()), - (PhysicalType::INT32, DataType::Decimal64(_)) => (data.into_array_data(), DataType::Int32), - (PhysicalType::INT32, DataType::Decimal128(_)) => (data.into_array_data(), DataType::Int32), - (PhysicalType::INT64, DataType::Int64) => (data.into_array_data(), self.datatype.clone()), - (PhysicalType::INT64, DataType::Decimal64(_)) => (data.into_array_data(), self.datatype.clone()), - (PhysicalType::INT64, DataType::Decimal128(_)) => (data.into_array_data(), DataType::Int64), // TODO - (PhysicalType::INT64, DataType::Timestamp(_)) => (data.into_array_data(), self.datatype.clone()), - (PhysicalType::INT96, DataType::Timestamp(_)) => (data.into_array_data(), self.datatype.clone()), - (PhysicalType::FLOAT, DataType::Float32) => (data.into_array_data(), self.datatype.clone()), - (PhysicalType::DOUBLE, DataType::Float64) => (data.into_array_data(), self.datatype.clone()), + (PhysicalType::BOOLEAN, DataTypeOld::Boolean) => (data.into_array_data(), self.datatype.clone()), + (PhysicalType::INT32, DataTypeOld::Int16) => (data.into_array_data(), DataTypeOld::Int32), + (PhysicalType::INT32, DataTypeOld::Int32) => (data.into_array_data(), self.datatype.clone()), + (PhysicalType::INT32, DataTypeOld::UInt16) => (data.into_array_data(), DataTypeOld::Int32), + (PhysicalType::INT32, DataTypeOld::Date32) => (data.into_array_data(), self.datatype.clone()), + (PhysicalType::INT32, DataTypeOld::Decimal64(_)) => (data.into_array_data(), DataTypeOld::Int32), + (PhysicalType::INT32, DataTypeOld::Decimal128(_)) => (data.into_array_data(), DataTypeOld::Int32), + (PhysicalType::INT64, DataTypeOld::Int64) => (data.into_array_data(), self.datatype.clone()), + (PhysicalType::INT64, DataTypeOld::Decimal64(_)) => (data.into_array_data(), self.datatype.clone()), + (PhysicalType::INT64, DataTypeOld::Decimal128(_)) => (data.into_array_data(), DataTypeOld::Int64), // TODO + (PhysicalType::INT64, DataTypeOld::Timestamp(_)) => (data.into_array_data(), self.datatype.clone()), + (PhysicalType::INT96, DataTypeOld::Timestamp(_)) => (data.into_array_data(), self.datatype.clone()), + (PhysicalType::FLOAT, DataTypeOld::Float32) => (data.into_array_data(), self.datatype.clone()), + (PhysicalType::DOUBLE, DataTypeOld::Float64) => (data.into_array_data(), self.datatype.clone()), (p_other, d_other) => return Err(RayexecError::new(format!("Unknown conversion from parquet to bullet type in primitive reader; parquet: {p_other}, bullet: {d_other}"))) }; diff --git a/crates/rayexec_parquet/src/reader/varlen.rs b/crates/rayexec_parquet/src/reader/varlen.rs index 75e40d8e6..80909f822 100644 --- a/crates/rayexec_parquet/src/reader/varlen.rs +++ b/crates/rayexec_parquet/src/reader/varlen.rs @@ -5,7 +5,7 @@ use parquet::data_type::{ByteArray, DataType as ParquetDataType}; use parquet::decoding::view::ViewBuffer; use parquet::schema::types::ColumnDescPtr; use rayexec_bullet::array::ArrayOld; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::builder::ArrayDataBuffer; use rayexec_error::{RayexecError, Result}; @@ -14,7 +14,7 @@ use super::{def_levels_into_bitmap, insert_null_values, ArrayBuilder, ValuesRead #[derive(Debug)] pub struct VarlenArrayReader { batch_size: usize, - datatype: DataType, + datatype: DataTypeOld, values_reader: ValuesReader, values_buffer: ViewBuffer, } @@ -23,7 +23,7 @@ impl

VarlenArrayReader

where P: PageReader, { - pub fn new(batch_size: usize, datatype: DataType, desc: ColumnDescPtr) -> Self { + pub fn new(batch_size: usize, datatype: DataTypeOld, desc: ColumnDescPtr) -> Self { VarlenArrayReader { batch_size, datatype, diff --git a/crates/rayexec_parquet/src/schema.rs b/crates/rayexec_parquet/src/schema.rs index 5652dda54..bb30bcd6a 100644 --- a/crates/rayexec_parquet/src/schema.rs +++ b/crates/rayexec_parquet/src/schema.rs @@ -10,7 +10,7 @@ use parquet::basic::{ use parquet::format::{MicroSeconds, MilliSeconds, NanoSeconds}; use parquet::schema::types::{BasicTypeInfo, SchemaDescriptor, Type}; use rayexec_bullet::datatype::{ - DataType, + DataTypeOld, DecimalTypeMeta, ListTypeMeta, TimeUnit, @@ -58,72 +58,72 @@ fn to_parquet_type(field: &Field) -> Result { }; let result = match &field.datatype { - DataType::Boolean => Type::primitive_type_builder(&field.name, PhysicalType::BOOLEAN) + DataTypeOld::Boolean => Type::primitive_type_builder(&field.name, PhysicalType::BOOLEAN) .with_repetition(rep) .build(), - DataType::Int8 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) + DataTypeOld::Int8 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) .with_repetition(rep) .with_logical_type(Some(LogicalType::Integer { bit_width: 8, is_signed: true, })) .build(), - DataType::Int16 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) + DataTypeOld::Int16 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) .with_repetition(rep) .with_logical_type(Some(LogicalType::Integer { bit_width: 16, is_signed: true, })) .build(), - DataType::Int32 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) + DataTypeOld::Int32 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) .with_repetition(rep) .with_logical_type(Some(LogicalType::Integer { bit_width: 32, is_signed: true, })) .build(), - DataType::Int64 => Type::primitive_type_builder(&field.name, PhysicalType::INT64) + DataTypeOld::Int64 => Type::primitive_type_builder(&field.name, PhysicalType::INT64) .with_repetition(rep) .with_logical_type(Some(LogicalType::Integer { bit_width: 64, is_signed: true, })) .build(), - DataType::UInt8 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) + DataTypeOld::UInt8 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) .with_repetition(rep) .with_logical_type(Some(LogicalType::Integer { bit_width: 8, is_signed: false, })) .build(), - DataType::UInt16 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) + DataTypeOld::UInt16 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) .with_repetition(rep) .with_logical_type(Some(LogicalType::Integer { bit_width: 16, is_signed: false, })) .build(), - DataType::UInt32 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) + DataTypeOld::UInt32 => Type::primitive_type_builder(&field.name, PhysicalType::INT32) .with_repetition(rep) .with_logical_type(Some(LogicalType::Integer { bit_width: 32, is_signed: false, })) .build(), - DataType::UInt64 => Type::primitive_type_builder(&field.name, PhysicalType::INT64) + DataTypeOld::UInt64 => Type::primitive_type_builder(&field.name, PhysicalType::INT64) .with_repetition(rep) .with_logical_type(Some(LogicalType::Integer { bit_width: 64, is_signed: false, })) .build(), - DataType::Float32 => Type::primitive_type_builder(&field.name, PhysicalType::FLOAT) + DataTypeOld::Float32 => Type::primitive_type_builder(&field.name, PhysicalType::FLOAT) .with_repetition(rep) .build(), - DataType::Float64 => Type::primitive_type_builder(&field.name, PhysicalType::DOUBLE) + DataTypeOld::Float64 => Type::primitive_type_builder(&field.name, PhysicalType::DOUBLE) .with_repetition(rep) .build(), - DataType::Timestamp(meta) => { + DataTypeOld::Timestamp(meta) => { let logical_type = match meta.unit { TimeUnit::Second => None, TimeUnit::Millisecond => Some(LogicalType::Timestamp { @@ -145,7 +145,7 @@ fn to_parquet_type(field: &Field) -> Result { .with_logical_type(logical_type) .build() } - DataType::Utf8 => Type::primitive_type_builder(&field.name, PhysicalType::BYTE_ARRAY) + DataTypeOld::Utf8 => Type::primitive_type_builder(&field.name, PhysicalType::BYTE_ARRAY) .with_repetition(rep) .with_logical_type(Some(LogicalType::String)) .build(), @@ -183,7 +183,7 @@ fn convert_type_to_field(parquet_type: impl AsRef) -> Result { Ok(field) } -fn convert_complex(parquet_type: &Type) -> Result { +fn convert_complex(parquet_type: &Type) -> Result { match parquet_type { Type::GroupType { basic_info, fields } => { match basic_info.converted_type() { @@ -210,7 +210,7 @@ fn convert_complex(parquet_type: &Type) -> Result { // } if nested.is_primitive() { let nested_type = convert_primitive(nested.as_ref())?; - return Ok(DataType::List(ListTypeMeta::new(nested_type))); + return Ok(DataTypeOld::List(ListTypeMeta::new(nested_type))); } // TODO: Other backwards compat types. @@ -226,7 +226,7 @@ fn convert_complex(parquet_type: &Type) -> Result { let inner_field = &inner_fields[0]; let inner_field = convert_type_to_field(inner_field)?; - Ok(DataType::List(ListTypeMeta::new(inner_field.datatype))) + Ok(DataTypeOld::List(ListTypeMeta::new(inner_field.datatype))) } ConvertedType::MAP | ConvertedType::MAP_KEY_VALUE => { not_implemented!("parquet map") @@ -244,7 +244,7 @@ fn convert_complex(parquet_type: &Type) -> Result { /// Convert a primitive type to a bullet data type. /// /// -fn convert_primitive(parquet_type: &Type) -> Result { +fn convert_primitive(parquet_type: &Type) -> Result { match parquet_type { Type::PrimitiveType { basic_info, @@ -253,14 +253,14 @@ fn convert_primitive(parquet_type: &Type) -> Result { scale, precision, } => match physical_type { - parquet::basic::Type::BOOLEAN => Ok(DataType::Boolean), + parquet::basic::Type::BOOLEAN => Ok(DataTypeOld::Boolean), parquet::basic::Type::INT32 => from_int32(basic_info, *scale, *precision), parquet::basic::Type::INT64 => from_int64(basic_info, *scale, *precision), - parquet::basic::Type::INT96 => Ok(DataType::Timestamp(TimestampTypeMeta::new( + parquet::basic::Type::INT96 => Ok(DataTypeOld::Timestamp(TimestampTypeMeta::new( TimeUnit::Nanosecond, ))), - parquet::basic::Type::FLOAT => Ok(DataType::Float32), - parquet::basic::Type::DOUBLE => Ok(DataType::Float64), + parquet::basic::Type::FLOAT => Ok(DataTypeOld::Float32), + parquet::basic::Type::DOUBLE => Ok(DataTypeOld::Float64), parquet::basic::Type::BYTE_ARRAY => from_byte_array(basic_info, *precision, *scale), parquet::basic::Type::FIXED_LEN_BYTE_ARRAY => { not_implemented!("parquet fixed len byte array") @@ -270,7 +270,7 @@ fn convert_primitive(parquet_type: &Type) -> Result { } } -fn decimal_type(precision: i32, scale: i32) -> Result { +fn decimal_type(precision: i32, scale: i32) -> Result { if precision < 0 { return Err(RayexecError::new("Precision cannot be negative")); } @@ -279,12 +279,12 @@ fn decimal_type(precision: i32, scale: i32) -> Result { } if precision <= Decimal64Type::MAX_PRECISION as i32 { - Ok(DataType::Decimal64(DecimalTypeMeta::new( + Ok(DataTypeOld::Decimal64(DecimalTypeMeta::new( precision as u8, scale as i8, ))) } else if precision <= Decimal128Type::MAX_PRECISION as i32 { - Ok(DataType::Decimal128(DecimalTypeMeta::new( + Ok(DataTypeOld::Decimal128(DecimalTypeMeta::new( precision as u8, scale as i8, ))) @@ -295,9 +295,9 @@ fn decimal_type(precision: i32, scale: i32) -> Result { } } -fn from_int32(info: &BasicTypeInfo, _scale: i32, _precision: i32) -> Result { +fn from_int32(info: &BasicTypeInfo, _scale: i32, _precision: i32) -> Result { match (info.logical_type(), info.converted_type()) { - (None, ConvertedType::NONE) => Ok(DataType::Int32), + (None, ConvertedType::NONE) => Ok(DataTypeOld::Int32), ( Some( ref t @ LogicalType::Integer { @@ -307,19 +307,19 @@ fn from_int32(info: &BasicTypeInfo, _scale: i32, _precision: i32) -> Result match (bit_width, is_signed) { - (8, true) => Ok(DataType::Int8), - (16, true) => Ok(DataType::Int16), - (32, true) => Ok(DataType::Int32), - (8, false) => Ok(DataType::UInt8), - (16, false) => Ok(DataType::UInt16), - (32, false) => Ok(DataType::UInt32), + (8, true) => Ok(DataTypeOld::Int8), + (16, true) => Ok(DataTypeOld::Int16), + (32, true) => Ok(DataTypeOld::Int32), + (8, false) => Ok(DataTypeOld::UInt8), + (16, false) => Ok(DataTypeOld::UInt16), + (32, false) => Ok(DataTypeOld::UInt32), _ => Err(RayexecError::new(format!( "Cannot create INT32 physical type from {:?}", t ))), }, (Some(LogicalType::Decimal { scale, precision }), _) => { - Ok(DataType::Decimal128(DecimalTypeMeta { + Ok(DataTypeOld::Decimal128(DecimalTypeMeta { precision: precision as u8, scale: scale as i8, })) @@ -333,14 +333,14 @@ fn from_int32(info: &BasicTypeInfo, _scale: i32, _precision: i32) -> Result Ok(DataType::Null), - (None, ConvertedType::UINT_8) => Ok(DataType::UInt8), - (None, ConvertedType::UINT_16) => Ok(DataType::UInt16), - (None, ConvertedType::UINT_32) => Ok(DataType::UInt32), - (None, ConvertedType::INT_8) => Ok(DataType::Int8), - (None, ConvertedType::INT_16) => Ok(DataType::Int16), - (None, ConvertedType::INT_32) => Ok(DataType::Int32), - (None, ConvertedType::DATE) => Ok(DataType::Date32), + (Some(LogicalType::Unknown), _) => Ok(DataTypeOld::Null), + (None, ConvertedType::UINT_8) => Ok(DataTypeOld::UInt8), + (None, ConvertedType::UINT_16) => Ok(DataTypeOld::UInt16), + (None, ConvertedType::UINT_32) => Ok(DataTypeOld::UInt32), + (None, ConvertedType::INT_8) => Ok(DataTypeOld::Int8), + (None, ConvertedType::INT_16) => Ok(DataTypeOld::Int16), + (None, ConvertedType::INT_32) => Ok(DataTypeOld::Int32), + (None, ConvertedType::DATE) => Ok(DataTypeOld::Date32), (None, ConvertedType::TIME_MILLIS) => unimplemented!(), (None, ConvertedType::DECIMAL) => unimplemented!(), (logical, converted) => Err(RayexecError::new(format!( @@ -350,9 +350,9 @@ fn from_int32(info: &BasicTypeInfo, _scale: i32, _precision: i32) -> Result Result { +fn from_int64(info: &BasicTypeInfo, _scale: i32, _precision: i32) -> Result { match (info.logical_type(), info.converted_type()) { - (None, ConvertedType::NONE) => Ok(DataType::Int64), + (None, ConvertedType::NONE) => Ok(DataTypeOld::Int64), ( Some(LogicalType::Integer { bit_width: 64, @@ -360,8 +360,8 @@ fn from_int64(info: &BasicTypeInfo, _scale: i32, _precision: i32) -> Result match is_signed { - true => Ok(DataType::Int64), - false => Ok(DataType::UInt64), + true => Ok(DataTypeOld::Int64), + false => Ok(DataTypeOld::UInt64), }, (Some(LogicalType::Time { unit, .. }), _) => match unit { ParquetTimeUnit::MILLIS(_) => Err(RayexecError::new( @@ -385,10 +385,10 @@ fn from_int64(info: &BasicTypeInfo, _scale: i32, _precision: i32) -> Result Ok(DataType::Int64), - (None, ConvertedType::UINT_64) => Ok(DataType::UInt64), + (None, ConvertedType::INT_64) => Ok(DataTypeOld::Int64), + (None, ConvertedType::UINT_64) => Ok(DataTypeOld::UInt64), (None, ConvertedType::TIME_MICROS) => unimplemented!(), (None, ConvertedType::TIMESTAMP_MILLIS) => unimplemented!(), (None, ConvertedType::TIMESTAMP_MICROS) => unimplemented!(), @@ -401,17 +401,17 @@ fn from_int64(info: &BasicTypeInfo, _scale: i32, _precision: i32) -> Result Result { +fn from_byte_array(info: &BasicTypeInfo, _precision: i32, _scale: i32) -> Result { match (info.logical_type(), info.converted_type()) { - (Some(LogicalType::String), _) => Ok(DataType::Utf8), - (Some(LogicalType::Json), _) => Ok(DataType::Utf8), - (Some(LogicalType::Bson), _) => Ok(DataType::Binary), - (Some(LogicalType::Enum), _) => Ok(DataType::Binary), - (None, ConvertedType::NONE) => Ok(DataType::Binary), - (None, ConvertedType::JSON) => Ok(DataType::Utf8), - (None, ConvertedType::BSON) => Ok(DataType::Binary), - (None, ConvertedType::ENUM) => Ok(DataType::Binary), - (None, ConvertedType::UTF8) => Ok(DataType::Utf8), + (Some(LogicalType::String), _) => Ok(DataTypeOld::Utf8), + (Some(LogicalType::Json), _) => Ok(DataTypeOld::Utf8), + (Some(LogicalType::Bson), _) => Ok(DataTypeOld::Binary), + (Some(LogicalType::Enum), _) => Ok(DataTypeOld::Binary), + (None, ConvertedType::NONE) => Ok(DataTypeOld::Binary), + (None, ConvertedType::JSON) => Ok(DataTypeOld::Utf8), + (None, ConvertedType::BSON) => Ok(DataTypeOld::Binary), + (None, ConvertedType::ENUM) => Ok(DataTypeOld::Binary), + (None, ConvertedType::UTF8) => Ok(DataTypeOld::Utf8), ( Some(LogicalType::Decimal { scale: _, diff --git a/crates/rayexec_parquet/src/writer/mod.rs b/crates/rayexec_parquet/src/writer/mod.rs index dc77ffb89..605dc9fa8 100644 --- a/crates/rayexec_parquet/src/writer/mod.rs +++ b/crates/rayexec_parquet/src/writer/mod.rs @@ -13,7 +13,7 @@ use parquet::format::FileMetaData; use parquet::schema::types::SchemaDescriptor; use rayexec_bullet::array::{ArrayData, ArrayOld}; use rayexec_bullet::batch::BatchOld; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::executor::physical_type::{PhysicalBinaryOld, PhysicalStorageOld}; use rayexec_bullet::field::Schema; use rayexec_bullet::storage::AddressableStorage; @@ -145,20 +145,20 @@ impl RowGroupWriter { for field in schema.fields.iter() { match &field.datatype { - DataType::Int8 - | DataType::Int16 - | DataType::Int32 - | DataType::Int64 - | DataType::UInt8 - | DataType::UInt16 - | DataType::UInt32 - | DataType::UInt64 - | DataType::Float32 - | DataType::Float64 - | DataType::Timestamp(_) - | DataType::Decimal64(_) - | DataType::Decimal128(_) - | DataType::Utf8 => { + DataTypeOld::Int8 + | DataTypeOld::Int16 + | DataTypeOld::Int32 + | DataTypeOld::Int64 + | DataTypeOld::UInt8 + | DataTypeOld::UInt16 + | DataTypeOld::UInt32 + | DataTypeOld::UInt64 + | DataTypeOld::Float32 + | DataTypeOld::Float64 + | DataTypeOld::Timestamp(_) + | DataTypeOld::Decimal64(_) + | DataTypeOld::Decimal128(_) + | DataTypeOld::Utf8 => { let page_writer = BufferedPageWriter { buf: ColumnBuffer(Vec::new()), // TODO: Could reuse across row groups. }; diff --git a/crates/rayexec_postgres/src/lib.rs b/crates/rayexec_postgres/src/lib.rs index 300116ad8..d112e4807 100644 --- a/crates/rayexec_postgres/src/lib.rs +++ b/crates/rayexec_postgres/src/lib.rs @@ -12,7 +12,7 @@ use futures::stream::BoxStream; use futures::{StreamExt, TryFutureExt}; use rayexec_bullet::array::ArrayOld; use rayexec_bullet::batch::BatchOld; -use rayexec_bullet::datatype::{DataType, DecimalTypeMeta}; +use rayexec_bullet::datatype::{DataTypeOld, DecimalTypeMeta}; use rayexec_bullet::field::Field; use rayexec_bullet::scalar::OwnedScalarValue; use rayexec_error::{RayexecError, Result, ResultExt}; @@ -358,24 +358,24 @@ impl PostgresClient { for (name, typ) in names.into_iter().zip(typs) { let dt = match typ { - &PostgresType::BOOL => DataType::Boolean, - &PostgresType::INT2 => DataType::Int16, - &PostgresType::INT4 => DataType::Int32, - &PostgresType::INT8 => DataType::Int64, - &PostgresType::FLOAT4 => DataType::Float32, - &PostgresType::FLOAT8 => DataType::Float64, + &PostgresType::BOOL => DataTypeOld::Boolean, + &PostgresType::INT2 => DataTypeOld::Int16, + &PostgresType::INT4 => DataTypeOld::Int32, + &PostgresType::INT8 => DataTypeOld::Int64, + &PostgresType::FLOAT4 => DataTypeOld::Float32, + &PostgresType::FLOAT8 => DataTypeOld::Float64, &PostgresType::CHAR | &PostgresType::BPCHAR | &PostgresType::VARCHAR | &PostgresType::TEXT | &PostgresType::JSONB | &PostgresType::JSON - | &PostgresType::UUID => DataType::Utf8, - &PostgresType::BYTEA => DataType::Binary, + | &PostgresType::UUID => DataTypeOld::Utf8, + &PostgresType::BYTEA => DataTypeOld::Binary, // While postgres numerics are "unconstrained" by default, we need // to specify the precision and scale for the column. Setting these // same as bigquery. - &PostgresType::NUMERIC => DataType::Decimal128(DecimalTypeMeta::new(38, 9)), + &PostgresType::NUMERIC => DataTypeOld::Decimal128(DecimalTypeMeta::new(38, 9)), other => { return Err(RayexecError::new(format!( @@ -390,7 +390,7 @@ impl PostgresClient { Ok(fields) } - fn binary_rows_to_batch(typs: &[DataType], rows: Vec) -> Result { + fn binary_rows_to_batch(typs: &[DataTypeOld], rows: Vec) -> Result { fn row_iter<'a, T: FromSql<'a>>( rows: &'a [BinaryCopyOutRow], idx: usize, @@ -401,12 +401,12 @@ impl PostgresClient { let mut arrays = Vec::with_capacity(typs.len()); for (idx, typ) in typs.iter().enumerate() { let arr = match typ { - DataType::Boolean => ArrayOld::from_iter(row_iter::(&rows, idx)), - DataType::Int8 => ArrayOld::from_iter(row_iter::(&rows, idx)), - DataType::Int16 => ArrayOld::from_iter(row_iter::(&rows, idx)), - DataType::Int32 => ArrayOld::from_iter(row_iter::(&rows, idx)), - DataType::Int64 => ArrayOld::from_iter(row_iter::(&rows, idx)), - DataType::Decimal128(m) => { + DataTypeOld::Boolean => ArrayOld::from_iter(row_iter::(&rows, idx)), + DataTypeOld::Int8 => ArrayOld::from_iter(row_iter::(&rows, idx)), + DataTypeOld::Int16 => ArrayOld::from_iter(row_iter::(&rows, idx)), + DataTypeOld::Int32 => ArrayOld::from_iter(row_iter::(&rows, idx)), + DataTypeOld::Int64 => ArrayOld::from_iter(row_iter::(&rows, idx)), + DataTypeOld::Decimal128(m) => { let primitives = ArrayOld::from_iter(rows.iter().map(|row| { let decimal = row.try_get::(idx).ok(); // TODO: Rescale @@ -415,18 +415,18 @@ impl PostgresClient { match primitives.validity() { Some(validity) => ArrayOld::new_with_validity_and_array_data( - DataType::Decimal128(DecimalTypeMeta::new(m.precision, m.scale)), + DataTypeOld::Decimal128(DecimalTypeMeta::new(m.precision, m.scale)), validity.clone(), primitives.array_data().clone(), ), None => ArrayOld::new_with_array_data( - DataType::Decimal128(DecimalTypeMeta::new(m.precision, m.scale)), + DataTypeOld::Decimal128(DecimalTypeMeta::new(m.precision, m.scale)), primitives.array_data().clone(), ), } } - DataType::Utf8 => ArrayOld::from_iter( + DataTypeOld::Utf8 => ArrayOld::from_iter( rows.iter() .map(|row| -> Option<&str> { row.try_get(idx).ok() }), ), diff --git a/crates/rayexec_slt/src/convert.rs b/crates/rayexec_slt/src/convert.rs index 470d478ab..a41fd4dc2 100644 --- a/crates/rayexec_slt/src/convert.rs +++ b/crates/rayexec_slt/src/convert.rs @@ -1,4 +1,4 @@ -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::field::Schema; use rayexec_bullet::format::{FormatOptions, Formatter}; use rayexec_error::Result; @@ -34,16 +34,16 @@ pub fn schema_to_types(schema: &Schema) -> Vec { let mut typs = Vec::new(); for field in &schema.fields { let typ = match field.datatype { - DataType::Int8 - | DataType::Int16 - | DataType::Int32 - | DataType::Int64 - | DataType::UInt8 - | DataType::UInt16 - | DataType::UInt32 - | DataType::UInt64 => DefaultColumnType::Integer, - DataType::Float32 | DataType::Float64 => DefaultColumnType::FloatingPoint, - DataType::Utf8 | DataType::Boolean => DefaultColumnType::Text, + DataTypeOld::Int8 + | DataTypeOld::Int16 + | DataTypeOld::Int32 + | DataTypeOld::Int64 + | DataTypeOld::UInt8 + | DataTypeOld::UInt16 + | DataTypeOld::UInt32 + | DataTypeOld::UInt64 => DefaultColumnType::Integer, + DataTypeOld::Float32 | DataTypeOld::Float64 => DefaultColumnType::FloatingPoint, + DataTypeOld::Utf8 | DataTypeOld::Boolean => DefaultColumnType::Text, _ => DefaultColumnType::Any, }; typs.push(typ); diff --git a/crates/rayexec_unity_catalog/src/functions.rs b/crates/rayexec_unity_catalog/src/functions.rs index 30d659c80..854a58a5f 100644 --- a/crates/rayexec_unity_catalog/src/functions.rs +++ b/crates/rayexec_unity_catalog/src/functions.rs @@ -8,7 +8,7 @@ use futures::stream::BoxStream; use futures::{FutureExt, TryStreamExt}; use rayexec_bullet::array::ArrayOld; use rayexec_bullet::batch::BatchOld; -use rayexec_bullet::datatype::{DataType, DataTypeId}; +use rayexec_bullet::datatype::{DataTypeId, DataTypeOld}; use rayexec_bullet::field::{Field, Schema}; use rayexec_bullet::scalar::OwnedScalarValue; use rayexec_error::Result; @@ -101,9 +101,9 @@ impl UnityObjectsOperation for ListSchemasOperation { fn schema() -> Schema { Schema::new([ - Field::new("name", DataType::Utf8, false), - Field::new("catalog_name", DataType::Utf8, false), - Field::new("comment", DataType::Utf8, true), + Field::new("name", DataTypeOld::Utf8, false), + Field::new("catalog_name", DataTypeOld::Utf8, false), + Field::new("comment", DataTypeOld::Utf8, true), ]) } @@ -181,13 +181,13 @@ impl UnityObjectsOperation for ListTablesOperation { fn schema() -> Schema { Schema::new([ - Field::new("name", DataType::Utf8, false), - Field::new("catalog_name", DataType::Utf8, false), - Field::new("schema_name", DataType::Utf8, false), - Field::new("table_type", DataType::Utf8, false), - Field::new("data_source_format", DataType::Utf8, false), - Field::new("storage_location", DataType::Utf8, false), - Field::new("comment", DataType::Utf8, true), + Field::new("name", DataTypeOld::Utf8, false), + Field::new("catalog_name", DataTypeOld::Utf8, false), + Field::new("schema_name", DataTypeOld::Utf8, false), + Field::new("table_type", DataTypeOld::Utf8, false), + Field::new("data_source_format", DataTypeOld::Utf8, false), + Field::new("storage_location", DataTypeOld::Utf8, false), + Field::new("comment", DataTypeOld::Utf8, true), ]) } diff --git a/crates/rayexec_wasm/src/session.rs b/crates/rayexec_wasm/src/session.rs index 6b8f8768d..32ce2568b 100644 --- a/crates/rayexec_wasm/src/session.rs +++ b/crates/rayexec_wasm/src/session.rs @@ -184,7 +184,7 @@ impl WasmMaterializedColumn { mod tests { use rayexec_bullet::array::ArrayOld; use rayexec_bullet::batch::BatchOld; - use rayexec_bullet::datatype::DataType; + use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::field::{Field, Schema}; use super::*; @@ -192,7 +192,7 @@ mod tests { #[test] fn format_cells() { let table = MaterializedResultTable::try_new( - Schema::new([Field::new("c1", DataType::Int32, true)]), + Schema::new([Field::new("c1", DataTypeOld::Int32, true)]), [ BatchOld::try_new([ArrayOld::from_iter([0, 1, 2, 3])]).unwrap(), BatchOld::try_new([ArrayOld::from_iter([4, 5])]).unwrap(), diff --git a/test_bin/integration_slt_hybrid.rs b/test_bin/integration_slt_hybrid.rs index 8358d69d5..63519b508 100644 --- a/test_bin/integration_slt_hybrid.rs +++ b/test_bin/integration_slt_hybrid.rs @@ -4,7 +4,7 @@ use std::time::Duration; use rayexec_bullet::array::ArrayOld; use rayexec_bullet::batch::BatchOld; -use rayexec_bullet::datatype::DataType; +use rayexec_bullet::datatype::DataTypeOld; use rayexec_bullet::field::Field; use rayexec_debug::table_storage::TablePreload; use rayexec_debug::{DebugDataSource, DebugDataSourceOptions}; @@ -33,8 +33,8 @@ pub fn main() -> Result<()> { schema: "schema1".to_string(), name: "table1".to_string(), columns: vec![ - Field::new("c1", DataType::Int64, false), - Field::new("c2", DataType::Utf8, false), + Field::new("c1", DataTypeOld::Int64, false), + Field::new("c2", DataTypeOld::Utf8, false), ], data: BatchOld::try_new([ ArrayOld::from_iter([1_i64, 2_i64]), @@ -47,8 +47,8 @@ pub fn main() -> Result<()> { schema: "schema1".to_string(), name: "insert_into1".to_string(), columns: vec![ - Field::new("c1", DataType::Int64, false), - Field::new("c2", DataType::Utf8, false), + Field::new("c1", DataTypeOld::Int64, false), + Field::new("c2", DataTypeOld::Utf8, false), ], data: BatchOld::try_new([ ArrayOld::from_iter([1_i64, 2_i64]),