Return-Path: X-Original-To: apmail-phoenix-dev-archive@minotaur.apache.org Delivered-To: apmail-phoenix-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8D6ED11BEE for ; Fri, 2 May 2014 05:22:44 +0000 (UTC) Received: (qmail 61035 invoked by uid 500); 2 May 2014 05:22:43 -0000 Delivered-To: apmail-phoenix-dev-archive@phoenix.apache.org Received: (qmail 60993 invoked by uid 500); 2 May 2014 05:22:43 -0000 Mailing-List: contact dev-help@phoenix.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.incubator.apache.org Delivered-To: mailing list dev@phoenix.incubator.apache.org Received: (qmail 60878 invoked by uid 99); 2 May 2014 05:22:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 May 2014 05:22:41 +0000 X-ASF-Spam-Status: No, hits=-2000.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 02 May 2014 05:22:41 +0000 Received: (qmail 60266 invoked by uid 99); 2 May 2014 05:22:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 May 2014 05:22:16 +0000 Date: Fri, 2 May 2014 05:22:16 +0000 (UTC) From: "James Taylor (JIRA)" To: dev@phoenix.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (PHOENIX-899) Using BINARY type in secondary indexes fails when doing an UPSERT MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/PHOENIX-899?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] James Taylor resolved PHOENIX-899. ---------------------------------- Resolution: Invalid > 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)