beliefer commented on code in PR #41516:
URL: https://github.com/apache/spark/pull/41516#discussion_r1223802759


##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -2961,6 +2993,14 @@ object functions {
       allowDifferentLgConfigK: Boolean): Column =
     hll_union(Column(columnName1), Column(columnName2), 
allowDifferentLgConfigK)
 
+  /**
+   * Returns the user name of current execution context.
+   *
+   * @group misc_funcs
+   * @since 3.5.0
+   */
+  def user(): Column = current_user()

Review Comment:
   ditto.



##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -2807,6 +2807,38 @@ object functions {
   // Misc functions
   
//////////////////////////////////////////////////////////////////////////////////////////////
 
+  /**
+   * Returns the current catalog.
+   *
+   * @group misc_funcs
+   * @since 3.5.0
+   */
+  def current_catalog(): Column = Column.fn("current_catalog")
+
+  /**
+   * Returns the current database.
+   *
+   * @group misc_funcs
+   * @since 3.5.0
+   */
+  def current_database(): Column = Column.fn("current_database")
+
+  /**
+   * Returns the current schema.
+   *
+   * @group misc_funcs
+   * @since 3.5.0
+   */
+  def current_schema(): Column = current_database()

Review Comment:
   I'm afraid. If the current_schema have the different output from 
current_database in future(means current_schema doesn't reuse CurrentDatabase 
and create a new expression CurrentSchema), the behavior will not change. 
Personally, I think `Column.fn("current_schema")` is better.



##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -3429,6 +3469,15 @@ object functions {
   def add_months(startDate: Column, numMonths: Column): Column =
     Column.fn("add_months", startDate, numMonths)
 
+  /**
+   * Returns the current date at the start of query evaluation as a date 
column. All calls of
+   * current_date within the same query return the same value.
+   *
+   * @group datetime_funcs
+   * @since 3.5.0
+   */
+  def curdate(): Column = current_date()

Review Comment:
   ditto.



##########
python/pyspark/sql/connect/functions.py:
##########
@@ -2623,6 +2632,33 @@ def hours(col: "ColumnOrName") -> Column:
 # Misc Functions
 
 
+def current_catalog() -> Column:
+    return _invoke_function("current_catalog")
+
+
+current_catalog.__doc__ = pysparkfuncs.current_catalog.__doc__
+
+
+def current_database() -> Column:
+    return _invoke_function("current_database")
+
+
+current_database.__doc__ = pysparkfuncs.current_database.__doc__
+
+
+current_schema = current_database
+
+
+def current_user() -> Column:
+    return _invoke_function("current_user")
+
+
+current_user.__doc__ = pysparkfuncs.current_user.__doc__
+
+
+user = current_user

Review Comment:
   ditto.



##########
python/pyspark/sql/connect/functions.py:
##########
@@ -2157,6 +2157,8 @@ def current_date() -> Column:
 
 current_date.__doc__ = pysparkfuncs.current_date.__doc__
 
+curdate = current_date

Review Comment:
   ditto.



##########
python/pyspark/sql/functions.py:
##########
@@ -4868,6 +4868,35 @@ def current_date() -> Column:
     return _invoke_function("current_date")
 
 
+curdate = current_date

Review Comment:
   ditto.



##########
python/pyspark/sql/connect/functions.py:
##########
@@ -2623,6 +2632,33 @@ def hours(col: "ColumnOrName") -> Column:
 # Misc Functions
 
 
+def current_catalog() -> Column:
+    return _invoke_function("current_catalog")
+
+
+current_catalog.__doc__ = pysparkfuncs.current_catalog.__doc__
+
+
+def current_database() -> Column:
+    return _invoke_function("current_database")
+
+
+current_database.__doc__ = pysparkfuncs.current_database.__doc__
+
+
+current_schema = current_database

Review Comment:
   ditto.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to