Search in sources :

Example 6 with KeyRangeQuery

use of org.janusgraph.diskstorage.keycolumnvalue.KeyRangeQuery in project janusgraph by JanusGraph.

the class CQLStoreTest method testGetKeysWithoutUnorderedScan.

@Test
@FeatureFlag(feature = JanusGraphFeature.OrderedScan)
public void testGetKeysWithoutUnorderedScan() throws BackendException, NoSuchFieldException, IllegalAccessException {
    // support ordered scan but not unordered scan
    Field field = StandardStoreFeatures.class.getDeclaredField("unorderedScan");
    field.setAccessible(true);
    Field modifiersField = Field.class.getDeclaredField("modifiers");
    modifiersField.setAccessible(true);
    modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
    field.set(manager.getFeatures(), false);
    Exception ex = assertThrows(PermanentBackendException.class, () -> store.getKeys(new SliceQuery(BufferUtil.zeroBuffer(1), BufferUtil.oneBuffer(4)), tx));
    assertEquals("This operation is only allowed when partitioner supports unordered scan", ex.getMessage());
    assertDoesNotThrow(() -> store.getKeys(new KeyRangeQuery(BufferUtil.getLongBuffer(1), BufferUtil.getLongBuffer(1000), BufferUtil.getLongBuffer(1), BufferUtil.getLongBuffer(1000)), tx));
}
Also used : Field(java.lang.reflect.Field) KeyRangeQuery(org.janusgraph.diskstorage.keycolumnvalue.KeyRangeQuery) BackendException(org.janusgraph.diskstorage.BackendException) PermanentBackendException(org.janusgraph.diskstorage.PermanentBackendException) SliceQuery(org.janusgraph.diskstorage.keycolumnvalue.SliceQuery) KeyColumnValueStoreTest(org.janusgraph.diskstorage.KeyColumnValueStoreTest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) FeatureFlag(org.janusgraph.testutil.FeatureFlag)

Aggregations

KeyRangeQuery (org.janusgraph.diskstorage.keycolumnvalue.KeyRangeQuery)6 FeatureFlag (org.janusgraph.testutil.FeatureFlag)5 Test (org.junit.jupiter.api.Test)5 KeyIterator (org.janusgraph.diskstorage.keycolumnvalue.KeyIterator)4 SliceQuery (org.janusgraph.diskstorage.keycolumnvalue.SliceQuery)4 JanusGraphBaseStoreFeaturesTest (org.janusgraph.JanusGraphBaseStoreFeaturesTest)3 Field (java.lang.reflect.Field)2 BackendException (org.janusgraph.diskstorage.BackendException)2 KeyColumnValueStoreTest (org.janusgraph.diskstorage.KeyColumnValueStoreTest)2 PermanentBackendException (org.janusgraph.diskstorage.PermanentBackendException)2 KeySliceQuery (org.janusgraph.diskstorage.keycolumnvalue.KeySliceQuery)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 ReadArrayBuffer (org.janusgraph.diskstorage.util.ReadArrayBuffer)1 RecordIterator (org.janusgraph.diskstorage.util.RecordIterator)1