You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by ze...@apache.org on 2026/08/11 14:48:58 UTC
(iceberg-go) branch main updated: fix(literals): correct below-min marshal error (#1713)
This is an automated email from the ASF dual-hosted git repository.
zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git
The following commit(s) were added to refs/heads/main by this push:
new 760d6ea95 fix(literals): correct below-min marshal error (#1713)
760d6ea95 is described below
commit 760d6ea953af5fcf75fc14fc92c09ee46550339e
Author: Minh Vu <vu...@gmail.com>
AuthorDate: Tue Aug 11 16:48:52 2026 +0200
fix(literals): correct below-min marshal error (#1713)
---
literals.go | 2 +-
literals_test.go | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/literals.go b/literals.go
index ba169db49..4759b9551 100644
--- a/literals.go
+++ b/literals.go
@@ -321,7 +321,7 @@ type belowMinLiteral[T int32 | int64 | float32 | float64] struct {
}
func (bm belowMinLiteral[T]) MarshalBinary() (data []byte, err error) {
- return nil, fmt.Errorf("%w: cannot marshal above max literal",
+ return nil, fmt.Errorf("%w: cannot marshal below min literal",
ErrInvalidBinSerialization)
}
diff --git a/literals_test.go b/literals_test.go
index 996c99c07..84b461bce 100644
--- a/literals_test.go
+++ b/literals_test.go
@@ -347,6 +347,12 @@ func TestInt64ToInt32OutsideBound(t *testing.T) {
assert.Equal(t, iceberg.PrimitiveTypes.Int32, belowMin.Type())
}
+func TestBelowMinLiteralMarshalBinary(t *testing.T) {
+ _, err := iceberg.Int32BelowMinLiteral().MarshalBinary()
+ require.ErrorIs(t, err, iceberg.ErrInvalidBinSerialization)
+ assert.EqualError(t, err, "invalid binary serialization: cannot marshal below min literal")
+}
+
func TestFloatConversions(t *testing.T) {
n1, _ := decimal128.FromFloat32(34.56, 9, 1)
n2, _ := decimal128.FromFloat32(34.56, 9, 2)