[ 
https://issues.apache.org/jira/browse/PHOENIX-2210?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Taylor updated PHOENIX-2210:
----------------------------------
    Summary: UPSERT SELECT without FROM clause fails with NPE  (was: UPSERT 
SELECT on the same table without FROM clause fails with NPE)

> UPSERT SELECT without FROM clause fails with NPE
> ------------------------------------------------
>
>                 Key: PHOENIX-2210
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2210
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Samarth Jain
>              Labels: verify
>             Fix For: 4.8.0
>
>
> {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)

Reply via email to