use of edu.uci.ics.texera.api.field.IntegerField in project textdb by TextDB.
the class WordCloudSinkTestConstants method getResultTuples.
public static List<Tuple> getResultTuples() {
IField[] fields1 = { new StringField("foo"), new IntegerField(200) };
IField[] fields2 = { new StringField("amy"), new IntegerField(100) };
IField[] fields3 = { new StringField("bob"), new IntegerField(50) };
Tuple tuple1 = new Tuple(WORD_CLOUD_RESULT_SCHEMA, fields1);
Tuple tuple2 = new Tuple(WORD_CLOUD_RESULT_SCHEMA, fields2);
Tuple tuple3 = new Tuple(WORD_CLOUD_RESULT_SCHEMA, fields3);
return Arrays.asList(tuple1, tuple2, tuple3);
}
use of edu.uci.ics.texera.api.field.IntegerField in project textdb by TextDB.
the class WordCloudSinkTestConstants method getTuples.
public static List<Tuple> getTuples() {
IField[] fields1 = { new TextField("foo foo"), new IntegerField(2000) };
IField[] fields2 = { new TextField("foo foo"), new IntegerField(1200) };
IField[] fields3 = { new TextField("amy amy"), new IntegerField(1000) };
IField[] fields4 = { new TextField("bob the a in into this"), new IntegerField(500) };
Tuple tuple1 = new Tuple(WORD_CLOUD_SCHEMA, fields1);
Tuple tuple2 = new Tuple(WORD_CLOUD_SCHEMA, fields2);
Tuple tuple3 = new Tuple(WORD_CLOUD_SCHEMA, fields3);
Tuple tuple4 = new Tuple(WORD_CLOUD_SCHEMA, fields4);
return Arrays.asList(tuple1, tuple2, tuple3, tuple4);
}
use of edu.uci.ics.texera.api.field.IntegerField in project textdb by TextDB.
the class CatalogConstants method getSchemaCatalogTuples.
/**
* Gets the tuples to be inserted to the schema catalog.
*
* @param tableName
* @param tableDirectory
* @param luceneAnalyzerStr
* @return
* @throws StorageException
*/
public static List<Tuple> getSchemaCatalogTuples(String tableName, Schema tableSchema) {
List<Tuple> schemaCatalogTuples = new ArrayList<>();
for (int i = 0; i < tableSchema.getAttributes().size(); i++) {
Attribute attr = tableSchema.getAttributes().get(i);
Tuple schemaTuple = new Tuple(SCHEMA_CATALOG_SCHEMA, new StringField(tableName), new StringField(attr.getName()), new StringField(attr.getType().toString().toLowerCase()), new IntegerField(i));
schemaCatalogTuples.add(schemaTuple);
}
return schemaCatalogTuples;
}
use of edu.uci.ics.texera.api.field.IntegerField in project textdb by TextDB.
the class WordCountIndexSource method computeNextMatchingTuple.
private Tuple computeNextMatchingTuple() throws TexeraException {
if (sortedWordCountMap == null) {
computeWordCount();
}
if (wordCountIterator.hasNext()) {
Entry<String, Integer> entry = wordCountIterator.next();
List<IField> tupleFieldList = new ArrayList<>();
// Generate the new UUID.
tupleFieldList.add(IDField.newRandomID());
tupleFieldList.add(new StringField(entry.getKey()));
tupleFieldList.add(new IntegerField(entry.getValue()));
cursor++;
return new Tuple(SCHEMA_WORD_COUNT, tupleFieldList);
}
return null;
}
use of edu.uci.ics.texera.api.field.IntegerField in project textdb by TextDB.
the class AggregatorTest method testCountHeightAggregation.
// TEST 4: Find count in height column
@Test
public void testCountHeightAggregation() throws Exception {
Attribute attribute = TestConstants.HEIGHT_ATTR;
String attributeName = attribute.getName();
AggregationType aggType = AggregationType.COUNT;
String resultAttributeName = AggregatorTestConstants.COUNT_HEIGHT_RESULT_ATTR_NAME;
AggregationAttributeAndResult aggEntity = new AggregationAttributeAndResult(attributeName, aggType, resultAttributeName);
List<AggregationAttributeAndResult> aggEntitiesList = new ArrayList<>();
aggEntitiesList.add(aggEntity);
IField[] row1 = { new IntegerField(6) };
Schema schema = new Schema(new Attribute(resultAttributeName, AttributeType.INTEGER));
List<Tuple> expectedResults = new ArrayList<>();
expectedResults.add(new Tuple(schema, row1));
List<Tuple> returnedResults = getQueryResults(aggEntitiesList);
Assert.assertEquals(1, returnedResults.size());
Assert.assertTrue(TestUtils.equals(expectedResults, returnedResults));
}
Aggregations