Я уже создал схему следующим образом: -Обновление схемы в Cassandra с помощью Гектор API
create column family Customer_detail_21
with column_type = 'Standard'
and comparator = 'UTF8Type'
and default_validation_class = 'UTF8Type'
and key_validation_class = 'UTF8Type'
and rows_cached = 0.0
and row_cache_save_period = 0
and row_cache_keys_to_save = 0
and keys_cached = 0.0
and key_cache_save_period = 0
and read_repair_chance = 0.0
and gc_grace = 0
and min_compaction_threshold = 4
and max_compaction_threshold = 32
and replicate_on_write = false
and row_cache_provider = 'ConcurrentLinkedHashCacheProvider'
and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
and column_metadata = [
{column_name : 'name',
validation_class : UTF8Type,
index_name : 'index_name_27',
index_type : 0,
}];
Но когда я обновил выше схему через следующий ниже код Java: -
public static void updateSchema() {
System.out.println("Update Schema");
ColumnFamilyDefinition familyDefinition = new ThriftCfDef(
getColumnFamilyDefinition("Customer_detail_21"));
if (familyDefinition != null) {
if (!isColumnPresent(familyDefinition)) {
BasicColumnDefinition columnDefinition = new BasicColumnDefinition();
columnDefinition.setName(StringSerializer.get().toByteBuffer(
"pincode"));
columnDefinition.setValidationClass(ComparatorType.INTEGERTYPE
.getClassName());
columnDefinition.setIndexName("index_pincode_66");
columnDefinition.setIndexType(ColumnIndexType.KEYS);
familyDefinition.addColumnDefinition(columnDefinition);
cluster.updateColumnFamily(familyDefinition, true);
}
}
}
I получил схему, как показано ниже: -
create column family Customer_detail_21
with column_type = 'Standard'
and comparator = 'UTF8Type'
and default_validation_class = 'UTF8Type'
and key_validation_class = 'UTF8Type'
and rows_cached = 0.0
and row_cache_save_period = 0
and row_cache_keys_to_save = 0
and keys_cached = 0.0
and key_cache_save_period = 0
and read_repair_chance = 0.0
and gc_grace = 0
and min_compaction_threshold = 4
and max_compaction_threshold = 32
and replicate_on_write = false
and row_cache_provider = 'ConcurrentLinkedHashCacheProvider'
and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
and column_metadata = [
{column_name : '',
validation_class : UTF8Type,
index_name : 'index_name_26',
index_type : 0,
},
{column_name : 'pincode',
validation_class : IntegerType,
index_name : 'index_pincode_65',
index_type : 0,
}];
В соответствии с вышеприведенным результатом мой предыдущий столбец name = 'name' теперь обновляется ted как column name = empty.
так почему старое имя столбца становится пустым после обновления.