Search in sources :

Example 51 with AggregateSymbol

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

the class TestAggregateSymbol method testParser4.

public void testParser4() {
    // $NON-NLS-1$
    AggregateSymbol as = new AggregateSymbol(NonReserved.MAX, false, sampleFunction());
    // $NON-NLS-1$
    helpParser(as, "MAX((m.g.c + 5))");
}
Also used : AggregateSymbol(org.teiid.query.sql.symbol.AggregateSymbol)

Example 52 with AggregateSymbol

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

the class TestAggregateSymbol method testEquals3.

// just changing the name of an aggregatesymbol doesn't matter
public void testEquals3() {
    // $NON-NLS-1$
    AggregateSymbol as1 = new AggregateSymbol(NonReserved.COUNT, true, sampleElement());
    // $NON-NLS-1$
    AggregateSymbol as2 = new AggregateSymbol(NonReserved.COUNT, true, sampleElement());
    helpEquals(as1, as2, true);
}
Also used : AggregateSymbol(org.teiid.query.sql.symbol.AggregateSymbol)

Example 53 with AggregateSymbol

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

the class ODataExpressionToSQLVisitor method visit.

@Override
public void visit(UriResourceNavigation info) {
    try {
        DocumentNode navigationResource = DocumentNode.build((EdmEntityType) info.getType(), info.getKeyPredicates(), this.metadata, this.odata, this.nameGenerator, true, getUriInfo(), this.parseService);
        Query query = new Query();
        query.setSelect(new Select(Arrays.asList(new AggregateSymbol(AggregateSymbol.Type.COUNT.name(), false, null))));
        query.setFrom(new From(Arrays.asList(navigationResource.getFromClause())));
        Criteria criteria = this.ctxQuery.buildJoinCriteria(navigationResource, info.getProperty());
        if (criteria == null) {
            throw new TeiidException(ODataPlugin.Event.TEIID16037, ODataPlugin.Util.gs(ODataPlugin.Event.TEIID16037));
        }
        query.setCriteria(criteria);
        this.stack.add(new ScalarSubquery(query));
    } catch (TeiidException e) {
        throw new TeiidRuntimeException(e);
    }
}
Also used : AggregateSymbol(org.teiid.query.sql.symbol.AggregateSymbol) ScalarSubquery(org.teiid.query.sql.symbol.ScalarSubquery) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException) TeiidException(org.teiid.core.TeiidException)

Aggregations

AggregateSymbol (org.teiid.query.sql.symbol.AggregateSymbol)53 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)27 Test (org.junit.Test)21 BasicSourceCapabilities (org.teiid.query.optimizer.capabilities.BasicSourceCapabilities)16 ArrayList (java.util.ArrayList)12 List (java.util.List)11 Expression (org.teiid.query.sql.symbol.Expression)9 OrderBy (org.teiid.query.sql.lang.OrderBy)8 CommandContext (org.teiid.query.util.CommandContext)6 BufferManager (org.teiid.common.buffer.BufferManager)5 SymbolMap (org.teiid.query.sql.util.SymbolMap)5 BigDecimal (java.math.BigDecimal)4 FakeTupleSource (org.teiid.query.processor.FakeTupleSource)4 Constant (org.teiid.query.sql.symbol.Constant)4 TeiidRuntimeException (org.teiid.core.TeiidRuntimeException)3 PlanNode (org.teiid.query.optimizer.relational.plantree.PlanNode)3 AliasSymbol (org.teiid.query.sql.symbol.AliasSymbol)3 ExpressionSymbol (org.teiid.query.sql.symbol.ExpressionSymbol)3 Map (java.util.Map)2 AggregateFunction (org.teiid.query.function.aggregate.AggregateFunction)2