This is an automated email from the ASF dual-hosted git repository.

zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-go.git


The following commit(s) were added to refs/heads/main by this push:
     new a4fb4d0da refactor: export the position delete file_path and pos field 
IDs (#2245)
a4fb4d0da is described below

commit a4fb4d0dafaeaf455990c1c3142462107662e5ec
Author: Revanth <[email protected]>
AuthorDate: Wed Oct 21 17:45:46 2026 -0500

    refactor: export the position delete file_path and pos field IDs (#2245)
---
 manifest.go                       |  4 ++--
 metadata_columns.go               | 11 +++++++++++
 table/data_file_meta.go           |  6 ++----
 table/inspect_position_deletes.go |  4 ++--
 table/internal/parquet_files.go   |  6 +-----
 5 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/manifest.go b/manifest.go
index 08cb21011..eed525b1d 100644
--- a/manifest.go
+++ b/manifest.go
@@ -3361,6 +3361,6 @@ type ManifestEntry interface {
 }
 
 var PositionalDeleteSchema = NewSchema(0,
-       NestedField{ID: 2147483546, Type: PrimitiveTypes.String, Name: 
"file_path", Required: true},
-       NestedField{ID: 2147483545, Type: PrimitiveTypes.Int64, Name: "pos", 
Required: true},
+       NestedField{ID: DeleteFilePathFieldID, Type: PrimitiveTypes.String, 
Name: "file_path", Required: true},
+       NestedField{ID: DeleteFilePosFieldID, Type: PrimitiveTypes.Int64, Name: 
"pos", Required: true},
 )
diff --git a/metadata_columns.go b/metadata_columns.go
index a1b509a55..3e2fe4577 100644
--- a/metadata_columns.go
+++ b/metadata_columns.go
@@ -43,6 +43,17 @@ const (
        LastUpdatedSequenceNumberFieldID = 2147483539
 )
 
+// Position delete file column field IDs. Reserved IDs are Integer.MAX_VALUE - 
101
+// and Integer.MAX_VALUE - 102 per the Iceberg spec (Position Delete Files).
+const (
+       // DeleteFilePathFieldID is the field ID for file_path (required 
string), the
+       // data file a position delete applies to. Reserved as 
Integer.MAX_VALUE - 101.
+       DeleteFilePathFieldID = 2147483546
+       // DeleteFilePosFieldID is the field ID for pos (required long), the 
ordinal
+       // of the deleted row in that file. Reserved as Integer.MAX_VALUE - 102.
+       DeleteFilePosFieldID = 2147483545
+)
+
 // Row lineage metadata column names (v3+).
 const (
        RowIDColumnName                     = "_row_id"
diff --git a/table/data_file_meta.go b/table/data_file_meta.go
index 7b8e116ed..99a5fdff4 100644
--- a/table/data_file_meta.go
+++ b/table/data_file_meta.go
@@ -28,8 +28,6 @@ import (
        tblutils "github.com/apache/iceberg-go/table/internal"
 )
 
-const referencedDataFilePathFieldID = 2147483546
-
 // DataFileArgs collects everything needed to compute a fully populated
 // [iceberg.DataFile] (data, equality-delete, or positional-delete) from
 // a file's in-memory, format-specific metadata object without performing
@@ -255,7 +253,7 @@ func DataFileFromMetadata(args DataFileArgs) 
(iceberg.DataFile, error) {
                if statsProps == nil {
                        statsProps = iceberg.Properties{}
                }
-               if colName, ok := 
args.Schema.FindColumnName(referencedDataFilePathFieldID); ok {
+               if colName, ok := 
args.Schema.FindColumnName(iceberg.DeleteFilePathFieldID); ok {
                        statsProps[MetricsModeColumnConfPrefix+"."+colName] = 
string(tblutils.MetricModeFull)
                }
        }
@@ -335,7 +333,7 @@ func DataFileFromMetadata(args DataFileArgs) 
(iceberg.DataFile, error) {
 
 func verifyReferencedDataFile(df iceberg.DataFile, ref string) error {
        decode := func(bounds map[int][]byte, which string) (string, error) {
-               raw, ok := bounds[referencedDataFilePathFieldID]
+               raw, ok := bounds[iceberg.DeleteFilePathFieldID]
                if !ok {
                        return "", fmt.Errorf(
                                "referenced_data_file %q is set but the 
position-delete file_path column has no %s bound",
diff --git a/table/inspect_position_deletes.go 
b/table/inspect_position_deletes.go
index 924aef562..a4f55ba4e 100644
--- a/table/inspect_position_deletes.go
+++ b/table/inspect_position_deletes.go
@@ -35,8 +35,8 @@ import (
 )
 
 const (
-       positionDeleteFilePathID       = math.MaxInt32 - 101
-       positionDeletePosID            = math.MaxInt32 - 102
+       positionDeleteFilePathID       = iceberg.DeleteFilePathFieldID
+       positionDeletePosID            = iceberg.DeleteFilePosFieldID
        positionDeleteRowID            = math.MaxInt32 - 103
        positionDeletePartitionID      = math.MaxInt32 - 5
        positionDeleteSpecID           = math.MaxInt32 - 4
diff --git a/table/internal/parquet_files.go b/table/internal/parquet_files.go
index e023739ce..eb714a07d 100644
--- a/table/internal/parquet_files.go
+++ b/table/internal/parquet_files.go
@@ -1280,10 +1280,6 @@ func (w *ParquetFileWriter) Close() (_ iceberg.DataFile, 
err error) {
        return stats.ToDataFile(opts), nil
 }
 
-// posDeleteFilePathFieldID is the reserved field ID of the file_path column
-// in a position delete file.
-const posDeleteFilePathFieldID = 2147483546
-
 // singleReferencedDataFile returns the data file path when every delete in a
 // position delete file targets that one file, or nil otherwise. It compares
 // the untruncated file_path min and max, which position delete writers always
@@ -1291,7 +1287,7 @@ const posDeleteFilePathFieldID = 2147483546
 // PositionDeleteWriter leaves the field unset; the spec allows it on position
 // delete files with a single target.
 func singleReferencedDataFile(stats *DataFileStatistics) *string {
-       agg, ok := stats.ColAggs[posDeleteFilePathFieldID]
+       agg, ok := stats.ColAggs[iceberg.DeleteFilePathFieldID]
        if !ok {
                return nil
        }

Reply via email to