Search in sources :

Example 6 with IdentifierExpression

use of org.apache.atlas.groovy.IdentifierExpression in project incubator-atlas by apache.

the class AbstractGremlinQueryOptimizerTest method testHasNotMovedToResult.

@Test
public void testHasNotMovedToResult() throws AtlasException {
    GroovyExpression toOptimize = getVerticesExpression();
    GroovyExpression or1Cond1 = makeHasExpression("p1", "e1");
    GroovyExpression or1Cond2 = makeHasExpression("p2", "e2");
    toOptimize = getFactory().generateLogicalExpression(toOptimize, "or", Arrays.asList(or1Cond1, or1Cond2));
    toOptimize = makeHasExpression(toOptimize, "p3", "e3");
    toOptimize = getFactory().generateAliasExpression(toOptimize, "_src");
    toOptimize = getFactory().generateSelectExpression(toOptimize, Collections.singletonList(new LiteralExpression("src1")), Collections.<GroovyExpression>singletonList(new IdentifierExpression("it")));
    GroovyExpression optimized = GremlinQueryOptimizer.getInstance().optimize(toOptimize);
    assertEquals(optimized.toString(), getExpectedGremlinForTestHasNotMovedToResult());
}
Also used : LiteralExpression(org.apache.atlas.groovy.LiteralExpression) GroovyExpression(org.apache.atlas.groovy.GroovyExpression) IdentifierExpression(org.apache.atlas.groovy.IdentifierExpression) Test(org.testng.annotations.Test)

Aggregations

GroovyExpression (org.apache.atlas.groovy.GroovyExpression)6 IdentifierExpression (org.apache.atlas.groovy.IdentifierExpression)6 FunctionCallExpression (org.apache.atlas.groovy.FunctionCallExpression)4 LiteralExpression (org.apache.atlas.groovy.LiteralExpression)3 ArrayList (java.util.ArrayList)1 AbstractFunctionExpression (org.apache.atlas.groovy.AbstractFunctionExpression)1 ClosureExpression (org.apache.atlas.groovy.ClosureExpression)1 VariableDeclaration (org.apache.atlas.groovy.ClosureExpression.VariableDeclaration)1 ComparisonOperatorExpression (org.apache.atlas.groovy.ComparisonOperatorExpression)1 TypeCoersionExpression (org.apache.atlas.groovy.TypeCoersionExpression)1 Test (org.testng.annotations.Test)1