Hector/Cassandra: How do I add a Column to an existing SuperColumn?

隐身守侯 提交于 2019-12-08 14:26:09

问题


I can create a new SuperColumn that has Columns - no problem. I can create a new Column - no problem. But how do I add a new Column to an existing SuperColumn?


回答1:


But how do I add a new Column to an existing SuperColumn?

You should really look into the class SuperCfTemplate and class SuperCfUpdater in hector. Once they are initialize, do what is needed (example in your question, add a new cf within this scf), then update the changes using the template. Below are a snippet.

SuperCfTemplate<String, String, String> template = new ThriftSuperCfTemplate<String, String, String>(keyspace, "Super1", stringSerializer, stringSerializer, stringSerializer);
SuperCfUpdater<String, String, String> updater = template.createUpdater("key", "newcf");
updater.setString("subname", "1");
template.update(updater);


来源:https://stackoverflow.com/questions/10047346/hector-cassandra-how-do-i-add-a-column-to-an-existing-supercolumn

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!