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


Java Utils.parseSchema方法代码示例

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


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

示例1: testNewMergeNullSchemas

import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
@Test
public void testNewMergeNullSchemas() throws Throwable {
    LogicalSchema a = Utils.parseSchema( "a1:bytearray, b1:(b11:int, b12:float), c1:long" );
    LogicalSchema b = Utils.parseSchema( "a2:bytearray, b2:(), c2:int" );

    LogicalSchema mergedSchema = LogicalSchema.merge(a, b, LogicalSchema.MergeMode.Union);
    LogicalSchema expected = Utils.parseSchema( "a1:bytearray, b1:(), c1:long" );
    assertTrue(LogicalSchema.equals(mergedSchema, expected, false, false));

    mergedSchema = LogicalSchema.merge(a, b, LogicalSchema.MergeMode.LoadForEach);
    expected = Utils.parseSchema( "a1:bytearray, b1:(b11:int, b12:float), c1:long" );
    assertTrue(LogicalSchema.equals(mergedSchema, expected, false, false));

    mergedSchema = LogicalSchema.merge(b, a, LogicalSchema.MergeMode.LoadForEach);
    expected = Utils.parseSchema( "a2:bytearray, b2:(b11:int,b12:float), c2:int" );
    assertTrue(LogicalSchema.equals(mergedSchema, expected, false, false));
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:18,代码来源:TestSchema.java

示例2: toMetacatType

import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
/**
 * {@inheritDoc}.
 */
@Override
public Type toMetacatType(@Nonnull @NonNull final String pigType) {
    try {
        final LogicalSchema schema = Utils.parseSchema(pigType);
        final LogicalSchema.LogicalFieldSchema field = schema.getField(0);
        return toCanonicalType(field);
    } catch (Exception e) {
        throw new IllegalArgumentException(String.format("Invalid type signature: '%s'", pigType));
    }
}
 
开发者ID:Netflix,项目名称:metacat,代码行数:14,代码来源:PigTypeConverter.java

示例3: testMergeSchemaWithTwoLevelAccess3

import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
@Test
// See PIG-730
public void testMergeSchemaWithTwoLevelAccess3() throws Exception {
    // Generate two schemas
    LogicalSchema ls1 = Utils.parseSchema("a:{t:(a0:int, a1:int)}");
    LogicalSchema ls2 = Utils.parseSchema("b:{t:(b0:int, b1:int)}");
    LogicalSchema ls3 = LogicalSchema.merge(ls1, ls2, MergeMode.LoadForEach);
    assertEquals("{a: {t: (a0: int,a1: int)}}", org.apache.pig.newplan.logical.Util.translateSchema(ls3).toString());
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:10,代码来源:TestSchema.java

示例4: testNewMergeDifferentSize1

import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
@Test(expected = FrontendException.class)
public void testNewMergeDifferentSize1() throws Throwable {
    LogicalSchema a = Utils.parseSchema( "a1:bytearray, b1:long, c1:long" );
    LogicalSchema b = Utils.parseSchema( "a2:bytearray, b2:long" );

    LogicalSchema mergedSchema = LogicalSchema.merge(a, b, LogicalSchema.MergeMode.Union);
    assertNull(mergedSchema);

    try {
        LogicalSchema.merge(a, b, LogicalSchema.MergeMode.LoadForEach);
    } catch (FrontendException e) {
        assertEquals(1031, e.getErrorCode());
        throw e;
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:16,代码来源:TestSchema.java

示例5: JsonLoader

import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
public JsonLoader(String schemaString) throws IOException {
    schema = new ResourceSchema(Utils.parseSchema(schemaString));
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:4,代码来源:JsonLoader.java


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