use of org.apache.carbondata.core.scan.result.BatchResult in project carbondata by apache.
the class CarbondataRecordSet method cursor.
/**
* get data blocks via Carbondata QueryModel API
*/
@Override
public RecordCursor cursor() {
List<TableBlockInfo> tableBlockInfoList = new ArrayList<TableBlockInfo>();
tableBlockInfoList.add(new TableBlockInfo(split.getLocalInputSplit().getPath().toString(), split.getLocalInputSplit().getStart(), split.getLocalInputSplit().getSegmentId(), split.getLocalInputSplit().getLocations().toArray(new String[0]), split.getLocalInputSplit().getLength(), //blockletInfos,
ColumnarFormatVersion.valueOf(split.getLocalInputSplit().getVersion())));
queryModel.setTableBlockInfos(tableBlockInfoList);
queryExecutor = QueryExecutorFactory.getQueryExecutor(queryModel);
//queryModel.setQueryId(queryModel.getQueryId() + "_" + split.getLocalInputSplit().getSegmentId());
try {
readSupport.initialize(queryModel.getProjectionColumns(), queryModel.getAbsoluteTableIdentifier());
CarbonIterator<Object[]> carbonIterator = new ChunkRowIterator((CarbonIterator<BatchResult>) queryExecutor.execute(queryModel));
RecordCursor rc = new CarbondataRecordCursor(readSupport, carbonIterator, columns, split);
return rc;
} catch (QueryExecutionException e) {
throw new RuntimeException(e.getMessage(), e);
} catch (Exception ex) {
throw new RuntimeException(ex.getMessage(), ex);
}
}
Aggregations