[GitHub] twalthr commented on a change in pull request #6337: [FLINK-9853] [table] Add HEX support

2018-08-13 Thread GitBox
twalthr commented on a change in pull request #6337: [FLINK-9853] [table] Add 
HEX support 
URL: https://github.com/apache/flink/pull/6337#discussion_r209582133
 
 

 ##
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/mathExpressions.scala
 ##
 @@ -422,3 +422,21 @@ case class Bin(child: Expression) extends UnaryExpression 
{
 relBuilder.call(ScalarSqlFunctions.BIN, child.toRexNode)
   }
 }
+
+case class Hex(child: Expression) extends UnaryExpression {
+  override private[flink] def resultType: TypeInformation[_] = 
BasicTypeInfo.STRING_TYPE_INFO
+
+  override private[flink] def validateInput(): ValidationResult = 
child.resultType match {
+case _: IntegerTypeInfo[_] =>
 
 Review comment:
   Rely on `TypeCheckUtils.isIntegerFamily` and `TypeCheckUtils#isString` 
instead.


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


With regards,
Apache Git Services


[GitHub] twalthr commented on a change in pull request #6337: [FLINK-9853] [table] Add HEX support

2018-08-13 Thread GitBox
twalthr commented on a change in pull request #6337: [FLINK-9853] [table] Add 
HEX support 
URL: https://github.com/apache/flink/pull/6337#discussion_r209582385
 
 

 ##
 File path: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala
 ##
 @@ -392,6 +392,93 @@ class ScalarFunctionsTest extends ScalarTypesTestBase {
   "รครครค1234512345")
   }
 
+  @Test
+  def testHex(): Unit = {
+testAllApis(
+  100.hex(),
+  "100.hex()",
+  "HEX(100)",
+  "64")
+
+testAllApis(
+  'f2.hex(),
+  "f2.hex()",
+  "HEX(f2)",
+  "2a")
 
 Review comment:
   MySQL returns upper-case letters. Should we do this as well?


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


With regards,
Apache Git Services