Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ffa817

Browse files
committed
Update src/tuplessort15.c for new changes upto 2022-06-01
1 parent210abdd commit1ffa817

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

‎src/tuplesort15.c

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ struct Tuplesortstate
471471

472472
/* These are specific to the index_btree subcase: */
473473
boolenforceUnique;/* complain if we find duplicate tuples */
474-
booluniqueNullsNotDistinct;/* unique constraint null treatment */
474+
booluniqueNullsNotDistinct;/* unique constraint null treatment */
475475

476476
/* These are specific to the index_hash subcase: */
477477
uint32high_mask;/* masks for sortable part of hash code */
@@ -708,15 +708,16 @@ qsort_tuple_unsigned_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
708708
returncompare;
709709

710710
/*
711-
* No need to waste effort calling the tiebreak function when there are
712-
*noother keys to sort on.
711+
* No need to waste effort calling the tiebreak function when there are no
712+
* other keys to sort on.
713713
*/
714714
if (state->onlyKey!=NULL)
715715
return0;
716716

717717
returnstate->comparetup(a,b,state);
718718
}
719719

720+
#ifSIZEOF_DATUM >=8
720721
/* Used if first key's comparator is ssup_datum_signed_compare */
721722
staticpg_attribute_always_inlineint
722723
qsort_tuple_signed_compare(SortTuple*a,SortTuple*b,Tuplesortstate*state)
@@ -731,14 +732,15 @@ qsort_tuple_signed_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
731732
returncompare;
732733

733734
/*
734-
* No need to waste effort calling the tiebreak function when there are
735-
*noother keys to sort on.
735+
* No need to waste effort calling the tiebreak function when there are no
736+
* other keys to sort on.
736737
*/
737738
if (state->onlyKey!=NULL)
738739
return0;
739740

740741
returnstate->comparetup(a,b,state);
741742
}
743+
#endif
742744

743745
/* Used if first key's comparator is ssup_datum_int32_compare */
744746
staticpg_attribute_always_inlineint
@@ -747,15 +749,15 @@ qsort_tuple_int32_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
747749
intcompare;
748750

749751
compare=ApplyInt32SortComparator(a->datum1,a->isnull1,
750-
b->datum1,b->isnull1,
751-
&state->sortKeys[0]);
752+
b->datum1,b->isnull1,
753+
&state->sortKeys[0]);
752754

753755
if (compare!=0)
754756
returncompare;
755757

756758
/*
757-
* No need to waste effort calling the tiebreak function when there are
758-
*noother keys to sort on.
759+
* No need to waste effort calling the tiebreak function when there are no
760+
* other keys to sort on.
759761
*/
760762
if (state->onlyKey!=NULL)
761763
return0;
@@ -781,6 +783,7 @@ qsort_tuple_int32_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
781783
#defineST_DEFINE
782784
#include"lib/sort_template.h"
783785

786+
#ifSIZEOF_DATUM >=8
784787
#defineST_SORT qsort_tuple_signed
785788
#defineST_ELEMENT_TYPE SortTuple
786789
#defineST_COMPARE(a,b,state) qsort_tuple_signed_compare(a, b, state)
@@ -789,6 +792,7 @@ qsort_tuple_int32_compare(SortTuple *a, SortTuple *b, Tuplesortstate *state)
789792
#defineST_SCOPE static
790793
#defineST_DEFINE
791794
#include"lib/sort_template.h"
795+
#endif
792796

793797
#defineST_SORT qsort_tuple_int32
794798
#defineST_ELEMENT_TYPE SortTuple
@@ -3662,23 +3666,22 @@ tuplesort_sort_memtuples(Tuplesortstate *state)
36623666
{
36633667
if (state->sortKeys[0].comparator==ssup_datum_unsigned_cmp)
36643668
{
3665-
elog(DEBUG1,"qsort_tuple_unsigned");
36663669
qsort_tuple_unsigned(state->memtuples,
36673670
state->memtupcount,
36683671
state);
36693672
return;
36703673
}
3674+
#ifSIZEOF_DATUM >=8
36713675
elseif (state->sortKeys[0].comparator==ssup_datum_signed_cmp)
36723676
{
3673-
elog(DEBUG1,"qsort_tuple_signed");
36743677
qsort_tuple_signed(state->memtuples,
36753678
state->memtupcount,
36763679
state);
36773680
return;
36783681
}
3682+
#endif
36793683
elseif (state->sortKeys[0].comparator==ssup_datum_int32_cmp)
36803684
{
3681-
elog(DEBUG1,"qsort_tuple_int32");
36823685
qsort_tuple_int32(state->memtuples,
36833686
state->memtupcount,
36843687
state);
@@ -3689,13 +3692,11 @@ tuplesort_sort_memtuples(Tuplesortstate *state)
36893692
/* Can we use the single-key sort function? */
36903693
if (state->onlyKey!=NULL)
36913694
{
3692-
elog(DEBUG1,"qsort_ssup");
36933695
qsort_ssup(state->memtuples,state->memtupcount,
36943696
state->onlyKey);
36953697
}
36963698
else
36973699
{
3698-
elog(DEBUG1,"qsort_tuple");
36993700
qsort_tuple(state->memtuples,
37003701
state->memtupcount,
37013702
state->comparetup,
@@ -4907,16 +4908,12 @@ ssup_datum_unsigned_cmp(Datum x, Datum y, SortSupport ssup)
49074908
return0;
49084909
}
49094910

4911+
#ifSIZEOF_DATUM >=8
49104912
int
49114913
ssup_datum_signed_cmp(Datumx,Datumy,SortSupportssup)
49124914
{
4913-
#ifSIZEOF_DATUM==8
4914-
int64xx= (int64)x;
4915-
int64yy= (int64)y;
4916-
#else
4917-
int32xx= (int32)x;
4918-
int32yy= (int32)y;
4919-
#endif
4915+
int64xx=DatumGetInt64(x);
4916+
int64yy=DatumGetInt64(y);
49204917

49214918
if (xx<yy)
49224919
return-1;
@@ -4925,12 +4922,13 @@ ssup_datum_signed_cmp(Datum x, Datum y, SortSupport ssup)
49254922
else
49264923
return0;
49274924
}
4925+
#endif
49284926

49294927
int
49304928
ssup_datum_int32_cmp(Datumx,Datumy,SortSupportssup)
49314929
{
4932-
int32xx=(int32)x;
4933-
int32yy=(int32)y;
4930+
int32xx=DatumGetInt32(x);
4931+
int32yy=DatumGetInt32(y);
49344932

49354933
if (xx<yy)
49364934
return-1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp