org.apache.pig.piggybank.evaluation.string
Class SUBSTRING
java.lang.Object
org.apache.pig.EvalFunc<String>
org.apache.pig.piggybank.evaluation.string.SUBSTRING
public class SUBSTRING
- extends EvalFunc<String>
string.SUBSTRING implements eval function to get a part of a string.
Example:
register pigudfs.jar;
A = load 'mydata' as (name);
B = foreach A generate string.SUBSTRING(name, 10, 12);
dump B;
First argument is the string to take a substring of.
Second argument is the index of the first character of substring.
Third argument is the index of the last character of substring.
if the last argument is past the end of the string, substring of (beginIndex, length(str)) is returned.
Methods inherited from class org.apache.pig.EvalFunc |
finish, getArgToFuncMapping, getLogger, getPigLogger, getReporter, getReturnType, getSchemaName, isAsynchronous, progress, setPigLogger, setReporter, warn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SUBSTRING
public SUBSTRING()
exec
public String exec(Tuple input)
throws IOException
- Method invoked on every tuple during foreach evaluation
- Specified by:
exec
in class EvalFunc<String>
- Parameters:
input
- tuple; first column is assumed to have the column to convert
- Returns:
- result, of type T.
- Throws:
IOException
outputSchema
public Schema outputSchema(Schema input)
- Overrides:
outputSchema
in class EvalFunc<String>
- Parameters:
input
- Schema of the input
- Returns:
- Schema of the output
Copyright © ${year} The Apache Software Foundation