public class StringShardStrategy extends Object implements ShardStrategy<String,String>
String
type column names into several row keys
based on the first char (lower-case converted) of the String
value.
Examples:
Prefix | Column Name | Sharded Row Key |
---|---|---|
my_prefix | Hello World | my_prefix_h |
my_prefix | hello world | my_prefix_h |
Null | Hello World | h |
Empty | Hello World | h |
Constructor and Description |
---|
StringShardStrategy()
Creates a shard strategy.
|
StringShardStrategy(String rowKeyPrefix)
Creates a shard strategy.
|
Modifier and Type | Method and Description |
---|---|
String |
getRowKey(String columnName)
Gets the row key to be used for the given column name.
|
public StringShardStrategy()
public StringShardStrategy(String rowKeyPrefix)
rowKeyPrefix
- row key prefix.public String getRowKey(String columnName)
ShardStrategy
getRowKey
in interface ShardStrategy<String,String>
columnName
- column name to fins a sharded key for. This could be
part of the column name if the shard strategy is applied to a
single component of a composite column name.Copyright © 2016. All Rights Reserved.