use of org.teiid.language.Comparison.Operator in project teiid by teiid.
the class LanguageBridgeFactory method translate.
org.teiid.language.Comparison translate(DependentSetCriteria criteria) {
Operator operator = Operator.EQ;
org.teiid.language.Expression arg = null;
final TupleBuffer tb = criteria.getDependentValueSource().getTupleBuffer();
if (criteria.getValueExpression() instanceof Array) {
Array array = (Array) criteria.getValueExpression();
List<org.teiid.language.Expression> params = new ArrayList<org.teiid.language.Expression>();
Class<?> baseType = null;
for (Expression ex : array.getExpressions()) {
if (baseType == null) {
baseType = ex.getType();
} else if (!baseType.equals(ex.getType())) {
baseType = DataTypeManager.DefaultDataClasses.OBJECT;
}
params.add(createParameter(criteria, tb, ex));
}
arg = new org.teiid.language.Array(baseType, params);
} else {
Expression ex = criteria.getValueExpression();
arg = createParameter(criteria, tb, ex);
}
if (this.dependentSets == null) {
this.dependentSets = new HashMap<String, List<? extends List<?>>>();
}
this.dependentSets.put(criteria.getContextSymbol(), new TupleBufferList(tb));
Comparison result = new org.teiid.language.Comparison(translate(criteria.getExpression()), arg, operator);
return result;
}
use of org.teiid.language.Comparison.Operator in project teiid by teiid.
the class LanguageBridgeFactory method translate.
SubqueryComparison translate(SubqueryCompareCriteria criteria) {
Quantifier quantifier = Quantifier.ALL;
switch(criteria.getPredicateQuantifier()) {
case SubqueryCompareCriteria.ALL:
quantifier = Quantifier.ALL;
break;
case SubqueryCompareCriteria.ANY:
quantifier = Quantifier.SOME;
break;
case SubqueryCompareCriteria.SOME:
quantifier = Quantifier.SOME;
break;
}
Operator operator = Operator.EQ;
switch(criteria.getOperator()) {
case SubqueryCompareCriteria.EQ:
operator = Operator.EQ;
break;
case SubqueryCompareCriteria.NE:
operator = Operator.NE;
break;
case SubqueryCompareCriteria.LT:
operator = Operator.LT;
break;
case SubqueryCompareCriteria.LE:
operator = Operator.LE;
break;
case SubqueryCompareCriteria.GT:
operator = Operator.GT;
break;
case SubqueryCompareCriteria.GE:
operator = Operator.GE;
break;
}
return new SubqueryComparison(translate(criteria.getLeftExpression()), operator, quantifier, translate(criteria.getCommand()));
}
Aggregations