Skip to content
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

Conversation

sevirov
Copy link
Contributor

@sevirov sevirov commented Oct 12, 2020

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en

Changelog category:

Добавил описание функции iLike и добавил оператор ILIKE.
@robot-clickhouse robot-clickhouse added the pr-documentation Documentation PRs for the specific code PR label Oct 12, 2020
@@ -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`.
Copy link
Contributor

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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).
Copy link
Contributor

@BayoNet BayoNet Oct 13, 2020

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@BayoNet BayoNet Oct 15, 2020

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%')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SELECT * FROM Months WHERE ilike(name, '%j%')
SELECT * FROM Months WHERE iLike(name, '%j%')

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ок.

@BayoNet
Copy link
Contributor

BayoNet commented Oct 13, 2020

Also, you didn't mention that ClickHouse supports the ILIKE operator, which works the same as the function.

@@ -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}
Copy link
Contributor

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.
Copy link
Contributor

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

@BayoNet BayoNet Oct 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iLike or ilike?

Внес поправки в английскую версию и сделал перевод на русский язык.
@BayoNet BayoNet merged commit e12f69c into ClickHouse:master Oct 19, 2020
traceon added a commit to traceon/ClickHouse that referenced this pull request Oct 19, 2020
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-documentation Documentation PRs for the specific code PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants