[GitHub] yanghua commented on a change in pull request #6473: [FLINK-9999] [table] Add ISNUMERIC supported in Table API/SQL

2018-08-11 Thread GitBox
yanghua commented on a change in pull request #6473: [FLINK-] [table] Add 
ISNUMERIC supported in Table API/SQL
URL: https://github.com/apache/flink/pull/6473#discussion_r209441697
 
 

 ##
 File path: 
flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala
 ##
 @@ -450,6 +450,63 @@ class ScalarFunctionsTest extends ScalarTypesTestBase {
   "")
   }
 
+  @Test
+  def testIsNumeric(): Unit = {
 
 Review comment:
   There is one here:
   
   ```
   testAllApis(
 "0.123a".isNumeric(),
 "'0.123a'.isNumeric",
 "ISNUMERIC('0.123a')",
 "0")
   ```
   
I don't add too much at the moment, but more coverage is always necessary. 
I want to wait until I can confirm that this function is necessary.


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] yanghua commented on a change in pull request #6473: [FLINK-9999] [table] Add ISNUMERIC supported in Table API/SQL

2018-08-11 Thread GitBox
yanghua commented on a change in pull request #6473: [FLINK-] [table] Add 
ISNUMERIC supported in Table API/SQL
URL: https://github.com/apache/flink/pull/6473#discussion_r209441509
 
 

 ##
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/stringExpressions.scala
 ##
 @@ -358,6 +358,29 @@ case class Rpad(text: Expression, len: Expression, pad: 
Expression)
   }
 }
 
+case class IsNumeric(child: Expression) extends UnaryExpression with 
InputTypeSpec {
+
+  override private[flink] def expectedTypes: Seq[TypeInformation[_]] = 
Seq(STRING_TYPE_INFO)
+
+  override private[flink] def resultType: TypeInformation[_] = INT_TYPE_INFO
+
+  override private[flink] def validateInput(): ValidationResult = {
+if (child.resultType == STRING_TYPE_INFO) {
 
 Review comment:
   Here I think of it as a string type scalar function, the value represented 
by this string can be int/bigInt/double and so on.


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