zhengruifeng commented on code in PR #42548:
URL: https://github.com/apache/spark/pull/42548#discussion_r1302534470


##########
python/pyspark/sql/connect/session.py:
##########
@@ -14,6 +14,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+import sys
+from inspect import currentframe, getframeinfo
+
+from pyspark.errors.exceptions.connect import AnalysisException

Review Comment:
   ```suggestion
   ```



##########
python/pyspark/sql/connect/session.py:
##########
@@ -176,6 +180,27 @@ def enableHiveSupport(self) -> "SparkSession.Builder":
                 error_class="NOT_IMPLEMENTED", message_parameters={"feature": 
"enableHiveSupport"}
             )
 
+        def _apply_options(self, session: "SparkSession") -> None:
+            with self._lock:
+                for k, v in self._options.items():
+                    try:
+                        session.conf.set(k, v)
+                    except AnalysisException as e:
+                        current = currentframe()
+                        lineno = getframeinfo(current).lineno + 1 if current 
is not None else 0
+                        print(
+                            warnings.formatwarning(
+                                """Failed to set spark runtime configuration: 
{0}={1}
+                                   Complete error message: {2}""".format(
+                                    k, v, e.message
+                                ),
+                                RuntimeWarning,
+                                __file__ if "__file__" in globals() else "",
+                                lineno,
+                            ),
+                            file=sys.stderr,
+                        )

Review Comment:
   ```suggestion
                       try:
                           session.conf.set(k, v)
                       except Exception as e:
                           warnings.warn(str(e))
   ```



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