Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
Reduce initial size, experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Sep 9, 2022
1 parent e84f06c commit 914cb47
Showing 1 changed file with 60 additions and 30 deletions.
90 changes: 60 additions & 30 deletions native-sql-engine/cpp/src/codegen/arrow_compute/ext/actions_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ class UniqueAction : public ActionBase {
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
null_flag_.resize(max_group_size, false);
Expand Down Expand Up @@ -364,7 +365,8 @@ class CountAction : public ActionBase {
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_.resize(max_group_size, 0);
return arrow::Status::OK();
Expand Down Expand Up @@ -501,7 +503,8 @@ class CountDistinctAction : public ActionBase {
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_.resize(max_group_size, 0);
return arrow::Status::OK();
Expand Down Expand Up @@ -655,7 +658,8 @@ class CountLiteralAction : public ActionBase {
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_.resize(max_group_size, 0);
return arrow::Status::OK();
Expand Down Expand Up @@ -775,7 +779,8 @@ class MinAction<DataType, CType, precompile::enable_if_number<DataType>>
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_.resize(max_group_size, 0);
Expand Down Expand Up @@ -1082,7 +1087,8 @@ class MinAction<DataType, CType, precompile::enable_if_decimal<DataType>>
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_.resize(max_group_size, 0);
Expand Down Expand Up @@ -1241,7 +1247,8 @@ class MinAction<DataType, CType, precompile::enable_if_string_like<DataType>>
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_.resize(max_group_size, "");
Expand Down Expand Up @@ -1391,7 +1398,8 @@ class MaxAction<DataType, CType, precompile::enable_if_number<DataType>>
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_.resize(max_group_size, 0);
Expand Down Expand Up @@ -1693,7 +1701,8 @@ class MaxAction<DataType, CType, precompile::enable_if_decimal<DataType>>
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_.resize(max_group_size, 0);
Expand Down Expand Up @@ -1852,7 +1861,8 @@ class MaxAction<DataType, CType, precompile::enable_if_string_like<DataType>>
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_.resize(max_group_size, "");
Expand Down Expand Up @@ -2032,7 +2042,8 @@ class SumAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_.resize(max_group_size, 0);
Expand Down Expand Up @@ -2193,7 +2204,8 @@ class SumAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_.resize(max_group_size, 0);
Expand Down Expand Up @@ -2365,7 +2377,8 @@ class SumActionPartial<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_.resize(max_group_size, 0);
Expand Down Expand Up @@ -2532,7 +2545,8 @@ class SumActionPartial<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_.resize(max_group_size, 0);
Expand Down Expand Up @@ -2704,7 +2718,8 @@ class AvgAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_sum_.resize(max_group_size, 0);
Expand Down Expand Up @@ -2876,7 +2891,8 @@ class AvgAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_sum_.resize(max_group_size, 0);
Expand Down Expand Up @@ -3066,7 +3082,8 @@ class SumCountAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_sum_.resize(max_group_size, 0);
Expand Down Expand Up @@ -3256,7 +3273,8 @@ class SumCountAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_sum_.resize(max_group_size, 0);
Expand Down Expand Up @@ -3434,7 +3452,8 @@ class SumCountMergeAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_sum_.resize(max_group_size, 0);
Expand Down Expand Up @@ -3614,7 +3633,8 @@ class SumCountMergeAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_sum_.resize(max_group_size, 0);
Expand Down Expand Up @@ -3786,7 +3806,8 @@ class AvgByCountAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_sum_.resize(max_group_size, 0);
Expand Down Expand Up @@ -3965,7 +3986,8 @@ class AvgByCountAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_sum_.resize(max_group_size, 0);
Expand Down Expand Up @@ -4168,7 +4190,8 @@ class StddevSampPartialAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_sum_.resize(max_group_size, 0);
Expand Down Expand Up @@ -4402,7 +4425,8 @@ class StddevSampPartialAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_sum_.resize(max_group_size, 0);
Expand Down Expand Up @@ -4631,7 +4655,8 @@ class StddevSampFinalAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_count_.resize(max_group_size, 0);
Expand Down Expand Up @@ -4844,7 +4869,8 @@ class StddevSampFinalAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_validity_.resize(max_group_size, false);
cache_count_.resize(max_group_size, 0);
Expand Down Expand Up @@ -5082,7 +5108,8 @@ class FirstPartialAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_first_.resize(max_group_size);
cache_value_set_.resize(max_group_size, false);
Expand Down Expand Up @@ -5321,7 +5348,8 @@ class FirstPartialAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_first_.resize(max_group_size);
cache_value_set_.resize(max_group_size, false);
Expand Down Expand Up @@ -5563,7 +5591,8 @@ class FirstFinalAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_first_.resize(max_group_size);
cache_value_set_.resize(max_group_size, false);
Expand Down Expand Up @@ -5820,7 +5849,8 @@ class FirstFinalAction<DataType, CType, ResDataType, ResCType,
if (target_group_size < 128) {
max_group_size = 128;
} else {
max_group_size = target_group_size * 2;
int extra_size = 0.01 * target_group_size < 128 ? 128 : 0.01 * target_group_size;
max_group_size = target_group_size + extra_size;
}
cache_first_.resize(max_group_size);
cache_value_set_.resize(max_group_size, false);
Expand Down

0 comments on commit 914cb47

Please sign in to comment.