From 2eaac4ce7ee244c7b88f8fe76e4d138ec5522d05 Mon Sep 17 00:00:00 2001 From: Tyler Adkins Date: Sun, 3 May 2026 02:12:18 -0400 Subject: [PATCH] fix(dataset get): partitionColumn is an object, not a string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GET /api/v1/datasets/{id} returns partitionColumn as an object {name, columnType} (or null), but DatasetDetail.PartitionColumn was typed as string, causing every dataset get on a partitioned dataset to fail with: json: cannot unmarshal object into Go struct field DatasetDetail.partitionColumn of type string Introduce PartitionColumnInfo struct, change DatasetDetail.PartitionColumn to *PartitionColumnInfo, and update the two display sites + the JSON output map to handle the new shape (display "Name (columnType)", JSON emits the column name only since the surrounding map is still flat). The TimePartitionRequest.PartitionColumn (request payload) stays as string — it's just the column name on update. --- go/cmd/dataset.go | 22 +++++++++++++++++----- go/internal/api/datasets.go | 9 ++++++++- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/go/cmd/dataset.go b/go/cmd/dataset.go index 3f8dc94..5a7a304 100644 --- a/go/cmd/dataset.go +++ b/go/cmd/dataset.go @@ -209,6 +209,10 @@ var datasetGetCmd = &cobra.Command{ } if output.EffectiveFmt(GCtx) == "json" { + pc := "" + if ds.PartitionColumn != nil { + pc = ds.PartitionColumn.Name + } item := map[string]string{ "id": ds.ID, "name": ds.Name, @@ -217,7 +221,7 @@ var datasetGetCmd = &cobra.Command{ "status": ds.DataQualityStatus, "checks": fmt.Sprintf("%.0f", ds.Checks), "incidents": fmt.Sprintf("%.0f", ds.Incidents), - "partitionColumn": ds.PartitionColumn, + "partitionColumn": pc, "updated": ds.LastUpdated, "cloudUrl": ds.CloudURL, } @@ -235,8 +239,12 @@ var datasetGetCmd = &cobra.Command{ } fmt.Printf(" %-22s %.0f\n", output.Bold.Render("Checks"), ds.Checks) fmt.Printf(" %-22s %.0f\n", output.Bold.Render("Incidents"), ds.Incidents) - if ds.PartitionColumn != "" { - fmt.Printf(" %-22s %s\n", output.Bold.Render("Partition column"), ds.PartitionColumn) + if ds.PartitionColumn != nil && ds.PartitionColumn.Name != "" { + label := ds.PartitionColumn.Name + if ds.PartitionColumn.ColumnType != "" { + label = fmt.Sprintf("%s (%s)", ds.PartitionColumn.Name, ds.PartitionColumn.ColumnType) + } + fmt.Printf(" %-22s %s\n", output.Bold.Render("Partition column"), label) } if len(ds.Tags) > 0 { fmt.Printf(" %-22s %s\n", output.Bold.Render("Tags"), strings.Join(ds.Tags, ", ")) @@ -357,8 +365,12 @@ var datasetTimePartitionCmd = &cobra.Command{ } fmt.Printf(" %-22s %s\n", output.Bold.Render("Dataset"), ds.Name) fmt.Printf(" %-22s %s\n", output.Bold.Render("ID"), output.Dim.Render(ds.ID)) - if ds.PartitionColumn != "" { - fmt.Printf(" %-22s %s\n", output.Bold.Render("Partition column"), ds.PartitionColumn) + if ds.PartitionColumn != nil && ds.PartitionColumn.Name != "" { + label := ds.PartitionColumn.Name + if ds.PartitionColumn.ColumnType != "" { + label = fmt.Sprintf("%s (%s)", ds.PartitionColumn.Name, ds.PartitionColumn.ColumnType) + } + fmt.Printf(" %-22s %s\n", output.Bold.Render("Partition column"), label) } else { fmt.Printf(" %-22s %s\n", output.Bold.Render("Partition column"), output.Dim.Render("not set")) } diff --git a/go/internal/api/datasets.go b/go/internal/api/datasets.go index c46aa6d..a94be3e 100644 --- a/go/internal/api/datasets.go +++ b/go/internal/api/datasets.go @@ -256,10 +256,17 @@ type DatasetDetail struct { Datasource DatasourceProperties `json:"datasource"` Tags []string `json:"tags"` LastUpdated string `json:"lastUpdated"` - PartitionColumn string `json:"partitionColumn"` + PartitionColumn *PartitionColumnInfo `json:"partitionColumn"` Owners []DatasetOwnerInfo `json:"owners"` } +// PartitionColumnInfo is the shape returned by GET /api/v1/datasets/{id} for +// time-partitioned datasets: {name, columnType}. nil when unpartitioned. +type PartitionColumnInfo struct { + Name string `json:"name"` + ColumnType string `json:"columnType"` +} + type DatasetOwnerInfo struct { Type string `json:"type"` UserID string `json:"userId"`