org.apache.pig.impl.eval
Class EvalSpec

java.lang.Object
  extended by org.apache.pig.impl.eval.EvalSpec
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BinCondSpec, CompositeEvalSpec, FilterSpec, FuncEvalSpec, GenerateSpec, SimpleEvalSpec, SortDistinctSpec, StarSpec, StreamSpec, WindowSpec

public abstract class EvalSpec
extends Object
implements Serializable

See Also:
Serialized Form

Nested Class Summary
 class EvalSpec.UserComparator
           
 
Field Summary
protected  boolean inner
           
protected  Properties properties
           
 
Constructor Summary
EvalSpec()
           
 
Method Summary
 EvalSpec addSpec(EvalSpec spec)
          set the succesor of this spec
 EvalSpec copy(PigContext pigContext)
           
 void finish()
          A placeholder for any cleanup action that the spec needs to perform
 EvalSpec getCombiner()
           
 Comparator<Tuple> getComparator()
          Compare 2 tuples according to this spec.
 String getComparatorName()
           
abstract  List<String> getFuncs()
          Get the functions required by this spec
 LineageTracer getLineage()
           
 Schema getOutputSchemaForPipe(Schema input)
           
 Properties getProperties()
          Get properties specific to a given EvalSpec.
 void instantiateFunc(FunctionInstantiator instantiaor)
           
 boolean isAsynchronous()
          Some specs may be asynchronous, i.e., they return before completing the processing fully.
 boolean isFlattened()
           
 boolean isInner()
           
protected abstract  Schema mapInputSchema(Schema schema)
          Given an input schema, determine the output schema of this spec as it operates on input tuples with the input schema.
 void setComparatorName(String name)
           
 void setFlatten(boolean isFlattened)
           
 void setInner(boolean inner)
           
 void setLineageTracer(LineageTracer lineage)
           
 void setSchema(Schema schema)
           
protected abstract  DataCollector setupDefaultPipe(Properties properties, DataCollector endOfPipe)
          set up a default data processing pipe for processing by this spec This pipe does not include unflattening/flattening at the end
 DataCollector setupPipe(Properties properties, DataCollector endOfPipe)
          set up a data processing pipe with flattening/unflattening at the end based on the isFlattened field
 Datum simpleEval(Datum input)
          If the spec is such that it produces exactly one datum per input datum, we can use simple eval as a shortcut to the whole process of setting the pipe etc.
abstract  void visit(EvalSpecVisitor v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inner

protected boolean inner

properties

protected Properties properties
Constructor Detail

EvalSpec

public EvalSpec()
Method Detail

setLineageTracer

public void setLineageTracer(LineageTracer lineage)

getLineage

public LineageTracer getLineage()

instantiateFunc

public void instantiateFunc(FunctionInstantiator instantiaor)
                     throws IOException
Throws:
IOException

setupDefaultPipe

protected abstract DataCollector setupDefaultPipe(Properties properties,
                                                  DataCollector endOfPipe)
set up a default data processing pipe for processing by this spec This pipe does not include unflattening/flattening at the end

Parameters:
properties - properties for the pipe
endOfPipe - The collector where output is desired
Returns:
The collector where input tuples should be put

setupPipe

public DataCollector setupPipe(Properties properties,
                               DataCollector endOfPipe)
set up a data processing pipe with flattening/unflattening at the end based on the isFlattened field

Parameters:
properties - properties for the EvalSpec
endOfPipe - where the output is desired
Returns:
The collector where input tuples should be put

addSpec

public EvalSpec addSpec(EvalSpec spec)
set the succesor of this spec

Parameters:
spec - the new succesor
Returns:

getFuncs

public abstract List<String> getFuncs()
Get the functions required by this spec

Returns:

getOutputSchemaForPipe

public Schema getOutputSchemaForPipe(Schema input)

mapInputSchema

protected abstract Schema mapInputSchema(Schema schema)
Given an input schema, determine the output schema of this spec as it operates on input tuples with the input schema.

Parameters:
input -
Returns:

finish

public void finish()
A placeholder for any cleanup action that the spec needs to perform


isAsynchronous

public boolean isAsynchronous()
Some specs may be asynchronous, i.e., they return before completing the processing fully. The default value is false, may be overridden to return true


setComparatorName

public void setComparatorName(String name)

getComparatorName

public String getComparatorName()

getComparator

public Comparator<Tuple> getComparator()
Compare 2 tuples according to this spec. This is used while sorting by arbitrary (even generated) fields.

Returns:

setFlatten

public void setFlatten(boolean isFlattened)

isFlattened

public boolean isFlattened()

simpleEval

public Datum simpleEval(Datum input)
If the spec is such that it produces exactly one datum per input datum, we can use simple eval as a shortcut to the whole process of setting the pipe etc. However, the code path is still the same in both cases.

Parameters:
input -
Returns:

getCombiner

public EvalSpec getCombiner()

copy

public EvalSpec copy(PigContext pigContext)

setSchema

public void setSchema(Schema schema)

isInner

public boolean isInner()

setInner

public void setInner(boolean inner)

getProperties

public Properties getProperties()
Get properties specific to a given EvalSpec.

Returns:
properties specific to a given EvalSpec

visit

public abstract void visit(EvalSpecVisitor v)


Copyright © ${year} The Apache Software Foundation