Generating Result Rows - 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

A graph function must implement an emitFinalRows() method, which returns any rows representing the graph function result. The example below shows the GraphSearch implementation of the emitFinalRows() method. This method checks whether the vertex is the destination vertex and whether it was successfully reached. If so, the method outputs a single row and returns. Otherwise, the method returns without emitting any rows.

/**
* The emitFinalRows method is called once per vertex to
* determine if the path of interest was found. That will
* be the case if the destination vertex and graph
* processing entered the "global halt" state.
* In this case that vertex will output a single row with
* the value "true". No rows are emitted otherwise.
* @param globals - a GraphGlobals with graph global state
* @param vertexState - a GraphSearchVertex with local vertex state
* @param emitter - a RowEmitter for emitting final results rows
*/
public void emitFinalRows (GraphGlobals globals,
                           VertexState vertexState,
                           RowEmitter emitter) {
    GraphSearchVertex vertex = (GraphSearchVertex) vertexState.getVertex();
    if (vertex.getVertexKey().equals(this.destinationVertexKey) && globals.isGlobalHalt()){
       emitter.addInt(1);
       emitter.emitRow();
     }
   return;

}// emitFinalRows