Repository: apache/iceberg-go
Pull request #158 (2024-09-29 08:46:01)

build(deps): bump github.com/aws/aws-sdk-go-v2/config from 1.27.33 to 1.27.39
Bumps [github.com/aws/aws-sdk-go-v2/config](https://github.com/aws/aws-sdk-go-v2) from 1.27.33 to 1.27.39.
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/aws/aws-sdk-go-v2/commit/22efd7712b3738e45ecab4429df34d60caad0310"><code>22efd77</code></a> Release 2024-09-27</li>
<li><a href="https://github.com/aws/aws-sdk-go-v2/commit/ce669cae191a2f9abaf6335ddd70c406ec73d8de"><code>ce669ca</code></a> Regenerated Clients</li>
<li><a href="https://github.com/aws/aws-sdk-go-v2/commit/b0084471ffefb9962d2fef39013b9c86b029431c"><code>b008447</code></a> Update endpoints model</li>
<li><a href="https://github.com/aws/aws-sdk-go-v2/commit/a912d17bf44dff5ea0cd750a062f4c88ce27b939"><code>a912d17</code></a> Update API model</li>
<li><a href="https://github.com/aws/aws-sdk-go-v2/commit/9306dbe4f90db9893b7fd9dbc3aa10a451059c9f"><code>9306dbe</code></a> remove deprecated worklink service (<a href="https://redirect.github.com/aws/aws-sdk-go-v2/issues/2814">#2814</a>)</li>
<li><a href="https://github.com/aws/aws-sdk-go-v2/commit/d795d86c05c4c80bf513b171ab24d46d01f17062"><code>d795d86</code></a> Release 2024-09-26</li>
<li><a href="https://github.com/aws/aws-sdk-go-v2/commit/03c35535f7e52ce38e54249b3267a1b9aa4e1ab4"><code>03c3553</code></a> Regenerated Clients</li>
<li><a href="https://github.com/aws/aws-sdk-go-v2/commit/b1c6a1f231eda85d6fe8342f1547571c68dd135b"><code>b1c6a1f</code></a> Update endpoints model</li>
<li><a href="https://github.com/aws/aws-sdk-go-v2/commit/a51f8d95851407cc4369f559cb1eab7b04afab3c"><code>a51f8d9</code></a> Update API model</li>
<li><a href="https://github.com/aws/aws-sdk-go-v2/commit/3a96a42cb9478b39c0cb9c0395b1cf4ed785fb9f"><code>3a96a42</code></a> update changelog (<a href="https://redirect.github.com/aws/aws-sdk-go-v2/issues/2805">#2805</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/aws/aws-sdk-go-v2/compare/config/v1.27.33...config/v1.27.39">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/aws/aws-sdk-go-v2/config&package-manager=go_modules&previous-version=1.27.33&new-version=1.27.39)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/go.mod b/go.mod
index 20b2df9..9e43f31 100644
--- a/go.mod
+++ b/go.mod
@@ -22,7 +22,7 @@ go 1.21
 require (
 	github.com/apache/arrow/go/v16 v16.1.0
 	github.com/aws/aws-sdk-go-v2 v1.31.0
-	github.com/aws/aws-sdk-go-v2/config v1.27.33
+	github.com/aws/aws-sdk-go-v2/config v1.27.39
 	github.com/aws/aws-sdk-go-v2/credentials v1.17.37
 	github.com/aws/aws-sdk-go-v2/service/glue v1.99.2
 	github.com/aws/aws-sdk-go-v2/service/s3 v1.61.2
diff --git a/go.sum b/go.sum
index 5ea65b2..d4cbd7c 100644
--- a/go.sum
+++ b/go.sum
@@ -22,8 +22,8 @@ github.com/aws/aws-sdk-go-v2 v1.31.0 h1:3V05LbxTSItI5kUqNwhJrrrY1BAXxXt0sN0l72Qm
 github.com/aws/aws-sdk-go-v2 v1.31.0/go.mod h1:ztolYtaEUtdpf9Wftr31CJfLVjOnD/CVRkKOOYgF8hA=
 github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4 h1:70PVAiL15/aBMh5LThwgXdSQorVr91L127ttckI9QQU=
 github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.4/go.mod h1:/MQxMqci8tlqDH+pjmoLu1i0tbWCUP1hhyMRuFxpQCw=
-github.com/aws/aws-sdk-go-v2/config v1.27.33 h1:Nof9o/MsmH4oa0s2q9a0k7tMz5x/Yj5k06lDODWz3BU=
-github.com/aws/aws-sdk-go-v2/config v1.27.33/go.mod h1:kEqdYzRb8dd8Sy2pOdEbExTTF5v7ozEXX0McgPE7xks=
+github.com/aws/aws-sdk-go-v2/config v1.27.39 h1:FCylu78eTGzW1ynHcongXK9YHtoXD5AiiUqq3YfJYjU=
+github.com/aws/aws-sdk-go-v2/config v1.27.39/go.mod h1:wczj2hbyskP4LjMKBEZwPRO1shXY+GsQleab+ZXT2ik=
 github.com/aws/aws-sdk-go-v2/credentials v1.17.37 h1:G2aOH01yW8X373JK419THj5QVqu9vKEwxSEsGxihoW0=
 github.com/aws/aws-sdk-go-v2/credentials v1.17.37/go.mod h1:0ecCjlb7htYCptRD45lXJ6aJDQac6D2NlKGpZqyTG6A=
 github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.14 h1:C/d03NAmh8C4BZXhuRNboF/DqhBkBCeDiJDcaqIT5pA=


Test patch:
diff --git a/cmd/iceberg/output_test.go b/cmd/iceberg/output_test.go
new file mode 100644
index 0000000..5907660
--- /dev/null
+++ b/cmd/iceberg/output_test.go
@@ -0,0 +1,195 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package main
+
+import (
+	"bytes"
+	"testing"
+
+	"github.com/apache/iceberg-go/table"
+	"github.com/pterm/pterm"
+	"github.com/stretchr/testify/assert"
+)
+
+var testArgs = []struct {
+	meta     string
+	expected string
+}{
+	{`{
+    "format-version": 2,
+    "table-uuid": "9c12d441-03fe-4693-9a96-a0705ddf69c1",
+    "location": "s3://bucket/test/location",
+    "last-sequence-number": 0,
+    "last-updated-ms": 1602638573590,
+    "last-column-id": 3,
+    "current-schema-id": 0,
+    "schemas": [
+        {"type": "struct", "schema-id": 0, "fields": [{"id": 1, "name": "x", "required": true, "type": "long"}]},
+        {
+            "type": "struct",
+            "fields": [
+                {"id": 1, "name": "x", "required": true, "type": "long"}
+            ]
+        }
+    ],
+    "default-spec-id": 0,
+    "partition-specs": [{"spec-id": 0, "fields": []}],
+    "last-partition-id": 1000,
+    "default-sort-order-id": 0,
+    "sort-orders": [
+        {
+            "order-id": 0,
+            "fields": [ ]
+        }
+    ],
+    "properties": {"read.split.target.size": "134217728"},
+    "current-snapshot-id": -1,
+    "snapshots": [ ],
+    "snapshot-log": [ ],
+    "metadata-log": [ ],
+    "refs": { }
+}`, 
+`Table format version | 2
+Metadata location    | 
+Table UUID           | 9c12d441-03fe-4693-9a96-a0705ddf69c1
+Last updated         | 1602638573590
+Sort Order           | 0: []
+Partition Spec       | []
+
+Current Schema, id=0
+└──1: x: required long
+
+Current Snapshot | 
+
+Snapshots
+
+Properties
+key                    | value
+----------------------------------
+read.split.target.size | 134217728
+
+`},
+	{`{
+    "format-version": 2,
+    "table-uuid": "9c12d441-03fe-4693-9a96-a0705ddf69c1",
+    "location": "s3://bucket/test/location",
+    "last-sequence-number": 34,
+    "last-updated-ms": 1602638573590,
+    "last-column-id": 3,
+    "current-schema-id": 1,
+    "schemas": [
+        {"type": "struct", "schema-id": 0, "fields": [{"id": 1, "name": "x", "required": true, "type": "long"}]},
+        {
+            "type": "struct",
+            "schema-id": 1,
+            "identifier-field-ids": [1, 2],
+            "fields": [
+                {"id": 1, "name": "x", "required": true, "type": "long"},
+                {"id": 2, "name": "y", "required": true, "type": "long", "doc": "comment"},
+                {"id": 3, "name": "z", "required": true, "type": "long"}
+            ]
+        }
+    ],
+    "default-spec-id": 0,
+    "partition-specs": [{"spec-id": 0, "fields": [{"name": "x", "transform": "identity", "source-id": 1, "field-id": 1000}]}],
+    "last-partition-id": 1000,
+    "default-sort-order-id": 3,
+    "sort-orders": [
+        {
+            "order-id": 3,
+            "fields": [
+                {"transform": "identity", "source-id": 2, "direction": "asc", "null-order": "nulls-first"},
+                {"transform": "bucket[4]", "source-id": 3, "direction": "desc", "null-order": "nulls-last"}
+            ]
+        }
+    ],
+    "properties": {"read.split.target.size": "134217728"},
+    "current-snapshot-id": 3055729675574597004,
+    "snapshots": [
+        {
+            "snapshot-id": 3051729675574597004,
+            "timestamp-ms": 1515100955770,
+            "sequence-number": 0,
+            "summary": {"operation": "append"},
+            "manifest-list": "s3://a/b/1.avro",
+	    "schema-id": 1
+        },
+        {
+            "snapshot-id": 3055729675574597004,
+            "parent-snapshot-id": 3051729675574597004,
+            "timestamp-ms": 1555100955770,
+            "sequence-number": 1,
+            "summary": {"operation": "append"},
+            "manifest-list": "s3://a/b/2.avro",
+            "schema-id": 1
+        }
+    ],
+    "snapshot-log": [
+        {"snapshot-id": 3051729675574597004, "timestamp-ms": 1515100955770},
+        {"snapshot-id": 3055729675574597004, "timestamp-ms": 1555100955770}
+    ],
+    "metadata-log": [{"metadata-file": "s3://bucket/.../v1.json", "timestamp-ms": 1515100}],
+    "refs": {"test": {"snapshot-id": 3051729675574597004, "type": "tag", "max-ref-age-ms": 10000000}}
+}`, 
+`Table format version | 2
+Metadata location    | 
+Table UUID           | 9c12d441-03fe-4693-9a96-a0705ddf69c1
+Last updated         | 1602638573590
+Sort Order           | 3: [
+                     | 2 asc nulls-first
+                     | bucket[4](3) desc nulls-last
+                     | ]
+Partition Spec       | [
+                     | 	1000: x: identity(1)
+                     | ]
+
+Current Schema, id=1
+├──1: x: required long
+├──2: y: required long (comment)
+└──3: z: required long
+
+Current Snapshot | append, {}: id=3055729675574597004, parent_id=3051729675574597004, schema_id=1, sequence_number=1, timestamp_ms=1555100955770, manifest_list=s3://a/b/2.avro
+
+Snapshots
+├──Snapshot 3051729675574597004, schema 1: s3://a/b/1.avro
+└──Snapshot 3055729675574597004, schema 1: s3://a/b/2.avro
+
+Properties
+key                    | value
+----------------------------------
+read.split.target.size | 134217728
+
+`},
+}
+
+
+func TestDescribeTable(t *testing.T) {
+	var buf bytes.Buffer
+	pterm.SetDefaultOutput(&buf)
+	pterm.DisableColor()
+
+	for _, tt := range testArgs {
+		meta, _ := table.ParseMetadataBytes([]byte(tt.meta))
+		table := table.New([]string{"t"}, meta, "", nil)
+		buf.Reset()
+
+		text{}.DescribeTable(table)
+
+		assert.Equal(t, tt.expected, buf.String())
+	}
+}