/* * returns true if an expression was found in tupleSchema true means no need * to call parent, somthing added to stack It has side effects - putting on * exprStack */ private <T extends Expression> boolean isRecognized(T expr) { // expr is changed in place, so that it does not contain synonims final int position = _nt.indexOf(_tupleSchema, expr); if (position != ParserUtil.NOT_FOUND) { // we found an expression already in the tuple schema final Type tc = _nt.getType(_tupleSchema, expr); final ValueExpression ve = new ColumnReference(tc, position, ParserUtil.getStringExpr(expr)); pushToExprStack(ve); return true; } else return false; }
/* * only getColumnIndex method invocation is different than in parent */ @Override public void visit(Column column) { // extract the position (index) of the required column // column might be changed, due to the synonym effect final int position = _nt.getColumnIndex(_tupleSchema, column); // extract type for the column // TypeConversion tc = _nt.getType(_tupleSchema, column); // TODO: Due to the fact that Project prepares columns for FinalAgg on // the last component // and that for SUM or COUNT this method is not invoked (recognize is // true), // but only for GroupByProjections as the top level method. // That is, we can safely assume StringConversion method. // Permanent fix is to create StringConversion over overallAggregation. final Type tc = _sc; final ValueExpression ve = new ColumnReference(tc, position, ParserUtil.getStringExpr(column)); pushToExprStack(ve); }