@Test public void testExec1() throws IOException { String outputDateStr = convDateFormat.exec(null); assertNull(outputDateStr); }
@Override public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } if (inputSdf == null || outputSdf == null) { this.inputSdf = new SimpleDateFormat((String) input.get(1)); this.outputSdf = new SimpleDateFormat((String) input.get(2)); } String s = null; try { Date d = inputSdf.parse((String) input.get(0)); s = outputSdf.format(d); } catch (ParseException e) { pigLogger.warn(this, "Date parsing error", ERRORS.DateParseError); } return s; }
ConvertDateFormat extends EvalFunc<String> { @Override public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } if (inputSdf == null || outputSdf == null) { this.inputSdf = new SimpleDateFormat((String) input.get(1)); this.outputSdf = new SimpleDateFormat((String) input.get(2)); } String s = null; try { Date d = inputSdf.parse((String) input.get(0)); s = outputSdf.format(d); } catch (ParseException e) { pigLogger.warn(this, "Date parsing error", ERRORS.DateParseError); } return s; } }
ConvertDateFormat extends EvalFunc<String> { @Override public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } if (inputSdf == null || outputSdf == null) { this.inputSdf = new SimpleDateFormat((String) input.get(1)); this.outputSdf = new SimpleDateFormat((String) input.get(2)); } String s = null; try { Date d = inputSdf.parse((String) input.get(0)); s = outputSdf.format(d); } catch (ParseException e) { pigLogger.warn(this, "Date parsing error", ERRORS.DateParseError); } return s; } ConvertDateFormat();  ConvertDateFormat(final String inputDateFormat, final String outputDateFormat); }
ConvertDateFormat extends EvalFunc<String> { @Override public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } if (inputSdf == null || outputSdf == null) { this.inputSdf = new SimpleDateFormat((String) input.get(1)); this.outputSdf = new SimpleDateFormat((String) input.get(2)); } String s = null; try { Date d = inputSdf.parse((String) input.get(0)); s = outputSdf.format(d); } catch (ParseException e) { pigLogger.warn(this, "Date parsing error", ERRORS.DateParseError); } return s; } ConvertDateFormat();  ConvertDateFormat(final String inputDateFormat, final String outputDateFormat); @Override String exec(Tuple input); }
ConvertDateFormat extends EvalFunc<String> { @Override public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } if (inputSdf == null || outputSdf == null) { this.inputSdf = new SimpleDateFormat((String) input.get(1)); this.outputSdf = new SimpleDateFormat((String) input.get(2)); } String s = null; try { Date d = inputSdf.parse((String) input.get(0)); s = outputSdf.format(d); } catch (ParseException e) { pigLogger.warn(this, "Date parsing error", ERRORS.DateParseError); } return s; } ConvertDateFormat();  ConvertDateFormat(final String inputDateFormat, final String outputDateFormat); @Override String exec(Tuple input);  }