| US 7,587,396 B2 | ||
| Encoding data to be sorted | ||
| Mark D. Callaghan, Palo Alto, Calif. (US); and Dmitry M. Potapov, Emerald Hills, Calif. (US) | ||
| Assigned to Oracle International Corporation, Redwood Shores, Calif. (US) | ||
| Filed on Nov. 24, 2004, as Appl. No. 10/996,742. | ||
| Prior Publication US 2006/0112097 A1, May 25, 2006 | ||
| Int. Cl. G06F 17/30 (2006.01) | ||
| U.S. Cl. 707—7 [707/6] | 35 Claims |

| 1. 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.
|