Skip to content

Commit a71d222

Browse files
committed
Fix unresolved doc link
1 parent 88aab46 commit a71d222

File tree

2 files changed

+33
-38
lines changed

2 files changed

+33
-38
lines changed

datafusion/functions/src/string/common.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,11 @@ where
482482
}))
483483
}
484484

485+
#[cfg(doc)]
486+
use arrow::array::{StringArray, LargeStringArray, StringViewArray};
485487
/// Perform SQL `array ~ regex_array` operation on
486488
/// [`StringArray`] / [`LargeStringArray`] / [`StringViewArray`].
489+
///
487490
/// If `regex_array` element has an empty value, the corresponding result value is always true.
488491
///
489492
/// `flags_array` are optional [`StringArray`] / [`LargeStringArray`] / [`StringViewArray`] flag,
@@ -494,15 +497,15 @@ where
494497
/// It is inspired / copied from `regexp_is_match_utf8` [arrow-rs].
495498
///
496499
/// [arrow-rs]: https://github.com/apache/arrow-rs/blob/8c956a9f9ab26c14072740cce64c2b99cb039b13/arrow-string/src/regexp.rs#L31-L37
497-
pub fn regexp_is_match<'a, ArrayType1, ArrayType2, ArrayType3>(
498-
array: &'a ArrayType1,
499-
regex_array: &'a ArrayType2,
500-
flags_array: Option<&'a ArrayType3>,
501-
) -> datafusion_common::Result<BooleanArray, DataFusionError>
500+
pub fn regexp_is_match<'a, S1, S2, S3>(
501+
array: &'a S1,
502+
regex_array: &'a S2,
503+
flags_array: Option<&'a S3>,
504+
) -> Result<BooleanArray, DataFusionError>
502505
where
503-
&'a ArrayType1: StringArrayType<'a>,
504-
&'a ArrayType2: StringArrayType<'a>,
505-
&'a ArrayType3: StringArrayType<'a>,
506+
&'a S1: StringArrayType<'a>,
507+
&'a S2: StringArrayType<'a>,
508+
&'a S3: StringArrayType<'a>,
506509
{
507510
if array.len() != regex_array.len() {
508511
return Err(DataFusionError::Execution(
@@ -559,7 +562,7 @@ where
559562
}
560563
Ok(())
561564
})
562-
.collect::<datafusion_common::Result<Vec<()>, DataFusionError>>()?;
565+
.collect::<Result<Vec<()>, DataFusionError>>()?;
563566

564567
let data = unsafe {
565568
ArrayDataBuilder::new(DataType::Boolean)

datafusion/functions/src/string/contains.rs

+21-29
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ pub fn contains(args: &[ArrayRef]) -> Result<ArrayRef, DataFusionError> {
9292
(Utf8View, Utf8View) => {
9393
let mod_str = args[0].as_string_view();
9494
let match_str = args[1].as_string_view();
95-
let res =
96-
regexp_is_match::<StringViewArray, StringViewArray, StringViewArray>(
97-
mod_str, match_str, None,
98-
)
99-
.map_err(|error| error)?;
95+
let res = regexp_is_match::<
96+
StringViewArray,
97+
StringViewArray,
98+
GenericStringArray<i32>,
99+
>(mod_str, match_str, None)?;
100100

101101
Ok(Arc::new(res) as ArrayRef)
102102
}
@@ -106,9 +106,8 @@ pub fn contains(args: &[ArrayRef]) -> Result<ArrayRef, DataFusionError> {
106106
let res = regexp_is_match::<
107107
StringViewArray,
108108
GenericStringArray<i32>,
109-
StringViewArray,
110-
>(mod_str, match_str, None)
111-
.map_err(|error| error)?;
109+
GenericStringArray<i32>,
110+
>(mod_str, match_str, None)?;
112111

113112
Ok(Arc::new(res) as ArrayRef)
114113
}
@@ -118,9 +117,8 @@ pub fn contains(args: &[ArrayRef]) -> Result<ArrayRef, DataFusionError> {
118117
let res = regexp_is_match::<
119118
StringViewArray,
120119
GenericStringArray<i64>,
121-
StringViewArray,
122-
>(mod_str, match_str, None)
123-
.map_err(|error| error)?;
120+
GenericStringArray<i32>,
121+
>(mod_str, match_str, None)?;
124122

125123
Ok(Arc::new(res) as ArrayRef)
126124
}
@@ -130,9 +128,8 @@ pub fn contains(args: &[ArrayRef]) -> Result<ArrayRef, DataFusionError> {
130128
let res = regexp_is_match::<
131129
GenericStringArray<i32>,
132130
StringViewArray,
133-
StringViewArray,
134-
>(mod_str, match_str, None)
135-
.map_err(|error| error)?;
131+
GenericStringArray<i32>,
132+
>(mod_str, match_str, None)?;
136133

137134
Ok(Arc::new(res) as ArrayRef)
138135
}
@@ -142,9 +139,8 @@ pub fn contains(args: &[ArrayRef]) -> Result<ArrayRef, DataFusionError> {
142139
let res = regexp_is_match::<
143140
GenericStringArray<i32>,
144141
GenericStringArray<i32>,
145-
StringViewArray,
146-
>(mod_str, match_str, None)
147-
.map_err(|error| error)?;
142+
GenericStringArray<i32>,
143+
>(mod_str, match_str, None)?;
148144

149145
Ok(Arc::new(res) as ArrayRef)
150146
}
@@ -154,9 +150,8 @@ pub fn contains(args: &[ArrayRef]) -> Result<ArrayRef, DataFusionError> {
154150
let res = regexp_is_match::<
155151
GenericStringArray<i32>,
156152
GenericStringArray<i64>,
157-
StringViewArray,
158-
>(mod_str, match_str, None)
159-
.map_err(|error| error)?;
153+
GenericStringArray<i32>,
154+
>(mod_str, match_str, None)?;
160155

161156
Ok(Arc::new(res) as ArrayRef)
162157
}
@@ -166,9 +161,8 @@ pub fn contains(args: &[ArrayRef]) -> Result<ArrayRef, DataFusionError> {
166161
let res = regexp_is_match::<
167162
GenericStringArray<i64>,
168163
StringViewArray,
169-
StringViewArray,
170-
>(mod_str, match_str, None)
171-
.map_err(|error| error)?;
164+
GenericStringArray<i32>,
165+
>(mod_str, match_str, None)?;
172166

173167
Ok(Arc::new(res) as ArrayRef)
174168
}
@@ -178,9 +172,8 @@ pub fn contains(args: &[ArrayRef]) -> Result<ArrayRef, DataFusionError> {
178172
let res = regexp_is_match::<
179173
GenericStringArray<i64>,
180174
GenericStringArray<i32>,
181-
StringViewArray,
182-
>(mod_str, match_str, None)
183-
.map_err(|error| error)?;
175+
GenericStringArray<i32>,
176+
>(mod_str, match_str, None)?;
184177

185178
Ok(Arc::new(res) as ArrayRef)
186179
}
@@ -190,9 +183,8 @@ pub fn contains(args: &[ArrayRef]) -> Result<ArrayRef, DataFusionError> {
190183
let res = regexp_is_match::<
191184
GenericStringArray<i64>,
192185
GenericStringArray<i64>,
193-
StringViewArray,
194-
>(mod_str, match_str, None)
195-
.map_err(|error| error)?;
186+
GenericStringArray<i32>,
187+
>(mod_str, match_str, None)?;
196188

197189
Ok(Arc::new(res) as ArrayRef)
198190
}

0 commit comments

Comments
 (0)