-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
DOCSUP-3478: Documented the iLike function #15880
DOCSUP-3478: Documented the iLike function #15880
Conversation
Добавил описание функции iLike и добавил оператор ILIKE.
@@ -378,6 +378,57 @@ For other regular expressions, the code is the same as for the ‘match’ funct | |||
|
|||
The same thing as ‘like’, but negative. | |||
|
|||
## iLike {#ilike} | |||
|
|||
Case insensitive variant of function `like`. It should respect UTF-8 and work similar to `positionCaseInsensitiveUTF8`. |
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.
If we refer to something, for example functions, we need to provide links.
I have understood nothing about UTF-8 reference.
|
||
**Returned value(s)** | ||
|
||
- True, if the string matches the supplied pattern. |
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.
- True, if the string matches the supplied pattern. | |
- True, if the string matches `pattern`. |
**Returned value(s)** | ||
|
||
- True, if the string matches the supplied pattern. | ||
- False, if the string doesn't match the supplied pattern. |
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.
- False, if the string doesn't match the supplied pattern. | |
- False, if the string doesn't match `pattern`. |
**Parameters** | ||
|
||
- `haystack` — Input string. [String](../../sql-reference/syntax.md#syntax-string-literal). | ||
- `pattern` — Regular expression with [re2 syntax](https://github.com/google/re2/wiki/Syntax). Must contain groups, each group enclosed in parentheses. If pattern contains no groups, an exception is thrown. [String](../../sql-reference/syntax.md#syntax-string-literal). |
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.
The like
function description contains "The regular expression can contain the meta symbols % and _." Does the function really require re2, or is there custom pattern syntax with "%" and "_" special symbols?
The function definitely must not contain groups. In fact, I'm not sure that it can contain groups.
I almost sure, the description of these functions must be similar to the PostgreSQL description https://www.postgresql.org/docs/13/functions-matching.html, and this pattern is not a regular expression at all.
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.
The
like
function description contains "The regular expression can contain the meta symbols % and ." Does the function really require re2, or is there custom pattern syntax with "%" and "" special symbols?The function definitely must not contain groups. In fact, I'm not sure that it can contain groups.
I almost sure, the description of these functions must be similar to the PostgreSQL description https://www.postgresql.org/docs/13/functions-matching.html, and this pattern is not a regular expression at all.
Yes, I agree that this pattern is not a regular expression at all. Can I describe different cases of the pattern in the same as in the PostgreSQL? But that's a lot of words.
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.
I didn't see many words about the pattern description in the Postgres docs, just a couple of sentences and four examples in one code block.
Query: | ||
|
||
``` sql | ||
SELECT * FROM Months WHERE ilike(name, '%j%') |
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.
SELECT * FROM Months WHERE ilike(name, '%j%') | |
SELECT * FROM Months WHERE iLike(name, '%j%') |
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.
iLike doesn't work, but ilike works. I tested it.
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.
Ок.
Also, you didn't mention that ClickHouse supports the ILIKE operator, which works the same as the function. |
Changed by comments.
@@ -378,6 +378,66 @@ For other regular expressions, the code is the same as for the ‘match’ funct | |||
|
|||
The same thing as ‘like’, but negative. | |||
|
|||
## iLike {#ilike} |
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.
If iLike
doesn't work, the topic must be named ilike
.
@@ -378,6 +378,66 @@ For other regular expressions, the code is the same as for the ‘match’ funct | |||
|
|||
The same thing as ‘like’, but negative. | |||
|
|||
## iLike {#ilike} | |||
|
|||
Case insensitive variant of [like](https://clickhouse.tech/docs/en/sql-reference/functions/string-search-functions/#function-like) function and works the same as the `ILIKE` operator. |
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.
The function doesn't work like ILIKE
. ILIKE
implementation is based on this function. You can write that the user can run ILIKE operator instead of the function.
- `haystack` — Input string. [String](../../sql-reference/syntax.md#syntax-string-literal). | ||
- `pattern` — If `pattern` doesn't contain percent signs or underscores, then the `pattern` only represents the string itself. An underscore (`_`) in `pattern` stands for (matches) any single character. A percent sign (`%`) matches any sequence of zero or more characters. | ||
|
||
Some examples of the `pattern` type: |
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.
Some examples of the `pattern` type: | |
Some `pattern` examples: |
@@ -53,6 +53,8 @@ ClickHouse transforms operators to their corresponding functions at the query pa | |||
|
|||
`a NOT LIKE s` – The `notLike(a, b)` function. | |||
|
|||
`a ILIKE s` – The `iLike(a, b)` function. |
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.
iLike
or ilike
?
Внес поправки в английскую версию и сделал перевод на русский язык.
* master: (719 commits) Revert "scipy" DOCSUP-3478: Documented the iLike function (ClickHouse#15880) DOCSUP-2954: Documented the view function (ClickHouse#15881) DOCSUP-2861: Translate on Russian (ClickHouse#16042) fix for floats tests for nullable_aggregate_states Update settings.md Update replication.md Update replication.md Update replication.md Update settings.md test for the bug 8580 test for the bug ClickHouse#8490 test for the bug ClickHouse#8425 Update run.sh done remove warnings in integration tests reset error code in ast fuzzer fix segfault with wrong aggregation in lambdas restart the tests ... # Conflicts: # src/Access/IAccessStorage.cpp # src/Access/IAccessStorage.h # src/Access/LDAPAccessStorage.cpp # src/Access/LDAPAccessStorage.h # src/Access/LDAPParams.h # src/Access/MultipleAccessStorage.cpp # src/Common/ErrorCodes.cpp # src/Server/HTTPHandler.cpp
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
Changelog category: