本文整理汇总了Java中org.apache.cassandra.cql3.QueryProcessor.resultify方法的典型用法代码示例。如果您正苦于以下问题:Java QueryProcessor.resultify方法的具体用法?Java QueryProcessor.resultify怎么用?Java QueryProcessor.resultify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.cql3.QueryProcessor
的用法示例。
在下文中一共展示了QueryProcessor.resultify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deserializeColumnFamilies
import org.apache.cassandra.cql3.QueryProcessor; //导入方法依赖的package包/类
/**
* Deserialize ColumnFamilies from low-level schema representation, all of them belong to the same keyspace
*
* @return map containing name of the ColumnFamily and it's metadata for faster lookup
*/
public static Map<String, CFMetaData> deserializeColumnFamilies(Row row)
{
if (row.cf == null)
return Collections.emptyMap();
Map<String, CFMetaData> cfms = new HashMap<>();
UntypedResultSet results = QueryProcessor.resultify("SELECT * FROM system.schema_columnfamilies", row);
for (UntypedResultSet.Row result : results)
{
CFMetaData cfm = CFMetaData.fromSchema(result);
cfms.put(cfm.cfName, cfm);
}
return cfms;
}
示例2: fromSchema
import org.apache.cassandra.cql3.QueryProcessor; //导入方法依赖的package包/类
/**
* Deserialize triggers from storage-level representation.
*
* @param serializedTriggers storage-level partition containing the trigger definitions
* @return the list of processed TriggerDefinitions
*/
public static List<TriggerDefinition> fromSchema(Row serializedTriggers)
{
List<TriggerDefinition> triggers = new ArrayList<>();
String query = String.format("SELECT * FROM %s.%s", Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_TRIGGERS_CF);
for (UntypedResultSet.Row row : QueryProcessor.resultify(query, serializedTriggers))
{
String name = row.getString(TRIGGER_NAME);
String classOption = row.getMap(TRIGGER_OPTIONS, UTF8Type.instance, UTF8Type.instance).get(CLASS);
triggers.add(new TriggerDefinition(name, classOption));
}
return triggers;
}
示例3: fromSchema
import org.apache.cassandra.cql3.QueryProcessor; //导入方法依赖的package包/类
/**
* Deserialize columns from storage-level representation
*
* @param serializedColumns storage-level partition containing the column definitions
* @return the list of processed ColumnDefinitions
*/
public static List<ColumnDefinition> fromSchema(Row serializedColumns, CFMetaData cfm)
{
List<ColumnDefinition> cds = new ArrayList<>();
String query = String.format("SELECT * FROM %s.%s", Keyspace.SYSTEM_KS, SystemKeyspace.SCHEMA_COLUMNS_CF);
for (UntypedResultSet.Row row : QueryProcessor.resultify(query, serializedColumns))
{
Type type = row.has(TYPE)
? Enum.valueOf(Type.class, row.getString(TYPE).toUpperCase())
: Type.REGULAR;
Integer componentIndex = null;
if (row.has(COMPONENT_INDEX))
componentIndex = row.getInt(COMPONENT_INDEX);
else if (type == Type.CLUSTERING_KEY && cfm.isSuper())
componentIndex = 1; // A ColumnDefinition for super columns applies to the column component
ByteBuffer name = cfm.getComponentComparator(componentIndex, type).fromString(row.getString(COLUMN_NAME));
AbstractType<?> validator;
try
{
validator = TypeParser.parse(row.getString(VALIDATOR));
}
catch (RequestValidationException e)
{
throw new RuntimeException(e);
}
IndexType indexType = null;
if (row.has(INDEX_TYPE))
indexType = IndexType.valueOf(row.getString(INDEX_TYPE));
Map<String, String> indexOptions = null;
if (row.has(INDEX_OPTIONS))
indexOptions = FBUtilities.fromJsonMap(row.getString(INDEX_OPTIONS));
String indexName = null;
if (row.has(INDEX_NAME))
indexName = row.getString(INDEX_NAME);
cds.add(new ColumnDefinition(name, validator, indexType, indexOptions, indexName, componentIndex, type));
}
return cds;
}