zanmato1984 commented on code in PR #41335:
URL: https://github.com/apache/arrow/pull/41335#discussion_r1579751273
##########
cpp/src/arrow/acero/query_context.cc:
##########
@@ -23,6 +23,36 @@ namespace arrow {
using arrow::internal::CpuInfo;
namespace acero {
+namespace internal {
+
+int64_t GetTempStackSizeFromEnvVar() {
+ auto maybe_env_value = arrow::internal::GetEnvVar(kTempStackSizeEnvVar);
+ if (!maybe_env_value.ok()) {
+ return kDefaultTempStackSize;
+ }
+ auto env_value = *std::move(maybe_env_value);
+ if (env_value.empty()) {
+ return kDefaultTempStackSize;
+ }
+
+ int64_t temp_stack_size = 0;
+ size_t length = 0;
+ bool exception = false;
+ try {
+ temp_stack_size = std::stoll(env_value.c_str(), &length);
+ } catch (const std::exception&) {
+ exception = true;
+ }
+ if (length != env_value.length() || exception || temp_stack_size <= 0) {
+ ARROW_LOG(WARNING) << "Invalid temp stack size provided in " <<
kTempStackSizeEnvVar
+ << ". Using default temp stack size: " <<
kDefaultTempStackSize;
+ return kDefaultTempStackSize;
+ }
+ return temp_stack_size;
Review Comment:
The stack initialization will fill the entire memory with `0xFF` [1]. With
this non-trivial overhead (at least for memory as big as 256GB), I think maybe
we should limit the upper-bound more aggressively :(
[1]
https://github.com/apache/arrow/blob/32885c91a1c94f1c8530815f4d4b8fc068859de8/cpp/src/arrow/compute/util.h#L95
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]