HaoYang670 opened a new issue, #2852:
URL: https://github.com/apache/arrow-rs/issues/2852

   **Which part is this question about**
   <!--
   Is it code base, library api, documentation or some other part?
   -->
   The definition of the `Decimal` type.
   
   **Describe your question**
   <!--
   A clear and concise description of what the question is.
   -->
   The current definition of the decimal type is `Decimal(u8, u8)`, which 
allows the precision to be zero.
   In the Datafusion, we meet as error which the zero precision leads the 
system to panic: https://github.com/apache/arrow-datafusion/issues/3665.
   
   My questions are:
   1. Does `precision = 0` make sense? 
   2. If it is, what is the value of `Decimal(0, ..)`?
   3. If it is not, how should we avoid the zero precision? Here are 2 ways I 
think:
       a. Add runtime check to all decimal functions when creating a new 
decimal type.
       b. Using the `NonZeroU8` to represent precision: 
https://doc.rust-lang.org/std/num/struct.NonZeroU8.html. Actually, `NonZeroU8` 
also does runtime checking when creating a value. But the benefit is that the 
type system help us find where to add the checking. The disadvantage it that we 
will change the API.
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->
   


-- 
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]

Reply via email to