diff --git a/py/server/deephaven/uri.py b/py/server/deephaven/uri.py index 3530e90cf0c..a70181c1356 100644 --- a/py/server/deephaven/uri.py +++ b/py/server/deephaven/uri.py @@ -4,7 +4,7 @@ """ Tools for resolving Uniform Resource Identifiers (URIs) into objects. """ -from typing import Union +from typing import Any import jpy @@ -14,9 +14,9 @@ _JResolveTools = jpy.get_type("io.deephaven.uri.ResolveTools") -def resolve(uri: str) -> Union[jpy.JType, JObjectWrapper]: +def resolve(uri: str) -> Any: """Resolves a Uniform Resource Identifier (URI) string into an object. Objects with custom Python wrappers, - like Table, return an instance of the wrapper class; otherwise, the raw Java object is returned. + like Table, return an instance of the wrapper class; otherwise, the Java or Python object is returned. Args: @@ -30,6 +30,9 @@ def resolve(uri: str) -> Union[jpy.JType, JObjectWrapper]: """ try: - return wrap_j_object(_JResolveTools.resolve(uri)) + # When grabbing something out of the query scope, it may already be presented as a PyObject; in which case, + # when the value gets back into python, it's a native python type - in which case, we don't need to wrap it. + item = _JResolveTools.resolve(uri) + return wrap_j_object(item) if isinstance(item, jpy.JType) else item except Exception as e: raise DHError(e, "failed to resolve the URI.") from e