Class WarnLostSortOrder

java.lang.Object
org.elasticsearch.xpack.esql.rule.Rule<LogicalPlan,LogicalPlan>
org.elasticsearch.xpack.esql.optimizer.rules.logical.WarnLostSortOrder

public final class WarnLostSortOrder extends Rule<LogicalPlan,LogicalPlan>
Warns when a SORT or TopN is followed by a LOOKUP JOIN which does not preserve order, and there is no subsequent SORT to restore the order.

For example:

 FROM test | SORT x | LOOKUP JOIN lookup ON key | LIMIT 10
 
will produce a warning because the SORT order is lost by the LOOKUP JOIN.

But:

 FROM test | SORT x | LOOKUP JOIN lookup ON key | SORT y | LIMIT 10
 
will NOT produce a warning because the final SORT restores a defined order.