badalprasadsingh commented on code in PR #2576:
URL: https://github.com/apache/iceberg-go/pull/2576#discussion_r4572577391
##########
table/sorting.go:
##########
@@ -271,6 +271,27 @@ func validateSortSourceIDs(ids []int, binding
orderBinding) error {
return nil
}
+// validateSortTransformSources rejects multiple sources for Iceberg's known
+// single-argument transforms when creating new orders. Existing metadata must
+// remain readable and serializable; unknown transforms may have multiple
inputs.
Review Comment:
P1: broadening my earlier ask: a SortOrder decoded from json, or taken from
an older table, still reaches CreateTable, ReplaceSortOrder or CommitTable and
gets written with source-ids
#2559 rejects this for partition specs, can `MetadataBuilder.AddSortOrder`
also check new orders? existing orders skip it, so old tables still work.
##########
table/sorting_source_arity_test.go:
##########
@@ -0,0 +1,111 @@
+// 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 table_test
+
+import (
+ "encoding/json"
+ "fmt"
+ "testing"
+
+ "github.com/apache/iceberg-go"
+ "github.com/apache/iceberg-go/table"
+ "github.com/stretchr/testify/require"
+)
+
+func TestSingleArgumentSortTransformsRejectMultipleSources(t *testing.T) {
Review Comment:
can a test decode a SortOrder with source-ids [1,2] on bucket[16] and check
that NewMetadata and ReplaceSortOrder return ErrInvalidSortSourceID? the legacy
test already shows existing orders keep working
--
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]