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


Java UDFContext.getUDFContext方法代码示例

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


在下文中一共展示了UDFContext.getUDFContext方法的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: 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-streaming,代码行数:20,代码来源:JsonLoader.java

示例4: prepareToWrite

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
@Override
public void prepareToWrite(RecordWriter writer) throws IOException {
    // Store the record writer reference so we can use it when it's time
    // to write tuples
    this.writer = writer;

    // 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));

    // Build a Json factory
    jsonFactory = new JsonFactory();
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:22,代码来源:JsonStorage.java

示例5: pushProjection

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

    if (fields != null && 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:sigmoidanalytics,项目名称:spork-streaming,代码行数:25,代码来源:FixedWidthLoader.java

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: checkSchema

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
public void checkSchema(ResourceSchema s) throws IOException {
    // Not actually checking schema
    // Actually, just storing it to use in the backend
    
    UDFContext udfc = UDFContext.getUDFContext();
    Properties p =
        udfc.getUDFProperties(this.getClass(), new String[]{ udfContextSignature });
    p.setProperty(SCHEMA_SIGNATURE, s.toString());
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:10,代码来源:CSVExcelStorage.java

示例12: checkSchema

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
@Override
public void checkSchema(ResourceSchema s) throws IOException {
    // Not actually checking schema
    // Just storing it to use in the backend
    
    UDFContext udfc = UDFContext.getUDFContext();
    Properties p =
        udfc.getUDFProperties(this.getClass(), new String[]{ udfContextSignature });
    p.setProperty(SCHEMA_SIGNATURE, s.toString());
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:11,代码来源:FixedWidthStorer.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,代码行数:12,代码来源:DBStorage.java

示例14: prepareToWrite

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
/** BACKEND **/

    @SuppressWarnings("rawtypes")
    @Override
    public void prepareToWrite(RecordWriter writer) throws IOException {
        // Get the schema string from the UDFContext object.
        UDFContext udfc = UDFContext.getUDFContext();
        Properties p = udfc.getUDFProperties(this.getClass(),
                new String[] { this.udfContextSignature });
        String strSchema = p.getProperty(SCHEMA_PROPERTY);
        if (strSchema == null) {
            throw new IOException(
                    "Could not find schema in UDF context at property "
                            + SCHEMA_PROPERTY);
        }

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

        // connect to dynamo
        this.dynamo = loadDynamoDB();

        // fetch capacity we are allowed to use
        this.maxWriteCapacity = getMaxWriteCapacity();
        this.currentWriteCapacity = this.maxWriteCapacity;
        this.queue = new DynamoWriteRequestBlockingQueue();
        
        // create and start the stopwatch
        this.stopwatch = new Stopwatch().start();

    }
 
开发者ID:mortardata,项目名称:pig-dynamodb,代码行数:33,代码来源:DynamoDBStorage.java

示例15: setupUDFContext

import org.apache.pig.impl.util.UDFContext; //导入方法依赖的package包/类
public static void setupUDFContext(Configuration job) throws IOException {
    UDFContext udfc = UDFContext.getUDFContext();
    udfc.addJobConf(job);
    // don't deserialize in front-end 
    if (udfc.isUDFConfEmpty()) {
        udfc.deserialize();
    }
}
 
开发者ID:sigmoidanalytics,项目名称:spork-streaming,代码行数:9,代码来源:MapRedUtil.java


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