-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-33977][SQL][DOCS] Add doc for "'like any' and 'like all' operators" #31008
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
Changes from 49 commits
4a6f903
96456e2
4314005
d6af4a7
f69094f
b86a42d
2ac5159
9021d6c
74a2ef4
9828158
9cd1aaf
abfcbb9
07c6c81
580130b
3712808
6107413
4b799b4
ee0ecbf
596bc61
0164e2f
90b79fc
2cef3a9
c26b64f
2e02cd2
a6d0741
82e5b2c
70bbf5d
126a51e
f2ceacd
5ad208f
970917e
ddc1b8b
2b1ed0b
a7d3729
17ef8fc
f7a2902
a803c9b
9d79697
7127f5e
69bd51b
a7ced5c
05ec9b8
59cc7df
1345e49
e159efc
3d0826e
348c564
a52e46f
d5b0e48
524759a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,12 +21,14 @@ license: | | |
|
|
||
| ### Description | ||
|
|
||
| A LIKE predicate is used to search for a specific pattern. | ||
| A LIKE predicate is used to search for a specific pattern. LIKE predicate also supports multiple patterns with quantifiers include `ANY`, `SOME` and `ALL`. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sgtm
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
|
|
||
| ### Syntax | ||
|
|
||
| ```sql | ||
| [ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | [ RLIKE | REGEXP ] regex_pattern } | ||
|
|
||
| [ NOT ] { LIKE quantifiers ( search_pattern [ , ... ]) } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to describle |
||
| ``` | ||
|
|
||
| ### Parameters | ||
|
|
@@ -45,6 +47,10 @@ A LIKE predicate is used to search for a specific pattern. | |
| * **regex_pattern** | ||
|
|
||
| Specifies a regular expression search pattern to be searched by the `RLIKE` or `REGEXP` clause. | ||
|
|
||
| * **quantifiers** | ||
|
|
||
| Specifies the predicate quantifiers include `ANY`, `SOME` and `ALL`. `ANY` or `SOME` means if one of the patterns matches the input, then return true; `ALL` means if all the patterns matches the input, then return true. | ||
|
|
||
| ### Examples | ||
|
|
||
|
|
@@ -111,6 +117,58 @@ SELECT * FROM person WHERE name LIKE '%$_%' ESCAPE '$'; | |
| +---+------+---+ | ||
| |500|Evan_W| 16| | ||
| +---+------+---+ | ||
|
|
||
| SELECT * FROM person WHERE name LIKE ALL ('%an%', '%an'); | ||
| +---+----+----+ | ||
| | id|name| age| | ||
| +---+----+----+ | ||
| |400| Dan| 50| | ||
| +---+----+----+ | ||
|
|
||
| SELECT * FROM person WHERE name LIKE ANY ('%an%', '%an'); | ||
| +---+------+---+ | ||
| | id| name|age| | ||
| +---+------+---+ | ||
| |400| Dan| 50| | ||
| |500|Evan_W| 16| | ||
| +---+------+---+ | ||
|
|
||
| SELECT * FROM person WHERE name LIKE SOME ('%an%', '%an'); | ||
| +---+------+---+ | ||
| | id| name|age| | ||
| +---+------+---+ | ||
| |400| Dan| 50| | ||
| |500|Evan_W| 16| | ||
| +---+------+---+ | ||
|
|
||
| SELECT * FROM person WHERE name NOT LIKE ALL ('%an%', '%an'); | ||
| +---+----+----+ | ||
| | id|name| age| | ||
| +---+----+----+ | ||
| |100|John| 30| | ||
| |200|Mary|null| | ||
| |300|Mike| 80| | ||
| +---+----+----+ | ||
|
|
||
| SELECT * FROM person WHERE name NOT LIKE ANY ('%an%', '%an'); | ||
| +---+------+----+ | ||
| | id| name| age| | ||
| +---+------+----+ | ||
| |100| John| 30| | ||
| |200| Mary|null| | ||
| |300| Mike| 80| | ||
| |500|Evan_W| 16| | ||
| +---+------+----+ | ||
|
|
||
| SELECT * FROM person WHERE name NOT LIKE SOME ('%an%', '%an'); | ||
| +---+------+----+ | ||
| | id| name| age| | ||
| +---+------+----+ | ||
| |100| John| 30| | ||
| |200| Mary|null| | ||
| |300| Mike| 80| | ||
| |500|Evan_W| 16| | ||
| +---+------+----+ | ||
| ``` | ||
|
|
||
| ### Related Statements | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.