“In this short tutorial, we will discuss how you can view all the user-defined functions, aggregates and user types in your server.”
Let us explore.
Keep in mind that we do not cover the process of creating User-Defined Functions, Aggregates or user types in this tutorial. If you wish to learn more about that, check out our tutorials on the topics to learn more.
Cassandra Fetch User-Defined Functions
To show all the User-Defined Functions in Cassandra, fetch all the records in the system_schema.functions table as shown:
This should return the details about the function definitions as shown in the example below:
----------------------+-------------------------------------------------------------------
keyspace_name | zero_day
function_name | log_func
argument_types | ['double']
argument_names | ['input']
body | return Double.valueOf(Math.log(input.doubleValue()));
called_on_null_input | True
language | java
return_type | double
In this case, we have one function only.
Cassandra Show User Types
Similarly, to fetch user types, we can query the types table as shown in the example below:
The resulting output is as shown:
---------------+-----------------------------------
keyspace_name | zero_day
type_name | user_info
field_names | ['id', 'country', 'age', 'email']
field_types | ['int', 'text', 'int', 'text']
(1 rows)
In this case, we have one user type with the details shown above.
Cassandra Show User-Defined Aggregates
To show the user-defined aggregates, query the aggregates table as shown:
If you have any defined aggregates, you should see them from this table.
Termination
The system_schema table holds useful information stored in the cluster, such as UDF, views, data types, keyspaces, etc.
Thanks for reading!!