We are trying to create a few custom data types. Based on our findings, we see that Cassandra supports creating User-Defined Types (UDT) using CQL. However, we do not see any support for creating operators like +,-,*,<,>,= on top custom data types for table columns.
We have the following queries regarding extending the Cassandra database:
How to define operators like +,-,*,<,> for columns with UDT?
Is it possible to define indexes for UDT columns using a custom comparison function?
[UPDATE] Our goal is to create User-Defined Functions using custom JAVA classes.
Here is an example of what I intend to do:
Step 1: Create a UDT called "Point"
CREATE TYPE Point ( X int, Y int );
Step 2: Create a table with columns of datatype "Point"
CREATE TABLE lineCoordinate ( start Point, end Point )
Step 3: Create support for queries "SELECT end-start from lineCoordinate"I have the following queries:
a) Is it possible to Create a UDF using custom JAVA class
Example:
public class LineCoordinate { public static int getDifference(Point p1,Point p2) { return p2.X - p1.X; } }
Compile this code into MyTest.jar
b) How to install MyTest.jar into Cassandra and create a UDF using CQL? What versions of Cassandra support using an external jar file.
c) How to create custom operator " - " for UDT (point) ?