@@ -18,6 +18,7 @@ use common_datavalues::prelude::*;
18
18
use common_datavalues:: type_coercion:: numerical_coercion;
19
19
use common_exception:: ErrorCode ;
20
20
use common_exception:: Result ;
21
+ use common_hashtable:: HashSetWithStackMemory ;
21
22
use common_hashtable:: KeysRef ;
22
23
use ordered_float:: OrderedFloat ;
23
24
@@ -27,8 +28,6 @@ use crate::scalars::FunctionContext;
27
28
use crate :: scalars:: FunctionDescription ;
28
29
use crate :: scalars:: FunctionFeatures ;
29
30
30
- use common_hashtable:: HashSetWithStackMemory ;
31
-
32
31
#[ derive( Clone ) ]
33
32
pub struct InFunction < const NEGATED : bool > {
34
33
is_null : bool ,
@@ -82,7 +81,6 @@ macro_rules! scalar_contains {
82
81
} } ;
83
82
}
84
83
85
-
86
84
macro_rules! bool_contains {
87
85
( $T: ident, $INPUT_COL: expr, $ROWS: expr, $COLUMNS: expr, $CAST_TYPE: ident, $FUNC_CTX: expr) => { {
88
86
let mut builder: ColumnBuilder <bool > = ColumnBuilder :: with_capacity( $ROWS) ;
@@ -92,24 +90,23 @@ macro_rules! bool_contains {
92
90
let col_viewer = $T:: try_create_viewer( & col) ?;
93
91
if col_viewer. valid_at( 0 ) {
94
92
let val = col_viewer. value_at( 0 ) ;
95
- vals |= 1 << ( val as u8 + 1 ) ;
93
+ vals |= 1 << ( val as u8 + 1 ) ;
96
94
}
97
95
}
98
96
let input_viewer = $T:: try_create_viewer( & $INPUT_COL) ?;
99
97
for ( row, val) in input_viewer. iter( ) . enumerate( ) {
100
- let contains = ( ( vals >> ( val as u8 + 1 ) ) & 1 ) > 0 ;
98
+ let contains = ( ( vals >> ( val as u8 + 1 ) ) & 1 ) > 0 ;
101
99
let valid = input_viewer. valid_at( row) ;
102
100
builder. append( valid && ( ( contains && !NEGATED ) || ( !contains && NEGATED ) ) ) ;
103
101
}
104
102
return Ok ( builder. build( $ROWS) ) ;
105
103
} } ;
106
104
}
107
105
108
-
109
106
macro_rules! string_contains {
110
107
( $T: ident, $INPUT_COL: expr, $ROWS: expr, $COLUMNS: expr, $CAST_TYPE: ident, $FUNC_CTX: expr) => { {
111
108
let mut builder: ColumnBuilder <bool > = ColumnBuilder :: with_capacity( $ROWS) ;
112
- let mut vals_set: HashSetWithStackMemory <64 , KeysRef > = HashSetWithStackMemory :: create( ) ;
109
+ let mut vals_set: HashSetWithStackMemory <64 , KeysRef > = HashSetWithStackMemory :: create( ) ;
113
110
let mut inserted = false ;
114
111
for col in & $COLUMNS[ 1 ..] {
115
112
let col = cast_column_field( col, col. data_type( ) , & $CAST_TYPE, & $FUNC_CTX) ?;
@@ -134,7 +131,8 @@ macro_rules! string_contains {
134
131
macro_rules! float_contains {
135
132
( $T: ident, $INPUT_COL: expr, $ROWS: expr, $COLUMNS: expr, $CAST_TYPE: ident, $FUNC_CTX: expr) => { {
136
133
let mut builder: ColumnBuilder <bool > = ColumnBuilder :: with_capacity( $ROWS) ;
137
- let mut vals_set: HashSetWithStackMemory <64 , OrderedFloat <$T>> = HashSetWithStackMemory :: create( ) ;
134
+ let mut vals_set: HashSetWithStackMemory <64 , OrderedFloat <$T>> =
135
+ HashSetWithStackMemory :: create( ) ;
138
136
let mut inserted = false ;
139
137
140
138
for col in & $COLUMNS[ 1 ..] {
0 commit comments