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


Java ColumnIdentifier.getInterned方法代码示例

本文整理汇总了Java中org.apache.cassandra.cql3.ColumnIdentifier.getInterned方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnIdentifier.getInterned方法的具体用法?Java ColumnIdentifier.getInterned怎么用?Java ColumnIdentifier.getInterned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.cql3.ColumnIdentifier的用法示例。


在下文中一共展示了ColumnIdentifier.getInterned方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIdentifier

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
public ColumnIdentifier getIdentifier(CFMetaData cfm)
{
    if (!cfm.isStaticCompactTable())
        return ColumnIdentifier.getInterned(text, true);

    AbstractType<?> thriftColumnNameType = cfm.thriftColumnNameType();
    if (thriftColumnNameType instanceof UTF8Type)
        return ColumnIdentifier.getInterned(text, true);

    // We have a Thrift-created table with a non-text comparator. Check if we have a match column, otherwise assume we should use
    // thriftColumnNameType
    ByteBuffer bufferName = ByteBufferUtil.bytes(text);
    for (ColumnDefinition def : cfm.allColumns())
    {
        if (def.name.bytes.equals(bufferName))
            return def.name;
    }
    return ColumnIdentifier.getInterned(thriftColumnNameType, thriftColumnNameType.fromString(text), text);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:20,代码来源:ColumnDefinition.java

示例2: ColumnDefinition

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
public ColumnDefinition(CFMetaData cfm, ByteBuffer name, AbstractType<?> type, int position, Kind kind)
{
    this(cfm.ksName,
         cfm.cfName,
         ColumnIdentifier.getInterned(name, cfm.getColumnDefinitionNameComparator(kind)),
         type,
         position,
         kind);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:10,代码来源:ColumnDefinition.java

示例3: getColumnSpecification

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
/**
 * Returns the column specification corresponding to the output value of the selector instances created by
 * this factory.
 *
 * @param cfm the column family meta data
 * @return a column specification
 */
public final ColumnSpecification getColumnSpecification(CFMetaData cfm)
{
    return new ColumnSpecification(cfm.ksName,
                                   cfm.cfName,
                                   ColumnIdentifier.getInterned(getColumnName(), true),
                                   getReturnType());
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:Selector.java

示例4: createDefinitionFromRow

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
private static ColumnDefinition createDefinitionFromRow(Row row, String keyspace, String table, Types types)
{
    ColumnIdentifier name = ColumnIdentifier.getInterned(row.getBytes("column_name_bytes"), row.getString("column_name"));

    ClusteringOrder order = ClusteringOrder.valueOf(row.getString("clustering_order").toUpperCase());
    AbstractType<?> type = CQLTypeParser.parse(keyspace, row.getString("type"), types);
    if (order == ClusteringOrder.DESC)
        type = ReversedType.getInstance(type);

    int position = row.getInt("position");
    ColumnDefinition.Kind kind = ColumnDefinition.Kind.valueOf(row.getString("kind").toUpperCase());
    return new ColumnDefinition(keyspace, table, name, type, position, kind);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:14,代码来源:NativeSSTableLoaderClient.java

示例5: fromThrift

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
public static ColumnDefinition fromThrift(String ksName,
                                          String cfName,
                                          AbstractType<?> thriftComparator,
                                          AbstractType<?> thriftSubcomparator,
                                          ColumnDef thriftColumnDef)
throws SyntaxException, ConfigurationException
{
    boolean isSuper = thriftSubcomparator != null;
    // For super columns, the componentIndex is 1 because the ColumnDefinition applies to the column component.
    AbstractType<?> comparator = thriftSubcomparator == null ? thriftComparator : thriftSubcomparator;
    try
    {
        comparator.validate(thriftColumnDef.name);
    }
    catch (MarshalException e)
    {
        throw new ConfigurationException(String.format("Column name %s is not valid for comparator %s", ByteBufferUtil.bytesToHex(thriftColumnDef.name), comparator));
    }

    // In our generic layout, we store thrift defined columns as static, but this doesn't work for super columns so we
    // use a regular definition (and "dynamic" columns are handled in a map).
    ColumnDefinition.Kind kind = isSuper ? ColumnDefinition.Kind.REGULAR : ColumnDefinition.Kind.STATIC;
    return new ColumnDefinition(ksName,
                                cfName,
                                ColumnIdentifier.getInterned(ByteBufferUtil.clone(thriftColumnDef.name), comparator),
                                TypeParser.parse(thriftColumnDef.validation_class),
                                ColumnDefinition.NO_POSITION,
                                kind);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:30,代码来源:ThriftConversion.java

示例6: createColumnFromColumnRow

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
private static ColumnDefinition createColumnFromColumnRow(UntypedResultSet.Row row,
                                                          String keyspace,
                                                          String table,
                                                          AbstractType<?> rawComparator,
                                                          AbstractType<?> rawSubComparator,
                                                          boolean isSuper,
                                                          boolean isCQLTable,
                                                          boolean isStaticCompactTable,
                                                          boolean needsUpgrade)
{
    String rawKind = row.getString("type");

    ColumnDefinition.Kind kind = deserializeKind(rawKind);
    if (needsUpgrade && isStaticCompactTable && kind == ColumnDefinition.Kind.REGULAR)
        kind = ColumnDefinition.Kind.STATIC;

    int componentIndex = ColumnDefinition.NO_POSITION;
    // Note that the component_index is not useful for non-primary key parts (it never really in fact since there is
    // no particular ordering of non-PK columns, we only used to use it as a simplification but that's not needed
    // anymore)
    if (kind.isPrimaryKeyKind())
        // We use to not have a component index when there was a single partition key, we don't anymore (#10491)
        componentIndex = row.has("component_index") ? row.getInt("component_index") : 0;

    // Note: we save the column name as string, but we should not assume that it is an UTF8 name, we
    // we need to use the comparator fromString method
    AbstractType<?> comparator = isCQLTable
                                 ? UTF8Type.instance
                                 : CompactTables.columnDefinitionComparator(rawKind, isSuper, rawComparator, rawSubComparator);
    ColumnIdentifier name = ColumnIdentifier.getInterned(comparator.fromString(row.getString("column_name")), comparator);

    AbstractType<?> validator = parseType(row.getString("validator"));

    return new ColumnDefinition(keyspace, table, name, validator, componentIndex, kind);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:36,代码来源:LegacySchemaMigrator.java

示例7: fakeColumn

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
private static ColumnDefinition fakeColumn(String name, AbstractType<?> type)
{
    return new ColumnDefinition(fakeMetadata.ksName,
                                fakeMetadata.cfName,
                                ColumnIdentifier.getInterned(name, false),
                                type,
                                ColumnDefinition.NO_POSITION,
                                ColumnDefinition.Kind.REGULAR);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:CellTest.java

示例8: integerColumn

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
public static ColumnDefinition integerColumn(String ksName, String cfName)
{
    return new ColumnDefinition(ksName,
                                cfName,
                                ColumnIdentifier.getInterned(IntegerType.instance.fromString("42"), IntegerType.instance),
                                UTF8Type.instance,
                                ColumnDefinition.NO_POSITION,
                                ColumnDefinition.Kind.REGULAR);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:SchemaLoader.java

示例9: utf8Column

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
public static ColumnDefinition utf8Column(String ksName, String cfName)
{
    return new ColumnDefinition(ksName,
                                cfName,
                                ColumnIdentifier.getInterned("fortytwo", true),
                                UTF8Type.instance,
                                ColumnDefinition.NO_POSITION,
                                ColumnDefinition.Kind.REGULAR);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:SchemaLoader.java

示例10: partitionKeyDef

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
public static ColumnDefinition partitionKeyDef(String ksName, String cfName, String name, AbstractType<?> type, int position)
{
    return new ColumnDefinition(ksName, cfName, ColumnIdentifier.getInterned(name, true), type, position, Kind.PARTITION_KEY);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:ColumnDefinition.java

示例11: clusteringDef

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
public static ColumnDefinition clusteringDef(String ksName, String cfName, String name, AbstractType<?> type, int position)
{
    return new ColumnDefinition(ksName, cfName, ColumnIdentifier.getInterned(name, true),  type, position, Kind.CLUSTERING);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:ColumnDefinition.java

示例12: regularDef

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
public static ColumnDefinition regularDef(String ksName, String cfName, String name, AbstractType<?> type)
{
    return new ColumnDefinition(ksName, cfName, ColumnIdentifier.getInterned(name, true), type, NO_POSITION, Kind.REGULAR);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:ColumnDefinition.java

示例13: indexTarget

import org.apache.cassandra.cql3.ColumnIdentifier; //导入方法依赖的package包/类
private static IndexTarget indexTarget(String name, IndexTarget.Type type)
{
    return new IndexTarget(ColumnIdentifier.getInterned(name, true), type);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:5,代码来源:CustomIndexTest.java


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