use of com.baidu.hugegraph.backend.store.BackendEntry in project incubator-hugegraph by apache.
the class BackendMutationTest method testEliminateAndInsertEntry.
@Test
public void testEliminateAndInsertEntry() {
BackendMutation mutation = new BackendMutation();
BackendEntry entry1 = constructBackendEntry("1");
BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
mutation.add(entry1, Action.ELIMINATE);
mutation.add(entry2, Action.INSERT);
Assert.assertEquals(1, get(mutation, "1").size());
Assert.assertEquals(Action.INSERT, get(mutation, "1").get(0).action());
}
use of com.baidu.hugegraph.backend.store.BackendEntry in project incubator-hugegraph by apache.
the class BackendMutationTest method testInsertAndInsertEntry.
@Test
public void testInsertAndInsertEntry() {
BackendMutation mutation = new BackendMutation();
BackendEntry entry1 = constructBackendEntry("1");
BackendEntry entry2 = constructBackendEntry("2");
BackendEntry entry3 = constructBackendEntry("1");
mutation.add(entry1, Action.INSERT);
mutation.add(entry2, Action.INSERT);
mutation.add(entry3, Action.INSERT);
Assert.assertEquals(1, get(mutation, "1").size());
Assert.assertEquals(Action.INSERT, get(mutation, "1").get(0).action());
Assert.assertEquals(1, get(mutation, "2").size());
Assert.assertEquals(Action.INSERT, get(mutation, "2").get(0).action());
}
use of com.baidu.hugegraph.backend.store.BackendEntry in project incubator-hugegraph by apache.
the class BackendMutationTest method testInsertAndEliminateEntry.
@Test
public void testInsertAndEliminateEntry() {
BackendMutation mutation = new BackendMutation();
BackendEntry entry1 = constructBackendEntry("1", "name", "marko");
BackendEntry entry2 = constructBackendEntry("1", "name", "marko");
mutation.add(entry1, Action.INSERT);
Assert.assertThrows(HugeException.class, () -> {
mutation.add(entry2, Action.ELIMINATE);
});
}
use of com.baidu.hugegraph.backend.store.BackendEntry in project incubator-hugegraph by apache.
the class BackendMutationTest method testInsertAndDeleteEntry.
@Test
public void testInsertAndDeleteEntry() {
BackendMutation mutation = new BackendMutation();
BackendEntry entry1 = constructBackendEntry("1");
BackendEntry entry2 = constructBackendEntry("1");
mutation.add(entry1, Action.INSERT);
Assert.assertThrows(HugeException.class, () -> {
mutation.add(entry2, Action.DELETE);
});
}
use of com.baidu.hugegraph.backend.store.BackendEntry in project incubator-hugegraph by apache.
the class CassandraStore method query.
@Override
public Iterator<BackendEntry> query(Query query) {
this.checkOpened();
HugeType type = CassandraTable.tableType(query);
String tableName = query.olap() ? this.olapTableName(type) : type.string();
CassandraTable table = this.table(tableName);
Iterator<BackendEntry> entries = table.query(this.session(), query);
// Merge olap results as needed
Set<Id> olapPks = query.olapPks();
if (this.isGraphStore && !olapPks.isEmpty()) {
List<Iterator<BackendEntry>> iterators = new ArrayList<>();
for (Id pk : olapPks) {
Query q = query.copy();
table = this.table(this.olapTableName(pk));
iterators.add(table.query(this.session(), q));
}
entries = new MergeIterator<>(entries, iterators, BackendEntry::mergeable);
}
return entries;
}
Aggregations