Search in sources :

Example 1 with EqDoubleFunctionFactory

use of io.questdb.griffin.engine.functions.eq.EqDoubleFunctionFactory in project questdb by bluestreak01.

the class FunctionParserTest method testUndefinedBindVariableFuzzyMatched.

@Test
public void testUndefinedBindVariableFuzzyMatched() throws SqlException {
    bindVariableService.clear();
    functions.add(new EqIntFunctionFactory());
    functions.add(new EqDoubleFunctionFactory());
    functions.add(new EqLongFunctionFactory());
    final GenericRecordMetadata metadata = new GenericRecordMetadata();
    metadata.add(new TableColumnMetadata("a", 1, ColumnType.FLOAT));
    try (Function f = parseFunction("a = $1", metadata, createFunctionParser())) {
        TestUtils.assertContains(f.getClass().getCanonicalName(), "io.questdb.griffin.engine.functions.eq.EqDoubleFunctionFactory.Func");
    }
    Assert.assertEquals(ColumnType.DOUBLE, bindVariableService.getFunction(0).getType());
}
Also used : EqLongFunctionFactory(io.questdb.griffin.engine.functions.eq.EqLongFunctionFactory) Function(io.questdb.cairo.sql.Function) EqDoubleFunctionFactory(io.questdb.griffin.engine.functions.eq.EqDoubleFunctionFactory) EqIntFunctionFactory(io.questdb.griffin.engine.functions.eq.EqIntFunctionFactory) Test(org.junit.Test)

Example 2 with EqDoubleFunctionFactory

use of io.questdb.griffin.engine.functions.eq.EqDoubleFunctionFactory in project questdb by bluestreak01.

the class FunctionParserTest method testUndefinedBindVariableAmbiguouslyMatched.

@Test
public void testUndefinedBindVariableAmbiguouslyMatched() throws SqlException {
    bindVariableService.clear();
    functions.add(new EqIntFunctionFactory());
    functions.add(new EqDoubleFunctionFactory());
    functions.add(new EqLongFunctionFactory());
    try (Function f = parseFunction("$2 = $1", null, createFunctionParser())) {
        TestUtils.assertContains(f.getClass().getCanonicalName(), "io.questdb.griffin.engine.functions.eq.EqDoubleFunctionFactory.Func");
    }
    Assert.assertEquals(ColumnType.DOUBLE, bindVariableService.getFunction(0).getType());
    Assert.assertEquals(ColumnType.DOUBLE, bindVariableService.getFunction(1).getType());
}
Also used : EqLongFunctionFactory(io.questdb.griffin.engine.functions.eq.EqLongFunctionFactory) Function(io.questdb.cairo.sql.Function) EqDoubleFunctionFactory(io.questdb.griffin.engine.functions.eq.EqDoubleFunctionFactory) EqIntFunctionFactory(io.questdb.griffin.engine.functions.eq.EqIntFunctionFactory) Test(org.junit.Test)

Example 3 with EqDoubleFunctionFactory

use of io.questdb.griffin.engine.functions.eq.EqDoubleFunctionFactory in project questdb by bluestreak01.

the class FunctionParserTest method testUndefinedBindVariableExactlyMatched.

@Test
public void testUndefinedBindVariableExactlyMatched() throws SqlException {
    bindVariableService.clear();
    functions.add(new EqIntFunctionFactory());
    functions.add(new EqDoubleFunctionFactory());
    functions.add(new EqLongFunctionFactory());
    final GenericRecordMetadata metadata = new GenericRecordMetadata();
    metadata.add(new TableColumnMetadata("a", 1, ColumnType.LONG));
    try (Function f = parseFunction("a = $1", metadata, createFunctionParser())) {
        TestUtils.assertContains(f.getClass().getCanonicalName(), "io.questdb.griffin.engine.functions.eq.EqLongFunctionFactory.Func");
    }
    Assert.assertEquals(ColumnType.LONG, bindVariableService.getFunction(0).getType());
}
Also used : EqLongFunctionFactory(io.questdb.griffin.engine.functions.eq.EqLongFunctionFactory) Function(io.questdb.cairo.sql.Function) EqDoubleFunctionFactory(io.questdb.griffin.engine.functions.eq.EqDoubleFunctionFactory) EqIntFunctionFactory(io.questdb.griffin.engine.functions.eq.EqIntFunctionFactory) Test(org.junit.Test)

Aggregations

Function (io.questdb.cairo.sql.Function)3 EqDoubleFunctionFactory (io.questdb.griffin.engine.functions.eq.EqDoubleFunctionFactory)3 EqIntFunctionFactory (io.questdb.griffin.engine.functions.eq.EqIntFunctionFactory)3 EqLongFunctionFactory (io.questdb.griffin.engine.functions.eq.EqLongFunctionFactory)3 Test (org.junit.Test)3