Patent ID: 7587396

Claim:
A computer-implemented method for encoding data to be sorted, the method comprising the steps of: in response to a request to arrange a plurality of data items in a sorted order based on values for one or more fields of the data items, performing the steps of: reading data that explicitly indicates whether null values for the one or more fields should be treated, for the purpose of sort operations, as being higher than the highest non-null value, or lower than the lowest non-null value; constructing an array of bytes for each data item, the array of bytes representing an encoding of the values for the one or more fields of the data item; wherein constructing the array of bytes for each data item includes, for each data item, performing the steps of: for each field of the one or more fields of the data item: where the field of the data item has a non-null value, storing, in the array of bytes for the data item, (a) one or more bytes that represent a first value and (b) one or more bytes that represent the non-null value, wherein the one or more bytes that represent the first value immediately precede, in the array of bytes for the data item, the one or more bytes that represent the non-null value, where the field of the data item has a null value, storing, in the array of bytes for the data item, one or more bytes that represent a second value, wherein where said data indicates that null values for the field of the data item are to be treated as lower than the lowest non-null value, the first value is greater than the second value, and wherein where said data indicates that null values for the field of the data item are to be treated as higher than the highest non-null value, the first value is less than the second value; wherein the method for encoding data to be sorted is performed by one or more computing devices.