pitrou commented on code in PR #14073:
URL: https://github.com/apache/arrow/pull/14073#discussion_r981479660
##########
cpp/src/gandiva/gdv_function_stubs.cc:
##########
@@ -825,6 +831,11 @@ void ExportedStubFunctions::AddMappings(Engine* engine)
const {
engine->AddGlobalMappingForFunc("gdv_fn_random_with_seed",
types->double_type(), args,
reinterpret_cast<void*>(gdv_fn_random_with_seed));
+ args = {types->i64_type(), types->i64_type(), types->i1_type()};
+ engine->AddGlobalMappingForFunc("gdv_fn_random_with_seed_int64",
types->double_type(),
Review Comment:
Why not always mandate int64 instead of defining two different functions?
##########
cpp/src/gandiva/random_generator_holder.h:
##########
@@ -40,10 +40,9 @@ class GANDIVA_EXPORT RandomGeneratorHolder : public
FunctionHolder {
double operator()() { return distribution_(generator_); }
private:
- explicit RandomGeneratorHolder(int seed) : distribution_(0, 1) {
- int64_t seed64 = static_cast<int64_t>(seed);
- seed64 = (seed64 ^ 0x00000005DEECE66D) & 0x0000ffffffffffff;
- generator_.seed(static_cast<uint64_t>(seed64));
+ explicit RandomGeneratorHolder(int64_t seed) : distribution_(0, 1) {
+ seed = (seed ^ 0x00000005DEECE66D) & 0x0000ffffffffffff;
Review Comment:
Why this formula?
--
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]