@Override public Void visitDistinctOperator(DistinctOperator op, Void arg) throws AlgebricksException { List<LogicalVariable> allLiveVars = new ArrayList<LogicalVariable>(); for (Mutable<ILogicalOperator> c : op.getInputs()) { VariableUtilities.getLiveVariables(c.getValue(), allLiveVars); } VariableUtilities.getProducedVariables(op, allLiveVars); /** put distinct vars first */ schemaVariables.addAll(op.getDistinctByVarList()); /** then other live vars */ for (LogicalVariable var : allLiveVars) { if (!schemaVariables.contains(var)) { schemaVariables.add(var); } } return null; }
@Override public Void visitDistinctOperator( DistinctOperator op, Pair<LogicalVariable, LogicalVariable> pair) throws AlgebricksException { for (Mutable<ILogicalExpression> eRef : op.getExpressions()) { eRef.getValue().substituteVar(pair.first, pair.second); } substVarTypes(op, pair); return null; }