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)
| 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) { |