Search in sources :

Example 1 with BlockEncodingSerde

use of io.trino.spi.block.BlockEncodingSerde in project trino by trinodb.

the class TestBinaryFileSpiller method setUp.

@BeforeMethod
public void setUp() {
    spillerStats = new SpillerStats();
    FeaturesConfig featuresConfig = new FeaturesConfig();
    featuresConfig.setSpillerSpillPaths(spillPath.getAbsolutePath());
    featuresConfig.setSpillMaxUsedSpaceThreshold(1.0);
    NodeSpillConfig nodeSpillConfig = new NodeSpillConfig();
    BlockEncodingSerde blockEncodingSerde = new TestingBlockEncodingSerde();
    singleStreamSpillerFactory = new FileSingleStreamSpillerFactory(blockEncodingSerde, spillerStats, featuresConfig, nodeSpillConfig);
    factory = new GenericSpillerFactory(singleStreamSpillerFactory);
    PagesSerdeFactory pagesSerdeFactory = new PagesSerdeFactory(blockEncodingSerde, nodeSpillConfig.isSpillCompressionEnabled());
    pagesSerde = pagesSerdeFactory.createPagesSerde();
    memoryContext = newSimpleAggregatedMemoryContext();
}
Also used : PagesSerdeFactory(io.trino.execution.buffer.PagesSerdeFactory) TestingBlockEncodingSerde(io.trino.spi.block.TestingBlockEncodingSerde) FeaturesConfig(io.trino.FeaturesConfig) TestingBlockEncodingSerde(io.trino.spi.block.TestingBlockEncodingSerde) BlockEncodingSerde(io.trino.spi.block.BlockEncodingSerde) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with BlockEncodingSerde

use of io.trino.spi.block.BlockEncodingSerde in project trino by trinodb.

the class ExecutingStatementResource method getQuery.

protected Query getQuery(QueryId queryId, String slug, long token) {
    Query query = queries.get(queryId);
    if (query != null) {
        if (!query.isSlugValid(slug, token)) {
            throw queryNotFound();
        }
        return query;
    }
    // this is the first time the query has been accessed on this coordinator
    Session session;
    Slug querySlug;
    try {
        session = queryManager.getQuerySession(queryId);
        querySlug = queryManager.getQuerySlug(queryId);
        if (!querySlug.isValid(EXECUTING_QUERY, slug, token)) {
            throw queryNotFound();
        }
    } catch (NoSuchElementException e) {
        throw queryNotFound();
    }
    query = queries.computeIfAbsent(queryId, id -> Query.create(session, querySlug, queryManager, queryInfoUrlFactory.getQueryInfoUrl(queryId), directExchangeClientSupplier, responseExecutor, timeoutExecutor, blockEncodingSerde));
    return query;
}
Also used : QueryId(io.trino.spi.QueryId) ResourceSecurity(io.trino.server.security.ResourceSecurity) Produces(javax.ws.rs.Produces) QueryManager(io.trino.execution.QueryManager) Path(javax.ws.rs.Path) Duration(io.airlift.units.Duration) PreDestroy(javax.annotation.PreDestroy) MediaType(javax.ws.rs.core.MediaType) Executors.newSingleThreadScheduledExecutor(java.util.concurrent.Executors.newSingleThreadScheduledExecutor) QueryParam(javax.ws.rs.QueryParam) EXECUTING_QUERY(io.trino.server.protocol.Slug.Context.EXECUTING_QUERY) BoundedExecutor(io.airlift.concurrent.BoundedExecutor) QueryResults(io.trino.client.QueryResults) DELETE(javax.ws.rs.DELETE) Context(javax.ws.rs.core.Context) AsyncResponse(javax.ws.rs.container.AsyncResponse) NOT_FOUND(javax.ws.rs.core.Response.Status.NOT_FOUND) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) Threads.threadsNamed(io.airlift.concurrent.Threads.threadsNamed) Suspended(javax.ws.rs.container.Suspended) MoreExecutors.directExecutor(com.google.common.util.concurrent.MoreExecutors.directExecutor) DirectExchangeClientSupplier(io.trino.operator.DirectExchangeClientSupplier) PUBLIC(io.trino.server.security.ResourceSecurity.AccessType.PUBLIC) DataSize(io.airlift.units.DataSize) Response(javax.ws.rs.core.Response) Entry(java.util.Map.Entry) WebApplicationException(javax.ws.rs.WebApplicationException) UriInfo(javax.ws.rs.core.UriInfo) AsyncResponseHandler.bindAsyncResponse(io.airlift.jaxrs.AsyncResponseHandler.bindAsyncResponse) Session(io.trino.Session) PathParam(javax.ws.rs.PathParam) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Logger(io.airlift.log.Logger) GET(javax.ws.rs.GET) MEGABYTE(io.airlift.units.DataSize.Unit.MEGABYTE) ConcurrentMap(java.util.concurrent.ConcurrentMap) Inject(javax.inject.Inject) Objects.requireNonNull(java.util.Objects.requireNonNull) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) NoSuchElementException(java.util.NoSuchElementException) ResponseBuilder(javax.ws.rs.core.Response.ResponseBuilder) ServerConfig(io.trino.server.ServerConfig) ProtocolHeaders(io.trino.client.ProtocolHeaders) UTF_8(java.nio.charset.StandardCharsets.UTF_8) TEXT_PLAIN_TYPE(javax.ws.rs.core.MediaType.TEXT_PLAIN_TYPE) ForStatementResource(io.trino.server.ForStatementResource) Futures(com.google.common.util.concurrent.Futures) URLEncoder(java.net.URLEncoder) Ordering(com.google.common.collect.Ordering) BlockEncodingSerde(io.trino.spi.block.BlockEncodingSerde) SECONDS(java.util.concurrent.TimeUnit.SECONDS) NoSuchElementException(java.util.NoSuchElementException) Session(io.trino.Session)

Aggregations

BlockEncodingSerde (io.trino.spi.block.BlockEncodingSerde)2 Ordering (com.google.common.collect.Ordering)1 Futures (com.google.common.util.concurrent.Futures)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 MoreExecutors.directExecutor (com.google.common.util.concurrent.MoreExecutors.directExecutor)1 BoundedExecutor (io.airlift.concurrent.BoundedExecutor)1 Threads.threadsNamed (io.airlift.concurrent.Threads.threadsNamed)1 AsyncResponseHandler.bindAsyncResponse (io.airlift.jaxrs.AsyncResponseHandler.bindAsyncResponse)1 Logger (io.airlift.log.Logger)1 DataSize (io.airlift.units.DataSize)1 MEGABYTE (io.airlift.units.DataSize.Unit.MEGABYTE)1 Duration (io.airlift.units.Duration)1 FeaturesConfig (io.trino.FeaturesConfig)1 Session (io.trino.Session)1 ProtocolHeaders (io.trino.client.ProtocolHeaders)1 QueryResults (io.trino.client.QueryResults)1 QueryManager (io.trino.execution.QueryManager)1 PagesSerdeFactory (io.trino.execution.buffer.PagesSerdeFactory)1 DirectExchangeClientSupplier (io.trino.operator.DirectExchangeClientSupplier)1 ForStatementResource (io.trino.server.ForStatementResource)1