phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maryann...@apache.org
Subject [25/35] phoenix git commit: PHOENIX-3267 Replace use of SELECT null with CAST(null AS <type>) (Eric Lomore)
Date Fri, 28 Oct 2016 21:34:18 GMT
PHOENIX-3267 Replace use of SELECT null with CAST(null AS <type>) (Eric Lomore)


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

Branch: refs/heads/calcite
Commit: 9eab8f584ca5e4c8db587e3326289f279d530b7b
Parents: 2c53dac
Author: James Taylor <jamestaylor@apache.org>
Authored: Thu Oct 27 11:48:02 2016 -0700
Committer: James Taylor <jamestaylor@apache.org>
Committed: Thu Oct 27 12:22:03 2016 -0700

----------------------------------------------------------------------
 .../src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java | 2 +-
 .../src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java   | 2 +-
 .../it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java | 4 ++--
 .../org/apache/phoenix/jdbc/PhoenixResultSetMetadataTest.java    | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/9eab8f58/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
index 01cc2c1..c689373 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/AggregateQueryIT.java
@@ -77,7 +77,7 @@ public class AggregateQueryIT extends BaseQueryIT {
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 70));
         conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(true);
-        conn.createStatement().execute("UPSERT INTO atable(organization_id,entity_id,a_integer)
SELECT organization_id, entity_id, null FROM atable");
+        conn.createStatement().execute("UPSERT INTO atable(organization_id,entity_id,a_integer)
SELECT organization_id, entity_id, CAST(null AS integer) FROM atable");
 
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 90));
         conn = DriverManager.getConnection(getUrl(), props);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9eab8f58/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
index 8c9c8eb..3561274 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpsertSelectIT.java
@@ -681,7 +681,7 @@ public class UpsertSelectIT extends BaseClientManagedTimeIT {
 
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30));
         conn = DriverManager.getConnection(getUrl(), props);
-        conn.createStatement().execute("upsert into phoenix_test (id, ts) select id, null
from phoenix_test where id <= 'bbb' limit 1");
+        conn.createStatement().execute("upsert into phoenix_test (id, ts) select id, CAST(null
AS timestamp) from phoenix_test where id <= 'bbb' limit 1");
         conn.commit();
         conn.close();
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9eab8f58/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 38c9f43..6669783 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
@@ -154,7 +154,7 @@ public class MutableIndexIT extends ParallelStatsDisabledIT {
             assertFalse(rs.next());
             
             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, null FROM "
+                    + "(varchar_pk, char_pk, int_pk, long_pk , decimal_pk, long_col2) SELECT
varchar_pk, char_pk, int_pk, long_pk , decimal_pk, CAST(null AS BIGINT) FROM "
                     + fullTableName + " WHERE long_col2=?");
             stmt.setLong(1,3L);
             assertEquals(1,stmt.executeUpdate());
@@ -865,4 +865,4 @@ private void upsertRow(String dml, Connection tenantConn, int i) throws
SQLExcep
       stmt.setString(2, String.valueOf(i));
       assertEquals(1,stmt.executeUpdate());
 }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/phoenix/blob/9eab8f58/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixResultSetMetadataTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixResultSetMetadataTest.java
b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixResultSetMetadataTest.java
index 9153595..17b3794 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixResultSetMetadataTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/jdbc/PhoenixResultSetMetadataTest.java
@@ -35,11 +35,11 @@ public class PhoenixResultSetMetadataTest extends BaseConnectionlessQueryTest
{
         conn.createStatement().execute(
                 "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)) ");
-        ResultSet rs = conn.createStatement().executeQuery("SELECT pk1, pk2, v1, v2, NULL
FROM T");
+        ResultSet rs = conn.createStatement().executeQuery("SELECT pk1, pk2, v1, v2, CAST(null
AS varchar) FROM T");
         assertEquals(15, rs.getMetaData().getColumnDisplaySize(1));
         assertEquals(PhoenixResultSetMetaData.DEFAULT_DISPLAY_WIDTH, rs.getMetaData().getColumnDisplaySize(2));
         assertEquals(15, rs.getMetaData().getColumnDisplaySize(3));
         assertEquals(conn.unwrap(PhoenixConnection.class).getDatePattern().length(), rs.getMetaData().getColumnDisplaySize(4));
-        assertEquals(QueryConstants.NULL_DISPLAY_TEXT.length(), rs.getMetaData().getColumnDisplaySize(5));
+        assertEquals(40, rs.getMetaData().getColumnDisplaySize(5));
     }
 }


Mime
View raw message