-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Day 1 #1
Day 1 #1
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ | |
use std::sync::Arc; | ||
|
||
use arrow::compute::cast; | ||
use arrow::compute::kernels::cast_utils::string_to_timestamp_nanos; | ||
use arrow::datatypes::DataType; | ||
use arrow::temporal_conversions::utf8_to_timestamp_ns_scalar; | ||
|
||
|
@@ -32,7 +31,6 @@ use crate::optimizer::optimizer::OptimizerRule; | |
use crate::optimizer::utils; | ||
use crate::physical_plan::functions::BuiltinScalarFunction; | ||
use crate::scalar::ScalarValue; | ||
use arrow::compute::{kernels, DEFAULT_CAST_OPTIONS}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. non-valid uses; |
||
|
||
/// Optimizer that simplifies comparison expressions involving boolean literals. | ||
/// | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,7 @@ use arrow::{ | |
array::*, | ||
compute::cast, | ||
datatypes::{ | ||
ArrowPrimitiveType, DataType, TimeUnit, TimestampMicrosecondType, | ||
TimestampMillisecondType, TimestampNanosecondType, TimestampSecondType, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. non-exists |
||
DataType, TimeUnit, | ||
}, | ||
temporal_conversions::utf8_to_timestamp_ns_scalar, | ||
types::NativeType, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -776,25 +776,6 @@ mod tests { | |
Ok(()) | ||
} | ||
|
||
#[test] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. duplicates |
||
fn modulus_op() -> Result<()> { | ||
let schema = Arc::new(Schema::new(vec![ | ||
Field::new("a", DataType::Int32, false), | ||
Field::new("b", DataType::Int32, false), | ||
])); | ||
let a = Arc::new(Int32Array::from(vec![8, 32, 128, 512, 2048])); | ||
let b = Arc::new(Int32Array::from(vec![2, 4, 7, 14, 32])); | ||
|
||
apply_arithmetic::<i32>( | ||
schema, | ||
vec![a, b], | ||
Operator::Modulo, | ||
Int32Array::from(vec![0, 0, 2, 8, 0]), | ||
)?; | ||
|
||
Ok(()) | ||
} | ||
|
||
fn apply_arithmetic<T: NativeType>( | ||
schema: Arc<Schema>, | ||
data: Vec<Arc<dyn Array>>, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,17 @@ macro_rules! compare_op_scalar { | |
}}; | ||
} | ||
|
||
// TODO: primitive array currently doesn't have `values_iter()`, it may | ||
// worth adding one there, and this specialized case could be removed. | ||
macro_rules! compare_primitive_op_scalar { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check TODO above |
||
($left: expr, $right:expr, $op:expr) => {{ | ||
let validity = $left.validity(); | ||
let values = | ||
Bitmap::from_trusted_len_iter($left.values().iter().map(|x| $op(x, $right))); | ||
Ok(BooleanArray::from_data(DataType::Boolean, values, validity)) | ||
}}; | ||
} | ||
|
||
/// InList | ||
#[derive(Debug)] | ||
pub struct InListExpr { | ||
|
@@ -162,18 +173,18 @@ macro_rules! make_contains_primitive { | |
// whether each value on the left (can be null) is contained in the non-null list | ||
fn in_list_primitive<T: NativeType>( | ||
array: &PrimitiveArray<T>, | ||
values: &[<T as NativeType>], | ||
values: &[T], | ||
) -> Result<BooleanArray> { | ||
compare_op_scalar!(array, values, |x, v: &[<T as NativeType>]| v | ||
compare_primitive_op_scalar!(array, values, |x, v| v | ||
.contains(&x)) | ||
} | ||
|
||
// whether each value on the left (can be null) is contained in the non-null list | ||
fn not_in_list_primitive<T: NativeType>( | ||
array: &PrimitiveArray<T>, | ||
values: &[<T as NativeType>], | ||
values: &[T], | ||
) -> Result<BooleanArray> { | ||
compare_op_scalar!(array, values, |x, v: &[<T as NativeType>]| !v | ||
compare_primitive_op_scalar!(array, values, |x, v| !v | ||
.contains(&x)) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,7 +116,7 @@ fn combine_hashes(l: u64, r: u64) -> u64 { | |
} | ||
|
||
macro_rules! hash_array { | ||
($array_type:ident, $column: ident, $ty: ident, $hashes: ident, $random_state: ident, $multi_col: ident) => { | ||
($array_type:ty, $column: ident, $ty: ident, $hashes: ident, $random_state: ident, $multi_col: ident) => { | ||
let array = $column.as_any().downcast_ref::<$array_type>().unwrap(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if array.null_count() == 0 { | ||
if $multi_col { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicates