use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationException in project pdi-dataservice-server-plugin by pentaho.
the class MongodbPredicate method getMongoOp.
private MongoOp getMongoOp(Condition condition) throws PushDownOptimizationException {
validateConditionForOpDetermination(condition);
final Condition firstChild = condition.getChildren().get(1);
MongoOp op = MongoOp.getMongoOp(firstChild.getOperator());
if (op == null) {
throw new PushDownOptimizationException("Unsupported operator: " + firstChild.getOperatorDesc());
}
return op;
}
use of org.pentaho.di.trans.dataservice.optimization.PushDownOptimizationException in project pdi-dataservice-server-plugin by pentaho.
the class TableInputParameterGeneration method convertAtomicCondition.
protected String convertAtomicCondition(Condition condition, RowMeta paramsMeta, List<Object> params) throws PushDownOptimizationException {
String value = condition.getRightExactString();
String function = condition.getFunctionDesc();
String placeholder = "?";
switch(condition.getFunction()) {
case Condition.FUNC_REGEXP:
case Condition.FUNC_CONTAINS:
case Condition.FUNC_STARTS_WITH:
case Condition.FUNC_ENDS_WITH:
case Condition.FUNC_TRUE:
throw new PushDownOptimizationException(condition.getFunctionDesc() + " is not supported for push down.");
case Condition.FUNC_NOT_NULL:
case Condition.FUNC_NULL:
placeholder = "";
break;
case Condition.FUNC_IN_LIST:
Object[] inList = getInListArray(condition);
ValueMetaInterface inListValueMeta = getResolvedValueMeta(condition);
for (int i = 0; i < inList.length; i++) {
paramsMeta.addValueMeta(inListValueMeta);
params.add(inList[i]);
}
placeholder = String.format("(%s)", StringUtils.join(Collections.nCopies(inList.length, "?").iterator(), ","));
function = " IN ";
break;
default:
if (value == null) {
throw new PushDownOptimizationException("Condition value can not be null: " + condition);
}
paramsMeta.addValueMeta(getResolvedValueMeta(condition));
params.add(getResolvedValue(condition));
break;
}
return String.format("%s %s %s", getQuotedFieldName(condition), function, placeholder);
}
Aggregations