use of io.questdb.griffin.engine.functions.bool.InStrFunctionFactory in project questdb by bluestreak01.
the class FunctionParserTest method testConstVarArgFunction.
@Test
public void testConstVarArgFunction() throws SqlException {
functions.add(new InStrFunctionFactory());
final GenericRecordMetadata metadata = new GenericRecordMetadata();
metadata.add(new TableColumnMetadata("a", 1, ColumnType.STRING));
FunctionParser functionParser = createFunctionParser();
Function function = parseFunction("a in ('xu', 'yk')", metadata, functionParser);
Assert.assertEquals(ColumnType.BOOLEAN, function.getType());
Assert.assertTrue(function.getBool(new Record() {
@Override
public CharSequence getStr(int col) {
return "yk";
}
}));
}
use of io.questdb.griffin.engine.functions.bool.InStrFunctionFactory in project questdb by bluestreak01.
the class FunctionParserTest method testVarArgFunction.
@Test
public void testVarArgFunction() throws SqlException {
functions.add(new InStrFunctionFactory());
final GenericRecordMetadata metadata = new GenericRecordMetadata();
metadata.add(new TableColumnMetadata("a", 1, ColumnType.STRING));
FunctionParser functionParser = createFunctionParser();
Record record = new Record() {
@Override
public CharSequence getStr(int col) {
return "YZ";
}
};
Function function = parseFunction("a in ('XY', 'YZ')", metadata, functionParser);
Assert.assertEquals(ColumnType.BOOLEAN, function.getType());
Assert.assertTrue(function.getBool(record));
}
use of io.questdb.griffin.engine.functions.bool.InStrFunctionFactory in project questdb by bluestreak01.
the class FunctionParserTest method testVarArgFunctionNoArg.
@Test
public void testVarArgFunctionNoArg() throws SqlException {
functions.add(new InStrFunctionFactory());
final GenericRecordMetadata metadata = new GenericRecordMetadata();
metadata.add(new TableColumnMetadata("a", 1, ColumnType.STRING));
FunctionParser functionParser = createFunctionParser();
Record record = new Record() {
@Override
public CharSequence getStr(int col) {
return "Y";
}
};
Function function = parseFunction("a in ()", metadata, functionParser);
Assert.assertEquals(ColumnType.BOOLEAN, function.getType());
Assert.assertFalse(function.getBool(record));
}
use of io.questdb.griffin.engine.functions.bool.InStrFunctionFactory in project questdb by bluestreak01.
the class FunctionParserTest method testPassColumnToConstVarArgFunction.
@Test
public void testPassColumnToConstVarArgFunction() {
functions.add(new InStrFunctionFactory());
final GenericRecordMetadata metadata = new GenericRecordMetadata();
metadata.add(new TableColumnMetadata("a", 1, ColumnType.STRING));
metadata.add(new TableColumnMetadata("b", 2, ColumnType.STRING));
assertFail(6, "constant expected", "a in (b, 'y')", metadata);
}
Aggregations