Skip to content

Commit

Permalink
ESQL: Deprecate static vector methods
Browse files Browse the repository at this point in the history
This deprecates the static methods for building vectors - we have a
factory now we're prefer folks use.
  • Loading branch information
nik9000 committed Oct 27, 2023
1 parent 5e22c27 commit e0abb07
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,32 @@ default void writeTo(StreamOutput out) throws IOException {
}
}

/** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */
/**
* Returns a builder using the {@link BlockFactory#getNonBreakingInstance nonbreaking block factory}.
* @Deprecated use {@link BlockFactory#newBooleanVectorBuilder}
*/
// Eventually, we want to remove this entirely, always passing an explicit BlockFactory
@Deprecated
static Builder newVectorBuilder(int estimatedSize) {
return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance());
}

/**
* Creates a builder that grows as needed. Prefer {@link #newVectorFixedBuilder}
* if you know the size up front because it's faster.
* @Deprecated use {@link BlockFactory#newBooleanVectorBuilder}
*/
@Deprecated
static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) {
return blockFactory.newBooleanVectorBuilder(estimatedSize);
}

/**
* Creates a builder that never grows. Prefer this over {@link #newVectorBuilder}
* if you know the size up front because it's faster.
* @Deprecated use {@link BlockFactory#newBooleanVectorFixedBuilder}
*/
@Deprecated
static FixedBuilder newVectorFixedBuilder(int size, BlockFactory blockFactory) {
return blockFactory.newBooleanVectorFixedBuilder(size);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,21 @@ default void writeTo(StreamOutput out) throws IOException {
}
}

/** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */
/**
* Returns a builder using the {@link BlockFactory#getNonBreakingInstance nonbreaking block factory}.
* @Deprecated use {@link BlockFactory#newBytesRefVectorBuilder}
*/
// Eventually, we want to remove this entirely, always passing an explicit BlockFactory
@Deprecated
static Builder newVectorBuilder(int estimatedSize) {
return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance());
}

/**
* Creates a builder that grows as needed.
* @Deprecated use {@link BlockFactory#newBytesRefVectorBuilder}
*/
@Deprecated
static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) {
return blockFactory.newBytesRefVectorBuilder(estimatedSize);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,32 @@ default void writeTo(StreamOutput out) throws IOException {
}
}

/** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */
/**
* Returns a builder using the {@link BlockFactory#getNonBreakingInstance nonbreaking block factory}.
* @Deprecated use {@link BlockFactory#newDoubleVectorBuilder}
*/
// Eventually, we want to remove this entirely, always passing an explicit BlockFactory
@Deprecated
static Builder newVectorBuilder(int estimatedSize) {
return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance());
}

/**
* Creates a builder that grows as needed. Prefer {@link #newVectorFixedBuilder}
* if you know the size up front because it's faster.
* @Deprecated use {@link BlockFactory#newDoubleVectorBuilder}
*/
@Deprecated
static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) {
return blockFactory.newDoubleVectorBuilder(estimatedSize);
}

/**
* Creates a builder that never grows. Prefer this over {@link #newVectorBuilder}
* if you know the size up front because it's faster.
* @Deprecated use {@link BlockFactory#newDoubleVectorFixedBuilder}
*/
@Deprecated
static FixedBuilder newVectorFixedBuilder(int size, BlockFactory blockFactory) {
return blockFactory.newDoubleVectorFixedBuilder(size);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,32 @@ default void writeTo(StreamOutput out) throws IOException {
}
}

/** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */
/**
* Returns a builder using the {@link BlockFactory#getNonBreakingInstance nonbreaking block factory}.
* @Deprecated use {@link BlockFactory#newIntVectorBuilder}
*/
// Eventually, we want to remove this entirely, always passing an explicit BlockFactory
@Deprecated
static Builder newVectorBuilder(int estimatedSize) {
return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance());
}

/**
* Creates a builder that grows as needed. Prefer {@link #newVectorFixedBuilder}
* if you know the size up front because it's faster.
* @Deprecated use {@link BlockFactory#newIntVectorBuilder}
*/
@Deprecated
static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) {
return blockFactory.newIntVectorBuilder(estimatedSize);
}

/**
* Creates a builder that never grows. Prefer this over {@link #newVectorBuilder}
* if you know the size up front because it's faster.
* @Deprecated use {@link BlockFactory#newIntVectorFixedBuilder}
*/
@Deprecated
static FixedBuilder newVectorFixedBuilder(int size, BlockFactory blockFactory) {
return blockFactory.newIntVectorFixedBuilder(size);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,32 @@ default void writeTo(StreamOutput out) throws IOException {
}
}

/** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */
/**
* Returns a builder using the {@link BlockFactory#getNonBreakingInstance nonbreaking block factory}.
* @Deprecated use {@link BlockFactory#newLongVectorBuilder}
*/
// Eventually, we want to remove this entirely, always passing an explicit BlockFactory
@Deprecated
static Builder newVectorBuilder(int estimatedSize) {
return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance());
}

/**
* Creates a builder that grows as needed. Prefer {@link #newVectorFixedBuilder}
* if you know the size up front because it's faster.
* @Deprecated use {@link BlockFactory#newLongVectorBuilder}
*/
@Deprecated
static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) {
return blockFactory.newLongVectorBuilder(estimatedSize);
}

/**
* Creates a builder that never grows. Prefer this over {@link #newVectorBuilder}
* if you know the size up front because it's faster.
* @Deprecated use {@link BlockFactory#newLongVectorFixedBuilder}
*/
@Deprecated
static FixedBuilder newVectorFixedBuilder(int size, BlockFactory blockFactory) {
return blockFactory.newLongVectorFixedBuilder(size);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,22 +141,29 @@ $endif$
}
}

/** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */
/**
* Returns a builder using the {@link BlockFactory#getNonBreakingInstance nonbreaking block factory}.
* @Deprecated use {@link BlockFactory#new$Type$VectorBuilder}
*/
// Eventually, we want to remove this entirely, always passing an explicit BlockFactory
@Deprecated
static Builder newVectorBuilder(int estimatedSize) {
return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance());
}

$if(BytesRef)$
/**
* Creates a builder that grows as needed.
* @Deprecated use {@link BlockFactory#new$Type$VectorBuilder}
*/
$else$
/**
* Creates a builder that grows as needed. Prefer {@link #newVectorFixedBuilder}
* if you know the size up front because it's faster.
* @Deprecated use {@link BlockFactory#new$Type$VectorBuilder}
*/
$endif$
@Deprecated
static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) {
return blockFactory.new$Type$VectorBuilder(estimatedSize);
}
Expand All @@ -166,7 +173,9 @@ $else$
/**
* Creates a builder that never grows. Prefer this over {@link #newVectorBuilder}
* if you know the size up front because it's faster.
* @Deprecated use {@link BlockFactory#new$Type$VectorFixedBuilder}
*/
@Deprecated
static FixedBuilder newVectorFixedBuilder(int size, BlockFactory blockFactory) {
return blockFactory.new$Type$VectorFixedBuilder(size);
}
Expand Down

0 comments on commit e0abb07

Please sign in to comment.