private static void extractScalars(Class<?> clazz) { new FunctionListBuilder().scalars(clazz); } }
private static void extractScalars(Class<?> clazz) { new FunctionListBuilder().scalars(clazz); } }
public FunctionAssertions addScalarFunctions(Class<?> clazz) { metadata.addFunctions(new FunctionListBuilder().scalars(clazz).getFunctions()); return this; }
@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); }
.aggregates(BitwiseAndAggregation.class) .scalar(RepeatFunction.class) .scalars(SequenceFunction.class) .scalars(SessionFunctions.class) .scalars(StringFunctions.class) .scalars(WordStemFunction.class) .scalar(SplitToMapFunction.class) .scalar(SplitToMultimapFunction.class) .scalars(VarbinaryFunctions.class) .scalars(UrlFunctions.class) .scalars(MathFunctions.class) .scalar(MathFunctions.Abs.class) .scalar(MathFunctions.Sign.class) .scalar(MathFunctions.Ceiling.class) .scalar(MathFunctions.Floor.class) .scalars(BitwiseFunctions.class) .scalars(DateTimeFunctions.class) .scalars(JsonFunctions.class) .scalars(ColorFunctions.class) .scalars(ColorOperators.class) .scalar(ColorOperators.ColorDistinctFromOperator.class) .scalars(HyperLogLogFunctions.class) .scalars(QuantileDigestFunctions.class) .scalars(UnknownOperators.class) .scalar(UnknownOperators.UnknownDistinctFromOperator.class) .scalars(BooleanOperators.class) .scalar(BooleanOperators.BooleanDistinctFromOperator.class) .scalars(BigintOperators.class)
@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); }