felipecrv commented on code in PR #41335:
URL: https://github.com/apache/arrow/pull/41335#discussion_r1581117184
##########
cpp/src/arrow/acero/query_context.cc:
##########
@@ -23,6 +23,46 @@ 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;
+ }
+ std::string env_value = std::move(maybe_env_value).ValueUnsafe();
+ 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;
+ }
Review Comment:
The standard int parsing functions can be full of surprises (locale support,
weird error reporting...). Feel free to use the parser from
`util/value_parsing.h` here. Bonus point: it would support Hexadecimal notation
as well which is good for specifying power-of-2 numbers.
https://github.com/apache/arrow/blob/2710626b234d5e387a3c63988ca5899c70547dcf/cpp/src/arrow/util/value_parsing.h#L930-L935
--
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]