Git Product home page Git Product logo

hector-examples's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

hector-examples's Issues

SchemaManipulation.java doesn't create secondary index

After running SchemaManipulation this is the output from cassandra-cli (show keyspaces)

Keyspace: DynamicKeyspace:
Replication Strategy: org.apache.cassandra.locator.SimpleStrategy
Durable Writes: true
Options: [replication_factor:1]
Column Families:
ColumnFamily: DynamicCf
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.BytesType
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 0.0/0
Memtable thresholds: 0.26718749999999997/1440/57 (millions of ops/minutes/MB)
GC grace seconds: 0
Compaction min/max thresholds: 4/32
Read repair chance: 0.0
Replicate on write: false
Built indexes: []
Column Metadata:
Column Name: birthdate (626972746864617465)
Validation Class: org.apache.cassandra.db.marshal.LongType
ColumnFamily: SuperCf (Super)
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.BytesType/org.apache.cassandra.db.marshal.BytesType
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 0.0/0
Memtable thresholds: 0.26718749999999997/1440/57 (millions of ops/minutes/MB)
GC grace seconds: 0
Compaction min/max thresholds: 4/32
Read repair chance: 0.0
Replicate on write: false
Built indexes: []

Compared with the Keyspace created by the Riptano documentation example

Keyspace: demo:
Replication Strategy: org.apache.cassandra.locator.NetworkTopologyStrategy
Durable Writes: true
Options: [datacenter1:1]
Column Families:
ColumnFamily: users
Key Validation Class: org.apache.cassandra.db.marshal.BytesType
Default column value validator: org.apache.cassandra.db.marshal.BytesType
Columns sorted by: org.apache.cassandra.db.marshal.UTF8Type
Row cache size / save period in seconds: 0.0/0
Key cache size / save period in seconds: 200000.0/14400
Memtable thresholds: 0.5484375/1440/117 (millions of ops/minutes/MB)
GC grace seconds: 864000
Compaction min/max thresholds: 4/32
Read repair chance: 1.0
Replicate on write: true
Built indexes: [users.users_birth_date_idx]
Column Metadata:
Column Name: birth_date
Validation Class: org.apache.cassandra.db.marshal.LongType
Index Name: users_birth_date_idx
Index Type: KEYS
Column Name: full_name
Validation Class: org.apache.cassandra.db.marshal.UTF8Type
Keyspace: system:

read a single row

Hi am new to cassandra 0.7. could u able to clear my doubt???

This is my code for read a single row

public class Read1Column
{
private static StringSerializer stringSerializer = StringSerializer.get();
private static DoubleSerializer doubtSerializer = DoubleSerializer.get();
public static void main(String[] args) throws Exception {

          String keyspaceName = "User";
          String columnFamilyName ="User_Details";
          String serverAddress = "localhost:9160";
          //String username="stu1";
          String Uid="0001";
          // String FirstName="ss";
         // String LastName="kk";
         // String EMail="sksk";
         String password="ssss";      
    // Create a cluster
          Cluster cluster = HFactory.getOrCreateCluster("TestCluster", serverAddress);            
          Keyspace keyspaceOperator = HFactory.createKeyspace(keyspaceName, cluster);


            try{

                Iterator<SuperRow<String, String, String, Double>> rowIter =
                    HFactory.createRangeSuperSlicesQuery(keyspaceOperator,
                            stringSerializer, stringSerializer, stringSerializer,
                            doubtSerializer)
                                        .setColumnFamily(columnFamilyName)
                                        .setKeys(Uid,password)
                                        .setRange(Uid, password, false, 40)
                                        .execute()
                                        .get()
                                        .iterator();

                    while (rowIter.hasNext()) {

                                    SuperRow<String, String, String, Double> row =
                    rowIter.next();

                                    List<HSuperColumn<String, String, Double>> scList =
                    row.getSuperSlice().getSuperColumns();

                                    for (int i=0; i<scList.size(); i++) {
                                             HSuperColumn<String, String, Double> sc =
                    scList.get(i);
                                            // Double val = sc.get(2).getValue(); 
                            // gets the value of column 2 within the supercolumn
                                             System.out.println(sc.get(2).getValue());

                                    }
                    }


            } catch (HectorException e) {
                e.printStackTrace();
            }
          //  client.getConnectionManager().shutdown();
        }

}

its show the error:

log4j:WARN No appenders could be found for logger (me.prettyprint.cassandra.connection.CassandraHostRetryService).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NullPointerException: Null not allowed, number 1
at me.prettyprint.cassandra.utils.Assert.noneNull(Assert.java:25)
at me.prettyprint.cassandra.model.HSuperColumnImpl.(HSuperColumnImpl.java:58)
at me.prettyprint.cassandra.model.SuperSliceImpl.(SuperSliceImpl.java:35)
at me.prettyprint.cassandra.model.SuperRowImpl.(SuperRowImpl.java:34)
at me.prettyprint.cassandra.model.SuperRowsImpl.(SuperRowsImpl.java:35)
at me.prettyprint.cassandra.model.OrderedSuperRowsImpl.(OrderedSuperRowsImpl.java:28)
at me.prettyprint.cassandra.model.thrift.ThriftRangeSuperSlicesQuery$1.doInKeyspace(ThriftRangeSuperSlicesQuery.java:73)
at me.prettyprint.cassandra.model.thrift.ThriftRangeSuperSlicesQuery$1.doInKeyspace(ThriftRangeSuperSlicesQuery.java:67)
at me.prettyprint.cassandra.model.KeyspaceOperationCallback.doInKeyspaceAndMeasure(KeyspaceOperationCallback.java:20)
at me.prettyprint.cassandra.model.ExecutingKeyspace.doExecute(ExecutingKeyspace.java:65)
at me.prettyprint.cassandra.model.thrift.ThriftRangeSuperSlicesQuery.execute(ThriftRangeSuperSlicesQuery.java:66)
at Read1Column.main(Read1Column.java:40)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.