You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by xc...@apache.org on 2018/11/07 11:30:11 UTC
[flink] branch release-1.6 updated: [FLINK-10463][table] Null
literal cannot be properly parsed in Java Table API function call
This is an automated email from the ASF dual-hosted git repository.
xccui pushed a commit to branch release-1.6
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-1.6 by this push:
new 761c7db [FLINK-10463][table] Null literal cannot be properly parsed in Java Table API function call
761c7db is described below
commit 761c7db58ea39bfc3a2bfdacba847d2d6e224129
Author: hequn8128 <ch...@gmail.com>
AuthorDate: Sat Oct 20 15:40:06 2018 +0800
[FLINK-10463][table] Null literal cannot be properly parsed in Java Table API function call
---
docs/dev/table/tableApi.md | 28 ++++++++++++++++------
.../flink/table/expressions/ExpressionParser.scala | 2 +-
2 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/docs/dev/table/tableApi.md b/docs/dev/table/tableApi.md
index 5eeb86b..2fae064 100644
--- a/docs/dev/table/tableApi.md
+++ b/docs/dev/table/tableApi.md
@@ -1606,11 +1606,13 @@ term = product , [ ( "+" | "-" ) , product ] ;
product = unary , [ ( "*" | "/" | "%") , unary ] ;
-unary = [ "!" | "-" ] , composite ;
+unary = [ "!" | "-" | "+" ] , composite ;
-composite = over | nullLiteral | suffixed | atom ;
+composite = over | suffixed | nullLiteral | prefixed | atom ;
-suffixed = interval | cast | as | if | functionCall ;
+suffixed = interval | suffixAs | suffixCast | suffixIf | suffixDistinct | suffixFunctionCall ;
+
+prefixed = prefixAs | prefixCast | prefixIf | prefixDistinct | prefixFunctionCall ;
interval = timeInterval | rowInterval ;
@@ -1618,15 +1620,27 @@ timeInterval = composite , "." , ("year" | "years" | "month" | "months" | "day"
rowInterval = composite , "." , "rows" ;
-cast = composite , ".cast(" , dataType , ")" ;
+suffixCast = composite , ".cast(" , dataType , ")" ;
+
+prefixCast = "cast(" , expression , dataType , ")" ;
dataType = "BYTE" | "SHORT" | "INT" | "LONG" | "FLOAT" | "DOUBLE" | "BOOLEAN" | "STRING" | "DECIMAL" | "SQL_DATE" | "SQL_TIME" | "SQL_TIMESTAMP" | "INTERVAL_MONTHS" | "INTERVAL_MILLIS" | ( "MAP" , "(" , dataType , "," , dataType , ")" ) | ( "PRIMITIVE_ARRAY" , "(" , dataType , ")" ) | ( "OBJECT_ARRAY" , "(" , dataType , ")" ) ;
-as = composite , ".as(" , fieldReference , ")" ;
+suffixAs = composite , ".as(" , fieldReference , ")" ;
+
+prefixAs = "as(" , expression, fieldReference , ")" ;
+
+suffixIf = composite , ".?(" , expression , "," , expression , ")" ;
+
+prefixIf = "?(" , expression , "," , expression , "," , expression , ")" ;
+
+suffixDistinct = composite , "distinct.()" ;
+
+prefixDistinct = functionIdentifier , ".distinct" , [ "(" , [ expression , { "," , expression } ] , ")" ] ;
-if = composite , ".?(" , expression , "," , expression , ")" ;
+suffixFunctionCall = composite , "." , functionIdentifier , [ "(" , [ expression , { "," , expression } ] , ")" ] ;
-functionCall = composite , "." , functionIdentifier , [ "(" , [ expression , { "," , expression } ] , ")" ] ;
+prefixFunctionCall = functionIdentifier , [ "(" , [ expression , { "," , expression } ] , ")" ] ;
atom = ( "(" , expression , ")" ) | literal | fieldReference ;
diff --git a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/ExpressionParser.scala b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/ExpressionParser.scala
index 4c0ed12..2a01caf 100644
--- a/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/ExpressionParser.scala
+++ b/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/ExpressionParser.scala
@@ -422,7 +422,7 @@ object ExpressionParser extends JavaTokenParsers with PackratParsers {
// suffix/prefix composite
- lazy val composite: PackratParser[Expression] = over | nullLiteral | suffixed | prefixed | atom |
+ lazy val composite: PackratParser[Expression] = over | suffixed | nullLiteral | prefixed | atom |
failure("Composite expression expected.")
// unary ops