Package org.apache.pig.impl.util

Examples of org.apache.pig.impl.util.UDFContext


    }


    // helper methods
    protected void storeInUDFContext(String signature, String key, Object value) {
        UDFContext udfContext = UDFContext.getUDFContext();
        Properties props = udfContext.getUDFProperties(
            this.getClass(), new String[]{signature});
        props.put(key, value);
    }
View Full Code Here


    @Override
    public void setLocation(String location, Job job) throws IOException {
        HCatContext.INSTANCE.setConf(job.getConfiguration()).getConf().get()
            .setBoolean(HCatConstants.HCAT_DATA_TINY_SMALL_INT_PROMOTION, true);

        UDFContext udfContext = UDFContext.getUDFContext();
        Properties udfProps = udfContext.getUDFProperties(this.getClass(),
            new String[]{signature});
        job.getConfiguration().set(INNER_SIGNATURE, INNER_SIGNATURE_PREFIX + "_" + signature);
        Pair<String, String> dbTablePair = PigHCatUtil.getDBTableNames(location);
        dbName = dbTablePair.first;
        tableName = dbTablePair.second;
View Full Code Here

        return schema;
    }

    public void setPartitionFilter(Expression partitionFilter) throws IOException
    {
        UDFContext context = UDFContext.getUDFContext();
        Properties property = context.getUDFProperties(AbstractCassandraStorage.class);
        property.setProperty(PARTITION_FILTER_SIGNATURE, partitionFilterToWhereClauseString(partitionFilter));
    }
View Full Code Here

    }

    /** 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);
    }
View Full Code Here

    }

    /** 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)));
    }
View Full Code Here

    }

    /** 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;
    }
View Full Code Here

    }

    /** 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;
View Full Code Here

                    roots = rp.getRoots().toArray(new PhysicalOperator[1]);
                    leaf = rp.getLeaves().get(0);
                }
               
                // Get the UDF specific context
              UDFContext udfc = UDFContext.getUDFContext();
              udfc.addJobConf(jConf);
              udfc.deserialize();
           
            } catch (IOException ioe) {
                String msg = "Problem while configuring reduce plan.";
                throw new RuntimeException(msg, ioe);
            }
View Full Code Here

                 * samplable tuples
                 */
                Object loader = PigContext.instantiateFuncFromSpec(spec.getFuncSpec());
                if (loader instanceof SampleLoader) {
                    Long iSize = FileLocalizer.getSize(spec.getFileName(), pigContext.getProperties());                    
                    UDFContext udfc = UDFContext.getUDFContext();
                    Properties p = udfc.getUDFProperties(SampleLoader.class);
                    p.setProperty("pig.input." + i + ".size", Long.toString(iSize));
                    udfc.serialize(job);
                }
           
        Slice[] pigs = spec.getSlicer().slice(store, spec.getFileName());
        for (Slice split : pigs) {
            splits.add(new SliceWrapper(split, pigContext.getExecType(), i, fs, inpTargets.get(i)));
View Full Code Here

            keyType = ((byte[])ObjectSerializer.deserialize(job.get("pig.map.keytype")))[0];
           
            pigReporter = new ProgressableReporter();
               
            // Get the UDF specific context
            UDFContext udfc = UDFContext.getUDFContext();
            udfc.addJobConf(job);
            udfc.deserialize();
           
            if(!(mp.isEmpty())) {
                List<OperatorKey> targetOpKeys =
                    (ArrayList<OperatorKey>)ObjectSerializer.deserialize(job.get("map.target.ops"));
                ArrayList<PhysicalOperator> targetOpsAsList = new ArrayList<PhysicalOperator>();
View Full Code Here

TOP

Related Classes of org.apache.pig.impl.util.UDFContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.