use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class LikeOperatorTest method testLikeMetricOperatorAndLess.
@Issue("4152")
@Test
public void testLikeMetricOperatorAndLess() {
String sqlQuery = String.format("SELECT metric " + "FROM atsd_series " + "WHERE metric LIKE '%1$s-first-%%' AND metric < '%1$s-first-10' " + "ORDER BY metric ", TEST_METRIC_PREFIX);
StringTable table = SqlMethod.queryTable(sqlQuery);
assertTableContainsColumnValues(TEST_METRICS.subList(0, 10), table, "metric");
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlExamplePercentilesTest method testExample.
@Issue("3047")
@Test(description = "Test for alias documentation example. " + "https://github.com/axibase/atsd-docs/blob/master/api/sql/examples/aggregate-percentiles.md")
public void testExample() {
String sqlQuery = String.format("SELECT percentile(25, value) AS \"p25\", %n" + " percentile(50, value) AS \"p50\", %n" + " median(value), %n" + " percentile(75, value) AS \"p75\", %n" + " percentile(90, value) AS \"p90\", %n" + " percentile(95, value) AS \"p95\", %n" + " percentile(97.5, value) AS \"p97.5\", %n" + " percentile(99, value) AS \"p99\", %n" + " percentile(99.5, value) AS \"p99.5\", %n" + " percentile(99.9, value) AS \"p99.9\", %n" + " percentile(99.99, value) AS \"p99.99\" %n" + " FROM \"%s\" %n" + "WHERE entity = '%s' %n" + " AND datetime >='2016-06-19T11:00:00.000Z' AND datetime < '2016-06-19T11:08:00.000Z'", TEST_METRIC_NAME, TEST_ENTITY_NAME);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<List<String>> expectedRows = Collections.singletonList(Arrays.asList("11.172749999999999", "11.3232", "11.3232", "11.408225", "11.435", "11.435", "11.435", "11.435", "11.435", "11.435", "11.435"));
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlExampleOrderByCollationTest method testOrderByEntityTagNameDESC.
@Issue("3162")
@Test
public void testOrderByEntityTagNameDESC() {
String sqlQuery = "SELECT tags.tag FROM \"" + TEST_METRIC_NAME + "\"\n" + "ORDER BY tags.tag DESC";
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<String> expectedColumn = sortList(trimList(NAMES), true);
assertTableContainsColumnValues(expectedColumn, resultTable, "tags.tag");
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlExampleOrderByCollationTest method testOrderByEntityTagNameASC.
@Issue("3162")
@Test
public void testOrderByEntityTagNameASC() {
String sqlQuery = "SELECT tags.tag FROM \"" + TEST_METRIC_NAME + "\"\n" + "ORDER BY tags.tag ASC";
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<String> expectedColumn = sortList(trimList(NAMES), false);
assertTableContainsColumnValues(expectedColumn, resultTable, "tags.tag");
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlExampleOrderByTimeTest method test.
@Issue("3047")
@Test(description = "Test for alias documentation example. " + "https://github.com/axibase/atsd-docs/blob/master/api/sql/examples/order-by-time.md")
public void test() {
String sqlQuery = String.format("SELECT datetime, value FROM \"%s\"%nORDER BY datetime", TEST_METRIC_NAME);
Response response = queryResponse(sqlQuery);
StringTable resultTable = response.readEntity(StringTable.class);
List<List<String>> expectedRows = Arrays.asList(Arrays.asList("2016-07-27T22:41:50.000Z", "2.0"), Arrays.asList("2016-07-27T22:41:51.000Z", "1.0"), Arrays.asList("2016-07-27T22:41:52.000Z", "0.0"));
assertTableRowsExist(expectedRows, resultTable);
}
Aggregations