use of edu.uci.ics.texera.dataflow.source.scan.ScanSourcePredicate in project textdb by TextDB.
the class AggregatorTest method setPreExecConfigs.
private void setPreExecConfigs(Aggregator aggOperator) {
ScanBasedSourceOperator sourceOperator = new ScanBasedSourceOperator(new ScanSourcePredicate(PEOPLE_TABLE));
aggOperator.setInputOperator(sourceOperator);
aggOperator.open();
aggOperator.setLimit(Integer.MAX_VALUE);
aggOperator.setOffset(0);
}
use of edu.uci.ics.texera.dataflow.source.scan.ScanSourcePredicate in project textdb by TextDB.
the class ProjectionOperatorTest method testProjection2.
@Test
public void testProjection2() throws Exception {
List<String> projectionFields = Arrays.asList(TestConstants.FIRST_NAME, TestConstants.DESCRIPTION);
Schema projectionSchema = new Schema(TestConstants.FIRST_NAME_ATTR, TestConstants.DESCRIPTION_ATTR);
IField[] fields1 = { new StringField("bruce"), new TextField("Tall Angry") };
IField[] fields2 = { new StringField("tom hanks"), new TextField("Short Brown") };
IField[] fields3 = { new StringField("brad lie angelina"), new TextField("White Angry") };
IField[] fields4 = { new StringField("george lin lin"), new TextField("Lin Clooney is Short and lin clooney is Angry") };
IField[] fields5 = { new StringField("christian john wayne"), new TextField("Tall Fair") };
IField[] fields6 = { new StringField("Mary brown"), new TextField("Short angry") };
Tuple tuple1 = new Tuple(projectionSchema, fields1);
Tuple tuple2 = new Tuple(projectionSchema, fields2);
Tuple tuple3 = new Tuple(projectionSchema, fields3);
Tuple tuple4 = new Tuple(projectionSchema, fields4);
Tuple tuple5 = new Tuple(projectionSchema, fields5);
Tuple tuple6 = new Tuple(projectionSchema, fields6);
List<Tuple> expectedResults = Arrays.asList(tuple1, tuple2, tuple3, tuple4, tuple5, tuple6);
List<Tuple> returnedResults = getProjectionResults(new ScanBasedSourceOperator(new ScanSourcePredicate(PEOPLE_TABLE)), projectionFields);
Assert.assertTrue(TestUtils.equals(expectedResults, returnedResults));
}
use of edu.uci.ics.texera.dataflow.source.scan.ScanSourcePredicate in project textdb by TextDB.
the class RegexMatcherTestHelper method getScanSourceResults.
public static List<Tuple> getScanSourceResults(String tableName, String regex, List<String> attributeNames, int limit, int offset) throws TexeraException {
ScanBasedSourceOperator scanSource = new ScanBasedSourceOperator(new ScanSourcePredicate(tableName));
RegexPredicate regexPredicate = new RegexPredicate(regex, attributeNames, RESULTS);
RegexMatcher regexMatcher = new RegexMatcher(regexPredicate);
regexMatcher.setLimit(limit);
regexMatcher.setOffset(offset);
regexMatcher.setInputOperator(scanSource);
Tuple tuple;
List<Tuple> results = new ArrayList<>();
regexMatcher.open();
while ((tuple = regexMatcher.getNextTuple()) != null) {
results.add(tuple);
}
regexMatcher.close();
return results;
}
use of edu.uci.ics.texera.dataflow.source.scan.ScanSourcePredicate in project textdb by TextDB.
the class RegexSplitOperatorTest method test8.
/*
* ID test: To test if each newly-split tuple's ID has conflict with the old tuple.
*/
@Test
public void test8() throws TexeraException {
String splitRegex = "ana";
String splitAttrName = TestConstantsRegexSplit.DESCRIPTION;
List<Tuple> results = computeRegexSplitResultsOneToMany(REGEX_TABLE, splitAttrName, splitRegex, RegexSplitPredicate.SplitType.STANDALONE);
ScanBasedSourceOperator scanSource = new ScanBasedSourceOperator(new ScanSourcePredicate(REGEX_TABLE));
Tuple tupleTable;
scanSource.open();
while ((tupleTable = scanSource.getNextTuple()) != null) {
for (Tuple tuple : results) {
Assert.assertFalse(tuple.getField(SchemaConstants._ID).equals(tupleTable.getField(SchemaConstants._ID)));
}
}
scanSource.close();
}
use of edu.uci.ics.texera.dataflow.source.scan.ScanSourcePredicate in project textdb by TextDB.
the class RegexSplitOperatorTest method computeRegexSplitResultsOnetoOne.
public static List<Tuple> computeRegexSplitResultsOnetoOne(String tableName, String splitAttrName, String splitRegex, RegexSplitPredicate.SplitType splitType) throws TexeraException {
ScanBasedSourceOperator scanSource = new ScanBasedSourceOperator(new ScanSourcePredicate(tableName));
RegexSplitOperator regexSplit = new RegexSplitOperator(new RegexSplitPredicate(splitRegex, splitAttrName, RegexOutputType.ONE_TO_ONE, splitType, RESULT_ATTR));
regexSplit.setInputOperator(scanSource);
List<Tuple> results = new ArrayList<>();
regexSplit.open();
Tuple tuple;
while ((tuple = regexSplit.getNextTuple()) != null) {
results.add(tuple);
}
regexSplit.close();
return results;
}
Aggregations