use of com.orientechnologies.orient.core.intent.OIntentMassiveInsert in project orientdb by orientechnologies.
the class OCommandExecutorSQLSelectTest method initMassiveOrderSkipLimit.
private void initMassiveOrderSkipLimit(ODatabaseDocumentTx db) {
db.getMetadata().getSchema().createClass("MassiveOrderSkipLimit", 1, null);
db.declareIntent(new OIntentMassiveInsert());
String fieldValue = "laskdf lkajsd flaksjdf laksjd flakjsd flkasjd flkajsd flkajsd flkajsd flkajsd flkajsd flkjas;lkj a;ldskjf laksdj asdklasdjf lskdaj fladsd";
for (int i = 0; i < ORDER_SKIP_LIMIT_ITEMS; i++) {
ODocument doc = new ODocument("MassiveOrderSkipLimit");
doc.field("nnum", i);
doc.field("aaa", fieldValue);
doc.field("bbb", fieldValue);
doc.field("bbba", fieldValue);
doc.field("daf", fieldValue);
doc.field("dfgd", fieldValue);
doc.field("dgd", fieldValue);
doc.save();
}
db.declareIntent(null);
}
use of com.orientechnologies.orient.core.intent.OIntentMassiveInsert in project orientdb by orientechnologies.
the class LocalPaginatedStorageRestoreTx method testSimpleRestore.
public void testSimpleRestore() throws Exception {
List<Future<Void>> futures = new ArrayList<Future<Void>>();
baseDocumentTx.declareIntent(new OIntentMassiveInsert());
for (int i = 0; i < 8; i++) futures.add(executorService.submit(new DataPropagationTask()));
for (Future<Void> future : futures) future.get();
Thread.sleep(1500);
copyDataFromTestWithoutClose();
OStorage storage = baseDocumentTx.getStorage();
baseDocumentTx.close();
storage.close();
testDocumentTx = new ODatabaseDocumentTx("plocal:" + buildDir.getAbsolutePath() + "/testLocalPaginatedStorageRestoreFromTx");
testDocumentTx.open("admin", "admin");
testDocumentTx.close();
ODatabaseCompare databaseCompare = new ODatabaseCompare(testDocumentTx.getURL(), baseDocumentTx.getURL(), "admin", "admin", new OCommandOutputListener() {
@Override
public void onMessage(String text) {
System.out.println(text);
}
});
databaseCompare.setCompareIndexMetadata(true);
Assert.assertTrue(databaseCompare.compare());
}
use of com.orientechnologies.orient.core.intent.OIntentMassiveInsert in project orientdb by orientechnologies.
the class GraphIntersectLightweightEdges method testIntersect.
@Test
public void testIntersect() {
graph.setUseLightweightEdges(true);
graph.setAutoStartTx(false);
graph.declareIntent(new OIntentMassiveInsert().setDisableSecurity(true).setDisableHooks(true).setDisableValidation(true).setEnableCache(false));
// graph.begin();
// CREATE SUPER NODE1
final OrientVertex root1 = graph.addVertex(null, "name", "root1");
for (int i = 0; i < TOT; ++i) {
root1.addEdge("E", graph.addVertex(null, "child", i));
if (i % 1000 == 0) {
graph.commit();
graph.setUseLog(false);
// graph.begin();
System.out.println("commit " + i);
}
}
OLogManager.instance().info(this, "Created root1 with " + TOT + " children");
// CREATE SUPER NODE2
final OrientVertex root2 = graph.addVertex(null, "name", "root2");
for (int i = 0; i < TOT; ++i) {
root2.addEdge("E", graph.addVertex(null, "child", i));
if (i % 1000 == 0) {
graph.commit();
graph.setUseLog(false);
// graph.begin();
System.out.println("commit " + i);
}
}
OLogManager.instance().info(this, "Created root2 with " + TOT + " children");
// CREATE THE VERTEX IN COMMON
final OrientVertex common = graph.addVertex(null, "common", true);
root1.addEdge("E", common);
root2.addEdge("E", common);
graph.commit();
OLogManager.instance().info(this, "Intersecting...");
Iterable<OrientVertex> result = graph.command(new OCommandSQL("select intersect( out() ) from [?,?]")).execute(root1.getIdentity(), root2.getIdentity());
OLogManager.instance().info(this, "Intersecting done");
Assert.assertTrue(result.iterator().hasNext());
OrientVertex o = result.iterator().next();
final Collection set = o.getRecord().field("intersect");
Assert.assertEquals(set.iterator().next(), common);
result = graph.command(new OCommandSQL("select expand($c) let $a=(select from V limit 20), $b=(select from V skip 10 limit 10), $c=intersect( $a, $b )")).execute();
Assert.assertTrue(result.iterator().hasNext());
}
use of com.orientechnologies.orient.core.intent.OIntentMassiveInsert in project orientdb by orientechnologies.
the class GraphIntersectRegularEdges method testIntersect.
@Test
public void testIntersect() {
graph.setUseLightweightEdges(false);
graph.setAutoStartTx(false);
graph.declareIntent(new OIntentMassiveInsert().setDisableSecurity(true).setDisableHooks(true).setDisableValidation(true).setEnableCache(false));
// graph.begin();
// CREATE SUPER NODE1
final OrientVertex root1 = graph.addVertex(null, "name", "root1");
for (int i = 0; i < TOT; ++i) {
root1.addEdge("E", graph.addVertex(null, "child", i));
if (i % 1000 == 0) {
graph.commit();
graph.setUseLog(false);
// graph.begin();
System.out.println("commit " + i);
}
}
OLogManager.instance().info(this, "Created root1 with " + TOT + " children");
// CREATE SUPER NODE2
final OrientVertex root2 = graph.addVertex(null, "name", "root2");
for (int i = 0; i < TOT; ++i) {
root2.addEdge("E", graph.addVertex(null, "child", i));
if (i % 1000 == 0) {
graph.commit();
graph.setUseLog(false);
// graph.begin();
System.out.println("commit " + i);
}
}
OLogManager.instance().info(this, "Created root2 with " + TOT + " children");
// CREATE THE VERTEX IN COMMON
final OrientVertex common = graph.addVertex(null, "common", true);
root1.addEdge("E", common);
root2.addEdge("E", common);
graph.commit();
OLogManager.instance().info(this, "Intersecting...");
final Iterable<OrientVertex> result = graph.command(new OCommandSQL("select intersect( out() ) from [?,?]")).execute(root1.getIdentity(), root2.getIdentity());
OLogManager.instance().info(this, "Intersecting done");
Assert.assertTrue(result.iterator().hasNext());
OrientVertex o = result.iterator().next();
final Set set = o.getRecord().field("intersect");
Assert.assertEquals(set.iterator().next(), common);
}
use of com.orientechnologies.orient.core.intent.OIntentMassiveInsert in project orientdb by orientechnologies.
the class TestGraphIntentMassiveInsert method testIntent.
@Test
public void testIntent() {
final OrientGraph graph = new OrientGraph("memory:default", false);
graph.setUseLightweightEdges(true);
graph.getRawGraph().declareIntent(new OIntentMassiveInsert());
final OrientVertexType c1 = graph.createVertexType("C1");
c1.createProperty("p1", OType.INTEGER);
graph.createEdgeType("parent");
graph.begin();
final OrientVertex first = graph.addVertex("class:C1");
first.setProperty("p1", -1);
for (int i = 0; i < 10; i++) {
final OrientVertex v = graph.addVertex("class:C1");
v.setProperty("p1", i);
first.addEdge("parent", v);
//this search fills _source
graph.command(new OSQLSynchQuery("SELECT from V where p1='" + i + "'")).execute();
}
graph.commit();
//here NPE will be thrown
final Iterable<Edge> edges = first.getEdges(Direction.BOTH);
Iterator<Edge> ter = edges.iterator();
for (int i = 0; i < 10; i++) {
assertTrue(ter.hasNext());
assertEquals(ter.next().getVertex(Direction.IN).getProperty("p1"), i);
}
}
Aggregations