Search in sources :

Example 16 with SlicePredicate

use of org.apache.cassandra.thrift.SlicePredicate in project eiger by wlloyd.

the class ConfigHelper method predicateFromString.

private static SlicePredicate predicateFromString(String st) {
    assert st != null;
    TDeserializer deserializer = new TDeserializer(new TBinaryProtocol.Factory());
    SlicePredicate predicate = new SlicePredicate();
    try {
        deserializer.deserialize(predicate, Hex.hexToBytes(st));
    } catch (TException e) {
        throw new RuntimeException(e);
    }
    return predicate;
}
Also used : TException(org.apache.thrift.TException) TDeserializer(org.apache.thrift.TDeserializer) TBinaryProtocol(org.apache.cassandra.thrift.TBinaryProtocol) SlicePredicate(org.apache.cassandra.thrift.SlicePredicate)

Example 17 with SlicePredicate

use of org.apache.cassandra.thrift.SlicePredicate in project janusgraph by JanusGraph.

the class CassandraBinaryInputFormat method setConf.

@Override
public void setConf(final Configuration config) {
    super.setConf(config);
    // Copy some JanusGraph configuration keys to the Hadoop Configuration keys used by Cassandra's ColumnFamilyInputFormat
    ConfigHelper.setInputInitialAddress(config, janusgraphConf.get(GraphDatabaseConfiguration.STORAGE_HOSTS)[0]);
    if (janusgraphConf.has(GraphDatabaseConfiguration.STORAGE_PORT))
        ConfigHelper.setInputRpcPort(config, String.valueOf(janusgraphConf.get(GraphDatabaseConfiguration.STORAGE_PORT)));
    if (janusgraphConf.has(GraphDatabaseConfiguration.AUTH_USERNAME))
        ConfigHelper.setInputKeyspaceUserName(config, janusgraphConf.get(GraphDatabaseConfiguration.AUTH_USERNAME));
    if (janusgraphConf.has(GraphDatabaseConfiguration.AUTH_PASSWORD))
        ConfigHelper.setInputKeyspacePassword(config, janusgraphConf.get(GraphDatabaseConfiguration.AUTH_PASSWORD));
    // Copy keyspace, force the CF setting to edgestore, honor widerows when set
    final boolean wideRows = config.getBoolean(INPUT_WIDEROWS_CONFIG, false);
    // Use the setInputColumnFamily overload that includes a widerows argument; using the overload without this argument forces it false
    ConfigHelper.setInputColumnFamily(config, janusgraphConf.get(AbstractCassandraStoreManager.CASSANDRA_KEYSPACE), mrConf.get(JanusGraphHadoopConfiguration.COLUMN_FAMILY_NAME), wideRows);
    log.debug("Set keyspace: {}", janusgraphConf.get(AbstractCassandraStoreManager.CASSANDRA_KEYSPACE));
    // Set the column slice bounds via Faunus' vertex query filter
    final SlicePredicate predicate = new SlicePredicate();
    final int rangeBatchSize = config.getInt(RANGE_BATCH_SIZE_CONFIG, Integer.MAX_VALUE);
    // TODO stop slicing the whole row
    predicate.setSlice_range(getSliceRange(rangeBatchSize));
    ConfigHelper.setInputSlicePredicate(config, predicate);
}
Also used : SlicePredicate(org.apache.cassandra.thrift.SlicePredicate)

Aggregations

SlicePredicate (org.apache.cassandra.thrift.SlicePredicate)17 ByteBuffer (java.nio.ByteBuffer)5 SliceRange (org.apache.cassandra.thrift.SliceRange)5 ArrayList (java.util.ArrayList)3 CFMetaData (org.apache.cassandra.config.CFMetaData)2 IDiskAtomFilter (org.apache.cassandra.db.filter.IDiskAtomFilter)2 InvalidRequestException (org.apache.cassandra.exceptions.InvalidRequestException)2 IsBootstrappingException (org.apache.cassandra.exceptions.IsBootstrappingException)2 RequestTimeoutException (org.apache.cassandra.exceptions.RequestTimeoutException)2 UnavailableException (org.apache.cassandra.exceptions.UnavailableException)2 ColumnOrSuperColumn (org.apache.cassandra.thrift.ColumnOrSuperColumn)2 Deletion (org.apache.cassandra.thrift.Deletion)2 Mutation (org.apache.cassandra.thrift.Mutation)2 SuperColumn (org.apache.cassandra.thrift.SuperColumn)2 TBinaryProtocol (org.apache.cassandra.thrift.TBinaryProtocol)2 TDeserializer (org.apache.thrift.TDeserializer)2 Bytes.fromByteBuffer (org.scale7.cassandra.pelops.Bytes.fromByteBuffer)2 DataOutputStream (java.io.DataOutputStream)1 IPartitioner (org.apache.cassandra.dht.IPartitioner)1 Token (org.apache.cassandra.dht.Token)1