rusackas commented on code in PR #40636:
URL: https://github.com/apache/superset/pull/40636#discussion_r3376774656
##########
superset/viz.py:
##########
@@ -633,7 +654,10 @@ def get_df_payload( # pylint: disable=too-many-statements
# noqa: C901
)
self.errors.append(error)
self.status = QueryStatus.FAILED
- stacktrace = utils.get_stacktrace()
+ # Only expose the raw stacktrace when explicitly enabled,
mirroring
+ # the gating used elsewhere (e.g.
superset.views.base.get_error_msg).
+ if current_app.debug or
current_app.config.get("SHOW_STACKTRACE"):
+ stacktrace = utils.get_stacktrace()
Review Comment:
Good catch — you are right that `get_stacktrace()` only returns a value when
`SHOW_STACKTRACE` is set, so the `current_app.debug` clause was dead code (it
never surfaced a stacktrace on its own). Rather than make the debug path
independently produce a trace, I removed the `current_app.debug or` clause so
the gating is purely `SHOW_STACKTRACE`, which is consistent with both
`get_stacktrace()` and `superset.views.base.get_error_msg`. Fixed in the latest
commit.
##########
superset/viz.py:
##########
@@ -1061,6 +1085,13 @@ def process_data(self, df: pd.DataFrame, aggregate: bool
= False) -> VizData:
method = self.form_data.get("resample_method")
if rule and method:
+ if method not in ALLOWED_RESAMPLE_METHODS:
+ raise QueryObjectValidationError(
+ _(
+ "Resample method '%(method)s' is not supported.",
+ method=method,
+ )
+ )
Review Comment:
Fair point as defense-in-depth. While the form data is typically validated
upstream, the legacy viz path reads `resample_method` straight from
`form_data`, so a non-string (e.g. a list) would hit the unhashable-type
`TypeError` rather than a clean validation error. I added an
`isinstance(method, str)` guard so unsupported input now returns the intended
`QueryObjectValidationError`. Fixed in the latest commit.
--
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]