phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artur Denysenko (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (PHOENIX-899) Using BINARY type in secondary indexes fails when doing an UPSERT
Date Thu, 29 May 2014 06:22:06 GMT

    [ https://issues.apache.org/jira/browse/PHOENIX-899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14011973#comment-14011973
] 

Artur Denysenko edited comment on PHOENIX-899 at 5/29/14 6:21 AM:
------------------------------------------------------------------

If you actually have a look at the code example you can see that:
# not null values are inserted
#  there is no any "BINARY(16) NULL" columns present in PK or indexes
# all "BINARY(16) NOT NULL" has fixed length

Please reopen.
I still see it in [4.0.0-incubating]


was (Author: adenysenko):
If you actually have a look at the code example you can see that:
# not null values are inserted
#  there is no any "BINARY() NULL" columns present in PK or indexes

Please reopen.
I still see it in [4.0.0-incubating]

> Using BINARY type in secondary indexes fails when doing an UPSERT
> -----------------------------------------------------------------
>
>                 Key: PHOENIX-899
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-899
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Samarth Jain
>            Assignee: Samarth Jain
>             Fix For: 3.0.0, 4.0.0
>
>
> {code}
> @Test
>     public void testIndexCreation() throws Exception {
>     	Properties props = new Properties(TEST_PROPERTIES);
>     	Connection conn = DriverManager.getConnection(getUrl(), props);
>         try {
>             conn.createStatement().execute("CREATE TABLE IF NOT EXISTS t1 "
>             		+ "( id BIGINT NOT NULL PRIMARY KEY" // INDEX_ID
>                     + ", t BINARY(16) NOT NULL" // INDEX_THING_ID
>                     + ", e BINARY(16) NOT NULL" // INDEX_EVENT_KEY
>                     + ", d DATE NOT NULL" // INDEX_TIMESTAMP
>                     + ", y BINARY(16) NULL" // INDEX_METATYPE_ID
>                     + ", v BINARY(16) NULL)"); // INDEX_VALUE
>             
>             conn.createStatement().execute("CREATE INDEX IF NOT EXISTS index1 ON  t1
(t, e, d DESC)");
>             conn.createStatement().execute("CREATE INDEX IF NOT EXISTS index2 ON t1 (t,
d DESC, e)");
>             
>             String upsert = "UPSERT INTO t1 values (?, ?, ?, ?, ?, ?)";
>             PreparedStatement stmt = conn.prepareStatement(upsert);
>             stmt.setInt(1, 1);
>             stmt.setBytes(2, "ABC".getBytes());
>             stmt.setBytes(3, "BCD".getBytes());
>             stmt.setDate(4, new Date(System.currentTimeMillis()));
>             stmt.setBytes(5, "CDE".getBytes());
>             stmt.setBytes(6, "BBNNB".getBytes());
>             stmt.executeUpdate();
>             conn.commit();
>         } finally {
>             conn.close();
>         }
>     }
> Exception:
> java.lang.IllegalArgumentException: Unsupported non nullable index type BINARY
> 	at org.apache.phoenix.util.IndexUtil.getIndexColumnDataType(IndexUtil.java:81)
> 	at org.apache.phoenix.index.IndexMaintainer.buildRowKey(IndexMaintainer.java:345)
> 	at org.apache.phoenix.index.IndexMaintainer.buildUpdateMutation(IndexMaintainer.java:391)
> 	at org.apache.phoenix.util.IndexUtil.generateIndexData(IndexUtil.java:185)
> 	at org.apache.phoenix.execute.MutationState$1.next(MutationState.java:203)
> 	at org.apache.phoenix.execute.MutationState$1.next(MutationState.java:186)
> 	at org.apache.phoenix.execute.MutationState.commit(MutationState.java:347)
> 	at org.apache.phoenix.jdbc.PhoenixConnection.commit(PhoenixConnection.java:351)
> 	at org.apache.phoenix.jdbc.PhoenixStatement.executeMutation(PhoenixStatement.java:229)
> 	at org.apache.phoenix.jdbc.PhoenixStatement.execute(PhoenixStatement.java:185)
> 	at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:146)
> 	at org.apache.phoenix.jdbc.PhoenixPreparedStatement.execute(PhoenixPreparedStatement.java:151)
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message