use of io.questdb.griffin.model.QueryColumn in project questdb by bluestreak01.
the class SampleByTest method testSampleByFirstLastRecordCursorFactoryInvalidNotFirstLast.
@Test
public void testSampleByFirstLastRecordCursorFactoryInvalidNotFirstLast() {
try {
GenericRecordMetadata groupByMeta = new GenericRecordMetadata();
TableColumnMetadata column = new TableColumnMetadata("col1", 1, ColumnType.LONG, false, 0, false, null);
groupByMeta.add(column);
GenericRecordMetadata meta = new GenericRecordMetadata();
meta.add(column);
ObjList<QueryColumn> columns = new ObjList<>();
ExpressionNode first = ExpressionNode.FACTORY.newInstance().of(ColumnType.LONG, "min", 0, 0);
first.rhs = ExpressionNode.FACTORY.newInstance().of(ColumnType.LONG, "col1", 0, 0);
QueryColumn col = QueryColumn.FACTORY.newInstance().of("col1", first);
columns.add(col);
new SampleByFirstLastRecordCursorFactory(null, new MicroTimestampSampler(100L), groupByMeta, columns, meta, null, 0, null, 0, 0, getSymbolFilter(), -1);
Assert.fail();
} catch (SqlException e) {
TestUtils.assertContains(e.getFlyweightMessage(), "expected first() or last() functions but got min");
}
}
use of io.questdb.griffin.model.QueryColumn in project questdb by bluestreak01.
the class SampleByTest method testSampleByFirstLastRecordCursorFactoryInvalidColumns.
@Test
public void testSampleByFirstLastRecordCursorFactoryInvalidColumns() {
try {
GenericRecordMetadata groupByMeta = new GenericRecordMetadata();
groupByMeta.add(new TableColumnMetadata("col1", 1, ColumnType.STRING, false, 0, false, null));
GenericRecordMetadata meta = new GenericRecordMetadata();
meta.add(new TableColumnMetadata("col1", 2, ColumnType.LONG, false, 0, false, null));
ObjList<QueryColumn> columns = new ObjList<>();
ExpressionNode first = ExpressionNode.FACTORY.newInstance().of(ColumnType.LONG, "first", 0, 0);
first.rhs = ExpressionNode.FACTORY.newInstance().of(ColumnType.LONG, "col1", 0, 0);
QueryColumn col = QueryColumn.FACTORY.newInstance().of("col1", first);
columns.add(col);
new SampleByFirstLastRecordCursorFactory(null, new MicroTimestampSampler(100L), groupByMeta, columns, meta, null, 0, null, 0, 0, getSymbolFilter(), -1);
Assert.fail();
} catch (SqlException e) {
TestUtils.assertContains(e.getFlyweightMessage(), "first(), last() is not supported on data type");
}
}
Aggregations