newScvf =
new SingleColumnValueFilter(scvf.getFamily(), scvf.getQualifier(),
CompareOp.GREATER_OR_EQUAL, scvf.getComparator());
} else {
newScvf =
new SingleColumnValuePartitionFilter(scvf.getFamily(), scvf.getQualifier(),
CompareOp.GREATER_OR_EQUAL, scvf.getComparator(), vp);
}
Value newValue = new Value(CompareOp.GREATER_OR_EQUAL, prevValue, newScvf);
valueList.add(newValue);
return;
}
}
break;
case GREATER_OR_EQUAL:
if (prevOperator == CompareOp.GREATER || prevOperator == CompareOp.GREATER_OR_EQUAL) {
if (result >= 0) {
valueListItr.remove();
} else {
// Already you found less value than present value means present filter will
// return subset of previous filter. No need to add it to list.
return;
}
} else if (prevOperator == CompareOp.LESS || prevOperator == CompareOp.LESS_OR_EQUAL) {
// Need to handle conditions like previous is c1<5 and current c1>2. In these cases we
// can change this condition into three parts c1<2,c1>=2 AND C1=<5 ,c1>5 and add to
// list.
} else if (prevOperator == CompareOp.EQUAL) {
if (result >= 0) {
valueListItr.remove();
}
}
break;
case LESS:
if (prevOperator == CompareOp.LESS || prevOperator == CompareOp.LESS_OR_EQUAL) {
if (result < 0) {
valueListItr.remove();
} else {
// Already you found less or equal value than present value means present filter will
// return subset of previous filter. No need to add it to list.
return;
}
} else if (prevOperator == CompareOp.GREATER
|| prevOperator == CompareOp.GREATER_OR_EQUAL) {
// Need to handle conditions like previous is c1<5 and current c1>2. In these cases we
// can change this condition into three parts c1<2,c1>=2 AND C1=<5 ,c1>5 and add to
// list.
} else if (prevOperator == CompareOp.EQUAL) {
if (result < 0) {
valueListItr.remove();
} else if (result == 0) {
// remove this entry and convert LESS to LESS_OR_EQUAL
valueListItr.remove();
SingleColumnValueFilter newScvf = null;
if (vp == null) {
newScvf =
new SingleColumnValueFilter(scvf.getFamily(), scvf.getQualifier(),
CompareOp.LESS_OR_EQUAL, scvf.getComparator());
} else {
newScvf =
new SingleColumnValuePartitionFilter(scvf.getFamily(), scvf.getQualifier(),
CompareOp.LESS_OR_EQUAL, scvf.getComparator(), vp);
}
Value newValue = new Value(CompareOp.LESS_OR_EQUAL, prevValue, newScvf);
valueList.add(newValue);
return;
}
}
break;
case LESS_OR_EQUAL:
if (prevOperator == CompareOp.LESS || prevOperator == CompareOp.LESS_OR_EQUAL) {
if (result <= 0) {
valueListItr.remove();
} else {
// Already you found less or equal value than present value means present filter will
// return subset of previous filter. No need to add it to list.
return;
}
} else if (prevOperator == CompareOp.GREATER
|| prevOperator == CompareOp.GREATER_OR_EQUAL) {
// Need to handle conditions like previous is c1<5 and current c1>2. In these cases we
// can change this condition into three parts c1<2,c1>=2 AND C1=<5 ,c1>5 and add to
// list.
} else if (prevOperator == CompareOp.EQUAL) {
// If we dont want to do conversion we can add into first if condition.
if (result <= 0) {
valueListItr.remove();
} else if (result == 0) {
// remove this entry and convert GREATER to GREATER_OR_EQUAL
}
}
break;
case EQUAL:
if (prevOperator == CompareOp.GREATER) {
if (result < 0) {
return;
} else if (result == 0) {
valueListItr.remove();
SingleColumnValueFilter newScvf = null;
if (vp == null) {
newScvf =
new SingleColumnValueFilter(scvf.getFamily(), scvf.getQualifier(),
CompareOp.GREATER_OR_EQUAL, scvf.getComparator());
} else {
newScvf =
new SingleColumnValuePartitionFilter(scvf.getFamily(), scvf.getQualifier(),
CompareOp.GREATER_OR_EQUAL, scvf.getComparator(), vp);
}
Value newValue = new Value(CompareOp.GREATER_OR_EQUAL, prevValue, newScvf);
valueList.add(newValue);
return;
}
} else if (prevOperator == CompareOp.GREATER_OR_EQUAL) {
if (result <= 0) {
return;
}
} else if (prevOperator == CompareOp.LESS) {
if (result > 0) {
return;
} else if (result == 0) {
valueListItr.remove();
SingleColumnValueFilter newScvf = null;
if (vp == null) {
newScvf =
new SingleColumnValueFilter(scvf.getFamily(), scvf.getQualifier(),
CompareOp.LESS_OR_EQUAL, scvf.getComparator());
} else {
newScvf =
new SingleColumnValuePartitionFilter(scvf.getFamily(), scvf.getQualifier(),
CompareOp.LESS_OR_EQUAL, scvf.getComparator(), vp);
}
Value newValue = new Value(CompareOp.LESS_OR_EQUAL, prevValue, newScvf);
valueList.add(newValue);
return;