maker-bundle icon indicating copy to clipboard operation
maker-bundle copied to clipboard

Stop silencing RuntimeCommandException exceptions

Open marbulk opened this issue 3 years ago • 4 comments

What is a purpose of silencing instances of RuntimeCommandException in ConsoleErrorSubscriber? This way one cannot use -vvv option for console commands to see the stack trace. Maker Bundle is a dev tool - there is no need to silence exceptions to print this exceptions in a "pretty way". In my opinion this increases a debugging difficulty curve.

I can work on that if we agree (in this case "work" = just will remove subscriber).

marbulk avatar May 15 '21 00:05 marbulk

This works in current versions. Thanks for reporting nonetheless!

rusackas avatar Mar 08 '24 20:03 rusackas

This is still broken on master so the ticket should reopend. @rusackas might only have tested the "Full name" option as it is handled separately in an extra code path: https://github.com/apache/superset/blob/9db431b4303fb83b79584d254bd0344ade117381/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js#L118

But as seen here, the "country" field will always have the cca3 value. That is indeed required for visualization: https://github.com/apache/superset/blob/9db431b4303fb83b79584d254bd0344ade117381/superset/viz.py#L1564

But to use a crossfilter it is required to also forward the actual value of the row to hand back to the filter, this is the patch we are using which fixes the issues:

diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js
index 540097be2..c866486fd 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js
+++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js
@@ -30,6 +30,7 @@ import { ColorBy } from './utils';
 const propTypes = {
   data: PropTypes.arrayOf(
     PropTypes.shape({
+      value: PropTypes.string,
       country: PropTypes.string,
       latitude: PropTypes.number,
       longitude: PropTypes.number,
@@ -114,8 +115,7 @@ function WorldMap(element, props) {
   const getCrossFilterDataMask = source => {
     const selected = Object.values(filterState.selectedValues || {});
     const key = source.id || source.country;
-    const country =
-      countryFieldtype === 'name' ? mapData[key]?.name : mapData[key]?.country;
+    const country = mapData[key]?.value;
 
     if (!country) {
       return undefined;
diff --git a/superset/viz.py b/superset/viz.py
index 8ba785ddc..b5ef29119 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1608,6 +1608,7 @@ class WorldMapViz(BaseViz):
                         self.form_data["country_fieldtype"], row["country"]
                     )
             if country:
+                row["value"] = row["country"]
                 row["country"] = country["cca3"]
                 row["latitude"] = country["lat"]
                 row["longitude"] = country["lng"]

doctorseus avatar Apr 24 '24 11:04 doctorseus

Oh how great it would be to whittle away at viz.py until it's gone for good. If there's a PR to be had that will improve the situation for all, we'd welcome it! (cc @villebro)

rusackas avatar Apr 24 '24 14:04 rusackas

Please, fix this. I have cca2 country values in other charts.

slyseinstrument avatar May 03 '24 09:05 slyseinstrument

This issue is also coming up in my situation. Having CCA2 country codes and as a result the cross-filtering does not work as expected. My source is Matomo data. So +1 from me.

jaroet avatar May 28 '24 07:05 jaroet

Also come across this.

dmarkey avatar Sep 09 '24 23:09 dmarkey

all.csv Ah solution was join iso2 -> iso3 using this.

dmarkey avatar Sep 10 '24 00:09 dmarkey