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


Java UDFContext.getUDFProperties方法代码示例

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


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

示例1: getSchema

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
public ResourceSchema getSchema(String location, Job job)
        throws IOException {

    if (schema != null) {
        // Send schema to backend
        // Schema should have been passed as an argument (-> constructor)
        // or provided in the default constructor

        UDFContext udfc = UDFContext.getUDFContext();
        Properties p = udfc.getUDFProperties(this.getClass(), new String[]{ udfContextSignature });
        p.setProperty(SCHEMA_SIGNATURE, schema.toString());

        return schema;
    } else {
        // Should never get here
        throw new IllegalArgumentException(
            "No schema found: default schema was never created and no user-specified schema was found."
        );
    }
}
 
开发者ID:mortardata,项目名称:pig-json,代码行数:21,代码来源:JsonLoader.java

示例2: pushProjection

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
@Override
public RequiredFieldResponse pushProjection(RequiredFieldList requiredFieldList) throws FrontendException {
    if (requiredFieldList == null)
        return null;

    if (!useDefaultSchema && requiredFieldList.getFields() != null)
    {
        requiredFields = new boolean[fields.length];

        for (RequiredField f : requiredFieldList.getFields()) {
            requiredFields[f.getIndex()] = true;
        }

        UDFContext udfc = UDFContext.getUDFContext();
        Properties p = udfc.getUDFProperties(this.getClass(), new String[]{ udfContextSignature });
        try {
            p.setProperty(REQUIRED_FIELDS_SIGNATURE, ObjectSerializer.serialize(requiredFields));
        } catch (Exception e) {
            throw new RuntimeException("Cannot serialize requiredFields for pushProjection");
        }
    }

    return new RequiredFieldResponse(true);
}
 
开发者ID:mortardata,项目名称:pig-json,代码行数:25,代码来源:JsonLoader.java

示例3: prepareToWrite

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
@Override
public void prepareToWrite(RecordWriter writer) throws IOException {
    // Store writer to use in putNext()
    this.writer = writer;

    // Get the schema string from the UDFContext object.
    UDFContext udfc = UDFContext.getUDFContext();
    Properties p = udfc.getUDFProperties(this.getClass(), new String[]{ udfContextSignature });
    String strSchema = p.getProperty(SCHEMA_SIGNATURE);
    if (strSchema == null) {
        throw new IOException("Could not find schema in UDF context");
    }

    schema = new ResourceSchema(Utils.getSchemaFromString(strSchema));
    fields = schema.getFields();
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:17,代码来源:FixedWidthStorer.java

示例4: setLocation

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
@Override
public void setLocation(String location, Job job) throws IOException {
    UDFContext udfContext = UDFContext.getUDFContext();
    Properties properties = udfContext.getUDFProperties(RegisteredJarVisibilityLoader.class);

    if (!properties.containsKey(REGISTERED_JAR_VISIBILITY_SCHEMA)) {
        LOG.info("Storing " + RegisteredJarVisibilitySchema.class.getName() + " in UDFContext.");
        properties.put(REGISTERED_JAR_VISIBILITY_SCHEMA, new RegisteredJarVisibilitySchema());
        LOG.info("Stored " + RegisteredJarVisibilitySchema.class.getName() + " in UDFContext.");
    } else {
        LOG.info("Retrieving " + REGISTERED_JAR_VISIBILITY_SCHEMA + " from UDFContext.");
        RegisteredJarVisibilitySchema registeredJarVisibilitySchema =
                (RegisteredJarVisibilitySchema) properties.get(REGISTERED_JAR_VISIBILITY_SCHEMA);
        LOG.info("Retrieved " + REGISTERED_JAR_VISIBILITY_SCHEMA + " from UDFContext.");
    }

    super.setLocation(location, job);
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:19,代码来源:RegisteredJarVisibilityLoader.java

示例5: prepareToRead

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void prepareToRead(RecordReader reader, PigSplit split)
throws IOException {
    this.reader = reader;
    
    // Get the schema string from the UDFContext object.
    UDFContext udfc = UDFContext.getUDFContext();
    Properties p =
        udfc.getUDFProperties(this.getClass(), new String[]{udfcSignature});
    String strSchema = p.getProperty(SCHEMA_SIGNATURE);
    if (strSchema == null) {
        throw new IOException("Could not find schema in UDF context");
    }

    // Parse the schema from the string stored in the properties object.
    schema = new ResourceSchema(Utils.getSchemaFromString(strSchema));

    jsonFactory = new JsonFactory();
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:20,代码来源:JsonLoader.java

示例6: prepareToWrite

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void prepareToWrite(RecordWriter writer) throws IOException {
    this.writer = (DocumentDBRecordWriter) writer;
    
    // Parse the schema from the string stored in the properties object.
    UDFContext udfc = UDFContext.getUDFContext();
    Properties p = udfc.getUDFProperties(this.getClass(), new String[]{udfContextSignature});

    String strSchema = p.getProperty(PIG_OUTPUT_SCHEMA_UDF_CONTEXT);
    if (strSchema == null) {
        throw new IOException("Could not find schema in UDF context");
    }

    try {
        // Parse the schema from the string stored in the properties object.
        this.schema = new ResourceSchema(SchemaHelper.getSchemaFromString(strSchema));
    } catch (Exception e) {
        LOG.error(e.getMessage(), e);
    }

}
 
开发者ID:Azure,项目名称:azure-documentdb-hadoop,代码行数:25,代码来源:DocumentDBStorage.java

示例7: getSchema

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
public ResourceSchema getSchema(String location, Job job)
throws IOException {

    ResourceSchema s;
    if (schema!=null) {
        s = schema;
    } else {
        // Parse the schema
        s = (new JsonMetadata()).getSchema(location, job, true);

        if (s == null) {
            throw new IOException("Unable to parse schema found in file in " + location);
        }
    }

    // Now that we have determined the schema, store it in our
    // UDFContext properties object so we have it when we need it on the
    // backend
    UDFContext udfc = UDFContext.getUDFContext();
    Properties p =
        udfc.getUDFProperties(this.getClass(), new String[]{udfcSignature});
    p.setProperty(SCHEMA_SIGNATURE, s.toString());

    return s;
}
 
开发者ID:sigmoidanalytics,项目名称:spork,代码行数:26,代码来源:JsonLoader.java

示例8: getWhereClauseForPartitionFilter

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
/** retrieve where clause for partition filter */
private String getWhereClauseForPartitionFilter()
{
    UDFContext context = UDFContext.getUDFContext();
    Properties property = context.getUDFProperties(AbstractCassandraStorage.class);
    return property.getProperty(PARTITION_FILTER_SIGNATURE);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:CqlNativeStorage.java

示例9: getCfInfo

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
/** get the columnfamily definition for the signature */
protected CfInfo getCfInfo(String signature) throws IOException
{
    UDFContext context = UDFContext.getUDFContext();
    Properties property = context.getUDFProperties(AbstractCassandraStorage.class);
    String prop = property.getProperty(signature);
    CfInfo cfInfo = new CfInfo();
    cfInfo.cfDef = cfdefFromString(prop.substring(2));
    cfInfo.compactCqlTable = prop.charAt(0) == '1' ? true : false;
    cfInfo.cql3Table = prop.charAt(1) == '1' ? true : false;
    return cfInfo;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:13,代码来源:AbstractCassandraStorage.java

示例10: setPartitionFilter

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
/** set partition filter */
public void setPartitionFilter(Expression partitionFilter) throws IOException
{
    UDFContext context = UDFContext.getUDFContext();
    Properties property = context.getUDFProperties(AbstractCassandraStorage.class);
    property.setProperty(PARTITION_FILTER_SIGNATURE, indexExpressionsToString(filterToIndexExpressions(partitionFilter)));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:CassandraStorage.java

示例11: getIndexExpressions

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
/** get a list of index expression */
private List<IndexExpression> getIndexExpressions() throws IOException
{
    UDFContext context = UDFContext.getUDFContext();
    Properties property = context.getUDFProperties(AbstractCassandraStorage.class);
    if (property.getProperty(PARTITION_FILTER_SIGNATURE) != null)
        return indexExpressionsFromString(property.getProperty(PARTITION_FILTER_SIGNATURE));
    else
        return null;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:CassandraStorage.java

示例12: getCfDef

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
/** get the columnfamily definition for the signature */
protected CfDef getCfDef(String signature) throws IOException
{
    UDFContext context = UDFContext.getUDFContext();
    Properties property = context.getUDFProperties(AbstractCassandraStorage.class);
    return cfdefFromString(property.getProperty(signature));
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:8,代码来源:AbstractCassandraStorage.java

示例13: checkSchema

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
@Override
public void checkSchema(ResourceSchema s) throws IOException {
    // We won't really check the schema here, we'll store it in our
    // UDFContext properties object so we have it when we need it on the
    // backend
    
    UDFContext udfc = UDFContext.getUDFContext();
    Properties p =
        udfc.getUDFProperties(this.getClass(), new String[]{udfcSignature});
    p.setProperty(SCHEMA_SIGNATURE, s.toString());
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:12,代码来源:JsonStorage.java

示例14: getProperties

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
/**
 * Internal function for getting the Properties object associated with
 * this UDF instance.
 * @param c Class of this UDF
 * @param signature Signature string
 * @return The Properties object associated with this UDF instance
 */
@SuppressWarnings("rawtypes")
protected final Properties getProperties(final Class c,
    final String signature) {
  UDFContext context = UDFContext.getUDFContext();
  if (signature == null) {
    return context.getUDFProperties(c);
  } else {
    return context.getUDFProperties(c, new String[] {signature});
  }

}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:19,代码来源:AvroStorage.java

示例15: checkSchema

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
@Override
public void checkSchema(ResourceSchema s) throws IOException {
    checkPigSchemaForDynamo(s);

    UDFContext udfc = UDFContext.getUDFContext();
    Properties p = udfc.getUDFProperties(this.getClass(),
            new String[] { this.udfContextSignature });
    p.setProperty(SCHEMA_PROPERTY, s.toString());
}
 
开发者ID:mortardata,项目名称:pig-dynamodb,代码行数:10,代码来源:DynamoDBStorage.java


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