@@ -174,19 +174,27 @@ namespace {
174174 XX (AsciiToUpper, to_upper) \
175175 XX (AsciiToTitle, to_title)
176176
177+ // NOTE: The functions below are marked as deprecated, so block implementation
178+ // is not required for them. Hence, STROKA_FIND_UDF provides only the scalar
179+ // one at the moment.
177180#define STROKA_FIND_UDF_MAP (XX ) \
178- XX (Contains, Contains) \
179181 XX (StartsWith, StartsWith) \
180182 XX (EndsWith, EndsWith) \
181183 XX (HasPrefix, StartsWith) \
182184 XX (HasSuffix, EndsWith)
183185
186+ // NOTE: The functions below are marked as deprecated, so block implementation
187+ // is not required for them. Hence, STRING_TWO_ARGS_UDF provides only the
188+ // scalar one at the moment.
184189#define STRING_TWO_ARGS_UDF_MAP (XX ) \
185190 XX (StartsWithIgnoreCase, AsciiHasPrefixIgnoreCase) \
186191 XX (EndsWithIgnoreCase, AsciiHasSuffixIgnoreCase) \
187192 XX (HasPrefixIgnoreCase, AsciiHasPrefixIgnoreCase) \
188193 XX (HasSuffixIgnoreCase, AsciiHasSuffixIgnoreCase)
189194
195+ // NOTE: The functions below are marked as deprecated, so block implementation
196+ // is not required for them. Hence, STROKA_UDF provides only the scalar one at
197+ // the moment.
190198#define STROKA_UDF_MAP (XX ) \
191199 XX (Reverse, ReverseInPlace)
192200
@@ -207,6 +215,30 @@ namespace {
207215 return valueBuilder->NewString (input);
208216 }
209217
218+ BEGIN_SIMPLE_STRICT_ARROW_UDF (TContains, bool (TOptional<char *>, char *)) {
219+ Y_UNUSED (valueBuilder);
220+ if (!args[0 ])
221+ return TUnboxedValuePod (false );
222+
223+ const TString haystack (args[0 ].AsStringRef ());
224+ const TString needle (args[1 ].AsStringRef ());
225+ return TUnboxedValuePod (haystack.Contains (needle));
226+ }
227+
228+ struct TContainsKernelExec : public TBinaryKernelExec <TContainsKernelExec> {
229+ template <typename TSink>
230+ static void Process (TBlockItem arg1, TBlockItem arg2, const TSink& sink) {
231+ if (!arg1)
232+ return sink (TBlockItem (false ));
233+
234+ const TString haystack (arg1.AsStringRef ());
235+ const TString needle (arg2.AsStringRef ());
236+ sink (TBlockItem (haystack.Contains (needle)));
237+ }
238+ };
239+
240+ END_SIMPLE_ARROW_UDF (TContains, TContainsKernelExec::Do);
241+
210242 SIMPLE_STRICT_UDF (TReplaceAll, char *(TAutoMap<char *>, char *, char *)) {
211243 if (TString result (args[0 ].AsStringRef ()); SubstGlobal (result, args[1 ].AsStringRef (), args[2 ].AsStringRef ()))
212244 return valueBuilder->NewString (result);
@@ -277,6 +309,8 @@ namespace {
277309 return args[0 ];
278310 }
279311
312+ // NOTE: String::Find is marked as deprecated, so block implementation is
313+ // not required for them. Hence, only the scalar one is provided.
280314 SIMPLE_STRICT_UDF_WITH_OPTIONAL_ARGS (TFind, i64 (TAutoMap<char *>, char *, TOptional<ui64>), 1 ) {
281315 Y_UNUSED (valueBuilder);
282316 const TString haystack (args[0 ].AsStringRef ());
@@ -285,6 +319,9 @@ namespace {
285319 return TUnboxedValuePod (haystack.find (needle, pos));
286320 }
287321
322+ // NOTE: String::ReverseFind is marked as deprecated, so block
323+ // implementation is not required for them. Hence, only the scalar one is
324+ // provided.
288325 SIMPLE_STRICT_UDF_WITH_OPTIONAL_ARGS (TReverseFind, i64 (TAutoMap<char *>, char *, TOptional<ui64>), 1 ) {
289326 Y_UNUSED (valueBuilder);
290327 const TString haystack (args[0 ].AsStringRef ());
@@ -293,6 +330,8 @@ namespace {
293330 return TUnboxedValuePod (haystack.rfind (needle, pos));
294331 }
295332
333+ // NOTE: String::Substring is marked as deprecated, so block implementation
334+ // is not required for them. Hence, only the scalar one is provided.
296335 SIMPLE_STRICT_UDF_WITH_OPTIONAL_ARGS (TSubstring, char *(TAutoMap<char *>, TOptional<ui64>, TOptional<ui64>), 1 ) {
297336 const TString input (args[0 ].AsStringRef ());
298337 const ui64 from = args[1 ].GetOrDefault <ui64>(0 );
0 commit comments