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


Java CQL3Type类代码示例

本文整理汇总了Java中org.apache.cassandra.cql3.CQL3Type的典型用法代码示例。如果您正苦于以下问题:Java CQL3Type类的具体用法?Java CQL3Type怎么用?Java CQL3Type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: AlterTableStatement

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public AlterTableStatement(CFName name,
                           Type type,
                           ColumnIdentifier.Raw columnName,
                           CQL3Type.Raw validator,
                           TableAttributes attrs,
                           Map<ColumnIdentifier.Raw, ColumnIdentifier.Raw> renames,
                           boolean isStatic)
{
    super(name);
    this.oType = type;
    this.rawColumnName = columnName;
    this.validator = validator; // used only for ADD/ALTER commands
    this.attrs = attrs;
    this.renames = renames;
    this.isStatic = isStatic;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:17,代码来源:AlterTableStatement.java

示例2: CreateFunctionStatement

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public CreateFunctionStatement(FunctionName functionName,
                               String language,
                               String body,
                               List<ColumnIdentifier> argNames,
                               List<CQL3Type.Raw> argRawTypes,
                               CQL3Type.Raw rawReturnType,
                               boolean calledOnNullInput,
                               boolean orReplace,
                               boolean ifNotExists)
{
    this.functionName = functionName;
    this.language = language;
    this.body = body;
    this.argNames = argNames;
    this.argRawTypes = argRawTypes;
    this.rawReturnType = rawReturnType;
    this.calledOnNullInput = calledOnNullInput;
    this.orReplace = orReplace;
    this.ifNotExists = ifNotExists;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:21,代码来源:CreateFunctionStatement.java

示例3: prepare

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
@Override
public Prepared prepare() throws InvalidRequestException
{
    if (Schema.instance.getKSMetaData(functionName.keyspace) != null)
    {
        argTypes = new ArrayList<>(argRawTypes.size());
        for (CQL3Type.Raw rawType : argRawTypes)
        {
            if (rawType.isFrozen())
                throw new InvalidRequestException("The function arguments should not be frozen; remove the frozen<> modifier");

            // UDT are not supported non frozen but we do not allow the frozen keyword for argument. So for the moment we
            // freeze them here
            if (!rawType.canBeNonFrozen())
                rawType.freeze();

            argTypes.add(rawType.prepare(functionName.keyspace).getType());
        }
    }

    return super.prepare();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:23,代码来源:DropFunctionStatement.java

示例4: all

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public static Collection<Function> all()
{
    Collection<Function> functions = new ArrayList<>();

    // because text and varchar ends up being synonymous, our automatic makeToBlobFunction doesn't work
    // for varchar, so we special case it below. We also skip blob for obvious reasons.
    for (CQL3Type type : CQL3Type.Native.values())
    {
        if (type != CQL3Type.Native.VARCHAR && type != CQL3Type.Native.BLOB)
        {
            functions.add(makeToBlobFunction(type.getType()));
            functions.add(makeFromBlobFunction(type.getType()));
        }
    }

    functions.add(VarcharAsBlobFct);
    functions.add(BlobAsVarcharFct);

    return functions;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:21,代码来源:BytesConversionFcts.java

示例5: CreateFunctionStatement

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public CreateFunctionStatement(FunctionName functionName,
                               String language,
                               String body,
                               boolean deterministic,
                               List<ColumnIdentifier> argNames,
                               List<CQL3Type.Raw> argRawTypes,
                               CQL3Type.Raw rawReturnType,
                               boolean orReplace,
                               boolean ifNotExists)
{
    this.functionName = functionName;
    this.language = language;
    this.body = body;
    this.deterministic = deterministic;
    this.argNames = argNames;
    this.argRawTypes = argRawTypes;
    this.rawReturnType = rawReturnType;
    this.orReplace = orReplace;
    this.ifNotExists = ifNotExists;
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:21,代码来源:CreateFunctionStatement.java

示例6: addDefinition

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public void addDefinition(ColumnIdentifier def, CQL3Type.Raw type, boolean isStatic)
{
    definedNames.add(def);
    definitions.put(def, type);
    if (isStatic)
        staticColumns.add(def);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:8,代码来源:CreateTableStatement.java

示例7: add

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public void add(String name, List<String> fieldNames, List<String> fieldTypes)
{
    List<CQL3Type.Raw> rawFieldTypes =
        fieldTypes.stream()
                  .map(CQLTypeParser::parseRaw)
                  .collect(toList());

    definitions.add(new RawUDT(name, fieldNames, rawFieldTypes));
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:10,代码来源:Types.java

示例8: DropAggregateStatement

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public DropAggregateStatement(FunctionName functionName,
                              List<CQL3Type.Raw> argRawTypes,
                              boolean argsPresent,
                              boolean ifExists)
{
    this.functionName = functionName;
    this.argRawTypes = argRawTypes;
    this.argsPresent = argsPresent;
    this.ifExists = ifExists;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:11,代码来源:DropAggregateStatement.java

示例9: prepareType

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
private AbstractType<?> prepareType(String typeName, CQL3Type.Raw rawType)
{
    if (rawType.isFrozen())
        throw new InvalidRequestException(String.format("The function %s should not be frozen; remove the frozen<> modifier", typeName));

    // UDT are not supported non frozen but we do not allow the frozen keyword for argument. So for the moment we
    // freeze them here
    if (!rawType.canBeNonFrozen())
        rawType.freeze();

    AbstractType<?> type = rawType.prepare(functionName.keyspace).getType();
    return type;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:14,代码来源:DropAggregateStatement.java

示例10: prepare

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public Prepared prepare() throws InvalidRequestException
{
    if (new HashSet<>(argNames).size() != argNames.size())
        throw new InvalidRequestException(String.format("duplicate argument names for given function %s with argument names %s",
                                                        functionName, argNames));

    argTypes = new ArrayList<>(argRawTypes.size());
    for (CQL3Type.Raw rawType : argRawTypes)
        argTypes.add(prepareType("arguments", rawType));

    returnType = prepareType("return type", rawReturnType);
    return super.prepare();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:14,代码来源:CreateFunctionStatement.java

示例11: DropFunctionStatement

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public DropFunctionStatement(FunctionName functionName,
                             List<CQL3Type.Raw> argRawTypes,
                             boolean argsPresent,
                             boolean ifExists)
{
    this.functionName = functionName;
    this.argRawTypes = argRawTypes;
    this.argsPresent = argsPresent;
    this.ifExists = ifExists;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:11,代码来源:DropFunctionStatement.java

示例12: getCql3Type

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
private static CQL3Type.Raw getCql3Type(DataType dt) throws Exception {
    CQL3Type.Raw type;
    switch (dt.getName()) {
    case LIST:
        type = CQL3Type.Raw.list(getCql3Type(dt.getTypeArguments().get(0)));
        break;
    case MAP:
        type = CQL3Type.Raw.map(getCql3Type(dt.getTypeArguments().get(0)),
                getCql3Type(dt.getTypeArguments().get(1)));
        break;
    case SET:
        type = CQL3Type.Raw.set(getCql3Type(dt.getTypeArguments().get(0)));
        break;
    case TUPLE:
        ArrayList<CQL3Type.Raw> tupleTypes = new ArrayList<CQL3Type.Raw>();
        for (DataType arg : ((TupleType) dt).getComponentTypes()) {
            tupleTypes.add(getCql3Type(arg));
        }
        type = CQL3Type.Raw.tuple(tupleTypes);
        break;
    case UDT: // Requires this UDT to already be loaded
        UserType udt = (UserType) dt;
        type = CQL3Type.Raw.userType(new UTName(new ColumnIdentifier(udt.getKeyspace(), true),
                new ColumnIdentifier(udt.getTypeName(), true)));
        break;
    default:
        type = CQL3Type.Raw.from(
                Enum.<CQL3Type.Native> valueOf(CQL3Type.Native.class, dt.getName().toString().toUpperCase()));
        break;
    }
    if (dt.isFrozen()) {
        type = CQL3Type.Raw.frozen(type);
    }
    return type;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:36,代码来源:BulkLoader.java

示例13: announceMigration

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public boolean announceMigration(boolean isLocalOnly) throws RequestValidationException
{
    List<AbstractType<?>> argTypes = new ArrayList<>(argRawTypes.size());
    for (CQL3Type.Raw rawType : argRawTypes)
        // We have no proper keyspace to give, which means that this will break (NPE currently)
        // for UDT: #7791 is open to fix this
        argTypes.add(rawType.prepare(null).getType());

    AbstractType<?> returnType = rawReturnType.prepare(null).getType();

    Function old = Functions.find(functionName, argTypes);
    if (old != null)
    {
        if (ifNotExists)
            return false;
        if (!orReplace)
            throw new InvalidRequestException(String.format("Function %s already exists", old));

        // Means we're replacing the function. We still need to validate that 1) it's not a native function and 2) that the return type
        // matches (or that could break existing code badly)
        if (old.isNative())
            throw new InvalidRequestException(String.format("Cannot replace native function %s", old));
        if (!old.returnType().isValueCompatibleWith(returnType))
            throw new InvalidRequestException(String.format("Cannot replace function %s, the new return type %s is not compatible with the return type %s of existing function",
                                                            functionName, returnType.asCQL3Type(), old.returnType().asCQL3Type()));
    }

    MigrationManager.announceNewFunction(UDFunction.create(functionName, argNames, argTypes, returnType, language, body, deterministic), isLocalOnly);
    return true;
}
 
开发者ID:daidong,项目名称:GraphTrek,代码行数:31,代码来源:CreateFunctionStatement.java

示例14: asCQL3Type

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
@Override
public CQL3Type asCQL3Type()
{
    return CQL3Type.Native.TIMESTAMP;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:6,代码来源:DateType.java

示例15: asCQL3Type

import org.apache.cassandra.cql3.CQL3Type; //导入依赖的package包/类
public CQL3Type asCQL3Type()
{
    return CQL3Type.Native.BLOB;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:5,代码来源:BytesType.java


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