Search in sources :

Example 16 with PredicateBase

use of edu.uci.ics.texera.dataflow.common.PredicateBase in project textdb by TextDB.

the class ProjectAllFieldsPredicateTest method testGenerateOperatorBean.

/**
 * Test the generateOperatorBean method.
 * Build a SelectAllFieldsPredicate, invoke the generateOperatorBean and check
 * whether a PassThroughBean with the right attributes is returned.
 */
@Test
public void testGenerateOperatorBean() {
    ProjectAllFieldsPredicate projectAllFieldsPredicate = new ProjectAllFieldsPredicate();
    PredicateBase projectionBean;
    final String operatorId1 = "xxx";
    projectionBean = projectAllFieldsPredicate.generateOperatorBean(operatorId1);
    Assert.assertEquals(projectionBean, new PassThroughPredicate(operatorId1));
    final String operatorId2 = "y0a9";
    projectionBean = projectAllFieldsPredicate.generateOperatorBean(operatorId2);
    Assert.assertEquals(projectionBean, new PassThroughPredicate(operatorId2));
}
Also used : PredicateBase(edu.uci.ics.texera.dataflow.common.PredicateBase) PassThroughPredicate(edu.uci.ics.texera.textql.planbuilder.beans.PassThroughPredicate) Test(org.junit.Test)

Example 17 with PredicateBase

use of edu.uci.ics.texera.dataflow.common.PredicateBase in project textdb by TextDB.

the class ProjectSomeFieldsPredicateTest method testGenerateOperatorBean00.

/**
 * Test the generateOperatorBean method.
 * Build a SelectSomeFieldsPredicate, invoke the generateOperatorBean and check
 * whether a ProjectionBean with the right attributes is returned.
 * An empty list is used as the list of projected fields.
 */
@Test
public void testGenerateOperatorBean00() {
    String operatorId = "xxx";
    List<String> projectedFields = Collections.emptyList();
    ProjectSomeFieldsPredicate projectSomeFieldsPredicate = new ProjectSomeFieldsPredicate(projectedFields);
    PredicateBase computedProjectionBean = projectSomeFieldsPredicate.generateOperatorBean(operatorId);
    PredicateBase expectedProjectionBean = new ProjectionPredicate(Arrays.asList());
    expectedProjectionBean.setID(operatorId);
    Assert.assertEquals(expectedProjectionBean, computedProjectionBean);
}
Also used : PredicateBase(edu.uci.ics.texera.dataflow.common.PredicateBase) ProjectionPredicate(edu.uci.ics.texera.dataflow.projection.ProjectionPredicate) Test(org.junit.Test)

Aggregations

PredicateBase (edu.uci.ics.texera.dataflow.common.PredicateBase)17 Test (org.junit.Test)15 SelectStatement (edu.uci.ics.texera.textql.statements.SelectStatement)8 KeywordPredicate (edu.uci.ics.texera.dataflow.keywordmatcher.KeywordPredicate)6 ProjectionPredicate (edu.uci.ics.texera.dataflow.projection.ProjectionPredicate)5 ProjectPredicate (edu.uci.ics.texera.textql.statements.predicates.ProjectPredicate)5 ExtractPredicate (edu.uci.ics.texera.textql.statements.predicates.ExtractPredicate)4 KeywordExtractPredicate (edu.uci.ics.texera.textql.statements.predicates.KeywordExtractPredicate)4 PassThroughPredicate (edu.uci.ics.texera.textql.planbuilder.beans.PassThroughPredicate)3 Statement (edu.uci.ics.texera.textql.statements.Statement)3 ProjectSomeFieldsPredicate (edu.uci.ics.texera.textql.statements.predicates.ProjectSomeFieldsPredicate)3 CreateViewStatement (edu.uci.ics.texera.textql.statements.CreateViewStatement)2 ProjectAllFieldsPredicate (edu.uci.ics.texera.textql.statements.predicates.ProjectAllFieldsPredicate)2 OperatorLink (edu.uci.ics.texera.dataflow.plangen.OperatorLink)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Assert (org.junit.Assert)1