use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class CastTest method testCastConstantAsStringAppliesFormat.
@Issue("3770")
@Test(dataProvider = "constNumbersWithFormatProvider")
public void testCastConstantAsStringAppliesFormat(String castArgument, String expected) throws Exception {
/**
* Proper format of number is #.##
*/
Series series = castNumberAsStringSeries;
String sqlQuery = String.format("SELECT CAST(%s AS string) FROM \"%s\"", castArgument, series.getMetric());
StringTable resultTable = SqlMethod.queryTable(sqlQuery);
String castValue = resultTable.getValueAt(0, 0);
assertEquals("Inproper format applied", expected, castValue);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class IsNullTest method testIsNullInExpression.
@Issue("3844")
@Test
public void testIsNullInExpression() throws Exception {
String sqlQuery = String.format("SELECT ROUND(100 - ISNULL(value, 0)) FROM \"%s\"", TEST_METRIC);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
String[][] expectedRows = { { "-23.0" } };
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class IsNullTest method testTypePreserved.
@Issue("3675")
@Test(dataProvider = "typeCheckTestProvider")
public void testTypePreserved(String from, String to, String type) throws Exception {
String sqlQuery = String.format("SELECT ISNULL(%s, %s) FROM \"m-test-type-preserve-1\"", from, to);
StringTable table = queryTable(sqlQuery, 1);
assertEquals("wrong ISNULL result data type", type, table.getColumnMetaData(0).getDataType());
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class LikeOperatorTest method testMultipleLikeMetricOperatorsAnd.
@Issue("4083")
@Test
public void testMultipleLikeMetricOperatorsAnd() {
String sqlQuery = String.format("SELECT metric " + "FROM atsd_series " + "WHERE metric LIKE '%1$s-first-__' AND metric LIKE '%1$s-first-2%%'" + "ORDER BY metric ", TEST_METRIC_PREFIX);
StringTable table = SqlMethod.queryTable(sqlQuery);
assertTableContainsColumnValues(TEST_METRICS.subList(20, 30), table, "metric");
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class LikeOperatorTest method testLikeMetricOperatorAndGreaterOrEquals.
@Issue("4152")
@Test
public void testLikeMetricOperatorAndGreaterOrEquals() {
String sqlQuery = String.format("SELECT metric " + "FROM atsd_series " + "WHERE metric LIKE '%1$s-first-%%' AND metric >= '%1$s-first-40' " + "ORDER BY metric ", TEST_METRIC_PREFIX);
StringTable table = SqlMethod.queryTable(sqlQuery);
assertTableContainsColumnValues(TEST_METRICS.subList(40, 50), table, "metric");
}
Aggregations