| 39 | public class ToString extends EvalFunc<String> { |
| 40 | |
| 41 | public String exec(Tuple input) throws IOException { |
| 42 | if (input == null || input.size() < 1 || input.get(0) == null) { |
| 43 | return null; |
| 44 | } |
| 45 | if (input.size() == 1) { |
| 46 | return DataType.toDateTime(input.get(0)).toString(); |
| 47 | } else if (input.size() == 2) { |
| 48 | DateTimeFormatter dtf = DateTimeFormat.forPattern(DataType.toString(input.get(1))); |
| 49 | return DataType.toDateTime(input.get(0)).toString(dtf); |
| 50 | } else { |
| 51 | return null; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public Schema outputSchema(Schema input) { |