[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-08-03 Thread Xingcan Cui (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16568493#comment-16568493
 ] 

Xingcan Cui commented on FLINK-9915:


Fixed in 1.7.0: e4c9d97a69555072c4940007754cd8b12a339d82

> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
> Fix For: 1.7.0
>
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-08-03 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16568487#comment-16568487
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

asfgit closed pull request #6390: [FLINK-9915] [table] Add TO_BASE64 function 
for table/sql API
URL: https://github.com/apache/flink/pull/6390
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/dev/table/sql.md b/docs/dev/table/sql.md
index 366e3fdcc64..4d1b27b018d 100644
--- a/docs/dev/table/sql.md
+++ b/docs/dev/table/sql.md
@@ -1848,6 +1848,17 @@ FROM_BASE64(text string)
   
 Returns the base string decoded with base64, if text is NULL, 
returns NULL. E.g. FROM_BASE64('aGVsbG8gd29ybGQ=') returns 
hello world.
   
+  
+
+
+  
+{% highlight text %}
+TO_BASE64(string)
+{% endhighlight %}
+  
+  
+Returns the base64-encoded result of the input string. If the input 
is NULL, returns NULL. E.g. TO_BASE64('hello world') returns 
aGVsbG8gd29ybGQ=.
+  
 
 
   
diff --git a/docs/dev/table/tableApi.md b/docs/dev/table/tableApi.md
index 6e202f19d5d..367f6cf6e15 100644
--- a/docs/dev/table/tableApi.md
+++ b/docs/dev/table/tableApi.md
@@ -2474,6 +2474,7 @@ STRING.rpad(len INT, pad STRING)
 Returns a string right-padded with the given pad string to a length 
of len characters. If the string is longer than len, the return value is 
shortened to len characters. E.g. "hi".rpad(4, '??') returns "hi??",  
"hi".rpad(1, '??') returns "h".
   
 
+
 
   
 {% highlight java %}
@@ -2485,6 +2486,18 @@ STRING.fromBase64()
 Returns the base string decoded with base64, if string is null, 
returns null. E.g. "aGVsbG8gd29ybGQ=".fromBase64() returns "hello world".
   
 
+
+
+  
+{% highlight java %}
+STRING.toBase64()
+{% endhighlight %}
+  
+
+  
+Returns the base64-encoded result of STRING. If STRING is NULL, 
returns NULL. E.g. "hello world".toBase64() returns "aGVsbG8gd29ybGQ=".
+  
+
 
 
   
@@ -4025,6 +4038,18 @@ STRING.initCap()
   
 
 
+
+  
+{% highlight scala %}
+STRING.toBase64()
+{% endhighlight %}
+  
+
+  
+Returns the base64-encoded result of STRING. If STRING is NULL, 
returns NULL. E.g. "hello world".toBase64() returns "aGVsbG8gd29ybGQ=".
+  
+
+
   
 
 
diff --git 
a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala
 
b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala
index 35d2167848a..9e8acb1469e 100644
--- 
a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala
+++ 
b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala
@@ -549,6 +549,11 @@ trait ImplicitExpressionOperations {
 */
   def fromBase64() = FromBase64(expr)
 
+  /**
+* Returns the base64-encoded result of the input string.
+*/
+  def toBase64() = ToBase64(expr)
+
   // Temporal operations
 
   /**
diff --git 
a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/BuiltInMethods.scala
 
b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/BuiltInMethods.scala
index 0e0f709eabc..512ae7e8e28 100644
--- 
a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/BuiltInMethods.scala
+++ 
b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/BuiltInMethods.scala
@@ -114,4 +114,6 @@ object BuiltInMethods {
   val BIN = Types.lookupMethod(classOf[JLong], "toBinaryString", classOf[Long])
 
   val FROMBASE64 = Types.lookupMethod(classOf[ScalarFunctions], "fromBase64", 
classOf[String])
+
+  val TOBASE64 = Types.lookupMethod(classOf[ScalarFunctions], "toBase64", 
classOf[String])
 }
diff --git 
a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/FunctionGenerator.scala
 
b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/FunctionGenerator.scala
index a5c275ab415..57d32c6e6e1 100644
--- 
a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/FunctionGenerator.scala
+++ 
b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/FunctionGenerator.scala
@@ -152,6 +152,12 @@ object FunctionGenerator {
 STRING_TYPE_INFO,
 BuiltInMethods.FROMBASE64)
 
+  addSqlFunctionMethod(
+TO_BASE64,
+Seq(STRING_TYPE_INFO),
+STRING_TYPE_INFO,
+BuiltInMethods.TOBASE64)
+
   // 

[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-08-03 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16568293#comment-16568293
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

xccui commented on issue #6390: [FLINK-9915] [table] Add TO_BASE64 function for 
table/sql API
URL: https://github.com/apache/flink/pull/6390#issuecomment-410277153
 
 
   Thanks for the update @yanghua. I'll have a final check and merge this.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16559142#comment-16559142
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

xccui commented on issue #6390: [FLINK-9915] Add TO_BASE64 function for 
table/sql API
URL: https://github.com/apache/flink/pull/6390#issuecomment-408287972
 
 
   @twalthr, please take a look. Thanks.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558631#comment-16558631
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

yanghua commented on issue #6390: [FLINK-9915] Add TO_BASE64 function for 
table/sql API
URL: https://github.com/apache/flink/pull/6390#issuecomment-408169883
 
 
   @xccui thanks for your suggestion, fixed them~


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558607#comment-16558607
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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

 ##
 File path: docs/dev/table/tableApi.md
 ##
 @@ -2474,17 +2474,30 @@ STRING.rpad(len INT, pad STRING)
 Returns a string right-padded with the given pad string to a length 
of len characters. If the string is longer than len, the return value is 
shortened to len characters. E.g. "hi".rpad(4, '??') returns "hi??",  
"hi".rpad(1, '??') returns "h".
   
 
+
 
   
 {% highlight java %}
 STRING.fromBase64()
 {% endhighlight %}
   
-
+  
 
 Review comment:
   OK, it is because of rebasing, will take care.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558588#comment-16558588
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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_r205524441
 
 

 ##
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala
 ##
 @@ -549,6 +549,11 @@ trait ImplicitExpressionOperations {
 */
   def fromBase64() = FromBase64(expr)
 
+  /**
+* Returns a string's representation that encoded as base64.
 
 Review comment:
Returns the base64-encoded result of the input string.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558585#comment-16558585
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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_r205526614
 
 

 ##
 File path: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala
 ##
 @@ -472,6 +472,40 @@ class ScalarFunctionsTest extends ScalarTypesTestBase {
   "null")
   }
 
+  @Test
+  def testToBase64(): Unit = {
+testAllApis(
+  'f0.toBase64(),
+  "f0.toBase64()",
+  "TO_BASE64(f0)",
+  "VGhpcyBpcyBhIHRlc3QgU3RyaW5nLg==")
+
+testAllApis(
+  'f8.toBase64(),
+  "f8.toBase64()",
+  "TO_BASE64(f8)",
+  "IFRoaXMgaXMgYSB0ZXN0IFN0cmluZy4g")
+
+//null test
+testAllApis(
+  'f33.toBase64(),
+  "f33.toBase64()",
+  "TO_BASE64(f33)",
+  "null")
+
+testAllApis(
 
 Review comment:
   This is actually not a test case for null.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558580#comment-16558580
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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_r205522289
 
 

 ##
 File path: docs/dev/table/tableApi.md
 ##
 @@ -2474,17 +2474,30 @@ STRING.rpad(len INT, pad STRING)
 Returns a string right-padded with the given pad string to a length 
of len characters. If the string is longer than len, the return value is 
shortened to len characters. E.g. "hi".rpad(4, '??') returns "hi??",  
"hi".rpad(1, '??') returns "h".
   
 
+
 
   
 {% highlight java %}
 STRING.fromBase64()
 {% endhighlight %}
   
-
+  
 
 Review comment:
   Try to avoid meaningless updates like that.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558583#comment-16558583
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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_r205525765
 
 

 ##
 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.
 
 Review comment:
   Returns the base64-encoded result of the input string.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558589#comment-16558589
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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_r205525970
 
 

 ##
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/functions/ScalarFunctions.scala
 ##
 @@ -201,4 +201,9 @@ object ScalarFunctions {
 */
   def fromBase64(str: String): String = new String(Base64.decodeBase64(str))
 
+  /**
+* Returns a string's representation that encoded as base64.
 
 Review comment:
   Returns the base64-encoded result of the input string.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558579#comment-16558579
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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_r205522776
 
 

 ##
 File path: docs/dev/table/tableApi.md
 ##
 @@ -2474,17 +2474,30 @@ STRING.rpad(len INT, pad STRING)
 Returns a string right-padded with the given pad string to a length 
of len characters. If the string is longer than len, the return value is 
shortened to len characters. E.g. "hi".rpad(4, '??') returns "hi??",  
"hi".rpad(1, '??') returns "h".
   
 
+
 
   
 {% highlight java %}
 STRING.fromBase64()
 {% endhighlight %}
   
-
+  
   
 Returns the base string decoded with base64, if string is null, 
returns null. E.g. "aGVsbG8gd29ybGQ=".fromBase64() returns "hello world".
   
 
+
+
+  
+{% highlight java %}
+STRING.toBase64()
+{% endhighlight %}
+  
+
+  
+Returns the string text encoded with BASE64. E.g. "hello 
world".toBase64() returns "aGVsbG8gd29ybGQ=".
 
 Review comment:
   Returns the base64-encoded result of STRING. If STRING is NULL, returns NULL.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558587#comment-16558587
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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_r205526999
 
 

 ##
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/sql/ScalarSqlFunctions.scala
 ##
 @@ -177,4 +177,13 @@ object ScalarSqlFunctions {
 SqlFunctionCategory.STRING
   )
 
+  val TO_BASE64 = new SqlFunction(
+"TO_BASE64",
+SqlKind.OTHER_FUNCTION,
+ReturnTypes.cascade(ReturnTypes.explicit(SqlTypeName.VARCHAR), 
SqlTypeTransforms.TO_NULLABLE),
+InferTypes.RETURN_TYPE,
+OperandTypes.family(SqlTypeFamily.STRING),
 
 Review comment:
   Can directly use `OperandTypes.STRING` here.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558584#comment-16558584
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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_r205524074
 
 

 ##
 File path: docs/dev/table/tableApi.md
 ##
 @@ -2474,17 +2474,30 @@ STRING.rpad(len INT, pad STRING)
 Returns a string right-padded with the given pad string to a length 
of len characters. If the string is longer than len, the return value is 
shortened to len characters. E.g. "hi".rpad(4, '??') returns "hi??",  
"hi".rpad(1, '??') returns "h".
   
 
+
 
   
 {% highlight java %}
 STRING.fromBase64()
 {% endhighlight %}
   
-
+  
   
 Returns the base string decoded with base64, if string is null, 
returns null. E.g. "aGVsbG8gd29ybGQ=".fromBase64() returns "hello world".
   
 
+
+
+  
+{% highlight java %}
 
 Review comment:
   Add the corresponding docs for scala.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558582#comment-16558582
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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_r205523208
 
 

 ##
 File path: docs/dev/table/sql.md
 ##
 @@ -1848,6 +1848,17 @@ FROM_BASE64(text string)
   
 Returns the base string decoded with base64, if text is NULL, 
returns NULL. E.g. FROM_BASE64('aGVsbG8gd29ybGQ=') returns 
hello world.
   
+  
+
+
+  
+{% highlight text %}
+TO_BASE64(text string)
+{% endhighlight %}
+  
+  
+Returns the string text encoded with BASE64, if string is null, 
returns null. E.g. TO_BASE64('hello world') returns 
aGVsbG8gd29ybGQ=.
 
 Review comment:
   Returns the base64-encoded result of the input string. If the input is NULL, 
returns NULL.


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558581#comment-16558581
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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_r205522908
 
 

 ##
 File path: docs/dev/table/sql.md
 ##
 @@ -1848,6 +1848,17 @@ FROM_BASE64(text string)
   
 Returns the base string decoded with base64, if text is NULL, 
returns NULL. E.g. FROM_BASE64('aGVsbG8gd29ybGQ=') returns 
hello world.
   
+  
+
+
+  
+{% highlight text %}
+TO_BASE64(text string)
 
 Review comment:
   TO_BASE64(string)


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558586#comment-16558586
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558234#comment-16558234
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

yanghua commented on issue #6390: [FLINK-9915] Add TO_BASE64 function for 
table/sql API
URL: https://github.com/apache/flink/pull/6390#issuecomment-408075718
 
 
   @xccui rebased~


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16558139#comment-16558139
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

xccui commented on issue #6390: [FLINK-9915] Add TO_BASE64 function for 
table/sql API
URL: https://github.com/apache/flink/pull/6390#issuecomment-408052278
 
 
   Hi @yanghua, I wonder if you could rebase the PR and apply the changes 
mentioned in former PRs. Thanks!


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-26 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16556949#comment-16556949
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

yanghua commented on issue #6390: [FLINK-9915] Add TO_BASE64 function for 
table/sql API
URL: https://github.com/apache/flink/pull/6390#issuecomment-407987453
 
 
   @xccui  can you review `TO_BASE64` function?


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:
us...@infra.apache.org


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16552729#comment-16552729
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

Github user yanghua commented on the issue:

https://github.com/apache/flink/pull/6390
  
cc @twalthr @hequn8128 @fhueske 


> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-23 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16552573#comment-16552573
 ] 

ASF GitHub Bot commented on FLINK-9915:
---

GitHub user yanghua opened a pull request:

https://github.com/apache/flink/pull/6390

[FLINK-9915] Add TO_BASE64 function for table/sql API

## What is the purpose of the change

*This pull request add TO_BASE64 function for table/sql API*

## Brief change log

  - *Add TO_BASE64 function for table/sql API*

## Verifying this change

This change added tests and can be verified as follows:

  - *ScalarFunctionsTest#testToBase64*

## Does this pull request potentially affect one of the following parts:

  - Dependencies (does it add or upgrade a dependency): (yes / **no**)
  - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (yes / **no**)
  - The serializers: (yes / **no** / don't know)
  - The runtime per-record code paths (performance sensitive): (yes / 
**no** / don't know)
  - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
  - The S3 file system connector: (yes / **no** / don't know)

## Documentation

  - Does this pull request introduce a new feature? (**yes** / no)
  - If yes, how is the feature documented? (not applicable / **docs** / 
JavaDocs / not documented)


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/yanghua/flink FLINK-9915

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/flink/pull/6390.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #6390






> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>  Labels: pull-request-available
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (FLINK-9915) Add TO_BASE64 function for table/sql API

2018-07-23 Thread Weike Dong (JIRA)


[ 
https://issues.apache.org/jira/browse/FLINK-9915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16552446#comment-16552446
 ] 

Weike Dong commented on FLINK-9915:
---

Hi vino,

I strongly support this feature, as the built-in functions in Flink Table / SQL 
are relatively small in number, lacking in many useful transformation functions 
for strings. However, many users with experiences of Hive SQL would prefer the 
Hive SQL style function name like "BASE64" or "UNBASE64", therefore the naming 
of the function could be discussed. Also for the type of the parameter for 
TO_BASE64, whether a binary array could be accepted or only a string is 
acceptable is another point to be considered.

But anyway, +1 for the feature : )

> Add TO_BASE64 function for table/sql API
> 
>
> Key: FLINK-9915
> URL: https://issues.apache.org/jira/browse/FLINK-9915
> Project: Flink
>  Issue Type: New Feature
>  Components: Table API  SQL
>Reporter: vinoyang
>Assignee: vinoyang
>Priority: Minor
>
> refer to mysql TO_BASE64 function : 
> https://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)