Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 292C3200C31 for ; Wed, 22 Feb 2017 02:23:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 27FB5160B7A; Wed, 22 Feb 2017 01:23:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 73D6D160B68 for ; Wed, 22 Feb 2017 02:23:49 +0100 (CET) Received: (qmail 66583 invoked by uid 500); 22 Feb 2017 01:23:47 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 65974 invoked by uid 99); 22 Feb 2017 01:23:47 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2017 01:23:47 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 529A9DFDD1; Wed, 22 Feb 2017 01:23:47 +0000 (UTC) From: sohami To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #752: DRILL-5258: Access mock data definition from SQL Content-Type: text/plain Message-Id: <20170222012347.529A9DFDD1@git1-us-west.apache.org> Date: Wed, 22 Feb 2017 01:23:47 +0000 (UTC) archived-at: Wed, 22 Feb 2017 01:23:50 -0000 Github user sohami commented on a diff in the pull request: https://github.com/apache/drill/pull/752#discussion_r102360734 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java --- @@ -75,20 +76,50 @@ */ private boolean extended; + private ScanStats scanStats = ScanStats.TRIVIAL_TABLE; @JsonCreator public MockGroupScanPOP(@JsonProperty("url") String url, - @JsonProperty("extended") Boolean extended, @JsonProperty("entries") List readEntries) { super((String) null); this.readEntries = readEntries; this.url = url; - this.extended = extended == null ? false : extended; + + // Compute decent row-count stats for this mock data source so that + // the planner is "fooled" into thinking that this operator wil do + // disk I/O. + + int rowCount = 0; + int rowWidth = 0; + for (MockScanEntry entry : readEntries) { + rowCount += entry.getRecords(); + int width = 0; + if (entry.getTypes() == null) { + width = 50; + } else { + for (MockColumn col : entry.getTypes()) { + int colWidth = 0; + if (col.getWidthValue() == 0) { + colWidth = TypeHelper.getSize(col.getMajorType()); + } else { + colWidth = col.getWidthValue(); + } + colWidth *= col.getRepeatCount(); + width += colWidth; + } + } + rowWidth = Math.max(rowWidth, width); --- End diff -- `rowWidth` seems to be `maxRowWidth` and `width` is `rowWidth`. Can we please rename these ? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---