1. A computer-readable storage medium storing computer-executable instructions for performing a method comprising: receiving a query that identifies an input data source; partitioning the input data source into a plurality of partitions, each of the partitions including a set of data elements with an associated set of indices for indicating an ordering of the data elements; identifying a query type for a query operator in the received query; determining whether a reordering of data elements will be performed based on the identified query type; and reordering the data elements in at least one of the partitions when it is determined based on the identified query type that reordering will be performed.