Package org.apache.cassandra.schema
Class UserFunctions
- java.lang.Object
-
- org.apache.cassandra.schema.UserFunctions
-
- All Implemented Interfaces:
java.lang.Iterable<UserFunction>
public final class UserFunctions extends java.lang.Object implements java.lang.Iterable<UserFunction>
An immutable container for a keyspace's UDAs and UDFs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UserFunctions.Builder
static class
UserFunctions.Filter
static class
UserFunctions.FunctionsDiff<T extends Function>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.stream.Stream<UDAggregate>
aggregatesUsingFunction(Function function)
static UserFunctions.Builder
builder()
boolean
equals(java.lang.Object o)
UserFunctions
filter(java.util.function.Predicate<UserFunction> predicate)
java.util.Optional<UserFunction>
find(FunctionName name, java.util.List<AbstractType<?>> argTypes)
java.util.Optional<UserFunction>
find(FunctionName name, java.util.List<AbstractType<?>> argTypes, UserFunctions.Filter filter)
Find the function with the specified namejava.util.Collection<UserFunction>
get(FunctionName name)
Get all function overloads with the specified namejava.util.Collection<UDAggregate>
getUdas(FunctionName name)
Get all UDAs overloads with the specified namejava.util.Collection<UDFunction>
getUdfs(FunctionName name)
Get all UDFs overloads with the specified nameint
hashCode()
boolean
isEmpty()
java.util.Iterator<UserFunction>
iterator()
static UserFunctions
none()
java.lang.Iterable<UserFunction>
referencingUserType(java.nio.ByteBuffer name)
int
size()
java.util.stream.Stream<UserFunction>
stream()
java.lang.String
toString()
static int
typeHashCode(java.util.List<AbstractType<?>> types)
static int
typeHashCode(AbstractType<?> t)
java.util.stream.Stream<UDAggregate>
udas()
java.util.stream.Stream<UDFunction>
udfs()
UserFunctions
with(UserFunction fun)
Create a Functions instance with the provided function addedUserFunctions
withAddedOrUpdated(UserFunction function)
UserFunctions
without(Function function)
UserFunctions
without(FunctionName name, java.util.List<AbstractType<?>> argTypes)
Creates a Functions instance with the function with the provided name and argument types removedUserFunctions
withUpdatedUserType(UserType udt)
-
-
-
Method Detail
-
builder
public static UserFunctions.Builder builder()
-
none
public static UserFunctions none()
-
iterator
public java.util.Iterator<UserFunction> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<UserFunction>
-
stream
public java.util.stream.Stream<UserFunction> stream()
-
size
public int size()
-
udfs
public java.util.stream.Stream<UDFunction> udfs()
- Returns:
- a stream of keyspace's UDFs
-
udas
public java.util.stream.Stream<UDAggregate> udas()
- Returns:
- a stream of keyspace's UDAs
-
referencingUserType
public java.lang.Iterable<UserFunction> referencingUserType(java.nio.ByteBuffer name)
-
withUpdatedUserType
public UserFunctions withUpdatedUserType(UserType udt)
-
aggregatesUsingFunction
public java.util.stream.Stream<UDAggregate> aggregatesUsingFunction(Function function)
- Parameters:
function
- the referree function- Returns:
- a stream of aggregates that use the provided function as either a state or a final function
-
get
public java.util.Collection<UserFunction> get(FunctionName name)
Get all function overloads with the specified name- Parameters:
name
- fully qualified function name- Returns:
- an empty list if the function name is not found; a non-empty collection of
Function
otherwise
-
getUdfs
public java.util.Collection<UDFunction> getUdfs(FunctionName name)
Get all UDFs overloads with the specified name- Parameters:
name
- fully qualified function name- Returns:
- an empty list if the function name is not found; a non-empty collection of
UDFunction
otherwise
-
getUdas
public java.util.Collection<UDAggregate> getUdas(FunctionName name)
Get all UDAs overloads with the specified name- Parameters:
name
- fully qualified function name- Returns:
- an empty list if the function name is not found; a non-empty collection of
UDAggregate
otherwise
-
find
public java.util.Optional<UserFunction> find(FunctionName name, java.util.List<AbstractType<?>> argTypes)
-
find
public java.util.Optional<UserFunction> find(FunctionName name, java.util.List<AbstractType<?>> argTypes, UserFunctions.Filter filter)
Find the function with the specified name- Parameters:
name
- fully qualified function nameargTypes
- function argument types- Returns:
- an empty
Optional
if the function name is not found; a non-empty optional ofFunction
otherwise
-
isEmpty
public boolean isEmpty()
-
typeHashCode
public static int typeHashCode(AbstractType<?> t)
-
typeHashCode
public static int typeHashCode(java.util.List<AbstractType<?>> types)
-
filter
public UserFunctions filter(java.util.function.Predicate<UserFunction> predicate)
-
with
public UserFunctions with(UserFunction fun)
Create a Functions instance with the provided function added
-
without
public UserFunctions without(FunctionName name, java.util.List<AbstractType<?>> argTypes)
Creates a Functions instance with the function with the provided name and argument types removed
-
without
public UserFunctions without(Function function)
-
withAddedOrUpdated
public UserFunctions withAddedOrUpdated(UserFunction function)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-