Am using hector java client for cassandra. Using Java how can i check whether particular column Name in column family exists or not?

有帮助吗?

解决方案

I think you have to attempt to retrieve the column. If this succeeds, then the column exists. If not, then it doesn't.

From the user guide:

ColumnQuery<String, String, String> columnQuery =
    HFactory.createStringColumnQuery(keyspace);
columnQuery.setColumnFamily("Standard1").setKey("jsmith").setName("first");
QueryResult<HColumn<String, String>> result = columnQuery.execute();

If your column values are very large, and you don't want to retrieve them like this, then one trick is to store a small 'companion' column that indicates the presence of the large column.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top