Search in sources :

Example 1 with ElementSymbol

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

the class EvaluatorIterator method init.

@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException {
    super.init(source, options, env);
    try {
        GroupSymbol gs = null;
        String query = options.get(QUERYSTRING);
        TransformationMetadata tm = createTransformationMetadata(options.get(DDL));
        this.criteria = QueryParser.getQueryParser().parseCriteria(query);
        this.elementsInExpression = ElementCollectorVisitor.getElements(this.criteria, false);
        for (ElementSymbol es : this.elementsInExpression) {
            gs = es.getGroupSymbol();
            ResolverUtil.resolveGroup(gs, tm);
        }
        ResolverVisitor.resolveLanguageObject(this.criteria, tm);
        this.evaluatorUtil = new EvaluatorUtil(gs);
    } catch (QueryParserException e) {
        throw new IOException(e);
    } catch (ClassNotFoundException e) {
        throw new IOException(e);
    } catch (QueryResolverException e) {
        throw new IOException(e);
    } catch (TeiidComponentException e) {
        throw new IOException(e);
    }
    CommandContext cc = new CommandContext();
    this.evaluator = new Evaluator(this.evaluatorUtil.getElementMap(), null, cc);
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) QueryParserException(org.teiid.api.exception.query.QueryParserException) CommandContext(org.teiid.query.util.CommandContext) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) TeiidComponentException(org.teiid.core.TeiidComponentException) IOException(java.io.IOException) Evaluator(org.teiid.query.eval.Evaluator) QueryResolverException(org.teiid.api.exception.query.QueryResolverException)

Example 2 with ElementSymbol

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

the class TestElementImpl method helpIntExample.

public static ElementSymbol helpIntExample(String groupName, String elementName) {
    ElementSymbol symbol = new ElementSymbol(elementName);
    symbol.setType(Integer.class);
    symbol.setGroupSymbol(TestGroupImpl.helpExample(groupName));
    return symbol;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol)

Example 3 with ElementSymbol

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

the class TestElementImpl method helpExample.

public static ElementSymbol helpExample(String groupName, String elementName) {
    ElementSymbol symbol = new ElementSymbol(elementName);
    symbol.setType(String.class);
    symbol.setGroupSymbol(TestGroupImpl.helpExample(groupName));
    return symbol;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol)

Example 4 with ElementSymbol

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

the class TestSubqueryCompareCriteriaImpl method helpExample.

public static SubqueryCompareCriteria helpExample() {
    // $NON-NLS-1$ //$NON-NLS-2$
    ElementSymbol element = TestElementImpl.helpExample("g1", "e1");
    Query query = TestQueryImpl.helpExample(true);
    SubqueryCompareCriteria scc = new SubqueryCompareCriteria(element, query, AbstractCompareCriteria.GT, SubqueryCompareCriteria.ANY);
    return scc;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) SubqueryCompareCriteria(org.teiid.query.sql.lang.SubqueryCompareCriteria) Query(org.teiid.query.sql.lang.Query)

Example 5 with ElementSymbol

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

the class TestSubqueryInCriteriaImpl method helpExample.

public static SubquerySetCriteria helpExample() {
    // $NON-NLS-1$ //$NON-NLS-2$
    ElementSymbol element = TestElementImpl.helpExample("g1", "e1");
    Query query = TestQueryImpl.helpExample(true);
    SubquerySetCriteria ssc = new SubquerySetCriteria(element, query);
    ssc.setNegated(true);
    return ssc;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Query(org.teiid.query.sql.lang.Query) SubquerySetCriteria(org.teiid.query.sql.lang.SubquerySetCriteria)

Aggregations

ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)417 ArrayList (java.util.ArrayList)165 Test (org.junit.Test)157 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)148 Expression (org.teiid.query.sql.symbol.Expression)104 List (java.util.List)103 Constant (org.teiid.query.sql.symbol.Constant)94 MultipleElementSymbol (org.teiid.query.sql.symbol.MultipleElementSymbol)41 SymbolMap (org.teiid.query.sql.util.SymbolMap)40 PlanNode (org.teiid.query.optimizer.relational.plantree.PlanNode)36 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)29 Map (java.util.Map)28 AggregateSymbol (org.teiid.query.sql.symbol.AggregateSymbol)28 Query (org.teiid.query.sql.lang.Query)26 HashMap (java.util.HashMap)25 Select (org.teiid.query.sql.lang.Select)24 BufferManager (org.teiid.common.buffer.BufferManager)22 Criteria (org.teiid.query.sql.lang.Criteria)22 LinkedList (java.util.LinkedList)20 TupleBuffer (org.teiid.common.buffer.TupleBuffer)19