Stream after sort is only ordered if sort wasn't parallelised
@@ -474,9 +474,15 @@ final class StreamPropertyDerivations
@Override
public StreamProperties visitSort(SortNode node, List<StreamProperties> inputProperties)
{
+ StreamProperties sourceProperties = Iterables.getOnlyElement(inputProperties);
+ if (sourceProperties.isSingleStream()) {
+ // stream is only sorted if sort operator is executed without parallelism
return StreamProperties.ordered();
}
+ return sourceProperties;
+ }
+
@Override
public StreamProperties visitLimit(LimitNode node, List<StreamProperties> inputProperties)
{
