@Override public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } try { String str = (String) input.get(0); if (str == null) return null; if (str.length() == 0) return str; return Character.toLowerCase(str.charAt(0))+str.substring(1); } catch (ExecException e) { warn("Error reading input: " + e.getMessage(), PigWarning.UDF_WARNING_1); return null; } }
@Override public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } try { String str = (String) input.get(0); if (str == null) return null; if (str.length() == 0) return str; return Character.toUpperCase(str.charAt(0))+str.substring(1); } catch (ExecException e) { warn("Error reading input: " + e.getMessage(), PigWarning.UDF_WARNING_1); return null; } }
@Override public int compare(Tuple t1, Tuple t2) { mSortFunc.attachInput(t1, t2); Integer i = null; Result res = null; try { res = mSortFunc.getNextInteger(); } catch (ExecException e) { log.error("Input not ready. Error on reading from input. " + e.getMessage()); } if (res != null) { return (Integer) res.result; } else { return 0; } }
private ArrayList<Tuple> applyView(Tuple inner) { // [0] is the JSON. Remaining elements are Strings describing paths // into the JSON to "flatten" into a single tuple: if(inner == null || inner.size() == 0) { return null; } try { JSONObject json = new JSONObject(inner.get(2).toString()); List<List<String>> matches = view.apply(json); if(matches.size() == 0) { return null; } ArrayList<Tuple> results = new ArrayList<Tuple>(); for(List<String> t : matches) { mCacheProtoTuple.addAll(t); Tuple tup = mCacheTupleFactory.newTuple(mCacheProtoTuple); mCacheProtoTuple.clear(); results.add(tup); } return results; } catch (JSONException e) { LOG.warning("Failed to parse JSON:"+e.getMessage()); } catch (ExecException e) { LOG.warning("ExecException:"+e.getMessage()); } return null; }
@Override public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } try { String str = (String) input.get(0); if (str == null) return null; if (str.length() == 0) return str; return str.replaceFirst(" +$", ""); } catch (ExecException e) { warn("Error reading input: " + e.getMessage(), PigWarning.UDF_WARNING_1); return null; } }
@Override public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } try { String str = (String) input.get(0); if (str == null) return null; if (str.length() == 0) return str; return str.trim(); } catch (ExecException e) { warn("Error reading input: " + e.getMessage(), PigWarning.UDF_WARNING_1); return null; } }
@Override public String exec(Tuple input) throws IOException { if (input == null || input.size() == 0) { return null; } try { String str = (String) input.get(0); if (str == null) return null; if (str.length() == 0) return str; return str.replaceFirst("^ +", ""); } catch (ExecException e) { warn("Error reading input: " + e.getMessage(), PigWarning.UDF_WARNING_1); return null; } }
private ArrayList<Tuple> applyView(Tuple inner) { // [0] is the JSON. Remaining elements are Strings describing paths // into the JSON to "flatten" into a single tuple: if(inner == null || inner.size() == 0) { return null; } try { JSONObject json = new JSONObject(inner.get(2).toString()); List<List<String>> matches = view.apply(json); if(matches.size() == 0) { return null; } ArrayList<Tuple> results = new ArrayList<Tuple>(); for(List<String> t : matches) { mCacheProtoTuple.addAll(t); Tuple tup = mCacheTupleFactory.newTuple(mCacheProtoTuple); mCacheProtoTuple.clear(); results.add(tup); } return results; } catch (JSONException e) { LOG.warning("Failed to parse JSON:"+e.getMessage()); } catch (ExecException e) { LOG.warning("ExecException:"+e.getMessage()); } return null; }
private ArrayList<Tuple> applyView(Tuple inner) { // [0] is the JSON. Remaining elements are Strings describing paths // into the JSON to "flatten" into a single tuple: if(inner == null || inner.size() == 0) { return null; } try { JSONObject json = new JSONObject(inner.get(2).toString()); List<List<String>> matches = view.apply(json); if(matches.size() == 0) { return null; } ArrayList<Tuple> results = new ArrayList<Tuple>(); for(List<String> t : matches) { mCacheProtoTuple.addAll(t); Tuple tup = mCacheTupleFactory.newTuple(mCacheProtoTuple); mCacheProtoTuple.clear(); results.add(tup); } return results; } catch (JSONException e) { LOG.warning("Failed to parse JSON:"+e.getMessage()); } catch (ExecException e) { LOG.warning("ExecException:"+e.getMessage()); } return null; }
incrementCounter(Counters.NUM_TUPLE_TO_JSON_CONVERSION_ERRORS, 1L); log.error(String.format("Failed to convert Tuple %s to JSON Object due to: %s", tupleAsStr(input), ee.getMessage()), ee); return null;
log.error("Invalid result while executing the expression plan : " + plan.toString() + "\n" + e.getMessage());
/** * Configures the Local Rearrange operators to get keys out of tuple. * @throws ExecException */ private void createJoinPlans(MultiMap<PhysicalOperator, PhysicalPlan> inpPlans, List<List<Byte>> keyTypes) throws PlanException{ int i=-1; for (PhysicalOperator inpPhyOp : inpPlans.keySet()) { ++i; POLocalRearrange lr = new POLocalRearrange(genKey()); try { lr.setIndex(i); } catch (ExecException e) { throw new PlanException(e.getMessage(),e.getErrorCode(),e.getErrorSource(),e); } lr.setResultType(DataType.TUPLE); lr.setKeyType(keyTypes.get(i).size() > 1 ? DataType.TUPLE : keyTypes.get(i).get(0)); lr.setPlans(inpPlans.get(inpPhyOp)); LRs[i]= lr; } }
log.warn(e.getMessage());
log .error("Error visiting Load during Augmentation phase of Example Generator! " + e.getMessage()); throw new FrontendException( "Error visiting Load during Augmentation phase of Example Generator! " + e.getMessage()); throw new FrontendException( "Error visiting Load during Augmentation phase of Example Generator! " + e.getMessage());
readBaseData(loads); } catch (ExecException e) { log.error("Error reading data. " + e.getMessage()); throw e; } catch (FrontendException e) {
private void createJoinPlans(MultiMap<PhysicalOperator, PhysicalPlan> inpPlans) throws PlanException { int i = -1; for (PhysicalOperator inpPhyOp : inpPlans.keySet()) { ++i; POLocalRearrange lr = new POLocalRearrange(genKey()); try { lr.setIndex(i); } catch (ExecException e) { throw new PlanException(e.getMessage(), e.getErrorCode(), e.getErrorSource(), e); } lr.setResultType(DataType.TUPLE); lr.setKeyType(DataType.TUPLE);//keyTypes.get(i).size() > 1 ? DataType.TUPLE : keyTypes.get(i).get(0)); lr.setPlans(inpPlans.get(inpPhyOp)); LRs[i] = lr; } }