phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas D'Silva (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PHOENIX-2210) UPSERT SELECT without FROM clause fails with NPE
Date Fri, 18 Jan 2019 22:16:00 GMT

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

Thomas D'Silva updated PHOENIX-2210:
------------------------------------
    Fix Version/s:     (was: 4.15.0)

> 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
>            Priority: Major
>              Labels: verify
>
> {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
(v7.6.3#76005)

Mime
View raw message