[GitHub] fhueske commented on a change in pull request #6622: [FLINK-10222] [table] Table scalar function expression parses error when function name equals the exists keyword suffix

2018-09-15 Thread GitBox
fhueske commented on a change in pull request #6622: [FLINK-10222] [table] 
Table scalar function expression parses error when function name equals the 
exists keyword suffix
URL: https://github.com/apache/flink/pull/6622#discussion_r217892719
 
 

 ##
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/ExpressionParser.scala
 ##
 @@ -42,7 +42,8 @@ object ExpressionParser extends JavaTokenParsers with 
PackratParsers {
 
   // Convert the keyword into an case insensitive Parser
   implicit def keyword2Parser(kw: Keyword): Parser[String] = {
-("""(?i)\Q""" + kw.key + """\E""").r
+("""(?i)\Q""" + kw.key +
+  
"""\E(?![_$a-zA-Z0-9\u005f\u0024\u0061-\u007a\u0041-\u005a\u0030-\u0039])""").r
 
 Review comment:
   I'll replace `a-zA-Z0-9\u005f\u0024\u0061-\u007a\u0041-\u005a\u0030-\u0039` 
by `\p{javaJavaIdentifierPart}` which matches all valid characters of Java 
identifiers.


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] fhueske commented on a change in pull request #6622: [FLINK-10222] [table] Table scalar function expression parses error when function name equals the exists keyword suffix

2018-09-14 Thread GitBox
fhueske commented on a change in pull request #6622: [FLINK-10222] [table] 
Table scalar function expression parses error when function name equals the 
exists keyword suffix
URL: https://github.com/apache/flink/pull/6622#discussion_r217701805
 
 

 ##
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/ExpressionParser.scala
 ##
 @@ -45,6 +45,12 @@ object ExpressionParser extends JavaTokenParsers with 
PackratParsers {
 ("""(?i)\Q""" + kw.key + """\E""").r
   }
 
+  // Convert the keyword into an case insensitive Parser
+  // It uses an more precisely matching mode for suffix keywords.
+  def suffixKeyword2Parser(kw: Keyword): Parser[String] = {
+("""(?i)\Q""" + kw.key + """\E(?![_$a-zA-Z0-9])""").r
 
 Review comment:
   We should match also Unicode letters, not just ASCII (`a-zA-Z`).


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] fhueske commented on a change in pull request #6622: [FLINK-10222] [table] Table scalar function expression parses error when function name equals the exists keyword suffix

2018-09-14 Thread GitBox
fhueske commented on a change in pull request #6622: [FLINK-10222] [table] 
Table scalar function expression parses error when function name equals the 
exists keyword suffix
URL: https://github.com/apache/flink/pull/6622#discussion_r217701567
 
 

 ##
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/ExpressionParser.scala
 ##
 @@ -45,6 +45,12 @@ object ExpressionParser extends JavaTokenParsers with 
PackratParsers {
 ("""(?i)\Q""" + kw.key + """\E""").r
   }
 
+  // Convert the keyword into an case insensitive Parser
+  // It uses an more precisely matching mode for suffix keywords.
+  def suffixKeyword2Parser(kw: Keyword): Parser[String] = {
+("""(?i)\Q""" + kw.key + """\E(?![_$a-zA-Z0-9])""").r
 
 Review comment:
   We can use this for all Keyword matches. Just replace `keyword2Parser` by 
this. 
   This would be the only change in the `ExpressionParser`.


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] fhueske commented on a change in pull request #6622: [FLINK-10222] [table] Table scalar function expression parses error when function name equals the exists keyword suffix

2018-09-13 Thread GitBox
fhueske commented on a change in pull request #6622: [FLINK-10222] [table] 
Table scalar function expression parses error when function name equals the 
exists keyword suffix
URL: https://github.com/apache/flink/pull/6622#discussion_r217554963
 
 

 ##
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/ExpressionParser.scala
 ##
 @@ -45,6 +45,13 @@ object ExpressionParser extends JavaTokenParsers with 
PackratParsers {
 ("""(?i)\Q""" + kw.key + """\E""").r
   }
 
+  // Convert the keyword into an case insensitive Parser
+  // It uses an exact matching mode. scenes to be used:
+  // a keyword as a suffix no required parameter and not as a prefix
+  def keyword2ParserForSuffixButNotAsPrefix(kw: Keyword): Parser[String] = {
 
 Review comment:
   Yes, I agree with @walterddr. This seems to be a better approach. 
   A keyword should only match if it is not followed by another identifier (see 
[Java identifier 
specs](https://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8)) 
character. 
   
   What do you think @yanghua?


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