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 19456200C82 for ; Sat, 13 May 2017 00:11:08 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 17CBE160BCB; Fri, 12 May 2017 22:11:08 +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 373B9160BC8 for ; Sat, 13 May 2017 00:11:07 +0200 (CEST) Received: (qmail 12291 invoked by uid 500); 12 May 2017 22:11:06 -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 12279 invoked by uid 99); 12 May 2017 22:11:06 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 May 2017 22:11:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 0EC0CC064B for ; Fri, 12 May 2017 22:11:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.201 X-Spam-Level: X-Spam-Status: No, score=-99.201 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id bwRvk9Xhec1F for ; Fri, 12 May 2017 22:11:05 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id E7CC15FDA6 for ; Fri, 12 May 2017 22:11:04 +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 7230BE0D4B for ; Fri, 12 May 2017 22:11:04 +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 24BAC242FD for ; Fri, 12 May 2017 22:11:04 +0000 (UTC) Date: Fri, 12 May 2017 22:11:04 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DRILL-5459) Extend physical operator test framework to test mini plans consisting of multiple operators MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 12 May 2017 22:11:08 -0000 [ https://issues.apache.org/jira/browse/DRILL-5459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16008799#comment-16008799 ] ASF GitHub Bot commented on DRILL-5459: --------------------------------------- Github user jinfengni commented on a diff in the pull request: https://github.com/apache/drill/pull/823#discussion_r116333318 --- Diff: exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/MiniPlanUnitTestBase.java --- @@ -0,0 +1,439 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.drill.exec.physical.unit; + +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; +import mockit.NonStrictExpectations; +import org.apache.drill.DrillTestWrapper; +import org.apache.drill.common.expression.SchemaPath; +import org.apache.drill.exec.physical.base.PhysicalOperator; +import org.apache.drill.exec.physical.impl.BatchCreator; +import org.apache.drill.exec.physical.impl.ScanBatch; +import org.apache.drill.exec.record.BatchSchema; +import org.apache.drill.exec.record.MaterializedField; +import org.apache.drill.exec.record.RecordBatch; +import org.apache.drill.exec.record.VectorAccessible; +import org.apache.drill.exec.rpc.NamedThreadFactory; +import org.apache.drill.exec.store.RecordReader; +import org.apache.drill.exec.store.dfs.DrillFileSystem; +import org.apache.drill.exec.store.parquet.ParquetDirectByteBufferAllocator; +import org.apache.drill.exec.store.parquet.ParquetReaderUtility; +import org.apache.drill.exec.store.parquet.columnreaders.ParquetRecordReader; +import org.apache.drill.exec.util.TestUtilities; +import org.apache.hadoop.fs.Path; +import org.apache.parquet.hadoop.CodecFactory; +import org.apache.parquet.hadoop.ParquetFileReader; +import org.apache.parquet.hadoop.metadata.ParquetMetadata; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import static org.apache.drill.exec.physical.unit.TestMiniPlan.fs; + +/** + * A MiniPlanUnitTestBase extends PhysicalOpUnitTestBase, to construct MiniPlan (aka plan fragment). + * in the form of physical operator tree, and verify both the expected schema and output row results. + * Steps to construct a unit: + * 1. Call PopBuilder / ScanPopBuilder to construct the MiniPlan + * 2. Create a MiniPlanTestBuilder, and specify the expected schema and base line values, or if there + * is no batch expected. + */ + +public class MiniPlanUnitTestBase extends PhysicalOpUnitTestBase { --- End diff -- Thanks for the suggestion. I'll leave it as future improvement, as it requires refactor the new class as well as the existing physical operator test framework. > Extend physical operator test framework to test mini plans consisting of multiple operators > ------------------------------------------------------------------------------------------- > > Key: DRILL-5459 > URL: https://issues.apache.org/jira/browse/DRILL-5459 > Project: Apache Drill > Issue Type: Improvement > Components: Tools, Build & Test > Reporter: Jinfeng Ni > Assignee: Jinfeng Ni > Labels: ready-to-commit > > DRILL-4437 introduced a unit test framework to test a non-scan physical operator. A JSON reader is implicitly used to specify the inputs to the physical operator under test. > There are needs to extend such unit test framework for two scenarios. > 1. We need a way to test scan operator with different record readers. Drill supports a variety of data source, and it's important to make sure every record reader work properly according to the protocol defined. > 2. We need a way to test a so-called mini-plan (aka plan fragment) consisting of multiple non-scan operators. > For the 2nd need, an alternative is to leverage SQL statement and query planner. However, such approach has a direct dependency on query planner; 1) any planner change may impact the testcase and lead to a different plan, 2) it's not always easy job to force the planner to get a desired plan fragment for testing. > In particular, it would be good to have a relatively easy way to specify a mini-plan with a couple of targeted physical operators. > This JIRA is created to track the work to extend the unit test framework in DRILL-4437. > > Related work: DRILL-5318 introduced a sub-operator test fixture, which mainly targeted to test at sub-operator level. The framework in DRILL-4437 and the extension would focus on operator level, or multiple operator levels, where execution would go through RecordBatch's API call. > Same as DRILL-4437, we are going to use mockit to mock required objects such fragment context, operator context etc. -- This message was sent by Atlassian JIRA (v6.3.15#6346)