A frequently used case with Cassandra stores data in the column names of a dynamically created column family. In this situation, the string values themselves are not needed, and it is common practice to store zeros there. However, when dealing with Hector, there seems to be no way to insert a null value because Hector HColumnImpl does an explicit null check in the column constructor:
public HColumnImpl(N name, V value, long clock, Serializer<N> nameSerializer, Serializer<V> valueSerializer) { this(nameSerializer, valueSerializer); notNull(name, "name is null"); notNull(value, "value is null"); this.column = new Column(nameSerializer.toByteBuffer(name)); this.column.setValue(valueSerializer.toByteBuffer(value)); this.column.setTimestamp(clock); }
Are there any ways to insert zeros through Hector? If not, what is the best practice in a situation where you don't need column values and only their names are needed?
source share