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


Java MetadataManager.getType方法代码示例

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


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

示例1: testUnnestNonNumericDoubles

import com.facebook.presto.metadata.MetadataManager; //导入方法依赖的package包/类
@Test
public void testUnnestNonNumericDoubles()
        throws Exception
{
    MetadataManager metadata = createTestMetadataManager();
    Type arrayType = metadata.getType(parseTypeSignature("array<double>"));
    Type mapType = metadata.getType(parseTypeSignature("map<bigint,double>"));

    List<Page> input = rowPagesBuilder(BIGINT, arrayType, mapType)
            .row(1, arrayBlockOf(DOUBLE, NEGATIVE_INFINITY, POSITIVE_INFINITY, NaN),
                    mapBlockOf(BIGINT, DOUBLE, ImmutableMap.of(1, NEGATIVE_INFINITY, 2, POSITIVE_INFINITY, 3, NaN)))
            .build();

    OperatorFactory operatorFactory = new UnnestOperator.UnnestOperatorFactory(
            0, new PlanNodeId("test"), ImmutableList.of(0), ImmutableList.<Type>of(BIGINT), ImmutableList.of(1, 2), ImmutableList.of(arrayType, mapType), false);
    Operator operator = operatorFactory.createOperator(driverContext);

    MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT, DOUBLE, BIGINT, DOUBLE)
            .row(1, NEGATIVE_INFINITY, 1, NEGATIVE_INFINITY)
            .row(1, POSITIVE_INFINITY, 2, POSITIVE_INFINITY)
            .row(1, NaN, 3, NaN)
            .build();

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

示例2: testUnnest

import com.facebook.presto.metadata.MetadataManager; //导入方法依赖的package包/类
@Test
public void testUnnest()
        throws Exception
{
    MetadataManager metadata = createTestMetadataManager();
    Type arrayType = metadata.getType(parseTypeSignature("array<bigint>"));
    Type mapType = metadata.getType(parseTypeSignature("map<bigint,bigint>"));

    List<Page> input = rowPagesBuilder(BIGINT, arrayType, mapType)
            .row(1, arrayBlockOf(BIGINT, 2, 3), mapBlockOf(BIGINT, BIGINT, ImmutableMap.of(4, 5)))
            .row(2, arrayBlockOf(BIGINT, 99), null)
            .row(3, null, null)
            .pageBreak()
            .row(6, arrayBlockOf(BIGINT, 7, 8), mapBlockOf(BIGINT, BIGINT, ImmutableMap.of(9, 10, 11, 12)))
            .build();

    OperatorFactory operatorFactory = new UnnestOperator.UnnestOperatorFactory(
            0, new PlanNodeId("test"), ImmutableList.of(0), ImmutableList.<Type>of(BIGINT), ImmutableList.of(1, 2), ImmutableList.of(arrayType, mapType), false);
    Operator operator = operatorFactory.createOperator(driverContext);

    MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT, BIGINT, BIGINT, BIGINT)
            .row(1, 2, 4, 5)
            .row(1, 3, null, null)
            .row(2, 99, null, null)
            .row(6, 7, 9, 10)
            .row(6, 8, 11, 12)
            .build();

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

示例3: testUnnestWithArray

import com.facebook.presto.metadata.MetadataManager; //导入方法依赖的package包/类
@Test
public void testUnnestWithArray()
        throws Exception
{
    MetadataManager metadata = createTestMetadataManager();
    Type arrayType = metadata.getType(parseTypeSignature("array<array<bigint>>"));
    Type mapType = metadata.getType(parseTypeSignature("map<array<bigint>,array<bigint>>"));

    List<Page> input = rowPagesBuilder(BIGINT, arrayType, mapType)
            .row(
                    1,
                    arrayBlockOf(new ArrayType(BIGINT), ImmutableList.of(2, 4), ImmutableList.of(3, 6)),
                    mapBlockOf(new ArrayType(BIGINT), new ArrayType(BIGINT), ImmutableMap.of(ImmutableList.of(4, 8), ImmutableList.of(5, 10))))
            .row(2, arrayBlockOf(new ArrayType(BIGINT), ImmutableList.of(99, 198)), null)
            .row(3, null, null)
            .pageBreak()
            .row(
                    6,
                    arrayBlockOf(new ArrayType(BIGINT), ImmutableList.of(7, 14), ImmutableList.of(8, 16)),
                    mapBlockOf(new ArrayType(BIGINT), new ArrayType(BIGINT), ImmutableMap.of(ImmutableList.of(9, 18), ImmutableList.of(10, 20), ImmutableList.of(11, 22), ImmutableList.of(12, 24))))
            .build();

    OperatorFactory operatorFactory = new UnnestOperator.UnnestOperatorFactory(
            0, new PlanNodeId("test"), ImmutableList.of(0), ImmutableList.<Type>of(BIGINT), ImmutableList.of(1, 2), ImmutableList.of(arrayType, mapType), false);
    Operator operator = operatorFactory.createOperator(driverContext);

    MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT, new ArrayType(BIGINT), new ArrayType(BIGINT), new ArrayType(BIGINT))
            .row(1, ImmutableList.of(2L, 4L), ImmutableList.of(4L, 8L), ImmutableList.of(5L, 10L))
            .row(1, ImmutableList.of(3L, 6L), null, null)
            .row(2, ImmutableList.of(99L, 198L), null, null)
            .row(6, ImmutableList.of(7L, 14L), ImmutableList.of(9L, 18L), ImmutableList.of(10L, 20L))
            .row(6, ImmutableList.of(8L, 16L), ImmutableList.of(11L, 22L), ImmutableList.of(12L, 24L))
            .build();

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

示例4: testUnnestWithOrdinality

import com.facebook.presto.metadata.MetadataManager; //导入方法依赖的package包/类
@Test
public void testUnnestWithOrdinality()
        throws Exception
{
    MetadataManager metadata = createTestMetadataManager();
    Type arrayType = metadata.getType(parseTypeSignature("array<bigint>"));
    Type mapType = metadata.getType(parseTypeSignature("map<bigint,bigint>"));

    List<Page> input = rowPagesBuilder(BIGINT, arrayType, mapType)
            .row(1, arrayBlockOf(BIGINT, 2, 3), mapBlockOf(BIGINT, BIGINT, ImmutableMap.of(4, 5)))
            .row(2, arrayBlockOf(BIGINT, 99), null)
            .row(3, null, null)
            .pageBreak()
            .row(6, arrayBlockOf(BIGINT, 7, 8), mapBlockOf(BIGINT, BIGINT, ImmutableMap.of(9, 10, 11, 12)))
            .build();

    OperatorFactory operatorFactory = new UnnestOperator.UnnestOperatorFactory(
            0, new PlanNodeId("test"), ImmutableList.of(0), ImmutableList.<Type>of(BIGINT), ImmutableList.of(1, 2), ImmutableList.of(arrayType, mapType), true);
    Operator operator = operatorFactory.createOperator(driverContext);

    MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT, BIGINT, BIGINT, BIGINT, BIGINT)
            .row(1, 2, 4, 5, 1)
            .row(1, 3, null, null, 2)
            .row(2, 99, null, null, 1)
            .row(6, 7, 9, 10, 1)
            .row(6, 8, 11, 12, 2)
            .build();

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


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