Skip to content

Commit

Permalink
TEIID-4262: Wrong result (empty or NULL) with an view and a single di…
Browse files Browse the repository at this point in the history
…sjunction for join criteria (correcting the criteria handling after view removal)
  • Loading branch information
shawkins authored and johnathonlee committed Jun 9, 2016
1 parent 2350847 commit 8437a79
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion build/kits/jboss-as7/docs/teiid/teiid-releasenotes.html
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ <h4>from ${project.version}</h4>
</li>
<li>[<a href='https://issues.jboss.org/browse/TEIID-4237'>TEIID-4237</a>] - INNER JOIN returns incorrect results
</li>
</ul>
<li>[<a href='https://issues.jboss.org/browse/TEIID-4262'>TEIID-4262</a>] - Wrong result (empty or NULL) with an view and a single disjunction for join criteria
</li>
</ul>

<h4>from 8.7.6.6_2</h4>
<ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ static void convertNode(PlanNode node, GroupSymbol oldGroup, Set<GroupSymbol> ne
if(joinCrits != null && !joinCrits.isEmpty()) {
Criteria crit = new CompoundCriteria(joinCrits);
crit = convertCriteria(crit, symbolMap, metadata, rewrite);
if (crit instanceof CompoundCriteria) {
if (crit instanceof CompoundCriteria && ((CompoundCriteria)crit).getOperator() == CompoundCriteria.AND) {
node.setProperty(NodeConstants.Info.JOIN_CRITERIA, ((CompoundCriteria)crit).getCriteria());
} else {
joinCrits = new ArrayList<Criteria>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,4 +498,15 @@ public class TestRuleMergeVirtual {
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}

@Test public void testSingleOrPredicate() throws Exception {
String sql = "SELECT alias3.a1 FROM (select e2 as a from pm1.g1) as alias2 INNER JOIN (SELECT t2.a AS a1, t1.a "
+ "FROM (SELECT 1 AS a) AS t1 INNER JOIN (select e2 as a from pm1.g1) as t2 ON t1.a = t2.a) "
+ "AS alias3 ON ((alias3.a = alias2.a) OR (alias3.a > alias2.a))";
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();

TestOptimizer.helpPlan(sql, //$NON-NLS-1$
RealMetadataFactory.example1Cached(),
new String[] {
"SELECT 1 FROM pm1.g1 AS g_0 WHERE (g_0.e2 = 1) OR (g_0.e2 < 1)", "SELECT g_0.e2 FROM pm1.g1 AS g_0 WHERE g_0.e2 = 1"}, new DefaultCapabilitiesFinder(caps), ComparisonMode.EXACT_COMMAND_STRING); //$NON-NLS-1$
}
}

0 comments on commit 8437a79

Please sign in to comment.