xccui commented on a change in pull request #6390: [FLINK-9915] Add TO_BASE64
function for table/sql API
URL: https://github.com/apache/flink/pull/6390#discussion_r205524700
##########
File path:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/stringExpressions.scala
##########
@@ -382,4 +382,32 @@ case class FromBase64(child: Expression) extends
UnaryExpression with InputTypeS
}
override def toString: String = s"($child).fromBase64"
+
+}
+
+/**
+ * Returns the string encoded with base64.
+ * Returns NULL If the input string is NULL.
+ */
+case class ToBase64(child: Expression) extends UnaryExpression with
InputTypeSpec {
+
+ override private[flink] def expectedTypes: Seq[TypeInformation[_]] =
Seq(STRING_TYPE_INFO)
+
+ override private[flink] def resultType: TypeInformation[_] = STRING_TYPE_INFO
+
+ override private[flink] def validateInput(): ValidationResult = {
+ if (child.resultType == STRING_TYPE_INFO) {
+ ValidationSuccess
+ } else {
+ ValidationFailure(s"ToBase64 operator requires String input, " +
Review comment:
ToBase64 operator requires **a** String input
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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