From issues-return-5274-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Sat Mar 16 00:13:01 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id ABD1D18078A for ; Sat, 16 Mar 2019 01:13:00 +0100 (CET) Received: (qmail 45929 invoked by uid 500); 16 Mar 2019 00:12:59 -0000 Mailing-List: contact issues-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 issues@phoenix.apache.org Received: (qmail 45822 invoked by uid 99); 16 Mar 2019 00:12:59 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 16 Mar 2019 00:12:59 +0000 From: GitBox To: issues@phoenix.apache.org Subject: [GitHub] [phoenix] BinShi-SecularBird commented on a change in pull request #463: Phoenix stats Initial Commit Message-ID: <155269517908.32442.5418127650440962621.gitbox@gitbox.apache.org> Date: Sat, 16 Mar 2019 00:12:59 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit BinShi-SecularBird commented on a change in pull request #463: Phoenix stats Initial Commit URL: https://github.com/apache/phoenix/pull/463#discussion_r266161597 ########## File path: phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java ########## @@ -694,4 +694,127 @@ public TimeRange getRowTimestampRange() { return rowTimestampRange; } + /** + * Produces the list of KeyRanges representing the fully qualified row key by calling into ScanUtil.setKey + * repeatedly for every combination of KeyRanges in the ranges field. The bounds will be set according to the + * properties of the setKey method. + * + * @return list of KeyRanges representing the fully qualified rowkey, coalesced + */ + public List getRowKeyRanges() { + // If its scanRanges are everything or nothing, then we short circuit and leave + // as schema is not filled in + if (isEverything()) { return Lists.newArrayList(KeyRange.EVERYTHING_RANGE); } + if (isDegenerate()) { return Lists.newArrayList(KeyRange.EMPTY_RANGE); } + + List queryRowKeyRanges = Lists.newArrayListWithExpectedSize(this.ranges.size()); + + // Point lookups are stored in the first range as a whole and already a rowkey + // see ScanRanges.getPointLookupKeyIterator + if (this.isPointLookup()) { + queryRowKeyRanges.addAll(this.getRanges().get(0)); + } else { + // If scanRanges.ranges has no information then should be in the scanRanges.scanRange + if (this.getRanges().size() == 0) { + queryRowKeyRanges.add(this.getScanRange()); + } else { // We have a composite key need the row key from the combination + // make a copy of ranges as we may add items to fully qualify our rowkey + List> ranges = new ArrayList<>(); + ranges.addAll(this.getRanges()); Review comment: Shall we just use List> ranges = new ArrayList<>(this.getRanges())? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services