本文整理汇总了Java中org.apache.pig.ResourceSchema.ResourceFieldSchema.getName方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceFieldSchema.getName方法的具体用法?Java ResourceFieldSchema.getName怎么用?Java ResourceFieldSchema.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.pig.ResourceSchema.ResourceFieldSchema
的用法示例。
在下文中一共展示了ResourceFieldSchema.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isTupleWrapper
import org.apache.pig.ResourceSchema.ResourceFieldSchema; //导入方法依赖的package包/类
/** check whether it is just a wrapped tuple */
public static boolean isTupleWrapper(ResourceFieldSchema pigSchema) {
Boolean status = false;
if(pigSchema.getType() == DataType.TUPLE)
if(pigSchema.getName() != null)
if(pigSchema.getName().equals(AvroStorageUtils.PIG_TUPLE_WRAPPER))
status = true;
return status;
}
示例2: getPigSchema
import org.apache.pig.ResourceSchema.ResourceFieldSchema; //导入方法依赖的package包/类
public static Schema getPigSchema(ResourceSchema rSchema)
throws FrontendException {
if(rSchema == null) {
return null;
}
List<FieldSchema> fsList = new ArrayList<FieldSchema>();
for(ResourceFieldSchema rfs : rSchema.getFields()) {
FieldSchema fs = new FieldSchema(rfs.getName(),
rfs.getSchema() == null ?
null : getPigSchema(rfs.getSchema()), rfs.getType());
if(rfs.getType() == DataType.BAG) {
if (fs.schema != null) { // allow partial schema
if (fs.schema.size() == 1) {
FieldSchema innerFs = fs.schema.getField(0);
if (innerFs.type != DataType.TUPLE) {
ResourceFieldSchema.throwInvalidSchemaException();
}
} else {
ResourceFieldSchema.throwInvalidSchemaException();
}
}
}
fsList.add(fs);
}
return new Schema(fsList);
}
示例3: checkSchema
import org.apache.pig.ResourceSchema.ResourceFieldSchema; //导入方法依赖的package包/类
@Override
public void checkSchema(ResourceSchema schema) throws IOException {
// Get schemaStr and sortColumnNames from the given schema. In the process, we
// also validate the schema and sorting info.
ResourceSchema.Order[] orders = schema.getSortKeyOrders();
boolean descending = false;
for (ResourceSchema.Order order : orders)
{
if (order == ResourceSchema.Order.DESCENDING)
{
Log LOG = LogFactory.getLog(TableStorer.class);
LOG.warn("Sorting in descending order is not supported by Zebra and the table will be unsorted.");
descending = true;
break;
}
}
StringBuilder sortColumnNames = new StringBuilder();
if (!descending) {
ResourceSchema.ResourceFieldSchema[] fields = schema.getFields();
int[] index = schema.getSortKeys();
for( int i = 0; i< index.length; i++ ) {
ResourceFieldSchema field = fields[index[i]];
String name = field.getName();
if( name == null )
throw new IOException("Zebra does not support column positional reference yet");
if( !org.apache.pig.data.DataType.isAtomic( field.getType() ) )
throw new IOException( "Field [" + name + "] is not of simple type as required for a sort column now." );
if( i > 0 )
sortColumnNames.append( "," );
sortColumnNames.append( name );
}
}
// Convert resource schema to zebra schema
org.apache.hadoop.zebra.schema.Schema zebraSchema;
try {
zebraSchema = SchemaConverter.convertFromResourceSchema( schema );
} catch (ParseException ex) {
throw new IOException("Exception thrown from SchemaConverter: " + ex.getMessage() );
}
Properties properties = UDFContext.getUDFContext().getUDFProperties(
this.getClass(), new String[]{ udfContextSignature } );
properties.setProperty( UDFCONTEXT_OUTPUT_SCHEMA, zebraSchema.toString() );
properties.setProperty( UDFCONTEXT_SORT_INFO, sortColumnNames.toString() );
// This is to turn off type check for potential corner cases - for internal use only;
if (System.getenv("zebra_output_checktype") != null && System.getenv("zebra_output_checktype").equals("no")) {
properties.setProperty( UDFCONTEXT_OUTPUT_CHECKTYPE, "no");
}
}