garlandz-db commented on code in PR #44349:
URL: https://github.com/apache/spark/pull/44349#discussion_r1427535520


##########
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:
   will `self._q.startIndex()` throw an exception if its not defined? 



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