private void parseOrderColumn(VoltXMLElement orderByNode, ParsedSelectStmt leftmostSelectChild) {

        ParsedColInfo.ExpressionAdjuster adjuster = new ParsedColInfo.ExpressionAdjuster() {
            @Override
            public AbstractExpression adjust(AbstractExpression expr) {
                // Union itself can't have aggregate expression
                return expr;
            }
        };
        // Get the display columns from the first child
        List<ParsedColInfo> displayColumns = leftmostSelectChild.displayColumns();
        ParsedColInfo order_col = ParsedColInfo.fromOrderByXml(leftmostSelectChild, orderByNode, adjuster);

        AbstractExpression order_exp = order_col.m_expression;
        assert(order_exp != null);

        // Mark the order by column if it is in displayColumns
        // The ORDER BY column MAY be identical to a simple display column, in which case,
        // tagging the actual display column as being also an order by column
        // helps later when trying to determine ORDER BY coverage (for determinism).
        for (ParsedColInfo col : displayColumns) {
            if (col.m_alias.equals(order_col.m_alias) || col.m_expression.equals(order_exp)) {
                col.m_orderBy = true;
                col.m_ascending = order_col.m_ascending;

                order_col.m_alias = col.m_alias;
                order_col.m_columnName = col.m_columnName;
                order_col.m_tableName = col.m_tableName;
                break;
            }
        }
        assert( ! (order_exp instanceof ConstantValueExpression));
        assert( ! (order_exp instanceof ParameterValueExpression));

        m_orderColumns.add(order_col);
    }
private void parseOrderColumn ( VoltXMLElement orderByNode , ParsedSelectStmt leftmostSelectChild ) { ParsedColInfo . ExpressionAdjuster adjuster = new ParsedColInfo . ExpressionAdjuster ( ) { @ Override public AbstractExpression adjust ( AbstractExpression expr ) { return expr ; } } ; List < ParsedColInfo > displayColumns = leftmostSelectChild . displayColumns ( ) ; ParsedColInfo order_col = ParsedColInfo . fromOrderByXml ( leftmostSelectChild , orderByNode , adjuster ) ; AbstractExpression order_exp = order_col . m_expression ; assert ( order_exp != null ) ; for ( ParsedColInfo col : displayColumns ) { if ( col . m_alias . equals ( order_col . m_alias ) || col . m_expression . equals ( order_exp ) ) { col . m_orderBy = true ; col . m_ascending = order_col . m_ascending ; order_col . m_alias = col . m_alias ; order_col . m_columnName = col . m_columnName ; order_col . m_tableName = col . m_tableName ; break ; } } assert ( ! ( order_exp instanceof ConstantValueExpression ) ) ; assert ( ! ( order_exp instanceof ParameterValueExpression ) ) ; m_orderColumns . add ( order_col ) ; }
This is a stripped down version of the ParsedSelectStmt.parseOrderColumn. Since the SET ops
are not allowed to have aggregate expressions (HAVING, GROUP BY) (except the individual SELECTS)
all the logic handling the aggregates is omitted here
@param orderByNode
@param leftmostSelectChild