feat(java/driver/jni): implement get/set option#4203
Open
lidavidm wants to merge 1 commit intoapache:mainfrom
Open
feat(java/driver/jni): implement get/set option#4203lidavidm wants to merge 1 commit intoapache:mainfrom
lidavidm wants to merge 1 commit intoapache:mainfrom
Conversation
zeroshade
approved these changes
Apr 14, 2026
Member
zeroshade
left a comment
There was a problem hiding this comment.
Basically just one comment that repeats multiple times. Otherwise this looks good to me!
Comment on lines
+473
to
+480
| while (length > buf.size()) { | ||
| // Buffer was too small, resize and try again | ||
| buf.resize(length); | ||
| CHECK_ADBC_ERROR( | ||
| AdbcStatementGetOptionBytes(db, key_str.value, const_cast<uint8_t*>(buf.data()), | ||
| &length, &error), | ||
| error); | ||
| } |
Member
There was a problem hiding this comment.
The spec says that the length should be set to the required length, do we really need this to be a loop?
Member
Author
There was a problem hiding this comment.
The other driver managers also use a loop
Comment on lines
+538
to
+545
| while (length > buf.size()) { | ||
| // Buffer was too small, resize and try again | ||
| buf.resize(length); | ||
| CHECK_ADBC_ERROR( | ||
| AdbcStatementGetOption(db, key_str.value, const_cast<char*>(buf.data()), | ||
| &length, &error), | ||
| error); | ||
| } |
Member
There was a problem hiding this comment.
Same question as above, if length is set to the required size, we shouldn't need a loop here, just an if
Comment on lines
+764
to
+771
| while (length > buf.size()) { | ||
| // Buffer was too small, resize and try again | ||
| buf.resize(length); | ||
| CHECK_ADBC_ERROR( | ||
| AdbcConnectionGetOptionBytes(db, key_str.value, | ||
| const_cast<uint8_t*>(buf.data()), &length, &error), | ||
| error); | ||
| } |
| AdbcConnectionGetOption(db, key_str.value, const_cast<char*>(buf.data()), &length, | ||
| &error), | ||
| error); | ||
| while (length > buf.size()) { |
| AdbcDatabaseGetOptionBytes(db, key_str.value, const_cast<uint8_t*>(buf.data()), | ||
| &length, &error), | ||
| error); | ||
| while (length > buf.size()) { |
amoeba
approved these changes
Apr 14, 2026
| JniDriver.PARAM_DRIVER.set(parameters, "adbc_driver_sqlite"); | ||
| try (final AdbcDatabase db = driver.open(parameters)) { | ||
| AdbcException e; | ||
| //noinspection unchecked |
Member
There was a problem hiding this comment.
My LSP wants to see these annotations for the yellow squigglies to go away,
diff --git a/java/driver/jni/src/test/java/org/apache/arrow/adbc/driver/jni/JniDriverTest.java b/java/driver/jni/src/test/java/org/apache/arrow/adbc/driver/jni/JniDriverTest.java
index c9a092221..8513d0de7 100644
--- a/java/driver/jni/src/test/java/org/apache/arrow/adbc/driver/jni/JniDriverTest.java
+++ b/java/driver/jni/src/test/java/org/apache/arrow/adbc/driver/jni/JniDriverTest.java
@@ -461,6 +461,7 @@ class JniDriverTest {
}
}
+ @SuppressWarnings("unchecked")
@ParameterizedTest
@MethodSource("getSetOptionFailProvider")
void getSetOptionFailDatabase(GetSetOptionFailCase testCase) throws Exception {
@@ -478,6 +479,7 @@ class JniDriverTest {
}
}
+ @SuppressWarnings("unchecked")
@ParameterizedTest
@MethodSource("getSetOptionFailProvider")
void getSetOptionFailConnection(GetSetOptionFailCase testCase) throws Exception {
@@ -495,6 +497,7 @@ class JniDriverTest {
}
}
+ @SuppressWarnings("unchecked")
@ParameterizedTest
@MethodSource("getSetOptionFailProvider")
void getSetOptionFailStatement(GetSetOptionFailCase testCase) throws Exception {| Java_org_apache_arrow_adbc_driver_jni_impl_NativeAdbc_statementGetOptionBytes( | ||
| JNIEnv* env, [[maybe_unused]] jclass self, jlong handle, jstring key) { | ||
| struct AdbcError error = ADBC_ERROR_INIT; | ||
| auto* db = reinterpret_cast<struct AdbcStatement*>(static_cast<uintptr_t>(handle)); |
Member
There was a problem hiding this comment.
nit: maybe rename these variables stmt and conn throughout this file as appropriate?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3868.