HyukjinKwon commented on code in PR #44349:
URL: https://github.com/apache/spark/pull/44349#discussion_r1427536459
##########
python/pyspark/errors/exceptions/captured.py:
##########
@@ -332,3 +345,37 @@ class UnknownException(CapturedException,
BaseUnknownException):
"""
None of the other exceptions.
"""
+
+
+class QueryContext(BaseQueryContext):
+ def __init__(self, q: JavaObject):
+ self._q = q
+
+ def contextType(self) -> QueryContextType:
+ context_type = self._q.contextType().toString()
+ assert context_type in ("SQL", "DataFrame")
+ if context_type == "DataFrame":
+ return QueryContextType.DataFrame
+ else:
+ return QueryContextType.SQL
+
+ def objectType(self) -> str:
+ return str(self._q.objectType())
+
+ def objectName(self) -> str:
+ return str(self._q.objectName())
+
+ def startIndex(self) -> int:
Review Comment:
It will (should) throw an exception from the server side. But we currently
have some bugs in the Spark Connect Server side so it doesn't throw an
exception but returns sth like -1.
--
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]