You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by el...@apache.org on 2024/05/15 23:08:17 UTC
(superset) branch elizabeth/tune-logging updated (87b625eec8 -> ede5398aee)
This is an automated email from the ASF dual-hosted git repository.
elizabeth pushed a change to branch elizabeth/tune-logging
in repository https://gitbox.apache.org/repos/asf/superset.git
discard 87b625eec8 warning emits an error
new ede5398aee warning emits an error
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (87b625eec8)
\
N -- N -- N refs/heads/elizabeth/tune-logging (ede5398aee)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
superset/errors.py | 1 -
superset/exceptions.py | 12 ------------
superset/utils/pandas_postprocessing/compare.py | 5 ++---
3 files changed, 2 insertions(+), 16 deletions(-)
(superset) 01/01: warning emits an error
Posted by el...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
elizabeth pushed a commit to branch elizabeth/tune-logging
in repository https://gitbox.apache.org/repos/asf/superset.git
commit ede5398aee70304112ff50d18670b0e55246679b
Author: Elizabeth Thompson <es...@gmail.com>
AuthorDate: Wed May 15 14:49:06 2024 -0700
warning emits an error
---
superset/utils/pandas_postprocessing/compare.py | 11 +++++++++--
.../unit_tests/pandas_postprocessing/test_compare.py | 20 +++++++++++++++++++-
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/superset/utils/pandas_postprocessing/compare.py b/superset/utils/pandas_postprocessing/compare.py
index b20682027f..ab2a3a3a57 100644
--- a/superset/utils/pandas_postprocessing/compare.py
+++ b/superset/utils/pandas_postprocessing/compare.py
@@ -15,16 +15,22 @@
# specific language governing permissions and limitations
# under the License.
from typing import Optional
+import warnings
import pandas as pd
from flask_babel import gettext as _
from pandas import DataFrame
+from pandas.errors import PerformanceWarning
from superset.constants import PandasPostprocessingCompare
-from superset.exceptions import InvalidPostProcessingError
+from superset.exceptions import InvalidPostProcessingError, PandasProcessingException, SupersetException
from superset.utils.core import TIME_COMPARISON
from superset.utils.pandas_postprocessing.utils import validate_column_args
+import logging
+
+logger = logging.getLogger(__name__)
+
@validate_column_args("source_columns", "compare_columns")
def compare( # pylint: disable=too-many-arguments
@@ -81,5 +87,6 @@ def compare( # pylint: disable=too-many-arguments
df = pd.concat([df, diff_df], axis=1)
if drop_original_columns:
- df = df.drop(source_columns + compare_columns, axis=1)
+ with warnings.catch_warnings(action='ignore', category=PerformanceWarning):
+ df = df.drop(source_columns + compare_columns, axis=1)
return df
diff --git a/tests/unit_tests/pandas_postprocessing/test_compare.py b/tests/unit_tests/pandas_postprocessing/test_compare.py
index 9da8a31535..4e70748f74 100644
--- a/tests/unit_tests/pandas_postprocessing/test_compare.py
+++ b/tests/unit_tests/pandas_postprocessing/test_compare.py
@@ -14,13 +14,18 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+from unittest.mock import patch
import pandas as pd
+import pytest
+from pandas.errors import PerformanceWarning
+
from superset.constants import PandasPostprocessingCompare as PPC
+from superset.exceptions import PandasProcessingException
from superset.utils import pandas_postprocessing as pp
from superset.utils.pandas_postprocessing.utils import FLAT_COLUMN_SEPARATOR
from tests.unit_tests.fixtures.dataframes import multiple_metrics_df, timeseries_df2
-
+from superset.utils.pandas_postprocessing.compare import logger
def test_compare_should_not_side_effect():
_timeseries_df2 = timeseries_df2.copy()
@@ -229,3 +234,16 @@ def test_compare_after_pivot():
}
)
)
+def test_exception_called(mocker):
+ drop_mock = mocker.patch("pandas.core.frame.DataFrame.drop")
+ drop_mock.side_effect = PerformanceWarning("warning message")
+
+ with pytest.raises(PandasProcessingException):
+ pp.compare(
+ df=timeseries_df2,
+ source_columns=["y"],
+ compare_columns=["z"],
+ compare_type=PPC.DIFF,
+ drop_original_columns=True,
+ )
+