You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "dmitry-chirkov-dremio (via GitHub)" <gi...@apache.org> on 2026/03/03 17:30:54 UTC

[I] Add rand_integer function [arrow]

dmitry-chirkov-dremio opened a new issue, #49441:
URL: https://github.com/apache/arrow/issues/49441

   ### Describe the enhancement requested
   
   ### Describe the enhancement requested
   
   Add `rand_integer` function to Gandiva to generate random integers, complementing the existing `rand`/`random` functions that generate random doubles.
   
   **Proposed signatures:**
   
   1. `rand_integer()` → int32 - Returns random integer in full int32 range [INT32_MIN, INT32_MAX]
   2. `rand_integer(int32 range)` → int32 - Returns random integer in range [0, range-1]
   3. `rand_integer(int32 min, int32 max)` → int32 - Returns random integer in range [min, max] inclusive
   
   **Implementation approach:**
   
   - Follow the existing `RandomGeneratorHolder` pattern
   - Use `std::uniform_int_distribution<int32_t>` for integer generation
   - Validate parameters at expression compilation time (range > 0, min <= max)
   - Use Mersenne Twister (`std::mt19937_64`) as the random engine
   
   **Rationale:**
   
   This function provides native integer random number generation, matching common patterns in other systems and programming languages (e.g., Java's `Random.nextInt()`), and offers a more efficient alternative to `CAST(rand() * range AS INT)` for generating random integers.
   
   ### Component(s)
   
   C++, Gandiva


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Add rand_integer function [arrow]

Posted by "dmitry-chirkov-dremio (via GitHub)" <gi...@apache.org>.
dmitry-chirkov-dremio commented on issue #49441:
URL: https://github.com/apache/arrow/issues/49441#issuecomment-3992533175

   take


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [C++][Gandiva] Add rand_integer function [arrow]

Posted by "dmitry-chirkov-dremio (via GitHub)" <gi...@apache.org>.
dmitry-chirkov-dremio closed issue #49441: [C++][Gandiva] Add rand_integer function
URL: https://github.com/apache/arrow/issues/49441


-- 
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: issues-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org