本文整理汇总了Java中org.apache.pig.LoadPushDown.RequiredFieldList类的典型用法代码示例。如果您正苦于以下问题:Java RequiredFieldList类的具体用法?Java RequiredFieldList怎么用?Java RequiredFieldList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequiredFieldList类属于org.apache.pig.LoadPushDown包,在下文中一共展示了RequiredFieldList类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: asProjection
import org.apache.pig.LoadPushDown.RequiredFieldList; //导入依赖的package包/类
static String asProjection(RequiredFieldList list, Properties props) {
List<String> fields = new ArrayList<String>();
FieldAlias alias = alias(new PropertiesSettings(props));
for (RequiredField field : list.getFields()) {
addField(field, fields, alias, "");
}
return StringUtils.concatenateAndUriEncode(fields, ",");
}
开发者ID:xushjie1987,项目名称:es-hadoop-v2.2.0,代码行数:10,代码来源:PigUtils.java
示例2: getRequiredFields
import org.apache.pig.LoadPushDown.RequiredFieldList; //导入依赖的package包/类
/**
* @param configuration configuration for the current job
* @return List of required fields from pushProjection
*/
static RequiredFieldList getRequiredFields(Configuration configuration) {
String requiredFieldString = configuration.get(PARQUET_PIG_REQUIRED_FIELDS);
if(requiredFieldString == null) {
return null;
}
try {
return (RequiredFieldList) ObjectSerializer.deserialize(requiredFieldString);
} catch (IOException iOException) {
throw new RuntimeException("Failed to deserialize pushProjection");
}
}
开发者ID:apache,项目名称:parquet-mr,代码行数:18,代码来源:TupleReadSupport.java
示例3: init
import org.apache.pig.LoadPushDown.RequiredFieldList; //导入依赖的package包/类
@Override
public ReadContext init(InitContext initContext) {
Schema pigSchema = getPigSchema(initContext.getConfiguration());
RequiredFieldList requiredFields = getRequiredFields(initContext.getConfiguration());
boolean columnIndexAccess = initContext.getConfiguration().getBoolean(PARQUET_COLUMN_INDEX_ACCESS, false);
if (pigSchema == null) {
return new ReadContext(initContext.getFileSchema());
} else {
// project the file schema according to the requested Pig schema
MessageType parquetRequestedSchema = new PigSchemaConverter(columnIndexAccess).filter(initContext.getFileSchema(), pigSchema, requiredFields);
return new ReadContext(parquetRequestedSchema);
}
}
开发者ID:apache,项目名称:parquet-mr,代码行数:16,代码来源:TupleReadSupport.java
示例4: filterTupleSchema
import org.apache.pig.LoadPushDown.RequiredFieldList; //导入依赖的package包/类
@Override
public List<Type> filterTupleSchema(GroupType schemaToFilter, Schema pigSchema, RequiredFieldList requiredFieldsList) {
List<Type> newFields = new ArrayList<Type>();
List<Pair<FieldSchema,Integer>> indexedFields = new ArrayList<Pair<FieldSchema,Integer>>();
try {
if(requiredFieldsList == null) {
int index = 0;
for(FieldSchema fs : pigSchema.getFields()) {
indexedFields.add(new Pair<FieldSchema, Integer>(fs, index++));
}
} else {
for(RequiredField rf : requiredFieldsList.getFields()) {
indexedFields.add(new Pair<FieldSchema, Integer>(pigSchema.getField(rf.getAlias()), rf.getIndex()));
}
}
for (Pair<FieldSchema, Integer> p : indexedFields) {
FieldSchema fieldSchema = pigSchema.getField(p.first.alias);
if (p.second < schemaToFilter.getFieldCount()) {
Type type = schemaToFilter.getFields().get(p.second);
newFields.add(filter(type, fieldSchema));
}
}
} catch (FrontendException e) {
throw new RuntimeException("Failed to filter requested fields", e);
}
return newFields;
}
开发者ID:apache,项目名称:parquet-mr,代码行数:30,代码来源:PigSchemaConverter.java
示例5: deserializeRequiredFieldList
import org.apache.pig.LoadPushDown.RequiredFieldList; //导入依赖的package包/类
public static RequiredFieldList deserializeRequiredFieldList(String requiredFieldString) {
if(requiredFieldString == null) {
return null;
}
try {
return (RequiredFieldList) ObjectSerializer.deserialize(requiredFieldString);
} catch (IOException e) {
throw new RuntimeException("Failed to deserialize pushProjection", e);
}
}
开发者ID:apache,项目名称:parquet-mr,代码行数:12,代码来源:PigSchemaConverter.java
示例6: serializeRequiredFieldList
import org.apache.pig.LoadPushDown.RequiredFieldList; //导入依赖的package包/类
static String serializeRequiredFieldList(RequiredFieldList requiredFieldList) {
try {
return ObjectSerializer.serialize(requiredFieldList);
} catch (IOException e) {
throw new RuntimeException("Failed to searlize required fields.", e);
}
}
开发者ID:apache,项目名称:parquet-mr,代码行数:8,代码来源:PigSchemaConverter.java
示例7: filter
import org.apache.pig.LoadPushDown.RequiredFieldList; //导入依赖的package包/类
/**
* filters a Parquet schema based on a pig schema for projection
* @param schemaToFilter the schema to be filter
* @param requestedPigSchema the pig schema to filter it with
* @param requiredFieldList projected required fields
* @return the resulting filtered schema
*/
public MessageType filter(MessageType schemaToFilter, Schema requestedPigSchema, RequiredFieldList requiredFieldList) {
try {
if (LOG.isDebugEnabled()) LOG.debug("filtering schema:\n" + schemaToFilter + "\nwith requested pig schema:\n " + requestedPigSchema);
List<Type> result = columnAccess.filterTupleSchema(schemaToFilter, requestedPigSchema, requiredFieldList);
if (LOG.isDebugEnabled()) LOG.debug("schema:\n" + schemaToFilter + "\nfiltered to:\n" + result);
return new MessageType(schemaToFilter.getName(), result);
} catch (RuntimeException e) {
throw new RuntimeException("can't filter " + schemaToFilter + " with " + requestedPigSchema, e);
}
}
开发者ID:apache,项目名称:parquet-mr,代码行数:18,代码来源:PigSchemaConverter.java
示例8: asProjection
import org.apache.pig.LoadPushDown.RequiredFieldList; //导入依赖的package包/类
static String asProjection(RequiredFieldList list, Properties props) {
List<String> fields = new ArrayList<String>();
FieldAlias alias = alias(new PropertiesSettings(props));
for (RequiredField field : list.getFields()) {
addField(field, fields, alias, "");
}
return StringUtils.concatenate(fields, ",");
}
开发者ID:elastic,项目名称:elasticsearch-hadoop,代码行数:10,代码来源:PigUtils.java
示例9: pushProjection
import org.apache.pig.LoadPushDown.RequiredFieldList; //导入依赖的package包/类
@Override
public RequiredFieldResponse pushProjection(RequiredFieldList requiredFieldList) throws FrontendException {
aliases = new String[requiredFieldList.getFields().size()];
for (int i=0; i<requiredFieldList.getFields().size(); i++) {
RequiredField fs = requiredFieldList.getFields().get(i);
aliases[i] = fs.getAlias();
}
try {
UDFContext.getUDFContext().getUDFProperties(this.getClass()).setProperty(signature, ObjectSerializer.serialize(aliases));
} catch (IOException e) {
throw new FrontendException(e);
}
return new RequiredFieldResponse(true);
}
开发者ID:PonIC,项目名称:PonIC,代码行数:15,代码来源:TestPruneColumn.java
示例10: newSchemaFromRequiredFieldList
import org.apache.pig.LoadPushDown.RequiredFieldList; //导入依赖的package包/类
/**
* Takes an Avro Schema and a Pig RequiredFieldList and returns a new schema
* with only the requried fields, or no if the function can't extract only
* those fields. Useful for push down projections.
* @param oldSchema The avro schema from which to extract the schema
* @param rfl the Pig required field list
* @return the new schema, or null
*/
public static Schema newSchemaFromRequiredFieldList(
final Schema oldSchema, final RequiredFieldList rfl) {
return newSchemaFromRequiredFieldList(oldSchema, rfl.getFields());
}
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:13,代码来源:AvroStorageSchemaConversionUtilities.java
注:本文中的org.apache.pig.LoadPushDown.RequiredFieldList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论