Skip to content

Commit 2b929cb

Browse files
authored
Merge pull request #7459 from b41sh/feat-func-v2-regexp
feat(query): migrate regexp func to func-v2
2 parents 33d20df + d524b6b commit 2b929cb

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
@@ -232,11 +232,14 @@ impl<'a, T: ValueType> Iterator for NullableIterator<'a, T> {
232232
type Item = Option<T::ScalarRef<'a>>;
233233

234234
fn next(&mut self) -> Option<Self::Item> {
235-
self.iter.next().zip(self.validity.next()).map(
236-
|(scalar, is_null)| {
237-
if is_null { None } else { Some(scalar) }
238-
},
239-
)
235+
self.iter
236+
.next()
237+
.zip(self.validity.next())
238+
.map(
239+
|(scalar, is_not_null)| {
240+
if is_not_null { Some(scalar) } else { None }
241+
},
242+
)
240243
}
241244

242245
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)