当前位置: 首页>>代码示例>>Java>>正文


Java MetadataManager.createTestMetadataManager方法代码示例

本文整理汇总了Java中com.facebook.presto.metadata.MetadataManager.createTestMetadataManager方法的典型用法代码示例。如果您正苦于以下问题:Java MetadataManager.createTestMetadataManager方法的具体用法?Java MetadataManager.createTestMetadataManager怎么用?Java MetadataManager.createTestMetadataManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.presto.metadata.MetadataManager的用法示例。


在下文中一共展示了MetadataManager.createTestMetadataManager方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNoCaching

import com.facebook.presto.metadata.MetadataManager; //导入方法依赖的package包/类
@Test
public void testNoCaching()
        throws Throwable
{
    MetadataManager metadata = MetadataManager.createTestMetadataManager();
    ExpressionCompiler compiler = new ExpressionCompiler(metadata);
    ImmutableList.Builder<RowExpression> projectionsBuilder = ImmutableList.builder();
    ArrayType arrayType = new ArrayType(VARCHAR);
    Signature signature = new Signature("concat", FunctionKind.SCALAR, arrayType.getTypeSignature(), arrayType.getTypeSignature(), arrayType.getTypeSignature());
    projectionsBuilder.add(new CallExpression(signature, arrayType, ImmutableList.of(new InputReferenceExpression(0, arrayType), new InputReferenceExpression(1, arrayType))));

    ImmutableList<RowExpression> projections = projectionsBuilder.build();
    PageProcessor pageProcessor = compiler.compilePageProcessor(new ConstantExpression(true, BooleanType.BOOLEAN), projections);
    PageProcessor pageProcessor2 = compiler.compilePageProcessor(new ConstantExpression(true, BooleanType.BOOLEAN), projections);
    assertTrue(pageProcessor != pageProcessor2);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:17,代码来源:TestPageProcessorCompiler.java

示例2: setup

import com.facebook.presto.metadata.MetadataManager; //导入方法依赖的package包/类
@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);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:22,代码来源:BenchmarkArrayDistinct.java

示例3: createTestingPlanner

import com.facebook.presto.metadata.MetadataManager; //导入方法依赖的package包/类
public static LocalExecutionPlanner createTestingPlanner()
{
    MetadataManager metadata = MetadataManager.createTestMetadataManager();

    PageSourceManager pageSourceManager = new PageSourceManager();
    pageSourceManager.addConnectorPageSourceProvider("test", new TestingPageSourceProvider());
    return new LocalExecutionPlanner(
            metadata,
            new SqlParser(),
            pageSourceManager,
            new IndexManager(),
            new PageSinkManager(),
            new MockExchangeClientSupplier(),
            new ExpressionCompiler(metadata),
            new IndexJoinLookupStats(),
            new CompilerConfig(),
            new TaskManagerConfig());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:19,代码来源:TaskTestUtils.java

示例4: ExpressionCompiler

import com.facebook.presto.metadata.MetadataManager; //导入方法依赖的package包/类
@Inject
public ExpressionCompiler() {
    TransactionManager transactionManager = TransactionManager.createTestTransactionManager();
    Metadata metadata = MetadataManager.createTestMetadataManager();

    this.serde = metadata.getBlockEncodingSerde();
    this.metadata = metadata;
    this.featuresConfig = new FeaturesConfig();
    this.typeManager = metadata.getTypeManager();
    this.session = Session.builder(new SessionPropertyManager())
            .setIdentity(new Identity("user", Optional.empty()))
            .setTimeZoneKey(TimeZoneKey.UTC_KEY)
            .setLocale(Locale.ENGLISH)
            .setQueryId(QueryId.valueOf("row_expression_compiler"))
            .setTransactionId(transactionManager.beginTransaction(IsolationLevel.REPEATABLE_READ, true, true))
            .build();

    this.expressionOptimizer = new ExpressionOptimizer(metadata.getFunctionRegistry(), metadata.getTypeManager(), session);

}
 
开发者ID:rakam-io,项目名称:rakam,代码行数:21,代码来源:ExpressionCompiler.java

示例5: testAggregation

import com.facebook.presto.metadata.MetadataManager; //导入方法依赖的package包/类
@Test
public void testAggregation()
        throws Exception
{
    MetadataManager metadata = MetadataManager.createTestMetadataManager();
    InternalAggregationFunction countVarcharColumn = metadata.getFunctionRegistry().getAggregateFunctionImplementation(new Signature("count", AGGREGATE, StandardTypes.BIGINT, StandardTypes.VARCHAR));
    InternalAggregationFunction maxVarcharColumn = metadata.getFunctionRegistry().getAggregateFunctionImplementation(new Signature("max", AGGREGATE, StandardTypes.VARCHAR, StandardTypes.VARCHAR));
    List<Page> input = rowPagesBuilder(VARCHAR, BIGINT, VARCHAR, BIGINT, DOUBLE, VARCHAR)
            .addSequencePage(100, 0, 0, 300, 500, 500, 500)
            .build();

    OperatorFactory operatorFactory = new AggregationOperatorFactory(
            0,
            new PlanNodeId("test"),
            Step.SINGLE,
            ImmutableList.of(COUNT.bind(ImmutableList.of(0), Optional.empty(), Optional.empty(), 1.0),
                    LONG_SUM.bind(ImmutableList.of(1), Optional.empty(), Optional.empty(), 1.0),
                    LONG_AVERAGE.bind(ImmutableList.of(1), Optional.empty(), Optional.empty(), 1.0),
                    maxVarcharColumn.bind(ImmutableList.of(2), Optional.empty(), Optional.empty(), 1.0),
                    countVarcharColumn.bind(ImmutableList.of(0), Optional.empty(), Optional.empty(), 1.0),
                    LONG_SUM.bind(ImmutableList.of(3), Optional.empty(), Optional.empty(), 1.0),
                    DOUBLE_SUM.bind(ImmutableList.of(4), Optional.empty(), Optional.empty(), 1.0),
                    maxVarcharColumn.bind(ImmutableList.of(5), Optional.empty(), Optional.empty(), 1.0)));
    Operator operator = operatorFactory.createOperator(driverContext);

    MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT, BIGINT, DOUBLE, VARCHAR, BIGINT, BIGINT, DOUBLE, VARCHAR)
            .row(100, 4950, 49.5, "399", 100, 54950, 54950.0, "599")
            .build();

    assertOperatorEquals(operator, input, expected);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:32,代码来源:TestAggregationOperator.java


注:本文中的com.facebook.presto.metadata.MetadataManager.createTestMetadataManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。