Skip to content

Commit

Permalink
Merge pull request #8891 from s1ck/nodesbuilder-default-maxoriginalid
Browse files Browse the repository at this point in the history
Make maxOriginalId optional in NodesBuilder
  • Loading branch information
knutwalker authored Apr 4, 2024
2 parents 9e78618 + 33568c2 commit b97d3cc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public LazyIdMapBuilder(
this.intermediateIdMapBuilder = ShardedLongLongMap.builder(concurrency);
this.nodesBuilder = GraphFactory.initNodesBuilder()
.concurrency(concurrency)
.maxOriginalId(NodesBuilder.UNKNOWN_MAX_ID)
.hasLabelInformation(hasLabelInformation)
.hasProperties(hasProperties)
.deduplicateIds(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static NodesBuilderBuilder initNodesBuilder(NodeSchema nodeSchema) {

@Builder.Factory
static NodesBuilder nodesBuilder(
long maxOriginalId,
Optional<Long> maxOriginalId,
Optional<Long> nodeCount,
Optional<NodeSchema> nodeSchema,
Optional<Boolean> hasLabelInformation,
Expand All @@ -95,20 +95,18 @@ static NodesBuilder nodesBuilder(
int threadCount = concurrency.orElse(1);

var idMapBehavior = IdMapBehaviorServiceProvider.idMapBehavior();
var maybeMaxOriginalId = maxOriginalId != NodesBuilder.UNKNOWN_MAX_ID
? Optional.of(maxOriginalId)
: Optional.<Long>empty();

var idMapType = idMapBuilderType.orElse(IdMap.NO_TYPE);
var idMapBuilder = idMapBehavior.create(
idMapType,
threadCount,
maybeMaxOriginalId,
maxOriginalId,
nodeCount
);

long maxOriginalNodeId = maxOriginalId.orElse(NodesBuilder.UNKNOWN_MAX_ID);
boolean deduplicate = deduplicateIds.orElse(true);
long maxIntermediateId = maxOriginalId;
long maxIntermediateId = maxOriginalNodeId;

if (HighLimitIdMap.isHighLimitIdMap(idMapType)) {
// If the requested id map is high limit, we need to make sure that
Expand All @@ -129,7 +127,7 @@ static NodesBuilder nodesBuilder(

return nodeSchema.isPresent()
? fromSchema(
maxOriginalId,
maxOriginalNodeId,
maxIntermediateId,
idMapBuilder,
threadCount,
Expand All @@ -138,7 +136,7 @@ static NodesBuilder nodesBuilder(
deduplicate
)
: new NodesBuilder(
maxOriginalId,
maxOriginalNodeId,
maxIntermediateId,
threadCount,
NodesBuilderContext.lazy(threadCount),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ BatchLoadResult loadSingleBatch(InternalTransaction tx, int bufferSize) {

this.nodesBuilder = GraphFactory.initNodesBuilder()
.nodeCount(nodeCount)
.maxOriginalId(NodesBuilder.UNKNOWN_MAX_ID)
.hasLabelInformation(hasLabelInformation)
.hasProperties(!propertyColumns.isEmpty())
.propertyState(PropertyState.TRANSIENT)
Expand Down

0 comments on commit b97d3cc

Please sign in to comment.