{
if(mode == ExecType.LOCAL) {
//We don't need this optimisation to happen in the local mode.
//so we do nothing here.
} else {
LOSort sort = (LOSort)predecessor;
if (sort.getLimit()==-1)
sort.setLimit(limit.getLimit());
else
sort.setLimit(sort.getLimit()<limit.getLimit()?sort.getLimit():limit.getLimit());
try {
removeFromChain(limit, null);
} catch (Exception e) {
int errCode = 2012;
String msg = "Can not remove LOLimit after LOSort";