Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-1800

[C++] Fix and simplify random_decimals

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.7.1
    • Fix Version/s: 0.8.0
    • Component/s: C++

      Description

      UniformDecimalDistribution currently generates values outside the range specified for the given precision in cases where the number of bytes required to represent a decimal value was less than or equal to 8.

      For example, for a 1 byte value the range is -128, 127 for the low bits and -1, 0 for the high bits. In cases where the low bits generated a negative number and the high bits generated a zero value the number can end up being much larger than desired.

      It's much easier to just generate N random bytes and sign extend based on the sign bit of the last byte.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cpcloud Phillip Cloud
                Reporter:
                cpcloud Phillip Cloud
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: