Expression expression = node.getOutputMap().get(sampleWeightSymbol);
if (expression instanceof QualifiedNameReference) {
Symbol unaliasedSampleWeightSymbol = Symbol.fromQualifiedName(((QualifiedNameReference) expression).getName());
context = new LimitContext(context.getCount(), Optional.of(unaliasedSampleWeightSymbol));
PlanNode source = planRewriter.rewrite(node.getSource(), context);
return new ProjectNode(node.getId(), source, node.getOutputMap());
}
else {
// TODO: We might want to add another limit here that ignores sample weight, and push it down. We would have to assume that sample weight is never zero.
PlanNode rewrittenNode = planRewriter.defaultRewrite(node, null);
// Drop in a LimitNode b/c we cannot push our limit down any further