@Override public Iterator<Expression> visitEnter(ScalarFunction node) { return node.preservesOrder() == OrderPreserving.NO ? Iterators.<Expression>emptyIterator() : Iterators.singletonIterator( node.getChildren().get(node.getKeyFormationTraversalIndex())); }
@Override public Info visitLeave(ScalarFunction node, List<Info> l) { if (l.isEmpty()) { return null; } Info info = l.get(0); // Keep the minimum value between this function and the current value, // so that we never increase OrderPreserving from NO or YES_IF_LAST. OrderPreserving orderPreserving = OrderPreserving.values()[ Math.min(node.preservesOrder().ordinal(), info.orderPreserving.ordinal())]; if (orderPreserving == info.orderPreserving) { return info; } return new Info(info, orderPreserving); }