[4/4] git commit: PHOENIX-973 Lexer skips unexpected characters

2014-10-17 Thread jamestaylor
PHOENIX-973 Lexer skips unexpected characters


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/19d02fa5
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/19d02fa5
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/19d02fa5

Branch: refs/heads/4.0
Commit: 19d02fa5f14ae8a9f7a769eaa6d770f521246fb1
Parents: 17eb70d
Author: James Taylor jtay...@salesforce.com
Authored: Fri Oct 17 18:12:15 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Fri Oct 17 18:12:15 2014 -0700

--
 phoenix-core/src/main/antlr3/PhoenixSQL.g   | 13 ++-
 .../query/ConnectionQueryServicesImpl.java  |  2 +-
 .../org/apache/phoenix/schema/SequenceKey.java  |  4 +-
 .../org/apache/phoenix/util/MetaDataUtil.java   | 14 +--
 .../org/apache/phoenix/util/UpgradeUtil.java| 95 
 .../apache/phoenix/parse/QueryParserTest.java   | 16 +++-
 .../java/org/apache/phoenix/query/BaseTest.java |  6 +-
 7 files changed, 96 insertions(+), 54 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/19d02fa5/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 26d54a2..e2636fb 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -949,13 +949,12 @@ SL_COMMENT2: '--';
 
 // Bind names start with a colon and followed by 1 or more 
letter/digit/underscores
 BIND_NAME
-: COLON (LETTER|DIGIT|'_')+
+: COLON (DIGIT)+
 ;
 
-// Valid names can have a single underscore, but not multiple
-// Turn back on literal testing, all names are literals.
+
 NAME
-:LETTER (FIELDCHAR)* ('\' (DBL_QUOTE_CHAR)* '\')?
+:LETTER (FIELDCHAR)*
 |'\' (DBL_QUOTE_CHAR)* '\'
 ;
 
@@ -1173,4 +1172,10 @@ SL_COMMENT
 DOT
 : '.'
 ;
+
+OTHER  
+: . { if (true) // to prevent compile error
+  throw new RuntimeException(Unexpected char: ' + $text + '); 
} 
+;
+
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/19d02fa5/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index fe3ae0a..415fbca 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -1536,7 +1536,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 } catch (TableAlreadyExistsException e) {
 // This will occur if we have an older 
SYSTEM.SEQUENCE, so we need to update it to include
 // any new columns we've added.
-if 
(UpgradeUtil.addSaltByteToSequenceTable(metaConnection, nSaltBuckets)) {
+if 
(UpgradeUtil.upgradeSequenceTable(metaConnection, nSaltBuckets)) {
 metaConnection.removeTable(null,
 
PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA,
 
PhoenixDatabaseMetaData.TYPE_SEQUENCE,

http://git-wip-us.apache.org/repos/asf/phoenix/blob/19d02fa5/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceKey.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceKey.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceKey.java
index 94ca549..6f82630 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceKey.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceKey.java
@@ -32,9 +32,9 @@ public class SequenceKey implements ComparableSequenceKey {
 this.tenantId = tenantId;
 this.schemaName = schemaName;
 this.sequenceName = sequenceName;
-this.key = ByteUtil.concat(nBuckets = 0 ? ByteUtil.EMPTY_BYTE_ARRAY : 
QueryConstants.SEPARATOR_BYTE_ARRAY, tenantId == null  ? 
ByteUtil.EMPTY_BYTE_ARRAY : Bytes.toBytes(tenantId), 
QueryConstants.SEPARATOR_BYTE_ARRAY, schemaName == null ? 
ByteUtil.EMPTY_BYTE_ARRAY : Bytes.toBytes(schemaName), 
QueryConstants.SEPARATOR_BYTE_ARRAY, Bytes.toBytes(sequenceName));
+this.key = ByteUtil.concat((nBuckets = 0 ? ByteUtil.EMPTY_BYTE_ARRAY 
: QueryConstants.SEPARATOR_BYTE_ARRAY), tenantId == null  ? 

[4/4] git commit: PHOENIX-973 Lexer skips unexpected characters

2014-10-17 Thread jamestaylor
PHOENIX-973 Lexer skips unexpected characters


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/ef062ad2
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/ef062ad2
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/ef062ad2

Branch: refs/heads/3.0
Commit: ef062ad250fc6203cf613dea7417160a68efabd4
Parents: cf07a5d
Author: James Taylor jtay...@salesforce.com
Authored: Fri Oct 17 18:12:15 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Fri Oct 17 18:44:58 2014 -0700

--
 phoenix-core/src/main/antlr3/PhoenixSQL.g   | 13 ++-
 .../query/ConnectionQueryServicesImpl.java  |  2 +-
 .../org/apache/phoenix/schema/SequenceKey.java  |  4 +-
 .../org/apache/phoenix/util/MetaDataUtil.java   | 14 +--
 .../org/apache/phoenix/util/UpgradeUtil.java| 95 
 .../apache/phoenix/parse/QueryParserTest.java   | 16 +++-
 .../java/org/apache/phoenix/query/BaseTest.java |  6 +-
 7 files changed, 96 insertions(+), 54 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef062ad2/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 48049c9..4a3a8d8 100644
--- a/phoenix-core/src/main/antlr3/PhoenixSQL.g
+++ b/phoenix-core/src/main/antlr3/PhoenixSQL.g
@@ -950,13 +950,12 @@ SL_COMMENT2: '--';
 
 // Bind names start with a colon and followed by 1 or more 
letter/digit/underscores
 BIND_NAME
-: COLON (LETTER|DIGIT|'_')+
+: COLON (DIGIT)+
 ;
 
-// Valid names can have a single underscore, but not multiple
-// Turn back on literal testing, all names are literals.
+
 NAME
-:LETTER (FIELDCHAR)* ('\' (DBL_QUOTE_CHAR)* '\')?
+:LETTER (FIELDCHAR)*
 |'\' (DBL_QUOTE_CHAR)* '\'
 ;
 
@@ -1174,4 +1173,10 @@ SL_COMMENT
 DOT
 : '.'
 ;
+
+OTHER  
+: . { if (true) // to prevent compile error
+  throw new RuntimeException(Unexpected char: ' + $text + '); 
} 
+;
+
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef062ad2/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index 688cf42..edeb206 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -1348,7 +1348,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 } catch (TableAlreadyExistsException e) {
 // This will occur if we have an older 
SYSTEM.SEQUENCE, so we need to update it to include
 // any new columns we've added.
-if 
(UpgradeUtil.addSaltByteToSequenceTable(metaConnection, nSaltBuckets)) {
+if 
(UpgradeUtil.upgradeSequenceTable(metaConnection, nSaltBuckets)) {
 metaConnection.removeTable(null,
 
PhoenixDatabaseMetaData.SYSTEM_CATALOG_SCHEMA,
 
PhoenixDatabaseMetaData.TYPE_SEQUENCE,

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ef062ad2/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceKey.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceKey.java 
b/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceKey.java
index 94ca549..6f82630 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceKey.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/SequenceKey.java
@@ -32,9 +32,9 @@ public class SequenceKey implements ComparableSequenceKey {
 this.tenantId = tenantId;
 this.schemaName = schemaName;
 this.sequenceName = sequenceName;
-this.key = ByteUtil.concat(nBuckets = 0 ? ByteUtil.EMPTY_BYTE_ARRAY : 
QueryConstants.SEPARATOR_BYTE_ARRAY, tenantId == null  ? 
ByteUtil.EMPTY_BYTE_ARRAY : Bytes.toBytes(tenantId), 
QueryConstants.SEPARATOR_BYTE_ARRAY, schemaName == null ? 
ByteUtil.EMPTY_BYTE_ARRAY : Bytes.toBytes(schemaName), 
QueryConstants.SEPARATOR_BYTE_ARRAY, Bytes.toBytes(sequenceName));
+this.key = ByteUtil.concat((nBuckets = 0 ? ByteUtil.EMPTY_BYTE_ARRAY 
: QueryConstants.SEPARATOR_BYTE_ARRAY), tenantId == null  ?