You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Samarth Jain (JIRA)" <ji...@apache.org> on 2015/08/26 20:16:46 UTC
[jira] [Created] (PHOENIX-2210) UPSERT SELECT on the same table
fails with NPE
Samarth Jain created PHOENIX-2210:
-------------------------------------
Summary: UPSERT SELECT on the same table fails with NPE
Key: PHOENIX-2210
URL: https://issues.apache.org/jira/browse/PHOENIX-2210
Project: Phoenix
Issue Type: Bug
Reporter: Samarth Jain
{code}
@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));
}
}
{code}
{code}
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)
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)