Search in sources :

Example 1 with OrcRowDataCacheKey

use of io.prestosql.orc.OrcRowDataCacheKey in project hetu-core by openlookeng.

the class CachingColumnReader method getCachedBlock.

private Block getCachedBlock(long rowCount, InputStreamSources dataStreamSources) throws IOException {
    OrcRowDataCacheKey cacheKey = new OrcRowDataCacheKey();
    cacheKey.setOrcDataSourceId(new OrcDataSourceIdWithTimeStamp(orcDataSourceId, lastModifiedTime));
    cacheKey.setStripeOffset(stripeOffset);
    cacheKey.setRowGroupOffset(rowGroupOffset);
    cacheKey.setColumnId(columnId);
    try {
        return cache.get(cacheKey, () -> {
            delegate.startRowGroup(dataStreamSources);
            delegate.prepareNextRead((int) rowCount);
            log.debug("Caching row group data. DatasourceId = %s, columnId = %s, stripeOffset = %d, rowGroupOffset = %d, Column = %s", orcDataSourceId, columnId, stripeOffset, rowGroupOffset, column);
            return delegate.readBlock();
        });
    } catch (UncheckedExecutionException | ExecutionException executionException) {
        handleCacheLoadException(executionException);
        log.debug(executionException.getCause(), "Error while caching row group data. Falling back to default flow...");
        delegate.startRowGroup(dataStreamSources);
        delegate.prepareNextRead((int) rowCount);
        cachedBlock = delegate.readBlock();
        return cachedBlock;
    }
}
Also used : UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) OrcDataSourceIdWithTimeStamp(io.prestosql.orc.OrcDataSourceIdWithTimeStamp) OrcRowDataCacheKey(io.prestosql.orc.OrcRowDataCacheKey) ExecutionException(java.util.concurrent.ExecutionException) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException)

Example 2 with OrcRowDataCacheKey

use of io.prestosql.orc.OrcRowDataCacheKey in project hetu-core by openlookeng.

the class DataCachingSelectiveColumnReader method getCachedBlock.

private Block getCachedBlock(long rowCount, InputStreamSources dataStreamSources) throws IOException {
    OrcRowDataCacheKey cacheKey = new OrcRowDataCacheKey();
    cacheKey.setOrcDataSourceId(new OrcDataSourceIdWithTimeStamp(orcDataSourceId, lastModifiedTime));
    cacheKey.setStripeOffset(stripeOffset);
    cacheKey.setRowGroupOffset(rowGroupOffset);
    cacheKey.setColumnId(columnId);
    try {
        return cache.get(cacheKey, () -> {
            delegate.startRowGroup(dataStreamSources);
            delegate.prepareNextRead((int) rowCount);
            log.debug("Caching row group data. DatasourceId = %s, columnId = %s, stripeOffset = %d, rowGroupOffset = %d, Column = %s", orcDataSourceId, columnId, stripeOffset, rowGroupOffset, column);
            return delegate.readBlock();
        });
    } catch (UncheckedExecutionException | ExecutionException executionException) {
        handleCacheLoadException(executionException);
        log.debug(executionException.getCause(), "Error while caching row group data. Falling back to default flow...");
        delegate.startRowGroup(dataStreamSources);
        delegate.prepareNextRead((int) rowCount);
        cachedBlock = delegate.readBlock();
        return cachedBlock;
    }
}
Also used : UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException) OrcDataSourceIdWithTimeStamp(io.prestosql.orc.OrcDataSourceIdWithTimeStamp) OrcRowDataCacheKey(io.prestosql.orc.OrcRowDataCacheKey) ExecutionException(java.util.concurrent.ExecutionException) UncheckedExecutionException(com.google.common.util.concurrent.UncheckedExecutionException)

Aggregations

UncheckedExecutionException (com.google.common.util.concurrent.UncheckedExecutionException)2 OrcDataSourceIdWithTimeStamp (io.prestosql.orc.OrcDataSourceIdWithTimeStamp)2 OrcRowDataCacheKey (io.prestosql.orc.OrcRowDataCacheKey)2 ExecutionException (java.util.concurrent.ExecutionException)2