use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlFunctionDateFormatTimeExpressionTest method testNullFormattedOrderBy.
@Issue("3283")
@Test
public void testNullFormattedOrderBy() {
String sqlQuery = String.format("SELECT date_format(time + 0/0) FROM \"%s\" ORDER BY datetime", TEST_METRIC_NAME);
Response response = queryResponse(sqlQuery);
StringTable resultTable = response.readEntity(StringTable.class);
String[][] expectedRows = { { "null" } };
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlFunctionDateFormatTimeExpressionTest method testDivisionByZero.
@Issue("3283")
@Test
public void testDivisionByZero() {
String sqlQuery = String.format("SELECT date_format(time/0) FROM \"%s\"", TEST_METRIC_NAME);
Response response = queryResponse(sqlQuery);
StringTable resultTable = response.readEntity(StringTable.class);
String[][] expectedRows = { { Util.ISOFormat(new Date(Long.MAX_VALUE)) } };
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlFunctionDateFormatTimeExpressionTest method testDivisionWithRest.
@Issue("3283")
@Test
public void testDivisionWithRest() {
String sqlQuery = String.format("SELECT date_format(time + 10/3) FROM \"%s\"", TEST_METRIC_NAME);
Response response = queryResponse(sqlQuery);
StringTable resultTable = response.readEntity(StringTable.class);
String[][] expectedRows = { { "2016-06-03T09:41:00.003Z" } };
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlFunctionDateFormatTimeExpressionTest method testMinus.
@Issue("3283")
@Test
public void testMinus() {
String sqlQuery = String.format("SELECT date_format(time-1) FROM \"%s\"", TEST_METRIC_NAME);
Response response = queryResponse(sqlQuery);
StringTable resultTable = response.readEntity(StringTable.class);
String[][] expectedRows = { { "2016-06-03T09:40:59.999Z" } };
assertTableRowsExist(expectedRows, resultTable);
}
use of com.axibase.tsd.api.model.sql.StringTable in project atsd-api-test by axibase.
the class SqlTimezoneFormatTest method testSimpleDateFormatWithZeroZone.
@Issue("2904")
@Test
public void testSimpleDateFormatWithZeroZone() throws JSONException {
String sqlQuery = String.format("SELECT time, date_format(time, 'yyyy-MM-dd''T''HH:mm:ssZ') AS \"f-date\"" + "FROM \"%s\" WHERE datetime = '2016-06-03T09:23:00.000Z'", TEST_METRIC_NAME);
StringTable resultTable = queryResponse(sqlQuery).readEntity(StringTable.class);
List<String> expectedColumnValues = Collections.singletonList(formatDate(Util.parseDate("2016-06-03T09:23:00.000Z"), "yyyy-MM-dd'T'HH:mm:ssZ"));
assertTableContainsColumnValues(expectedColumnValues, resultTable, "f-date");
}
Aggregations