@@ -115,8 +115,8 @@ class SparkAggregateWindowLimitMemoryTest
115115 static void SetUpTestCase () {
116116 OperatorTestBase::SetUpTestCase ();
117117 OperatorTestBase::setupMemory (
118- 256 << 20 , // allocatorCapacity
119- 256 << 20 , // arbitratorCapacity
118+ 192 << 20 , // allocatorCapacity
119+ 192 << 20 , // arbitratorCapacity
120120 0 , // arbitratorReservedCapacity
121121 0 , // memoryPoolInitCapacity
122122 0 , // memoryPoolReservedCapacity
@@ -137,18 +137,22 @@ class SparkAggregateWindowLimitMemoryTest
137137// the limit and cause failure.
138138// The capacity is calculated as:
139139// 1. size of input data: 1 rows * 32KB (the length of the string) = 32KB
140- // 2. size of RowContainer: ((1,024 rows * 32KB (data) + 1,024 rows * 32KB
141- // (Accumulators))) * 3 = 192MB
142- // (Accumulators won't be destroyed now )
140+ // 2. size of RowContainer: ((1,024 rows * 32KB (data))) * 3 +
141+ // 32KB(Accumulator) = 96MB
142+ // (Accumulators will be destroyed when processing a new partition. )
143143// 3. size of results: 10 rows * 32KB * 2 (column 'd' and the result column) =
144144// 640KB
145145// 4. other overheads
146- // Total: ~ 192MB
146+ // Total: ~ 96MB
147147// If we don't clear the string buffers in time, the size of the string buffers
148- // would be at least 1,024 rows * 32KB * 3 = 96MB. So without the fix, we need
149- // capacity to be set to more than 192MB + 96MB = 288MB to pass the test.
150- // So we set the capacity to 256MB here.
151- TEST_F (SparkAggregateWindowLimitMemoryTest, clearStringBuffersInTime) {
148+ // would be at least 1,024 rows * 32KB * 3 = 96MB. If we don't destroy the
149+ // previously created accumulator, the memory size of accumulators accumulated
150+ // will be (32KB * 1024 rows * 3) = 96MB. So without the fix, we need capacity
151+ // to be set to more than 96MB + 96MB + 96MB = 288MB to pass the test. We set
152+ // the capacity to 192MB here to verify that our fixes work.
153+ TEST_F (
154+ SparkAggregateWindowLimitMemoryTest,
155+ clearStringBuffersAndAccumulatorsInTime) {
152156 constexpr vector_size_t size = 1'024 * 3 ;
153157 constexpr vector_size_t resultSize = 10 ;
154158 // For this test, it is important to create a single-row partition.
0 commit comments