Java 类com.facebook.presto.metadata.FunctionListBuilder 实例源码

项目:presto    文件:BenchmarkArrayDistinct.java   
@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);
}
项目:presto-cuebiq-functions    文件:UdfFactory.java   
@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();
}
项目:presto-cuebiq-functions    文件:DecimalGeohashEncodeTest.java   
@Test
public void testFunctionCreation()
{

    TypeRegistry typeRegistry = new TypeRegistry();
    FunctionListBuilder builder = new FunctionListBuilder();

    builder.scalar(DecimalGeographicFunctions.class);
}
项目:presto-cuebiq-functions    文件:PolyContainsTest.java   
@Test
public void testFunctionCreation()
{

    TypeRegistry typeRegistry = new TypeRegistry();
    FunctionListBuilder builder = new FunctionListBuilder();

    builder.scalar(PolyContains.class);
}
项目:hmmongo    文件:ViterbiFunctionFactory.java   
@Override
public List<SqlFunction> listFunctions() {

    ViterbiFunction.setConfig(viterbiConfig);

    return new FunctionListBuilder(typeManager)
        .scalar(ViterbiFunction.class)
        .getFunctions();
}
项目:presto    文件:GenericAggregationFunctionFactory.java   
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());
}
项目:presto    文件:AbstractTestFunctions.java   
protected void registerScalar(Class<?> clazz)
{
    Metadata metadata = functionAssertions.getMetadata();
    List<SqlFunction> functions = new FunctionListBuilder(metadata.getTypeManager())
            .scalar(clazz)
            .getFunctions();
    metadata.getFunctionRegistry().addFunctions(functions);
}
项目:presto    文件:MLFunctionFactory.java   
@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();
}
项目:presto    文件:TeradataFunctionFactory.java   
@Override
public List<SqlFunction> listFunctions()
{
    return new FunctionListBuilder(typeManager)
            .scalar(TeradataStringFunctions.class)
            .scalar(TeradataDateFunctions.class)
            .getFunctions();
}
项目:presto    文件:TestCountNullAggregation.java   
@BeforeClass
public void setup()
{
    InternalAggregationFunction function = new AggregationCompiler().generateAggregationFunction(CountNull.class);
    functionRegistry.addFunctions(new FunctionListBuilder(new TypeRegistry()).aggregate(function).getFunctions());
}
项目:presto    文件:FunctionAssertions.java   
public FunctionAssertions addScalarFunctions(Class<?> clazz)
{
    metadata.addFunctions(new FunctionListBuilder(metadata.getTypeManager()).scalar(clazz).getFunctions());
    return this;
}