Search in sources :

Example 96 with OCommandSQL

use of com.orientechnologies.orient.core.sql.OCommandSQL in project orientdb by orientechnologies.

the class SQLSelectCompositeIndexDirectSearchTest method testEqualsPartialPrimitive.

@Test
public void testEqualsPartialPrimitive() {
    final List<ODocument> resultList = database.command(new OCommandSQL("select * from index:SQLSelectCompositeIndexDirectSearchTestIndex where key = 2")).execute();
    Assert.assertEquals(resultList.size(), 10);
    final List<ORID> expectedRIDs = rids.subList(20, 30);
    for (final ODocument d : resultList) {
        Assert.assertTrue(d.containsField("rid"));
        Assert.assertTrue(expectedRIDs.contains(d.<ORID>field("rid")));
    }
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) ORID(com.orientechnologies.orient.core.id.ORID) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 97 with OCommandSQL

use of com.orientechnologies.orient.core.sql.OCommandSQL in project orientdb by orientechnologies.

the class SQLSelectCompositeIndexDirectSearchTest method testMinorEqualsPartialPrimitive.

@Test
public void testMinorEqualsPartialPrimitive() {
    final List<ODocument> resultList = database.command(new OCommandSQL("select * from index:SQLSelectCompositeIndexDirectSearchTestIndex where key <= 4")).execute();
    Assert.assertEquals(resultList.size(), 50);
    final List<ORID> expectedRIDs = rids.subList(0, 50);
    for (final ODocument d : resultList) {
        Assert.assertTrue(d.containsField("rid"));
        Assert.assertTrue(expectedRIDs.contains(d.<ORID>field("rid")));
    }
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) ORID(com.orientechnologies.orient.core.id.ORID) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 98 with OCommandSQL

use of com.orientechnologies.orient.core.sql.OCommandSQL in project orientdb by orientechnologies.

the class SQLSelectCompositeIndexDirectSearchTest method testMinor.

@Test
public void testMinor() throws Exception {
    final List<ODocument> resultList = database.command(new OCommandSQL("select * from index:SQLSelectCompositeIndexDirectSearchTestIndex where key < [2, 5]")).execute();
    Assert.assertEquals(resultList.size(), 25);
    final List<ORID> expectedRIDs = rids.subList(0, 26);
    for (final ODocument d : resultList) {
        Assert.assertTrue(d.containsField("rid"));
        Assert.assertTrue(expectedRIDs.contains(d.<ORID>field("rid")));
    }
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) ORID(com.orientechnologies.orient.core.id.ORID) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 99 with OCommandSQL

use of com.orientechnologies.orient.core.sql.OCommandSQL in project orientdb by orientechnologies.

the class SQLSelectCompositeIndexDirectSearchTest method testBetweenPartialPrimitive.

@Test
public void testBetweenPartialPrimitive() throws Exception {
    final List<ODocument> resultList = database.command(new OCommandSQL("select * from index:SQLSelectCompositeIndexDirectSearchTestIndex where key between 2 and 5")).execute();
    Assert.assertEquals(resultList.size(), 40);
    final List<ORID> expectedRIDs = rids.subList(20, 60);
    for (final ODocument d : resultList) {
        Assert.assertTrue(d.containsField("rid"));
        Assert.assertTrue(expectedRIDs.contains(d.<ORID>field("rid")));
    }
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) ORID(com.orientechnologies.orient.core.id.ORID) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 100 with OCommandSQL

use of com.orientechnologies.orient.core.sql.OCommandSQL in project orientdb by orientechnologies.

the class SQLSelectCompositeIndexDirectSearchTest method testInPartialComposite.

@Test(enabled = false)
public void testInPartialComposite() {
    final List<ODocument> resultList = database.command(new OCommandSQL("select * from index:SQLSelectCompositeIndexDirectSearchTestIndex where key in [[2], [3], [7]]")).execute();
    Assert.assertEquals(resultList.size(), 30);
    final List<ORID> expectedRIDs = rids.subList(20, 40);
    expectedRIDs.addAll(rids.subList(70, 80));
    for (final ODocument d : resultList) {
        Assert.assertTrue(d.containsField("rid"));
        Assert.assertTrue(expectedRIDs.contains(d.<ORID>field("rid")));
    }
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) ORID(com.orientechnologies.orient.core.id.ORID) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Aggregations

OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)621 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)422 Test (org.junit.Test)97 Test (org.testng.annotations.Test)93 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)83 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)79 OSQLSynchQuery (com.orientechnologies.orient.core.sql.query.OSQLSynchQuery)78 ORID (com.orientechnologies.orient.core.id.ORID)64 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)61 OSchema (com.orientechnologies.orient.core.metadata.schema.OSchema)54 Set (java.util.Set)53 HashMap (java.util.HashMap)45 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)42 OrientVertex (com.tinkerpop.blueprints.impls.orient.OrientVertex)41 List (java.util.List)25 Before (org.junit.Before)24 OStorage (com.orientechnologies.orient.core.storage.OStorage)23 OrientGraphNoTx (com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx)23 ORecordId (com.orientechnologies.orient.core.id.ORecordId)21 Vertex (com.tinkerpop.blueprints.Vertex)19