use of edu.uci.ics.texera.dataflow.common.PredicateBase in project textdb by TextDB.
the class SelectStatement method getInternalOperatorBeans.
/**
* Return a list of operators generated when this statement is converted to beans.
* Beans will be generated for the Alias, Projection, Extraction and Source operators.
* @return The list of operator beans generated by this statement.
*/
@Override
public List<PredicateBase> getInternalOperatorBeans() {
List<PredicateBase> operators = new ArrayList<>();
// Build and append a PassThroughBean as an alias for this Statement
operators.add(new PassThroughPredicate(getOutputNodeID()));
// Build and append bean for Projection
if (this.projectPredicate == null) {
operators.add(new PassThroughPredicate(getProjectionNodeID()));
} else {
operators.add(this.projectPredicate.generateOperatorBean(getProjectionNodeID()));
}
// Build and append bean for Extraction predicate
if (this.extractPredicate == null) {
operators.add(new PassThroughPredicate(getExtractionNodeID()));
} else {
operators.add(this.extractPredicate.generateOperatorBean(getExtractionNodeID()));
}
// Build and append bean for the Source
operators.add(new PassThroughPredicate(getInputNodeID()));
// return the built operators
return operators;
}
use of edu.uci.ics.texera.dataflow.common.PredicateBase in project textdb by TextDB.
the class CreateViewStatementTest method testCreateViewStatementBeansBuilder00.
/**
* Test the correctness of the generated beans by a CreateViewStatement with
* a SelectExtractStatement as sub-statement without a SelectPredicate nor
* ExtractPredicate.
* Get a graph by calling getInternalOperatorBeans() 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 testCreateViewStatementBeansBuilder00() {
Statement subStatement = new SelectStatement("id2", null, null, "from", null, null);
CreateViewStatement createViewStatement = new CreateViewStatement("idx", subStatement);
List<PredicateBase> expectedGeneratedBeans = Collections.emptyList();
List<String> dependencies = Arrays.asList(subStatement.getId());
Assert.assertEquals(createViewStatement.getInputViews(), dependencies);
StatementTestUtils.assertGeneratedBeans(createViewStatement, expectedGeneratedBeans);
}
use of edu.uci.ics.texera.dataflow.common.PredicateBase in project textdb by TextDB.
the class SelectStatementTest method testSelectStatementBeansBuilder04.
/**
* 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 testSelectStatementBeansBuilder04() {
ProjectPredicate projectPredicate = new ProjectAllFieldsPredicate();
ExtractPredicate extractPredicate = new KeywordExtractPredicate(Arrays.asList("f1"), "keyword", KeywordMatchingType.CONJUNCTION_INDEXBASED.toString());
SelectStatement selectStatement = new SelectStatement("id", projectPredicate, extractPredicate, "source", null, null);
List<PredicateBase> expectedGeneratedBeans = Arrays.asList(new KeywordPredicate("keyword", Arrays.asList("f1"), null, KeywordMatchingType.CONJUNCTION_INDEXBASED, "id_e"));
List<String> dependencies = Arrays.asList("source");
Assert.assertEquals(selectStatement.getInputViews(), dependencies);
StatementTestUtils.assertGeneratedBeans(selectStatement, expectedGeneratedBeans);
}
use of edu.uci.ics.texera.dataflow.common.PredicateBase in project textdb by TextDB.
the class SelectStatementTest method testSelectStatementBeansBuilder03.
/**
* Test the correctness of the generated beans by a SelectStatement with 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 testSelectStatementBeansBuilder03() {
ExtractPredicate extractPredicate = new KeywordExtractPredicate(Arrays.asList("c", "d"), "word", KeywordMatchingType.SUBSTRING_SCANBASED.toString());
SelectStatement selectStatement = new SelectStatement("id", null, extractPredicate, "TableP9", null, null);
List<PredicateBase> expectedGeneratedBeans = Arrays.asList(new KeywordPredicate("word", Arrays.asList("c", "d"), null, KeywordMatchingType.SUBSTRING_SCANBASED, "id_e"));
List<String> dependencies = Arrays.asList("TableP9");
Assert.assertEquals(selectStatement.getInputViews(), dependencies);
StatementTestUtils.assertGeneratedBeans(selectStatement, expectedGeneratedBeans);
}
use of edu.uci.ics.texera.dataflow.common.PredicateBase in project textdb by TextDB.
the class SelectStatementTest method testSelectStatementBeansBuilder00.
/**
* Test the correctness of the generated beans by a SelectStatement without a
* ProjectPredicate nor ExtractPredicate.
* 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 testSelectStatementBeansBuilder00() {
SelectStatement selectStatement = new SelectStatement("id", null, null, "tableX", null, null);
List<PredicateBase> expectedGeneratedBeans = Collections.emptyList();
List<String> dependencies = Arrays.asList("tableX");
Assert.assertEquals(selectStatement.getInputViews(), dependencies);
StatementTestUtils.assertGeneratedBeans(selectStatement, expectedGeneratedBeans);
}
Aggregations