public class REPLACE_MULTI extends EvalFunc<String>
input_data = LOAD 'input_data' as (name); -- name = 'Hello World!'
replaced_name = FOREACH input_data GENERATE REPLACE_MULTI ( name, [ ' '#'_', '!'#'', 'e'#'a', 'o'#'oo' ] ); -- replaced_name = Halloo_Woorld
The first argument is the source string on which REPLACE_MULTI operation is
performed. The second argument is a map having search key - replacement value
pairs.EvalFunc.SchemaType
log, pigLogger, reporter, returnType
Constructor and Description |
---|
REPLACE_MULTI() |
Modifier and Type | Method and Description |
---|---|
String |
exec(Tuple input)
Method invoked on every tuple during FOREACH evaluation.
|
List<FuncSpec> |
getArgToFuncMapping()
Allow a UDF to specify type specific implementations of itself.
|
Schema |
outputSchema(Schema input)
Report the schema of the output of this UDF.
|
allowCompileTimeCalculation, finish, getCacheFiles, getInputSchema, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, getSchemaType, getShipFiles, isAsynchronous, needEndOfAllInputProcessing, progress, setEndOfAllInput, setInputSchema, setPigLogger, setReporter, setUDFContextSignature, warn
public String exec(Tuple input) throws IOException
exec
in class EvalFunc<String>
input
- tuple; First field value is the source string and second field
is a map having search - replacement values.IOException
public Schema outputSchema(Schema input)
EvalFunc
The default implementation interprets the OutputSchema
annotation,
if one is present. Otherwise, it returns null
(no known output schema).
outputSchema
in class EvalFunc<String>
input
- Schema of the inputpublic List<FuncSpec> getArgToFuncMapping() throws FrontendException
EvalFunc
getArgToFuncMapping
in class EvalFunc<String>
FrontendException
Copyright © 2007-2012 The Apache Software Foundation