use of com.facebook.presto.spi.RecordSet in project presto by prestodb.
the class ThriftIndexedTpchService method lookupIndexKeys.
/**
* Get lookup result and re-map output columns based on requested order.
*/
private static RecordSet lookupIndexKeys(RecordSet keys, IndexedTable table, List<String> outputColumnNames) {
RecordSet allColumnsOutputRecordSet = table.lookupKeys(keys);
List<Integer> outputRemap = computeRemap(table.getOutputColumns(), outputColumnNames);
return new MappedRecordSet(allColumnsOutputRecordSet, outputRemap);
}
use of com.facebook.presto.spi.RecordSet in project presto by prestodb.
the class ThriftIndexedTpchService method createLookupPageSource.
@Override
protected ConnectorPageSource createLookupPageSource(SplitInfo splitInfo, List<String> outputColumnNames) {
IndexedTable indexedTable = indexedData.getIndexedTable(splitInfo.getTableName(), schemaNameToScaleFactor(splitInfo.getSchemaName()), ImmutableSet.copyOf(splitInfo.getLookupColumnNames())).orElseThrow(() -> new IllegalArgumentException(String.format("No such index: %s%s", splitInfo.getTableName(), splitInfo.getLookupColumnNames())));
List<Type> lookupColumnTypes = types(splitInfo.getTableName(), splitInfo.getLookupColumnNames());
RecordSet keyRecordSet = new MappedRecordSet(new ListBasedRecordSet(splitInfo.getKeys(), lookupColumnTypes), computeRemap(splitInfo.getLookupColumnNames(), indexedTable.getKeyColumns()));
RecordSet outputRecordSet = lookupIndexKeys(keyRecordSet, indexedTable, outputColumnNames);
return new RecordPageSource(outputRecordSet);
}
use of com.facebook.presto.spi.RecordSet in project presto by prestodb.
the class KafkaRecordSetProvider method getRecordSet.
@Override
public RecordSet getRecordSet(ConnectorTransactionHandle transaction, ConnectorSession session, ConnectorSplit split, List<? extends ColumnHandle> columns) {
KafkaSplit kafkaSplit = convertSplit(split);
List<KafkaColumnHandle> kafkaColumns = columns.stream().map(KafkaHandleResolver::convertColumnHandle).collect(ImmutableList.toImmutableList());
RowDecoder keyDecoder = decoderFactory.create(kafkaSplit.getKeyDataFormat(), getDecoderParameters(kafkaSplit.getKeyDataSchemaContents()), kafkaColumns.stream().filter(col -> !col.isInternal()).filter(KafkaColumnHandle::isKeyCodec).collect(toImmutableSet()));
RowDecoder messageDecoder = decoderFactory.create(kafkaSplit.getMessageDataFormat(), getDecoderParameters(kafkaSplit.getMessageDataSchemaContents()), kafkaColumns.stream().filter(col -> !col.isInternal()).filter(col -> !col.isKeyCodec()).collect(toImmutableSet()));
return new KafkaRecordSet(kafkaSplit, consumerManager, kafkaColumns, keyDecoder, messageDecoder);
}
use of com.facebook.presto.spi.RecordSet in project presto by prestodb.
the class TestJmxSplitManager method testHistoryRecordSetProvider.
@Test
public void testHistoryRecordSetProvider() throws Exception {
for (SchemaTableName schemaTableName : metadata.listTables(SESSION, HISTORY_SCHEMA_NAME)) {
// wait for at least two samples
List<Long> timeStamps = ImmutableList.of();
for (int waited = 0; waited < TIMEOUT_TIME; waited += SLEEP_TIME) {
RecordSet recordSet = getRecordSet(schemaTableName);
timeStamps = readTimeStampsFrom(recordSet);
if (timeStamps.size() >= 2) {
break;
}
Thread.sleep(SLEEP_TIME);
}
assertTrue(timeStamps.size() >= 2);
// we don't have equality check here because JmxHistoryDumper scheduling can lag
assertTrue(timeStamps.get(1) - timeStamps.get(0) >= JMX_STATS_DUMP.toMillis());
}
}
use of com.facebook.presto.spi.RecordSet in project presto by prestodb.
the class CommonSubExpressionBenchmark method ComputeRecordSet.
@Benchmark
public Optional<Page> ComputeRecordSet() {
List<Type> types = ImmutableList.of(TYPE_MAP.get(this.functionType));
PageBuilder pageBuilder = new PageBuilder(projectionTypes);
RecordSet recordSet = new PageRecordSet(types, inputPage);
cursorProcessor.process(null, new DriverYieldSignal(), recordSet.cursor(), pageBuilder);
return Optional.of(pageBuilder.build());
}
Aggregations