Skip to content

Commit

Permalink
feat: 分区获取不size时,按size进行分区分组报错
Browse files Browse the repository at this point in the history
  • Loading branch information
fetchadd authored and idleyui committed Apr 22, 2022
1 parent e9bc293 commit 8443b58
Showing 1 changed file with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,21 @@ private List<TablePartitionGroup> generateAdaptiveTablePartitionGroups(
tmpList.add(new JobAndPtMeta(job, metaSource, source));
}

List<PartitionMetaModel> partitionMetaModels = tmpList.stream()
.map(o->o.partitionMetaModel).collect(Collectors.toList());

// Make sure that the size of each partition is valid.
for (PartitionMetaModel p : partitionMetaModels) {
if (p.getSize() == null) {
LOG.info(
"Database: {}, table: {}, partition: {}, size is not valid",
source.getDatabase(),
source.getTable(),
p.getPartitionValues());
return null;
}
}

// Sort subjobs & ptModel by pt size in descending order
tmpList.sort((o1, o2) -> {
if (o1.partitionMetaModel.getSize() > o2.partitionMetaModel.getSize()) {
Expand All @@ -388,22 +403,8 @@ private List<TablePartitionGroup> generateAdaptiveTablePartitionGroups(
}
});

List<PartitionMetaModel> partitionMetaModels = tmpList.stream()
.map(o->o.partitionMetaModel).collect(Collectors.toList());
pendingSubJobs = tmpList.stream().map(o->o.job).collect(Collectors.toList());

// Make sure that the size of each partition is valid.
for (PartitionMetaModel p : partitionMetaModels) {
if (p.getSize() == null) {
LOG.info(
"Database: {}, table: {}, partition: {}, size is not valid",
source.getDatabase(),
source.getTable(),
p.getPartitionValues());
return null;
}
}

List<TablePartitionGroup> ret = new LinkedList<>();

int groupDataSizeInGigaByte = Integer.valueOf(config.getOrDefault(
Expand Down

0 comments on commit 8443b58

Please sign in to comment.