MaxGekk commented on code in PR #51575:
URL: https://github.com/apache/spark/pull/51575#discussion_r2221910400


##########
sql/api/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -5683,6 +5683,32 @@ object functions {
   def unix_timestamp(s: Column, p: String): Column =
     Column.fn("unix_timestamp", s, lit(p))
 
+  /**
+   * Parses a string value to a time value. If the input is malformed, raises 
an error.
+   *
+   * @param str
+   *   string to be parsed to time
+   * @group datetime_funcs
+   * @since 4.1.0
+   */
+  def to_time(str: Column): Column = {
+    Column.fn("to_time", str)
+  }
+
+  /**
+   * Parses a string value to a time value. If the input is malformed, raises 
an error.
+   *
+   * @param str
+   *   string to be parsed to time

Review Comment:
   ```suggestion
      *   A string to be parsed to time
   ```



##########
sql/api/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -5683,6 +5683,32 @@ object functions {
   def unix_timestamp(s: Column, p: String): Column =
     Column.fn("unix_timestamp", s, lit(p))
 
+  /**
+   * Parses a string value to a time value. If the input is malformed, raises 
an error.
+   *
+   * @param str
+   *   string to be parsed to time

Review Comment:
   ```suggestion
      *   A string to be parsed to time
   ```



##########
python/pyspark/sql/tests/test_functions.py:
##########
@@ -81,7 +81,12 @@ def test_function_parity(self):
         missing_in_py = jvm_fn_set.difference(py_fn_set)
 
         # Functions that we expect to be missing in python until they are 
added to pyspark
-        expected_missing_in_py = set()
+        expected_missing_in_py = set(
+            [
+                "to_time",  # TODO(SPARK-52890): @uros-db is addressing this 
separately.
+                "try_to_time",  # TODO(SPARK-52891): @uros-db is addressing 
this separately.

Review Comment:
   ```suggestion
                   # TODO(SPARK-52890): Implement the to_time function in Python
                   "to_time",
                   # TODO(SPARK-52891): Implement the try_to_time function in 
Python
                   "try_to_time",
   ```



##########
sql/api/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -5683,6 +5683,32 @@ object functions {
   def unix_timestamp(s: Column, p: String): Column =
     Column.fn("unix_timestamp", s, lit(p))
 
+  /**
+   * Parses a string value to a time value. If the input is malformed, raises 
an error.
+   *
+   * @param str
+   *   string to be parsed to time
+   * @group datetime_funcs
+   * @since 4.1.0
+   */
+  def to_time(str: Column): Column = {
+    Column.fn("to_time", str)
+  }
+
+  /**
+   * Parses a string value to a time value. If the input is malformed, raises 
an error.
+   *
+   * @param str
+   *   string to be parsed to time
+   * @param format
+   *   time format pattern to follow

Review Comment:
   Could you refer to doc page with patterns, please.



##########
sql/api/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -5683,6 +5683,32 @@ object functions {
   def unix_timestamp(s: Column, p: String): Column =
     Column.fn("unix_timestamp", s, lit(p))
 
+  /**
+   * Parses a string value to a time value. If the input is malformed, raises 
an error.

Review Comment:
   Could you move `If the input is malformed, raises an error.` under the 
`@return`. See to_timestamp and to_date



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to