@Setup public void setup() { MetadataManager metadata = MetadataManager.createTestMetadataManager(); metadata.addFunctions(new FunctionListBuilder(metadata.getTypeManager()).scalar(BenchmarkArrayDistinct.class).getFunctions()); ExpressionCompiler compiler = new ExpressionCompiler(metadata); ImmutableList.Builder<RowExpression> projectionsBuilder = ImmutableList.builder(); Block[] blocks = new Block[TYPES.size()]; for (int i = 0; i < TYPES.size(); i++) { Type elementType = TYPES.get(i); ArrayType arrayType = new ArrayType(elementType); Signature signature = new Signature(name, FunctionKind.SCALAR, arrayType.getTypeSignature(), arrayType.getTypeSignature()); projectionsBuilder.add(new CallExpression(signature, arrayType, ImmutableList.of(new InputReferenceExpression(i, arrayType)))); blocks[i] = createChannel(POSITIONS, ARRAY_SIZE, arrayType); } ImmutableList<RowExpression> projections = projectionsBuilder.build(); pageProcessor = compiler.compilePageProcessor(new ConstantExpression(true, BooleanType.BOOLEAN), projections); pageBuilder = new PageBuilder(projections.stream().map(RowExpression::getType).collect(Collectors.toList())); page = new Page(blocks); }
@Override public List<SqlFunction> listFunctions() { FunctionListBuilder builder = new FunctionListBuilder(); try { List<Class<?>> classes = getFunctionClasses(); addFunctions(builder, classes); } catch (IOException e) { System.out.println("Could not load classes from jar file: " + e); return ImmutableList.of(); } return builder.getFunctions(); }
@Test public void testFunctionCreation() { TypeRegistry typeRegistry = new TypeRegistry(); FunctionListBuilder builder = new FunctionListBuilder(); builder.scalar(DecimalGeographicFunctions.class); }
@Test public void testFunctionCreation() { TypeRegistry typeRegistry = new TypeRegistry(); FunctionListBuilder builder = new FunctionListBuilder(); builder.scalar(PolyContains.class); }
@Override public List<SqlFunction> listFunctions() { ViterbiFunction.setConfig(viterbiConfig); return new FunctionListBuilder(typeManager) .scalar(ViterbiFunction.class) .getFunctions(); }
public static GenericAggregationFunctionFactory fromAggregationDefinition(Class<?> clazz, TypeManager typeManager) { FunctionListBuilder builder = new FunctionListBuilder(typeManager); for (InternalAggregationFunction aggregation : new AggregationCompiler(typeManager).generateAggregationFunctions(clazz)) { builder.aggregate(aggregation); } return new GenericAggregationFunctionFactory(builder.getFunctions()); }
protected void registerScalar(Class<?> clazz) { Metadata metadata = functionAssertions.getMetadata(); List<SqlFunction> functions = new FunctionListBuilder(metadata.getTypeManager()) .scalar(clazz) .getFunctions(); metadata.getFunctionRegistry().addFunctions(functions); }
@Override public List<SqlFunction> listFunctions() { return new FunctionListBuilder(typeManager) .aggregate(LearnClassifierAggregation.class) .aggregate(LearnVarcharClassifierAggregation.class) .aggregate(LearnRegressorAggregation.class) .aggregate(LearnLibSvmClassifierAggregation.class) .aggregate(LearnLibSvmVarcharClassifierAggregation.class) .aggregate(LearnLibSvmRegressorAggregation.class) .aggregate(EvaluateClassifierPredictionsAggregation.class) .scalar(MLFunctions.class) .getFunctions(); }
@Override public List<SqlFunction> listFunctions() { return new FunctionListBuilder(typeManager) .scalar(TeradataStringFunctions.class) .scalar(TeradataDateFunctions.class) .getFunctions(); }
@BeforeClass public void setup() { InternalAggregationFunction function = new AggregationCompiler().generateAggregationFunction(CountNull.class); functionRegistry.addFunctions(new FunctionListBuilder(new TypeRegistry()).aggregate(function).getFunctions()); }
public FunctionAssertions addScalarFunctions(Class<?> clazz) { metadata.addFunctions(new FunctionListBuilder(metadata.getTypeManager()).scalar(clazz).getFunctions()); return this; }