-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1011 Disable full stack trace when using spark connect #1012
Changes from all commits
bf00376
1143d25
d7e0e8f
11bedfa
7578d8c
7102f97
48c1623
d951b42
e95d599
1dcfb4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,9 @@ | |
|
||
|
||
def handle_spark_dataframe(dataframe, should_cache=False): | ||
"""Execute a ResultSet sqlaproxy using pysark module.""" | ||
"""Execute a ResultSet sqlaproxy using pyspark module.""" | ||
if not DataFrame and not CDataFrame: | ||
raise exceptions.MissingPackageError("pysark not installed") | ||
raise exceptions.MissingPackageError("pyspark not installed") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix typo |
||
|
||
return SparkResultProxy(dataframe, dataframe.columns, should_cache) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,12 @@ | |
from sqlglot.errors import ParseError | ||
from sqlalchemy.exc import SQLAlchemyError | ||
from ploomber_core.dependencies import requires | ||
|
||
try: | ||
from pyspark.sql.utils import AnalysisException | ||
except ModuleNotFoundError: | ||
AnalysisException = None | ||
Comment on lines
+11
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to handle the case where pyspark module is not installed |
||
|
||
import ast | ||
from os.path import isfile | ||
import re | ||
|
@@ -556,11 +562,14 @@ def is_non_sqlalchemy_error(error): | |
"pyodbc.ProgrammingError", | ||
# Clickhouse errors | ||
"DB::Exception:", | ||
# Pyspark | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed these as they are included in AnalysisException |
||
"UNRESOLVED_ROUTINE", | ||
"PARSE_SYNTAX_ERROR", | ||
] | ||
return any(msg in str(error) for msg in specific_db_errors) | ||
is_pyspark_analysis_exception = ( | ||
isinstance(error, AnalysisException) if AnalysisException else False | ||
) | ||
return ( | ||
any(msg in str(error) for msg in specific_db_errors) | ||
or is_pyspark_analysis_exception | ||
) | ||
Comment on lines
+566
to
+572
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If AnalysisException is imported then checks if the error is of instance of pyspark's Analysis Exception and handles it accordingly |
||
|
||
|
||
def if_substring_exists(string, substrings): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo