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/25 01:02:17 UTC

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

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