Search in sources :

Example 1 with TimestampConstant

use of io.questdb.griffin.engine.functions.constants.TimestampConstant 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 2 with TimestampConstant

use of io.questdb.griffin.engine.functions.constants.TimestampConstant 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 3 with TimestampConstant

use of io.questdb.griffin.engine.functions.constants.TimestampConstant in project questdb by bluestreak01.

the class EqDoubleFunctionFactoryTest method testRightNaNTimestampNaN.

@Test
public void testRightNaNTimestampNaN() throws SqlException {
    FunctionFactory factory = getFunctionFactory();
    ObjList<Function> args = new ObjList<>();
    args.add(new TimestampConstant(Numbers.LONG_NaN) {

        @Override
        public boolean isConstant() {
            return false;
        }
    });
    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.assertFalse(function.isConstant());
}
Also used : Function(io.questdb.cairo.sql.Function) DoubleConstant(io.questdb.griffin.engine.functions.constants.DoubleConstant) 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)

Aggregations

Function (io.questdb.cairo.sql.Function)3 FunctionFactory (io.questdb.griffin.FunctionFactory)3 AbstractFunctionFactoryTest (io.questdb.griffin.engine.AbstractFunctionFactoryTest)3 TimestampConstant (io.questdb.griffin.engine.functions.constants.TimestampConstant)3 IntList (io.questdb.std.IntList)3 ObjList (io.questdb.std.ObjList)3 Test (org.junit.Test)3 DoubleConstant (io.questdb.griffin.engine.functions.constants.DoubleConstant)1