Write the Test Code - 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

For example code that shows how to write a test program, read the samples such as testrun-echo_input.c that are provided in the sqlmr-sdk/example/c directory of the SDK. In a nutshell, when writing your test program for the TestRunner framework, you can do the following:

  • Use the SqlmrSimpleTestParams fields functionFile and functionName to store the path and name of the executable (.so file) to be tested.
  • Use the column utilities of SqlmrSimpleTestParams to build a data input table, which is an array of SqlmrTestColumnDefinition objects. This simulates an Aster instance table.
  • Specify the name of the input file that will fill the simulated table with data, as well as sources for any arguments the function takes. The test data in the input file is assumed to be tab-delimited. For an example input file, see sqlmr-sdk/example/c/echo_input/testrun.in.
  • If your SQL-MapReduce function uses installed files (for example to feed additional data to the function) use the SqlmrSimpleTestParams field installedFileDirectoryOrNull to specify the location of the simulated installed file. This allows TestRunner to simulate the installed files feature. (See Manage Functions and Files in Aster Database.)
  • Specify where the test results will be saved (using the completedContractFileName field for the completed SQL-MapReduce runtime contract results and the outputFileName field for the function’s output).
  • Run the test using the sqlmr_runSimpleTest function.

It can be convenient to mimic the naming conventions of the examples. To do this, name your test program testrun-function_name.c, as in testrun-echo_input.c.