zeroshade commented on code in PR #1379:
URL: https://github.com/apache/iceberg-go/pull/1379#discussion_r3523575868
##########
cmd/iceberg/utils.go:
##########
@@ -48,31 +49,33 @@ func parseProperties(propStr string) (iceberg.Properties,
error) {
return props, nil
}
-func parsePartitionSpec(specStr string) (*iceberg.PartitionSpec, error) {
+func parsePartitionSpec(specStr string, schema *iceberg.Schema)
(*iceberg.PartitionSpec, error) {
+ if schema == nil {
+ return nil, errors.New("schema is required for partition spec
parsing")
+ }
+
if specStr == "" {
return iceberg.UnpartitionedSpec, nil
}
fields := strings.Split(specStr, ",")
- var partitionFields []iceberg.PartitionField
+ opts := make([]iceberg.PartitionOption, 0)
- for i, field := range fields {
+ for _, field := range fields {
field = strings.TrimSpace(field)
if field == "" {
continue
Review Comment:
Passing `nil` here leaves each generated `PartitionField.FieldID` at the
internal unassigned value (`0`). `NewPartitionSpecOpts` validates/initializes
the spec but does not assign partition field IDs, and REST create-table
serializes this spec directly in the request payload. Please assign IDs while
parsing (for example `iceberg.PartitionDataIDStart + len(opts)`) and add
assertions that parsed fields receive `1000`, `1001`, ... plus a REST
create-payload regression test.
--
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]