Class TExpression

Object
gudusoft.gsqlparser.nodes.TParseTreeNode
gudusoft.gsqlparser.nodes.TExpression
All Implemented Interfaces:
Visitable, Iterator<TSourceToken>
Direct Known Subclasses:
TCollMapBase, TCollPredBase, TNamedParameter, TPositionalParameter

public class TExpression extends TParseTreeNode
An expression is a combination of one or more values, operators, and SQL functions that evaluates to a value. There are lots of types of expression in this SQL parser, getExpressionType() was used to distinguish these types.

OBJECT NAME/CONSTANT/SOURCE TOKEN/FUNCTION CALL

UNARY ARITHMETIC LOGICAL ASSIGNMENT CONCATENATE AT TIME ZONE AT LOCAL BITWISE SUBQUERY
  • A scalar subquery expression is a subquery that returns exactly one column value from one row.
EXPRESSION WITH PARENTHESIS LIST EXPRESSION COLLECTION CONSTRUCTORS (informix) GROUP EXPRESSION, @deprecated As of v1.4.3.3
COMPARISON IN CASE
  • case expression,let you use IF ... THEN ... ELSE logic in SQL statements without having to invoke procedures.
CURSOR PATTERN MATCHING NULL BETWEEN EXISTS IS UNKNOWN IS TRUE IS FALSE DAY TO SECOND YEAR TO MONTH INTERVAL(teradata) NEW STRUCTURED TYPE NEW VARIANT_TYPE LDIFF,RDIFF,P_INTERSECT,P_NORMALIZE UNTIL CHANGED LEFT SHIFT RIGHT SHIFT IS DOCUMENT IS DISTINCT FROM SQL SERVER left join SQL SERVER right join COLLATE MEMBER OF NEXT VALUE FOR REF ARROW(named parameters in function call) TYPECAST MULTISET FLOATING POINT ROW CONSTRUCTOR IS OF TYPE PLACE HOLDER TYPE_CONSTRUCTOR_EXPRESSION ARRAY ACCESS OBJECT ACCESS EXPRESSION Unknown Unknown unary left Unknown unary right ARRAY CONSTRUCTOR
  • An array constructor is an expression that builds an array value using values for its member elements.

    like this: ARRAY[1,2,3+4]

    array element values can be accessed via getExprList(),

    or getExprList() can be null when it is: array[]

    It is also possible to construct an array from the results of a subquery like this:

    SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');

    thus, subquery can be access via getSubQuery()

FIELD SELECTION
  • If an expression yields a value of a composite type (row type), then a specific field of the row can be extracted by writing

    expression.fieldname

    In general the row expression must be parenthesized, but the parentheses can be omitted

    when the expression to be selected from is just a table reference or positional parameter.

    For example:

    mytable.mycolumn

    $1.somecolumn

    (rowfunction(a,b)).col3

    (Thus, a qualified column reference is actually just a special case of the field selection syntax.) An important special case is extracting a field from a table column that is of a composite type:

    (compositecol).somefield

    (mytable.compositecol).somefield

    The parentheses are required here to show that compositecol is a column name not a table name,

    or that mytable is a table name not a schema name in the second case.

    n a select list, you can ask for all fields of a composite value by writing .*:

    (compositecol).*

    When expression in following syntax, it will be marked as fieldSelection, and check getFieldName()

    (rowfunction(a,b)).col3

    (compositecol).somefield

    (mytable.compositecol).somefield

    (compositecol).*

    Otherwise, it will be marked as simpleObjectname:

    mytable.mycolumn

    $1.somecolumn

HIVE ARRAY ACCESS HIVE FIELD ACCESS JSON Operators (PostgreSQL) IS [NOT] A SET Big Query ARRAY <T>[ expr_list ]