-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
GH-41329: [C++][Gandiva] Fix gandiva cache size env var #41330
Changes from all commits
73f3603
156bb1d
7f712fd
78e7640
915d731
064bb78
fdca72d
77a71a7
032169e
869945e
d3aa5e9
0b491bc
eaaa659
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,14 +20,27 @@ | |
#include <cstdlib> | ||
#include <mutex> | ||
|
||
#include "arrow/util/macros.h" | ||
#include "gandiva/lru_cache.h" | ||
#include "gandiva/visibility.h" | ||
|
||
namespace gandiva { | ||
|
||
namespace internal { | ||
// Only called once by GetCacheCapacity(). | ||
// Do the actual work of getting the cache capacity from env var. | ||
// Also makes the testing easier. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not possible in google test to re-initialize a static variable. So have this dedicated function to do the actual work eagerly, then we can test it instead of |
||
GANDIVA_EXPORT | ||
int GetCacheCapacityFromEnvVar(); | ||
} // namespace internal | ||
|
||
ARROW_DEPRECATED("Deprecated in 17.0.0. Use GetCacheCapacity instead.") | ||
GANDIVA_EXPORT | ||
int GetCapacity(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it can. But is this public API? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have no idea :-) You could deprecate the old API if we want to ensure a smoother migration. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed with deprecating old API and adding renamed one. |
||
|
||
GANDIVA_EXPORT | ||
int GetCacheCapacity(); | ||
|
||
GANDIVA_EXPORT | ||
void LogCacheSize(size_t capacity); | ||
|
||
|
@@ -36,7 +49,7 @@ class Cache { | |
public: | ||
explicit Cache(size_t capacity) : cache_(capacity) { LogCacheSize(capacity); } | ||
|
||
Cache() : Cache(GetCapacity()) {} | ||
Cache() : Cache(GetCacheCapacity()) {} | ||
|
||
ValueType GetObjectCode(const KeyType& cache_key) { | ||
std::optional<ValueType> result; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the parsing according to the recommendation from #41335 (comment)