C
- type of the row key in the main column family. Such row key will
be the column name in the secondary index column.D
- type of the denormalized data. Data to set as the value in the
indexed columns.public interface Denormalizer<C extends Serializable & Comparable<C>,D>
When a column family is created to keep custom secondary indexes, the row
key in such column family would typically be a value of the indexed column
and the column names would be the row keys in the main column family that
has such value set. Denormalizer
is used to include more data in
the secondary index column family so it is available in a single read.
Examples:
column_family_secondary_index { "indexed_value_1": { id_i: <data provided by the denormalizer>, ... id_j: <data provided by the denormalizer>, } "indexed_value_2": { id_m: <data provided by the denormalizer>, ... id_n: <data provided by the denormalizer>, } } column_family_persons_by_status { "Single": { person_id_i: <Name, Last Name>, ... person_id_j: <Name, Last Name>, } "Married": { person_id_m: <Name, Last Name>, ... person_id_n: <Name, Last Name>, } }If the columns need to be sorted by a different attribute the attribute is included as part of the column name (composite column name). This does not affect the denormalizer.
Example:
column_family_persons_by_status_sorted_by_last_name_and_name { "Single": { <last_name_i, name_i, person_id_i>: <Birthdate_i>, ... <last_name_j, name_j, person_id_j>: <Birthdate_j>, } "Married": { <last_name_m, name_m, person_id_m>: <Birthdate_m>, ... <last_name_n, name_n, person_id_n>: <Birthdate_n>, } }
Modifier and Type | Method and Description |
---|---|
Column<C,D> |
getColumn(ColumnName<C,D> name,
D value)
Creates an indexed column with denormalized data.
|
ColumnDecoder<C,D> |
getColumnDecoder()
Gets the column decoder.
|
Column<C,D> getColumn(ColumnName<C,D> name, D value)
name
- indexed column name.value
- denormalized data.ColumnDecoder<C,D> getColumnDecoder()
Copyright © 2015. All Rights Reserved.