Skip to content

Commit 7b8e946

Browse files
committed
fix
1 parent 1c8e192 commit 7b8e946

2 files changed

Lines changed: 15 additions & 14 deletions

File tree

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/util/builder/PipeTableModelTsFileBuilderV2.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,22 @@ private void writeTabletsIntoOneFile(
164164
List<IMeasurementSchema> aggregatedSchemas =
165165
tablets.stream()
166166
.flatMap(tablet -> tablet.getSchemas().stream())
167-
.filter(Objects::nonNull)
168167
.collect(Collectors.toList());
169168
List<ColumnCategory> aggregatedColumnCategories =
170169
tablets.stream()
171170
.flatMap(tablet -> tablet.getColumnTypes().stream())
172-
.filter(Objects::nonNull)
173171
.collect(Collectors.toList());
174172

175173
final Set<IMeasurementSchema> seen = new HashSet<>();
176174
final List<Integer> distinctIndices =
177175
IntStream.range(0, aggregatedSchemas.size())
178176
.filter(
179-
i -> seen.add(aggregatedSchemas.get(i))) // Only keep the first occurrence index
177+
i -> {
178+
if (Objects.nonNull(aggregatedSchemas.get(i))) {
179+
return seen.add(aggregatedSchemas.get(i));
180+
}
181+
return false;
182+
}) // Only keep the first occurrence index
180183
.boxed()
181184
.collect(Collectors.toList());
182185

@@ -222,24 +225,25 @@ private void writeTabletsIntoOneFile(
222225
// the data of the table model is aligned
223226
true,
224227
tablet.getSchemas().stream()
225-
.filter(Objects::nonNull)
226-
.map(IMeasurementSchema::getMeasurementName)
228+
.map(m -> Objects.nonNull(m) ? m.getMeasurementName() : null)
227229
.toArray(String[]::new),
228230
tablet.getSchemas().stream()
229-
.map(IMeasurementSchema::getType)
231+
.map(m -> Objects.nonNull(m) ? m.getType() : null)
230232
.toArray(TSDataType[]::new),
231233
// TODO: cast
232234
tablet.getSchemas().stream()
233-
.filter(Objects::nonNull)
234235
.map(schema -> (MeasurementSchema) schema)
235236
.toArray(MeasurementSchema[]::new),
236237
tablet.getTimestamps(),
237238
tablet.getBitMaps(),
238239
values,
239240
tablet.getRowSize(),
240241
tablet.getColumnTypes().stream()
241-
.filter(Objects::nonNull)
242-
.map(TsTableColumnCategory::fromTsFileColumnCategory)
242+
.map(
243+
c ->
244+
Objects.nonNull(c)
245+
? TsTableColumnCategory.fromTsFileColumnCategory(c)
246+
: null)
243247
.toArray(TsTableColumnCategory[]::new));
244248

245249
final int start = 0;

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/util/builder/PipeTreeModelTsFileBuilderV2.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,13 @@ private void writeTabletsIntoOneFile(
162162
new PartialPath(tablet.getDeviceId()),
163163
isTabletAlignedList.get(i),
164164
tablet.getSchemas().stream()
165-
.filter(Objects::nonNull)
166-
.map(IMeasurementSchema::getMeasurementName)
165+
.map(m -> Objects.nonNull(m) ? m.getMeasurementName() : null)
167166
.toArray(String[]::new),
168167
tablet.getSchemas().stream()
169-
.filter(Objects::nonNull)
170-
.map(IMeasurementSchema::getType)
168+
.map(m -> Objects.nonNull(m) ? m.getType() : null)
171169
.toArray(TSDataType[]::new),
172170
// TODO: cast
173171
tablet.getSchemas().stream()
174-
.filter(Objects::nonNull)
175172
.map(schema -> (MeasurementSchema) schema)
176173
.toArray(MeasurementSchema[]::new),
177174
tablet.getTimestamps(),

0 commit comments

Comments
 (0)