software.amazon.awssdk.services.athena.model.QueryRuntimeStatisticsTimeline Maven / Gradle / Ivy
Show all versions of athena Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.athena.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Timeline statistics such as query queue time, planning time, execution time, service processing time, and total
* execution time.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class QueryRuntimeStatisticsTimeline implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField QUERY_QUEUE_TIME_IN_MILLIS_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("QueryQueueTimeInMillis").getter(getter(QueryRuntimeStatisticsTimeline::queryQueueTimeInMillis))
.setter(setter(Builder::queryQueueTimeInMillis))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryQueueTimeInMillis").build())
.build();
private static final SdkField SERVICE_PRE_PROCESSING_TIME_IN_MILLIS_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("ServicePreProcessingTimeInMillis")
.getter(getter(QueryRuntimeStatisticsTimeline::servicePreProcessingTimeInMillis))
.setter(setter(Builder::servicePreProcessingTimeInMillis))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServicePreProcessingTimeInMillis")
.build()).build();
private static final SdkField QUERY_PLANNING_TIME_IN_MILLIS_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("QueryPlanningTimeInMillis").getter(getter(QueryRuntimeStatisticsTimeline::queryPlanningTimeInMillis))
.setter(setter(Builder::queryPlanningTimeInMillis))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryPlanningTimeInMillis").build())
.build();
private static final SdkField ENGINE_EXECUTION_TIME_IN_MILLIS_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("EngineExecutionTimeInMillis")
.getter(getter(QueryRuntimeStatisticsTimeline::engineExecutionTimeInMillis))
.setter(setter(Builder::engineExecutionTimeInMillis))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EngineExecutionTimeInMillis")
.build()).build();
private static final SdkField SERVICE_PROCESSING_TIME_IN_MILLIS_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("ServiceProcessingTimeInMillis")
.getter(getter(QueryRuntimeStatisticsTimeline::serviceProcessingTimeInMillis))
.setter(setter(Builder::serviceProcessingTimeInMillis))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServiceProcessingTimeInMillis")
.build()).build();
private static final SdkField TOTAL_EXECUTION_TIME_IN_MILLIS_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("TotalExecutionTimeInMillis")
.getter(getter(QueryRuntimeStatisticsTimeline::totalExecutionTimeInMillis))
.setter(setter(Builder::totalExecutionTimeInMillis))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalExecutionTimeInMillis").build())
.build();
private static final List> SDK_FIELDS = Collections
.unmodifiableList(Arrays.asList(QUERY_QUEUE_TIME_IN_MILLIS_FIELD, SERVICE_PRE_PROCESSING_TIME_IN_MILLIS_FIELD,
QUERY_PLANNING_TIME_IN_MILLIS_FIELD, ENGINE_EXECUTION_TIME_IN_MILLIS_FIELD,
SERVICE_PROCESSING_TIME_IN_MILLIS_FIELD, TOTAL_EXECUTION_TIME_IN_MILLIS_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("QueryQueueTimeInMillis", QUERY_QUEUE_TIME_IN_MILLIS_FIELD);
put("ServicePreProcessingTimeInMillis", SERVICE_PRE_PROCESSING_TIME_IN_MILLIS_FIELD);
put("QueryPlanningTimeInMillis", QUERY_PLANNING_TIME_IN_MILLIS_FIELD);
put("EngineExecutionTimeInMillis", ENGINE_EXECUTION_TIME_IN_MILLIS_FIELD);
put("ServiceProcessingTimeInMillis", SERVICE_PROCESSING_TIME_IN_MILLIS_FIELD);
put("TotalExecutionTimeInMillis", TOTAL_EXECUTION_TIME_IN_MILLIS_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final Long queryQueueTimeInMillis;
private final Long servicePreProcessingTimeInMillis;
private final Long queryPlanningTimeInMillis;
private final Long engineExecutionTimeInMillis;
private final Long serviceProcessingTimeInMillis;
private final Long totalExecutionTimeInMillis;
private QueryRuntimeStatisticsTimeline(BuilderImpl builder) {
this.queryQueueTimeInMillis = builder.queryQueueTimeInMillis;
this.servicePreProcessingTimeInMillis = builder.servicePreProcessingTimeInMillis;
this.queryPlanningTimeInMillis = builder.queryPlanningTimeInMillis;
this.engineExecutionTimeInMillis = builder.engineExecutionTimeInMillis;
this.serviceProcessingTimeInMillis = builder.serviceProcessingTimeInMillis;
this.totalExecutionTimeInMillis = builder.totalExecutionTimeInMillis;
}
/**
*
* The number of milliseconds that the query was in your query queue waiting for resources. Note that if transient
* errors occur, Athena might automatically add the query back to the queue.
*
*
* @return The number of milliseconds that the query was in your query queue waiting for resources. Note that if
* transient errors occur, Athena might automatically add the query back to the queue.
*/
public final Long queryQueueTimeInMillis() {
return queryQueueTimeInMillis;
}
/**
*
* The number of milliseconds that Athena spends on preprocessing before it submits the query to the engine.
*
*
* @return The number of milliseconds that Athena spends on preprocessing before it submits the query to the engine.
*/
public final Long servicePreProcessingTimeInMillis() {
return servicePreProcessingTimeInMillis;
}
/**
*
* The number of milliseconds that Athena took to plan the query processing flow. This includes the time spent
* retrieving table partitions from the data source. Note that because the query engine performs the query planning,
* query planning time is a subset of engine processing time.
*
*
* @return The number of milliseconds that Athena took to plan the query processing flow. This includes the time
* spent retrieving table partitions from the data source. Note that because the query engine performs the
* query planning, query planning time is a subset of engine processing time.
*/
public final Long queryPlanningTimeInMillis() {
return queryPlanningTimeInMillis;
}
/**
*
* The number of milliseconds that the query took to execute.
*
*
* @return The number of milliseconds that the query took to execute.
*/
public final Long engineExecutionTimeInMillis() {
return engineExecutionTimeInMillis;
}
/**
*
* The number of milliseconds that Athena took to finalize and publish the query results after the query engine
* finished running the query.
*
*
* @return The number of milliseconds that Athena took to finalize and publish the query results after the query
* engine finished running the query.
*/
public final Long serviceProcessingTimeInMillis() {
return serviceProcessingTimeInMillis;
}
/**
*
* The number of milliseconds that Athena took to run the query.
*
*
* @return The number of milliseconds that Athena took to run the query.
*/
public final Long totalExecutionTimeInMillis() {
return totalExecutionTimeInMillis;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(queryQueueTimeInMillis());
hashCode = 31 * hashCode + Objects.hashCode(servicePreProcessingTimeInMillis());
hashCode = 31 * hashCode + Objects.hashCode(queryPlanningTimeInMillis());
hashCode = 31 * hashCode + Objects.hashCode(engineExecutionTimeInMillis());
hashCode = 31 * hashCode + Objects.hashCode(serviceProcessingTimeInMillis());
hashCode = 31 * hashCode + Objects.hashCode(totalExecutionTimeInMillis());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof QueryRuntimeStatisticsTimeline)) {
return false;
}
QueryRuntimeStatisticsTimeline other = (QueryRuntimeStatisticsTimeline) obj;
return Objects.equals(queryQueueTimeInMillis(), other.queryQueueTimeInMillis())
&& Objects.equals(servicePreProcessingTimeInMillis(), other.servicePreProcessingTimeInMillis())
&& Objects.equals(queryPlanningTimeInMillis(), other.queryPlanningTimeInMillis())
&& Objects.equals(engineExecutionTimeInMillis(), other.engineExecutionTimeInMillis())
&& Objects.equals(serviceProcessingTimeInMillis(), other.serviceProcessingTimeInMillis())
&& Objects.equals(totalExecutionTimeInMillis(), other.totalExecutionTimeInMillis());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("QueryRuntimeStatisticsTimeline").add("QueryQueueTimeInMillis", queryQueueTimeInMillis())
.add("ServicePreProcessingTimeInMillis", servicePreProcessingTimeInMillis())
.add("QueryPlanningTimeInMillis", queryPlanningTimeInMillis())
.add("EngineExecutionTimeInMillis", engineExecutionTimeInMillis())
.add("ServiceProcessingTimeInMillis", serviceProcessingTimeInMillis())
.add("TotalExecutionTimeInMillis", totalExecutionTimeInMillis()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "QueryQueueTimeInMillis":
return Optional.ofNullable(clazz.cast(queryQueueTimeInMillis()));
case "ServicePreProcessingTimeInMillis":
return Optional.ofNullable(clazz.cast(servicePreProcessingTimeInMillis()));
case "QueryPlanningTimeInMillis":
return Optional.ofNullable(clazz.cast(queryPlanningTimeInMillis()));
case "EngineExecutionTimeInMillis":
return Optional.ofNullable(clazz.cast(engineExecutionTimeInMillis()));
case "ServiceProcessingTimeInMillis":
return Optional.ofNullable(clazz.cast(serviceProcessingTimeInMillis()));
case "TotalExecutionTimeInMillis":
return Optional.ofNullable(clazz.cast(totalExecutionTimeInMillis()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function