zeroshade commented on code in PR #1034:
URL: https://github.com/apache/arrow-go/pull/1034#discussion_r3660790285
##########
parquet/pqarrow/schema.go:
##########
@@ -246,7 +246,7 @@ func DecimalSize(precision int32) int32 {
if precision <= 76 {
return byteblock[precision]
}
- return int32(math.Ceil(float64(precision)/8.0)*math.Log2(10) + 1)
+ return int32(math.Ceil((float64(precision)*math.Log2(10) + 1) / 8))
Review Comment:
This now matches the generator comment at line 238 verbatim, which is the
strongest evidence it's the intended formula.
Confirmed exactly minimal against big-integer arithmetic for p=77..3000, and
continuous with `byteblock` at the p=76 boundary (new formula reproduces all 76
table entries). The previous expression applied `ceil` to `precision/8` before
multiplying by `log2(10)`, which mixed units and produced a step function —
constant 34 across p=74..80 — and under-allocated from p=248 onward.
--
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]