-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Description
Describe the bug, including details regarding any error messages, version, and platform.
I think the original purpose of the following check is to set gandiva cache size to the predefined default value (5000) for invalid/zero/negative numbers:
arrow/cpp/src/gandiva/cache.cc
Lines 29 to 42 in 25bb627
| size_t capacity = DEFAULT_CACHE_SIZE; | |
| auto maybe_env_cache_size = ::arrow::internal::GetEnvVar("GANDIVA_CACHE_SIZE"); | |
| if (maybe_env_cache_size.ok()) { | |
| const auto env_cache_size = *std::move(maybe_env_cache_size); | |
| if (!env_cache_size.empty()) { | |
| capacity = std::atol(env_cache_size.c_str()); | |
| if (capacity <= 0) { | |
| ARROW_LOG(WARNING) << "Invalid cache size provided in GANDIVA_CACHE_SIZE. " | |
| << "Using default cache size: " << DEFAULT_CACHE_SIZE; | |
| capacity = DEFAULT_CACHE_SIZE; | |
| } | |
| } | |
| } | |
| return static_cast<int>(capacity); |
However it will fail checking if the value is negative because it is using unsigned type size_t to do the <= 0 check.
Component(s)
C++