Author: shawkins
Date: 2010-10-15 14:32:06 -0400 (Fri, 15 Oct 2010)
New Revision: 2655
Modified:
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java
branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TestSQLConversionVisitor.java
branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/AliasGenerator.java
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInlineViewImpl.java
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestOrderByImpl.java
branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
branches/7.1.x/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java
Log:
TEIID-1305 fix to ensure that order by contains actual column references if a source
doesn't support select expressions. While modeshape supports select aliases, we
currently just look at supportsSelectExpressions to determine if aliasing should be used.
there is also still a lurking issue with set query order by if supportsSelectExpressions
is false
Modified:
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java
===================================================================
---
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java 2010-10-14
18:57:42 UTC (rev 2654)
+++
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/modeshape/ModeShapeExecutionFactory.java 2010-10-15
18:32:06 UTC (rev 2655)
@@ -243,5 +243,10 @@
public boolean supportsIntersect() {
return true;
}
+
+ @Override
+ public boolean supportsSetQueryOrderBy() {
+ return false;
+ }
}
Modified:
branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TestSQLConversionVisitor.java
===================================================================
---
branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TestSQLConversionVisitor.java 2010-10-14
18:57:42 UTC (rev 2654)
+++
branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/TestSQLConversionVisitor.java 2010-10-15
18:32:06 UTC (rev 2655)
@@ -377,9 +377,9 @@
}
@Test public void testVisitISelectWithComment() throws Exception {
- String expected = "SELECT /*teiid sessionid:ConnectionID,
requestid:RequestID.PartID*/ g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS myAlias, g3, g4
WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4 HAVING 100 >=
200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4 DESC"; //$NON-NLS-1$
+ String expected = "SELECT /*teiid sessionid:ConnectionID,
requestid:RequestID.PartID*/ g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS myAlias, g3, g4
WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4 HAVING 100 >=
200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC, g1.e3, g1.e4 DESC"; //$NON-NLS-1$
assertEquals(expected, getStringWithContext(TestQueryImpl.example(false)));
- expected = "SELECT /*teiid sessionid:ConnectionID,
requestid:RequestID.PartID*/ DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS myAlias,
g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4 HAVING 100
>= 200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4 DESC"; //$NON-NLS-1$
+ expected = "SELECT /*teiid sessionid:ConnectionID,
requestid:RequestID.PartID*/ DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS myAlias,
g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4 HAVING 100
>= 200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC, g1.e3, g1.e4 DESC";
//$NON-NLS-1$
assertEquals(expected, getStringWithContext(TestQueryImpl.example(true)));
}
Modified:
branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
===================================================================
---
branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java 2010-10-14
18:57:42 UTC (rev 2654)
+++
branches/7.1.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java 2010-10-15
18:32:06 UTC (rev 2655)
@@ -731,7 +731,7 @@
@Test public void testLimitWithNestedInlineView() throws Exception {
String input = "select max(intkey), stringkey from (select intkey, stringkey
from bqt1.smalla order by intkey limit 100) x group by stringkey"; //$NON-NLS-1$
- String output = "SELECT MAX(x.intkey), x.stringkey FROM (SELECT * FROM
(SELECT SmallA.IntKey, SmallA.StringKey FROM SmallA ORDER BY intkey) WHERE ROWNUM <=
100) x GROUP BY x.stringkey"; //$NON-NLS-1$
+ String output = "SELECT MAX(x.intkey), x.stringkey FROM (SELECT * FROM
(SELECT SmallA.IntKey, SmallA.StringKey FROM SmallA ORDER BY SmallA.IntKey) WHERE ROWNUM
<= 100) x GROUP BY x.stringkey"; //$NON-NLS-1$
helpTestVisitor(FakeMetadataFactory.exampleBQTCached(),
input,
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2010-10-14
18:57:42 UTC (rev 2654)
+++
branches/7.1.x/engine/src/main/java/org/teiid/dqp/internal/datamgr/LanguageBridgeFactory.java 2010-10-15
18:32:06 UTC (rev 2655)
@@ -167,7 +167,7 @@
}
result.setLeftQuery(translate(union.getLeftQuery()));
result.setRightQuery(translate(union.getRightQuery()));
- result.setOrderBy(translate(union.getOrderBy()));
+ result.setOrderBy(translate(union.getOrderBy(), true));
result.setLimit(translate(union.getLimit()));
return result;
}
@@ -207,7 +207,7 @@
Select q = new Select(translatedSymbols, query
.getSelect().isDistinct(), items,
translate(query.getCriteria()), translate(query.getGroupBy()),
- translate(query.getHaving()), translate(query.getOrderBy()));
+ translate(query.getHaving()), translate(query.getOrderBy(), false));
q.setLimit(translate(query.getLimit()));
return q;
}
@@ -417,7 +417,7 @@
return new org.teiid.language.GroupBy(translatedItems);
}
- public org.teiid.language.OrderBy translate(OrderBy orderBy) {
+ public org.teiid.language.OrderBy translate(OrderBy orderBy, boolean set) {
if(orderBy == null){
return null;
}
@@ -428,10 +428,10 @@
Ordering direction = items.get(i).isAscending() ? Ordering.ASC:
Ordering.DESC;
SortSpecification orderByItem = null;
- if(symbol instanceof AliasSymbol || !items.get(i).isUnrelated()){
+ if(items.get(i).isUnrelated() || (!set && symbol instanceof
ElementSymbol)){
+ orderByItem = new SortSpecification(direction, translate(symbol));
+ } else {
orderByItem = new SortSpecification(direction, new ColumnReference(null,
symbol.getOutputName(), null, symbol.getType()));
- } else {
- orderByItem = new SortSpecification(direction, translate(symbol));
}
orderByItem.setNullOrdering(items.get(i).getNullOrdering());
translatedItems.add(orderByItem);
Modified:
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/AliasGenerator.java
===================================================================
---
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/AliasGenerator.java 2010-10-14
18:57:42 UTC (rev 2654)
+++
branches/7.1.x/engine/src/main/java/org/teiid/query/optimizer/relational/AliasGenerator.java 2010-10-15
18:32:06 UTC (rev 2655)
@@ -263,7 +263,7 @@
*/
public void visit(Query obj) {
if (obj.getOrderBy() != null || obj.getLimit() != null) {
- visitor.namingContext.aliasColumns = true && !stripColumnAliases;
+ visitor.namingContext.aliasColumns = !stripColumnAliases;
}
visitNode(obj.getFrom());
visitNode(obj.getCriteria());
@@ -360,8 +360,10 @@
if (needsAlias) {
element = new AliasSymbol(element.getShortName(),
(SingleElementSymbol)expr);
- obj.getOrderByItems().get(i).setSymbol(element);
+ } else if (expr instanceof ElementSymbol) {
+ element = (ElementSymbol)expr;
}
+ item.setSymbol(element);
element.setOutputName(name);
}
Modified:
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInlineViewImpl.java
===================================================================
---
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInlineViewImpl.java 2010-10-14
18:57:42 UTC (rev 2654)
+++
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestInlineViewImpl.java 2010-10-15
18:32:06 UTC (rev 2655)
@@ -48,7 +48,7 @@
}
public void testGetQuery() throws Exception {
- assertEquals("SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS
myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4
HAVING 100 >= 200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4 DESC",
example().getQuery().toString()); //$NON-NLS-1$
+ assertEquals("SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS
myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4
HAVING 100 >= 200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC, g1.e3, g1.e4 DESC",
example().getQuery().toString()); //$NON-NLS-1$
}
}
Modified:
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestOrderByImpl.java
===================================================================
---
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestOrderByImpl.java 2010-10-14
18:57:42 UTC (rev 2654)
+++
branches/7.1.x/engine/src/test/java/org/teiid/dqp/internal/datamgr/TestOrderByImpl.java 2010-10-15
18:32:06 UTC (rev 2655)
@@ -22,33 +22,26 @@
package org.teiid.dqp.internal.datamgr;
+import static org.junit.Assert.*;
+
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
-import junit.framework.TestCase;
-
+import org.junit.Test;
import org.teiid.language.OrderBy;
import org.teiid.language.SortSpecification;
+import org.teiid.query.sql.symbol.ElementSymbol;
-public class TestOrderByImpl extends TestCase {
+public class TestOrderByImpl {
- /**
- * Constructor for TestOrderByImpl.
- * @param name
- */
- public TestOrderByImpl(String name) {
- super(name);
- }
-
public static org.teiid.query.sql.lang.OrderBy helpExample() {
- ArrayList elements = new ArrayList();
+ ArrayList<ElementSymbol> elements = new ArrayList<ElementSymbol>();
elements.add(TestElementImpl.helpExample("vm1.g1", "e1"));
//$NON-NLS-1$ //$NON-NLS-2$
elements.add(TestElementImpl.helpExample("vm1.g1", "e2"));
//$NON-NLS-1$ //$NON-NLS-2$
elements.add(TestElementImpl.helpExample("vm1.g1", "e3"));
//$NON-NLS-1$ //$NON-NLS-2$
elements.add(TestElementImpl.helpExample("vm1.g1", "e4"));
//$NON-NLS-1$ //$NON-NLS-2$
- ArrayList types = new ArrayList();
+ ArrayList<Boolean> types = new ArrayList<Boolean>();
types.add(Boolean.TRUE);
types.add(Boolean.FALSE);
types.add(Boolean.TRUE);
@@ -57,17 +50,13 @@
}
public static OrderBy example() throws Exception {
- return TstLanguageBridgeFactory.factory.translate(helpExample());
+ return TstLanguageBridgeFactory.factory.translate(helpExample(), false);
}
- public void testGetItems() throws Exception {
- List items = example().getSortSpecifications();
+ @Test public void testGetItems() throws Exception {
+ List<SortSpecification> items = example().getSortSpecifications();
assertNotNull(items);
assertEquals(4, items.size());
- for (Iterator i = items.iterator(); i.hasNext();) {
- assertTrue(i.next() instanceof SortSpecification);
- }
-
}
}
Modified:
branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java
===================================================================
---
branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java 2010-10-14
18:57:42 UTC (rev 2654)
+++
branches/7.1.x/engine/src/test/java/org/teiid/query/optimizer/relational/TestAliasGenerator.java 2010-10-15
18:32:06 UTC (rev 2655)
@@ -27,8 +27,8 @@
import org.junit.Test;
import org.teiid.core.TeiidComponentException;
import org.teiid.core.TeiidProcessingException;
+import org.teiid.dqp.internal.datamgr.LanguageBridgeFactory;
import org.teiid.query.metadata.QueryMetadataInterface;
-import org.teiid.query.optimizer.relational.AliasGenerator;
import org.teiid.query.parser.QueryParser;
import org.teiid.query.resolver.TestResolver;
import org.teiid.query.rewriter.QueryRewriter;
@@ -39,7 +39,7 @@
import org.teiid.query.sql.symbol.SingleElementSymbol;
import org.teiid.query.unittest.FakeMetadataFactory;
-
+@SuppressWarnings("nls")
public class TestAliasGenerator {
private Command helpTest(String sql,
@@ -159,7 +159,10 @@
@Test public void testStripAliases1() throws Exception {
String sql = "select intkey as a, stringkey as b from BQT1.SmallA ORDER BY a,
b"; //$NON-NLS-1$
String expected = "SELECT BQT1.SmallA.intkey, BQT1.SmallA.stringkey FROM
BQT1.SmallA ORDER BY BQT1.SmallA.intkey, BQT1.SmallA.stringkey"; //$NON-NLS-1$
- helpTest(sql, expected, false, true, FakeMetadataFactory.exampleBQTCached());
+ Command command = helpTest(sql, expected, false, true,
FakeMetadataFactory.exampleBQTCached());
+ LanguageBridgeFactory lbf = new
LanguageBridgeFactory(FakeMetadataFactory.exampleBQTCached());
+ org.teiid.language.Command c = lbf.translate(command);
+ assertEquals("SELECT SmallA.IntKey, SmallA.StringKey FROM SmallA ORDER BY
SmallA.IntKey, SmallA.StringKey", c.toString());
}
}
Modified:
branches/7.1.x/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java
===================================================================
---
branches/7.1.x/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java 2010-10-14
18:57:42 UTC (rev 2654)
+++
branches/7.1.x/test-integration/common/src/test/java/org/teiid/connector/visitor/util/TestSQLStringVisitor.java 2010-10-15
18:32:06 UTC (rev 2655)
@@ -150,7 +150,7 @@
* Test for void visit(IExistsCriteria)
*/
@Test public void testVisitIExistsCriteria() throws Exception {
- String expected = "EXISTS (SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM
g1, g2 AS myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2,
g1.e3, g1.e4 HAVING 100 >= 200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4
DESC)"; //$NON-NLS-1$
+ String expected = "EXISTS (SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM
g1, g2 AS myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2,
g1.e3, g1.e4 HAVING 100 >= 200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC, g1.e3,
g1.e4 DESC)"; //$NON-NLS-1$
assertEquals(expected, getString(TestExistsCriteriaImpl.example()));
}
@@ -278,7 +278,7 @@
* Test for void visit(IOrderBy)
*/
@Test public void testVisitIOrderBy() throws Exception {
- String expected = "ORDER BY e1, e2 DESC, e3, e4 DESC"; //$NON-NLS-1$
+ String expected = "ORDER BY g1.e1, g1.e2 DESC, g1.e3, g1.e4 DESC";
//$NON-NLS-1$
assertEquals(expected, getString(TestOrderByImpl.example()));
}
@@ -294,7 +294,7 @@
* Test for void visit(IQuery)
*/
@Test public void testVisitIQuery() throws Exception {
- String expected = "SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS
myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4
HAVING 100 >= 200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4 DESC";
//$NON-NLS-1$
+ String expected = "SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS
myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4
HAVING 100 >= 200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC, g1.e3, g1.e4 DESC";
//$NON-NLS-1$
assertEquals(expected, getString(TestQueryImpl.example(true)));
}
@@ -302,7 +302,7 @@
* Test for void visit(IScalarSubquery)
*/
@Test public void testVisitIScalarSubquery() throws Exception {
- String expected = "(SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2
AS myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3,
g1.e4 HAVING 100 >= 200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4 DESC)";
//$NON-NLS-1$
+ String expected = "(SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2
AS myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3,
g1.e4 HAVING 100 >= 200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC, g1.e3, g1.e4
DESC)"; //$NON-NLS-1$
assertEquals(expected, getString(TestScalarSubqueryImpl.example()));
}
@@ -318,9 +318,9 @@
* Test for void visit(ISelect)
*/
@Test public void testVisitISelect() throws Exception {
- String expected = "SELECT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS myAlias,
g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4 HAVING 100
>= 200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4 DESC"; //$NON-NLS-1$
+ String expected = "SELECT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS myAlias,
g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4 HAVING 100
>= 200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC, g1.e3, g1.e4 DESC";
//$NON-NLS-1$
assertEquals(expected, getString(TestQueryImpl.example(false)));
- expected = "SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS
myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4
HAVING 100 >= 200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4 DESC";
//$NON-NLS-1$
+ expected = "SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS
myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4
HAVING 100 >= 200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC, g1.e3, g1.e4 DESC";
//$NON-NLS-1$
assertEquals(expected, getString(TestQueryImpl.example(true)));
}
@@ -339,7 +339,7 @@
* Test for void visit(ISubqueryCompareCriteria)
*/
@Test public void testVisitISubqueryCompareCriteria() throws Exception {
- String expected = "g1.e1 > SOME (SELECT DISTINCT g1.e1, g1.e2, g1.e3,
g1.e4 FROM g1, g2 AS myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1,
g1.e2, g1.e3, g1.e4 HAVING 100 >= 200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4
DESC)"; //$NON-NLS-1$
+ String expected = "g1.e1 > SOME (SELECT DISTINCT g1.e1, g1.e2, g1.e3,
g1.e4 FROM g1, g2 AS myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1,
g1.e2, g1.e3, g1.e4 HAVING 100 >= 200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC,
g1.e3, g1.e4 DESC)"; //$NON-NLS-1$
assertEquals(expected, getString(TestSubqueryCompareCriteriaImpl.example()));
}
@@ -347,12 +347,12 @@
* Test for void visit(ISubqueryInCriteria)
*/
@Test public void testVisitISubqueryInCriteria() throws Exception {
- String expected = "g1.e1 NOT IN (SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4
FROM g1, g2 AS myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2,
g1.e3, g1.e4 HAVING 100 >= 200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4
DESC)"; //$NON-NLS-1$
+ String expected = "g1.e1 NOT IN (SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4
FROM g1, g2 AS myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2,
g1.e3, g1.e4 HAVING 100 >= 200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC, g1.e3,
g1.e4 DESC)"; //$NON-NLS-1$
assertEquals(expected, getString(TestSubqueryInCriteriaImpl.example()));
}
@Test public void testVisitIUnion1() throws Exception {
- String expected = "SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS
myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4
HAVING 100 >= 200 AND 500 < 600 ORDER BY e1, e2 DESC, e3, e4 DESC UNION SELECT
DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS myAlias, g3, g4 WHERE 100 >= 200 AND
500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4 HAVING 100 >= 200 AND 500 < 600
ORDER BY e1, e2 DESC, e3, e4 DESC ORDER BY e1, e2 DESC, e3, e4 DESC";//$NON-NLS-1$
+ String expected = "SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS
myAlias, g3, g4 WHERE 100 >= 200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4
HAVING 100 >= 200 AND 500 < 600 ORDER BY g1.e1, g1.e2 DESC, g1.e3, g1.e4 DESC UNION
SELECT DISTINCT g1.e1, g1.e2, g1.e3, g1.e4 FROM g1, g2 AS myAlias, g3, g4 WHERE 100 >=
200 AND 500 < 600 GROUP BY g1.e1, g1.e2, g1.e3, g1.e4 HAVING 100 >= 200 AND 500 <
600 ORDER BY g1.e1, g1.e2 DESC, g1.e3, g1.e4 DESC ORDER BY e1, e2 DESC, e3, e4
DESC";//$NON-NLS-1$
assertEquals(expected, getString(TestSetQueryImpl.example()));
}