C-Loftus commented on issue #1080:
URL: https://github.com/apache/iceberg-go/issues/1080#issuecomment-4453604242
Thank you so much @tanmayrauth that makes sense! As one minor follow up if
you don't mind, I see that upon table creation you can pass the
`iceberg.TruncateTransform` in two different places. Does it matter where this
is specified? Is one a better practice?
1. Within an `iceberg.PartitionSpec` via `catalog.WithPartitionSpec`. That
struct has a `iceberg.PartitionField` field which could take in a
`iceberg.TruncateTransform`
2. Within a `table.SortOrder` via `catalog.WithSortOrder`. That struct has a
sort field which could take in `iceberg.TruncateTransform`
## Example
```go
partitionSpec := iceberg.NewPartitionSpec(
iceberg.PartitionField{SourceIDs: []int{2}, Transform:
iceberg.TruncateTransform{Width: 20}, Name: "project_partition"},
)
// this could also take in a Transform struct. Is that better to do? vvvvvvv
sortField := table.SortField{SourceIDs: []int{2}, Direction: table.SortASC}
sortOrder, err := table.NewSortOrder(table.InitialSortOrderID,
[]table.SortField{sortField})
tbl, err := cat.CreateTable(ctx, tableIdent, icebergSchema,
catalog.WithPartitionSpec(&partitionSpec),
catalog.WithSortOrder(sortOrder),
// abbreviated for clarity...
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]