Package com.facebook.presto.execution

Examples of com.facebook.presto.execution.BufferResult


        int maxSleepMillis = 1;

        while (remainingNanos > 0) {
            // todo we need a much better way to determine if a task is unknown (e.g. not scheduled yet), done, or there is current no more data
            try {
                BufferResult result = taskManager.getTaskResults(taskId, outputId, pageSequenceId, DEFAULT_MAX_SIZE, new Duration(remainingNanos, NANOSECONDS));
                if (!result.isEmpty()) {
                    GenericEntity<?> entity = new GenericEntity<>(result.getElements(), new TypeToken<List<Page>>() {}.getType());
                    return Response.ok(entity).header(PRESTO_PAGE_SEQUENCE_ID, result.getStartingSequenceId()).build();
                }
                else if (result.isBufferClosed()) {
                    return Response.status(Status.GONE).header(PRESTO_PAGE_SEQUENCE_ID, result.getStartingSequenceId()).build();
                }
                else {
                    return Response.status(Status.NO_CONTENT).header(PRESTO_PAGE_SEQUENCE_ID, result.getStartingSequenceId()).build();
                }
            }
            catch (NoSuchElementException | NoSuchBufferException ignored) {
            }
View Full Code Here


        int maxSleepMillis = 1;

        while (remainingNanos > 0) {
            // todo we need a much better way to determine if a task is unknown (e.g. not scheduled yet), done, or there is current no more data
            try {
                BufferResult result = taskManager.getTaskResults(taskId, outputId, token, DEFAULT_MAX_SIZE, new Duration(remainingNanos, NANOSECONDS));
                List<Page> pages = result.getPages();

                if (!pages.isEmpty()) {
                    GenericEntity<?> entity = new GenericEntity<>(pages, new TypeToken<List<Page>>() {}.getType());
                    return Response.ok(entity)
                            .header(PRESTO_PAGE_TOKEN, result.getToken())
                            .header(PRESTO_PAGE_NEXT_TOKEN, result.getNextToken())
                            .build();
                }
                else if (result.isBufferClosed()) {
                    return Response.status(Status.GONE)
                            .header(PRESTO_PAGE_TOKEN, result.getToken())
                            .header(PRESTO_PAGE_NEXT_TOKEN, result.getNextToken())
                            .build();
                }
                else {
                    return Response.status(Status.NO_CONTENT)
                            .header(PRESTO_PAGE_TOKEN, result.getToken())
                            .header(PRESTO_PAGE_NEXT_TOKEN, result.getNextToken())
                            .build();
                }
            }
            catch (NoSuchElementException | NoSuchBufferException ignored) {
            }
View Full Code Here

        int maxSleepMillis = 1;

        while (remainingNanos > 0) {
            // todo we need a much better way to determine if a task is unknown (e.g. not scheduled yet), done, or there is current no more data
            try {
                BufferResult result = taskManager.getTaskResults(taskId, outputId, token, DEFAULT_MAX_SIZE, new Duration(remainingNanos, NANOSECONDS));
                List<Page> pages = result.getPages();

                if (!pages.isEmpty()) {
                    GenericEntity<?> entity = new GenericEntity<>(pages, new TypeToken<List<Page>>() {}.getType());
                    return Response.ok(entity)
                            .header(PRESTO_PAGE_TOKEN, result.getToken())
                            .header(PRESTO_PAGE_NEXT_TOKEN, result.getNextToken())
                            .build();
                }
                else if (result.isBufferClosed()) {
                    return Response.status(Status.GONE)
                            .header(PRESTO_PAGE_TOKEN, result.getToken())
                            .header(PRESTO_PAGE_NEXT_TOKEN, result.getNextToken())
                            .build();
                }
                else {
                    return Response.status(Status.NO_CONTENT)
                            .header(PRESTO_PAGE_TOKEN, result.getToken())
                            .header(PRESTO_PAGE_NEXT_TOKEN, result.getNextToken())
                            .build();
                }
            }
            catch (NoSuchElementException | NoSuchBufferException ignored) {
            }
View Full Code Here

TOP

Related Classes of com.facebook.presto.execution.BufferResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.