You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2016/02/24 22:13:46 UTC
[28/50] [abbrv] phoenix git commit: PHOENIX-2602 Parser does not
handle escaped LPAREN
PHOENIX-2602 Parser does not handle escaped LPAREN
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/43b34da1
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/43b34da1
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/43b34da1
Branch: refs/heads/calcite
Commit: 43b34da1d4e10bef233bbb748c5dd1be11d7ce18
Parents: 046bda3
Author: James Taylor <jt...@salesforce.com>
Authored: Mon Feb 15 01:44:31 2016 -0800
Committer: James Taylor <jt...@salesforce.com>
Committed: Mon Feb 15 10:14:58 2016 -0800
----------------------------------------------------------------------
phoenix-core/src/main/antlr3/PhoenixSQL.g | 7 ++++---
.../test/java/org/apache/phoenix/parse/QueryParserTest.java | 6 ++++++
2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/43b34da1/phoenix-core/src/main/antlr3/PhoenixSQL.g
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/antlr3/PhoenixSQL.g b/phoenix-core/src/main/antlr3/PhoenixSQL.g
index 0be5717..64e1d32 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -1213,14 +1213,14 @@ DIGIT
STRING_LITERAL
@init{ StringBuilder sb = new StringBuilder(); }
: '\''
- ( t=CHAR_ESC { sb.append(getText()); }
- | t=CHAR { sb.append(t.getText()); }
+ ( t=CHAR { sb.append(t.getText()); }
+ | t=CHAR_ESC { sb.append(getText()); }
)* '\'' { setText(sb.toString()); }
;
fragment
CHAR
- : ( ~('\'') )
+ : ( ~('\'' | '\\') )
;
fragment
@@ -1242,6 +1242,7 @@ CHAR_ESC
| '\\' { setText("\\"); }
| '_' { setText("\\_"); }
| '%' { setText("\\\%"); }
+ | { setText("\\"); }
)
| '\'\'' { setText("\'"); }
;
http://git-wip-us.apache.org/repos/asf/phoenix/blob/43b34da1/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
index 5363042..70f590f 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/parse/QueryParserTest.java
@@ -766,4 +766,10 @@ public class QueryParserTest {
String sql = "select * from t where 'a' <= ALL(a-b+1)";
parseQuery(sql);
}
+
+ @Test
+ public void testDoubleBackslash() throws Exception {
+ String sql = "SELECT * FROM T WHERE A LIKE 'a\\(d'";
+ parseQuery(sql);
+ }
}