use of org.apache.carbondata.presto.impl.CarbonLocalInputSplit in project carbondata by apache.
the class CarbondataRecordSet method cursor.
/**
* get data blocks via Carbondata QueryModel API.
*/
@Override
public RecordCursor cursor() {
CarbonLocalInputSplit carbonLocalInputSplit = split.getLocalInputSplit();
List<CarbonInputSplit> splitList = new ArrayList<>(1);
splitList.add(CarbonLocalInputSplit.convertSplit(carbonLocalInputSplit));
List<TableBlockInfo> tableBlockInfoList = CarbonInputSplit.createBlocks(splitList);
queryModel.setTableBlockInfos(tableBlockInfoList);
queryExecutor = QueryExecutorFactory.getQueryExecutor(queryModel);
try {
readSupport.initialize(queryModel.getProjectionColumns(), queryModel.getTable());
CarbonIterator iterator = queryExecutor.execute(queryModel);
PrestoCarbonVectorizedRecordReader vectorReader = new PrestoCarbonVectorizedRecordReader(queryExecutor, queryModel, (AbstractDetailQueryResultIterator) iterator);
return new CarbondataRecordCursor(readSupport, vectorReader, columns, split);
} catch (QueryExecutionException e) {
throw new RuntimeException(e.getMessage(), e);
} catch (Exception ex) {
throw new RuntimeException(ex.getMessage(), ex);
}
}
use of org.apache.carbondata.presto.impl.CarbonLocalInputSplit in project carbondata by apache.
the class CarbondataSplitManager method getSplits.
public ConnectorSplitSource getSplits(ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorTableLayoutHandle layout) {
CarbondataTableLayoutHandle layoutHandle = (CarbondataTableLayoutHandle) layout;
CarbondataTableHandle tableHandle = layoutHandle.getTable();
SchemaTableName key = tableHandle.getSchemaTableName();
// Packaging presto-TupleDomain into CarbondataColumnConstraint, to decouple from presto-spi Module
List<CarbondataColumnConstraint> rebuildConstraints = getColumnConstraints(layoutHandle.getConstraint());
CarbonTableCacheModel cache = carbonTableReader.getCarbonCache(key);
Expression filters = PrestoFilterUtil.parseFilterExpression(layoutHandle.getConstraint());
try {
List<CarbonLocalInputSplit> splits = carbonTableReader.getInputSplits2(cache, filters);
ImmutableList.Builder<ConnectorSplit> cSplits = ImmutableList.builder();
for (CarbonLocalInputSplit split : splits) {
cSplits.add(new CarbondataSplit(connectorId, tableHandle.getSchemaTableName(), layoutHandle.getConstraint(), split, rebuildConstraints));
}
return new FixedSplitSource(cSplits.build());
} catch (Exception ex) {
throw new RuntimeException(ex.getMessage(), ex);
}
}
Aggregations