Search in sources :

Example 16 with SelectStatement

use of edu.uci.ics.texera.textql.statements.SelectStatement in project textdb by TextDB.

the class SelectStatementTest method testSelectStatementBeansBuilder05.

/**
 * Test the correctness of the generated beans by a SelectStatement with a
 * ProjectAllFieldsPredicate and a KeywordExtractPredicate.
 * Get a graph by calling getInternalPredicateBases() and getInternalLinkBeans()
 * methods and check if the generated path form the node getInputNodeID() to
 * the node getOutputNodeID() is correct. Also check whether getInputViews()
 * is returning the correct dependencies.
 */
@Test
public void testSelectStatementBeansBuilder05() {
    ProjectPredicate projectPredicate = new ProjectSomeFieldsPredicate(Arrays.asList("a", "b"));
    ExtractPredicate extractPredicate = new KeywordExtractPredicate(Arrays.asList("a", "b"), "x", KeywordMatchingType.SUBSTRING_SCANBASED.toString());
    SelectStatement selectStatement = new SelectStatement("_sid4", projectPredicate, extractPredicate, "from", null, null);
    List<PredicateBase> expectedGeneratedBeans = Arrays.asList(new KeywordPredicate("x", Arrays.asList("a", "b"), null, KeywordMatchingType.SUBSTRING_SCANBASED, "_sid4_e"), new ProjectionPredicate(Arrays.asList("a", "b")));
    List<String> dependencies = Arrays.asList("from");
    Assert.assertEquals(selectStatement.getInputViews(), dependencies);
    StatementTestUtils.assertGeneratedBeans(selectStatement, expectedGeneratedBeans);
}
Also used : SelectStatement(edu.uci.ics.texera.textql.statements.SelectStatement) ProjectPredicate(edu.uci.ics.texera.textql.statements.predicates.ProjectPredicate) PredicateBase(edu.uci.ics.texera.dataflow.common.PredicateBase) ExtractPredicate(edu.uci.ics.texera.textql.statements.predicates.ExtractPredicate) KeywordExtractPredicate(edu.uci.ics.texera.textql.statements.predicates.KeywordExtractPredicate) ProjectSomeFieldsPredicate(edu.uci.ics.texera.textql.statements.predicates.ProjectSomeFieldsPredicate) KeywordExtractPredicate(edu.uci.ics.texera.textql.statements.predicates.KeywordExtractPredicate) ProjectionPredicate(edu.uci.ics.texera.dataflow.projection.ProjectionPredicate) KeywordPredicate(edu.uci.ics.texera.dataflow.keywordmatcher.KeywordPredicate) Test(org.junit.Test)

Aggregations

SelectStatement (edu.uci.ics.texera.textql.statements.SelectStatement)16 Test (org.junit.Test)16 ProjectPredicate (edu.uci.ics.texera.textql.statements.predicates.ProjectPredicate)13 ExtractPredicate (edu.uci.ics.texera.textql.statements.predicates.ExtractPredicate)12 KeywordExtractPredicate (edu.uci.ics.texera.textql.statements.predicates.KeywordExtractPredicate)12 ProjectSomeFieldsPredicate (edu.uci.ics.texera.textql.statements.predicates.ProjectSomeFieldsPredicate)11 ProjectAllFieldsPredicate (edu.uci.ics.texera.textql.statements.predicates.ProjectAllFieldsPredicate)10 PredicateBase (edu.uci.ics.texera.dataflow.common.PredicateBase)8 CreateViewStatement (edu.uci.ics.texera.textql.statements.CreateViewStatement)8 Statement (edu.uci.ics.texera.textql.statements.Statement)8 TextQLParser (edu.uci.ics.texera.textql.languageparser.TextQLParser)4 KeywordPredicate (edu.uci.ics.texera.dataflow.keywordmatcher.KeywordPredicate)3 ProjectionPredicate (edu.uci.ics.texera.dataflow.projection.ProjectionPredicate)2 ParseException (edu.uci.ics.texera.textql.languageparser.ParseException)1 TokenMgrError (edu.uci.ics.texera.textql.languageparser.TokenMgrError)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 PipedInputStream (java.io.PipedInputStream)1 PipedOutputStream (java.io.PipedOutputStream)1 PrintStream (java.io.PrintStream)1