You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by xueyumusic <gi...@git.apache.org> on 2018/07/15 13:33:20 UTC
[GitHub] flink pull request #6337: [FLINK-9853][Tabel API & SQL] add HEX support
GitHub user xueyumusic opened a pull request:
https://github.com/apache/flink/pull/6337
[FLINK-9853][Tabel API & SQL] add HEX support
## What is the purpose of the change
This PR propose to add HEX in table api and sql, the syntax like mysql, which could take int or string arguments. For a integer argument N, it returns a hexadecimal string representation of the value of N. For a string argument str, it returns a hexadecimal string representation of str where each byte of each character in str is converted to two hexadecimal digits.
Syntax:
HEX(100) = 64
HEX('This is a test String.') = '546869732069732061207465737420537472696e672e'
## Brief change log
- *The expressionDsl, scalarSqlFunctions and mathExpressions to add hex*
- *The FunctionGenerator to support hex generator*
## Verifying this change
This change added tests and can be verified as follows:
*(example:)*
- *Added ScalaFunctionTests tests for table api and sql expressions*
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (no)
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
- The serializers: (no)
- The runtime per-record code paths (performance sensitive): (no)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (no)
- The S3 file system connector: (no)
## Documentation
- Does this pull request introduce a new feature? (yes)
- If yes, how is the feature documented? (docs)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/xueyumusic/flink hex
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/6337.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 #6337
----
commit 8d3bef913bee1d4913ef3ae056e3d15d4cda2cec
Author: xueyu <27...@...>
Date: 2018-07-15T12:01:15Z
hex support
----
---
[GitHub] flink issue #6337: [FLINK-9853][Tabel API & SQL] add HEX support
Posted by yanghua <gi...@git.apache.org>.
Github user yanghua commented on the issue:
https://github.com/apache/flink/pull/6337
+1, from my side
---
[GitHub] flink pull request #6337: [FLINK-9853][Tabel API & SQL] add HEX support
Posted by yanghua <gi...@git.apache.org>.
Github user yanghua commented on a diff in the pull request:
https://github.com/apache/flink/pull/6337#discussion_r202573057
--- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/functions/ScalarFunctions.scala ---
@@ -182,4 +184,6 @@ object ScalarFunctions {
new String(data)
}
+
+ def hex(x: String): String = Hex.encodeHexString(x.getBytes)
--- End diff --
add the doc for the API looks better to me
---
[GitHub] flink pull request #6337: [FLINK-9853][Tabel API & SQL] add HEX support
Posted by xueyumusic <gi...@git.apache.org>.
Github user xueyumusic commented on a diff in the pull request:
https://github.com/apache/flink/pull/6337#discussion_r202581145
--- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/runtime/functions/ScalarFunctions.scala ---
@@ -182,4 +184,6 @@ object ScalarFunctions {
new String(data)
}
+
+ def hex(x: String): String = Hex.encodeHexString(x.getBytes)
--- End diff --
thanks for review, @yanghua , fixed
---
[GitHub] flink issue #6337: [FLINK-9853][Tabel API & SQL] add HEX support
Posted by hequn8128 <gi...@git.apache.org>.
Github user hequn8128 commented on the issue:
https://github.com/apache/flink/pull/6337
Thanks for your PR. +1 to merge.
---
[GitHub] flink pull request #6337: [FLINK-9853][Tabel API & SQL] add HEX support
Posted by yanghua <gi...@git.apache.org>.
Github user yanghua commented on a diff in the pull request:
https://github.com/apache/flink/pull/6337#discussion_r202572746
--- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/scala/expressionDsl.scala ---
@@ -400,6 +400,12 @@ trait ImplicitExpressionOperations {
* numeric is null. E.g. "4" leads to "100", "12" leads to "1100".
*/
def bin() = Bin(expr)
+ /**
--- End diff --
please insert a new blank line
---