LOCast cast = new LOCast(currentPlan, newKey, rg.getOperand(), DataType.CHARARRAY) ;
currentPlan.add(cast) ;
currentPlan.disconnect(rg.getOperand(), rg) ;
try {
currentPlan.connect(rg.getOperand(), cast) ;
currentPlan.connect(cast, rg) ;
}
catch (PlanException pe) {
int errCode = 2059;
String msg = "Problem with inserting cast operator for regular expression in plan.";
throw new TypeCheckerException(msg, errCode, PigException.BUG, pe);