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 ca7b363e0 refactor(transforms)!: rename typed human formatting to 
ToHumanString (#2321)
ca7b363e0 is described below

commit ca7b363e0e234f6538f63abfb95637490719a909
Author: Minh Vu <[email protected]>
AuthorDate: Mon Oct 26 17:48:26 2026 +0100

    refactor(transforms)!: rename typed human formatting to ToHumanString 
(#2321)
    
    Signed-off-by: Minh Vu <[email protected]>
---
 partitions.go                      |  2 +-
 table/clustered_writer.go          |  2 +-
 table/inspect.go                   |  2 +-
 table/partition_path.go            |  2 +-
 table/partition_path_bench_test.go |  2 +-
 transforms.go                      | 28 ++++++++++++++--------------
 transforms_test.go                 | 12 ++++++------
 website/src/releases.md            |  2 +-
 8 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/partitions.go b/partitions.go
index 396b5e16f..d365d907b 100644
--- a/partitions.go
+++ b/partitions.go
@@ -947,7 +947,7 @@ func (ps *PartitionSpec) PartitionToPath(data StructLike, 
sc *Schema) string {
                sb.WriteByte('=')
 
                // Only escape the value (which changes per row)
-               valueStr := 
resolvedFields[i].field.Transform.ToHumanStrType(resolvedFields[i].resultType, 
data.Get(i))
+               valueStr := 
resolvedFields[i].field.Transform.ToHumanString(resolvedFields[i].resultType, 
data.Get(i))
                internal.AppendQueryEscaped(&sb, valueStr)
        }
 
diff --git a/table/clustered_writer.go b/table/clustered_writer.go
index b14f6689c..90afdefb7 100644
--- a/table/clustered_writer.go
+++ b/table/clustered_writer.go
@@ -217,7 +217,7 @@ func clusteredPartitionedWrite(
 // tree keyed on each partition field's value, mirroring the layout of
 // partitionMapNode. Go's any-equality at each level distinguishes SQL
 // NULL from the literal string "null" — the same property that
-// PartitionToPath drops via Transform.ToHumanStr.
+// PartitionToPath drops via Transform.ToHumanString.
 type closedPartitionSet map[any]closedPartitionSet
 
 func (s closedPartitionSet) add(rec partitionRecord) {
diff --git a/table/inspect.go b/table/inspect.go
index 2dd4ec2d6..ec8789c40 100644
--- a/table/inspect.go
+++ b/table/inspect.go
@@ -468,7 +468,7 @@ func appendManifestBound(builder *array.StringBuilder, typ 
iceberg.Type, transfo
                return nil
        }
 
-       builder.Append(transform.ToHumanStrType(typ, literal.Any()))
+       builder.Append(transform.ToHumanString(typ, literal.Any()))
 
        return nil
 }
diff --git a/table/partition_path.go b/table/partition_path.go
index 7a999cae0..1dce749f3 100644
--- a/table/partition_path.go
+++ b/table/partition_path.go
@@ -52,7 +52,7 @@ func (p partitionPathPlan) format(data iceberg.StructLike) 
string {
 
                sb.WriteString(field.escapedName)
                sb.WriteByte('=')
-               value := field.transform.ToHumanStrType(field.resultType, 
data.Get(i))
+               value := field.transform.ToHumanString(field.resultType, 
data.Get(i))
                internal.AppendQueryEscaped(&sb, value)
        }
 
diff --git a/table/partition_path_bench_test.go 
b/table/partition_path_bench_test.go
index cd5822210..ca6cbc58f 100644
--- a/table/partition_path_bench_test.go
+++ b/table/partition_path_bench_test.go
@@ -43,7 +43,7 @@ func referencePartitionPathQueryEscape(p partitionPathPlan, 
data iceberg.StructL
                }
                builder.WriteString(field.escapedName)
                builder.WriteByte('=')
-               value := field.transform.ToHumanStrType(field.resultType, 
data.Get(i))
+               value := field.transform.ToHumanString(field.resultType, 
data.Get(i))
                builder.WriteString(url.QueryEscape(value))
        }
 
diff --git a/transforms.go b/transforms.go
index 64badaf93..44e6a5f1d 100644
--- a/transforms.go
+++ b/transforms.go
@@ -217,8 +217,8 @@ type Transform interface {
        Apply(Optional[Literal]) Optional[Literal]
        Project(name string, pred BoundPredicate) (UnboundPredicate, error)
 
-       // ToHumanStrType formats a partition value using its transformed 
result type.
-       ToHumanStrType(typ Type, val any) string
+       // ToHumanString formats a partition value using its transformed result 
type.
+       ToHumanString(typ Type, val any) string
 }
 
 // IdentityTransform uses the identity function, performing no transformation
@@ -258,9 +258,9 @@ func (IdentityTransform) Apply(value Optional[Literal]) 
Optional[Literal] {
        return value
 }
 
-// ToHumanStrType formats identity partition values, including UTC offsets for
+// ToHumanString formats identity partition values, including UTC offsets for
 // timestamp-with-zone source types.
-func (IdentityTransform) ToHumanStrType(typ Type, val any) string {
+func (IdentityTransform) ToHumanString(typ Type, val any) string {
        if val == nil {
                return "null"
        }
@@ -348,7 +348,7 @@ func (VoidTransform) Apply(value Optional[Literal]) 
Optional[Literal] {
        return Optional[Literal]{}
 }
 
-func (VoidTransform) ToHumanStrType(Type, any) string { return "null" }
+func (VoidTransform) ToHumanString(Type, any) string { return "null" }
 
 func (VoidTransform) Project(string, BoundPredicate) (UnboundPredicate, error) 
{
        return nil, nil
@@ -401,10 +401,10 @@ func (UnknownTransform) Apply(Optional[Literal]) 
Optional[Literal] {
        return Optional[Literal]{}
 }
 
-// ToHumanStrType renders the value, not the unknown transform name. This
+// ToHumanString renders the value, not the unknown transform name. This
 // keeps distinct partition values from collapsing into a single path.
-func (UnknownTransform) ToHumanStrType(typ Type, val any) string {
-       return IdentityTransform{}.ToHumanStrType(typ, val)
+func (UnknownTransform) ToHumanString(typ Type, val any) string {
+       return IdentityTransform{}.ToHumanString(typ, val)
 }
 
 // Project returns nil so scans don't prune on an unknown partition field.
@@ -617,7 +617,7 @@ func (t BucketTransform) Transformer(src Type) func(any) 
Optional[int32] {
        }
 }
 
-func (BucketTransform) ToHumanStrType(_ Type, val any) string {
+func (BucketTransform) ToHumanString(_ Type, val any) string {
        if val == nil {
                return "null"
        }
@@ -840,7 +840,7 @@ func (t TruncateTransform) Apply(value Optional[Literal]) 
(out Optional[Literal]
        return out
 }
 
-func (TruncateTransform) ToHumanStrType(_ Type, val any) string {
+func (TruncateTransform) ToHumanString(_ Type, val any) string {
        switch v := val.(type) {
        case nil:
                return "null"
@@ -1091,7 +1091,7 @@ func (YearTransform) Apply(value Optional[Literal]) (out 
Optional[Literal]) {
        return out
 }
 
-func (YearTransform) ToHumanStrType(_ Type, val any) string {
+func (YearTransform) ToHumanString(_ Type, val any) string {
        switch v := val.(type) {
        case int32:
                return strconv.Itoa(int(v) + epochTM.Year())
@@ -1192,7 +1192,7 @@ func (MonthTransform) Apply(value Optional[Literal]) (out 
Optional[Literal]) {
        return out
 }
 
-func (MonthTransform) ToHumanStrType(_ Type, val any) string {
+func (MonthTransform) ToHumanString(_ Type, val any) string {
        switch v := val.(type) {
        case int32:
                tm := epochTM.AddDate(0, int(v), 0)
@@ -1289,7 +1289,7 @@ func (DayTransform) Apply(value Optional[Literal]) (out 
Optional[Literal]) {
        return out
 }
 
-func (DayTransform) ToHumanStrType(_ Type, val any) string {
+func (DayTransform) ToHumanString(_ Type, val any) string {
        var days int32
        switch v := val.(type) {
        case Date:
@@ -1391,7 +1391,7 @@ func (HourTransform) Apply(value Optional[Literal]) (out 
Optional[Literal]) {
        return out
 }
 
-func (HourTransform) ToHumanStrType(_ Type, val any) string {
+func (HourTransform) ToHumanString(_ Type, val any) string {
        switch v := val.(type) {
        case int32:
                seconds := int64(v) * int64(time.Hour/time.Second)
diff --git a/transforms_test.go b/transforms_test.go
index f4921eddc..15c449131 100644
--- a/transforms_test.go
+++ b/transforms_test.go
@@ -143,8 +143,8 @@ func TestParseTransform(t *testing.T) {
 
                        // Human rendering is of the value, never the transform 
name.
                        u := tr.(iceberg.UnknownTransform)
-                       assert.Equal(t, "null", 
u.ToHumanStrType(iceberg.StringType{}, nil))
-                       assert.Equal(t, "abc", 
u.ToHumanStrType(iceberg.StringType{}, "abc"))
+                       assert.Equal(t, "null", 
u.ToHumanString(iceberg.StringType{}, nil))
+                       assert.Equal(t, "abc", 
u.ToHumanString(iceberg.StringType{}, "abc"))
                })
        }
 }
@@ -213,7 +213,7 @@ func TestUnknownTransformRejectsEmptyName(t *testing.T) {
        require.ErrorIs(t, err, iceberg.ErrInvalidTransform)
 }
 
-func TestToHumanStrTypeValues(t *testing.T) {
+func TestToHumanStringValues(t *testing.T) {
        decVal, _ := decimal.Decimal128FromString("14.21", 4, 2)
        negDecVal, _ := decimal.Decimal128FromString("-1.50", 9, 2)
 
@@ -263,12 +263,12 @@ func TestToHumanStrTypeValues(t *testing.T) {
 
        for _, tt := range tests {
                t.Run(tt.expected, func(t *testing.T) {
-                       assert.Equal(t, tt.expected, 
tt.transform.ToHumanStrType(tt.typ, tt.input))
+                       assert.Equal(t, tt.expected, 
tt.transform.ToHumanString(tt.typ, tt.input))
                })
        }
 }
 
-func TestToHumanStrType(t *testing.T) {
+func TestToHumanString(t *testing.T) {
        decVal, _ := decimal.Decimal128FromString("14.21", 4, 2)
        tsMicros := iceberg.Timestamp(1705314600000000)
        tsNanos := iceberg.TimestampNano(1705314600000000001)
@@ -305,7 +305,7 @@ func TestToHumanStrType(t *testing.T) {
 
        for _, tt := range tests {
                t.Run(tt.name, func(t *testing.T) {
-                       assert.Equal(t, tt.expected, 
tt.transform.ToHumanStrType(tt.typ, tt.input))
+                       assert.Equal(t, tt.expected, 
tt.transform.ToHumanString(tt.typ, tt.input))
                })
        }
 }
diff --git a/website/src/releases.md b/website/src/releases.md
index b83a6a6ef..67f72328d 100644
--- a/website/src/releases.md
+++ b/website/src/releases.md
@@ -49,7 +49,7 @@ Per-release notes (highlights, breaking changes, 
contributors) are published on
 - **Catalog identifier helper renamed.** `catalog.TableNameFromIdent` is 
removed. Use `catalog.ObjectNameFromIdent` for tables, views, and functions.
 - **Substrait expression conversion no longer takes case sensitivity.** 
`substrait.ConvertExpr(schema, expression, caseSensitive)` becomes 
`substrait.ConvertExpr(schema, expression)`. Case sensitivity remains part of 
expression binding.
 
-- **Transform formatting requires the result type.** 
`Transform.ToHumanStr(value)` is removed. Use 
`Transform.ToHumanStrType(resultType, value)` to format partition values, 
including timestamps with time zones.
+- **Transform formatting requires the result type and uses the Java-aligned 
method name.** `Transform.ToHumanStr(value)` and 
`Transform.ToHumanStrType(resultType, value)` are removed. Use 
`Transform.ToHumanString(resultType, value)` to format partition values, 
including timestamps with time zones.
 - **Catalogs now require cleanup.** The `catalog.Catalog` interface includes 
`Close() error`. Custom catalog implementations must provide `Close`, and 
callers should close catalog instances after use. `catalog.Closer` remains 
available as an alias for `io.Closer`.
 
 - **Puffin writer property setter renamed.** `puffin.Writer.AddProperties` is 
now `puffin.Writer.SetProperties`. Repeated calls still merge keys; use 
`ClearProperties` to clear custom properties before finishing.

Reply via email to