Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMORO-3120]Fix: Corrected issue with merging Parquet files without Field ID, which caused misaligned columns. #3122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.apache.iceberg.encryption.EncryptionManager;
import org.apache.iceberg.io.CloseableIterable;
import org.apache.iceberg.io.InputFile;
import org.apache.iceberg.mapping.NameMappingParser;
import org.apache.iceberg.parquet.Parquet;
import org.apache.iceberg.types.Type;
import org.apache.iceberg.types.TypeUtil;
Expand Down Expand Up @@ -191,13 +192,15 @@ private CloseableIterable<Record> openFile(
return avro.build();

case PARQUET:
Parquet.ReadBuilder parquet =
Parquet.read(input)
.project(fileProjection)
.createReaderFunc(
fileSchema ->
GenericParquetReaders.buildReader(
fileProjection, fileSchema, idToConstant));
Parquet.ReadBuilder parquet = Parquet.read(input)
.project(fileProjection)
.createReaderFunc(fileSchema ->
GenericParquetReaders.buildReader(fileProjection, fileSchema, idToConstant));

//Fix the issue that parquet file schema without field ID ,then compact misaligned columns issue
if (nameMapping != null && !nameMapping.isEmpty()) {
parquet.withNameMapping(NameMappingParser.fromJson(nameMapping));
}

if (reuseContainer) {
parquet.reuseContainers();
Expand Down
Loading