mirror of
https://github.com/postgres/postgres.git
synced 2026-05-16 11:29:49 -04:00
Cosmetic fixes for radix sort
Do minor comment fixes and remove implicit cast to Datum. While here, let's prefer crashing instead of entering an infinite loop in case of future programming mistakes when computing next_level, suggested by ChangAo Chen. Discussion: https://postgr.es/m/tencent_49E3F11E74D8A584A2144ED532A490CBC40A@qq.com
This commit is contained in:
parent
a0302eac78
commit
ca9807dfec
1 changed files with 7 additions and 4 deletions
|
|
@ -2589,7 +2589,7 @@ normalize_datum(Datum orig, SortSupport ssup)
|
|||
|
||||
if (ssup->comparator == ssup_datum_signed_cmp)
|
||||
{
|
||||
norm_datum1 = orig + ((uint64) PG_INT64_MAX) + 1;
|
||||
norm_datum1 = orig + (Int64GetDatum(PG_INT64_MAX)) + 1;
|
||||
}
|
||||
else if (ssup->comparator == ssup_datum_int32_cmp)
|
||||
{
|
||||
|
|
@ -2620,8 +2620,8 @@ normalize_datum(Datum orig, SortSupport ssup)
|
|||
* Radix sort by (pass-by-value) datum1, diverting to qsort_tuple()
|
||||
* for tiebreaks.
|
||||
*
|
||||
* This is a modification of
|
||||
* ska_byte_sort() from https://github.com/skarupke/ska_sort
|
||||
* This is a modification of ska_byte_sort() from
|
||||
* https://github.com/skarupke/ska_sort
|
||||
* The original copyright notice follows:
|
||||
*
|
||||
* Copyright Malte Skarupke 2016.
|
||||
|
|
@ -2783,6 +2783,8 @@ radix_sort_recursive(SortTuple *begin, size_t n_elems, int level, Tuplesortstate
|
|||
else
|
||||
next_level = level + 1;
|
||||
|
||||
Assert(next_level > level);
|
||||
|
||||
for (uint8 *rp = remaining_partitions;
|
||||
rp < remaining_partitions + num_partitions;
|
||||
rp++)
|
||||
|
|
@ -2849,7 +2851,8 @@ radix_sort_tuple(SortTuple *data, size_t n, Tuplesortstate *state)
|
|||
/*
|
||||
* Find the first NOT NULL if NULLS FIRST, or first NULL if NULLS LAST.
|
||||
* This also serves as a quick check for the common case where all tuples
|
||||
* are NOT NULL in the first sort key.
|
||||
* are NOT NULL in the first sort key with the default order ASC NULLS
|
||||
* LAST.
|
||||
*/
|
||||
while (d1 < n && data[d1].isnull1 == nulls_first)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue