phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshb...@apache.org
Subject phoenix git commit: PHOENIX-3646 Fix issues with Split keys and Replace bind values with actual split keys in CREATE TABLE DDL in Phoenix-Calcite(Rajeshbabu)
Date Fri, 03 Feb 2017 16:53:04 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 496f376d2 -> d77bad2b3


PHOENIX-3646 Fix issues with Split keys and Replace bind values with actual split keys in
CREATE TABLE DDL in Phoenix-Calcite(Rajeshbabu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: d77bad2b37201f2859a8275da2b88f1fe5c238ea
Parents: 496f376
Author: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Authored: Fri Feb 3 22:35:32 2017 +0530
Committer: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Committed: Fri Feb 3 22:35:32 2017 +0530

----------------------------------------------------------------------
 .../phoenix/end2end/ExecuteStatementsIT.java    |  4 +-
 .../phoenix/end2end/ParallelIteratorsIT.java    | 15 +++---
 .../apache/phoenix/end2end/SkipScanQueryIT.java | 17 +++---
 .../end2end/index/IndexExpressionIT.java        | 36 +++++--------
 .../apache/phoenix/end2end/index/IndexIT.java   |  9 ++--
 .../phoenix/end2end/index/IndexMetadataIT.java  | 57 +++++++-------------
 .../phoenix/end2end/index/MutableIndexIT.java   |  5 +-
 .../phoenix/compile/QueryCompilerTest.java      |  6 +--
 .../phoenix/compile/QueryMetaDataTest.java      | 11 ----
 .../jdbc/PhoenixPreparedStatementTest.java      | 24 ---------
 .../java/org/apache/phoenix/query/BaseTest.java | 10 +---
 11 files changed, 61 insertions(+), 133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/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 78f46cc..c8c0d37 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
@@ -68,7 +68,7 @@ public class ExecuteStatementsIT extends ParallelStatsDisabledIT {
             "    \"DATE\" date not null,\n" +
             "    val decimal\n" +
             "    CONSTRAINT pk PRIMARY KEY (inst,host,\"DATE\"))\n" +
-            "    split on (?,?,?);\n" +
+            "    split on ('a','j','s');\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
@@ -80,7 +80,7 @@ public class ExecuteStatementsIT extends ParallelStatsDisabledIT {
         Date now = new Date(System.currentTimeMillis());
         Connection conn = DriverManager.getConnection(getUrl());
         conn.setAutoCommit(true);
-        List<Object> binds = Arrays.<Object>asList("a","j","s", 6);
+        List<Object> binds = Arrays.<Object>asList(6);
         int nStatements = PhoenixRuntime.executeStatements(conn, new StringReader(statements),
binds);
         assertEquals(7, nStatements);
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelIteratorsIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelIteratorsIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelIteratorsIT.java
index 5fc7d9e..717e7ac 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelIteratorsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/ParallelIteratorsIT.java
@@ -31,11 +31,12 @@ import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.Collections;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.compile.QueryPlan;
 import org.apache.phoenix.coprocessor.BaseScannerRegionObserver;
 import org.apache.phoenix.jdbc.PhoenixStatement;
@@ -216,12 +217,12 @@ public class ParallelIteratorsIT extends ParallelStatsEnabledIT {
     }
     
     private void createTable (Connection conn, byte[][] splits) throws SQLException {
-        PreparedStatement stmt = conn.prepareStatement("create table " + tableName +
-                "   (id char(1) not null primary key,\n" +
-                "    \"value\" integer) SPLIT ON (" + Joiner.on(',').join(Collections.nCopies(splits.length,
"?")) + ")");
-        for (int i = 0; i < splits.length; i++) {
-            stmt.setBytes(i+1, splits[i]);
+        List<String> splitsList = new ArrayList<String>(splits.length);
+        for(byte[] split : splits) {
+            splitsList.add("'" + Bytes.toString(split) + "'");
         }
-        stmt.execute();
+        conn.createStatement().execute("create table " + tableName +
+                "   (id char(1) not null primary key,\n" +
+                "    \"value\" integer) SPLIT ON (" + Joiner.on(',').join(splitsList) + ")");
     }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
index 0c5e3aa..c2de3b7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/SkipScanQueryIT.java
@@ -34,6 +34,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.util.TestUtil;
 import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.PropertiesUtil;
@@ -325,13 +326,15 @@ public class SkipScanQueryIT extends ParallelStatsDisabledIT {
     public void testSkipScanIntersectionAtEnd() throws Exception {
         Connection conn = DriverManager.getConnection(getUrl());
         String tableName = generateUniqueName();
-        PreparedStatement stmt = conn.prepareStatement("create table " + tableName 
-            + "(pk1 UNSIGNED_TINYINT NOT NULL, pk2 UNSIGNED_TINYINT NOT NULL, pk3 UNSIGNED_TINYINT
NOT NULL, kv VARCHAR "
-            + "CONSTRAINT pk PRIMARY KEY (pk1, pk2, pk3)) SPLIT ON (?, ?, ?)");
-        stmt.setBytes(1, new byte[] {1, 1});
-        stmt.setBytes(2, new byte[] {2, 1});
-        stmt.setBytes(3, new byte[] {3, 1});
-        stmt.execute();
+        conn.createStatement()
+                .execute(
+                    "create table "
+                            + tableName
+                            + "(pk1 UNSIGNED_TINYINT NOT NULL, pk2 UNSIGNED_TINYINT NOT NULL,
pk3 UNSIGNED_TINYINT NOT NULL, kv VARCHAR "
+                            + "CONSTRAINT pk PRIMARY KEY (pk1, pk2, pk3)) SPLIT ON ('"
+                            + Bytes.toString(new byte[] { 1, 1 }) + "', '"
+                            + Bytes.toString(new byte[] { 2, 1 }) + "', '"
+                            + Bytes.toString(new byte[] { 3, 1 }) + "')");
         
         conn.createStatement().execute("upsert into " + tableName + " values (0, 1, 1, 'a')");
         conn.createStatement().execute("upsert into " + tableName + " values (1, 1, 1, 'a')");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java
index 50548bd..383452f 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexExpressionIT.java
@@ -134,8 +134,7 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
                     + " ((UPPER(varchar_pk) || '_' || UPPER(char_pk) || '_' || UPPER(varchar_col1)
|| '_' || UPPER(b.char_col2)),"
                     + " (decimal_pk+int_pk+decimal_col2+int_col1)," + " date_pk+1, date1+1,
date2+1 )"
                     + " INCLUDE (long_col1, long_col2)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
 
             // run select query with expression in WHERE clause
             String whereSql = "SELECT long_col1, long_col2 from "
@@ -145,7 +144,7 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
                     // since a.date1 and b.date2 are NULLABLE and date is fixed width, these
expressions are stored as
                     // DECIMAL in the index (which is not fixed width)
                     + " AND date_pk+1=? AND date1+1=? AND date2+1=?";
-            stmt = conn.prepareStatement(whereSql);
+            PreparedStatement stmt = conn.prepareStatement(whereSql);
             stmt.setString(1, "VARCHAR1_CHAR1     _A.VARCHAR1_B.CHAR1   ");
             stmt.setInt(2, 3);
             Date date = DateUtil.parseDate("2015-01-02 00:00:00");
@@ -329,8 +328,7 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
             populateDataTable(conn, fullDataTableName);
             String ddl = "CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + indexName
+ " ON " + fullDataTableName
                     + " (2*long_col2)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
 
             ResultSet rs;
             rs = conn.createStatement().executeQuery("SELECT COUNT(*) FROM " + fullDataTableName);
@@ -403,8 +401,7 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
             populateDataTable(conn, fullDataTableName);
             String ddl = "CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + indexName
+ " ON " + fullDataTableName
                     + " (long_pk, varchar_pk, 1+long_pk, UPPER(varchar_pk) )" + " INCLUDE
(long_col1, long_col2)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
 
             ResultSet rs;
             rs = conn.createStatement().executeQuery("SELECT COUNT(*) FROM " + fullDataTableName);
@@ -484,8 +481,7 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
             populateDataTable(conn, fullDataTableName);
             String ddl = "CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + indexName
+ " ON " + fullDataTableName
                     + " (int_col1+int_col2)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
 
             String groupBySql = "SELECT (int_col1+int_col2), COUNT(*) FROM " + fullDataTableName
                     + " GROUP BY (int_col1+int_col2)";
@@ -540,8 +536,7 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
             populateDataTable(conn, fullDataTableName);
             String ddl = "CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + indexName
+ " ON " + fullDataTableName
                     + " (int_col1+1)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             String sql = "SELECT distinct int_col1+1 FROM " + fullDataTableName + " where
int_col1+1 > 0";
             ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + sql);
             String expectedPlan = "CLIENT PARALLEL 1-WAY RANGE SCAN OVER "
@@ -596,8 +591,7 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
             String ddl = "CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + indexName
+ " ON " + fullDataTableName
                     + " (int_col1+1)";
 
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             String sql = "SELECT int_col1+1 FROM " + fullDataTableName + " where int_col1+1
IN (2)";
             ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + sql);
             assertEquals("CLIENT PARALLEL 1-WAY RANGE SCAN OVER "
@@ -647,8 +641,7 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
             String ddl = "CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + indexName
+ " ON " + fullDataTableName
                     + " (int_col1+1)";
 
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             String sql = "SELECT int_col1+1 AS foo FROM " + fullDataTableName + " ORDER BY
foo";
             ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + sql);
             assertEquals("CLIENT PARALLEL 1-WAY "
@@ -700,13 +693,12 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
             ResultSet rs = conn.createStatement().executeQuery(query);
             assertFalse(rs.next());
             String ddl = "CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + indexName
+ " ON " + dataTableName + " (\"cf1\".\"V1\" || '_' || \"CF2\".\"v2\") INCLUDE (\"V1\",\"v2\")";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             query = "SELECT * FROM " + indexName;
             rs = conn.createStatement().executeQuery(query);
             assertFalse(rs.next());
 
-            stmt = conn.prepareStatement("UPSERT INTO " + dataTableName + " VALUES(?,?,?)");
+            PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + dataTableName
+ " VALUES(?,?,?)");
             stmt.setString(1,"a");
             stmt.setString(2, "x");
             stmt.setString(3, "1");
@@ -814,8 +806,7 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
 
             conn = DriverManager.getConnection(getUrl(), props);
             conn.setAutoCommit(false);
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             String sql = "SELECT int_col1+1, int_col2 FROM " + fullDataTableName + " WHERE
int_col1+1=2";
             ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + sql);
             assertEquals("CLIENT PARALLEL 1-WAY "
@@ -1356,13 +1347,12 @@ public class IndexExpressionIT extends ParallelStatsDisabledIT {
 			assertFalse(rs.next());
 			String ddl = "CREATE " + (localIndex ? "LOCAL" : "")
 					+ " INDEX " + indexName + " ON " + dataTableName + " (REGEXP_SUBSTR(v,'id:\\\\w+'))";
-			PreparedStatement stmt = conn.prepareStatement(ddl);
-			stmt.execute();
+			conn.createStatement().execute(ddl);
 			query = "SELECT * FROM " + indexName;
 			rs = conn.createStatement().executeQuery(query);
 			assertFalse(rs.next());
 
-			stmt = conn.prepareStatement("UPSERT INTO " + dataTableName + " VALUES(?,?)");
+			PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + dataTableName + " VALUES(?,?)");
 			stmt.setString(1, "k1");
 			stmt.setString(2, "{id:id1}");
 			stmt.execute();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexIT.java
index 48fe3e6..410dca5 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexIT.java
@@ -421,8 +421,7 @@ public class IndexIT extends ParallelStatsDisabledIT {
             stmt.execute(ddl);
             BaseTest.populateTestTable(fullTableName);
             ddl = "CREATE " + (localIndex ? "LOCAL" : "") + " INDEX " + indexName + " ON
" + fullTableName + " (int_col2)";
-            PreparedStatement pstmt = conn.prepareStatement(ddl);
-            pstmt.execute();
+            conn.createStatement().execute(ddl);
             ResultSet rs = conn.createStatement().executeQuery("SELECT distinct int_col2
FROM " + fullTableName + " where int_col2 > 0");
             assertTrue(rs.next());
             assertEquals(3, rs.getInt(1));
@@ -516,8 +515,7 @@ public class IndexIT extends ParallelStatsDisabledIT {
             TestUtil.createMultiCFTestTable(conn, fullTableName, tableDDLOptions);
             populateMultiCFTestTable(fullTableName, date);
             String ddl = "CREATE " + (localIndex ? " LOCAL " : "") + " INDEX " + indexName
+ " ON " + fullTableName + " (date_col)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
 
             String query = "SELECT int_pk from " + fullTableName ;
             ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + query);
@@ -1011,8 +1009,7 @@ public class IndexIT extends ParallelStatsDisabledIT {
             populateMultiCFTestTable(fullTableName, date);
             String ddl = null;
             ddl = "CREATE " + (localIndex ? "LOCAL " : "") + "INDEX " + indexName + " ON
" + fullTableName + " (decimal_pk) INCLUDE (decimal_col1, decimal_col2)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
 
             query = "SELECT decimal_pk, decimal_col1, decimal_col2 from " + fullTableName
;
             rs = conn.createStatement().executeQuery("EXPLAIN " + query);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
index 63a6bd6..fd6703e 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/IndexMetadataIT.java
@@ -133,8 +133,7 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
             String ddl = "CREATE INDEX " + indexName + " ON " + fullIndexDataTable
                     + " (varchar_col1 ASC, varchar_col2 ASC, int_pk DESC)"
                     + " INCLUDE (int_col1, int_col2)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             
             // Verify the metadata for index is correct.
             ResultSet rs = conn.getMetaData().getIndexInfo(null, INDEX_DATA_SCHEMA, indexDataTable,
false, false);
@@ -231,8 +230,7 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
             assertFalse(rs.next());
 
             ddl = "DROP INDEX " + indexName + " ON " + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR
+ indexDataTable;
-            stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             
             assertNoActiveIndex(conn, INDEX_DATA_SCHEMA, indexDataTable);
 
@@ -249,14 +247,12 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
             ddl = "CREATE INDEX " + indexName + "1 ON " + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR
+ indexDataTable
                     + " (varchar_col1 ASC, varchar_col2 ASC, int_pk DESC)"
                     + " INCLUDE (int_col1, int_col2)";
-            stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             
             ddl = "CREATE INDEX " + indexName + "2 ON " + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR
+ indexDataTable
                     + " (varchar_col1 ASC, varchar_col2 ASC, int_pk DESC)"
                     + " INCLUDE (long_pk, int_col2)";
-            stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             rs = conn.getMetaData().getIndexInfo(null, INDEX_DATA_SCHEMA, indexDataTable,
false, false);
             assertIndexInfoMetadata(rs, INDEX_DATA_SCHEMA, indexDataTable, indexName + "1",
1, "A:VARCHAR_COL1", Order.ASC);
             assertIndexInfoMetadata(rs, INDEX_DATA_SCHEMA, indexDataTable, indexName + "1",
2, "B:VARCHAR_COL2", Order.ASC);
@@ -290,8 +286,7 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
                 
             }
             ddl = "DROP TABLE " + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + indexDataTable;
-            stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             
             rs = conn.getMetaData().getIndexInfo(null, INDEX_DATA_SCHEMA, indexDataTable,
false, false);
             assertFalse(rs.next());
@@ -319,8 +314,7 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
             String ddl = "CREATE INDEX " + indexName + " ON " + fullTableName
                     + " (char_col1 ASC, int_col2 ASC, long_col2 DESC)"
                     + " INCLUDE (int_col1)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             
             // Verify the CHAR, INT and LONG are converted to right type.
             ResultSet rs = conn.getMetaData().getIndexInfo(null, INDEX_DATA_SCHEMA, indexDataTable,
false, false);
@@ -351,8 +345,7 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
             assertFalse(rs.next());
             
             ddl = "DROP INDEX " + indexName + " ON " + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR
+ indexDataTable;
-            stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             
             // Assert the rows for index table is completely removed.
             rs = conn.getMetaData().getIndexInfo(null, INDEX_DATA_SCHEMA, indexDataTable,
false, false);
@@ -380,8 +373,7 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
             String ddl = "CREATE INDEX " + indexName + " ON " + fullTableName
                     + " (char_col1 ASC, int_col2 ASC, long_col2 DESC)"
                     + " INCLUDE (int_col1)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
 
             ddl = "ALTER INDEX " + indexName + " ON " + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR
+ indexDataTable + " UNUSABLE";
             conn.createStatement().execute(ddl);
@@ -391,8 +383,7 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
             assertEquals("lowerCaseIndex", rs.getString(3));
             
             ddl = "DROP INDEX " + indexName + " ON " + INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR
+ indexDataTable;
-            stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             
             // Assert the rows for index table is completely removed.
             rs = conn.getMetaData().getIndexInfo(null, INDEX_DATA_SCHEMA, indexDataTable,
false, false);
@@ -416,8 +407,7 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
             String ddl = "CREATE INDEX " + indexName + " ON " + fullTableName
             		+ " (a.int_col1, a.long_col1, b.int_col2, b.long_col2)"
             		+ " INCLUDE(int_col1, int_col2)";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             fail("Should have caught exception.");
         } catch (SQLException e) {
             assertEquals(SQLExceptionCode.COLUMN_EXIST_IN_DEF.getErrorCode(), e.getErrorCode());
@@ -435,8 +425,7 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
             String ddl = "create table test_table (char_pk varchar not null,"
         		+ " int_col integer, long_col integer, int_col integer"
         		+ " constraint pk primary key (char_pk))";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             fail("Should have caught exception");
         } catch (ColumnAlreadyExistsException e) {
             assertEquals(SQLExceptionCode.COLUMN_EXIST_IN_DEF.getErrorCode(), e.getErrorCode());
@@ -455,8 +444,7 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
         		+ " a.int_col integer, a.long_col integer,"
         		+ " a.int_col integer, b.long_col integer"
         		+ " constraint pk primary key (char_pk))";
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             fail("Should have caught exception");
         } catch (ColumnAlreadyExistsException e) {
             assertEquals(SQLExceptionCode.COLUMN_EXIST_IN_DEF.getErrorCode(), e.getErrorCode());
@@ -476,16 +464,13 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
         		+ " a.int_col integer, a.long_col integer,"
         		+ " b.int_col integer, b.long_col integer"
         		+ " constraint pk primary key (char_pk))";
-        PreparedStatement stmt = conn.prepareStatement(ddl);
-        stmt.execute();
+        conn.createStatement().execute(ddl);
         
         ddl = "CREATE INDEX " + indexName + "1 ON " + testTable  + " (a.int_col, b.int_col)";
-        stmt = conn.prepareStatement(ddl);
-        stmt.execute();
+        conn.createStatement().execute(ddl);
         try {
             ddl = "CREATE INDEX " + indexName + "2 ON " + testTable  + " (int_col)";
-            stmt = conn.prepareStatement(ddl);
-            stmt.execute();
+            conn.createStatement().execute(ddl);
             fail("Should have caught exception");
         } catch (AmbiguousColumnException e) {
             assertEquals(SQLExceptionCode.AMBIGUOUS_COLUMN.getErrorCode(), e.getErrorCode());
@@ -551,19 +536,15 @@ public class IndexMetadataIT extends ParallelStatsDisabledIT {
 
 
         String ddl = "create table " + testTable  + " (k varchar primary key, v1 varchar,
v2 varchar, v3 varchar)";
-        PreparedStatement stmt = conn.prepareStatement(ddl);
-        stmt.execute();
+        conn.createStatement().execute(ddl);
         String indexName = "ASYNCIND_" + generateUniqueName();
         
         ddl = "CREATE INDEX " + indexName + "1 ON " + testTable  + " (v1) ASYNC";
-        stmt = conn.prepareStatement(ddl);
-        stmt.execute();
+        conn.createStatement().execute(ddl);
         ddl = "CREATE INDEX " + indexName + "2 ON " + testTable  + " (v2) ASYNC";
-        stmt = conn.prepareStatement(ddl);
-        stmt.execute();
+        conn.createStatement().execute(ddl);
         ddl = "CREATE INDEX " + indexName + "3 ON " + testTable  + " (v3)";
-        stmt = conn.prepareStatement(ddl);
-        stmt.execute();
+        conn.createStatement().execute(ddl);
         
         ResultSet rs = conn.createStatement().executeQuery(
             "select table_name, " + PhoenixDatabaseMetaData.ASYNC_CREATED_DATE + " " +

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
index 8942716..7042fe7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
@@ -102,9 +102,8 @@ public class MutableIndexIT extends ParallelStatsDisabledIT {
 
 			TestUtil.createMultiCFTestTable(conn, fullTableName, tableDDLOptions);
             populateMultiCFTestTable(fullTableName);
-            PreparedStatement stmt = conn.prepareStatement("CREATE " + (localIndex ? " LOCAL
" : "") + " INDEX " + indexName + " ON " + fullTableName 
+            conn.createStatement().execute("CREATE " + (localIndex ? " LOCAL " : "") + "
INDEX " + indexName + " ON " + fullTableName 
             		+ " (char_col1 ASC, int_col1 ASC) INCLUDE (long_col1, long_col2)");
-            stmt.execute();
             
             String query = "SELECT char_col1, int_col1, long_col2 from " + fullTableName;
             ResultSet rs = conn.createStatement().executeQuery("EXPLAIN " + query);
@@ -129,7 +128,7 @@ public class MutableIndexIT extends ParallelStatsDisabledIT {
             assertEquals(5L, rs.getLong(3));
             assertFalse(rs.next());
             
-            stmt = conn.prepareStatement("UPSERT INTO " + fullTableName
+            PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + fullTableName
                     + "(varchar_pk, char_pk, int_pk, long_pk , decimal_pk, long_col2) SELECT
varchar_pk, char_pk, int_pk, long_pk , decimal_pk, long_col2*2 FROM "
                     + fullTableName + " WHERE long_col2=?");
             stmt.setLong(1,4L);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
index 04cd93f..8336f81 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
@@ -1023,15 +1023,13 @@ public class QueryCompilerTest extends BaseConnectionlessQueryTest
{
         String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" + (ts + 5);
// Run query at timestamp 5
         Connection conn = DriverManager.getConnection(url);
         try {
-            PreparedStatement statement = conn.prepareStatement("ALTER TABLE atable ADD xyz
INTEGER SALT_BUCKETS=4");
-            statement.execute();
+            conn.createStatement().execute("ALTER TABLE atable ADD xyz INTEGER SALT_BUCKETS=4");
             fail();
         } catch (SQLException e) { // expected
             assertEquals(SQLExceptionCode.SALT_ONLY_ON_CREATE_TABLE.getErrorCode(), e.getErrorCode());
         }
         try {
-            PreparedStatement statement = conn.prepareStatement("ALTER TABLE atable SET SALT_BUCKETS=4");
-            statement.execute();
+            conn.createStatement().execute("ALTER TABLE atable SET SALT_BUCKETS=4");
             fail();
         } catch (SQLException e) { // expected
             assertEquals(SQLExceptionCode.SALT_ONLY_ON_CREATE_TABLE.getErrorCode(), e.getErrorCode());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryMetaDataTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryMetaDataTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryMetaDataTest.java
index bf11b72..73ba2a4 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryMetaDataTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/compile/QueryMetaDataTest.java
@@ -441,15 +441,4 @@ public class QueryMetaDataTest extends BaseConnectionlessQueryTest {
         assertEquals(String.class.getName(), pmd.getParameterClassName(2));
         assertEquals(String.class.getName(), pmd.getParameterClassName(3));
     }
-    
-    @Test
-    public void testBindParamMetaDataForCreateTable() throws Exception {
-        String ddl = "CREATE TABLE foo (k VARCHAR PRIMARY KEY) SPLIT ON (?, ?)";
-        Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES));
-        PreparedStatement statement = conn.prepareStatement(ddl);
-        ParameterMetaData pmd = statement.getParameterMetaData();
-        assertEquals(2, pmd.getParameterCount());
-        assertEquals(byte[].class.getName(), pmd.getParameterClassName(1));
-        assertEquals(byte[].class.getName(), pmd.getParameterClassName(2));
-    }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixPreparedStatementTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixPreparedStatementTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixPreparedStatementTest.java
index 287fb4b..56a524c 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixPreparedStatementTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixPreparedStatementTest.java
@@ -178,28 +178,4 @@ public class PhoenixPreparedStatementTest extends BaseConnectionlessQueryTest
{
         assertEquals(0, phoenixStmt.getQueryTimeoutInMillis());
     }
 
-    @Test
-    public void testPreparedStatementWithGeneratedKeys() throws Exception {
-        Connection conn = DriverManager.getConnection(getUrl());
-        PreparedStatement statement = conn.prepareStatement("CREATE TABLE T (pk1 CHAR(15)
not null, pk2 VARCHAR not null,  v1 VARCHAR(15), v2 DATE, " +
-            "v3 VARCHAR CONSTRAINT pk PRIMARY KEY (pk1, pk2))", PreparedStatement.RETURN_GENERATED_KEYS);
-        statement.execute();
-    }
-
-    @Test
-    public void testPreparedStatementWithColumnIndexes() throws Exception {
-        Connection conn = DriverManager.getConnection(getUrl());
-        PreparedStatement statement = conn.prepareStatement("CREATE TABLE T (pk1 CHAR(15)
not null, pk2 VARCHAR not null,  v1 VARCHAR(15), v2 DATE, " +
-            "v3 VARCHAR CONSTRAINT pk PRIMARY KEY (pk1, pk2))", new int[0]);
-        statement.execute();
-    }
-
-    @Test
-    public void testPreparedStatementWithColumnNames() throws Exception {
-        Connection conn = DriverManager.getConnection(getUrl());
-        PreparedStatement statement = conn.prepareStatement("CREATE TABLE T (pk1 CHAR(15)
not null, pk2 VARCHAR not null,  v1 VARCHAR(15), v2 DATE, " +
-            "v3 VARCHAR CONSTRAINT pk PRIMARY KEY (pk1, pk2))", new String[0]);
-        statement.execute();
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/d77bad2b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index a178491..c5f4e4f 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -779,7 +779,7 @@ public abstract class BaseTest {
         if (splits != null) {
             buf.append(" SPLIT ON (");
             for (int i = 0; i < splits.length; i++) {
-                buf.append("?,");
+                buf.append("'").append(Bytes.toString(splits[i])).append("'").append(",");
             }
             buf.setCharAt(buf.length()-1, ')');
         }
@@ -790,13 +790,7 @@ public abstract class BaseTest {
         }
         Connection conn = DriverManager.getConnection(url, props);
         try {
-            PreparedStatement stmt = conn.prepareStatement(ddl);
-            if (splits != null) {
-                for (int i = 0; i < splits.length; i++) {
-                    stmt.setBytes(i+1, splits[i]);
-                }
-            }
-            stmt.execute(ddl);
+            conn.createStatement().execute(ddl);
         } catch (TableAlreadyExistsException e) {
             if (! swallowTableAlreadyExistsException) {
                 throw e;


Mime
View raw message