Skip to content

Commit 3d084fe

Browse files
committed
[SPARK-39677][SQL][DOCS][3.2] Fix args formatting of the regexp and like functions
### What changes were proposed in this pull request? In the PR, I propose to fix args formatting of some regexp functions by adding explicit new lines. That fixes the following items in arg lists. Before: <img width="745" alt="Screenshot 2022-07-05 at 09 48 28" src="https://user-images.githubusercontent.com/1580697/177274234-04209d43-a542-4c71-b5ca-6f3239208015.png"> After: <img width="704" alt="Screenshot 2022-07-05 at 11 06 13" src="https://user-images.githubusercontent.com/1580697/177280718-cb05184c-8559-4461-b94d-dfaaafda7dd2.png"> ### Why are the changes needed? To improve readability of Spark SQL docs. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? By building docs and checking manually: ``` $ SKIP_SCALADOC=1 SKIP_PYTHONDOC=1 SKIP_RDOC=1 bundle exec jekyll build ``` Authored-by: Max Gekk <max.gekkgmail.com> Signed-off-by: Max Gekk <max.gekkgmail.com> (cherry picked from commit 4e42f8b) Signed-off-by: Max Gekk <max.gekkgmail.com> Closes #37093 from MaxGekk/fix-regexp-docs-3.2. Authored-by: Max Gekk <[email protected]> Signed-off-by: Max Gekk <[email protected]>
1 parent 6ae97e2 commit 3d084fe

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,12 @@ abstract class StringRegexExpression extends BinaryExpression
8383
Arguments:
8484
* str - a string expression
8585
* pattern - a string expression. The pattern is a string which is matched literally, with
86-
exception to the following special symbols:
87-
88-
_ matches any one character in the input (similar to . in posix regular expressions)
89-
86+
exception to the following special symbols:<br><br>
87+
_ matches any one character in the input (similar to . in posix regular expressions)\
9088
% matches zero or more characters in the input (similar to .* in posix regular
91-
expressions)
92-
89+
expressions)<br><br>
9390
Since Spark 2.0, string literals are unescaped in our SQL parser. For example, in order
94-
to match "\abc", the pattern should be "\\abc".
95-
91+
to match "\abc", the pattern should be "\\abc".<br><br>
9692
When SQL config 'spark.sql.parser.escapedStringLiterals' is enabled, it falls back
9793
to Spark 1.6 behavior regarding string literal parsing. For example, if the config is
9894
enabled, the pattern to match "\abc" should be "\abc".
@@ -352,12 +348,10 @@ case class NotLikeAny(child: Expression, patterns: Seq[UTF8String]) extends Like
352348
arguments = """
353349
Arguments:
354350
* str - a string expression
355-
* regexp - a string expression. The regex string should be a Java regular expression.
356-
351+
* regexp - a string expression. The regex string should be a Java regular expression.<br><br>
357352
Since Spark 2.0, string literals (including regex patterns) are unescaped in our SQL
358353
parser. For example, to match "\abc", a regular expression for `regexp` can be
359-
"^\\abc$".
360-
354+
"^\\abc$".<br><br>
361355
There is a SQL config 'spark.sql.parser.escapedStringLiterals' that can be used to
362356
fallback to the Spark 1.6 behavior regarding string literal parsing. For example,
363357
if the config is enabled, the `regexp` that can match "\abc" is "^\abc$".
@@ -505,12 +499,10 @@ case class StringSplit(str: Expression, regex: Expression, limit: Expression)
505499
Arguments:
506500
* str - a string expression to search for a regular expression pattern match.
507501
* regexp - a string representing a regular expression. The regex string should be a
508-
Java regular expression.
509-
502+
Java regular expression.<br><br>
510503
Since Spark 2.0, string literals (including regex patterns) are unescaped in our SQL
511504
parser. For example, to match "\abc", a regular expression for `regexp` can be
512-
"^\\abc$".
513-
505+
"^\\abc$".<br><br>
514506
There is a SQL config 'spark.sql.parser.escapedStringLiterals' that can be used to
515507
fallback to the Spark 1.6 behavior regarding string literal parsing. For example,
516508
if the config is enabled, the `regexp` that can match "\abc" is "^\abc$".
@@ -707,12 +699,10 @@ abstract class RegExpExtractBase
707699
Arguments:
708700
* str - a string expression.
709701
* regexp - a string representing a regular expression. The regex string should be a
710-
Java regular expression.
711-
702+
Java regular expression.<br><br>
712703
Since Spark 2.0, string literals (including regex patterns) are unescaped in our SQL
713704
parser. For example, to match "\abc", a regular expression for `regexp` can be
714-
"^\\abc$".
715-
705+
"^\\abc$".<br><br>
716706
There is a SQL config 'spark.sql.parser.escapedStringLiterals' that can be used to
717707
fallback to the Spark 1.6 behavior regarding string literal parsing. For example,
718708
if the config is enabled, the `regexp` that can match "\abc" is "^\abc$".
@@ -812,12 +802,10 @@ case class RegExpExtract(subject: Expression, regexp: Expression, idx: Expressio
812802
Arguments:
813803
* str - a string expression.
814804
* regexp - a string representing a regular expression. The regex string should be a
815-
Java regular expression.
816-
805+
Java regular expression.<br><br>
817806
Since Spark 2.0, string literals (including regex patterns) are unescaped in our SQL
818807
parser. For example, to match "\abc", a regular expression for `regexp` can be
819-
"^\\abc$".
820-
808+
"^\\abc$".<br><br>
821809
There is a SQL config 'spark.sql.parser.escapedStringLiterals' that can be used to
822810
fallback to the Spark 1.6 behavior regarding string literal parsing. For example,
823811
if the config is enabled, the `regexp` that can match "\abc" is "^\abc$".

0 commit comments

Comments
 (0)