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


Java ResourceFieldSchema.getName方法代码示例

本文整理汇总了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;
}
 
开发者ID:linkedin,项目名称:Cubert,代码行数:10,代码来源:AvroStorageUtils.java

示例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);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:28,代码来源:Schema.java

示例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");
  }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:53,代码来源:TableStorer.java


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