badalprasadsingh commented on code in PR #2577:
URL: https://github.com/apache/iceberg-go/pull/2577#discussion_r4564748814


##########
table/internal/parquet_unmapped_columns_test.go:
##########
@@ -0,0 +1,132 @@
+// 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 internal_test
+
+import (
+       "bytes"
+       "testing"
+
+       "github.com/apache/arrow-go/v18/arrow"
+       "github.com/apache/arrow-go/v18/arrow/memory"
+       "github.com/apache/arrow-go/v18/parquet"
+       "github.com/apache/arrow-go/v18/parquet/file"
+       "github.com/apache/arrow-go/v18/parquet/pqarrow"
+       "github.com/apache/arrow-go/v18/parquet/schema"
+       "github.com/apache/iceberg-go"
+       "github.com/apache/iceberg-go/table/internal"
+       "github.com/stretchr/testify/require"
+)
+
+// A Parquet file may contain imported columns that have neither an embedded
+// field ID nor an entry in the table's name mapping. Such columns must not
+// prevent the reader from projecting known Iceberg columns.
+func TestPruneParquetSkipsUnmappedIDLessColumns(t *testing.T) {

Review Comment:
   can we add a scan test next to TestScanWithIDLessNameMappingFields, using a 
file with no embedded ids (like a Spark add_files import), unmapped top-level 
and nested columns, and a read of only a later-added column?
   
   this test calls PrunedSchema directly, so it can't catch the carrier gap



##########
table/internal/parquet_files.go:
##########


Review Comment:
   `UpdateSchema().AddColumn("extra")` without WithNameMapping now reads nulls 
from imported files that hold extra values -> iceberg-ava updates the mapping 
and reads them
   
   it's the #2512 UpdateSchema gap, now for any unmapped column -> could you 
open the issue we asked for there and link it here?



##########
table/internal/parquet_files.go:
##########
@@ -3236,6 +3238,12 @@ func (p *pruneParquetSchema) fieldID(field arrow.Field, 
mapping *iceberg.MappedF
                return mapping.ID()
        }
 
+       // A name mapping may omit fields present only in the data file.
+       // Unmapped fields cannot match any projected Iceberg ID, so skip them.
+       if p.hasNameMapping {
+               return -1
+       }

Review Comment:
   P1: reads where no selected column is in the file still fail -> #2482's 
carrier in prepareToRead converts the full file schema and hits field missing 
from name mapping, e.g. WithSelectedFields("z") with z added after the import
   
   can that carrier give unmapped columns ID -1, like entries without field-id?



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