Skip to content

Commit b5fd6f7

Browse files
committed
Undo LangVersion and unrelevant changes
1 parent 7b88770 commit b5fd6f7

File tree

15 files changed

+87
-445
lines changed

15 files changed

+87
-445
lines changed

yql/essentials/core/peephole_opt/yql_opt_peephole_physical.cpp

Lines changed: 0 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <yql/essentials/utils/yql_paths.h>
2323

2424
#include <util/generic/xrange.h>
25-
#include <util/string/ascii.h>
2625

2726
#include <library/cpp/svnversion/svnversion.h>
2827
#include <library/cpp/yson/writer.h>
@@ -8358,101 +8357,6 @@ TExprNode::TPtr ExpandSqlCompare(const TExprNode::TPtr& node, TExprContext& ctx)
83588357
return node;
83598358
}
83608359

8361-
TExprNode::TPtr ExpandContainsIgnoreCase(const TExprNode::TPtr& node, TExprContext& ctx) {
8362-
YQL_CLOG(DEBUG, CorePeepHole) << "Expand " << node->Content();
8363-
const auto pos = node->Pos();
8364-
const TString part{node->Child(1)->Child(0)->Content()};
8365-
if (node->Child(0)->GetTypeAnn()->GetKind() == ETypeAnnotationKind::Null) {
8366-
return MakeBool<false>(pos, ctx);
8367-
}
8368-
8369-
if (AllOf(part, IsAscii)) {
8370-
TString func = "String._yql_";
8371-
if (node->Content() == "EqualsIgnoreCase") {
8372-
func += "AsciiEqualsIgnoreCase";
8373-
} else if (node->Content() == "StartsWithIgnoreCase") {
8374-
func += "AsciiStartsWithIgnoreCase";
8375-
} else if (node->Content() == "EndsWithIgnoreCase") {
8376-
func += "AsciiEndsWithIgnoreCase";
8377-
} else if (node->Content() == "StringContainsIgnoreCase") {
8378-
func += "AsciiContainsIgnoreCase";
8379-
} else {
8380-
YQL_ENSURE(!"Unknown IngoreCase node");
8381-
}
8382-
8383-
return ctx.Builder(pos)
8384-
.Callable("Apply")
8385-
.Callable(0, "Udf")
8386-
.Atom(0, func)
8387-
.Seal()
8388-
.Add(1, node->ChildPtr(0))
8389-
.Callable(2, "String")
8390-
.Atom(0, part)
8391-
.Seal()
8392-
.Seal()
8393-
.Build();
8394-
}
8395-
8396-
TString pattern;
8397-
if (node->Content() == "EqualsIgnoreCase") {
8398-
pattern = part;
8399-
} else if (node->Content() == "StartsWithIgnoreCase") {
8400-
pattern = part + "%";
8401-
} else if (node->Content() == "EndsWithIgnoreCase") {
8402-
pattern = "%" + part;
8403-
} else if (node->Content() == "StringContainsIgnoreCase") {
8404-
pattern = "%" + part + "%";
8405-
} else {
8406-
YQL_ENSURE(!"Unknown IngoreCase node");
8407-
}
8408-
auto patternExpr = ctx.Builder(pos)
8409-
.Callable("Apply")
8410-
.Callable(0, "Udf")
8411-
.Atom(0, "Re2.PatternFromLike")
8412-
.Seal()
8413-
.Callable(1, node->Child(1)->Content())
8414-
.Atom(0, pattern)
8415-
.Seal()
8416-
.Seal()
8417-
.Build();
8418-
8419-
8420-
auto optionsExpr = ctx.Builder(pos)
8421-
.Callable("NamedApply")
8422-
.Callable(0, "Udf")
8423-
.Atom(0, "Re2.Options")
8424-
.Seal()
8425-
.List(1)
8426-
.Seal()
8427-
.Callable(2, "AsStruct")
8428-
.List(0)
8429-
.Atom(0, "CaseSensitive")
8430-
.Callable(1, "Bool")
8431-
.Atom(0, "false", TNodeFlags::Default)
8432-
.Seal()
8433-
.Seal()
8434-
.Seal()
8435-
.Seal()
8436-
.Build();
8437-
8438-
auto result = ctx.Builder(pos)
8439-
.Callable("Apply")
8440-
.Callable(0, "AssumeStrict")
8441-
.Callable(0, "Udf")
8442-
.Atom(0, "Re2.Match")
8443-
.List(1)
8444-
.Add(0, patternExpr)
8445-
.Add(1, optionsExpr)
8446-
.Seal()
8447-
.Seal()
8448-
.Seal()
8449-
.Add(1, node->Child(0))
8450-
.Seal()
8451-
.Build();
8452-
8453-
return result;
8454-
}
8455-
84568360
template <bool Equals>
84578361
TExprNode::TPtr ExpandAggrEqual(const TExprNode::TPtr& node, TExprContext& ctx) {
84588362
if (&node->Head() == &node->Tail()) {

yql/essentials/docs/en/udf/list/string.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,27 @@ Functions for ASCII strings:
3232

3333
* `String::CollapseText(String{Flags:AutoMap}, Uint64) -> String`
3434

35-
* `String::AsciiEqualsIgnoreCase(String?, String) -> Bool` Added in the version [2025.02](../../changelog/2025.02.md#string-module)
36-
3735
* `String::Contains(String?, String) -> Bool`
3836

39-
* `String::AsciiContainsIgnoreCase(String?, String) -> Bool` Added in the version [2025.02](../../changelog/2025.02.md#string-module)
40-
4137
* `String::Find(String{Flags:AutoMap}, String, [Uint64?]) -> Int64`: Returns the first position found or -1. The optional argument is the offset from the beginning of the string.
4238

4339
* `String::ReverseFind(String{Flags:AutoMap}, String, [Uint64?]) -> Int64`: Returns the last position found or -1. The optional argument is the offset from the beginning of the string.
4440

45-
* `String::AsciiStartsWithIgnoreCase(String?, String) -> Bool` Added in the version [2025.02](../../changelog/2025.02.md#string-module)
46-
4741
* `String::HasPrefix(String?, String) -> Bool`
4842

49-
* `String::HasPrefixIgnoreCase(String?, String) -> Bool` Removed in the version [2025.02](../../changelog/2025.02.md#string-module)
43+
* `String::HasPrefixIgnoreCase(String?, String) -> Bool`
5044

5145
* `String::StartsWith(String?, String) -> Bool`
5246

53-
* `String::StartsWithIgnoreCase(String?, String) -> Bool` Removed in the version [2025.02](../../changelog/2025.02.md#string-module)
54-
55-
* `String::AsciiEndsWithIgnoreCase(String?, String) -> Bool` Added in the version [2025.02](../../changelog/2025.02.md#string-module)
47+
* `String::StartsWithIgnoreCase(String?, String) -> Bool`
5648

5749
* `String::HasSuffix(String?, String) -> Bool`
5850

59-
* `String::HasSuffixIgnoreCase(String?, String) -> Bool` Removed in the version [2025.02](../../changelog/2025.02.md#string-module)
51+
* `String::HasSuffixIgnoreCase(String?, String) -> Bool`
6052

6153
* `String::EndsWith(String?, String) -> Bool`
6254

63-
* `String::EndsWithIgnoreCase(String?, String) -> Bool` Removed in the version [2025.02](../../changelog/2025.02.md#string-module)
55+
* `String::EndsWithIgnoreCase(String?, String) -> Bool`
6456

6557
* `String::Substring(String{Flags:AutoMap}, [Uint64?, Uint64?]) -> String`
6658

yql/essentials/docs/ru/udf/list/string.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ SELECT String::Strip("YQL "); -- "YQL"
4747

4848
Проверяет наличие подстроки в строке.
4949

50-
* `String::AsciiContainsIgnoreCase(string:String?, substring:String) -> Bool`
51-
* `String::AsciiEqualsIgnoreCase(left:String?, right:String) -> Bool`
52-
Проверяют наличие подстроки или полное равенство строк без учета регистра символов.
53-
5450
* `String::Find(string:String{Flags:AutoMap}, String, [Uint64?]) -> Int64` - Устаревшая: используйте встроенную функцию [Find](../../builtins/basic.md#find)
5551
* `String::ReverseFind(string:String{Flags:AutoMap}, String, [Uint64?]) -> Int64` - Устаревшая: используйте встроенную функцию [RFind](../../builtins/basic.md#rfind)
5652
* `String::Substring(string:String{Flags:AutoMap}, [Uint64?, Uint64?]) -> String` - Устаревшая: используйте встроенную функцию [Substring](../../builtins/basic.md#substring)
@@ -62,12 +58,10 @@ SELECT String::Strip("YQL "); -- "YQL"
6258

6359
Устаревшие функции, к использованию не рекомендуются.
6460

65-
* `String::AsciiStartsWithIgnoreCase(string:String?, prefix:String) -> Bool` - добавлена в версии [2025.02](../../changelog/2025.02.md#string-module)
66-
* `String::AsciiEndsWithIgnoreCase(string:String?, suffix:String) -> Bool` - добавлена в версии [2025.02](../../changelog/2025.02.md#string-module)
67-
* `String::HasPrefixIgnoreCase(string:String?, prefix:String) -> Bool` - удалена в версии [2025.02](../../changelog/2025.02.md#string-module)
68-
* `String::StartsWithIgnoreCase(string:String?, prefix:String) -> Bool` - удалена в версии [2025.02](../../changelog/2025.02.md#string-module)
69-
* `String::HasSuffixIgnoreCase(string:String?, suffix:String) -> Bool` - удалена в версии [2025.02](../../changelog/2025.02.md#string-module)
70-
* `String::EndsWithIgnoreCase(string:String?, suffix:String) -> Bool` - удалена в версии [2025.02](../../changelog/2025.02.md#string-module)
61+
* `String::HasPrefixIgnoreCase(string:String?, prefix:String) -> Bool`
62+
* `String::StartsWithIgnoreCase(string:String?, prefix:String) -> Bool`
63+
* `String::HasSuffixIgnoreCase(string:String?, suffix:String) -> Bool`
64+
* `String::EndsWithIgnoreCase(string:String?, suffix:String) -> Bool`
7165

7266
Проверяют наличие префикса или суффикса в строке без учёта региста символов.
7367

yql/essentials/public/udf/arrow/udf_arrow_helpers.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class TUdfKernelState : public arrow::compute::KernelState {
6262

6363
return *ScalarBuilder_;
6464
}
65-
65+
6666
const IValueBuilder& GetValueBuilder() {
6767
Y_ENSURE(ValueBuilder_);
6868
return *ValueBuilder_;
@@ -348,7 +348,7 @@ TScalarBuilderImpl* CastToScalarBuilderImpl(IScalarBuilder& builder) {
348348
template<typename TReader>
349349
TReader* CastToBlockReaderImpl(IBlockReader& reader) {
350350
static_assert(std::is_base_of_v<IBlockReader, TReader>);
351-
351+
352352
auto* readerImpl = dynamic_cast<TReader*>(&reader);
353353
Y_ENSURE(readerImpl, TStringBuilder() << "Got " << typeid(reader).name() << " as BlockReader");
354354
return readerImpl;
@@ -444,7 +444,7 @@ struct TBinaryKernelExec {
444444

445445
*res = MakeArray(outputArrays);
446446
} else if (arg1.is_array() && arg2.is_scalar()) {
447-
auto& array1 = *arg1.array();
447+
auto& array1 = *arg1.array();
448448
auto item2 = reader2Impl->GetScalarItem(*arg2.scalar());
449449
auto& builder = state.GetArrayBuilder();
450450
auto* builderImpl = CastToArrayBuilderImpl<TArrayBuilderImpl>(builder);
@@ -644,7 +644,7 @@ struct TUnaryUnsafeFixedSizeFilterKernel {
644644
}
645645
auto validMask = nullBuilder.Finish();
646646
validMask = MakeDenseBitmap(validMask->data(), length, GetYqlMemoryPool());
647-
647+
648648
auto inMask = inArray->buffers[0];
649649
if (inMask) {
650650
outArray->buffers[0] = AllocateBitmapWithReserve(length, GetYqlMemoryPool());
@@ -703,10 +703,6 @@ class TUnaryOverOptionalImpl : public TBoxedValue {
703703
BEGIN_ARROW_UDF_IMPL(udfName##_BlocksImpl, signatureFunc, 0, true) \
704704
UDF_IMPL(udfName, builder.SimpleSignature<signatureFunc>().SupportsBlocks().IsStrict();, ;, ;, "", "", udfName##_BlocksImpl)
705705

706-
#define BEGIN_SIMPLE_STRICT_ARROW_UDF_OPTIONS(udfName, signatureFunc, options) \
707-
BEGIN_ARROW_UDF_IMPL(udfName##_BlocksImpl, signatureFunc, 0, true) \
708-
UDF_IMPL(udfName, builder.SimpleSignature<signatureFunc>().SupportsBlocks().IsStrict(); options;, ;, ;, "", "", udfName##_BlocksImpl)
709-
710706
#define BEGIN_SIMPLE_ARROW_UDF_WITH_OPTIONAL_ARGS(udfName, signatureFunc, optArgc) \
711707
BEGIN_ARROW_UDF_IMPL(udfName##_BlocksImpl, signatureFunc, optArgc, false) \
712708
UDF_IMPL(udfName, builder.SimpleSignature<signatureFunc>().SupportsBlocks().OptionalArgs(optArgc);, ;, ;, "", "", udfName##_BlocksImpl)
@@ -748,4 +744,4 @@ class TUnaryOverOptionalImpl : public TBoxedValue {
748744
END_ARROW_UDF(udfName##_BlocksImpl, exec)
749745

750746
#define END_SIMPLE_ARROW_UDF_WITH_NULL_HANDLING(udfName, exec, nullHandling) \
751-
END_ARROW_UDF_WITH_NULL_HANDLING(udfName##_BlocksImpl, exec, nullHandling)
747+
END_ARROW_UDF_WITH_NULL_HANDLING(udfName##_BlocksImpl, exec, nullHandling)

yql/essentials/udfs/common/string/string_udf.cpp

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,16 @@ namespace {
151151
} \
152152
}
153153

154-
#define STRING_TWO_ARGS_UDF_DEPRECATED_2025_02(udfName, function) \
155-
SIMPLE_STRICT_UDF_OPTIONS(T##udfName, bool(TOptional<char*>, char*), \
156-
builder.SetMaxLangVer(NYql::MakeLangVersion(2025, 1))) \
157-
{ \
158-
Y_UNUSED(valueBuilder); \
159-
if (args[0]) { \
160-
const TString haystack(args[0].AsStringRef()); \
161-
const TString needle(args[1].AsStringRef()); \
162-
return TUnboxedValuePod(function(haystack, needle)); \
163-
} else { \
164-
return TUnboxedValuePod(false); \
165-
} \
154+
#define STRING_TWO_ARGS_UDF(udfName, function) \
155+
SIMPLE_STRICT_UDF(T##udfName, bool(TOptional<char*>, char*)) { \
156+
Y_UNUSED(valueBuilder); \
157+
if (args[0]) { \
158+
const TString haystack(args[0].AsStringRef()); \
159+
const TString needle(args[1].AsStringRef()); \
160+
return TUnboxedValuePod(function(haystack, needle)); \
161+
} else { \
162+
return TUnboxedValuePod(false); \
163+
} \
166164
}
167165

168166
#define STRING_ASCII_CMP_IGNORE_CASE_UDF(udfName, function) \
@@ -193,9 +191,8 @@ namespace {
193191
} \
194192
}; \
195193
\
196-
BEGIN_SIMPLE_STRICT_ARROW_UDF_OPTIONS(T##udfName, \
197-
bool(TOptional<char*>, char*), \
198-
builder.SetMinLangVer(NYql::MakeLangVersion(2025, 2))) \
194+
BEGIN_SIMPLE_STRICT_ARROW_UDF(T##udfName, \
195+
bool(TOptional<char*>, char*)) \
199196
{ \
200197
Y_UNUSED(valueBuilder); \
201198
return udfName##Impl(args); \
@@ -212,7 +209,7 @@ namespace {
212209
\
213210
END_SIMPLE_ARROW_UDF(T_yql_##udfName, T##udfName##KernelExec::Do)
214211

215-
#define IS_ASCII_UDF(function) \
212+
#define IS_ASCII_UDF(function) \
216213
BEGIN_SIMPLE_STRICT_ARROW_UDF(T##function, bool(TOptional<char*>)) { \
217214
Y_UNUSED(valueBuilder); \
218215
if (args[0]) { \
@@ -409,9 +406,9 @@ namespace {
409406
XX(HasSuffix, EndsWith)
410407

411408
// NOTE: The functions below are marked as deprecated, so block implementation
412-
// is not required for them. Hence, STRING_TWO_ARGS_UDF_DEPRECATED_2025_02
413-
// provides only the scalar one at the moment.
414-
#define STRING_TWO_ARGS_UDF_MAP_DEPRECATED_2025_02(XX) \
409+
// is not required for them. Hence, STRING_TWO_ARGS_UDF provides only the
410+
// scalar one at the moment.
411+
#define STRING_TWO_ARGS_UDF_MAP(XX) \
415412
XX(StartsWithIgnoreCase, AsciiHasPrefixIgnoreCase) \
416413
XX(EndsWithIgnoreCase, AsciiHasSuffixIgnoreCase) \
417414
XX(HasPrefixIgnoreCase, AsciiHasPrefixIgnoreCase) \
@@ -426,6 +423,7 @@ namespace {
426423
// is not required for them. Hence, STROKA_UDF provides only the scalar one at
427424
// the moment.
428425
#define STROKA_UDF_MAP(XX) \
426+
XX(Reverse, ReverseInPlace)
429427

430428
#define IS_ASCII_UDF_MAP(XX) \
431429
XX(IsAscii) \
@@ -541,8 +539,7 @@ namespace {
541539
return TUnboxedValuePod(found != haystack.cend());
542540
}
543541

544-
BEGIN_SIMPLE_STRICT_ARROW_UDF_OPTIONS(TAsciiContainsIgnoreCase, bool(TOptional<char*>, char*),
545-
builder.SetMinLangVer(NYql::MakeLangVersion(2025, 2)))
542+
BEGIN_SIMPLE_STRICT_ARROW_UDF(TAsciiContainsIgnoreCase, bool(TOptional<char*>, char*))
546543
{
547544
Y_UNUSED(valueBuilder);
548545
return AsciiContainsIgnoreCaseImpl(args);
@@ -990,7 +987,7 @@ namespace {
990987
STROKA_CASE_UDF_MAP(STROKA_CASE_UDF)
991988
STROKA_ASCII_CASE_UDF_MAP(STROKA_ASCII_CASE_UDF)
992989
STROKA_FIND_UDF_MAP(STROKA_FIND_UDF)
993-
STRING_TWO_ARGS_UDF_MAP_DEPRECATED_2025_02(STRING_TWO_ARGS_UDF_DEPRECATED_2025_02)
990+
STRING_TWO_ARGS_UDF_MAP(STRING_TWO_ARGS_UDF)
994991
STRING_ASCII_CMP_IGNORE_CASE_UDF_MAP(STRING_ASCII_CMP_IGNORE_CASE_UDF)
995992
IS_ASCII_UDF_MAP(IS_ASCII_UDF)
996993

@@ -1007,8 +1004,8 @@ namespace {
10071004
STROKA_CASE_UDF_MAP(STRING_REGISTER_UDF)
10081005
STROKA_ASCII_CASE_UDF_MAP(STRING_REGISTER_UDF)
10091006
STROKA_FIND_UDF_MAP(STRING_REGISTER_UDF)
1010-
STRING_TWO_ARGS_UDF_MAP_DEPRECATED_2025_02(STRING_REGISTER_UDF)
1011-
STRING_ASCII_CMP_IGNORE_CASE_UDF_MAP(STRING_REGISTER_UDF)
1007+
STRING_TWO_ARGS_UDF_MAP(STRING_REGISTER_UDF)
1008+
// STRING_ASCII_CMP_IGNORE_CASE_UDF_MAP(STRING_REGISTER_UDF) not going to be expoesed until 2025.2
10121009
STRING_ASCII_CMP_IGNORE_CASE_UDF_MAP(STRING_OPT_REGISTER_UDF)
10131010
IS_ASCII_UDF_MAP(STRING_REGISTER_UDF)
10141011
STRING_STREAM_PAD_FORMATTER_UDF_MAP(STRING_REGISTER_UDF)
@@ -1023,7 +1020,7 @@ namespace {
10231020
TRemoveFirst,
10241021
TRemoveLast,
10251022
TContains,
1026-
TAsciiContainsIgnoreCase,
1023+
//TAsciiContainsIgnoreCase, not going to be expoesed until 2025.2
10271024
T_yql_AsciiContainsIgnoreCase,
10281025
TFind,
10291026
TReverseFind,

yql/essentials/udfs/common/string/test/canondata/result.json

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
],
77
"test.test[AsciiCmpIgnoreCase]": [
88
{
9-
"uri": "file://test.test_AsciiCmpIgnoreCase_/results.txt"
10-
}
11-
],
12-
"test.test[AsciiCmpIgnoreCase_2025_02]": [
13-
{
14-
"uri": "file://test.test_AsciiCmpIgnoreCase_2025_02_/extracted"
9+
"uri": "file://test.test_AsciiCmpIgnoreCase_/extracted"
1510
}
1611
],
1712
"test.test[Base32Decode]": [
@@ -29,11 +24,6 @@
2924
"uri": "file://test.test_BlockAsciiChecks_/results.txt"
3025
}
3126
],
32-
"test.test[BlockAsciiCmpIgnoreCase]": [
33-
{
34-
"uri": "file://test.test_BlockAsciiCmpIgnoreCase_/results.txt"
35-
}
36-
],
3727
"test.test[BlockFind]": [
3828
{
3929
"uri": "file://test.test_BlockFind_/results.txt"

0 commit comments

Comments
 (0)