| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Thank you @devoopsman45 , left some comments. Also, is a noop standard across df bindings when a table does not exist?
Sorry, something went wrong.
@coderfender Please let me know your thoughts. Thanks |
Sorry, something went wrong.
There was a problem hiding this comment.
@devoopsman45 , @hiteshkumardasika Thank you for the changes. I believe we are close to getting this merged.
Sorry, something went wrong.
| } | ||
| if (name == null) { | ||
| throw new IllegalArgumentException("tableExists name must be non-null"); | ||
| } |
There was a problem hiding this comment.
Does the native code throw an exception when a null invariant is passed ?
Sorry, something went wrong.
There was a problem hiding this comment.
If null is passed from Java, the Java native call spits out a null JString. Then in Rust, env.get_string() on a null JString would return a JNI error, which propagates out, and
try_unwrap_or_throw catches it and throws a Java RuntimeException or DataFusionException back. I believe that is not a right Exception to be thrown.
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you for the explanation. Should we probably set a more specific exception handling mechanism for future enhancements to follow through? ( we can do that in a follow up pr though)
Sorry, something went wrong.
There was a problem hiding this comment.
Sure, Thanks. I will create a followup Enhancement for this
Sorry, something went wrong.
|
|
||
| private void checkOpen() { | ||
| if (nativeHandle == 0) { | ||
| throw new IllegalStateException("SessionContext is closed"); |
There was a problem hiding this comment.
Nit : could probably make the method name a little more robust like 'checkOpenSessionContext' or so to keep users from guessing
Sorry, something went wrong.
There was a problem hiding this comment.
Could we perhaps use option to make the code more functional and let the callers handle exception/ success accordingly?
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for the feedback. This file in general has a throw on closed sort of pattern. If optional is returned, it would force every caller to .orElseThrow() paradigm, which seems a bit noisy for private helper. We can probably do this as a seperate enhancement if needed.
Sorry, something went wrong.
There was a problem hiding this comment.
@coderfender Fixed the method naming. Thank you
Sorry, something went wrong.
|
@coderfender Thank you for review. Ready to merge whenever you are. Here are the followup Issues I am going to create as disucssed above in the comments.
|
Sorry, something went wrong.
|
Sure . Feel free to add the issues on this PR to track lineage |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Which issue does this PR close?
Rationale for this change
SessionContext can let a caller register tables but there is no way to
This makes it tough to write safer code while registering
What changes are included in this PR?
SessionContext.tableExists(String name) — returns true if a table
with that name is registered in the session
table; no-op if the name is not found
Both are thin JNI wrappers over DataFusion's existing
SessionContext::table_exist and SessionContext::deregister_table
on the Rust side.
Are these changes tested?
Yes. SessionContextTableRegistrationTest covers:
-->
Are there any user-facing changes?
Yes — two new public methods on SessionContext. Additive only, no
breaking changes.