Search in sources :

Example 61 with FilterExpression

use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.

the class SubqueryFilterSplitterTest method testCompoundSplitByOr.

@Test
public void testCompoundSplitByOr() throws Exception {
    FilterExpression expression = parse("(countryUnSeats>3;overallRating=='Foo'),(overallRating=='Bar';overallRating=='Blah')");
    SubqueryFilterSplitter.SplitFilter splitExpressions = SubqueryFilterSplitter.splitFilter(metaDataStore, expression);
    assertEquals(expression, splitExpressions.getOuter());
    assertNull(splitExpressions.getInner());
}
Also used : FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) Test(org.junit.jupiter.api.Test)

Example 62 with FilterExpression

use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.

the class SubqueryFilterSplitterTest method testSplitByAnd.

@Test
public void testSplitByAnd() throws Exception {
    FilterExpression expression = parse("countryUnSeats>3;overallRating=='Foo'");
    FilterExpression expectedOuter = parse("countryUnSeats>3");
    FilterExpression expectedInner = parse("overallRating=='Foo'");
    SubqueryFilterSplitter.SplitFilter splitExpressions = SubqueryFilterSplitter.splitFilter(metaDataStore, expression);
    assertEquals(expectedOuter, splitExpressions.getOuter());
    assertEquals(expectedInner, splitExpressions.getInner());
}
Also used : FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) Test(org.junit.jupiter.api.Test)

Example 63 with FilterExpression

use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.

the class SubqueryFilterSplitterTest method testSplitByOr.

@Test
public void testSplitByOr() throws Exception {
    FilterExpression expression = parse("countryUnSeats>3,overallRating=='Foo'");
    SubqueryFilterSplitter.SplitFilter splitExpressions = SubqueryFilterSplitter.splitFilter(metaDataStore, expression);
    assertEquals(expression, splitExpressions.getOuter());
    assertNull(splitExpressions.getInner());
}
Also used : FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) Test(org.junit.jupiter.api.Test)

Example 64 with FilterExpression

use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.

the class SubqueryFilterSplitterTest method testSinglePredicateWithJoin.

@Test
public void testSinglePredicateWithJoin() throws Exception {
    FilterExpression expression = parse("countryUnSeats>3");
    SubqueryFilterSplitter.SplitFilter splitExpressions = SubqueryFilterSplitter.splitFilter(metaDataStore, expression);
    assertNull(splitExpressions.getInner());
    assertEquals(expression, splitExpressions.getOuter());
}
Also used : FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) Test(org.junit.jupiter.api.Test)

Example 65 with FilterExpression

use of com.yahoo.elide.core.filter.expression.FilterExpression in project elide by yahoo.

the class FilterTranslatorTest method testComplexAttributeAlias.

@Test
public void testComplexAttributeAlias() throws Exception {
    FilterExpression expression = dialect.parseFilterExpression("price.total>=10", ClassType.of(Book.class), true);
    FilterTranslator filterOp = new FilterTranslator(dictionary);
    String actual = filterOp.apply(expression, true);
    actual = actual.replaceAll(":\\w+", ":XXX");
    assertEquals("example_Book.price.total >= :XXX", actual);
}
Also used : Book(example.Book) NotFilterExpression(com.yahoo.elide.core.filter.expression.NotFilterExpression) OrFilterExpression(com.yahoo.elide.core.filter.expression.OrFilterExpression) AndFilterExpression(com.yahoo.elide.core.filter.expression.AndFilterExpression) FilterExpression(com.yahoo.elide.core.filter.expression.FilterExpression) Test(org.junit.jupiter.api.Test)

Aggregations

FilterExpression (com.yahoo.elide.core.filter.expression.FilterExpression)214 Test (org.junit.jupiter.api.Test)161 OrFilterExpression (com.yahoo.elide.core.filter.expression.OrFilterExpression)91 AndFilterExpression (com.yahoo.elide.core.filter.expression.AndFilterExpression)72 MultivaluedHashMap (javax.ws.rs.core.MultivaluedHashMap)49 FilterPredicate (com.yahoo.elide.core.filter.predicates.FilterPredicate)46 Path (com.yahoo.elide.core.Path)44 Query (com.yahoo.elide.datastores.aggregation.query.Query)42 Argument (com.yahoo.elide.core.request.Argument)39 SQLUnitTest (com.yahoo.elide.datastores.aggregation.framework.SQLUnitTest)39 DataStoreTransaction (com.yahoo.elide.core.datastore.DataStoreTransaction)34 SQLTable (com.yahoo.elide.datastores.aggregation.queryengines.sql.metadata.SQLTable)34 HashMap (java.util.HashMap)29 Book (example.Book)28 NotFilterExpression (com.yahoo.elide.core.filter.expression.NotFilterExpression)24 EntityProjection (com.yahoo.elide.core.request.EntityProjection)22 Date (java.util.Date)21 EntityDictionary (com.yahoo.elide.core.dictionary.EntityDictionary)20 Day (com.yahoo.elide.datastores.aggregation.timegrains.Day)19 HashSet (java.util.HashSet)18