Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/18447#discussion_r212820670
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala
---
@@ -98,6 +98,29 @@ case class AssertTrue(child: Expression) extends
UnaryExpression with ImplicitCa
override def sql: String = s"assert_true(${child.sql})"
}
+@ExpressionDescription(
+ usage = "_FUNC_(expr) - Returns the data type of the `expr`.",
+ extended = """
+ Examples:
+ > SELECT _FUNC_("a");
+ string
+ > SELECT _FUNC_(OL);
+ bigint
+ """)
+case class GetDataType(child: Expression) extends UnaryExpression {
+
+ override def dataType: DataType = StringType
+
+ override def nullSafeEval(input: Any): Any =
UTF8String.fromString(child.dataType.simpleString)
--- End diff --
It should be `catalogString` instead of `simpleString`.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]