You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ra...@apache.org on 2017/07/08 10:28:25 UTC

phoenix git commit: use normal statement for ddl operarations

Repository: phoenix
Updated Branches:
  refs/heads/calcite 6ea86429f -> 17c206434


use normal statement for ddl operarations


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

Branch: refs/heads/calcite
Commit: 17c2064344081e18efbe0b87f071cdac299a53bb
Parents: 6ea8642
Author: Rajeshbabu Chintaguntla <ra...@apache.org>
Authored: Sat Jul 8 15:57:49 2017 +0530
Committer: Rajeshbabu Chintaguntla <ra...@apache.org>
Committed: Sat Jul 8 15:57:49 2017 +0530

----------------------------------------------------------------------
 .../phoenix/end2end/DistinctPrefixFilterIT.java      |  6 +++---
 .../apache/phoenix/end2end/ExecuteStatementsIT.java  |  5 ++---
 .../phoenix/end2end/MinMaxAggregateFunctionIT.java   |  4 ++--
 .../org/apache/phoenix/end2end/StatsCollectorIT.java | 15 +++++----------
 .../phoenix/calcite/rel/PhoenixAbstractProject.java  |  3 ++-
 5 files changed, 14 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/17c20643/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java
index d66857d..73b2182 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctPrefixFilterIT.java
@@ -61,10 +61,10 @@ public class DistinctPrefixFilterIT extends ParallelStatsDisabledIT {
                 "col1 FLOAT, col2 INTEGER, CONSTRAINT pk PRIMARY KEY(prefix1, prefix2, prefix3)) DISABLE_WAL=true, IMMUTABLE_ROWS=true, SALT_BUCKETS=8";
         createTestTable(getUrl(), ddl);
 
-        conn.prepareStatement("CREATE INDEX " + testTableF + "_idx ON "+testTableF+"(col2) DISABLE_WAL=true").execute();
-        conn.prepareStatement("CREATE LOCAL INDEX " + testTableV + "_idx ON "+testTableV+"(col2) DISABLE_WAL=true").execute();
+        conn.createStatement().execute("CREATE INDEX " + testTableF + "_idx ON "+testTableF+"(col2) DISABLE_WAL=true");
+        conn.createStatement().execute("CREATE LOCAL INDEX " + testTableV + "_idx ON "+testTableV+"(col2) DISABLE_WAL=true");
 
-        conn.prepareStatement("CREATE SEQUENCE " + testSeq + " CACHE 1000").execute();
+        conn.createStatement().execute("CREATE SEQUENCE " + testSeq + " CACHE 1000");
 
         insertPrefixF(1, 1);
         insertPrefixF(1, 2);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/17c20643/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 7248a59..8443a54 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
@@ -131,9 +131,8 @@ public class ExecuteStatementsIT extends ParallelStatsDisabledIT {
                 "CONSTRAINT my_pk PRIMARY KEY (a_id, a_string))";
         
     
-        PreparedStatement statement = conn.prepareStatement(query);
-        statement.execute();
-        statement = conn.prepareStatement(
+        conn.createStatement().execute(query);
+        PreparedStatement statement = conn.prepareStatement(
                 "upsert into " + tableName +
                 "    (a_id, " +
                 "    a_string, " +

http://git-wip-us.apache.org/repos/asf/phoenix/blob/17c20643/phoenix-core/src/it/java/org/apache/phoenix/end2end/MinMaxAggregateFunctionIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MinMaxAggregateFunctionIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MinMaxAggregateFunctionIT.java
index c2429ab..0355b62 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MinMaxAggregateFunctionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MinMaxAggregateFunctionIT.java
@@ -33,13 +33,13 @@ public class MinMaxAggregateFunctionIT extends ParallelStatsDisabledIT {
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
         try {
-            conn.prepareStatement(
+            conn.createStatement().execute(
                 "create table " + TABLE_NAME + "("
                         + "VAL1 integer not null, "
                         + "VAL2 char(2), "
                         + "VAL3 varchar, "
                         + "VAL4 varchar "
-                        + "constraint PK primary key (VAL1))").execute();
+                        + "constraint PK primary key (VAL1))");
             conn.commit();
 
             conn.prepareStatement("upsert into " + TABLE_NAME + " values (0, '00', '00', '0')").execute();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/17c20643/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java
index 65f0089..c397061 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StatsCollectorIT.java
@@ -233,8 +233,7 @@ public class StatsCollectorIT extends BaseUniqueNamesOwnClusterIT {
         Array array;
         conn = upsertValues(props, fullTableName);
         // CAll the update statistics query here. If already major compaction has run this will not get executed.
-        stmt = conn.prepareStatement("UPDATE STATISTICS " + fullTableName);
-        stmt.execute();
+        conn.createStatement().execute("UPDATE STATISTICS " + fullTableName);
         stmt = upsertStmt(conn, fullTableName);
         stmt.setString(1, "z");
         s = new String[] { "xyz", "def", "ghi", "jkll", null, null, "xxx" };
@@ -244,8 +243,7 @@ public class StatsCollectorIT extends BaseUniqueNamesOwnClusterIT {
         array = conn.createArrayOf("VARCHAR", s);
         stmt.setArray(3, array);
         stmt.execute();
-        stmt = conn.prepareStatement("UPDATE STATISTICS " + fullTableName);
-        stmt.execute();
+        conn.createStatement().execute("UPDATE STATISTICS " + fullTableName);
         rs = conn.createStatement().executeQuery("SELECT k FROM " + fullTableName);
         assertTrue(rs.next());
         conn.close();
@@ -301,10 +299,8 @@ public class StatsCollectorIT extends BaseUniqueNamesOwnClusterIT {
         conn = upsertValues(props, fullTableName);
         conn = upsertValues(props, fullTableName2);
         // CAll the update statistics query here
-        stmt = conn.prepareStatement("UPDATE STATISTICS "+fullTableName);
-        stmt.execute();
-        stmt = conn.prepareStatement("UPDATE STATISTICS "+fullTableName2);
-        stmt.execute();
+        conn.createStatement().execute("UPDATE STATISTICS "+fullTableName);
+        conn.createStatement().execute("UPDATE STATISTICS "+fullTableName2);
         stmt = upsertStmt(conn, fullTableName);
         stmt.setString(1, "z");
         s = new String[] { "xyz", "def", "ghi", "jkll", null, null, "xxx" };
@@ -326,8 +322,7 @@ public class StatsCollectorIT extends BaseUniqueNamesOwnClusterIT {
         conn.close();
         conn = getConnection();
         // This analyze would not work
-        stmt = conn.prepareStatement("UPDATE STATISTICS "+fullTableName2);
-        stmt.execute();
+        conn.createStatement().execute("UPDATE STATISTICS "+fullTableName2);
         rs = conn.createStatement().executeQuery("SELECT k FROM "+fullTableName2);
         assertTrue(rs.next());
         conn.close();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/17c20643/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractProject.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractProject.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractProject.java
index 2a0021a..4474fed 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractProject.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/rel/PhoenixAbstractProject.java
@@ -68,7 +68,8 @@ abstract public class PhoenixAbstractProject extends Project implements PhoenixQ
             RexNode project = projects.get(i);
             if ((bindVariablesPresent && RexLiteral.isNullLiteral(project))
                     || project instanceof ImplicitNullLiteral
-                    || (project instanceof RexCall && (((RexCall) project).getOperands().get(0) instanceof ImplicitNullLiteral))) {
+                    || (project instanceof RexCall && !((RexCall) project).getOperands().isEmpty() && (((RexCall) project)
+                            .getOperands().get(0) instanceof ImplicitNullLiteral))) {
                 unspecifiedColumnPositions.add(new Integer(i));
                 continue;
             }