devoopsman45 commented on code in PR #102:
URL: https://github.com/apache/datafusion-java/pull/102#discussion_r3368186828


##########
core/src/main/java/org/apache/datafusion/SessionContext.java:
##########
@@ -601,6 +601,41 @@ private static byte[] serializeSchemaIpc(Schema schema) {
     return baos.toByteArray();
   }
 
+  /**
+   * Returns {@code true} if a table with the given name is registered in this 
session.
+   *
+   * <p>This is the Java counterpart to DataFusion's Rust {@code 
SessionContext::table_exist}.
+   *
+   * @throws IllegalStateException if this context is closed.
+   */
+  public boolean tableExists(String name) {
+    if (nativeHandle == 0) {
+      throw new IllegalStateException("SessionContext is closed");
+    }
+    if (name == null) {
+      throw new IllegalArgumentException("tableExists name must be non-null");
+    }

Review 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.
     



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to