Search in sources :

Example 36 with DataWriter

use of edu.uci.ics.texera.storage.DataWriter in project textdb by TextDB.

the class FuzzyTokenMatcherTestHelper method writeTestTables.

/*
     * Creates the test table(s) and writes data into it(them).
     */
public static void writeTestTables() throws TexeraException {
    RelationManager relationManager = RelationManager.getInstance();
    // create the people table and write tuples
    relationManager.createTable(PEOPLE_TABLE, TestUtils.getDefaultTestIndex().resolve(PEOPLE_TABLE), TestConstants.SCHEMA_PEOPLE, LuceneAnalyzerConstants.standardAnalyzerString());
    DataWriter peopleDataWriter = relationManager.getTableDataWriter(PEOPLE_TABLE);
    peopleDataWriter.open();
    for (Tuple tuple : TestConstants.getSamplePeopleTuples()) {
        peopleDataWriter.insertTuple(tuple);
    }
    peopleDataWriter.close();
}
Also used : Tuple(edu.uci.ics.texera.api.tuple.Tuple) RelationManager(edu.uci.ics.texera.storage.RelationManager) DataWriter(edu.uci.ics.texera.storage.DataWriter)

Example 37 with DataWriter

use of edu.uci.ics.texera.storage.DataWriter in project textdb by TextDB.

the class PlanStore method deletePlan.

/**
 * Removess a plan by given name from plan store.
 *
 * @param planName, the name of the plan.
 * @throws TexeraException
 */
public void deletePlan(String planName) throws TexeraException {
    Tuple plan = getPlan(planName);
    if (plan == null) {
        return;
    }
    IDField idField = (IDField) plan.getField(SchemaConstants._ID);
    DataWriter dataWriter = relationManager.getTableDataWriter(PlanStoreConstants.TABLE_NAME);
    dataWriter.open();
    dataWriter.deleteTupleByID(idField);
    dataWriter.close();
}
Also used : IDField(edu.uci.ics.texera.api.field.IDField) Tuple(edu.uci.ics.texera.api.tuple.Tuple) DataWriter(edu.uci.ics.texera.storage.DataWriter)

Aggregations

DataWriter (edu.uci.ics.texera.storage.DataWriter)37 Tuple (edu.uci.ics.texera.api.tuple.Tuple)33 RelationManager (edu.uci.ics.texera.storage.RelationManager)19 Test (org.junit.Test)11 ArrayList (java.util.ArrayList)10 BeforeClass (org.junit.BeforeClass)8 StorageException (edu.uci.ics.texera.api.exception.StorageException)3 IDField (edu.uci.ics.texera.api.field.IDField)3 StringField (edu.uci.ics.texera.api.field.StringField)3 IOException (java.io.IOException)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Term (org.apache.lucene.index.Term)2 TermQuery (org.apache.lucene.search.TermQuery)2 TexeraException (edu.uci.ics.texera.api.exception.TexeraException)1 IField (edu.uci.ics.texera.api.field.IField)1 TupleSink (edu.uci.ics.texera.dataflow.sink.tuple.TupleSink)1 TupleSinkPredicate (edu.uci.ics.texera.dataflow.sink.tuple.TupleSinkPredicate)1 TwitterJsonConverter (edu.uci.ics.texera.dataflow.twitter.TwitterJsonConverter)1 TwitterJsonConverterPredicate (edu.uci.ics.texera.dataflow.twitter.TwitterJsonConverterPredicate)1