Search in sources :

Example 6 with RecordPageSource

use of com.facebook.presto.spi.RecordPageSource in project presto by prestodb.

the class AbstractTestHiveClient method assertPageSourceType.

protected static void assertPageSourceType(ConnectorPageSource pageSource, HiveStorageFormat hiveStorageFormat) {
    if (pageSource instanceof RecordPageSource) {
        RecordCursor hiveRecordCursor = ((RecordPageSource) pageSource).getCursor();
        hiveRecordCursor = ((HiveRecordCursor) hiveRecordCursor).getRegularColumnRecordCursor();
        if (hiveRecordCursor instanceof HiveCoercionRecordCursor) {
            hiveRecordCursor = ((HiveCoercionRecordCursor) hiveRecordCursor).getRegularColumnRecordCursor();
        }
        assertInstanceOf(hiveRecordCursor, recordCursorType(hiveStorageFormat), hiveStorageFormat.name());
    } else {
        assertInstanceOf(((HivePageSource) pageSource).getPageSource(), pageSourceType(hiveStorageFormat), hiveStorageFormat.name());
    }
}
Also used : ParquetHiveRecordCursor(com.facebook.presto.hive.parquet.ParquetHiveRecordCursor) RecordCursor(com.facebook.presto.spi.RecordCursor) RecordPageSource(com.facebook.presto.spi.RecordPageSource)

Example 7 with RecordPageSource

use of com.facebook.presto.spi.RecordPageSource in project presto by prestodb.

the class TpchConnectorIndex method lookup.

@Override
public ConnectorPageSource lookup(RecordSet rawInputRecordSet) {
    // convert the input record set from the column ordering in the query to
    // match the column ordering of the index
    RecordSet inputRecordSet = keyFormatter.apply(rawInputRecordSet);
    // lookup the values in the index
    RecordSet rawOutputRecordSet = indexedTable.lookupKeys(inputRecordSet);
    // expect by the query
    return new RecordPageSource(outputFormatter.apply(rawOutputRecordSet));
}
Also used : RecordSet(com.facebook.presto.spi.RecordSet) RecordPageSource(com.facebook.presto.spi.RecordPageSource)

Aggregations

RecordPageSource (com.facebook.presto.spi.RecordPageSource)7 ConnectorPageSource (com.facebook.presto.spi.ConnectorPageSource)4 ColumnHandle (com.facebook.presto.spi.ColumnHandle)3 RecordCursor (com.facebook.presto.spi.RecordCursor)3 TupleDomain (com.facebook.presto.spi.predicate.TupleDomain)3 ImmutableList (com.google.common.collect.ImmutableList)3 ConnectorSession (com.facebook.presto.spi.ConnectorSession)2 Page (com.facebook.presto.spi.Page)2 PrestoException (com.facebook.presto.spi.PrestoException)2 ImmutableCollectors.toImmutableList (com.facebook.presto.util.ImmutableCollectors.toImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Test (org.testng.annotations.Test)2 Session (com.facebook.presto.Session)1 ConnectorId (com.facebook.presto.connector.ConnectorId)1 REGULAR (com.facebook.presto.hive.HiveColumnHandle.ColumnType.REGULAR)1 ColumnMapping.extractRegularColumnHandles (com.facebook.presto.hive.HivePageSourceProvider.ColumnMapping.extractRegularColumnHandles)1 AVRO (com.facebook.presto.hive.HiveStorageFormat.AVRO)1 DWRF (com.facebook.presto.hive.HiveStorageFormat.DWRF)1 JSON (com.facebook.presto.hive.HiveStorageFormat.JSON)1 ORC (com.facebook.presto.hive.HiveStorageFormat.ORC)1