incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "cbertu81@libero.it" <cbert...@libero.it>
Subject R: Indexes on Columns & SubColumns Clarification
Date Thu, 04 Nov 2010 22:22:21 GMT
In each family, both CF and SCF, data are grouped by rows.

Just to give an idea ...

Super Column Family Name{
           Row 1  {
                    SuperColumn1 { Column1 Key: Column1 Value ... ColumnN Key: 
ColumnN Value}
                    SuperColumn2 { Column1 Key: Column1 Value, ColumnN Key: 
ColumnN Value}
            }
           Row N  {
                    SuperColumn1 { Column1 Key: Column1 Value ... ColumnN Key: 
ColumnN Value}
                    SuperColumn2 { Column1 Key: Column1 Value ... ColumnN Key: 
ColumnN Value}
                    SuperColumn3 { Column1 Key: Column1 Value ... ColumnN Key: 
ColumnN Value}
            }
}

Column Family Name {
             Row1 {
                    Column1 Key: Column1 Value
                    .....
                    ColumnN Key: ColumnN Value
             }
             RowN {
                    Column1 Key: Column1 Value
                    .....
                    ColumnN Key: ColumnN Value
             }
}

Your representation looks like a SCF ... 

detailed_log: { // supercolumnfamily 
	username : { // row
		uuid // supercolumn identifier { 
			{ price : 100 } // column price
			{ min	: 10 } column min
			{ max : 500 }, // column max
		}
		uuid // supercolumn identifier { 
			{ price : 100 } // column price
			{ min	: 10 } column min
			{ max : 500 }, // column max
		}               
	}
}

detailed_log can contains from 0 to N rows and each row can contain from 0 to 
N SuperColumns. Each SuperColumn can contain from 0 to N columns.

>SELECT * FROM detailed_log WHERE username = 'foobar' AND uuid RANGE(
>start_UUID -> end_UUID );

I would say in Pelops (java) Client i Use is something like this ...

.... getSuperColumnsFromRow(/**
	 * Retrieve super columns from a row
	 * @param rowKey                        The key of the row
	 * @param columnFamily                  The name of the column family 
containing the super columns
	 * @param colPredicate                  The super column selector predicate
	 * @param cLevel                        The Cassandra consistency level with 
which to perform the operation
	 * @return                              A list of matching columns
 */)

List<SuperColumn> result = selector.getSuperColumnsFromRow(username,"
detailed_log", Selector.newColumnsPredicateAll(false, howmany), 
ConsistencyLevel.ONE);
This will retrieve "howmany" SuperColumns, sorted by your Storage Conf sorting 
definition, from the row username.

Hope this helps.

Best Regards

Carlo

Mime
View raw message