Creating a new operator class
About this task
Although the R-tree access method includes a default operator class that is called rtree_ops, you must create a new operator class when you are developing a DataBlade® module that uses the R-tree access method.
The rtree_ops operator class is provided primarily for generic R-tree testing and as an example of how to create a new operator class. The rtree_ops operator class includes only the four required strategy functions: Overlap, Equal, Contains, and Within. If you want to create more than these four strategy functions, you must create your own operator class.
The rtree_ops operator class also restricts the number of support functions to the three required ones: Union, Size, and Inter. Because bottom-up building of R-tree indexes requires that you also create the SFCbits, ObjectLength, SFCvalue, and SetUnion functions, the rtree_ops operator class does not support bottom-up building.
To create a new operator class:
Procedure
- Create the required support functions.
This step includes writing the C code using the DataBlade® API to implement the required support functions and defining the SQL statements to register the function with the database server.
This step is described in Support functions.
- Create the required strategy functions.Similar to support functions, this step includes writing the C code using the DataBlade® API to implement the required strategy functions and defining the SQL statements to register the function with the database server.
This step is described in Strategy functions.
- Create the operator class by creating custom SQL to register
the operator class with the database server.
This step is described in Syntax for creating a new operator class.
Results
Each access method has different requirements for the support and strategy functions. The following topics describe the support and strategy functions that the R-tree access method requires. These topics also provide examples of how to create them.
NOT VARIANT
in the WITH clause
of the CREATE FUNCTION statement.