GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.voltdb.com — CREATE AGGREGATE FUNCTION Using VoltDBCREATE AGGREGATE FUNCTIONCREATE AGGREGATE FUNCTION — Defines an aggregate SQL function and associates it with a Java class. SynopsisCREATE AGGREGATE FUNCTION function-name FROM CLASS class-path DescriptionThe CREATE AGGREGATE FUNCTION statement declares a user-defined aggregate function and associates it with a Java class. Aggregate functions process multiple values based on a query expression and produce a single result. For example, the built-in AVG aggregate function calculates the average of the values of a specific column or expression based on the query constraints. The return value of a user-defined aggregate function matches the datatype of the Java method itself. Similarly, the number and datatype of the function's arguments are defined by the arguments of the method. User-defined aggregate functions allow you to extend the functionality of the SQL language by declaring your own functions that can be used in SQL queries and data manipulation statements. The steps for creating a user-defined aggregate function are:
The Java methods that implement the user-defined function must follow the same rules for determinism as user-defined stored procedures, as outlined in Section 5.1.2.2, “Avoid Introducing Non-deterministic Values from External Functions”. See the chapter on "Creating Custom SQL Functions" in the VoltDB Guide to Performance and Customization for details on designing the Java class and methods necessary for a user-defined aggregate function. To declare a scalar rather than an aggregate function, see the description of the CREATE FUNCTION statement. ExamplesThe following example defines an aggregate function called longest_word from the start(), assemble(), combine(), and end() methods in the class LongestWord: CREATE AGGREGATE FUNCTION longest_word FROM CLASS myapp.functions.LongestWord; |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |