Search in sources :

Example 6 with SearchedCaseExpression

use of org.teiid.query.sql.symbol.SearchedCaseExpression in project teiid by teiid.

the class ODataExpressionToSQLVisitor method addOne.

private org.teiid.query.sql.symbol.Expression addOne(org.teiid.query.sql.symbol.Expression expr) {
    org.teiid.query.sql.symbol.Expression when = new CompareCriteria(expr, CompareCriteria.LT, new Constant(0));
    SearchedCaseExpression caseExpr = new SearchedCaseExpression(Arrays.asList(when), Arrays.asList(expr));
    caseExpr.setElseExpression(new Function("+", new org.teiid.query.sql.symbol.Expression[] { expr, new Constant(1) }));
    return caseExpr;
}
Also used : Function(org.teiid.query.sql.symbol.Function) SearchedCaseExpression(org.teiid.query.sql.symbol.SearchedCaseExpression) SearchedCaseExpression(org.teiid.query.sql.symbol.SearchedCaseExpression) Constant(org.teiid.query.sql.symbol.Constant) ScalarSubquery(org.teiid.query.sql.symbol.ScalarSubquery)

Aggregations

SearchedCaseExpression (org.teiid.query.sql.symbol.SearchedCaseExpression)6 Constant (org.teiid.query.sql.symbol.Constant)3 Criteria (org.teiid.query.sql.lang.Criteria)2 Expression (org.teiid.query.sql.symbol.Expression)2 Function (org.teiid.query.sql.symbol.Function)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 DataPolicy (org.teiid.adminapi.DataPolicy)1 DataPolicyMetadata (org.teiid.adminapi.impl.DataPolicyMetadata)1 PermissionMetaData (org.teiid.adminapi.impl.DataPolicyMetadata.PermissionMetaData)1 QueryMetadataException (org.teiid.api.exception.query.QueryMetadataException)1 TeiidException (org.teiid.core.TeiidException)1 org.teiid.language (org.teiid.language)1 FunctionDescriptor (org.teiid.query.function.FunctionDescriptor)1 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)1 SubqueryContainer (org.teiid.query.sql.lang.SubqueryContainer)1 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)1 ScalarSubquery (org.teiid.query.sql.symbol.ScalarSubquery)1 WindowFunction (org.teiid.query.sql.symbol.WindowFunction)1 ValidationVisitor (org.teiid.query.validator.ValidationVisitor)1