Procedure - 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
  1. Connect to the cluster with the ACT client. Use a user account that has rights to install functions in the schema and rights to grant permissions to those functions. In this example we will use a schema called textanalysis.
    $ act -h queen-ip -d databasename -U username -w password
  2. Example only: For this example, we create some test data. At the ACT SQL command line, we type:
    BEGIN;
    CREATE FACT TABLE documents (document varchar)
        DISTRIBUTE BY HASH(document);
    INSERT INTO documents VALUES 	
        ('this is a test document'),
        ('this is another test document');
    END;
  3. Install the SQL-MapReduce function using ACT's \install command. (For a list of such commands, see Manage Functions and Files in Aster Database.)

    Here, we assume:

    • the files counttokens.jar and tokenize.jar are local to the directory where you invoked ACT,
    • you are working in a schema called textanalysis (If you don't have a schema set up for your use, try installing in the schema public, instead. Just replace "textanalysis" with "public" below.), and
    • you have INSTALL FILE and CREATE FUNCTION privileges in the textanalysis schema where you will install the functions.
      \install counttokens.jar textanalysis/counttokens.jar
      \install tokenize.jar textanalysis/tokenize.jar

      [Optional] If you like, you can enclose the \install command and subsequent calls to it in a transaction so that you can roll it back later to remove the SQL-MapReduce function from your cluster. (In this example we do an ABORT to remove our test function from the system.)

      Optional usage:

      BEGIN;
      \install counttokens.jar textanalysis/counttokens.jar
      \install tokenize.jar textanalysis/tokenize.jar
      SELECT ... -- queries that use the installed functions
      ABORT;

      You can type \dF+ or \dF *.* to check which schema a function belongs to. When you call the function, Teradata Aster recommends that you include its schema name.Type \dF+ function_name to check which schema the function belongs to.

  4. Use the GRANT command to give the EXECUTE privilege to users who will run the function. For this example, let's assume we want user "beehive" to be able to run the function.
    In most ACT commands for managing functions, when you type the function name, you do not type its suffix (like .jar in this example). Thus the syntax is:
    GRANT EXECUTE
       ON FUNCTION textanalysis.counttokens
       TO mjones;

    Repeat the above step for the rest of your users and functions. Alternatively, you can grant EXECUTE rights at the group level by replacing the user name with a group name in the GRANT EXECUTE statement.