You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by jb...@apache.org on 2016/06/23 14:16:09 UTC
[21/56] [abbrv] incubator-carbondata git commit: remove
AbastructQueryExecutor (#690)
remove AbastructQueryExecutor (#690)
Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/656577d5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/656577d5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/656577d5
Branch: refs/heads/master
Commit: 656577d5c05d57291de77084d8993553a49cdfdc
Parents: 6288ec7
Author: Jacky Li <ja...@huawei.com>
Authored: Sat Jun 18 14:41:02 2016 +0800
Committer: Ravindra Pesala <ra...@gmail.com>
Committed: Sat Jun 18 12:11:02 2016 +0530
----------------------------------------------------------------------
.../impl/ListBasedResultAggregator.java | 10 +-
.../impl/InternalAbstractQueryExecutor.java | 120 -------------------
2 files changed, 4 insertions(+), 126 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/656577d5/core/src/main/java/org/carbondata/query/carbon/aggregator/impl/ListBasedResultAggregator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/query/carbon/aggregator/impl/ListBasedResultAggregator.java b/core/src/main/java/org/carbondata/query/carbon/aggregator/impl/ListBasedResultAggregator.java
index 074e9ea..10bf88c 100644
--- a/core/src/main/java/org/carbondata/query/carbon/aggregator/impl/ListBasedResultAggregator.java
+++ b/core/src/main/java/org/carbondata/query/carbon/aggregator/impl/ListBasedResultAggregator.java
@@ -177,13 +177,11 @@ public class ListBasedResultAggregator implements ScannedResultAggregator {
* Below method will used to get the result
*/
@Override public Result getAggregatedResult() {
- Result result = new ListBasedResult();
+ Result<List<ListBasedResultWrapper>, Object> result = new ListBasedResult();
if (!tableBlockExecutionInfos.isFixedKeyUpdateRequired()) {
- updateKeyWithLatestBlockKeygenerator();
- result.addScannedResult(listBasedResult);
- } else {
- result.addScannedResult(listBasedResult);
+ updateKeyWithLatestBlockKeyGenerator();
}
+ result.addScannedResult(listBasedResult);
return result;
}
@@ -195,7 +193,7 @@ public class ListBasedResultAggregator implements ScannedResultAggregator {
*
* @return updated block
*/
- private void updateKeyWithLatestBlockKeygenerator() {
+ private void updateKeyWithLatestBlockKeyGenerator() {
try {
long[] data = null;
ByteArrayWrapper key = null;
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/656577d5/core/src/main/java/org/carbondata/query/carbon/executor/internal/impl/InternalAbstractQueryExecutor.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/carbondata/query/carbon/executor/internal/impl/InternalAbstractQueryExecutor.java b/core/src/main/java/org/carbondata/query/carbon/executor/internal/impl/InternalAbstractQueryExecutor.java
deleted file mode 100644
index a8c2c3a..0000000
--- a/core/src/main/java/org/carbondata/query/carbon/executor/internal/impl/InternalAbstractQueryExecutor.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.carbondata.query.carbon.executor.internal.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.carbondata.common.logging.LogService;
-import org.carbondata.common.logging.LogServiceFactory;
-import org.carbondata.core.carbon.datastore.DataRefNode;
-import org.carbondata.core.carbon.datastore.DataRefNodeFinder;
-import org.carbondata.core.carbon.datastore.impl.btree.BTreeDataRefNodeFinder;
-import org.carbondata.core.iterator.CarbonIterator;
-import org.carbondata.query.carbon.executor.exception.QueryExecutionException;
-import org.carbondata.query.carbon.executor.infos.BlockExecutionInfo;
-import org.carbondata.query.carbon.executor.internal.InternalQueryExecutor;
-import org.carbondata.query.carbon.merger.ScannedResultMerger;
-import org.carbondata.query.carbon.merger.impl.UnSortedScannedResultMerger;
-import org.carbondata.query.carbon.result.Result;
-
-/**
- * Query executor class which will have common implementation
- * among all type of executor
- */
-public abstract class InternalAbstractQueryExecutor implements InternalQueryExecutor {
-
- /**
- * LOGGER.
- */
- private static final LogService LOGGER =
- LogServiceFactory.getLogService(InternalAbstractQueryExecutor.class.getName());
-
- /**
- * Executor Service.
- */
- protected ExecutorService execService;
-
- /**
- * number of cores to be used
- */
- protected int numberOfCores;
-
- /**
- * Below method will be used to used to execute the detail query
- * and it will return iterator over result
- *
- * @param tableBlockExecutionInfosList block execution info which will have all the properties
- * required for query execution
- * @param sliceIndex slice indexes to be executed in this case it w
- * @return query result
- */
- @Override public CarbonIterator<Result> executeQuery(
- List<BlockExecutionInfo> tableBlockExecutionInfosList, int[] sliceIndex)
- throws QueryExecutionException {
-
- long startTime = System.currentTimeMillis();
- BlockExecutionInfo latestInfo =
- tableBlockExecutionInfosList.get(tableBlockExecutionInfosList.size() - 1);
- execService = Executors.newFixedThreadPool(numberOfCores);
- ScannedResultMerger scannedResultProcessor = null;
- scannedResultProcessor = new UnSortedScannedResultMerger(latestInfo, numberOfCores);
- try {
- List<Future> listFutureObjects = new ArrayList<Future>();
- for (BlockExecutionInfo blockInfo : tableBlockExecutionInfosList) {
- DataRefNodeFinder finder = new BTreeDataRefNodeFinder(blockInfo.getEachColumnValueSize());
- DataRefNode startDataBlock = finder
- .findFirstDataBlock(blockInfo.getDataBlock().getDataRefNode(), blockInfo.getStartKey());
- DataRefNode endDataBlock = finder
- .findLastDataBlock(blockInfo.getDataBlock().getDataRefNode(), blockInfo.getEndKey());
- long numberOfBlockToScan = endDataBlock.nodeNumber() - startDataBlock.nodeNumber() + 1;
- blockInfo.setFirstDataBlock(startDataBlock);
- blockInfo.setNumberOfBlockToScan(numberOfBlockToScan);
- blockInfo.setScannedResultProcessor(scannedResultProcessor);
- listFutureObjects.add(execService.submit(new QueryRunner(blockInfo)));
- }
- execService.shutdown();
- execService.awaitTermination(2, TimeUnit.DAYS);
- LOGGER.info("Total time taken for scan " + (System.currentTimeMillis() - startTime));
- for (Future future : listFutureObjects) {
- try {
- future.get();
- } catch (ExecutionException e) {
- throw new QueryExecutionException(e.getMessage());
- }
- }
- return scannedResultProcessor.getQueryResultIterator();
- } catch (QueryExecutionException e) {
- LOGGER.error(e, e.getMessage());
- throw new QueryExecutionException(e);
- } catch (InterruptedException e) {
- LOGGER.error(e, e.getMessage());
- throw new QueryExecutionException(e);
- } finally {
- execService = null;
- latestInfo = null;
- }
- }
-
-}