Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
@Test public void testUpsertSelectSameRow() throws Exception { try (Connection conn = DriverManager.getConnection(getUrl())) { conn.createStatement().execute("CREATE TABLE T (PK1 VARCHAR NOT NULL, PK2 VARCHAR NOT NULL, KV1 INTEGER CONSTRAINT PK PRIMARY KEY (PK1, PK2))"); conn.createStatement().executeUpdate("UPSERT INTO T VALUES ('PK10', 'PK20', 10)"); conn.createStatement().executeUpdate("UPSERT INTO T VALUES ('PK11', 'PK21', 20)"); conn.createStatement().executeUpdate("UPSERT INTO T VALUES ('PK12', 'PK22', 30)"); conn.commit(); conn.createStatement().executeUpdate("UPSERT INTO T (PK1, PK2, KV1) SELECT PK1, PK2, (KV1 + 100) WHERE PK1 = 'PK10' AND PK2 = 'PK20' "); conn.commit(); ResultSet rs = conn.createStatement().executeQuery("SELECT KV1 FROM T WHERE WHERE PK1 = 'PK10' AND PK2 = 'PK20'"); assertTrue(rs.next()); assertEquals(110, rs.getInt(1)); } }
Exception: java.lang.NullPointerException at org.apache.phoenix.schema.TableRef.equals(TableRef.java:115) at org.apache.phoenix.compile.UpsertCompiler.compile(UpsertCompiler.java:392) at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:550) at org.apache.phoenix.jdbc.PhoenixStatement$ExecutableUpsertStatement.compilePlan(PhoenixStatement.java:1) at org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:318) at org.apache.phoenix.jdbc.PhoenixStatement$3.call(PhoenixStatement.java:1) at org.apache.phoenix.call.CallRunner.run(CallRunner.java:53) at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:310) at org.apache.phoenix.jdbc.PhoenixStatement.executeUpdate(PhoenixStatement.java:1421)