Search in sources :

Example 11 with DrillFuncHolder

use of org.apache.drill.exec.expr.fn.DrillFuncHolder in project drill by apache.

the class FunctionRegistryHolderTest method testGetHoldersByFunctionNameWithVersion.

@Test
public void testGetHoldersByFunctionNameWithVersion() {
    List<DrillFuncHolder> expectedResult = Lists.newArrayList();
    for (List<FunctionHolder> functionHolders : newJars.values()) {
        for (FunctionHolder functionHolder : functionHolders) {
            if ("lower".equals(functionHolder.getName())) {
                expectedResult.add(functionHolder.getHolder());
            }
        }
    }
    assertFalse(expectedResult.isEmpty());
    AtomicLong version = new AtomicLong();
    compareTwoLists(expectedResult, registryHolder.getHoldersByFunctionName("lower", version));
    assertEquals("Version number should match", version.get(), registryHolder.getVersion());
}
Also used : AtomicLong(java.util.concurrent.atomic.AtomicLong) DrillFuncHolder(org.apache.drill.exec.expr.fn.DrillFuncHolder) Test(org.junit.Test)

Example 12 with DrillFuncHolder

use of org.apache.drill.exec.expr.fn.DrillFuncHolder in project drill by apache.

the class FunctionRegistryHolderTest method testGetAllFunctionsWithHoldersWithVersion.

@Test
public void testGetAllFunctionsWithHoldersWithVersion() {
    ListMultimap<String, DrillFuncHolder> expectedResult = ArrayListMultimap.create();
    for (List<FunctionHolder> functionHolders : newJars.values()) {
        for (FunctionHolder functionHolder : functionHolders) {
            expectedResult.put(functionHolder.getName(), functionHolder.getHolder());
        }
    }
    AtomicLong version = new AtomicLong();
    compareListMultimaps(expectedResult, registryHolder.getAllFunctionsWithHolders(version));
    assertEquals("Version number should match", version.get(), registryHolder.getVersion());
}
Also used : AtomicLong(java.util.concurrent.atomic.AtomicLong) DrillFuncHolder(org.apache.drill.exec.expr.fn.DrillFuncHolder) Test(org.junit.Test)

Aggregations

DrillFuncHolder (org.apache.drill.exec.expr.fn.DrillFuncHolder)12 LogicalExpression (org.apache.drill.common.expression.LogicalExpression)5 FunctionCall (org.apache.drill.common.expression.FunctionCall)4 FunctionResolver (org.apache.drill.exec.resolver.FunctionResolver)4 Collection (java.util.Collection)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 QuotedString (org.apache.drill.common.expression.ValueExpressions.QuotedString)2 AnnotatedClassDescriptor (org.apache.drill.common.scanner.persistence.AnnotatedClassDescriptor)2 FunctionConverter (org.apache.drill.exec.expr.fn.FunctionConverter)2 DrillSqlOperator (org.apache.drill.exec.planner.sql.DrillSqlOperator)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 SqlOperator (org.apache.calcite.sql.SqlOperator)1 Pair (org.apache.commons.lang3.tuple.Pair)1 ValueExpressions (org.apache.drill.common.expression.ValueExpressions)1 LongExpression (org.apache.drill.common.expression.ValueExpressions.LongExpression)1 FunctionValidationException (org.apache.drill.exec.exception.FunctionValidationException)1 JarValidationException (org.apache.drill.exec.exception.JarValidationException)1