Search in sources :

Example 1 with QueryIOMetadata

use of io.prestosql.spi.eventlistener.QueryIOMetadata in project hetu-core by openlookeng.

the class QueryMonitor method queryImmediateFailureEvent.

public void queryImmediateFailureEvent(BasicQueryInfo queryInfo, ExecutionFailureInfo failure) {
    eventListenerManager.queryCompleted(new QueryCompletedEvent(new QueryMetadata(queryInfo.getQueryId().toString(), queryInfo.getSession().getTransactionId().map(TransactionId::toString), queryInfo.getQuery(), queryInfo.getPreparedQuery(), queryInfo.getState().toString(), queryInfo.getSelf(), Optional.empty(), Optional.empty()), new QueryStatistics(ofMillis(0), ofMillis(0), ofMillis(queryInfo.getQueryStats().getQueuedTime().toMillis()), Optional.empty(), Optional.empty(), Optional.empty(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ImmutableList.of(), 0, true, ImmutableList.of(), ImmutableList.of(), Optional.empty()), createQueryContext(queryInfo.getSession(), queryInfo.getResourceGroupId()), new QueryIOMetadata(ImmutableList.of(), Optional.empty()), createQueryFailureInfo(failure, Optional.empty()), ImmutableList.of(), ofEpochMilli(queryInfo.getQueryStats().getCreateTime().getMillis()), ofEpochMilli(queryInfo.getQueryStats().getEndTime().getMillis()), ofEpochMilli(queryInfo.getQueryStats().getEndTime().getMillis())));
    logQueryTimeline(queryInfo);
}
Also used : QueryMetadata(io.prestosql.spi.eventlistener.QueryMetadata) QueryCompletedEvent(io.prestosql.spi.eventlistener.QueryCompletedEvent) QueryStatistics(io.prestosql.spi.eventlistener.QueryStatistics) QueryIOMetadata(io.prestosql.spi.eventlistener.QueryIOMetadata)

Example 2 with QueryIOMetadata

use of io.prestosql.spi.eventlistener.QueryIOMetadata in project hetu-core by openlookeng.

the class QueryMonitor method getQueryIOMetadata.

private static QueryIOMetadata getQueryIOMetadata(QueryInfo queryInfo) {
    ImmutableList.Builder<QueryInputMetadata> inputs = ImmutableList.builder();
    for (Input input : queryInfo.getInputs()) {
        inputs.add(new QueryInputMetadata(input.getCatalogName().getCatalogName(), input.getSchema(), input.getTable(), input.getColumns().stream().map(Column::getName).collect(Collectors.toList()), input.getConnectorInfo()));
    }
    Optional<QueryOutputMetadata> output = Optional.empty();
    if (queryInfo.getOutput().isPresent()) {
        Optional<TableFinishInfo> tableFinishInfo = queryInfo.getQueryStats().getOperatorSummaries().stream().map(OperatorStats::getInfo).filter(TableFinishInfo.class::isInstance).map(TableFinishInfo.class::cast).findFirst();
        output = Optional.of(new QueryOutputMetadata(queryInfo.getOutput().get().getCatalogName().getCatalogName(), queryInfo.getOutput().get().getSchema(), queryInfo.getOutput().get().getTable(), tableFinishInfo.map(TableFinishInfo::getConnectorOutputMetadata), tableFinishInfo.map(TableFinishInfo::isJsonLengthLimitExceeded)));
    }
    return new QueryIOMetadata(inputs.build(), output);
}
Also used : Input(io.prestosql.execution.Input) TableFinishInfo(io.prestosql.operator.TableFinishInfo) ImmutableList(com.google.common.collect.ImmutableList) QueryOutputMetadata(io.prestosql.spi.eventlistener.QueryOutputMetadata) QueryIOMetadata(io.prestosql.spi.eventlistener.QueryIOMetadata) QueryInputMetadata(io.prestosql.spi.eventlistener.QueryInputMetadata)

Aggregations

QueryIOMetadata (io.prestosql.spi.eventlistener.QueryIOMetadata)2 ImmutableList (com.google.common.collect.ImmutableList)1 Input (io.prestosql.execution.Input)1 TableFinishInfo (io.prestosql.operator.TableFinishInfo)1 QueryCompletedEvent (io.prestosql.spi.eventlistener.QueryCompletedEvent)1 QueryInputMetadata (io.prestosql.spi.eventlistener.QueryInputMetadata)1 QueryMetadata (io.prestosql.spi.eventlistener.QueryMetadata)1 QueryOutputMetadata (io.prestosql.spi.eventlistener.QueryOutputMetadata)1 QueryStatistics (io.prestosql.spi.eventlistener.QueryStatistics)1