Scalar Functions in Java - Aster Execution Engine

Teradata Aster® Developer Guide

Product
Aster Execution Engine
Release Number
7.00.02
Published
July 2017
Language
English (United States)
Last Update
2018-04-13
dita:mapPath
xnl1494366523182.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
dita:id
ffu1489104705746
lifecycle
previous
Product Category
Software

This section guides you through writing and invoking a simple user defined scalar function in Java. It assumes you have downloaded the Aster Execution Engine SQL-Analytics SDK.

To write a user defined function in Java, you create a Java class that implements the following interface:

com.asterdata.ncluster.scalar.ScalarFunction

The class must implement a public constructor that takes:

com.asterdata.ncluster.scalar.ScalarRuntimeContract

The name of your user defined Java function is the name of the Java class, ignoring case differences. So, for example, a function named factorial might be implemented by a Java class com.mycompany.Factorial.

Teradata Aster's SQL-Analytics framework supports one type of scalar function. A user defined scalar function implements the following interface:

  • ScalarFunction. ScalarFunction consumes one row as input and returns a single value for each row. From an interface perspective, the function will be passed as an iterator to an arbitrary set of rows. A ScalarFunction consists of:
    • the constructor
    • the operate function computeValue()