// being that the predicates here are all "flattened" so the hierarchy
// information is no longer available to guide the grouping of
// predicates with common parents. So some optimization possible in
// generateMultiValueInExpr() is not tried here, as they require
// implementing "longest common prefix" algorithm which is an overkill.
BitKey inListRHSBitKey = inListLHSBitKey.copy();
if (!columnBitKey.equals(inListLHSBitKey)
|| (children.size() > 1
&& !sqlQuery.getDialect().supportsMultiValueInExpr()))
{
inListRHSBitKey.clear();
} else {
for (StarPredicate predicate : children) {
// If any predicate requires comparison to null value, cannot
// use IN list for this predicate.
if (predicate instanceof ValueColumnPredicate) {
ValueColumnPredicate columnPred =
((ValueColumnPredicate) predicate);
if (columnPred.getValue() == RolapUtil.sqlNullValue) {
// This column predicate cannot be translated to IN
inListRHSBitKey.clear(
columnPred.getConstrainedColumn().getBitPosition());
}
// else do nothing because this column predicate can be
// translated to IN
} else {
inListRHSBitKey.clear();
break;
}
}
}
return inListRHSBitKey;