Pushing Predicates Down to the Input - 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

With SQL-MapReduce Collaborative Planning, you can add logic to your SQL-MapReduce function that checks whether it can push the predicate sent by the Planner to the function’s input and advises the Planner accordingly.

For example, consider this query, which retrieves the session information for a particular user:

SELECT userid, ts, sessionid
FROM Sessionize(ON clickstream
  PARTITION BY custid
  ORDER BY ts
  TIMECOLUMN ('ts')
  TIMEOUT (60))
WHERE userid = 333;

Without SQL-MapReduce Collaborative Planning, the plan consists of the following steps:

  1. Execute the following query and store the output data in the temporary table tmp1:
    SESSIONIZE (SELECT * FROM clickstream ORDER BY userid, ts)
  2. Filter the data in tmp1.
    SELECT * FROM tmp1 WHERE userid = 333;
  3. Send the filtered data to the Queen.
  4. Return the output data to the application from the Queen.

However, with SQL-MapReduce Collaborative Planning, if your code determines that it can push the predicate on the function's input, the code notifies the Planner, which sends the following query to the function instead of the query sent in step 1 above:

SESSIONIZE (SELECT * FROM clickstream WHERE custid = 333 ORDER BY userid, ts)

In addition, the Planner eliminates the filtering step (see step 2 above), resulting in a significant optimization, as shown in the following figure.

Type 1 predicate example