MCPcopy Create free account
hub / github.com/apache/pig / exec

Method exec

src/org/apache/pig/builtin/LAST_INDEX_OF.java:53–66  ·  view source on GitHub ↗

Finds the last location of a substring in a given string. @param input tuple: the string to process the substring to find @exception java.io.IOException @return last location of substring, or null in case of processing errors.

(Tuple input)

Source from the content-addressed store, hash-verified

51 * @return last location of substring, or null in case of processing errors.
52 */
53 @Override
54 public Integer exec(Tuple input) throws IOException {
55 if (input == null || input.size() < 2)
56 return null;
57
58 try {
59 String str = (String)input.get(0);
60 String search = (String)input.get(1);
61 return str.lastIndexOf(search);
62 } catch(Exception e) {
63 warn("Failed to process input; error - " + e.getMessage(), PigWarning.UDF_WARNING_1);
64 return null;
65 }
66 }
67
68 @Override
69 public Schema outputSchema(Schema input) {

Callers 1

testLastIndexOfMethod · 0.95

Calls 4

sizeMethod · 0.65
getMethod · 0.65
warnMethod · 0.65
getMessageMethod · 0.45

Tested by 1

testLastIndexOfMethod · 0.76