This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 8cd095f297c8 [SPARK-48738][SQL] Correct since version for built-in 
func alias `random`, `position`, `mod`, `cardinality`, `current_schema`, 
`user`, `session_user`,`char_length`,`character_length`
8cd095f297c8 is described below

commit 8cd095f297c8b0274750e853d5295efb2f29368f
Author: Wei Guo <[email protected]>
AuthorDate: Fri Jun 28 11:02:29 2024 +0900

    [SPARK-48738][SQL] Correct since version for built-in func alias `random`, 
`position`, `mod`, `cardinality`, `current_schema`, `user`, 
`session_user`,`char_length`,`character_length`
    
    ### What changes were proposed in this pull request?
    
    This PR aims to correct since version for built-in method alias `random`, 
`position`, `mod`, `cardinality`, `current_schema`, `user` and `session_user`.
    
    - https://issues.apache.org/jira/browse/SPARK-28086  random 3.0.0 (rand 
1.5.0)
    
    - https://issues.apache.org/jira/browse/SPARK-20754 position 2.3.0 (locate 
1.5.0)
    
    - https://issues.apache.org/jira/browse/SPARK-20754 mod 2.3.0 (% 1.0.0)
    
    - https://issues.apache.org/jira/browse/SPARK-23923 cardinality 2.4.0  
(size 1.5.0)
    
    - https://issues.apache.org/jira/browse/SPARK-41323 current_schema  3.4.0  
(current_database 1.6.0)
    
    - https://issues.apache.org/jira/browse/SPARK-39138 user 3.4.0 
(current_user 3.2.0)
    
    - https://issues.apache.org/jira/browse/SPARK-44860 session_user 4.0.0  
(current_user 3.20)
    
    - https://issues.apache.org/jira/browse/SPARK-20749 char_length 2.3.0 (len 
1.5.0)
    
    - https://issues.apache.org/jira/browse/SPARK-20749 character_length 2.3.0 
(len 1.5.0)
    
    ### Why are the changes needed?
    
    The default since version of those method alias is wrong.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    - Pass GA
    - Make a  check by creating docs manually: `./build/mvn -DskipTests clean 
package & cd sql & sh create-docs.sh`
    
    Take `current_schema` as an example:
    
    **Before: the official website**
    <img width="737" alt="image" 
src="https://github.com/apache/spark/assets/16032294/b235a455-1b78-4010-92ba-5e5ca427399b";>
    **After: my local site**
    <img width="765" alt="image" 
src="https://github.com/apache/spark/assets/16032294/bfadb479-82fe-4916-805a-1590ad0dc171";>
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #47125 from wayneguow/update_since.
    
    Authored-by: Wei Guo <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 .../spark/sql/catalyst/analysis/FunctionRegistry.scala | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
index cd113cc1b34c..8a5a32c173bb 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala
@@ -381,7 +381,7 @@ object FunctionRegistry {
     expression[PosExplode]("posexplode"),
     expressionGeneratorOuter[PosExplode]("posexplode_outer"),
     expression[Rand]("rand"),
-    expression[Rand]("random", true),
+    expression[Rand]("random", true, Some("3.0.0")),
     expression[Randn]("randn"),
     expression[Stack]("stack"),
     expression[CaseWhen]("when"),
@@ -416,7 +416,7 @@ object FunctionRegistry {
     expression[Log1p]("log1p"),
     expression[Log2]("log2"),
     expression[Log]("ln"),
-    expression[Remainder]("mod", true),
+    expression[Remainder]("mod", true, Some("2.3.0")),
     expression[UnaryMinus]("negative", true),
     expression[Pi]("pi"),
     expression[Pmod]("pmod"),
@@ -530,8 +530,8 @@ object FunctionRegistry {
     expressionBuilder("endswith", EndsWithExpressionBuilder),
     expression[Base64]("base64"),
     expression[BitLength]("bit_length"),
-    expression[Length]("char_length", true),
-    expression[Length]("character_length", true),
+    expression[Length]("char_length", true, Some("2.3.0")),
+    expression[Length]("character_length", true, Some("2.3.0")),
     expression[ConcatWs]("concat_ws"),
     expression[Decode]("decode"),
     expression[Elt]("elt"),
@@ -559,7 +559,7 @@ object FunctionRegistry {
     expressionBuilder("lpad", LPadExpressionBuilder),
     expression[StringTrimLeft]("ltrim"),
     expression[JsonTuple]("json_tuple"),
-    expression[StringLocate]("position", true),
+    expression[StringLocate]("position", true, Some("2.3.0")),
     expression[FormatString]("printf", true),
     expression[RegExpExtract]("regexp_extract"),
     expression[RegExpExtractAll]("regexp_extract_all"),
@@ -705,7 +705,7 @@ object FunctionRegistry {
     expression[MapConcat]("map_concat"),
     expression[Size]("size"),
     expression[Slice]("slice"),
-    expression[Size]("cardinality", true),
+    expression[Size]("cardinality", true, Some("2.4.0")),
     expression[ArraysZip]("arrays_zip"),
     expression[SortArray]("sort_array"),
     expression[Shuffle]("shuffle"),
@@ -754,11 +754,11 @@ object FunctionRegistry {
     expression[InputFileBlockLength]("input_file_block_length"),
     expression[MonotonicallyIncreasingID]("monotonically_increasing_id"),
     expression[CurrentDatabase]("current_database"),
-    expression[CurrentDatabase]("current_schema", true),
+    expression[CurrentDatabase]("current_schema", true, Some("3.4.0")),
     expression[CurrentCatalog]("current_catalog"),
     expression[CurrentUser]("current_user"),
-    expression[CurrentUser]("user", setAlias = true),
-    expression[CurrentUser]("session_user", setAlias = true),
+    expression[CurrentUser]("user", true, Some("3.4.0")),
+    expression[CurrentUser]("session_user", true, Some("4.0.0")),
     expression[CallMethodViaReflection]("reflect"),
     expression[CallMethodViaReflection]("java_method", true),
     expression[SparkVersion]("version"),


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to