Search in sources :

Example 1 with CQLStoreManager

use of org.janusgraph.diskstorage.cql.CQLStoreManager in project janusgraph by JanusGraph.

the class CQLScanJobIT method testSimpleScan.

@Test
public void testSimpleScan() throws InterruptedException, ExecutionException, IOException, BackendException {
    int keys = 1000;
    int cols = 40;
    String[][] values = KeyValueStoreUtil.generateData(keys, cols);
    // Make it only half the number of columns for every 2nd key
    for (int i = 0; i < values.length; i++) {
        if (i % 2 == 0)
            values[i] = Arrays.copyOf(values[i], cols / 2);
    }
    log.debug("Loading values: " + keys + "x" + cols);
    KeyColumnValueStoreManager mgr = new CQLStoreManager(GraphDatabaseConfiguration.buildGraphConfiguration());
    KeyColumnValueStore store = mgr.openDatabase("edgestore");
    StoreTransaction tx = mgr.beginTransaction(StandardBaseTransactionConfig.of(TimestampProviders.MICRO));
    KeyColumnValueStoreUtil.loadValues(store, tx, values);
    // noop on Cassandra, but harmless
    tx.commit();
    SimpleScanJobRunner runner = (ScanJob job, Configuration jobConf, String rootNSName) -> {
        try {
            return new CQLHadoopScanRunner(job).scanJobConf(jobConf).scanJobConfRoot(rootNSName).partitionerOverride("org.apache.cassandra.dht.Murmur3Partitioner").run();
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    };
    SimpleScanJob.runBasicTests(keys, cols, runner);
}
Also used : KeyColumnValueStore(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore) WriteConfiguration(org.janusgraph.diskstorage.configuration.WriteConfiguration) JanusGraphHadoopConfiguration(org.janusgraph.hadoop.config.JanusGraphHadoopConfiguration) Configuration(org.janusgraph.diskstorage.configuration.Configuration) GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration) StoreTransaction(org.janusgraph.diskstorage.keycolumnvalue.StoreTransaction) CQLHadoopScanRunner(org.janusgraph.hadoop.scan.CQLHadoopScanRunner) CQLStoreManager(org.janusgraph.diskstorage.cql.CQLStoreManager) SimpleScanJobRunner(org.janusgraph.diskstorage.SimpleScanJobRunner) KeyColumnValueStoreManager(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager) SimpleScanJob(org.janusgraph.diskstorage.SimpleScanJob) ScanJob(org.janusgraph.diskstorage.keycolumnvalue.scan.ScanJob) Test(org.junit.jupiter.api.Test) JanusGraphBaseTest(org.janusgraph.graphdb.JanusGraphBaseTest)

Aggregations

SimpleScanJob (org.janusgraph.diskstorage.SimpleScanJob)1 SimpleScanJobRunner (org.janusgraph.diskstorage.SimpleScanJobRunner)1 Configuration (org.janusgraph.diskstorage.configuration.Configuration)1 WriteConfiguration (org.janusgraph.diskstorage.configuration.WriteConfiguration)1 CQLStoreManager (org.janusgraph.diskstorage.cql.CQLStoreManager)1 KeyColumnValueStore (org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore)1 KeyColumnValueStoreManager (org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager)1 StoreTransaction (org.janusgraph.diskstorage.keycolumnvalue.StoreTransaction)1 ScanJob (org.janusgraph.diskstorage.keycolumnvalue.scan.ScanJob)1 JanusGraphBaseTest (org.janusgraph.graphdb.JanusGraphBaseTest)1 GraphDatabaseConfiguration (org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)1 JanusGraphHadoopConfiguration (org.janusgraph.hadoop.config.JanusGraphHadoopConfiguration)1 CQLHadoopScanRunner (org.janusgraph.hadoop.scan.CQLHadoopScanRunner)1 Test (org.junit.jupiter.api.Test)1