diff --git a/src/gausskernel/runtime/executor/nodeAgg.cpp b/src/gausskernel/runtime/executor/nodeAgg.cpp index 8f5fa37a0afa627fe666a976f12170217161f87c..2f0487fd983d732e3b5a8a9a1f882525dc4f0868 100644 --- a/src/gausskernel/runtime/executor/nodeAgg.cpp +++ b/src/gausskernel/runtime/executor/nodeAgg.cpp @@ -1938,15 +1938,6 @@ static TupleTableSlot* agg_retrieve_hash_table(AggState* aggstate) return NULL; } -int getPower2Num(int num) -{ - int i = 1; - while (i < num) { - i <<= 1; - } - return i; -} - /* ----------------- * ExecInitAgg * @@ -2916,7 +2907,7 @@ Datum aggregate_dummy(PG_FUNCTION_ARGS) } FORCE_INLINE void agg_spill_to_disk(AggWriteFileControl* TempFileControl, TupleHashTable hashtable, - TupleTableSlot* hashslot, int numGroups, bool isAgg, int planId, int dop, Instrumentation* instrument) + TupleTableSlot* hashslot, int64 numGroups, bool isAgg, int planId, int dop, Instrumentation* instrument) { if (TempFileControl->spillToDisk == false) { Assert(TempFileControl->finishwrite == false); @@ -2980,7 +2971,7 @@ FORCE_INLINE void agg_spill_to_disk(AggWriteFileControl* TempFileControl, TupleH } /* estimate num of temp file */ - int estsize = getPower2Num(4 * numGroups / TempFileControl->inmemoryRownum); + int estsize = getPower2NextNum(4 * numGroups / TempFileControl->inmemoryRownum); TempFileControl->filenum = Max(HASH_MIN_FILENUMBER, estsize); TempFileControl->filenum = Min(TempFileControl->filenum, HASH_MAX_FILENUMBER); TempFileControl->filesource = diff --git a/src/include/executor/node/nodeAgg.h b/src/include/executor/node/nodeAgg.h index 22717e91ac9389c4e7b483ccb387be8a868f2c73..24ab9f5bee99f87b70d5b6613694bf3400c7dfac 100644 --- a/src/include/executor/node/nodeAgg.h +++ b/src/include/executor/node/nodeAgg.h @@ -279,9 +279,8 @@ extern long ExecGetMemCostAgg(Agg*); extern void initialize_phase(AggState* aggstate, int newphase); extern List* find_hash_columns(AggState* aggstate); extern uint32 ComputeHashValue(TupleHashTable hashtbl); -extern int getPower2Num(int num); extern void agg_spill_to_disk(AggWriteFileControl* TempFileControl, TupleHashTable hashtable, TupleTableSlot* hashslot, - int numGroups, bool isAgg, int planId, int dop, Instrumentation* intrument = NULL); + int64 numGroups, bool isAgg, int planId, int dop, Instrumentation* intrument = NULL); extern void ExecEarlyFreeAggregation(AggState* node); extern void ExecReSetAgg(AggState* node); diff --git a/src/include/vecexecutor/vechashtable.h b/src/include/vecexecutor/vechashtable.h index 7591147d6612621cd85155c3582255fa7e4893ae..9b2dd3d10cbb3337866122648bc3dd543dad42f2 100644 --- a/src/include/vecexecutor/vechashtable.h +++ b/src/include/vecexecutor/vechashtable.h @@ -356,7 +356,7 @@ inline int getPower2LessNum(int num) return i; } -inline int getPower2NextNum(int num) +inline int getPower2NextNum(int64 num) { int i = 1; int count = 0;