Search in sources :

Example 1 with RowBatch

use of org.apache.carbondata.core.scan.result.RowBatch in project carbondata by apache.

the class DetailQueryResultIterator method getBatchResult.

private RowBatch getBatchResult() {
    RowBatch rowBatch = new RowBatch();
    synchronized (lock) {
        updateDataBlockIterator();
        if (dataBlockIterator != null) {
            rowBatch.setRows(dataBlockIterator.next());
            rowBatch.setCarbonDataFileWrittenVersion(carbonDataFileWrittenVersion);
        }
    }
    return rowBatch;
}
Also used : RowBatch(org.apache.carbondata.core.scan.result.RowBatch)

Example 2 with RowBatch

use of org.apache.carbondata.core.scan.result.RowBatch in project carbondata by apache.

the class SecondaryIndexQueryResultProcessor method processResult.

/**
 * This method will iterate over the query result and perform row sorting operation
 */
private void processResult(List<CarbonIterator<RowBatch>> detailQueryResultIteratorList) throws SecondaryIndexException {
    for (CarbonIterator<RowBatch> detailQueryIterator : detailQueryResultIteratorList) {
        DetailQueryResultIterator queryIterator = (DetailQueryResultIterator) detailQueryIterator;
        BlockExecutionInfo blockExecutionInfo = queryIterator.getBlockExecutionInfo();
        // get complex dimension info map from block execution info
        Map<Integer, GenericQueryType> complexDimensionInfoMap = blockExecutionInfo.getComplexDimensionInfoMap();
        int[] complexColumnParentBlockIndexes = blockExecutionInfo.getComplexColumnParentBlockIndexes();
        while (detailQueryIterator.hasNext()) {
            RowBatch batchResult = detailQueryIterator.next();
            while (batchResult.hasNext()) {
                addRowForSorting(prepareRowObjectForSorting(batchResult.next(), complexDimensionInfoMap, complexColumnParentBlockIndexes));
                isRecordFound = true;
            }
        }
    }
    try {
        sortDataRows.startSorting();
    } catch (CarbonSortKeyAndGroupByException e) {
        this.sortDataRows.close();
        LOGGER.error(e);
        throw new SecondaryIndexException("Problem loading data while creating secondary index: " + e.getMessage());
    }
}
Also used : DetailQueryResultIterator(org.apache.carbondata.core.scan.result.iterator.DetailQueryResultIterator) RowBatch(org.apache.carbondata.core.scan.result.RowBatch) GenericQueryType(org.apache.carbondata.core.scan.filter.GenericQueryType) CarbonSortKeyAndGroupByException(org.apache.carbondata.processing.sort.exception.CarbonSortKeyAndGroupByException) BlockExecutionInfo(org.apache.carbondata.core.scan.executor.infos.BlockExecutionInfo) SecondaryIndexException(org.apache.spark.sql.secondaryindex.exception.SecondaryIndexException)

Example 3 with RowBatch

use of org.apache.carbondata.core.scan.result.RowBatch in project carbondata by apache.

the class CarbonSecondaryIndexExecutor method executeBlockList.

/**
 * get executor and execute the query model.
 */
private CarbonIterator<RowBatch> executeBlockList(List<TableBlockInfo> blockList) throws QueryExecutionException {
    queryModel.setTableBlockInfos(blockList);
    CarbonIterator<RowBatch> iter = null;
    try {
        iter = queryExecutor.execute(queryModel);
    } catch (IOException e) {
        LOGGER.error(e.getMessage());
        throw new QueryExecutionException(e);
    }
    return iter;
}
Also used : QueryExecutionException(org.apache.carbondata.core.scan.executor.exception.QueryExecutionException) RowBatch(org.apache.carbondata.core.scan.result.RowBatch) IOException(java.io.IOException)

Aggregations

RowBatch (org.apache.carbondata.core.scan.result.RowBatch)3 IOException (java.io.IOException)1 QueryExecutionException (org.apache.carbondata.core.scan.executor.exception.QueryExecutionException)1 BlockExecutionInfo (org.apache.carbondata.core.scan.executor.infos.BlockExecutionInfo)1 GenericQueryType (org.apache.carbondata.core.scan.filter.GenericQueryType)1 DetailQueryResultIterator (org.apache.carbondata.core.scan.result.iterator.DetailQueryResultIterator)1 CarbonSortKeyAndGroupByException (org.apache.carbondata.processing.sort.exception.CarbonSortKeyAndGroupByException)1 SecondaryIndexException (org.apache.spark.sql.secondaryindex.exception.SecondaryIndexException)1