So far, we have only done simple SELECT operations that are inherently permitted by Cassandra. In the case of complex queries, where we could not fetch results based on just the primary key indexes, we built secondary indexes and materialized views. What if there arises a situation where you are required to perform some custom computations? Fortunately, Cassandra provides custom user-defined functions to perform some simple computations on the data present in Cassandra.
UDFs allow the execution of user code on the server side. The coordinator node takes care of the computation. In Cassandra 3.0 and later, UDFs are executed in a sandbox. You can also use custom security managers to prevent UDFs from accessing the filesystem or to prevent the execution of harmful code. Java and JavaScript are supported by default.