public class DataToSketch
extends org.apache.pig.EvalFunc<org.apache.pig.data.DataByteArray>
implements org.apache.pig.Accumulator<org.apache.pig.data.DataByteArray>, org.apache.pig.Algebraic
| Constructor and Description |
|---|
DataToSketch()
Constructor with default lgK and seed
|
DataToSketch(int lgK,
long seed)
Base constructor.
|
DataToSketch(String lgK)
Constructor with given lgK as string and default seed
|
DataToSketch(String lgK,
String seed)
Constructor with given lgK and seed as strings
|
| Modifier and Type | Method and Description |
|---|---|
void |
accumulate(org.apache.pig.data.Tuple inputTuple)
An Accumulator version of the standard exec() method.
|
void |
cleanup()
Cleans up the UDF state after being called using the
Accumulator interface. |
org.apache.pig.data.DataByteArray |
exec(org.apache.pig.data.Tuple inputTuple)
Top-level exec function.
|
String |
getFinal() |
String |
getInitial() |
String |
getIntermed() |
org.apache.pig.data.DataByteArray |
getValue()
Returns the sketch that has been built up by multiple calls to
accumulate(org.apache.pig.data.Tuple). |
allowCompileTimeCalculation, finish, getArgToFuncMapping, getCacheFiles, getInputSchema, getLoadCaster, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, getShipFiles, isAsynchronous, needEndOfAllInputProcessing, outputSchema, progress, setEndOfAllInput, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warnpublic DataToSketch()
public DataToSketch(String lgK)
lgK - in a form of a Stringpublic DataToSketch(String lgK, String seed)
lgK - in a form of a Stringseed - in a form of a Stringpublic DataToSketch(int lgK,
long seed)
lgK - parameter controlling the sketch size and accuracyseed - parameter to use during hashingpublic org.apache.pig.data.DataByteArray exec(org.apache.pig.data.Tuple inputTuple)
throws IOException
Note Strings as values are normally typed as DataType.CHARARRAY, which will be encoded as UTF-8 prior to being submitted to the sketch. If the user requires a different encoding for cross-platform compatibility, it is recommended that these values be encoded prior to being submitted in a DataBag and then typed as a DataType.BYTEARRAY.
exec in class org.apache.pig.EvalFunc<org.apache.pig.data.DataByteArray>inputTuple - A tuple containing a single bag, containing Datum Tuples.IOException - from Pigpublic void accumulate(org.apache.pig.data.Tuple inputTuple)
throws IOException
accumulate in interface org.apache.pig.Accumulator<org.apache.pig.data.DataByteArray>inputTuple - A tuple containing a single bag, containing Datum Tuples.IOException - by Pigexec(org.apache.pig.data.Tuple),
"org.apache.pig.Accumulator.accumulate(org.apache.pig.data.Tuple)"public org.apache.pig.data.DataByteArray getValue()
accumulate(org.apache.pig.data.Tuple).getValue in interface org.apache.pig.Accumulator<org.apache.pig.data.DataByteArray>public void cleanup()
Accumulator interface.cleanup in interface org.apache.pig.Accumulator<org.apache.pig.data.DataByteArray>public String getInitial()
getInitial in interface org.apache.pig.Algebraicpublic String getIntermed()
getIntermed in interface org.apache.pig.Algebraicpublic String getFinal()
getFinal in interface org.apache.pig.AlgebraicCopyright © 2015–2020 The Apache Software Foundation. All rights reserved.