本文整理汇总了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));
}
示例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));
}
}
示例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());
}
示例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;
}
}
示例5: JsonLoader
import org.apache.pig.impl.util.Utils; //导入方法依赖的package包/类
public JsonLoader(String schemaString) throws IOException {
schema = new ResourceSchema(Utils.parseSchema(schemaString));
}