zeroshade commented on code in PR #1365:
URL: https://github.com/apache/iceberg-go/pull/1365#discussion_r3522375807
##########
transforms.go:
##########
@@ -244,6 +244,14 @@ func (t BucketTransform) MarshalText() ([]byte, error) {
func (t BucketTransform) String() string { return fmt.Sprintf("bucket[%d]",
t.NumBuckets) }
+func (t BucketTransform) validateNumBuckets() error {
Review Comment:
[MAJOR] This helper is used for Apply/Transformer/Project, but
BucketTransform.MarshalText (~line 241) and NewPartitionSpecID in partitions.go
(~line 353) still allow a direct BucketTransform{NumBuckets <= 0} to be stored
and serialized as invalid "bucket[0]"/"bucket[-1]". Only ParseTransform /
JSON-unmarshal validate. Please validate in BucketTransform.MarshalText (return
ErrInvalidArgument for NumBuckets<=0) and/or in the error-returning spec
construction paths (NewPartitionSpecOpts/addSpecFieldInternal), or add a
validating NewBucketTransform constructor. Add tests for negative direct
structs and for json.Marshal/spec construction rejecting NumBuckets<=0.
--
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]