当前位置: 首页>>代码示例>>Java>>正文


Java QueryProcessor.resultify方法代码示例

本文整理汇总了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;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:20,代码来源:KSMetaData.java

示例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;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:TriggerDefinition.java

示例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;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:53,代码来源:ColumnDefinition.java


注:本文中的org.apache.cassandra.cql3.QueryProcessor.resultify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。