Skip to content

Commit 85c8efa

Browse files
committed
feat(query): migrate regexp func to func-v2
1 parent 35c44d1 commit 85c8efa

File tree

7 files changed

+2853
-11
lines changed

7 files changed

+2853
-11
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/query/expression/src/function.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ where F: Fn(&[ValueRef<AnyType>], &GenericMap) -> Result<Value<AnyType>, String>
221221
}
222222
}
223223
}
224-
let nonull_results = f(&nonull_args, generics)?;
224+
let results = f(&nonull_args, generics)?;
225225
let bitmap = bitmap.unwrap_or_else(|| constant_bitmap(true, len));
226-
match nonull_results {
226+
match results {
227227
Value::Scalar(s) => {
228228
if bitmap.get(0) {
229229
Ok(Value::Scalar(Result::upcast_scalar(s)))
@@ -232,10 +232,21 @@ where F: Fn(&[ValueRef<AnyType>], &GenericMap) -> Result<Value<AnyType>, String>
232232
}
233233
}
234234
Value::Column(column) => {
235-
let result = Column::Nullable(Box::new(NullableColumn {
236-
column,
237-
validity: bitmap.into(),
238-
}));
235+
let result = match column {
236+
Column::Nullable(box nullable_column) => {
237+
let validity = bitmap.into();
238+
let validity =
239+
common_arrow::arrow::bitmap::and(&nullable_column.validity, &validity);
240+
Column::Nullable(Box::new(NullableColumn {
241+
column: nullable_column.column,
242+
validity,
243+
}))
244+
}
245+
_ => Column::Nullable(Box::new(NullableColumn {
246+
column,
247+
validity: bitmap.into(),
248+
})),
249+
};
239250
Ok(Value::Column(Result::upcast_column(result)))
240251
}
241252
}

src/query/expression/src/types/nullable.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,14 @@ impl<'a, T: ValueType> Iterator for NullableIterator<'a, T> {
225225
type Item = Option<T::ScalarRef<'a>>;
226226

227227
fn next(&mut self) -> Option<Self::Item> {
228-
self.iter.next().zip(self.validity.next()).map(
229-
|(scalar, is_null)| {
230-
if is_null { None } else { Some(scalar) }
231-
},
232-
)
228+
self.iter
229+
.next()
230+
.zip(self.validity.next())
231+
.map(
232+
|(scalar, is_not_null)| {
233+
if is_not_null { Some(scalar) } else { None }
234+
},
235+
)
233236
}
234237

235238
fn size_hint(&self) -> (usize, Option<usize>) {

src/query/functions-v2/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ ordered-float = { git = "https://github.com/andylokandy/rust-ordered-float.git",
3636
"rand",
3737
] }
3838
rand = { version = "0.8.5", features = ["small_rng"] }
39+
regex = "1.5.6"
3940
serde = { version = "1.0.137", features = ["derive"] }
4041
serde_json = "1.0"
42+
simdutf8 = "0.1.4"
4143
strength_reduce = "0.2.3"
4244

4345
[dev-dependencies]

0 commit comments

Comments
 (0)