Search in sources :

Example 6 with ObjList

use of io.questdb.std.ObjList in project questdb by bluestreak01.

the class EqDoubleFunctionFactoryTest method testLeftNaNTimestamp.

@Test
public void testLeftNaNTimestamp() throws SqlException {
    FunctionFactory factory = getFunctionFactory();
    ObjList<Function> args = new ObjList<>();
    args.add(DoubleConstant.NULL);
    args.add(new TimestampConstant(20000L));
    IntList argPositions = new IntList();
    argPositions.add(2);
    argPositions.add(1);
    Function function = factory.newInstance(4, args, argPositions, configuration, sqlExecutionContext);
    Assert.assertFalse(function.getBool(null));
    Assert.assertTrue(function.isConstant());
}
Also used : Function(io.questdb.cairo.sql.Function) TimestampConstant(io.questdb.griffin.engine.functions.constants.TimestampConstant) ObjList(io.questdb.std.ObjList) FunctionFactory(io.questdb.griffin.FunctionFactory) IntList(io.questdb.std.IntList) Test(org.junit.Test) AbstractFunctionFactoryTest(io.questdb.griffin.engine.AbstractFunctionFactoryTest)

Example 7 with ObjList

use of io.questdb.std.ObjList in project questdb by bluestreak01.

the class EqDoubleFunctionFactoryTest method testRightNaNTimestamp.

@Test
public void testRightNaNTimestamp() throws SqlException {
    FunctionFactory factory = getFunctionFactory();
    ObjList<Function> args = new ObjList<>();
    args.add(new TimestampConstant(20000L));
    args.add(DoubleConstant.NULL);
    IntList argPositions = new IntList();
    argPositions.add(1);
    argPositions.add(2);
    Function function = factory.newInstance(4, args, argPositions, configuration, sqlExecutionContext);
    Assert.assertFalse(function.getBool(null));
}
Also used : Function(io.questdb.cairo.sql.Function) TimestampConstant(io.questdb.griffin.engine.functions.constants.TimestampConstant) ObjList(io.questdb.std.ObjList) FunctionFactory(io.questdb.griffin.FunctionFactory) IntList(io.questdb.std.IntList) Test(org.junit.Test) AbstractFunctionFactoryTest(io.questdb.griffin.engine.AbstractFunctionFactoryTest)

Example 8 with ObjList

use of io.questdb.std.ObjList in project questdb by bluestreak01.

the class EqDoubleFunctionFactoryTest method testRightNaNFloat.

@Test
public void testRightNaNFloat() throws SqlException {
    FunctionFactory factory = getFunctionFactory();
    ObjList<Function> args = new ObjList<>();
    args.add(new DoubleConstant(Double.NaN));
    args.add(new FloatConstant(5.1f) {

        @Override
        public boolean isConstant() {
            return false;
        }
    });
    IntList argPositions = new IntList();
    argPositions.add(2);
    argPositions.add(1);
    Function function = factory.newInstance(4, args, argPositions, configuration, sqlExecutionContext);
    Assert.assertFalse(function.getBool(null));
    Assert.assertFalse(function.isConstant());
}
Also used : Function(io.questdb.cairo.sql.Function) DoubleConstant(io.questdb.griffin.engine.functions.constants.DoubleConstant) ObjList(io.questdb.std.ObjList) FloatConstant(io.questdb.griffin.engine.functions.constants.FloatConstant) FunctionFactory(io.questdb.griffin.FunctionFactory) IntList(io.questdb.std.IntList) Test(org.junit.Test) AbstractFunctionFactoryTest(io.questdb.griffin.engine.AbstractFunctionFactoryTest)

Example 9 with ObjList

use of io.questdb.std.ObjList in project questdb by bluestreak01.

the class EqDoubleFunctionFactoryTest method testLeftNaNFloat.

@Test
public void testLeftNaNFloat() throws SqlException {
    FunctionFactory factory = getFunctionFactory();
    ObjList<Function> args = new ObjList<>();
    args.add(new FloatConstant(3.4f));
    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));
    Assert.assertTrue(function.isConstant());
}
Also used : Function(io.questdb.cairo.sql.Function) DoubleConstant(io.questdb.griffin.engine.functions.constants.DoubleConstant) ObjList(io.questdb.std.ObjList) FloatConstant(io.questdb.griffin.engine.functions.constants.FloatConstant) FunctionFactory(io.questdb.griffin.FunctionFactory) IntList(io.questdb.std.IntList) Test(org.junit.Test) AbstractFunctionFactoryTest(io.questdb.griffin.engine.AbstractFunctionFactoryTest)

Example 10 with ObjList

use of io.questdb.std.ObjList in project questdb by bluestreak01.

the class EqDoubleFunctionFactoryTest method testRightNaNDateNaN.

@Test
public void testRightNaNDateNaN() throws SqlException {
    FunctionFactory factory = getFunctionFactory();
    ObjList<Function> args = new ObjList<>();
    args.add(new DateConstant(Numbers.LONG_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());
}
Also used : Function(io.questdb.cairo.sql.Function) DoubleConstant(io.questdb.griffin.engine.functions.constants.DoubleConstant) DateConstant(io.questdb.griffin.engine.functions.constants.DateConstant) ObjList(io.questdb.std.ObjList) FunctionFactory(io.questdb.griffin.FunctionFactory) IntList(io.questdb.std.IntList) Test(org.junit.Test) AbstractFunctionFactoryTest(io.questdb.griffin.engine.AbstractFunctionFactoryTest)

Aggregations

ObjList (io.questdb.std.ObjList)16 Test (org.junit.Test)14 Function (io.questdb.cairo.sql.Function)12 FunctionFactory (io.questdb.griffin.FunctionFactory)11 IntList (io.questdb.std.IntList)11 AbstractFunctionFactoryTest (io.questdb.griffin.engine.AbstractFunctionFactoryTest)10 DoubleConstant (io.questdb.griffin.engine.functions.constants.DoubleConstant)7 SqlException (io.questdb.griffin.SqlException)3 DateConstant (io.questdb.griffin.engine.functions.constants.DateConstant)3 FloatConstant (io.questdb.griffin.engine.functions.constants.FloatConstant)3 TimestampConstant (io.questdb.griffin.engine.functions.constants.TimestampConstant)3 AbstractGriffinTest (io.questdb.griffin.AbstractGriffinTest)2 ExpressionNode (io.questdb.griffin.model.ExpressionNode)2 QueryColumn (io.questdb.griffin.model.QueryColumn)2 Rnd (io.questdb.std.Rnd)2 CairoConfiguration (io.questdb.cairo.CairoConfiguration)1 ColumnType (io.questdb.cairo.ColumnType)1 Record (io.questdb.cairo.sql.Record)1 VirtualRecord (io.questdb.cairo.sql.VirtualRecord)1 SqlExecutionContext (io.questdb.griffin.SqlExecutionContext)1