本文整理汇总了Java中org.apache.cassandra.cql3.CQL3Type.Raw方法的典型用法代码示例。如果您正苦于以下问题:Java CQL3Type.Raw方法的具体用法?Java CQL3Type.Raw怎么用?Java CQL3Type.Raw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.cql3.CQL3Type
的用法示例。
在下文中一共展示了CQL3Type.Raw方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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();
}
示例4: 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;
}
示例5: 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);
}
示例6: 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));
}
示例7: 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;
}
示例8: 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;
}
示例9: 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();
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
示例13: RawUDT
import org.apache.cassandra.cql3.CQL3Type; //导入方法依赖的package包/类
RawUDT(String name, List<String> fieldNames, List<CQL3Type.Raw> fieldTypes)
{
this.name = name;
this.fieldNames = fieldNames;
this.fieldTypes = fieldTypes;
}
示例14: functionFromCql
import org.apache.cassandra.cql3.CQL3Type; //导入方法依赖的package包/类
/**
* Creates a FunctionResource representing a specific, keyspace-scoped function.
* This variant is used to create an instance during parsing of a CQL statement.
* It includes transposition of the arg types from CQL types to AbstractType
* implementations
*
* @param keyspace the keyspace in which the function is scoped
* @param name name of the function.
* @param argTypes the types of the function arguments in raw CQL form
* @return FunctionResource instance reresenting the function.
*/
public static FunctionResource functionFromCql(String keyspace, String name, List<CQL3Type.Raw> argTypes)
{
List<AbstractType<?>> abstractTypes = new ArrayList<>();
for (CQL3Type.Raw cqlType : argTypes)
abstractTypes.add(cqlType.prepare(keyspace).getType());
return new FunctionResource(keyspace, name, abstractTypes);
}