/** * Find the function with the specified name * * @param name fully qualified function name * @param argTypes function argument types * @return an empty {@link Optional} if the function name is not found; a non-empty optional of {@link Function} otherwise */ public Optional<Function> find(FunctionName name, List<AbstractType<?>> argTypes) { return get(name).stream() .filter(fun -> typesMatch(fun.argTypes(), argTypes)) .findAny(); }
/** * Find the function with the specified name * * @param name fully qualified function name * @param argTypes function argument types * @return an empty {@link Optional} if the function name is not found; a non-empty optional of {@link Function} otherwise */ public Optional<Function> find(FunctionName name, List<AbstractType<?>> argTypes) { return get(name).stream() .filter(fun -> typesMatch(fun.argTypes(), argTypes)) .findAny(); }
/** * Find the function with the specified name * * @param name fully qualified function name * @param argTypes function argument types * @return an empty {@link Optional} if the function name is not found; a non-empty optional of {@link Function} otherwise */ public Optional<Function> find(FunctionName name, List<AbstractType<?>> argTypes) { return get(name).stream() .filter(fun -> typesMatch(fun.argTypes(), argTypes)) .findAny(); }
public Selector.Factory newSelectorFactory(CFMetaData cfm, AbstractType<?> expectedType, List<ColumnDefinition> defs, VariableSpecifications boundNames) { SelectorFactories factories = SelectorFactories.createFactoriesAndCollectColumnDefinitions(args, function.argTypes(), cfm, defs, boundNames); return AbstractFunctionSelector.newFactory(function, factories); }
public Selector.Factory newSelectorFactory(CFMetaData cfm, AbstractType<?> expectedType, List<ColumnDefinition> defs, VariableSpecifications boundNames) { SelectorFactories factories = SelectorFactories.createFactoriesAndCollectColumnDefinitions(args, function.argTypes(), cfm, defs, boundNames); return AbstractFunctionSelector.newFactory(function, factories); }
public static ColumnSpecification makeArgSpec(String receiverKs, String receiverCf, Function fun, int i) { return new ColumnSpecification(receiverKs, receiverCf, new ColumnIdentifier("arg" + i + '(' + fun.name().toString().toLowerCase() + ')', true), fun.argTypes().get(i)); }
public static FunctionExecutionException create(Function function, Throwable cause) { List<String> cqlTypes = AbstractType.asCQLTypeStringList(function.argTypes()); FunctionExecutionException fee = new FunctionExecutionException(function.name(), cqlTypes, cause.toString()); fee.initCause(cause); return fee; }
public static ColumnSpecification makeArgSpec(String receiverKs, String receiverCf, Function fun, int i) { return new ColumnSpecification(receiverKs, receiverCf, new ColumnIdentifier("arg" + i + '(' + fun.name().toString().toLowerCase() + ')', true), fun.argTypes().get(i)); }
public static FunctionExecutionException create(Function function, Throwable cause) { List<String> cqlTypes = AbstractType.asCQLTypeStringList(function.argTypes()); FunctionExecutionException fee = new FunctionExecutionException(function.name(), cqlTypes, cause.toString()); fee.initCause(cause); return fee; }
public static FunctionExecutionException create(Function function, Throwable cause) { List<String> cqlTypes = AbstractType.asCQLTypeStringList(function.argTypes()); FunctionExecutionException fee = new FunctionExecutionException(function.name(), cqlTypes, cause.toString()); fee.initCause(cause); return fee; }
public static FunctionExecutionException create(Function function, Throwable cause) { List<String> cqlTypes = AbstractType.asCQLTypeStringList(function.argTypes()); FunctionExecutionException fee = new FunctionExecutionException(function.name(), cqlTypes, cause.toString()); fee.initCause(cause); return fee; }
public static ColumnSpecification makeArgSpec(String receiverKs, String receiverCf, Function fun, int i) { return new ColumnSpecification(receiverKs, receiverCf, new ColumnIdentifier("arg" + i + '(' + fun.name().toString().toLowerCase() + ')', true), fun.argTypes().get(i)); }
/** * Create a Functions instance with the provided function added */ public Functions with(Function fun) { if (find(fun.name(), fun.argTypes()).isPresent()) throw new IllegalStateException(String.format("Function %s already exists", fun.name())); return builder().add(this).add(fun).build(); }
/** * Create a Functions instance with the provided function added */ public Functions with(Function fun) { if (find(fun.name(), fun.argTypes()).isPresent()) throw new IllegalStateException(String.format("Function %s already exists", fun.name())); return builder().add(this).add(fun).build(); }
/** * Create a Functions instance with the provided function added */ public Functions with(Function fun) { if (find(fun.name(), fun.argTypes()).isPresent()) throw new IllegalStateException(String.format("Function %s already exists", fun.name())); return builder().add(this).add(fun).build(); }
public void checkAccess(ClientState state) throws UnauthorizedException, InvalidRequestException { Function function = findFunction(); if (function == null) { if (!ifExists) throw new InvalidRequestException(String.format("Unconfigured function %s.%s(%s)", functionName.keyspace, functionName.name, Joiner.on(",").join(argRawTypes))); } else { state.ensureHasPermission(Permission.DROP, FunctionResource.function(function.name().keyspace, function.name().name, function.argTypes())); } }
public void ensureHasPermission(Permission permission, Function function) { // Save creating a FunctionResource is we don't need to if (!DatabaseDescriptor.getAuthorizer().requireAuthorization()) return; // built in functions are always available to all if (function.isNative()) return; checkPermissionOnResourceChain(permission, FunctionResource.function(function.name().keyspace, function.name().name, function.argTypes())); }
public void ensureHasPermission(Permission permission, Function function) { // Save creating a FunctionResource is we don't need to if (!DatabaseDescriptor.getAuthorizer().requireAuthorization()) return; // built in functions are always available to all if (function.isNative()) return; checkPermissionOnResourceChain(permission, FunctionResource.function(function.name().keyspace, function.name().name, function.argTypes())); }
public Selector.Factory newSelectorFactory(CFMetaData cfm, AbstractType<?> expectedType, List<ColumnDefinition> defs, VariableSpecifications boundNames) { SelectorFactories factories = SelectorFactories.createFactoriesAndCollectColumnDefinitions(args, function.argTypes(), cfm, defs, boundNames); //lookup first for generic function taking arbitrary types Function fun = GenericFunctionRegistry.getInstance(function.name(), factories.getReturnTypes()); if (fun == null) fun = FunctionResolver.get(cfm.ksName, function.name(), args, cfm.ksName, cfm.cfName, null); if (fun == null) throw new InvalidRequestException(String.format("Unknown function '%s'", function.name())); if (fun.returnType() == null) throw new InvalidRequestException(String.format("Unknown function %s called in selection clause", function.name())); return AbstractFunctionSelector.newFactory(function, factories); }
public void ensureHasPermission(Permission permission, Function function) { // Save creating a FunctionResource is we don't need to if (!DatabaseDescriptor.getAuthorizer().requireAuthorization()) return; // built in functions are always available to all if (function.isNative()) return; checkPermissionOnResourceChain(permission, FunctionResource.function(function.name().keyspace, function.name().name, function.argTypes())); }