Search in sources :

Example 56 with GroupSymbol

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

the class TestFrameUtil method testFindSourceNode2.

@Test
public void testFindSourceNode2() {
    PlanNode root = getExamplePlan();
    Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
    groups.add(getGroup(3));
    PlanNode originatingNode = FrameUtil.findOriginatingNode(root, groups);
    assertEquals(NodeConstants.Types.SOURCE, originatingNode.getType());
}
Also used : PlanNode(org.teiid.query.optimizer.relational.plantree.PlanNode) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 57 with GroupSymbol

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

the class TestFrameUtil method testNonExistentSource.

@Test
public void testNonExistentSource() {
    PlanNode root = getExamplePlan();
    Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
    groups.add(getGroup(4));
    PlanNode originatingNode = FrameUtil.findOriginatingNode(root, groups);
    assertNull(originatingNode);
}
Also used : PlanNode(org.teiid.query.optimizer.relational.plantree.PlanNode) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 58 with GroupSymbol

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

the class TestFrameUtil method testFindSourceNode.

@Test
public void testFindSourceNode() {
    PlanNode root = getExamplePlan();
    Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
    groups.add(getGroup(1));
    PlanNode originatingNode = FrameUtil.findOriginatingNode(root, groups);
    assertEquals(NodeConstants.Types.NULL, originatingNode.getType());
}
Also used : PlanNode(org.teiid.query.optimizer.relational.plantree.PlanNode) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 59 with GroupSymbol

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

the class TestRuleChooseDependent method getVirtualGroup.

public GroupSymbol getVirtualGroup() throws Exception {
    // $NON-NLS-1$
    GroupSymbol gs = new GroupSymbol("vm1.g1");
    ResolverUtil.resolveGroup(gs, metadata);
    return gs;
}
Also used : GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol)

Example 60 with GroupSymbol

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

the class TestRuleChooseDependent method testCardinalityWithKeyMatchCrit.

/**
 * Tests SetCriteria in the atomic criteria
 */
@Test
public void testCardinalityWithKeyMatchCrit() throws Exception {
    // override default metadata
    this.metadata = RealMetadataFactory.example4();
    GroupSymbol group1 = getPhysicalGroup(1, 2);
    ElementSymbol g1e2 = getElementSymbol(1, 2, 2);
    GroupSymbol group2 = getPhysicalGroup(3, 3);
    ElementSymbol g2e1 = getElementSymbol(3, 3, 1);
    ElementSymbol g2e2 = getElementSymbol(3, 3, 2);
    // Join criteria
    ArrayList crits = new ArrayList(1);
    CompareCriteria crit2 = new CompareCriteria(g1e2, CompareCriteria.EQ, g2e2);
    crits.add(crit2);
    Criteria atomicCrit1 = null;
    // $NON-NLS-1$
    Criteria atomicCrit2 = new MatchCriteria(g2e1, new Constant(new String("ab%")));
    int expected = RIGHT_SIDE;
    helpTestChooseSiblingAndMarkDependent(group1, atomicCrit1, group2, atomicCrit2, crits, expected);
    expected = LEFT_SIDE;
    helpTestChooseSiblingAndMarkDependent(group2, atomicCrit2, group1, atomicCrit1, crits, expected);
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Constant(org.teiid.query.sql.symbol.Constant) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)299 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)146 Test (org.junit.Test)108 ArrayList (java.util.ArrayList)92 MultipleElementSymbol (org.teiid.query.sql.symbol.MultipleElementSymbol)59 Expression (org.teiid.query.sql.symbol.Expression)52 PlanNode (org.teiid.query.optimizer.relational.plantree.PlanNode)50 Constant (org.teiid.query.sql.symbol.Constant)48 List (java.util.List)43 HashSet (java.util.HashSet)32 Query (org.teiid.query.sql.lang.Query)31 From (org.teiid.query.sql.lang.From)29 SymbolMap (org.teiid.query.sql.util.SymbolMap)29 Select (org.teiid.query.sql.lang.Select)26 Criteria (org.teiid.query.sql.lang.Criteria)22 TempMetadataID (org.teiid.query.metadata.TempMetadataID)21 LinkedList (java.util.LinkedList)20 Command (org.teiid.query.sql.lang.Command)20 Set (java.util.Set)17 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)17