Skip to content

Commit 30a8946

Browse files
odysakwannoel
andauthored
fix(common): decimal round digits test (risingwavelabs#8568)
Co-authored-by: Noel Kwan <[email protected]>
1 parent 88550e4 commit 30a8946

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/expr/src/vector_op/round.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ mod tests {
7878
do_test("84818.33333333333333333333333", 4, "84818.3333");
7979
do_test("84818.15", 1, "84818.2");
8080
do_test("21.372736", -1, "0");
81-
// Maximum of 28 digits
82-
do_test("0", 340, &format!("0.{}", "0".repeat(28)));
81+
// When digit extends past original scale, it should just return original scale.
82+
// Intuitively, it does not make sense after rounding `0` it becomes `0.000`. Precision
83+
// should always be less or equal, not more.
84+
do_test("0", 340, "0");
8385
}
8486

8587
#[test]

0 commit comments

Comments
 (0)