-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-32193][SQL][DOCS] Update regexp usage in SQL docs #29009
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
Conversation
update masterbranch
|
I think you don't need to file jira for this kind of minor doc fixes. Btw, any other systems supporting |
docs/sql-migration-guide.md
Outdated
| * `ACOS(n)` If n < -1 or n > 1, Hive returns null, Spark SQL returns NaN. | ||
| * `ASIN(n)` If n < -1 or n > 1, Hive returns null, Spark SQL returns NaN. | ||
| * `CAST(n AS TIMESTAMP)` If n is integral numbers, Hive treats n as milliseconds, Spark SQL treats n as seconds. | ||
| * `REGEXP(str, patten)` Hive support this function, Spark SQL use RLIKE instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: support -> supports and use -> uses
|
cc: @HyukjinKwon |
So far as i know ,mysql and hive support this key word .But i think a alias name seems a good idea. |
|
Thanks @maropu. @GuoPhilipse, does MySQL also supports From reading the doc in Hive at https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF, it's same as Rlike which Spark supports. Maybe we should alias it. FWIW, there are many unsupported expressions explicitly: spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveSessionCatalog.scala Lines 189 to 192 in 5d870ef
|
docs/sql-migration-guide.md
Outdated
| * `ACOS(n)` If n < -1 or n > 1, Hive returns null, Spark SQL returns NaN. | ||
| * `ASIN(n)` If n < -1 or n > 1, Hive returns null, Spark SQL returns NaN. | ||
| * `CAST(n AS TIMESTAMP)` If n is integral numbers, Hive treats n as milliseconds, Spark SQL treats n as seconds. | ||
| * `REGEXP(str, patten)` Hive support this function, Spark SQL use RLIKE instead. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, technically this isn's in "the scenarios in which Hive and Spark generate different results".
yes, i posted the REGEXP usage in mysql last comment. |
|
No, @GuoPhilipse, I meant if it's supported in |
|
I get a bit confiused and Hive really supports REGEX as a function? |
|
I tried in hive 1.1, and it works. seems hive is incompatible for old version //RLIKE
//REGEXP
|
|
Yea, I checked the doc @HyukjinKwon put above, and it seems the current hive only supports |
|
|
||
| ```sql | ||
| [ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern } | ||
| [ NOT ] { LIKE search_pattern [ ESCAPE esc_char ] | RLIKE regex_pattern | REGEXP regex_pattern} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ RLIKE | REGEXP ] regex_pattern cc: @huaxingao
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its okay for this PR to just update this doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have updated and added examples for this usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, this reminded me that there are still missing keywords in the SQL docs: https://issues.apache.org/jira/browse/SPARK-31753
Its very helpful if you take this over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am glad to take this over,will work on it later :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! That's very helpful.
docs/sql-migration-guide.md
Outdated
|
|
||
| - In Spark 3.1, `from_unixtime`, `unix_timestamp`,`to_unix_timestamp`, `to_timestamp` and `to_date` will fail if the specified datetime pattern is invalid. In Spark 3.0 or earlier, they result `NULL`. | ||
|
|
||
| - In Spark 3.1, we can use regexp function, it is the alias of rlike funtion, which functions the same with rike funtion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this.
| expression[StringReplace]("replace"), | ||
| expression[Overlay]("overlay"), | ||
| expression[RLike]("rlike"), | ||
| expression[RLike]("regexp", true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need this? It seems hive and mysql doesn't support this though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, let me will remove the function usage
|
ok to test |
|
Test build #125427 has finished for PR 29009 at commit
|
HyukjinKwon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay but let me leave it to @maropu
### What changes were proposed in this pull request? update REGEXP usage and examples in sql-ref-syntx-qry-select-like.cmd ### Why are the changes needed? make the usage of REGEXP known to more users ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? No tests Closes #29009 from GuoPhilipse/update-migrate-guide. Lead-authored-by: GuoPhilipse <[email protected]> Co-authored-by: GuoPhilipse <[email protected]> Signed-off-by: Takeshi Yamamuro <[email protected]> (cherry picked from commit 09cc6c5) Signed-off-by: Takeshi Yamamuro <[email protected]>
|
Thanks! Merged to master/3.0. |
What changes were proposed in this pull request?
update REGEXP usage and examples in sql-ref-syntx-qry-select-like.cmd
Why are the changes needed?
make the usage of REGEXP known to more users
Does this PR introduce any user-facing change?
No
How was this patch tested?
No tests