ktmud commented on a change in pull request #13434:
URL: https://github.com/apache/superset/pull/13434#discussion_r594532970
##########
File path: superset/utils/pandas_postprocessing.py
##########
@@ -577,7 +578,7 @@ def contribution(
:return: DataFrame with contributions.
"""
contribution_df = df.copy()
- numeric_df = contribution_df.select_dtypes(include="number")
+ numeric_df = contribution_df.select_dtypes(include=["number", Decimal])
Review comment:
Bycatch: fix index errors for Percent metrics when Decimal columns are
used in metrics.
##########
File path: tests/fixtures/birth_names_dashboard.py
##########
@@ -127,7 +127,7 @@ def _get_dataframe(database: Database) -> DataFrame:
data = _get_birth_names_data()
df = pd.DataFrame.from_dict(data)
if database.backend == "presto":
- df.ds = df.ds.dt.strftime("%Y-%m-%d %H:%M%:%S")
+ df.ds = df.ds.dt.strftime("%Y-%m-%d %H:%M:%S")
Review comment:
Bycatch: fix simulation data for Presto timestamp, which may cause error
when the `ds` column is used in `cast(ds as TIME)`
##########
File path: tests/security_tests.py
##########
@@ -42,11 +40,6 @@
from superset.utils.core import get_example_database
from .base_tests import SupersetTestCase
-from .dashboard_utils import (
- create_table_for_dashboard,
- create_slice,
- create_dashboard,
-)
Review comment:
Bycatch: clean up unused variables.
##########
File path: superset/common/query_object.py
##########
@@ -116,24 +117,24 @@ def __init__(
order_desc: bool = True,
extras: Optional[Dict[str, Any]] = None,
columns: Optional[List[str]] = None,
- orderby: Optional[List[List[str]]] = None,
+ orderby: Optional[List[OrderBy]] = None,
post_processing: Optional[List[Optional[Dict[str, Any]]]] = None,
is_rowcount: bool = False,
**kwargs: Any,
):
+ columns = columns or []
+ groupby = groupby or []
+ extras = extras or {}
+ annotation_layers = annotation_layers or []
+
self.is_rowcount = is_rowcount
self.datasource = None
if datasource:
self.datasource = ConnectorRegistry.get_datasource(
str(datasource["type"]), int(datasource["id"]), db.session
)
self.result_type = result_type
- annotation_layers = annotation_layers or []
self.apply_fetch_values_predicate = apply_fetch_values_predicate or
False
- metrics = metrics or []
Review comment:
`metrics` is allowed to be `None` so we don't need a fallback here.
`metrics is None` indicates there's no need for aggregation.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]