Search in sources :

Example 86 with Issue

use of io.qameta.allure.Issue in project atsd-api-test by axibase.

the class SqlPeriodSyntaxTest method testPeriodInterpolateOptions.

@Issue("3058")
@Test
public void testPeriodInterpolateOptions() {
    String sqlQuery = String.format("SELECT datetime, AVG(value) FROM \"%s\" %nWHERE entity = '%s' %n" + "AND datetime >= '2016-06-19T11:00:00.500Z' AND datetime < '2016-06-19T11:00:11.000Z' %n" + "GROUP BY PERIOD(2500 MILLISECOND, LINEAR)", TEST_METRIC_NAME, TEST_ENTITY_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    List<List<String>> expectedRows = Arrays.asList(Arrays.asList("2016-06-19T11:00:05.000Z", "1.0"), // <-INTERPOLATED BY LINEAR
    Arrays.asList("2016-06-19T11:00:07.500Z", "1.5"), Arrays.asList("2016-06-19T11:00:10.000Z", "2.0"));
    assertTableRowsExist(expectedRows, resultTable);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) List(java.util.List) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 87 with Issue

use of io.qameta.allure.Issue in project atsd-api-test by axibase.

the class SqlPeriodSyntaxTest method testPeriodExtendInterpolateOptions.

@Issue("3058")
@Test
public void testPeriodExtendInterpolateOptions() {
    String sqlQuery = String.format("SELECT datetime, AVG(value) FROM \"%s\" %nWHERE entity = '%s'" + "AND datetime >= '2016-06-19T11:00:00.500Z' AND datetime < '2016-06-19T11:00:11.000Z' %n" + "GROUP BY PERIOD(2500 MILLISECOND, EXTEND, LINEAR)", TEST_METRIC_NAME, TEST_ENTITY_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    List<List<String>> expectedRows = Arrays.asList(// <-EXTEND BY NEXT
    Arrays.asList("2016-06-19T11:00:02.500Z", "1.0"), Arrays.asList("2016-06-19T11:00:05.000Z", "1.0"), // <-INTERPOLATED BY LINEAR
    Arrays.asList("2016-06-19T11:00:07.500Z", "1.5"), Arrays.asList("2016-06-19T11:00:10.000Z", "2.0"));
    assertTableRowsExist(expectedRows, resultTable);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) List(java.util.List) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 88 with Issue

use of io.qameta.allure.Issue in project atsd-api-test by axibase.

the class SqlPeriodSyntaxTest method testPeriodAlignInterpolateOptions.

@Issue("3058")
@Test
public void testPeriodAlignInterpolateOptions() {
    String sqlQuery = String.format("SELECT datetime, AVG(value) FROM \"%s\" %nWHERE entity = '%s' %n" + "AND datetime >= '2016-06-19T11:00:00.500Z' AND datetime < '2016-06-19T11:00:11.000Z' %n" + "GROUP BY PERIOD(2500 MILLISECOND, START_TIME, VALUE 0)", TEST_METRIC_NAME, TEST_ENTITY_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    List<List<String>> expectedRows = Arrays.asList(Arrays.asList("2016-06-19T11:00:03.000Z", "1.0"), // <-INTERPOLATED BY VALUE 0
    Arrays.asList("2016-06-19T11:00:05.500Z", "0.0"), Arrays.asList("2016-06-19T11:00:08.000Z", "2.0"));
    assertTableRowsExist(expectedRows, resultTable);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) List(java.util.List) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 89 with Issue

use of io.qameta.allure.Issue in project atsd-api-test by axibase.

the class SqlPeriodSyntaxTest method testPeriodExtendInterpolateAlignOptions.

@Issue("3058")
@Test
public void testPeriodExtendInterpolateAlignOptions() {
    String sqlQuery = String.format("SELECT datetime, AVG(value) FROM \"%s\" %nWHERE entity = '%s' %n" + "AND datetime >= '2016-06-19T10:59:57.500Z' AND datetime < '2016-06-19T11:00:13.000Z' %n" + "GROUP BY PERIOD(2500 MILLISECOND, EXTEND, LINEAR, START_TIME)", TEST_METRIC_NAME, TEST_ENTITY_NAME);
    StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
    List<List<String>> expectedRows = Arrays.asList(// <-EXTENDED BY NEXT
    Arrays.asList("2016-06-19T10:59:57.500Z", "0.0"), Arrays.asList("2016-06-19T11:00:00.000Z", "0.0"), // <-INTERPOLATED BY LINEAR
    Arrays.asList("2016-06-19T11:00:02.500Z", "0.5"), Arrays.asList("2016-06-19T11:00:05.000Z", "1.0"), // <-INTERPOLATED BY LINEAR
    Arrays.asList("2016-06-19T11:00:07.500Z", "1.5"), Arrays.asList("2016-06-19T11:00:10.000Z", "2.0"), // <-EXTENDED BY PREVIOUS
    Arrays.asList("2016-06-19T11:00:12.500Z", "2.0"));
    assertTableRowsExist(expectedRows, resultTable);
}
Also used : StringTable(com.axibase.tsd.api.model.sql.StringTable) List(java.util.List) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Example 90 with Issue

use of io.qameta.allure.Issue in project atsd-api-test by axibase.

the class CastTest method testImplicitCastStringColumnToNumber.

@Issue("4020")
@Test
public void testImplicitCastStringColumnToNumber() throws Exception {
    Series series = Mocks.series();
    series.setTags(new HashMap<String, String>());
    series.addTag("value", "10");
    SeriesMethod.insertSeriesCheck(series);
    String sql = String.format("SELECT metric%n" + "FROM \"%s\"%n" + "WHERE tags.\"value\" = 10", series.getMetric());
    String[][] expected = { { series.getMetric() } };
    assertSqlQueryRows("String column was not implicitly casted to number", expected, sql);
}
Also used : Series(com.axibase.tsd.api.model.series.Series) Issue(io.qameta.allure.Issue) Test(org.testng.annotations.Test) SqlTest(com.axibase.tsd.api.method.sql.SqlTest)

Aggregations

Issue (io.qameta.allure.Issue)858 Test (org.testng.annotations.Test)857 SqlTest (com.axibase.tsd.api.method.sql.SqlTest)377 StringTable (com.axibase.tsd.api.model.sql.StringTable)270 Response (javax.ws.rs.core.Response)234 List (java.util.List)166 SeriesQuery (com.axibase.tsd.api.model.series.query.SeriesQuery)145 Series (com.axibase.tsd.api.model.series.Series)88 Property (com.axibase.tsd.api.model.property.Property)84 BigDecimal (java.math.BigDecimal)53 Metric (com.axibase.tsd.api.model.metric.Metric)50 Period (com.axibase.tsd.api.model.Period)47 PropertyQuery (com.axibase.tsd.api.model.property.PropertyQuery)44 Entity (com.axibase.tsd.api.model.entity.Entity)43 ArrayList (java.util.ArrayList)37 Message (com.axibase.tsd.api.model.message.Message)32 PlainCommand (com.axibase.tsd.api.model.command.PlainCommand)31 HashMap (java.util.HashMap)30 EntityGroup (com.axibase.tsd.api.model.entitygroup.EntityGroup)29 Aggregate (com.axibase.tsd.api.model.series.query.transformation.aggregate.Aggregate)29