PHOENIX-3265 Double-quote column names that use reserved keywords

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

Branch: refs/heads/master
Commit: fd1dac0d40b1b2095e176121aadaf11a267f636f
Parents: d1156ea
Author: maryannxue <maryann....@gmail.com>
Authored: Wed Oct 12 11:28:48 2016 -0700
Committer: maryannxue <maryann....@gmail.com>
Committed: Wed Oct 12 11:28:48 2016 -0700

----------------------------------------------------------------------
 .../phoenix/end2end/AbsFunctionEnd2EndIT.java   |   6 +-
 .../phoenix/end2end/ArrayFillFunctionIT.java    |   6 +-
 .../phoenix/end2end/ExecuteStatementsIT.java    |  12 +-
 .../phoenix/end2end/FirstValueFunctionIT.java   |  60 ++++----
 .../org/apache/phoenix/end2end/HashJoinIT.java  |  18 +--
 .../phoenix/end2end/LastValueFunctionIT.java    | 148 +++++++++----------
 .../phoenix/end2end/NthValueFunctionIT.java     |  48 +++---
 .../phoenix/end2end/ProductMetricsIT.java       |  68 ++++-----
 .../org/apache/phoenix/end2end/QueryMoreIT.java |   4 +-
 .../phoenix/end2end/RoundFloorCeilFuncIT.java   |  16 +-
 .../phoenix/end2end/SignFunctionEnd2EndIT.java  |   6 +-
 .../apache/phoenix/end2end/SortMergeJoinIT.java |  44 +++---
 .../org/apache/phoenix/end2end/SortOrderIT.java |   6 +-
 .../end2end/SubqueryUsingSortMergeJoinIT.java   |   2 +-
 .../apache/phoenix/end2end/UpsertValuesIT.java  |  10 +-
 .../phoenix/end2end/VariableLengthPKIT.java     |  46 +++---
 .../phoenix/compile/JoinQueryCompilerTest.java  |   2 +-
 .../phoenix/compile/QueryOptimizerTest.java     |  12 +-
 .../java/org/apache/phoenix/query/BaseTest.java |   2 +-
 .../org/apache/phoenix/query/QueryPlanTest.java |  14 +-
 20 files changed, 265 insertions(+), 265 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/AbsFunctionEnd2EndIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AbsFunctionEnd2EndIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AbsFunctionEnd2EndIT.java
index 8447286..3137cdf 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AbsFunctionEnd2EndIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AbsFunctionEnd2EndIT.java
@@ -46,7 +46,7 @@ public class AbsFunctionEnd2EndIT extends 
ParallelStatsDisabledIT {
         try {
             conn = DriverManager.getConnection(getUrl());
             String ddl;
-            ddl = "CREATE TABLE " + TABLE_NAME + " (k VARCHAR NOT NULL PRIMARY 
KEY, dec DECIMAL, doub DOUBLE, fl FLOAT, inte INTEGER, lon BIGINT, smalli 
SMALLINT, tinyi TINYINT)";
+            ddl = "CREATE TABLE " + TABLE_NAME + " (k VARCHAR NOT NULL PRIMARY 
KEY, \"DEC\" DECIMAL, doub DOUBLE, fl FLOAT, inte INTEGER, lon BIGINT, smalli 
SMALLINT, tinyi TINYINT)";
             conn.createStatement().execute(ddl);
             conn.commit();
         } finally {
@@ -71,7 +71,7 @@ public class AbsFunctionEnd2EndIT extends 
ParallelStatsDisabledIT {
 
     private void testSignedNumberSpec(Connection conn, double data) throws 
Exception {
         updateSignedTable(conn, data);
-        ResultSet rs = conn.createStatement() .executeQuery("SELECT 
ABS(dec),ABS(doub),ABS(fl),ABS(inte),ABS(lon),ABS(smalli),ABS(tinyi) FROM " + 
TABLE_NAME);
+        ResultSet rs = conn.createStatement() .executeQuery("SELECT 
ABS(\"DEC\"),ABS(doub),ABS(fl),ABS(inte),ABS(lon),ABS(smalli),ABS(tinyi) FROM " 
+ TABLE_NAME);
         assertTrue(rs.next());
         Double d = Double.valueOf(data);
         
assertEquals(rs.getBigDecimal(1).compareTo(BigDecimal.valueOf(data).abs()), 0);
@@ -83,7 +83,7 @@ public class AbsFunctionEnd2EndIT extends 
ParallelStatsDisabledIT {
         assertEquals(rs.getByte(7), Math.abs(d.byteValue()));
         assertTrue(!rs.next());
 
-        PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + 
TABLE_NAME + " WHERE ABS(dec)=? AND ABS(doub)=? AND ABS(fl)=? AND ABS(inte)=? 
AND ABS(lon)=? AND ABS(smalli)=? AND ABS(tinyi)=?");
+        PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + 
TABLE_NAME + " WHERE ABS(\"DEC\")=? AND ABS(doub)=? AND ABS(fl)=? AND 
ABS(inte)=? AND ABS(lon)=? AND ABS(smalli)=? AND ABS(tinyi)=?");
         stmt.setBigDecimal(1, BigDecimal.valueOf(data).abs());
         stmt.setDouble(2, Math.abs(d.doubleValue()));
         stmt.setFloat(3, Math.abs(d.floatValue()));

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayFillFunctionIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayFillFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayFillFunctionIT.java
index 96bafad..dfa0beb 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayFillFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ArrayFillFunctionIT.java
@@ -44,10 +44,10 @@ public class ArrayFillFunctionIT extends 
ParallelStatsDisabledIT {
         tableName = generateUniqueName();
         Connection conn = DriverManager.getConnection(getUrl());
         String ddl = "CREATE TABLE " + tableName
-            + " (region_name VARCHAR PRIMARY KEY,length1 INTEGER, length2 
INTEGER,date DATE,time TIME,timestamp TIMESTAMP,varchar VARCHAR,integer 
INTEGER,double DOUBLE,bigint BIGINT,char CHAR(15),double1 DOUBLE,char1 
CHAR(17),nullcheck INTEGER,chars2 CHAR(15)[], varchars2 VARCHAR[])";
+            + " (region_name VARCHAR PRIMARY KEY,length1 INTEGER, length2 
INTEGER,\"DATE\" DATE,time TIME,timestamp TIMESTAMP,varchar VARCHAR,integer 
INTEGER,double DOUBLE,bigint BIGINT,char CHAR(15),double1 DOUBLE,char1 
CHAR(17),nullcheck INTEGER,chars2 CHAR(15)[], varchars2 VARCHAR[])";
         conn.createStatement().execute(ddl);
         String dml = "UPSERT INTO " + tableName
-            + 
"(region_name,length1,length2,date,time,timestamp,varchar,integer,double,bigint,char,double1,char1,nullcheck,chars2,varchars2)
 VALUES('SF Bay Area',"
+            + 
"(region_name,length1,length2,\"DATE\",time,timestamp,varchar,integer,double,bigint,char,double1,char1,nullcheck,chars2,varchars2)
 VALUES('SF Bay Area',"
             +
                 "0," +
                 "-3," +
@@ -181,7 +181,7 @@ public class ArrayFillFunctionIT extends 
ParallelStatsDisabledIT {
 
         ResultSet rs;
         rs = conn.createStatement().executeQuery(
-            "SELECT ARRAY_FILL(date,3) FROM " + tableName + " WHERE 
region_name = 'SF Bay Area'");
+            "SELECT ARRAY_FILL(\"DATE\",3) FROM " + tableName + " WHERE 
region_name = 'SF Bay Area'");
         assertTrue(rs.next());
 
         Object[] objects = new Object[]{new Date(1432102334184l), new 
Date(1432102334184l), new Date(1432102334184l)};

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExecuteStatementsIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExecuteStatementsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExecuteStatementsIT.java
index bc21af0..78f46cc 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExecuteStatementsIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ExecuteStatementsIT.java
@@ -65,17 +65,17 @@ public class ExecuteStatementsIT extends 
ParallelStatsDisabledIT {
             "create table " + ptsdbTableName +
             "   (inst varchar null,\n" + 
             "    host varchar null,\n" + 
-            "    date date not null,\n" + 
+            "    \"DATE\" date not null,\n" +
             "    val decimal\n" +
-            "    CONSTRAINT pk PRIMARY KEY (inst,host,date))\n" +
+            "    CONSTRAINT pk PRIMARY KEY (inst,host,\"DATE\"))\n" +
             "    split on (?,?,?);\n" +
             "alter table " + ptsdbTableName + " add if not exists val 
decimal;\n" +  // Shouldn't error out b/c of if not exists clause
             "alter table " + ptsdbTableName + " drop column if exists blah;\n" 
+  // Shouldn't error out b/c of if exists clause
             "drop table if exists FOO.BAR;\n" + // Shouldn't error out b/c of 
if exists clause
-            "UPSERT INTO " + ptsdbTableName + "(date, val, host) " +
+            "UPSERT INTO " + ptsdbTableName + "(\"DATE\", val, host) " +
             "    SELECT current_date(), x_integer+2, entity_id FROM " + 
tableName + " WHERE a_integer >= ?;" +
-            "UPSERT INTO " + ptsdbTableName + "(date, val, inst)\n" +
-            "    SELECT date+1, val*10, host FROM " + ptsdbTableName + ";";
+            "UPSERT INTO " + ptsdbTableName + "(\"DATE\", val, inst)\n" +
+            "    SELECT \"DATE\"+1, val*10, host FROM " + ptsdbTableName + ";";
         
         Date now = new Date(System.currentTimeMillis());
         Connection conn = DriverManager.getConnection(getUrl());
@@ -85,7 +85,7 @@ public class ExecuteStatementsIT extends 
ParallelStatsDisabledIT {
         assertEquals(7, nStatements);
 
         Date then = new Date(System.currentTimeMillis() + 
QueryConstants.MILLIS_IN_DAY);
-        String query = "SELECT host,inst, date,val FROM " + ptsdbTableName + " 
where inst is not null";
+        String query = "SELECT host,inst,\"DATE\",val FROM " + ptsdbTableName 
+ " where inst is not null";
         PreparedStatement statement = conn.prepareStatement(query);
         
         ResultSet rs = statement.executeQuery();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/FirstValueFunctionIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/FirstValueFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/FirstValueFunctionIT.java
index a2fa244..9992341 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/FirstValueFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/FirstValueFunctionIT.java
@@ -36,23 +36,23 @@ public class FirstValueFunctionIT extends 
ParallelStatsDisabledIT {
         String tableName = generateUniqueName();
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " "
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date BIGINT, \"value\" BIGINT)";
+                + " \"DATE\" BIGINT, \"value\" BIGINT)";
         conn.createStatement().execute(ddl);
 
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (1, 8, 1, 3)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (1, 8, 1, 3)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (2, 8, 2, 7)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (2, 8, 2, 7)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (3, 8, 3, 9)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (3, 8, 3, 9)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (5, 8, 5, 158)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (5, 8, 5, 158)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (4, 8, 4, 5)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (4, 8, 4, 5)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT FIRST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName
+            "SELECT FIRST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName
                 + " GROUP BY page_id");
 
         assertTrue(rs.next());
@@ -129,23 +129,23 @@ public class FirstValueFunctionIT extends 
ParallelStatsDisabledIT {
         String tableName = generateUniqueName();
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " "
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG, "
-                + "date DOUBLE, \"value\" DOUBLE)";
+                + "\"DATE\" DOUBLE, \"value\" DOUBLE)";
         conn.createStatement().execute(ddl);
 
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (1, 8, 1, 300)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (1, 8, 1, 300)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (2, 8, 2, 7)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (2, 8, 2, 7)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (3, 8, 3, 9)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (3, 8, 3, 9)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (5, 8, 4, 2)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (5, 8, 4, 2)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (4, 8, 5, 400)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (4, 8, 5, 400)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT FIRST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName
+            "SELECT FIRST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName
                 + " GROUP BY page_id");
 
         assertTrue(rs.next());
@@ -160,23 +160,23 @@ public class FirstValueFunctionIT extends 
ParallelStatsDisabledIT {
         String table_name = generateUniqueName();
         String ddl = "CREATE TABLE IF NOT EXISTS " + table_name + " "
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG, "
-                + "date VARCHAR(3), \"value\" VARCHAR(3))";
+                + "\"DATE\" VARCHAR(3), \"value\" VARCHAR(3))";
         conn.createStatement().execute(ddl);
 
         conn.createStatement().execute(
-            "UPSERT INTO " + table_name + " (id, page_id, date, \"value\") 
VALUES (1, 8, '1', '3')");
+            "UPSERT INTO " + table_name + " (id, page_id, \"DATE\", \"value\") 
VALUES (1, 8, '1', '3')");
         conn.createStatement().execute(
-            "UPSERT INTO " + table_name + " (id, page_id, date, \"value\") 
VALUES (2, 8, '2', '7')");
+            "UPSERT INTO " + table_name + " (id, page_id, \"DATE\", \"value\") 
VALUES (2, 8, '2', '7')");
         conn.createStatement().execute(
-            "UPSERT INTO " + table_name + " (id, page_id, date, \"value\") 
VALUES (3, 8, '3', '9')");
+            "UPSERT INTO " + table_name + " (id, page_id, \"DATE\", \"value\") 
VALUES (3, 8, '3', '9')");
         conn.createStatement().execute(
-            "UPSERT INTO " + table_name + " (id, page_id, date, \"value\") 
VALUES (5, 8, '4', '2')");
+            "UPSERT INTO " + table_name + " (id, page_id, \"DATE\", \"value\") 
VALUES (5, 8, '4', '2')");
         conn.createStatement().execute(
-            "UPSERT INTO " + table_name + " (id, page_id, date, \"value\") 
VALUES (4, 8, '5', '4')");
+            "UPSERT INTO " + table_name + " (id, page_id, \"DATE\", \"value\") 
VALUES (4, 8, '5', '4')");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT FIRST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + table_name
+            "SELECT FIRST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + table_name
                 + " GROUP BY page_id");
 
         assertTrue(rs.next());
@@ -191,23 +191,23 @@ public class FirstValueFunctionIT extends 
ParallelStatsDisabledIT {
         String tableName = generateUniqueName();
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " "
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date FLOAT, \"value\" FLOAT)";
+                + " \"DATE\" FLOAT, \"value\" FLOAT)";
         conn.createStatement().execute(ddl);
 
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (1, 8, 1, 300)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (1, 8, 1, 300)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (2, 8, 2, 7)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (2, 8, 2, 7)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (3, 8, 3, 9)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (3, 8, 3, 9)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (5, 8, 4, 2)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (5, 8, 4, 2)");
         conn.createStatement().execute(
-            "UPSERT INTO " + tableName + " (id, page_id, date, \"value\") 
VALUES (4, 8, 5, 400)");
+            "UPSERT INTO " + tableName + " (id, page_id, \"DATE\", \"value\") 
VALUES (4, 8, 5, 400)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT FIRST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName
+            "SELECT FIRST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName
                 + " GROUP BY page_id");
 
         assertTrue(rs.next());
@@ -223,7 +223,7 @@ public class FirstValueFunctionIT extends 
ParallelStatsDisabledIT {
         String tableName = generateUniqueName();
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " "
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date FLOAT, \"value\" FLOAT)";
+                + " \"DATE\" FLOAT, \"value\" FLOAT)";
         conn.createStatement().execute(ddl);
 
         conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id) VALUES (1, 8)");
@@ -234,7 +234,7 @@ public class FirstValueFunctionIT extends 
ParallelStatsDisabledIT {
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT FIRST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName
+            "SELECT FIRST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName
                 + " GROUP BY page_id");
 
         assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
index 0d42e27..1b90288 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/HashJoinIT.java
@@ -2813,13 +2813,13 @@ public class HashJoinIT extends BaseJoinIT {
             assertEquals(rs.getString("c.phone"), "999-999-3333");
             assertEquals(rs.getString("c.address"), "303 XXX Street");
             assertNull(rs.getString("c.loc_id"));
-            assertEquals(rs.getDate("c.date"), new 
Date(format.parse("2013-11-25 10:06:29").getTime()));
+            assertEquals(rs.getDate("c.\"DATE\""), new 
Date(format.parse("2013-11-25 10:06:29").getTime()));
             assertEquals(rs.getString("O.order_id"), "000000000000002");
             assertEquals(rs.getString("O.customer_id"), "0000000003");
             assertEquals(rs.getString("O.item_id"), "0000000006");
             assertEquals(rs.getInt("o.price"), 552);
             assertEquals(rs.getInt("o.quantity"), 2000);
-            assertEquals(rs.getTimestamp("o.date"), new 
Timestamp(format.parse("2013-11-25 10:06:29").getTime()));
+            assertEquals(rs.getTimestamp("o.\"DATE\""), new 
Timestamp(format.parse("2013-11-25 10:06:29").getTime()));
             assertEquals(rs.getString("I.item_id"), "0000000006");
             assertEquals(rs.getString("i.name"), "T6");
             assertEquals(rs.getInt("i.price"), 600);
@@ -2838,13 +2838,13 @@ public class HashJoinIT extends BaseJoinIT {
             assertEquals(rs.getString("c.phone"), "999-999-4444");
             assertEquals(rs.getString("c.address"), "404 XXX Street");
             assertEquals(rs.getString("c.loc_id"), "10004");
-            assertEquals(rs.getDate("c.date"), new 
Date(format.parse("2013-11-22 14:22:56").getTime()));
+            assertEquals(rs.getDate("c.\"DATE\""), new 
Date(format.parse("2013-11-22 14:22:56").getTime()));
             assertEquals(rs.getString("O.order_id"), "000000000000001");
             assertEquals(rs.getString("O.customer_id"), "0000000004");
             assertEquals(rs.getString("O.item_id"), "0000000001");
             assertEquals(rs.getInt("o.price"), 100);
             assertEquals(rs.getInt("o.quantity"), 1000);
-            assertEquals(rs.getTimestamp("o.date"), new 
Timestamp(format.parse("2013-11-22 14:22:56").getTime()));
+            assertEquals(rs.getTimestamp("o.\"DATE\""), new 
Timestamp(format.parse("2013-11-22 14:22:56").getTime()));
             assertEquals(rs.getString("I.item_id"), "0000000001");
             assertEquals(rs.getString("i.name"), "T1");
             assertEquals(rs.getInt("i.price"), 100);
@@ -2863,13 +2863,13 @@ public class HashJoinIT extends BaseJoinIT {
             assertEquals(rs.getString("c.phone"), "999-999-4444");
             assertEquals(rs.getString("c.address"), "404 XXX Street");
             assertEquals(rs.getString("c.loc_id"), "10004");
-            assertEquals(rs.getDate("c.date"), new 
Date(format.parse("2013-11-22 14:22:56").getTime()));
+            assertEquals(rs.getDate("c.\"DATE\""), new 
Date(format.parse("2013-11-22 14:22:56").getTime()));
             assertEquals(rs.getString("O.order_id"), "000000000000004");
             assertEquals(rs.getString("O.customer_id"), "0000000004");
             assertEquals(rs.getString("O.item_id"), "0000000006");
             assertEquals(rs.getInt("o.price"), 510);
             assertEquals(rs.getInt("o.quantity"), 4000);
-            assertEquals(rs.getTimestamp("o.date"), new 
Timestamp(format.parse("2013-11-26 13:26:04").getTime()));
+            assertEquals(rs.getTimestamp("o.\"DATE\""), new 
Timestamp(format.parse("2013-11-26 13:26:04").getTime()));
             assertEquals(rs.getString("I.item_id"), "0000000006");
             assertEquals(rs.getString("i.name"), "T6");
             assertEquals(rs.getInt("i.price"), 600);
@@ -3157,7 +3157,7 @@ public class HashJoinIT extends BaseJoinIT {
             assertEquals(rs.getString("c.phone"), "999-999-3333");
             assertEquals(rs.getString("c.address"), "303 XXX Street");
             assertNull(rs.getString("c.loc_id"));
-            assertEquals(rs.getDate("c.date"), new 
Date(format.parse("2013-11-25 10:06:29").getTime()));
+            assertEquals(rs.getDate("c.\"DATE\""), new 
Date(format.parse("2013-11-25 10:06:29").getTime()));
             assertEquals(rs.getString("qo.ooid"), "000000000000002");
             assertEquals(rs.getString("qo.ocid"), "0000000003");
             assertEquals(rs.getString("qo.oiid"), "0000000006");
@@ -3181,7 +3181,7 @@ public class HashJoinIT extends BaseJoinIT {
             assertEquals(rs.getString("c.phone"), "999-999-4444");
             assertEquals(rs.getString("c.address"), "404 XXX Street");
             assertEquals(rs.getString("c.loc_id"), "10004");
-            assertEquals(rs.getDate("c.date"), new 
Date(format.parse("2013-11-22 14:22:56").getTime()));
+            assertEquals(rs.getDate("c.\"DATE\""), new 
Date(format.parse("2013-11-22 14:22:56").getTime()));
             assertEquals(rs.getString("qo.ooid"), "000000000000001");
             assertEquals(rs.getString("qo.ocid"), "0000000004");
             assertEquals(rs.getString("qo.oiid"), "0000000001");
@@ -3205,7 +3205,7 @@ public class HashJoinIT extends BaseJoinIT {
             assertEquals(rs.getString("c.phone"), "999-999-4444");
             assertEquals(rs.getString("c.address"), "404 XXX Street");
             assertEquals(rs.getString("c.loc_id"), "10004");
-            assertEquals(rs.getDate("c.date"), new 
Date(format.parse("2013-11-22 14:22:56").getTime()));
+            assertEquals(rs.getDate("c.\"DATE\""), new 
Date(format.parse("2013-11-22 14:22:56").getTime()));
             assertEquals(rs.getString("qo.ooid"), "000000000000004");
             assertEquals(rs.getString("qo.ocid"), "0000000004");
             assertEquals(rs.getString("qo.oiid"), "0000000006");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/LastValueFunctionIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LastValueFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LastValueFunctionIT.java
index 2a3ebf7..658c178 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/LastValueFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/LastValueFunctionIT.java
@@ -36,25 +36,25 @@ public class LastValueFunctionIT extends 
ParallelStatsDisabledIT {
         String tableName = generateUniqueName();
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName 
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date DATE, \"value\" UNSIGNED_LONG)";
+                + " \"DATE\" DATE, \"value\" UNSIGNED_LONG)";
         conn.createStatement().execute(ddl);
 
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") "
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") "
                 + "VALUES (1, 8, TO_DATE('2013-01-01 00:00:00'), 300)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") "
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") "
                 + "VALUES (2, 8, TO_DATE('2013-01-01 00:01:00'), 7)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") "
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") "
                 + "VALUES (3, 8, TO_DATE('2013-01-01 00:02:00'), 9)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") "
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") "
                 + "VALUES (4, 8, TO_DATE('2013-01-01 00:03:00'), 4)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") "
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") "
                 + "VALUES (5, 8, TO_DATE('2013-01-01 00:04:00'), 2)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") "
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") "
                 + "VALUES (6, 8, TO_DATE('2013-01-01 00:05:00'), 150)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName + " GROUP BY page_id");
+                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName + " GROUP BY page_id");
 
         assertTrue(rs.next());
         assertEquals(rs.getLong(1), 150);
@@ -68,18 +68,18 @@ public class LastValueFunctionIT extends 
ParallelStatsDisabledIT {
         String tableName = generateUniqueName();
 
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName 
-                + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG, 
date INTEGER, \"value\" INTEGER)";
+                + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG, 
\"DATE\" INTEGER, \"value\" INTEGER)";
         conn.createStatement().execute(ddl);
 
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (5, 8, 5, -255)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (1, 8, 1, 3)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (2, 8, 2, 7)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (3, 8, 3, 9)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (4, 8, 4, 4)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (5, 8, 5, -255)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (1, 8, 1, 3)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (2, 8, 2, 7)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (3, 8, 3, 9)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (4, 8, 4, 4)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName + " GROUP BY page_id"
+                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName + " GROUP BY page_id"
         );
 
         assertTrue(rs.next());
@@ -94,18 +94,18 @@ public class LastValueFunctionIT extends 
ParallelStatsDisabledIT {
 
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName 
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date UNSIGNED_INT, \"value\" UNSIGNED_INT)";
+                + " \"DATE\" UNSIGNED_INT, \"value\" UNSIGNED_INT)";
         conn.createStatement().execute(ddl);
 
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (1, 8, 1, 3)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (2, 8, 2, 7)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (3, 8, 3, 9)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (5, 8, 4, 2)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (4, 8, 5, 4)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (1, 8, 1, 3)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (2, 8, 2, 7)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (3, 8, 3, 9)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (5, 8, 4, 2)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (4, 8, 5, 4)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName + " GROUP BY page_id"
+                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName + " GROUP BY page_id"
         );
         assertTrue(rs.next());
         assertEquals(rs.getInt(1), 4);
@@ -171,18 +171,18 @@ public class LastValueFunctionIT extends 
ParallelStatsDisabledIT {
 
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName 
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG, "
-                + "date CHAR(3), \"value\" CHAR(3))";
+                + "\"DATE\" CHAR(3), \"value\" CHAR(3))";
         conn.createStatement().execute(ddl);
 
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (1, 8, '1', '300')");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (2, 8, '2', '7')");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (3, 8, '3', '9')");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (5, 8, '4', '2')");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (4, 8, '5', '400')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (1, 8, '1', '300')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (2, 8, '2', '7')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (3, 8, '3', '9')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (5, 8, '4', '2')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (4, 8, '5', '400')");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName + " GROUP BY page_id");
+                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName + " GROUP BY page_id");
 
         assertTrue(rs.next());
         assertEquals(rs.getString(1), "400");
@@ -196,18 +196,18 @@ public class LastValueFunctionIT extends 
ParallelStatsDisabledIT {
 
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName 
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date VARCHAR, \"value\" VARCHAR)";
+                + " \"DATE\" VARCHAR, \"value\" VARCHAR)";
         conn.createStatement().execute(ddl);
 
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (1, 8, '1', '3')");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (2, 8, '2', '7')");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (3, 8, '3', '9')");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (5, 8, '4', '2')");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (4, 8, '5', '4')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (1, 8, '1', '3')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (2, 8, '2', '7')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (3, 8, '3', '9')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (5, 8, '4', '2')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (4, 8, '5', '4')");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName + " GROUP BY page_id");
+                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName + " GROUP BY page_id");
 
         assertTrue(rs.next());
         assertEquals(rs.getString(1), "4");
@@ -221,27 +221,27 @@ public class LastValueFunctionIT extends 
ParallelStatsDisabledIT {
 
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName 
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date UNSIGNED_INT, \"value\" UNSIGNED_INT)";
+                + " \"DATE\" UNSIGNED_INT, \"value\" UNSIGNED_INT)";
         conn.createStatement().execute(ddl);
 
         //first page_id
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (1, 8, 1, 3)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (2, 8, 2, 7)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (3, 8, 3, 9)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (5, 8, 4, 2)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (4, 8, 5, 4)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (1, 8, 1, 3)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (2, 8, 2, 7)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (3, 8, 3, 9)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (5, 8, 4, 2)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (4, 8, 5, 4)");
 
         //second page_id
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (11, 9, 1, 3)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (12, 9, 2, 7)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (13, 9, 3, 9)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (15, 9, 4, 2)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (14, 9, 5, 40)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (11, 9, 1, 3)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (12, 9, 2, 7)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (13, 9, 3, 9)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (15, 9, 4, 2)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (14, 9, 5, 40)");
 
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName + " GROUP BY page_id");
+                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName + " GROUP BY page_id");
 
         assertTrue(rs.next());
         assertEquals(rs.getInt(1), 4);
@@ -258,18 +258,18 @@ public class LastValueFunctionIT extends 
ParallelStatsDisabledIT {
 
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName 
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date UNSIGNED_INT, \"value\" UNSIGNED_INT)";
+                + " \"DATE\" UNSIGNED_INT, \"value\" UNSIGNED_INT)";
         conn.createStatement().execute(ddl);
 
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date) VALUES (1, 8, 1)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date) VALUES (2, 8, 2)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date) VALUES (3, 8, 3)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date) VALUES (5, 8, 4)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date) VALUES (4, 8, 5)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\") VALUES (1, 8, 1)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\") VALUES (2, 8, 2)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\") VALUES (3, 8, 3)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\") VALUES (5, 8, 4)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\") VALUES (4, 8, 5)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName + " GROUP BY page_id");
+                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName + " GROUP BY page_id");
 
         assertTrue(rs.next());
         byte[] nothing = rs.getBytes(1);
@@ -283,19 +283,19 @@ public class LastValueFunctionIT extends 
ParallelStatsDisabledIT {
 
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName 
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date UNSIGNED_INT, \"value\" UNSIGNED_INT)";
+                + " \"DATE\" UNSIGNED_INT, \"value\" UNSIGNED_INT)";
         conn.createStatement().execute(ddl);
 
         //first page_id
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date) VALUES (1, 8, 1)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date) VALUES (2, 8, 2)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date) VALUES (3, 8, 3)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date) VALUES (5, 8, 4)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date) VALUES (4, 8, 5)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\") VALUES (1, 8, 1)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\") VALUES (2, 8, 2)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\") VALUES (3, 8, 3)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\") VALUES (5, 8, 4)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\") VALUES (4, 8, 5)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
FROM " + tableName + " GROUP BY page_id");
+                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM " + tableName + " GROUP BY page_id");
 
         assertTrue(rs.next());
         byte[] nothing = rs.getBytes(1);
@@ -309,27 +309,27 @@ public class LastValueFunctionIT extends 
ParallelStatsDisabledIT {
 
         String ddl = "CREATE TABLE IF NOT EXISTS " + tableName 
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_INT,"
-                + " date UNSIGNED_INT, \"value\" UNSIGNED_INT)";
+                + " \"DATE\" UNSIGNED_INT, \"value\" UNSIGNED_INT)";
         conn.createStatement().execute(ddl);
 
         //first page
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (1, 8, 1, 3)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (2, 8, 2, 7)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (3, 8, 3, 9)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (5, 8, 4, 2)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (4, 8, 5, 5)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (1, 8, 1, 3)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (2, 8, 2, 7)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (3, 8, 3, 9)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (5, 8, 4, 2)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (4, 8, 5, 5)");
 
         //second page
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (5, 2, 1, 3)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (6, 2, 2, 7)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (7, 2, 3, 9)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (8, 2, 4, 2)");
-        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, date, \"value\") VALUES (9, 2, 5, 4)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (5, 2, 1, 3)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (6, 2, 2, 7)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (7, 2, 3, 9)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (8, 2, 4, 2)");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " (id, 
page_id, \"DATE\", \"value\") VALUES (9, 2, 5, 4)");
 
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY date ASC) 
AS val "
+                "SELECT LAST_VALUE(\"value\") WITHIN GROUP (ORDER BY \"DATE\" 
ASC) AS val "
                 + "FROM " + tableName + " GROUP BY page_id ORDER BY val DESC");
 
         assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/NthValueFunctionIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NthValueFunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NthValueFunctionIT.java
index c5cdf89..1278e26 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NthValueFunctionIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NthValueFunctionIT.java
@@ -68,25 +68,25 @@ public class NthValueFunctionIT extends 
ParallelStatsDisabledIT {
 
         String ddl = "CREATE TABLE IF NOT EXISTS " + nth_test_table + " "
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date INTEGER, \"value\" UNSIGNED_LONG)";
+                + " \"DATE\" INTEGER, \"value\" UNSIGNED_LONG)";
         conn.createStatement().execute(ddl);
 
         conn.createStatement().execute("UPSERT INTO " + nth_test_table
-            + " (id, page_id, date, \"value\") VALUES (1, 8, 0, 300)");
+            + " (id, page_id, \"DATE\", \"value\") VALUES (1, 8, 0, 300)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (2, 8, 1, 7)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (2, 8, 1, 7)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (3, 8, 2, 9)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (3, 8, 2, 9)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (4, 8, 3, 4)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (4, 8, 3, 4)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (5, 8, 4, 2)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (5, 8, 4, 2)");
         conn.createStatement().execute("UPSERT INTO " + nth_test_table
-            + " (id, page_id, date, \"value\") VALUES (6, 8, 5, 150)");
+            + " (id, page_id, \"DATE\", \"value\") VALUES (6, 8, 5, 150)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT NTH_VALUE(\"value\", 2)  WITHIN GROUP (ORDER BY date ASC) 
FROM "
+            "SELECT NTH_VALUE(\"value\", 2)  WITHIN GROUP (ORDER BY \"DATE\" 
ASC) FROM "
                 + nth_test_table + " GROUP BY page_id");
 
         assertTrue(rs.next());
@@ -101,25 +101,25 @@ public class NthValueFunctionIT extends 
ParallelStatsDisabledIT {
         String nth_test_table = generateUniqueName();
         String ddl = "CREATE TABLE IF NOT EXISTS " + nth_test_table + " "
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date INTEGER, \"value\" UNSIGNED_LONG)";
+                + " \"DATE\" INTEGER, \"value\" UNSIGNED_LONG)";
         conn.createStatement().execute(ddl);
 
         conn.createStatement().execute("UPSERT INTO " + nth_test_table
-            + " (id, page_id, date, \"value\") VALUES (1, 8, 0, 300)");
+            + " (id, page_id, \"DATE\", \"value\") VALUES (1, 8, 0, 300)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (2, 8, 1, 7)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (2, 8, 1, 7)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (3, 8, 2, 9)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (3, 8, 2, 9)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (4, 8, 3, 4)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (4, 8, 3, 4)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (5, 8, 4, 2)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (5, 8, 4, 2)");
         conn.createStatement().execute("UPSERT INTO " + nth_test_table
-            + " (id, page_id, date, \"value\") VALUES (6, 8, 5, 150)");
+            + " (id, page_id, \"DATE\", \"value\") VALUES (6, 8, 5, 150)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT NTH_VALUE(\"value\", 2)  WITHIN GROUP (ORDER BY date DESC) 
FROM "
+            "SELECT NTH_VALUE(\"value\", 2)  WITHIN GROUP (ORDER BY \"DATE\" 
DESC) FROM "
                 + nth_test_table + " GROUP BY page_id");
 
         assertTrue(rs.next());
@@ -134,25 +134,25 @@ public class NthValueFunctionIT extends 
ParallelStatsDisabledIT {
         String nth_test_table = generateUniqueName();
         String ddl = "CREATE TABLE IF NOT EXISTS " + nth_test_table + " "
                 + "(id INTEGER NOT NULL PRIMARY KEY, page_id UNSIGNED_LONG,"
-                + " date INTEGER, \"value\" UNSIGNED_LONG)";
+                + " \"DATE\" INTEGER, \"value\" UNSIGNED_LONG)";
         conn.createStatement().execute(ddl);
 
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (1, 8, 5, 8)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (1, 8, 5, 8)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (2, 8, 2, 7)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (2, 8, 2, 7)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (3, 8, 1, 9)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (3, 8, 1, 9)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (4, 8, 4, 4)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (4, 8, 4, 4)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (5, 8, 3, 2)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (5, 8, 3, 2)");
         conn.createStatement().execute(
-            "UPSERT INTO " + nth_test_table + " (id, page_id, date, \"value\") 
VALUES (6, 8, 0, 1)");
+            "UPSERT INTO " + nth_test_table + " (id, page_id, \"DATE\", 
\"value\") VALUES (6, 8, 0, 1)");
         conn.commit();
 
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT NTH_VALUE(\"value\", 2)  WITHIN GROUP (ORDER BY date DESC) 
FROM "
+            "SELECT NTH_VALUE(\"value\", 2)  WITHIN GROUP (ORDER BY \"DATE\" 
DESC) FROM "
                 + nth_test_table + " GROUP BY page_id");
 
         assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
index 07dd101..17c854a 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ProductMetricsIT.java
@@ -118,7 +118,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
             "upsert into " +
             "PRODUCT_METRICS(" +
             "    ORGANIZATION_ID, " +
-            "    DATE, " +
+            "    \"DATE\", " +
             "    FEATURE, " +
             "    UNIQUE_USERS, " +
             "    TRANSACTIONS, " +
@@ -218,7 +218,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
             "upsert into " +
             "PRODUCT_METRICS(" +
             "    ORGANIZATION_ID, " +
-            "    DATE, " +
+            "    \"DATE\", " +
             "    FEATURE, " +
             "    UNIQUE_USERS, " +
             "    TRANSACTIONS, " +
@@ -303,7 +303,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testDateRangeAggregation() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT count(1), feature f FROM PRODUCT_METRICS WHERE 
organization_id=? AND date >= to_date(?) AND date <= to_date(?) GROUP BY f";
+        String query = "SELECT count(1), feature f FROM PRODUCT_METRICS WHERE 
organization_id=? AND \"DATE\" >= to_date(?) AND \"DATE\" <= to_date(?) GROUP 
BY f";
         //String query = "SELECT count(1), feature FROM PRODUCT_METRICS GROUP 
BY feature";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
@@ -351,7 +351,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testPartiallyEvaluableAnd() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT date FROM PRODUCT_METRICS WHERE 
organization_id=? AND unique_users >= 30 AND transactions >= 300 AND 
cpu_utilization > 2 AND db_utilization > 0.5 AND io_time = 4000";
+        String query = "SELECT \"DATE\" FROM PRODUCT_METRICS WHERE 
organization_id=? AND unique_users >= 30 AND transactions >= 300 AND 
cpu_utilization > 2 AND db_utilization > 0.5 AND io_time = 4000";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -372,7 +372,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testPartiallyEvaluableOr() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT date FROM PRODUCT_METRICS WHERE 
organization_id=? AND (transactions = 10000 OR unset_column = 5 OR io_time = 
4000)";
+        String query = "SELECT \"DATE\" FROM PRODUCT_METRICS WHERE 
organization_id=? AND (transactions = 10000 OR unset_column = 5 OR io_time = 
4000)";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -393,7 +393,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testConstantTrueHaving() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT count(1), feature FROM PRODUCT_METRICS WHERE 
organization_id=? AND date >= to_date(?) AND date <= to_date(?) GROUP BY 
feature HAVING 1=1";
+        String query = "SELECT count(1), feature FROM PRODUCT_METRICS WHERE 
organization_id=? AND \"DATE\" >= to_date(?) AND \"DATE\" <= to_date(?) GROUP 
BY feature HAVING 1=1";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -420,7 +420,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testConstantFalseHaving() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT count(1), feature FROM PRODUCT_METRICS WHERE 
organization_id=? AND date >= to_date(?) AND date <= to_date(?) GROUP BY 
feature HAVING 1=1 and 0=1";
+        String query = "SELECT count(1), feature FROM PRODUCT_METRICS WHERE 
organization_id=? AND \"DATE\" >= to_date(?) AND \"DATE\" <= to_date(?) GROUP 
BY feature HAVING 1=1 and 0=1";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -441,7 +441,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testDateRangeHavingAggregation() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT count(1), feature FROM PRODUCT_METRICS WHERE 
organization_id=? AND date >= to_date(?) AND date <= to_date(?) GROUP BY 
feature HAVING count(1) >= 2";
+        String query = "SELECT count(1), feature FROM PRODUCT_METRICS WHERE 
organization_id=? AND \"DATE\" >= to_date(?) AND \"DATE\" <= to_date(?) GROUP 
BY feature HAVING count(1) >= 2";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -465,7 +465,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testDateRangeSumLongAggregation() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT sum(transactions), feature FROM PRODUCT_METRICS 
WHERE organization_id=? AND date >= to_date(?) AND date <= to_date(?) GROUP BY 
feature";
+        String query = "SELECT sum(transactions), feature FROM PRODUCT_METRICS 
WHERE organization_id=? AND \"DATE\" >= to_date(?) AND \"DATE\" <= to_date(?) 
GROUP BY feature";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -492,7 +492,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testRoundAggregation() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT round(date,'hour',1) r,count(1) FROM 
PRODUCT_METRICS WHERE organization_id=? GROUP BY r";
+        String query = "SELECT round(\"DATE\",'hour',1) r,count(1) FROM 
PRODUCT_METRICS WHERE organization_id=? GROUP BY r";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -532,7 +532,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testRoundScan() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT round(date,'hour') FROM PRODUCT_METRICS WHERE 
organization_id=?";
+        String query = "SELECT round(\"DATE\",'hour') FROM PRODUCT_METRICS 
WHERE organization_id=?";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -575,7 +575,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testTruncAggregation() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT trunc(date,'hour'),count(1) FROM 
PRODUCT_METRICS WHERE organization_id=? GROUP BY trunc(date,'hour')";
+        String query = "SELECT trunc(\"DATE\",'hour'),count(1) FROM 
PRODUCT_METRICS WHERE organization_id=? GROUP BY trunc(\"DATE\",'hour')";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -729,7 +729,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testMultiDimRoundAggregation() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT round(date,'hour',1),feature,sum(unique_users) 
FROM PRODUCT_METRICS WHERE organization_id=? GROUP BY 
round(date,'hour',1),feature";
+        String query = "SELECT 
round(\"DATE\",'hour',1),feature,sum(unique_users) FROM PRODUCT_METRICS WHERE 
organization_id=? GROUP BY round(\"DATE\",'hour',1),feature";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -780,7 +780,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testDateRangeSumNumberUngroupedAggregation() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT sum(cpu_utilization) FROM PRODUCT_METRICS WHERE 
organization_id=? AND date >= to_date(?) AND date <= to_date(?)";
+        String query = "SELECT sum(cpu_utilization) FROM PRODUCT_METRICS WHERE 
organization_id=? AND \"DATE\" >= to_date(?) AND \"DATE\" <= to_date(?)";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -842,7 +842,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
                     "upsert into " +
                     "PRODUCT_METRICS(" +
                     "    ORGANIZATION_ID, " +
-                    "    DATE, " +
+                    "    \"DATE\", " +
                     "    FEATURE, " +
                     "    UNIQUE_USERS," +
                     "    TRANSACTIONS) " +
@@ -1208,7 +1208,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testDegenerateAggregation() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT count(1), feature FROM PRODUCT_METRICS WHERE 
organization_id=? AND date >= to_date(?) AND date <= to_date(?) GROUP BY 
feature";
+        String query = "SELECT count(1), feature FROM PRODUCT_METRICS WHERE 
organization_id=? AND \"DATE\" >= to_date(?) AND \"DATE\" <= to_date(?) GROUP 
BY feature";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1234,7 +1234,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testFeatureDateRangeAggregation() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT feature,unique_users FROM PRODUCT_METRICS WHERE 
organization_id=? AND date >= to_date(?) AND feature > ?";
+        String query = "SELECT feature,unique_users FROM PRODUCT_METRICS WHERE 
organization_id=? AND \"DATE\" >= to_date(?) AND feature > ?";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1402,7 +1402,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
         initTableValues(tenantId, getSplits(tenantId), ts);
-        String query = "SELECT date, transactions t FROM PRODUCT_METRICS WHERE 
organization_id=? AND unique_users <= 30 ORDER BY t DESC LIMIT 2";
+        String query = "SELECT \"DATE\", transactions t FROM PRODUCT_METRICS 
WHERE organization_id=? AND unique_users <= 30 ORDER BY t DESC LIMIT 2";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
 
@@ -1451,7 +1451,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testOrderByGroupedAggregation() throws Exception {        
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT feature,sum(unique_users) 
s,count(feature),round(date,'hour',1) r " +
+        String query = "SELECT feature,sum(unique_users) 
s,count(feature),round(\"DATE\",'hour',1) r " +
                        "FROM PRODUCT_METRICS " + 
                        "WHERE organization_id=? " +
                        "GROUP BY feature, r " +
@@ -1593,7 +1593,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testFilterOnTrailingKeyColumn2() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT organization_id, date, feature FROM 
PRODUCT_METRICS WHERE substr(organization_id,1,3)=? AND date > to_date(?)";
+        String query = "SELECT organization_id, \"DATE\", feature FROM 
PRODUCT_METRICS WHERE substr(organization_id,1,3)=? AND \"DATE\" > to_date(?)";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1621,7 +1621,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testSubstringNotEqual() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT organization_id, date, feature FROM 
PRODUCT_METRICS WHERE organization_id=? AND date > to_date(?)";
+        String query = "SELECT organization_id, \"DATE\", feature FROM 
PRODUCT_METRICS WHERE organization_id=? AND \"DATE\" > to_date(?)";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1641,7 +1641,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testKeyOrderedAggregation1() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT date, sum(UNIQUE_USERS) FROM PRODUCT_METRICS 
WHERE date > to_date(?) GROUP BY organization_id, date";
+        String query = "SELECT \"DATE\", sum(UNIQUE_USERS) FROM 
PRODUCT_METRICS WHERE \"DATE\" > to_date(?) GROUP BY organization_id, \"DATE\"";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1666,7 +1666,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testKeyOrderedAggregation2() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT date, sum(UNIQUE_USERS) FROM PRODUCT_METRICS 
WHERE date < to_date(?) GROUP BY organization_id, date";
+        String query = "SELECT \"DATE\", sum(UNIQUE_USERS) FROM 
PRODUCT_METRICS WHERE \"DATE\" < to_date(?) GROUP BY organization_id, \"DATE\"";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1694,7 +1694,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testKeyOrderedRoundAggregation1() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT round(date,'HOUR'), sum(UNIQUE_USERS) FROM 
PRODUCT_METRICS WHERE date < to_date(?) GROUP BY organization_id, 
round(date,'HOUR')";
+        String query = "SELECT round(\"DATE\",'HOUR'), sum(UNIQUE_USERS) FROM 
PRODUCT_METRICS WHERE \"DATE\" < to_date(?) GROUP BY organization_id, 
round(\"DATE\",'HOUR')";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1719,7 +1719,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testKeyOrderedRoundAggregation2() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT round(date,'HOUR'), sum(UNIQUE_USERS) FROM 
PRODUCT_METRICS WHERE date <= to_date(?) GROUP BY organization_id, 
round(date,'HOUR')";
+        String query = "SELECT round(\"DATE\",'HOUR'), sum(UNIQUE_USERS) FROM 
PRODUCT_METRICS WHERE \"DATE\" <= to_date(?) GROUP BY organization_id, 
round(\"DATE\",'HOUR')";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1744,7 +1744,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testEqualsRound() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and trunc(date,'DAY')=?"; 
+        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and trunc(\"DATE\",'DAY')=?";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1768,7 +1768,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testDateSubtractionCompareNumber() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and ? - date > 3"; 
+        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and ? - \"DATE\" > 3";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1794,7 +1794,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testDateSubtractionLongToDecimalCompareNumber() throws 
Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and ? - date - 1.5 > 3"; 
+        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and ? - \"DATE\" - 1.5 > 3";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1872,7 +1872,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testCurrentDate() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and date - current_date() > 8"; 
+        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and \"DATE\" - current_date() > 8";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1894,7 +1894,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testCurrentTime() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and date - current_time() > 8"; 
+        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and \"DATE\" - current_time() > 8";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1916,7 +1916,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
     public void testTruncateNotTraversableToFormScanKey() throws Exception {
         long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and TRUNC(date,'DAY') <= ?"; 
+        String query = "SELECT feature FROM PRODUCT_METRICS WHERE 
organization_id = ? and TRUNC(\"DATE\",'DAY') <= ?";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1959,7 +1959,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
         long ts = nextTimestamp();
         String ddl = "create table " + PRODUCT_METRICS_NAME +
         "   (organization_id char(15) not null," +
-        "    date date not null," +
+        "    \"DATE\" date not null," +
         "    feature char(1) not null," +
         "    unique_users integer not null,\n" +
         "    db_utilization decimal(31,10),\n" +
@@ -1969,7 +1969,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
         "    io_time bigint,\n" +
         "    region varchar,\n" +
         "    unset_column decimal(31,10)\n" +
-        "    CONSTRAINT pk PRIMARY KEY (organization_id, date, feature, 
unique_users)) salt_buckets=3";
+        "    CONSTRAINT pk PRIMARY KEY (organization_id, \"DATE\", feature, 
unique_users)) salt_buckets=3";
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts-1); // Run query at timestamp 5
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(url, props);
@@ -1998,7 +1998,7 @@ public class ProductMetricsIT extends 
BaseClientManagedTimeIT {
             assertTrue(rs.next());
             assertEquals(18, rs.getLong(1));
             
-            statement = conn.prepareStatement("SELECT date FROM 
PRODUCT_METRICS WHERE organization_id = ?  order by date desc limit 10");
+            statement = conn.prepareStatement("SELECT \"DATE\" FROM 
PRODUCT_METRICS WHERE organization_id = ?  order by \"DATE\" desc limit 10");
             statement.setString(1, tenantId);
             rs = statement.executeQuery();
             Date date = null;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
index 9399900..041e96d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryMoreIT.java
@@ -348,11 +348,11 @@ public class QueryMoreIT extends ParallelStatsDisabledIT {
         try (Statement stmt = conn.createStatement()) {
             assertFalse(stmt.execute("CREATE TABLE IF NOT EXISTS " + table + " 
(\n" +
                 "PK VARCHAR(15) NOT NULL\n," +
-                "DEC DECIMAL,\n" +
+                "\"DEC\" DECIMAL,\n" +
                 "CONSTRAINT TABLE_PK PRIMARY KEY (PK))"));
         }
 
-        try (PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + 
table + " (PK, DEC) VALUES(?, ?)")) {
+        try (PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + 
table + " (PK, \"DEC\") VALUES(?, ?)")) {
             stmt.setString(1, "key");
             stmt.setBigDecimal(2, null);
             assertFalse(stmt.execute());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFuncIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFuncIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFuncIT.java
index 9961199..423876f 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFuncIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFuncIT.java
@@ -71,7 +71,7 @@ public class RoundFloorCeilFuncIT extends 
ParallelStatsDisabledIT {
         try {
             conn = DriverManager.getConnection(getUrl());
             String ddl = "CREATE TABLE IF NOT EXISTS " + tableName
-                + " (s VARCHAR NOT NULL PRIMARY KEY, dt DATE, t TIME, ts 
TIMESTAMP, dec DECIMAL, doub DOUBLE, undoub UNSIGNED_DOUBLE, fl FLOAT, unfl 
UNSIGNED_FLOAT)";
+                + " (s VARCHAR NOT NULL PRIMARY KEY, dt DATE, t TIME, ts 
TIMESTAMP, \"DEC\" DECIMAL, doub DOUBLE, undoub UNSIGNED_DOUBLE, fl FLOAT, unfl 
UNSIGNED_FLOAT)";
             conn.createStatement().execute(ddl);
             
             Date dateUpserted = DateUtil.parseDate("2012-01-01 14:25:28");
@@ -369,7 +369,7 @@ public class RoundFloorCeilFuncIT extends 
ParallelStatsDisabledIT {
     public void testRoundingUpDecimal() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT ROUND(dec), ROUND(dec, 1), ROUND(dec, 2), ROUND(dec, 3) 
FROM " + tableName);
+            "SELECT ROUND(\"DEC\"), ROUND(\"DEC\", 1), ROUND(\"DEC\", 2), 
ROUND(\"DEC\", 3) FROM " + tableName);
         assertTrue(rs.next());
         BigDecimal expectedBd = BigDecimal.valueOf(1);
         assertEquals(expectedBd, rs.getBigDecimal(1));
@@ -385,7 +385,7 @@ public class RoundFloorCeilFuncIT extends 
ParallelStatsDisabledIT {
     public void testRoundingUpDecimalInWhere() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT * FROM " + tableName + " WHERE ROUND(dec, 2) = 1.26");
+            "SELECT * FROM " + tableName + " WHERE ROUND(\"DEC\", 2) = 1.26");
         assertTrue(rs.next());
     }
     
@@ -393,7 +393,7 @@ public class RoundFloorCeilFuncIT extends 
ParallelStatsDisabledIT {
     public void testFloorDecimal() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT FLOOR(dec), FLOOR(dec, 1), FLOOR(dec, 2), FLOOR(dec, 3) 
FROM " + tableName);
+            "SELECT FLOOR(\"DEC\"), FLOOR(\"DEC\", 1), FLOOR(\"DEC\", 2), 
FLOOR(\"DEC\", 3) FROM " + tableName);
         assertTrue(rs.next());
         BigDecimal expectedBd = BigDecimal.valueOf(1);
         assertEquals(expectedBd, rs.getBigDecimal(1));
@@ -409,7 +409,7 @@ public class RoundFloorCeilFuncIT extends 
ParallelStatsDisabledIT {
     public void testFloorDecimalInWhere() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT * FROM " + tableName + " WHERE FLOOR(dec, 2) = 1.26");
+            "SELECT * FROM " + tableName + " WHERE FLOOR(\"DEC\", 2) = 1.26");
         assertTrue(rs.next());
     }
     
@@ -417,7 +417,7 @@ public class RoundFloorCeilFuncIT extends 
ParallelStatsDisabledIT {
     public void testCeilDecimal() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT CEIL(dec), CEIL(dec, 1), CEIL(dec, 2), CEIL(dec, 3) FROM " 
+ tableName);
+            "SELECT CEIL(\"DEC\"), CEIL(\"DEC\", 1), CEIL(\"DEC\", 2), 
CEIL(\"DEC\", 3) FROM " + tableName);
         assertTrue(rs.next());
         BigDecimal expectedBd = BigDecimal.valueOf(2);
         assertEquals(expectedBd, rs.getBigDecimal(1));
@@ -433,7 +433,7 @@ public class RoundFloorCeilFuncIT extends 
ParallelStatsDisabledIT {
     public void testCeilDecimalInWhere() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT * FROM " + tableName + " WHERE CEIL(dec, 2) = 1.27");
+            "SELECT * FROM " + tableName + " WHERE CEIL(\"DEC\", 2) = 1.27");
         assertTrue(rs.next());
     }
     @Test
@@ -452,7 +452,7 @@ public class RoundFloorCeilFuncIT extends 
ParallelStatsDisabledIT {
        public void testRoundingUpDoubleInWhere() throws Exception {
                Connection conn = DriverManager.getConnection(getUrl());
                ResultSet rs = conn.createStatement().executeQuery(
-        "SELECT * FROM " + tableName + " WHERE ROUND(dec, 2) = 1.26");
+        "SELECT * FROM " + tableName + " WHERE ROUND(\"DEC\", 2) = 1.26");
                assertTrue(rs.next());
        }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/fd1dac0d/phoenix-core/src/it/java/org/apache/phoenix/end2end/SignFunctionEnd2EndIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SignFunctionEnd2EndIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SignFunctionEnd2EndIT.java
index e3458dd..94b9f42 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SignFunctionEnd2EndIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SignFunctionEnd2EndIT.java
@@ -51,7 +51,7 @@ public class SignFunctionEnd2EndIT extends 
ParallelStatsDisabledIT {
             conn = DriverManager.getConnection(getUrl());
             String ddl;
             ddl = "CREATE TABLE " + signedTableName
-                + " (k VARCHAR NOT NULL PRIMARY KEY, dec DECIMAL, doub DOUBLE, 
fl FLOAT, inte INTEGER, lon BIGINT, smalli SMALLINT, tinyi TINYINT)";
+                + " (k VARCHAR NOT NULL PRIMARY KEY, \"DEC\" DECIMAL, doub 
DOUBLE, fl FLOAT, inte INTEGER, lon BIGINT, smalli SMALLINT, tinyi TINYINT)";
             conn.createStatement().execute(ddl);
             ddl = "CREATE TABLE " + unsignedTableName
                 + " (k VARCHAR NOT NULL PRIMARY KEY, doub UNSIGNED_DOUBLE, fl 
UNSIGNED_FLOAT, inte UNSIGNED_INT, lon UNSIGNED_LONG, smalli UNSIGNED_SMALLINT, 
tinyi UNSIGNED_TINYINT)";
@@ -96,7 +96,7 @@ public class SignFunctionEnd2EndIT extends 
ParallelStatsDisabledIT {
     private void testSignedNumberSpec(Connection conn, double data, int 
expected) throws Exception {
         updateSignedTable(conn, data);
         ResultSet rs = conn.createStatement().executeQuery(
-            "SELECT 
SIGN(dec),SIGN(doub),SIGN(fl),SIGN(inte),SIGN(lon),SIGN(smalli),SIGN(tinyi) 
FROM "
+            "SELECT 
SIGN(\"DEC\"),SIGN(doub),SIGN(fl),SIGN(inte),SIGN(lon),SIGN(smalli),SIGN(tinyi) 
FROM "
                 + signedTableName);
         assertTrue(rs.next());
         for (int i = 1; i <= 7; ++i) {
@@ -105,7 +105,7 @@ public class SignFunctionEnd2EndIT extends 
ParallelStatsDisabledIT {
         assertTrue(!rs.next());
 
         PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + 
signedTableName
-            + " WHERE SIGN(dec)=? AND SIGN(doub)=? AND SIGN(fl)=? AND 
SIGN(inte)=? AND SIGN(lon)=? AND SIGN(smalli)=? AND SIGN(tinyi)=?");
+            + " WHERE SIGN(\"DEC\")=? AND SIGN(doub)=? AND SIGN(fl)=? AND 
SIGN(inte)=? AND SIGN(lon)=? AND SIGN(smalli)=? AND SIGN(tinyi)=?");
         for (int i = 1; i <= 7; ++i)
             stmt.setInt(i, expected);
         rs = stmt.executeQuery();

Reply via email to