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 5079718B9F for ; Tue, 14 Jul 2015 05:10:08 +0000 (UTC) Received: (qmail 81757 invoked by uid 500); 14 Jul 2015 05:10:08 -0000 Delivered-To: apmail-phoenix-dev-archive@phoenix.apache.org Received: (qmail 81703 invoked by uid 500); 14 Jul 2015 05:10:08 -0000 Mailing-List: contact dev-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list dev@phoenix.apache.org Received: (qmail 81692 invoked by uid 99); 14 Jul 2015 05:10:08 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Jul 2015 05:10:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 9B0181A6F75 for ; Tue, 14 Jul 2015 05:10:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.97 X-Spam-Level: X-Spam-Status: No, score=0.97 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id Wqb1cGUpZlhU for ; Tue, 14 Jul 2015 05:10:06 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id B7DDB21357 for ; Tue, 14 Jul 2015 05:10:05 +0000 (UTC) Received: (qmail 81023 invoked by uid 99); 14 Jul 2015 05:10:05 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Jul 2015 05:10:05 +0000 Date: Tue, 14 Jul 2015 05:10:04 +0000 (UTC) From: "James Taylor (JIRA)" To: dev@phoenix.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (PHOENIX-2067) Sort order incorrect for variable length DESC columns MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PHOENIX-2067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] James Taylor updated PHOENIX-2067: ---------------------------------- Attachment: PHOENIX-2067_array_addendum_v2.patch [~Dumindux] and [~ram_krish] - would you guys mind reviewing this patch? This ensures that descending, variable length arrays sort correctly. The change is the use a 255 byte as the separator for non null values (including the terminators). See the couple of new tests in ArrayIT. Much of the type changes are just formatting and moving a couple of duplicated methods where they belong at the base type. The other changes are to ensure we keep the same separator - for example if a table has not been upgraded, we need to keep using the 0 byte separator. That's where most of the complication comes in. Much appreciated. [~Dumindux] - if you have time perhaps you can write a couple of lower level unit tests to confirm that my isRowKeyOrderOptimized works in all situations and that array_cat, prepend, and append work in that they maintain the same separator byte that the array is already using. > Sort order incorrect for variable length DESC columns > ----------------------------------------------------- > > Key: PHOENIX-2067 > URL: https://issues.apache.org/jira/browse/PHOENIX-2067 > Project: Phoenix > Issue Type: Bug > Affects Versions: 4.4.0 > Environment: HBase 0.98.6-cdh5.3.0 > jdk1.7.0_67 x64 > CentOS release 6.4 (2.6.32-358.el6.x86_64) > Reporter: Mykola Komarnytskyy > Assignee: James Taylor > Attachments: PHOENIX-2067_array_addendum.patch, PHOENIX-2067_array_addendum_v2.patch, PHOENIX-2067_v1.patch, PHOENIX-2067_v2.patch, PHOENIX-2067_v3.patch > > > Steps to reproduce: > 1. Create a table: > CREATE TABLE mytable (id BIGINT not null PRIMARY KEY, timestamp BIGINT, log_message varchar) IMMUTABLE_ROWS=true, SALT_BUCKETS=16; > 2. Create two indexes: > CREATE INDEX mytable_index_search ON mytable(timestamp,id) INCLUDE (log_message) SALT_BUCKETS=16; > CREATE INDEX mytable_index_search_desc ON mytable(timestamp DESC,id DESC) INCLUDE (log_message) SALT_BUCKETS=16; > 3. Upsert values: > UPSERT INTO mytable VALUES(1, 1434983826018, 'message1'); > UPSERT INTO mytable VALUES(2, 1434983826100, 'message2'); > UPSERT INTO mytable VALUES(3, 1434983826101, 'message3'); > UPSERT INTO mytable VALUES(4, 1434983826202, 'message4'); > 4. Sort DESC by timestamp: > select timestamp,id,log_message from mytable ORDER BY timestamp DESC; > Failure: data is sorted incorrectly. In case when we have two longs which are different only by last two digits (e.g. 1434983826155, 1434983826100) and one of the long ends with '00' we receive incorrect order. > Sorting result: > 1434983826202 > 1434983826100 > 1434983826101 > 1434983826018 -- This message was sent by Atlassian JIRA (v6.3.4#6332)