Skip to content

Commit

Permalink
Allow VectorFixedBuilder to become released without build (elastic#10…
Browse files Browse the repository at this point in the history
…0567)

VectorFixedBuilder can be closed without calling build 
and we should move its state to released in this case.
  • Loading branch information
dnhatn authored Oct 10, 2023
1 parent a8d79b3 commit f313479
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public BooleanVector build() {
public void close() {
if (nextIndex >= 0) {
// If nextIndex < 0 we've already built the vector
nextIndex = -1;
blockFactory.adjustBreaker(-preAdjustedBytes, false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public DoubleVector build() {
public void close() {
if (nextIndex >= 0) {
// If nextIndex < 0 we've already built the vector
nextIndex = -1;
blockFactory.adjustBreaker(-preAdjustedBytes, false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public IntVector build() {
public void close() {
if (nextIndex >= 0) {
// If nextIndex < 0 we've already built the vector
nextIndex = -1;
blockFactory.adjustBreaker(-preAdjustedBytes, false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public LongVector build() {
public void close() {
if (nextIndex >= 0) {
// If nextIndex < 0 we've already built the vector
nextIndex = -1;
blockFactory.adjustBreaker(-preAdjustedBytes, false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ final class $Type$VectorFixedBuilder implements $Type$Vector.FixedBuilder {
public void close() {
if (nextIndex >= 0) {
// If nextIndex < 0 we've already built the vector
nextIndex = -1;
blockFactory.adjustBreaker(-preAdjustedBytes, false);
}
}
Expand Down

0 comments on commit f313479

Please sign in to comment.