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());
}
Aggregations