diff --git a/Cargo.lock b/Cargo.lock index 6d4d04ed9f12..bb2239ec15db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -434,7 +434,7 @@ version = "37.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a16b88a93ac8350f0200b1cd336a1f887315925b8dd7aa145a37b8bdbd8497a4" dependencies = [ - "bitflags 2.2.1", + "bitflags 2.3.1", ] [[package]] @@ -989,9 +989,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.2.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24a6904aef64d73cf10ab17ebace7befb918b82164785cb89907993be7f83813" +checksum = "6776fc96284a0bb647b615056fc496d1fe1644a7ab01829818a6d91cae888b84" [[package]] name = "bitmaps" diff --git a/src/query/expression/src/evaluator.rs b/src/query/expression/src/evaluator.rs index 8fcc22e7d556..47d02c89bc87 100644 --- a/src/query/expression/src/evaluator.rs +++ b/src/query/expression/src/evaluator.rs @@ -85,42 +85,6 @@ impl<'a> Evaluator<'a> { } } - /// TODO(sundy/andy): refactor this if we got better idea - pub fn run_auto_type(&self, expr: &Expr) -> Result> { - let column_refs = expr.column_refs(); - - let mut columns = self.input_columns.columns().to_vec(); - for (index, datatype) in column_refs.iter() { - let column = &columns[*index]; - if datatype != &column.data_type { - let value = self.run(&Expr::Cast { - span: None, - is_try: false, - expr: Box::new(Expr::ColumnRef { - span: None, - id: *index, - data_type: column.data_type.clone(), - display_name: String::new(), - }), - dest_type: datatype.clone(), - })?; - - columns[*index] = BlockEntry { - data_type: datatype.clone(), - value, - }; - } - } - - let new_blocks = DataBlock::new_with_meta( - columns, - self.input_columns.num_rows(), - self.input_columns.get_meta().cloned(), - ); - let new_evaluator = Evaluator::new(&new_blocks, self.func_ctx, self.fn_registry); - new_evaluator.run(expr) - } - pub fn run(&self, expr: &Expr) -> Result> { self.partial_run(expr, None) } diff --git a/src/query/service/src/api/rpc/flight_scatter_hash.rs b/src/query/service/src/api/rpc/flight_scatter_hash.rs index 4b8995ffed62..fb351317d576 100644 --- a/src/query/service/src/api/rpc/flight_scatter_hash.rs +++ b/src/query/service/src/api/rpc/flight_scatter_hash.rs @@ -120,7 +120,7 @@ impl FlightScatter for OneHashKeyFlightScatter { let evaluator = Evaluator::new(&data_block, &self.func_ctx, &BUILTIN_FUNCTIONS); let num = data_block.num_rows(); - let indices = evaluator.run_auto_type(&self.indices_scalar).unwrap(); + let indices = evaluator.run(&self.indices_scalar).unwrap(); let indices = get_hash_values(&indices, num)?; let data_blocks = DataBlock::scatter(&data_block, &indices, self.scatter_size)?; @@ -141,7 +141,7 @@ impl FlightScatter for HashFlightScatter { let indices = if !self.hash_key.is_empty() { let mut hash_keys = vec![]; for expr in &self.hash_key { - let indices = evaluator.run_auto_type(expr).unwrap(); + let indices = evaluator.run(expr).unwrap(); let indices = get_hash_values(&indices, num)?; hash_keys.push(indices) } diff --git a/src/query/service/src/pipelines/processors/transforms/hash_join/common.rs b/src/query/service/src/pipelines/processors/transforms/hash_join/common.rs index e78eb2e0a6c5..34ade5c1f220 100644 --- a/src/query/service/src/pipelines/processors/transforms/hash_join/common.rs +++ b/src/query/service/src/pipelines/processors/transforms/hash_join/common.rs @@ -212,7 +212,7 @@ impl JoinHashTable { let func_ctx = self.ctx.get_function_context()?; let evaluator = Evaluator::new(merged_block, &func_ctx, &BUILTIN_FUNCTIONS); let predicates = evaluator - .run_auto_type(&filter)? + .run(&filter)? .try_downcast::() .unwrap(); @@ -234,7 +234,7 @@ impl JoinHashTable { let func_ctx = self.ctx.get_function_context()?; let evaluator = Evaluator::new(merged_block, &func_ctx, &BUILTIN_FUNCTIONS); - let filter_vector: Value = evaluator.run_auto_type(filter)?; + let filter_vector: Value = evaluator.run(filter)?; let filter_vector = filter_vector.convert_to_full_column(filter.data_type(), merged_block.num_rows());