16.10 - Syntaxer - Teradata Database

Teradata Database SQL Request and Transaction Processing

Teradata Database
June 2017
Programming Reference
User Guide

The Syntaxer

The Syntaxer checks the Request parcel for high-level syntax. If no errors are detected, it converts the Request parcels into a skeletal parse tree referred to as the SynTree, also called the Black Tree, which it then passes on to the Resolver.

A parse tree is a data structure used by the SQL Parser to represent a Request parcel in a form that is simple to annotate with various descriptive and statistical information derived from the Data Dictionary and from derived statistics. The Syntaxer does not transform the request text in any way.

The parse tree also permits a relatively simple transformation of the Request parcel by Query Rewrite and the Optimizer into an execution plan.

The larger the Request parcel, the longer the syntaxer takes to generate the parse tree.

Views and macros can be nested up to 64 levels deep, but nesting adds processing time.

The Syntaxer is composed of the Lexer and Synact.

The Lexer decomposes a Request parcel into its component tokens such as keywords, special characters, numeric data, and character strings.

The following illustration shows a block diagram of Syntaxer activity.

Block Diagram of Syntaxer Activity

Syntaxer Component Processes

  1. The Syntaxer checks the request cache to determine if it contains an identical Request parcel.
    IF an identical parcel is … THEN the Syntaxer …
    found calls Steps Packaging and passes it the previously generated AMP processing steps. The steps, called plastic steps, are not yet bound with host variable data values.

    Plastic steps are directives to the AMPs. The steps do not yet contain data values from the Data parcel set specified in the USING request modifier.

    Plastic steps are flexible, thereby allowing different sets of values from USING request modifiers to be inserted during subsequent operations.

    not found produces an initial parse tree, then calls the Resolver.
  2. If no matching parcel is found in the request cache and if no syntax errors are detected, then the Syntaxer generates a skeletal parse tree called a SynTree and passes it to the Resolver.

    If a syntax error is detected, the Request parcel is returned to the requesting application with an appropriate error message.

    At later points in the parsing process, additional information are added to the parse tree, building toward an eventual set of concrete AMP steps.

    The Syntaxer produces the SynTree as its output and passes it to the Resolver.

SQL Flagger Activity

When the SQL Flagger is enabled, the Syntaxer is the component of the Parser that performs most of the flagging.

See SQL Fundamentals for information about the SQL Flagger.