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 7B99A200C48 for ; Thu, 23 Feb 2017 22:08:57 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7A4B7160B64; Thu, 23 Feb 2017 21:08:57 +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 9C6FC160B78 for ; Thu, 23 Feb 2017 22:08:56 +0100 (CET) Received: (qmail 21366 invoked by uid 500); 23 Feb 2017 21:08:55 -0000 Mailing-List: contact issues-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 issues@drill.apache.org Received: (qmail 21350 invoked by uid 99); 23 Feb 2017 21:08:55 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Feb 2017 21:08:55 +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 66B2B1A0540 for ; Thu, 23 Feb 2017 21:08:55 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -1.999 X-Spam-Level: X-Spam-Status: No, score=-1.999 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id 6pHPJfHqxO3n for ; Thu, 23 Feb 2017 21:08:54 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 7B63E5FBE4 for ; Thu, 23 Feb 2017 21:08:53 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 2F370E087E for ; Thu, 23 Feb 2017 21:08:46 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id CBDD524164 for ; Thu, 23 Feb 2017 21:08:44 +0000 (UTC) Date: Thu, 23 Feb 2017 21:08:44 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DRILL-5260) Refinements to new "Cluster Fixture" test framework MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 23 Feb 2017 21:08:57 -0000 [ https://issues.apache.org/jira/browse/DRILL-5260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15881266#comment-15881266 ] ASF GitHub Bot commented on DRILL-5260: --------------------------------------- Github user sohami commented on a diff in the pull request: https://github.com/apache/drill/pull/753#discussion_r102603020 --- Diff: exec/java-exec/src/test/java/org/apache/drill/test/ProfileParser.java --- @@ -42,44 +48,207 @@ public class ProfileParser { JsonObject profile; + String query; List plans; + List operations; + Map fragments = new HashMap<>(); + private List topoOrder; public ProfileParser( File file ) throws IOException { try (FileReader fileReader = new FileReader(file); JsonReader reader = Json.createReader(fileReader)) { profile = (JsonObject) reader.read(); } + + parse(); + } + + private void parse() { + parseQuery(); + parsePlans(); + buildFrags(); + parseFragProfiles(); + mapOpProfiles(); + aggregateOpers(); + buildTree(); + } + + private void parseQuery() { + query = profile.getString("query"); + query = query.replace("//n", "\n"); + } + + /** + * Parse a text version of the plan as it appears in the JSON + * query profile. + */ + + private static class PlanParser { + + List plans = new ArrayList<>(); + List operations = new ArrayList<>(); + List sorted = new ArrayList<>(); + + public void parsePlans(String plan) { + plans = new ArrayList<>( ); + String parts[] = plan.split("\n"); + for (String part : parts) { + plans.add(part); + OpDefInfo opDef = new OpDefInfo( part ); + operations.add(opDef); + } + sortList(); + } + + public void sortList() { + List raw = new ArrayList<>( ); + raw.addAll( operations ); + Collections.sort( raw, new Comparator() { + @Override + public int compare(OpDefInfo o1, OpDefInfo o2) { + int result = Integer.compare(o1.majorId, o2.majorId); + if ( result == 0 ) { + result = Integer.compare(o1.stepId, o2.stepId); + } + return result; + } + }); + int currentFrag = 0; + int currentStep = 0; + for ( OpDefInfo opDef : raw ) { + if ( currentFrag < opDef.majorId ) { + currentFrag++; + OpDefInfo sender = new OpDefInfo( currentFrag, 0 ); + sender.isInferred = true; + sender.name = "Sender"; + sorted.add(sender); + currentStep = 1; + opDef.inferredParent = sender; + sender.children.add( opDef ); + } + if ( opDef.stepId > currentStep ) { + OpDefInfo unknown = new OpDefInfo( currentFrag, currentStep ); + unknown.isInferred = true; + unknown.name = "Unknown"; + sorted.add(unknown); + opDef.inferredParent = unknown; + unknown.children.add( opDef ); + } + sorted.add( opDef ); + currentStep = opDef.stepId + 1; + } + } + } + + /** + * Parse the plan portion of the query profile. + */ + + private void parsePlans() { + PlanParser parser = new PlanParser(); + String plan = getPlan( ); + parser.parsePlans(plan); + plans = parser.plans; + topoOrder = parser.operations; + operations = parser.sorted; + } --- End diff -- wrong assignment ?` topoOrder = parser.sorted` and `operations = parser.operations` ? > Refinements to new "Cluster Fixture" test framework > --------------------------------------------------- > > Key: DRILL-5260 > URL: https://issues.apache.org/jira/browse/DRILL-5260 > Project: Apache Drill > Issue Type: Improvement > Affects Versions: 1.10 > Reporter: Paul Rogers > Assignee: Paul Rogers > Priority: Minor > Fix For: 1.10 > > > Roll-up of a number of enhancements to the cluster fixture framework. > * Config option to suppress printing of CSV and other output. (Allows printing for single tests, not printing when running from Maven.) > * Parsing of query profiles to extract plan and run time information. > * Fix bug in log fixture when enabling logging for a package. > * Improved ZK support. > * Set up the new CTTAS default temporary workspace for tests. > * Revise TestDrillbitResiliance to use the new framework. > * Revise TestWindowFrame to to use the new framework. > * Revise TestMergeJoinWithSchemaChanges to use the new framework. -- This message was sent by Atlassian JIRA (v6.3.15#6346)