use of io.questdb.std.IntList in project questdb by bluestreak01.
the class FunctionParserTest method testImplicitConstantNullSymbol.
@Test
public void testImplicitConstantNullSymbol() throws SqlException {
functions.add(new FunctionFactory() {
@Override
public String getSignature() {
return "x()";
}
@Override
public Function newInstance(int position, ObjList<Function> args, IntList argPositions, CairoConfiguration configuration1, SqlExecutionContext sqlExecutionContext) {
return new SymbolConstant(null, SymbolTable.VALUE_IS_NULL);
}
});
Function function = parseFunction("x()", new GenericRecordMetadata(), createFunctionParser());
Assert.assertTrue(function instanceof SymbolConstant);
}
use of io.questdb.std.IntList in project questdb by bluestreak01.
the class EqDoubleFunctionFactoryTest method testRightNaNDate.
@Test
public void testRightNaNDate() throws SqlException {
FunctionFactory factory = getFunctionFactory();
ObjList<Function> args = new ObjList<>();
args.add(new DateConstant(10000L));
args.add(new DoubleConstant(Double.NaN));
IntList argPositions = new IntList();
argPositions.add(1);
argPositions.add(2);
Function function = factory.newInstance(4, args, argPositions, configuration, sqlExecutionContext);
Assert.assertFalse(function.getBool(null));
}
use of io.questdb.std.IntList in project questdb by bluestreak01.
the class EqDoubleFunctionFactoryTest method testLeftNaNFloatNaN.
@Test
public void testLeftNaNFloatNaN() throws SqlException {
FunctionFactory factory = getFunctionFactory();
ObjList<Function> args = new ObjList<>();
args.add(new FloatConstant(Float.NaN));
args.add(new DoubleConstant(Double.NaN));
IntList argPositions = new IntList();
argPositions.add(1);
argPositions.add(2);
Function function = factory.newInstance(4, args, argPositions, configuration, sqlExecutionContext);
Assert.assertTrue(function.getBool(null));
Assert.assertTrue(function.isConstant());
}
use of io.questdb.std.IntList in project questdb by bluestreak01.
the class CountSymbolGroupByFunction method computeNext.
@Override
public void computeNext(MapValue mapValue, Record record) {
final IntList set = lists.getQuick(mapValue.getInt(valueIndex + 1));
final int val = arg.getInt(record);
if (val != VALUE_IS_NULL) {
if (val < set.size()) {
if (set.getQuick(val) == 1) {
return;
}
set.setQuick(val, 1);
} else {
set.extendAndSet(val, 1);
}
mapValue.addLong(valueIndex, 1);
}
}
use of io.questdb.std.IntList in project questdb by bluestreak01.
the class CountSymbolGroupByFunction method computeFirst.
@Override
public void computeFirst(MapValue mapValue, Record record) {
final IntList list;
if (lists.size() <= setIndex) {
lists.extendAndSet(setIndex, list = new IntList());
} else {
list = lists.getQuick(setIndex);
}
list.clear(0);
mapValue.putInt(valueIndex + 1, setIndex);
setIndex++;
int val = arg.getInt(record);
if (val != VALUE_IS_NULL) {
list.extendAndSet(val, 1);
mapValue.putLong(valueIndex, 1L);
} else {
mapValue.putLong(valueIndex, 0L);
}
}
Aggregations