Class TransformExpressionTree


  • public class TransformExpressionTree
    extends Object
    Class for representing expression trees for transforms.
    • A TransformExpressionTree node has either transform function or a column name, or a literal.
    • Leaf nodes either have column name or literal, whereas non-leaf nodes have transform function.
    • Transform function is applied to its children.
    • Method Detail

      • standardizeExpression

        public static String standardizeExpression​(String expression)
        Compiles the expression and serializes it back to standard format.

        E.g. " foo\t ( bar ('a'\t ,foobar( b, 'c'\t, 123) ) ,d )\t" -> "foo(bar('a',foobar(b,'c','123')),d)"

        The standard format expressions will be used in the broker response.

      • getStandardExpression

        public static String getStandardExpression​(AstNode astNode)
        Converts an AstNode into a standard expression.
      • getValue

        public String getValue()
        Returns the value of the node.
        Returns:
        Function name for FUNCTION; column name for IDENTIFIER; string value for LITERAL
      • setValue

        public void setValue​(String value)
        allows value to be set (needed to fix the case)
        Parameters:
        value -
      • isColumn

        public boolean isColumn()
        Returns if the tree represents a column name (ie no expression), false otherwise
        Returns:
        True if tress represents column, false otherwise.
      • isFunction

        public boolean isFunction()
      • isLiteral

        public boolean isLiteral()
      • getColumns

        public void getColumns​(Set<String> columns)
        Add all columns to the passed in column set.
        Parameters:
        columns - Output columns
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object