Search in sources :

Example 6 with Classification

use of io.crate.planner.operators.StatementClassifier.Classification in project crate by crate.

the class QueryStatsTest method testTrackedStatementTypes.

@Test
public void testTrackedStatementTypes() {
    List<MetricsView> oneMetricForEachStatementType = new ArrayList<>();
    for (StatementType type : StatementType.values()) {
        if (type.equals(StatementType.UNDEFINED)) {
            continue;
        }
        oneMetricForEachStatementType.add(createMetric(new Classification(type), 1));
    }
    Map<StatementType, QueryStats.Metric> metricsByCommand = createMetricsMap(oneMetricForEachStatementType);
    assertThat(metricsByCommand.size(), is(7));
    assertThat(metricsByCommand.get(StatementType.SELECT), is(notNullValue()));
    assertThat(metricsByCommand.get(StatementType.UPDATE), is(notNullValue()));
    assertThat(metricsByCommand.get(StatementType.INSERT), is(notNullValue()));
    assertThat(metricsByCommand.get(StatementType.DELETE), is(notNullValue()));
    assertThat(metricsByCommand.get(StatementType.DDL), is(notNullValue()));
    assertThat(metricsByCommand.get(StatementType.MANAGEMENT), is(notNullValue()));
    assertThat(metricsByCommand.get(StatementType.COPY), is(notNullValue()));
    assertThat(metricsByCommand.get(StatementType.UNDEFINED), is(nullValue()));
}
Also used : StatementType(io.crate.planner.Plan.StatementType) Classification(io.crate.planner.operators.StatementClassifier.Classification) ArrayList(java.util.ArrayList) MetricsView(io.crate.metadata.sys.MetricsView) Test(org.junit.Test)

Aggregations

Classification (io.crate.planner.operators.StatementClassifier.Classification)6 Test (org.junit.Test)6 CrateDummyClusterServiceUnitTest (io.crate.test.integration.CrateDummyClusterServiceUnitTest)5 JobContextLog (io.crate.expression.reference.sys.job.JobContextLog)3 User (io.crate.user.User)3 BlockingEvictingQueue (io.crate.common.collections.BlockingEvictingQueue)2 JobContext (io.crate.expression.reference.sys.job.JobContext)2 MetricsView (io.crate.metadata.sys.MetricsView)2 ClusterSettings (org.elasticsearch.common.settings.ClusterSettings)2 Settings (org.elasticsearch.common.settings.Settings)2 OperationContext (io.crate.expression.reference.sys.operation.OperationContext)1 OperationContextLog (io.crate.expression.reference.sys.operation.OperationContextLog)1 StatementType (io.crate.planner.Plan.StatementType)1 ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ExecutorService (java.util.concurrent.ExecutorService)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1