Skip to content

GH-1458: [JDBC] Close parameter VectorSchemaRoot if setRowCount or setParameters fails - #1459

Open
jbonofre wants to merge 1 commit into
apache:mainfrom
jbonofre:GH-1458-parameter-binder-handoff
Open

jbonofre wants to merge 1 commit into
apache:mainfrom
jbonofre:GH-1458-parameter-binder-handoff

Conversation

@jbonofre

Copy link
Copy Markdown
Member

What's Changed

Follow-up to #1441 (#1439).

Expand the try block in AvaticaParameterBinder.bind(List<TypedValue>, int) to cover the initial parameter-count check as well as parameters.setRowCount(index + 1) and preparedStatement.setParameters(parameters) (up to parametersHandedOff = true), so that any RuntimeException thrown before ownership is handed off to the prepared statement closes parameters:

  • parameters.setRowCount(index + 1) calls setValueCount on each vector, which can still allocate buffers (for example, child vector buffers of a FixedSizeListVector when null was bound) and throw OutOfMemoryException.
  • preparedStatement.setParameters(parameters) can also throw before parametersHandedOff is set to true.

Added unit tests in AvaticaParameterBinderTest covering both setRowCount (OutOfMemoryException) and setParameters (IllegalStateException) failures.

Closes #1458.

… or setParameters fails

Expand the try block in AvaticaParameterBinder.bind(List<TypedValue>, int) to cover the parameter count check, parameters.setRowCount(index + 1), and preparedStatement.setParameters(parameters) so that any RuntimeException thrown before ownership is handed off closes the parameter VectorSchemaRoot.
@jbonofre jbonofre added the bug-fix PRs that fix a big. label Nov 11, 2026
@jbonofre
jbonofre requested a review from wgtmac as a code owner November 11, 2026 17:59
@jbonofre jbonofre added the bug-fix PRs that fix a big. label Nov 11, 2026
@github-actions github-actions Bot added this to the 20.0.0 milestone Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PRs that fix a big.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JDBC] Close parameter VectorSchemaRoot if setRowCount or setParameters fails in AvaticaParameterBinder

2 participants