Skip to content

Commit c8b50f3

Browse files
author
zhangyongxiang.alpha
committed
[core] Support ignore corrupt or lost files during read
1 parent d20036c commit c8b50f3

4 files changed

Lines changed: 15 additions & 9 deletions

File tree

paimon-core/src/main/java/org/apache/paimon/KeyValueFileStore.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ public RawFileSplitRead newBatchRawFileRead() {
129129
valueType,
130130
FileFormatDiscover.of(options),
131131
pathFactory(),
132-
options.fileIndexReadEnabled(),
133-
false);
132+
options);
134133
}
135134

136135
public KeyValueFileReaderFactory.Builder newReaderFactoryBuilder() {

paimon-core/src/main/java/org/apache/paimon/io/ChainKeyValueFileReaderFactory.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ public ChainKeyValueFileReaderFactory(
5252
RowType valueType,
5353
FormatReaderMapping.Builder formatReaderMappingBuilder,
5454
DataFilePathFactory pathFactory,
55-
long asyncThreshold,
5655
BinaryRow partition,
5756
DeletionVector.Factory dvFactory,
58-
ChainReadContext chainReadContext) {
57+
ChainReadContext chainReadContext,
58+
CoreOptions coreOptions) {
5959
super(
6060
fileIO,
6161
schemaManager,
@@ -64,9 +64,9 @@ public ChainKeyValueFileReaderFactory(
6464
valueType,
6565
formatReaderMappingBuilder,
6666
pathFactory,
67-
asyncThreshold,
6867
partition,
69-
dvFactory);
68+
dvFactory,
69+
coreOptions);
7070
this.chainReadContext = chainReadContext;
7171
CoreOptions options = new CoreOptions(schema.options());
7272
this.currentBranch = options.branch();
@@ -132,10 +132,10 @@ public ChainKeyValueFileReaderFactory build(
132132
wrapped.readValueType,
133133
builder,
134134
wrapped.pathFactory.createChainReadDataFilePathFactory(chainReadContext),
135-
wrapped.options.fileReaderAsyncThreshold().getBytes(),
136135
partition,
137136
dvFactory,
138-
chainReadContext);
137+
chainReadContext,
138+
wrapped.options);
139139
}
140140
}
141141
}

paimon-core/src/main/java/org/apache/paimon/io/KeyValueFileReaderFactory.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,5 +319,9 @@ protected FormatReaderMapping.Builder formatReaderMappingBuilder(
319319
public FileIO fileIO() {
320320
return fileIO;
321321
}
322+
323+
public CoreOptions options() {
324+
return options;
325+
}
322326
}
323327
}

paimon-core/src/main/java/org/apache/paimon/table/format/FormatReadBuilder.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,17 @@ protected RecordReader<InternalRow> createReader(FormatDataSplit dataSplit) thro
195195
return new DataFileRecordReader(
196196
readType(),
197197
reader,
198+
options.scanIgnoreCorruptFile(),
199+
options.scanIgnoreLostFile(),
198200
null,
199201
null,
200202
PartitionUtils.create(partitionMapping, dataSplit.partition()),
201203
false,
202204
null,
203205
0,
204206
Collections.emptyMap(),
205-
null);
207+
null,
208+
formatReaderContext.filePath());
206209
} catch (Exception e) {
207210
FileUtils.checkExists(formatReaderContext.fileIO(), formatReaderContext.filePath());
208211
throw e;

0 commit comments

Comments
 (0)