fallintoplace commented on code in PR #2577:
URL: https://github.com/apache/iceberg-go/pull/2577#discussion_r4566841515
##########
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:
Fixed in 4f1bdc4. The carrier now gives unmapped columns a temporary -1 ID.
##########
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:
Added a scan test for this in be694e6.
##########
table/internal/parquet_files.go:
##########
Review Comment:
Opened #2583 for this. Thanks!
--
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]