private Object getValueFromDyadicExpression(Expression expr) {
// In general we don't support nested dyadic expressions
// but we special case negation:
// select * from table where val = -33
DyadicExpression dyadic = (DyadicExpression) expr;
if (dyadic.getLeft() instanceof Literal &&
((Literal) dyadic.getLeft()).getLiteral() instanceof Number &&
dyadic.getRight() == null &&
Expression.OP_NEG.equals(dyadic.getOperator())) {
Number negateMe = (Number) ((Literal) dyadic.getLeft()).getLiteral();
return negateNumber(negateMe);
}
throw new UnsupportedDatastoreFeatureException(
"Right side of expression is composed of unsupported components. "
+ "Left: " + dyadic.getLeft().getClass().getName()
+ ", Op: " + dyadic.getOperator()
+ ", Right: " + dyadic.getRight());
}