laskoviymishka commented on code in PR #2444:
URL: https://github.com/apache/iceberg-go/pull/2444#discussion_r4640096706


##########
table/stats_ndv.go:
##########
@@ -0,0 +1,237 @@
+// 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
+
+import (
+       "context"
+       "fmt"
+       "slices"
+
+       "github.com/apache/arrow-go/v18/arrow"
+       "github.com/apache/iceberg-go"
+       "github.com/apache/iceberg-go/table/stats"
+)
+
+// NDVStats is the result of ComputeNDVs.
+type NDVStats struct {
+       // Snapshot is the snapshot the sketches were computed over. Its ID and
+       // sequence number identify the sketches when they are written to a 
Puffin
+       // statistics file. It is nil when the table has no snapshot.
+       Snapshot *Snapshot
+       // Columns holds one sketch per analyzed column, keyed by field ID.
+       Columns map[int]NDVResult
+}
+
+// NDVResult is the number-of-distinct-values sketch computed for one column.
+type NDVResult struct {
+       // FieldID is the Iceberg field ID of the column.
+       FieldID int

Review Comment:
   Could we drop `FieldID` before apidiff freezes this type? `Columns` is 
already [keyed by field 
ID](https://github.com/apache/iceberg-go/blob/5a2ed713ae82091739c8f994bc6cbbf116ad2242/table/stats_ndv.go#L36-L43),
 and 
[L136](https://github.com/apache/iceberg-go/blob/5a2ed713ae82091739c8f994bc6cbbf116ad2242/table/stats_ndv.go#L134-L141)
 writes `tgt.field.ID` into both, so removing it later would be a breaking 
change. If you'd rather keep it for callers that pass an `NDVResult` around on 
its own, that's fine too.



-- 
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]

Reply via email to