You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/04/24 23:02:13 UTC

[GitHub] [spark] huaxingao opened a new pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

huaxingao opened a new pull request #28332:
URL: https://github.com/apache/spark/pull/28332


   
   ### What changes were proposed in this pull request?
   Document LIKE clause in SQL Reference
   
   
   ### Why are the changes needed?
   To make SQL Reference complete
   
   
   ### Does this PR introduce any user-facing change?
   Yes
   
   before
   <img width="1050" alt="Screen Shot 2020-04-24 at 3 51 03 PM" src="https://user-images.githubusercontent.com/13592258/80262797-71e53900-8643-11ea-8c85-c6355bea8984.png">
   
   after
   <img width="1050" alt="Screen Shot 2020-04-24 at 3 49 20 PM" src="https://user-images.githubusercontent.com/13592258/80262740-49f5d580-8643-11ea-9c41-cc49c7f6e4d8.png">
   
   <img width="1049" alt="Screen Shot 2020-04-24 at 3 49 39 PM" src="https://user-images.githubusercontent.com/13592258/80262742-4bbf9900-8643-11ea-8c67-c31f8cc12694.png">
   
   
   
   ### How was this patch tested?
   Manually build and check
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
maropu commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-620920092


   ok, thanks. Merged to master/3.0.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619458822






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28332:
URL: https://github.com/apache/spark/pull/28332#discussion_r415177676



##########
File path: docs/sql-ref-syntax-qry-select-like.md
##########
@@ -0,0 +1,120 @@
+---
+layout: global
+title: LIKE Predicate
+displayTitle: LIKE Predicate
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+A LIKE predicate is used to search for a specific pattern.
+
+### Syntax
+
+{% highlight sql %}
+[ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern }
+{% endhighlight %}
+
+### Parameters
+
+<dl>
+  <dt><code><em>search_pattern</em></code></dt>
+  <dd>
+    Specifies a string pattern to be searched by the <code>LIKE</code> clause. It can contain special pattern-matching characters:
+    <ul>
+      <li><code>%</code></li> matches zero or more characters.
+      <li><code>_</code></li> matches exactly one character.
+    </ul>
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>esc_char</em></code></dt>
+  <dd>
+    Specifies the escape character. The default escape character is <code>\</code>.
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>regex_pattern</em></code></dt>
+  <dd>
+    Specifies a regular expression search pattern to be searched by the <code>RLIKE</code> clause.
+  </dd>
+</dl>
+
+### Examples
+
+{% highlight sql %}
+CREATE TABLE person (id INT, name STRING, age INT);
+INSERT INTO person VALUES
+    (100, 'John', 30),
+    (200, 'Mary', NULL),
+    (300, 'Mike', 80),
+    (400, 'Dan',  50),
+    (500, 'Evan_w', 16);
+
+SELECT * FROM person WHERE name LIKE 'M%';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE 'M_ry';
++---+----+----+
+| id|name| age|
++---+----+----+
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name NOT LIKE 'M_ry';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
+|300|  Mike| 80|
+|100|  John| 30|
+|400|   Dan| 50|
++---+------+---+
+
+SELECT * FROM person WHERE name RLIKE '[MD]';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|400| Dan|  50|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE '%\_%';

Review comment:
       Ah, I see... I think a single `\` is ok now. If we get user's feedbacks, we will update it then.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28332:
URL: https://github.com/apache/spark/pull/28332#discussion_r415163243



##########
File path: docs/sql-ref-syntax-qry-select-like.md
##########
@@ -0,0 +1,113 @@
+---
+layout: global
+title: LIKE Predicate
+displayTitle: LIKE Predicate
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+A LIKE predicate is used to search for a specific pattern.
+
+### Syntax
+
+{% highlight sql %}
+[ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern }
+{% endhighlight %}
+
+### Parameters
+
+<dl>
+  <dt><code><em>search_pattern</em></code></dt>
+  <dd>
+    Specifies a string pattern to be searched by the <code>LIKE</code> clause. It can contain special pattern-matching characters:
+    <ul>
+      <li><code>%</code></li> matches zero or more characters.
+      <li><code>_</code></li> matches exactly one character.
+    </ul>
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>esc_char</em></code></dt>
+  <dd>
+    Specifies the escape character.
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>regex_pattern</em></code></dt>
+  <dd>
+    Specifies a regular expression search pattern to be searched by the <code>RLIKE</code> clause.
+  </dd>
+</dl>
+
+### Examples
+
+{% highlight sql %}
+CREATE TABLE person (id INT, name STRING, age INT);
+INSERT INTO person VALUES
+    (100, 'John', 30),
+    (200, 'Mary', NULL),
+    (300, 'Mike', 80),
+    (400, 'Dan',  50),
+    (500, 'Evan_w', 16);
+
+SELECT * FROM person WHERE name LIKE 'M%';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE 'M_ry';
++---+----+----+
+| id|name| age|
++---+----+----+
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name NOT LIKE 'M_ry';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
+|300|  Mike| 80|
+|100|  John| 30|
+|400|   Dan| 50|
++---+------+---+
+
+SELECT * FROM person WHERE name RLIKE '[MD]';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|400| Dan|  50|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE '%$_%' ESCAPE '$';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
++---+------+---+
+{% endhighlight %}
+
+### Related Statements
+
+ * [SELECT](sql-ref-syntax-qry-select.html)
+ * [WHERE Clause](sql-ref-syntax-qry-select-where.html)

Review comment:
       You referred some existing documents in the other systems? For example, it seems PgSQL has a single page for patten-matching syntaxes.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619275016


   **[Test build #121786 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121786/testReport)** for PR 28332 at commit [`89fc5d6`](https://github.com/apache/spark/commit/89fc5d6f30d15f833cbeb6f12b1bebacb77b38ee).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619450894






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28332:
URL: https://github.com/apache/spark/pull/28332#discussion_r415169589



##########
File path: docs/sql-ref-syntax-qry-select-like.md
##########
@@ -0,0 +1,113 @@
+---
+layout: global
+title: LIKE Predicate
+displayTitle: LIKE Predicate
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+A LIKE predicate is used to search for a specific pattern.
+
+### Syntax
+
+{% highlight sql %}
+[ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern }
+{% endhighlight %}
+
+### Parameters
+
+<dl>
+  <dt><code><em>search_pattern</em></code></dt>
+  <dd>
+    Specifies a string pattern to be searched by the <code>LIKE</code> clause. It can contain special pattern-matching characters:
+    <ul>
+      <li><code>%</code></li> matches zero or more characters.
+      <li><code>_</code></li> matches exactly one character.
+    </ul>
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>esc_char</em></code></dt>
+  <dd>
+    Specifies the escape character.
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>regex_pattern</em></code></dt>
+  <dd>
+    Specifies a regular expression search pattern to be searched by the <code>RLIKE</code> clause.
+  </dd>
+</dl>
+
+### Examples
+
+{% highlight sql %}
+CREATE TABLE person (id INT, name STRING, age INT);
+INSERT INTO person VALUES
+    (100, 'John', 30),
+    (200, 'Mary', NULL),
+    (300, 'Mike', 80),
+    (400, 'Dan',  50),
+    (500, 'Evan_w', 16);
+
+SELECT * FROM person WHERE name LIKE 'M%';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE 'M_ry';
++---+----+----+
+| id|name| age|
++---+----+----+
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name NOT LIKE 'M_ry';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
+|300|  Mike| 80|
+|100|  John| 30|
+|400|   Dan| 50|
++---+------+---+
+
+SELECT * FROM person WHERE name RLIKE '[MD]';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|400| Dan|  50|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE '%$_%' ESCAPE '$';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
++---+------+---+
+{% endhighlight %}
+
+### Related Statements
+
+ * [SELECT](sql-ref-syntax-qry-select.html)
+ * [WHERE Clause](sql-ref-syntax-qry-select-where.html)

Review comment:
       Yea, we should not include them in this PR.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] huaxingao commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
huaxingao commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-620700495


   cc @srowen 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619457824


   **[Test build #121820 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121820/testReport)** for PR 28332 at commit [`c5cbabc`](https://github.com/apache/spark/commit/c5cbabc51d60317d588dcdb041845ed9a255c334).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] huaxingao commented on a change in pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28332:
URL: https://github.com/apache/spark/pull/28332#discussion_r415162543



##########
File path: docs/sql-ref-syntax-qry-select-like.md
##########
@@ -0,0 +1,113 @@
+---
+layout: global
+title: LIKE Predicate
+displayTitle: LIKE Predicate
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+A LIKE predicate is used to search for a specific pattern.
+
+### Syntax
+
+{% highlight sql %}
+[ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern }
+{% endhighlight %}
+
+### Parameters
+
+<dl>
+  <dt><code><em>search_pattern</em></code></dt>
+  <dd>
+    Specifies a string pattern to be searched by the <code>LIKE</code> clause. It can contain special pattern-matching characters:
+    <ul>
+      <li><code>%</code></li> matches zero or more characters.
+      <li><code>_</code></li> matches exactly one character.
+    </ul>
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>esc_char</em></code></dt>
+  <dd>
+    Specifies the escape character.
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>regex_pattern</em></code></dt>
+  <dd>
+    Specifies a regular expression search pattern to be searched by the <code>RLIKE</code> clause.
+  </dd>
+</dl>
+
+### Examples
+
+{% highlight sql %}
+CREATE TABLE person (id INT, name STRING, age INT);
+INSERT INTO person VALUES
+    (100, 'John', 30),
+    (200, 'Mary', NULL),
+    (300, 'Mike', 80),
+    (400, 'Dan',  50),
+    (500, 'Evan_w', 16);
+
+SELECT * FROM person WHERE name LIKE 'M%';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE 'M_ry';
++---+----+----+
+| id|name| age|
++---+----+----+
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name NOT LIKE 'M_ry';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
+|300|  Mike| 80|
+|100|  John| 30|
+|400|   Dan| 50|
++---+------+---+
+
+SELECT * FROM person WHERE name RLIKE '[MD]';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|400| Dan|  50|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE '%$_%' ESCAPE '$';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
++---+------+---+
+{% endhighlight %}
+
+### Related Statements
+
+ * [SELECT](sql-ref-syntax-qry-select.html)
+ * [WHERE Clause](sql-ref-syntax-qry-select-where.html)

Review comment:
       I separated the LIKE predicate from the WHERE clause page. It seems better to me this way. It's also easier to add LIKE ANY and LIKE ALL later. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619277605






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619457945






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619452746


   **[Test build #121819 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121819/testReport)** for PR 28332 at commit [`488684b`](https://github.com/apache/spark/commit/488684b40bd850633445745c4207c9174317590c).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
maropu commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619455981


   Looks fine.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619275344






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619273723






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619277605






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619273723






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619275016


   **[Test build #121786 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121786/testReport)** for PR 28332 at commit [`89fc5d6`](https://github.com/apache/spark/commit/89fc5d6f30d15f833cbeb6f12b1bebacb77b38ee).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619275344






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619450894






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28332:
URL: https://github.com/apache/spark/pull/28332#discussion_r415169803



##########
File path: docs/sql-ref-syntax-qry-select-like.md
##########
@@ -0,0 +1,113 @@
+---
+layout: global
+title: LIKE Predicate
+displayTitle: LIKE Predicate
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+A LIKE predicate is used to search for a specific pattern.
+
+### Syntax
+
+{% highlight sql %}
+[ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern }
+{% endhighlight %}
+
+### Parameters
+
+<dl>
+  <dt><code><em>search_pattern</em></code></dt>
+  <dd>
+    Specifies a string pattern to be searched by the <code>LIKE</code> clause. It can contain special pattern-matching characters:
+    <ul>
+      <li><code>%</code></li> matches zero or more characters.
+      <li><code>_</code></li> matches exactly one character.
+    </ul>
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>esc_char</em></code></dt>
+  <dd>
+    Specifies the escape character.

Review comment:
       Could you describe the default escape char?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619458822






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619452781






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] huaxingao commented on a change in pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28332:
URL: https://github.com/apache/spark/pull/28332#discussion_r415165624



##########
File path: docs/sql-ref-syntax-qry-select-like.md
##########
@@ -0,0 +1,113 @@
+---
+layout: global
+title: LIKE Predicate
+displayTitle: LIKE Predicate
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+A LIKE predicate is used to search for a specific pattern.
+
+### Syntax
+
+{% highlight sql %}
+[ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern }
+{% endhighlight %}
+
+### Parameters
+
+<dl>
+  <dt><code><em>search_pattern</em></code></dt>
+  <dd>
+    Specifies a string pattern to be searched by the <code>LIKE</code> clause. It can contain special pattern-matching characters:
+    <ul>
+      <li><code>%</code></li> matches zero or more characters.
+      <li><code>_</code></li> matches exactly one character.
+    </ul>
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>esc_char</em></code></dt>
+  <dd>
+    Specifies the escape character.
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>regex_pattern</em></code></dt>
+  <dd>
+    Specifies a regular expression search pattern to be searched by the <code>RLIKE</code> clause.
+  </dd>
+</dl>
+
+### Examples
+
+{% highlight sql %}
+CREATE TABLE person (id INT, name STRING, age INT);
+INSERT INTO person VALUES
+    (100, 'John', 30),
+    (200, 'Mary', NULL),
+    (300, 'Mike', 80),
+    (400, 'Dan',  50),
+    (500, 'Evan_w', 16);
+
+SELECT * FROM person WHERE name LIKE 'M%';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE 'M_ry';
++---+----+----+
+| id|name| age|
++---+----+----+
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name NOT LIKE 'M_ry';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
+|300|  Mike| 80|
+|100|  John| 30|
+|400|   Dan| 50|
++---+------+---+
+
+SELECT * FROM person WHERE name RLIKE '[MD]';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|400| Dan|  50|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE '%$_%' ESCAPE '$';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
++---+------+---+
+{% endhighlight %}
+
+### Related Statements
+
+ * [SELECT](sql-ref-syntax-qry-select.html)
+ * [WHERE Clause](sql-ref-syntax-qry-select-where.html)

Review comment:
       https://docs.oracle.com/cd/B13789_01/server.101/b10759/conditions016.htm
   https://docs.snowflake.com/en/sql-reference/functions/like.html




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] huaxingao commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
huaxingao commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-620923710


   Thanks! @maropu @srowen 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619457824


   **[Test build #121820 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121820/testReport)** for PR 28332 at commit [`c5cbabc`](https://github.com/apache/spark/commit/c5cbabc51d60317d588dcdb041845ed9a255c334).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619458777


   **[Test build #121820 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121820/testReport)** for PR 28332 at commit [`c5cbabc`](https://github.com/apache/spark/commit/c5cbabc51d60317d588dcdb041845ed9a255c334).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28332:
URL: https://github.com/apache/spark/pull/28332#discussion_r415163243



##########
File path: docs/sql-ref-syntax-qry-select-like.md
##########
@@ -0,0 +1,113 @@
+---
+layout: global
+title: LIKE Predicate
+displayTitle: LIKE Predicate
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+A LIKE predicate is used to search for a specific pattern.
+
+### Syntax
+
+{% highlight sql %}
+[ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern }
+{% endhighlight %}
+
+### Parameters
+
+<dl>
+  <dt><code><em>search_pattern</em></code></dt>
+  <dd>
+    Specifies a string pattern to be searched by the <code>LIKE</code> clause. It can contain special pattern-matching characters:
+    <ul>
+      <li><code>%</code></li> matches zero or more characters.
+      <li><code>_</code></li> matches exactly one character.
+    </ul>
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>esc_char</em></code></dt>
+  <dd>
+    Specifies the escape character.
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>regex_pattern</em></code></dt>
+  <dd>
+    Specifies a regular expression search pattern to be searched by the <code>RLIKE</code> clause.
+  </dd>
+</dl>
+
+### Examples
+
+{% highlight sql %}
+CREATE TABLE person (id INT, name STRING, age INT);
+INSERT INTO person VALUES
+    (100, 'John', 30),
+    (200, 'Mary', NULL),
+    (300, 'Mike', 80),
+    (400, 'Dan',  50),
+    (500, 'Evan_w', 16);
+
+SELECT * FROM person WHERE name LIKE 'M%';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE 'M_ry';
++---+----+----+
+| id|name| age|
++---+----+----+
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name NOT LIKE 'M_ry';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
+|300|  Mike| 80|
+|100|  John| 30|
+|400|   Dan| 50|
++---+------+---+
+
+SELECT * FROM person WHERE name RLIKE '[MD]';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|400| Dan|  50|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE '%$_%' ESCAPE '$';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
++---+------+---+
+{% endhighlight %}
+
+### Related Statements
+
+ * [SELECT](sql-ref-syntax-qry-select.html)
+ * [WHERE Clause](sql-ref-syntax-qry-select-where.html)

Review comment:
       You referred some existing documents in the other systems? For example, it seems PgSQL has a single page for patten-matching syntaxes. https://www.postgresql.org/docs/current/functions-matching.html




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] maropu commented on a change in pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
maropu commented on a change in pull request #28332:
URL: https://github.com/apache/spark/pull/28332#discussion_r414937193



##########
File path: docs/sql-ref-syntax-aux-show-databases.md
##########
@@ -29,16 +29,21 @@ and mean the same thing.
 ### Syntax
 
 {% highlight sql %}
-SHOW { DATABASES | SCHEMAS } [ LIKE string_pattern ]
+SHOW { DATABASES | SCHEMAS } [ LIKE regex_pattern ]
 {% endhighlight %}
 
 ### Parameters
 
 <dl>
-  <dt><code><em>LIKE string_pattern</em></code></dt>
+  <dt><code><em>regex_pattern</em></code></dt>
   <dd>
-    Specifies a string pattern that is used to match the databases in the system. In 
-    the specified string pattern <code>'*'</code> matches any number of characters.
+    Specifies a regular expression pattern that is used to limit the results of the

Review comment:
       nit: limit -> filter?

##########
File path: docs/sql-ref-syntax-aux-show-databases.md
##########
@@ -29,16 +29,21 @@ and mean the same thing.
 ### Syntax
 
 {% highlight sql %}
-SHOW { DATABASES | SCHEMAS } [ LIKE string_pattern ]
+SHOW { DATABASES | SCHEMAS } [ LIKE regex_pattern ]
 {% endhighlight %}
 
 ### Parameters
 
 <dl>
-  <dt><code><em>LIKE string_pattern</em></code></dt>
+  <dt><code><em>regex_pattern</em></code></dt>
   <dd>
-    Specifies a string pattern that is used to match the databases in the system. In 
-    the specified string pattern <code>'*'</code> matches any number of characters.
+    Specifies a regular expression pattern that is used to limit the results of the
+    statement.
+    <ul>
+      <li>Only <code>*</code> and <code>|</code> are allowed as wildcard pattern.</li>
+      <li>Excluding <code>*</code> and <code>|</code> the remaining pattern follows the regex semantics.</li>

Review comment:
       nit:
    - `Excluding <code>*</code> and <code>|</code> ` -> `Excluding <code>*</code> and <code>|</code>, `
    - `regex` -> `regular expression`

##########
File path: docs/sql-ref-syntax-qry-select-where.md
##########
@@ -69,6 +94,15 @@ SELECT * FROM person WHERE id = 200 OR id = 300 ORDER BY id;
   |300|Mike|  80|
   +---+----+----+
 
+-- `LIKE` in `WHERE` clause.
+SELECT * FROM person WHERE name LIKE 'M%';
+  +---+----+---+
+  | id|name|age|
+  +---+----+---+
+  |200|Mary|null|
+  |300|Mike| 80|
+  +---+----+---+

Review comment:
       nit: remove the leading spaces.

##########
File path: docs/sql-ref-syntax-aux-show-databases.md
##########
@@ -29,16 +29,21 @@ and mean the same thing.
 ### Syntax
 
 {% highlight sql %}
-SHOW { DATABASES | SCHEMAS } [ LIKE string_pattern ]
+SHOW { DATABASES | SCHEMAS } [ LIKE regex_pattern ]
 {% endhighlight %}
 
 ### Parameters
 
 <dl>
-  <dt><code><em>LIKE string_pattern</em></code></dt>
+  <dt><code><em>regex_pattern</em></code></dt>
   <dd>
-    Specifies a string pattern that is used to match the databases in the system. In 
-    the specified string pattern <code>'*'</code> matches any number of characters.
+    Specifies a regular expression pattern that is used to limit the results of the
+    statement.
+    <ul>
+      <li>Only <code>*</code> and <code>|</code> are allowed as wildcard pattern.</li>
+      <li>Excluding <code>*</code> and <code>|</code> the remaining pattern follows the regex semantics.</li>
+      <li>The leading and trailing blanks are trimmed in the input pattern before processing.</li>

Review comment:
       How about case sensitivity?

##########
File path: docs/sql-ref-syntax-qry-select-where.md
##########
@@ -69,6 +94,15 @@ SELECT * FROM person WHERE id = 200 OR id = 300 ORDER BY id;
   |300|Mike|  80|
   +---+----+----+
 
+-- `LIKE` in `WHERE` clause.
+SELECT * FROM person WHERE name LIKE 'M%';
+  +---+----+---+
+  | id|name|age|
+  +---+----+---+
+  |200|Mary|null|
+  |300|Mike| 80|
+  +---+----+---+

Review comment:
       Could you add a example for `LIKE ... ESCAPE...`, too?

##########
File path: docs/sql-ref-syntax-qry-select-where.md
##########
@@ -37,7 +37,32 @@ WHERE boolean_expression
   <dd>
     Specifies any expression that evaluates to a result type <code>boolean</code>. Two or
     more expressions may be combined together using the logical
-    operators ( <code>AND</code>, <code>OR</code> ).
+    operators ( <code>AND</code>, <code>OR</code> ). <br><br>
+    <b>Syntax:</b><br>
+      <code>
+        NOT boolean_expression | EXISTS ( query ) | column_name LIKE regex_pattern | value_expression |<br>
+        boolean_expression AND boolean_expression | boolean_expression OR boolean_expression

Review comment:
       Could you add `RLIKE` and `LIKE ... ESCAPE ... `?

##########
File path: docs/sql-ref-syntax-aux-show-views.md
##########
@@ -39,12 +39,12 @@ SHOW VIEWS [ { FROM | IN } database_name ] [ LIKE 'regex_pattern' ]
   <dd>
      Specifies the database name from which views are listed.
   </dd>
-  <dt><code><em>LIKE regex_pattern</em></code></dt>
+  <dt><code><em>regex_pattern</em></code></dt>
   <dd>
      Specifies the regular expression pattern that is used to filter out unwanted views. 
      <ul> 
-          <li> Except for `*` and `|` character, the pattern works like a regex.</li>
-          <li> `*` alone matches 0 or more characters and `|` is used to separate multiple different regexes,
+          <li> Except for <code>*</code> and <code>|</code> character, the pattern works like a regex.</li>

Review comment:
       nit: remove the space `<li>Except...`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] huaxingao commented on a change in pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28332:
URL: https://github.com/apache/spark/pull/28332#discussion_r415166246



##########
File path: docs/sql-ref-syntax-qry-select-like.md
##########
@@ -0,0 +1,113 @@
+---
+layout: global
+title: LIKE Predicate
+displayTitle: LIKE Predicate
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+A LIKE predicate is used to search for a specific pattern.
+
+### Syntax
+
+{% highlight sql %}
+[ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern }
+{% endhighlight %}
+
+### Parameters
+
+<dl>
+  <dt><code><em>search_pattern</em></code></dt>
+  <dd>
+    Specifies a string pattern to be searched by the <code>LIKE</code> clause. It can contain special pattern-matching characters:
+    <ul>
+      <li><code>%</code></li> matches zero or more characters.
+      <li><code>_</code></li> matches exactly one character.
+    </ul>
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>esc_char</em></code></dt>
+  <dd>
+    Specifies the escape character.
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>regex_pattern</em></code></dt>
+  <dd>
+    Specifies a regular expression search pattern to be searched by the <code>RLIKE</code> clause.
+  </dd>
+</dl>
+
+### Examples
+
+{% highlight sql %}
+CREATE TABLE person (id INT, name STRING, age INT);
+INSERT INTO person VALUES
+    (100, 'John', 30),
+    (200, 'Mary', NULL),
+    (300, 'Mike', 80),
+    (400, 'Dan',  50),
+    (500, 'Evan_w', 16);
+
+SELECT * FROM person WHERE name LIKE 'M%';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE 'M_ry';
++---+----+----+
+| id|name| age|
++---+----+----+
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name NOT LIKE 'M_ry';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
+|300|  Mike| 80|
+|100|  John| 30|
+|400|   Dan| 50|
++---+------+---+
+
+SELECT * FROM person WHERE name RLIKE '[MD]';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|400| Dan|  50|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE '%$_%' ESCAPE '$';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
++---+------+---+
+{% endhighlight %}
+
+### Related Statements
+
+ * [SELECT](sql-ref-syntax-qry-select.html)
+ * [WHERE Clause](sql-ref-syntax-qry-select-where.html)

Review comment:
       LIKE ALL and LIKE ANY can be added to this page too later. I don't want to include these two now because this PR is for 3.0.
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619277542


   **[Test build #121786 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121786/testReport)** for PR 28332 at commit [`89fc5d6`](https://github.com/apache/spark/commit/89fc5d6f30d15f833cbeb6f12b1bebacb77b38ee).
    * This patch passes all tests.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] huaxingao commented on a change in pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
huaxingao commented on a change in pull request #28332:
URL: https://github.com/apache/spark/pull/28332#discussion_r415173038



##########
File path: docs/sql-ref-syntax-qry-select-like.md
##########
@@ -0,0 +1,120 @@
+---
+layout: global
+title: LIKE Predicate
+displayTitle: LIKE Predicate
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+A LIKE predicate is used to search for a specific pattern.
+
+### Syntax
+
+{% highlight sql %}
+[ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern }
+{% endhighlight %}
+
+### Parameters
+
+<dl>
+  <dt><code><em>search_pattern</em></code></dt>
+  <dd>
+    Specifies a string pattern to be searched by the <code>LIKE</code> clause. It can contain special pattern-matching characters:
+    <ul>
+      <li><code>%</code></li> matches zero or more characters.
+      <li><code>_</code></li> matches exactly one character.
+    </ul>
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>esc_char</em></code></dt>
+  <dd>
+    Specifies the escape character. The default escape character is <code>\</code>.
+  </dd>
+</dl>
+<dl>
+  <dt><code><em>regex_pattern</em></code></dt>
+  <dd>
+    Specifies a regular expression search pattern to be searched by the <code>RLIKE</code> clause.
+  </dd>
+</dl>
+
+### Examples
+
+{% highlight sql %}
+CREATE TABLE person (id INT, name STRING, age INT);
+INSERT INTO person VALUES
+    (100, 'John', 30),
+    (200, 'Mary', NULL),
+    (300, 'Mike', 80),
+    (400, 'Dan',  50),
+    (500, 'Evan_w', 16);
+
+SELECT * FROM person WHERE name LIKE 'M%';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE 'M_ry';
++---+----+----+
+| id|name| age|
++---+----+----+
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name NOT LIKE 'M_ry';
++---+------+---+
+| id|  name|age|
++---+------+---+
+|500|Evan_W| 16|
+|300|  Mike| 80|
+|100|  John| 30|
+|400|   Dan| 50|
++---+------+---+
+
+SELECT * FROM person WHERE name RLIKE '[MD]';
++---+----+----+
+| id|name| age|
++---+----+----+
+|300|Mike|  80|
+|400| Dan|  50|
+|200|Mary|null|
++---+----+----+
+
+SELECT * FROM person WHERE name LIKE '%\_%';

Review comment:
       I am not sure to put ```%\_%``` or ```%\\_%```
   spark-sql takes one `\`
   while spark shell requires two `\`
   ```
   scala> sql("SELECT * FROM person WHERE name LIKE '%\_%'").show()
   <console>:1: error: invalid escape character
          sql("SELECT * FROM person WHERE name LIKE '%\_%'").show()
                                                       ^
   
   ```
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619451453


   **[Test build #121819 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121819/testReport)** for PR 28332 at commit [`488684b`](https://github.com/apache/spark/commit/488684b40bd850633445745c4207c9174317590c).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619452781






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619457945






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #28332: [SPARK-31556][SQL][DOCS] Document LIKE clause in SQL Reference

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #28332:
URL: https://github.com/apache/spark/pull/28332#issuecomment-619451453


   **[Test build #121819 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/121819/testReport)** for PR 28332 at commit [`488684b`](https://github.com/apache/spark/commit/488684b40bd850633445745c4207c9174317590c).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org