-
Notifications
You must be signed in to change notification settings - Fork 610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[YQL-17103] Support StartsWith with pg types in extract_predicate library #854
[YQL-17103] Support StartsWith with pg types in extract_predicate library #854
Conversation
nepal
commented
Jan 5, 2024
- support StartsWith predicates for pg types
Note This is an automated comment that will be appended during run. 🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit eaba788.
🔴 linux-x86_64-release-asan: some tests FAILED for commit eaba788.
|
085a2e5
to
0e213c4
Compare
@@ -4665,6 +4665,16 @@ void RegisterCoSimpleCallables1(TCallableOptimizerMap& map) { | |||
map["IsDistinctFrom"] = std::bind(&OptimizeDistinctFrom<false>, _1, _2); | |||
|
|||
map["StartsWith"] = map["EndsWith"] = map["StringContains"] = [](const TExprNode::TPtr& node, TExprContext& ctx, TOptimizeContext& /*optCtx*/) { | |||
if (node->Head().GetTypeAnn()->GetKind() == ETypeAnnotationKind::Pg || node->Tail().GetTypeAnn()->GetKind() == ETypeAnnotationKind::Pg) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this overload is needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overload helps to simplify logic of predicate analysis. This way we make StartsWith with pg types to look exactly the same as with plain YQL types (no intermediate FromPg is needed), so the code which looks for StartsWith over Member() call will work without pg-specific tweaks.
Also, accepting PG types here looks like a nice feature to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to discuss
0e213c4
to
da312f3
Compare
❌ Documentation buildRevision build failed Build logsErrors (8)❌ Error occurred in /en/postgresql/functions.md ❌ Error occurred in /en/reference/ydb-cli/workload-kv.md ❌ Error occurred in /ru/postgresql/functions.md ❌ Error occurred in /ru/reference/ydb-cli/workload-kv.md ❌ No such file or has no access to /en/postgresql/functions.md ❌ No such file or has no access to /en/reference/ydb-cli/workload-kv.md ❌ No such file or has no access to /ru/postgresql/functions.md ❌ No such file or has no access to /ru/reference/ydb-cli/workload-kv.md |
Discussed and decided
|
``` | ||
|
||
Обязательные аргументы: | ||
|
||
* Исходная строка; | ||
* Искомая подстрока. | ||
|
||
Аргументы могут быть типов `String` или `Utf8` и могут быть опциональными. | ||
Аргументы должны иметь тип `String`/`Utf8` (или опциональный String`/`Utf8`) либо строковый PostgreSQL тип (`PgText`/`PgBinary`/`PgVarchar`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pgbytea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
da312f3
to
eaba788
Compare
✅ Documentation buildRevision builded successful |