You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ra...@apache.org on 2016/12/12 06:25:35 UTC
[1/2] incubator-carbondata git commit: added test cases for
core.reader module
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 <an...@knoldus.in>
Authored: Fri Nov 25 16:37:41 2016 +0530
Committer: ravipesala <ra...@gmail.com>
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<QueryStatistic> 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());
+ }
+
+}
[2/2] incubator-carbondata git commit: [CARBONDATA-475] Added test
cases for org.apache.carbondata.core.carbon.querystatistics This closes #374
Posted by ra...@apache.org.
[CARBONDATA-475] Added test cases for org.apache.carbondata.core.carbon.querystatistics This closes #374
Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/311a7d31
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/311a7d31
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/311a7d31
Branch: refs/heads/master
Commit: 311a7d31bfe597903f074597378266e34fa843fb
Parents: 79c34ee fe5402e
Author: ravipesala <ra...@gmail.com>
Authored: Mon Dec 12 11:55:16 2016 +0530
Committer: ravipesala <ra...@gmail.com>
Committed: Mon Dec 12 11:55:16 2016 +0530
----------------------------------------------------------------------
.../DriverQueryStatisticsRecorderImplTest.java | 121 +++++++++++++++++++
.../QueryStasticsRecorderImplTest.java | 110 +++++++++++++++++
2 files changed, 231 insertions(+)
----------------------------------------------------------------------