cloud-fan commented on a change in pull request #24742: [SPARK-27881][SQL]
Support CAST (... FORMAT <pattern>) expression
URL: https://github.com/apache/spark/pull/24742#discussion_r294174498
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
##########
@@ -197,19 +199,53 @@ object Cast {
* When cast from/to timezone related types, we need timeZoneId, which will be
resolved with
* session local timezone by an analyzer [[ResolveTimeZone]].
*/
+// scalastyle:off line.size.limit
@ExpressionDescription(
- usage = "_FUNC_(expr AS type) - Casts the value `expr` to the target data
type `type`.",
+ usage = "_FUNC_(expr AS type [FORMAT fmt]) - Casts the value `expr` to the
target data type `type`.",
examples = """
Examples:
> SELECT _FUNC_('10' as int);
10
+ > SELECT _FUNC_('2016 12 31' as date FORMAT 'yyyy MM dd');
+ 2016-12-31
""")
+// scalastyle:on line.size.limit
case class Cast(child: Expression, dataType: DataType, timeZoneId:
Option[String] = None)
Review comment:
If it's justified to add `timeZoneId` to `Cast`, I think it's also justified
to add a `format: Option[String]` parameter?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]