@Override public void addFunctions(List<? extends SqlFunction> functionInfos) { // TODO: transactional when FunctionRegistry is made transactional functions.addFunctions(functionInfos); }
protected void registerScalarFunction(SqlScalarFunction sqlScalarFunction) { Metadata metadata = functionAssertions.getMetadata(); metadata.getFunctionRegistry().addFunctions(ImmutableList.of(sqlScalarFunction)); }
protected void registerFunctions(Plugin plugin) { functionRegistry.addFunctions(extractFunctions(plugin.getFunctions())); }
@BeforeClass public void setup() { functionRegistry.addFunctions(new FunctionListBuilder().aggregates(CountNull.class).getFunctions()); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "\\QFunction already registered: custom_add(bigint,bigint):bigint\\E") public void testDuplicateFunctions() { List<SqlFunction> functions = new FunctionListBuilder() .scalars(CustomFunctions.class) .getFunctions() .stream() .filter(input -> input.getSignature().getName().equals("custom_add")) .collect(toImmutableList()); TypeRegistry typeManager = new TypeRegistry(); FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); registry.addFunctions(functions); registry.addFunctions(functions); }
protected void registerScalar(Class<?> clazz) { Metadata metadata = functionAssertions.getMetadata(); List<SqlFunction> functions = new FunctionListBuilder() .scalars(clazz) .getFunctions(); metadata.getFunctionRegistry().addFunctions(functions); }
protected void registerParametricScalar(Class<?> clazz) { Metadata metadata = functionAssertions.getMetadata(); List<SqlFunction> functions = new FunctionListBuilder() .scalar(clazz) .getFunctions(); metadata.getFunctionRegistry().addFunctions(functions); }
@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "'sum' is both an aggregation and a scalar function") public void testConflictingScalarAggregation() { List<SqlFunction> functions = new FunctionListBuilder() .scalars(ScalarSum.class) .getFunctions(); TypeRegistry typeManager = new TypeRegistry(); FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); registry.addFunctions(functions); }
private Signature resolveSignature() { FunctionRegistry functionRegistry = new FunctionRegistry(typeRegistry, blockEncoding, new FeaturesConfig()); functionRegistry.addFunctions(createFunctionsFromSignatures()); return functionRegistry.resolveFunction(QualifiedName.of(TEST_FUNCTION_NAME), fromTypeSignatures(parameterTypes)); }
metadata.getFunctionRegistry().addFunctions(functions.build());
metadata.getFunctionRegistry().addFunctions(ImmutableList.of(new GenericLongFunction("record_cursor", value -> { driverContext.getYieldSignal().forceYieldForTesting(); return value;
transactionManager); metadata.getFunctionRegistry().addFunctions(ImmutableList.of(APPLY_FUNCTION));
addFunctions(builder.getFunctions());
@Override public void addFunctions(List<? extends SqlFunction> functionInfos) { // TODO: transactional when FunctionRegistry is made transactional functions.addFunctions(functionInfos); }
@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "\\QFunction already registered: custom_add(bigint,bigint):bigint\\E") public void testDuplicateFunctions() { List<SqlFunction> functions = new FunctionListBuilder(new TypeRegistry()) .scalar(CustomFunctions.class) .getFunctions() .stream() .filter(input -> input.getSignature().getName().equals("custom_add")) .collect(toImmutableList()); TypeRegistry typeManager = new TypeRegistry(); FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), true); registry.addFunctions(functions); registry.addFunctions(functions); }
@BeforeClass public void setup() { InternalAggregationFunction function = new AggregationCompiler().generateAggregationFunction(CountNull.class); functionRegistry.addFunctions(new FunctionListBuilder(new TypeRegistry()).aggregate(function).getFunctions()); }
protected void registerScalar(Class<?> clazz) { Metadata metadata = functionAssertions.getMetadata(); List<SqlFunction> functions = new FunctionListBuilder(metadata.getTypeManager()) .scalar(clazz) .getFunctions(); metadata.getFunctionRegistry().addFunctions(functions); }
@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "'sum' is both an aggregation and a scalar function") public void testConflictingScalarAggregation() throws Exception { List<SqlFunction> functions = new FunctionListBuilder(new TypeRegistry()) .scalar(ScalarSum.class) .getFunctions(); TypeRegistry typeManager = new TypeRegistry(); FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), true); registry.addFunctions(functions); }
addFunctions(builder.getFunctions());