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 8E8F0200BDB for ; Mon, 12 Dec 2016 07:25:42 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8D0C7160B22; Mon, 12 Dec 2016 06:25:42 +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 89422160B0D for ; Mon, 12 Dec 2016 07:25:41 +0100 (CET) Received: (qmail 50246 invoked by uid 500); 12 Dec 2016 06:25:40 -0000 Mailing-List: contact commits-help@carbondata.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@carbondata.incubator.apache.org Delivered-To: mailing list commits@carbondata.incubator.apache.org Received: (qmail 50237 invoked by uid 99); 12 Dec 2016 06:25:40 -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; Mon, 12 Dec 2016 06:25:40 +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 1D3C31A01C7 for ; Mon, 12 Dec 2016 06:25:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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 F2LWaKKN70kF for ; Mon, 12 Dec 2016 06:25:37 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 323185FAE6 for ; Mon, 12 Dec 2016 06:25:36 +0000 (UTC) Received: (qmail 50156 invoked by uid 99); 12 Dec 2016 06:25:35 -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; Mon, 12 Dec 2016 06:25:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 57019E0005; Mon, 12 Dec 2016 06:25:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ravipesala@apache.org To: commits@carbondata.incubator.apache.org Date: Mon, 12 Dec 2016 06:25:35 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-carbondata git commit: added test cases for core.reader module archived-at: Mon, 12 Dec 2016 06:25:42 -0000 Repository: incubator-carbondata Updated Branches: refs/heads/master 79c34ee7e -> 311a7d31b added test cases for core.reader module formated the code changed in assertion imports corrected the package name added test cases for core.carbon.querystatistics module remove unwanted files removed test db file Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/fe5402e3 Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/fe5402e3 Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/fe5402e3 Branch: refs/heads/master Commit: fe5402e3f90b2e248c9c72ccd551ba172292c92a Parents: 79c34ee Author: anubhav100 Authored: Fri Nov 25 16:37:41 2016 +0530 Committer: ravipesala Committed: Mon Dec 12 11:53:52 2016 +0530 ---------------------------------------------------------------------- .../DriverQueryStatisticsRecorderImplTest.java | 121 +++++++++++++++++++ .../QueryStasticsRecorderImplTest.java | 110 +++++++++++++++++ 2 files changed, 231 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/fe5402e3/core/src/test/java/org/apache/carbondata/core/carbon/querystatistics/DriverQueryStatisticsRecorderImplTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/querystatistics/DriverQueryStatisticsRecorderImplTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/querystatistics/DriverQueryStatisticsRecorderImplTest.java new file mode 100644 index 0000000..1c5749b --- /dev/null +++ b/core/src/test/java/org/apache/carbondata/core/carbon/querystatistics/DriverQueryStatisticsRecorderImplTest.java @@ -0,0 +1,121 @@ +/* + * 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.carbondata.core.carbon.querystatistics; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.BeforeClass; +import org.junit.Test; + +import static junit.framework.TestCase.assertNotNull; +import static org.pentaho.di.core.util.Assert.assertNull; + +public class DriverQueryStatisticsRecorderImplTest { + + private static DriverQueryStatisticsRecorderImpl driverQueryStatisticsRecorderImpl = null; + private static QueryStatistic queryStasticsWithSQL_PARSE = null; + private static QueryStatistic queryStasticsWithLoadMetaData = null; + private static QueryStatistic queryStasticsWithLOAD_BLOCKS_DRIVER = null; + private static QueryStatistic queryStasticsWithBLOCK_ALLOCATION = null; + private static QueryStatistic queryStasticsWithBLOCK_IDENTIFICATION = null; + + private static List queryStatisticList; + + @BeforeClass public static void setUp() { + driverQueryStatisticsRecorderImpl = DriverQueryStatisticsRecorderImpl.getInstance(); + queryStasticsWithSQL_PARSE = new QueryStatistic(); + queryStasticsWithLoadMetaData = new QueryStatistic(); + queryStasticsWithLOAD_BLOCKS_DRIVER = new QueryStatistic(); + queryStasticsWithBLOCK_ALLOCATION = new QueryStatistic(); + queryStasticsWithBLOCK_IDENTIFICATION = new QueryStatistic(); + queryStatisticList = new ArrayList<>(); + + } + + @Test public void testCollectDriverStatistics() { + queryStasticsWithLOAD_BLOCKS_DRIVER + .addCountStatistic(QueryStatisticsConstants.LOAD_BLOCKS_DRIVER, 3); + queryStasticsWithLOAD_BLOCKS_DRIVER + .addStatistics(QueryStatisticsConstants.LOAD_BLOCKS_DRIVER, 5); + queryStasticsWithLOAD_BLOCKS_DRIVER + .addFixedTimeStatistic(QueryStatisticsConstants.LOAD_BLOCKS_DRIVER, 5); + queryStatisticList.add(queryStasticsWithLOAD_BLOCKS_DRIVER); + queryStasticsWithBLOCK_ALLOCATION + .addCountStatistic(QueryStatisticsConstants.BLOCK_ALLOCATION, 3); + queryStasticsWithBLOCK_ALLOCATION.addStatistics(QueryStatisticsConstants.BLOCK_ALLOCATION, 5); + queryStasticsWithLOAD_BLOCKS_DRIVER + .addFixedTimeStatistic(QueryStatisticsConstants.LOAD_BLOCKS_DRIVER, 5); + queryStatisticList.add(queryStasticsWithBLOCK_ALLOCATION); + queryStasticsWithBLOCK_IDENTIFICATION + .addCountStatistic(QueryStatisticsConstants.BLOCK_IDENTIFICATION, 3); + queryStasticsWithBLOCK_IDENTIFICATION + .addStatistics(QueryStatisticsConstants.BLOCK_IDENTIFICATION, 5); + queryStatisticList.add(queryStasticsWithBLOCK_IDENTIFICATION); + queryStasticsWithLoadMetaData.addCountStatistic(QueryStatisticsConstants.LOAD_META, 3); + queryStasticsWithLoadMetaData.addStatistics(QueryStatisticsConstants.LOAD_META, 5); + queryStatisticList.add(queryStasticsWithLoadMetaData); + queryStasticsWithSQL_PARSE.addCountStatistic(QueryStatisticsConstants.SQL_PARSE, 3); + queryStasticsWithSQL_PARSE.addStatistics(QueryStatisticsConstants.SQL_PARSE, 5); + queryStatisticList.add(queryStasticsWithSQL_PARSE); + + String result = + driverQueryStatisticsRecorderImpl.collectDriverStatistics(queryStatisticList, "query1"); + assertNotNull(result); + } + + @Test public void testCollectDriverStatisticsWithBlock_Allocation() { + queryStatisticList.clear(); + queryStasticsWithBLOCK_ALLOCATION + .addCountStatistic(QueryStatisticsConstants.BLOCK_ALLOCATION, 3); + queryStasticsWithBLOCK_ALLOCATION.addStatistics(QueryStatisticsConstants.BLOCK_ALLOCATION, 5); + queryStatisticList.add(queryStasticsWithBLOCK_ALLOCATION); + String result = + driverQueryStatisticsRecorderImpl.collectDriverStatistics(queryStatisticList, "query1"); + assertNull(result); + } + + @Test public void testCollectDriverStatisticsWithBlock_AllocationAndBlock_Identification() { + queryStatisticList.clear(); + queryStasticsWithBLOCK_ALLOCATION + .addCountStatistic(QueryStatisticsConstants.BLOCK_ALLOCATION, 3); + queryStasticsWithBLOCK_ALLOCATION.addStatistics(QueryStatisticsConstants.BLOCK_ALLOCATION, 5); + queryStatisticList.add(queryStasticsWithBLOCK_ALLOCATION); + queryStasticsWithBLOCK_IDENTIFICATION + .addCountStatistic(QueryStatisticsConstants.BLOCK_IDENTIFICATION, 3); + queryStasticsWithBLOCK_IDENTIFICATION + .addStatistics(QueryStatisticsConstants.BLOCK_IDENTIFICATION, 5); + queryStatisticList.add(queryStasticsWithBLOCK_IDENTIFICATION); + String result = + driverQueryStatisticsRecorderImpl.collectDriverStatistics(queryStatisticList, "query1"); + assertNotNull(result); + } + + @Test + public void testCollectDriverStatisticsWithBlock_AllocationAndBlock_IdentificationForException() { + queryStatisticList.clear(); + + driverQueryStatisticsRecorderImpl = DriverQueryStatisticsRecorderImpl.getInstance(); + + String result = + driverQueryStatisticsRecorderImpl.collectDriverStatistics(queryStatisticList, "query1"); + assertNull(result); + } +} + http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/fe5402e3/core/src/test/java/org/apache/carbondata/core/carbon/querystatistics/QueryStasticsRecorderImplTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/carbondata/core/carbon/querystatistics/QueryStasticsRecorderImplTest.java b/core/src/test/java/org/apache/carbondata/core/carbon/querystatistics/QueryStasticsRecorderImplTest.java new file mode 100644 index 0000000..fd2a55e --- /dev/null +++ b/core/src/test/java/org/apache/carbondata/core/carbon/querystatistics/QueryStasticsRecorderImplTest.java @@ -0,0 +1,110 @@ +/* + * 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.carbondata.core.carbon.querystatistics; + +import org.junit.BeforeClass; +import org.junit.Test; + +import static junit.framework.TestCase.assertNotNull; + +public class QueryStasticsRecorderImplTest { + + private static QueryStatisticsRecorderImpl queryStasticsRecorderImpl = null; + private static QueryStatistic queryStatistic = null; + private static QueryStatistic queryStatisticWithLOAD_BLOCKS_EXECUTOR = null; + private static QueryStatistic queryStatisticWithSCAN_BLOCKS_TIME = null; + private static QueryStatistic queryStatisticWithSCAN_BLOCKS_NUM = null; + private static QueryStatistic queryStatisticWithLOAD_DICTIONARY = null; + private static QueryStatistic queryStatisticWithRESULT_SIZE = null; + private static QueryStatistic queryStatisticWithEXECUTOR_PART = null; + private static QueryStatistic queryStatisticWithTOTAL_BLOCKLET_NUM = null; + private static QueryStatistic queryStatisticWithVALID_SCAN_BLOCKLET_NUM = null; + + @BeforeClass public static void setUp() { + queryStatisticWithLOAD_BLOCKS_EXECUTOR = new QueryStatistic(); + queryStasticsRecorderImpl = new QueryStatisticsRecorderImpl("query1"); + queryStasticsRecorderImpl.logStatisticsAsTableDriver(); + queryStasticsRecorderImpl.logStatisticsAsTableExecutor(); + queryStatisticWithLOAD_BLOCKS_EXECUTOR + .addStatistics(QueryStatisticsConstants.LOAD_BLOCKS_EXECUTOR, 5L); + queryStatisticWithLOAD_BLOCKS_EXECUTOR + .addCountStatistic(QueryStatisticsConstants.LOAD_BLOCKS_EXECUTOR, 5L); + queryStatisticWithLOAD_BLOCKS_EXECUTOR + .addStatistics(QueryStatisticsConstants.LOAD_BLOCKS_EXECUTOR, 5L); + queryStasticsRecorderImpl.logStatistics(); + queryStasticsRecorderImpl.recordStatistics(queryStatisticWithLOAD_BLOCKS_EXECUTOR); + queryStatisticWithSCAN_BLOCKS_TIME = new QueryStatistic(); + queryStatisticWithSCAN_BLOCKS_TIME.addStatistics(QueryStatisticsConstants.SCAN_BLOCKS_TIME, 5L); + queryStatisticWithSCAN_BLOCKS_TIME + .addCountStatistic(QueryStatisticsConstants.SCAN_BLOCKS_TIME, 5L); + queryStatisticWithSCAN_BLOCKS_TIME.addStatistics(QueryStatisticsConstants.SCAN_BLOCKS_TIME, 5L); + queryStasticsRecorderImpl.logStatistics(); + queryStasticsRecorderImpl.recordStatistics(queryStatisticWithSCAN_BLOCKS_TIME); + queryStatisticWithSCAN_BLOCKS_NUM = new QueryStatistic(); + queryStatisticWithSCAN_BLOCKS_NUM.addStatistics(QueryStatisticsConstants.SCAN_BLOCKS_NUM, 5L); + queryStatisticWithSCAN_BLOCKS_NUM + .addCountStatistic(QueryStatisticsConstants.SCAN_BLOCKS_NUM, 5L); + queryStatisticWithSCAN_BLOCKS_NUM.addStatistics(QueryStatisticsConstants.SCAN_BLOCKS_NUM, 5L); + queryStasticsRecorderImpl.logStatistics(); + queryStasticsRecorderImpl.recordStatistics(queryStatisticWithSCAN_BLOCKS_NUM); + queryStatisticWithLOAD_DICTIONARY = new QueryStatistic(); + queryStatisticWithLOAD_DICTIONARY.addStatistics(QueryStatisticsConstants.LOAD_DICTIONARY, 5L); + queryStatisticWithLOAD_DICTIONARY + .addCountStatistic(QueryStatisticsConstants.LOAD_DICTIONARY, 5L); + queryStatisticWithLOAD_DICTIONARY.addStatistics(QueryStatisticsConstants.LOAD_DICTIONARY, 5L); + queryStasticsRecorderImpl.logStatistics(); + queryStasticsRecorderImpl.recordStatistics(queryStatisticWithLOAD_DICTIONARY); + queryStatisticWithRESULT_SIZE = new QueryStatistic(); + queryStatisticWithRESULT_SIZE.addStatistics(QueryStatisticsConstants.RESULT_SIZE, 5L); + queryStatisticWithRESULT_SIZE.addCountStatistic(QueryStatisticsConstants.RESULT_SIZE, 5L); + queryStatisticWithRESULT_SIZE.addStatistics(QueryStatisticsConstants.RESULT_SIZE, 5L); + queryStasticsRecorderImpl.logStatistics(); + queryStasticsRecorderImpl.recordStatistics(queryStatisticWithRESULT_SIZE); + queryStatisticWithEXECUTOR_PART = new QueryStatistic(); + queryStatisticWithEXECUTOR_PART.addStatistics(QueryStatisticsConstants.EXECUTOR_PART, 5L); + queryStatisticWithEXECUTOR_PART.addCountStatistic(QueryStatisticsConstants.EXECUTOR_PART, 5L); + queryStatisticWithEXECUTOR_PART.addStatistics(QueryStatisticsConstants.EXECUTOR_PART, 5L); + queryStasticsRecorderImpl.logStatistics(); + queryStasticsRecorderImpl.recordStatistics(queryStatisticWithEXECUTOR_PART); + queryStatisticWithTOTAL_BLOCKLET_NUM = new QueryStatistic(); + queryStatisticWithTOTAL_BLOCKLET_NUM + .addStatistics(QueryStatisticsConstants.TOTAL_BLOCKLET_NUM, 5L); + queryStatisticWithTOTAL_BLOCKLET_NUM + .addCountStatistic(QueryStatisticsConstants.TOTAL_BLOCKLET_NUM, 5L); + queryStatisticWithTOTAL_BLOCKLET_NUM + .addStatistics(QueryStatisticsConstants.TOTAL_BLOCKLET_NUM, 5L); + queryStasticsRecorderImpl.logStatistics(); + queryStasticsRecorderImpl.recordStatistics(queryStatisticWithTOTAL_BLOCKLET_NUM); + queryStatisticWithVALID_SCAN_BLOCKLET_NUM = new QueryStatistic(); + queryStatisticWithVALID_SCAN_BLOCKLET_NUM + .addStatistics(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM, 5L); + queryStatisticWithVALID_SCAN_BLOCKLET_NUM + .addCountStatistic(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM, 5L); + queryStatisticWithVALID_SCAN_BLOCKLET_NUM + .addStatistics(QueryStatisticsConstants.VALID_SCAN_BLOCKLET_NUM, 5L); + queryStasticsRecorderImpl.logStatistics(); + queryStasticsRecorderImpl.recordStatistics(queryStatisticWithVALID_SCAN_BLOCKLET_NUM); + } + + @Test public void testcollectExecutorStatistics() { + assertNotNull(queryStasticsRecorderImpl.collectExecutorStatistics()); + } + +}