dtenedor commented on code in PR #36365:
URL: https://github.com/apache/spark/pull/36365#discussion_r868397971


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/numberFormatExpressions.scala:
##########
@@ -168,3 +168,157 @@ case class TryToNumber(left: Expression, right: 
Expression)
       newRight: Expression): TryToNumber =
     copy(left = newLeft, right = newRight)
 }
+
+/**
+ * A function that converts decimal values to strings, returning NULL if the 
decimal value fails to
+ * match the format string.
+ */
+@ExpressionDescription(
+  usage = """
+    _FUNC_(numberExpr, formatExpr) - Convert `numberExpr` to a string based on 
the `formatExpr`.
+      Throws an exception if the conversion fails. The format can consist of 
the following
+      characters, case insensitive:
+        '0' or '9': Specifies an expected digit between 0 and 9. A sequence of 
0 or 9 in the format
+          string matches a sequence of digits in the input value, generating a 
result string of the
+          same length as the corresponding sequence in the format string. The 
result string is
+          left-padded with zeros if the 0/9 sequence comprises more digits 
than the matching part of
+          the decimal value, starts with 0, and is before the decimal point.
+        '.' or 'D': Specifies the position of the decimal point (optional, 
only allowed once).
+        ',' or 'G': Specifies the position of the grouping (thousands) 
separator (,). There must be
+          a 0 or 9 to the left and right of each grouping separator.
+        '$': Specifies the location of the $ currency sign. This character may 
only be specified
+          once.
+        'S' or 'MI': Specifies the position of a '-' or '+' sign (optional, 
only allowed once at
+          the beginning or end of the format string). Note that 'S' allows '-' 
but 'MI' does not.
+        'PR': Only allowed at the end of the format string; specifies that 
'expr' indicates a

Review Comment:
   Done.



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