You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/08/06 03:27:20 UTC

(superset) branch master updated: test(deckgl): Polygon chart with a column literally named "polygon" (#33669) (#42591)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 442995481c4 test(deckgl): Polygon chart with a column literally named "polygon" (#33669) (#42591)
442995481c4 is described below

commit 442995481c4ece05ebb7a768754d700941298fa3
Author: Evan Rusackas <ev...@preset.io>
AuthorDate: Wed Aug 5 20:27:13 2026 -0700

    test(deckgl): Polygon chart with a column literally named "polygon" (#33669) (#42591)
    
    Co-authored-by: Claude Code <no...@anthropic.com>
---
 .../src/layers/Polygon/transformProps.test.ts      | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Polygon/transformProps.test.ts b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Polygon/transformProps.test.ts
index cb29f078e0b..a3c81b92e85 100644
--- a/superset-frontend/plugins/preset-chart-deckgl/src/layers/Polygon/transformProps.test.ts
+++ b/superset-frontend/plugins/preset-chart-deckgl/src/layers/Polygon/transformProps.test.ts
@@ -529,4 +529,66 @@ describe('Polygon transformProps', () => {
     expect(features[0]?.extraProps?.['SUM(population)']).toBe(50000);
     expect(features[0]?.metrics?.['SUM(population)']).toBe(50000);
   });
+
+  // Regression test for #33669: a boundary column literally named "polygon"
+  // (the same key this transform uses internally for the parsed geometry)
+  // reportedly broke rendering, because the raw column value could
+  // theoretically collide with the `polygon` key this function builds on
+  // each feature. `line_column` is excluded before spreading a record's
+  // other properties onto the feature, and the parsed `polygon` key is
+  // assigned last in the returned object literal, so it should always win
+  // over anything copied from the raw record, even when they share a name.
+  //
+  // The fixture mirrors the GeoJSON `Feature` shape from the CSV attached to
+  // the issue (a `Feature` with nested `geometry.coordinates`), not a bare
+  // coordinate array, since those two shapes take different parsing paths
+  // in `getPolygonCoordinateParts`. Both reported column-name spellings,
+  // "polygon" and "Polygon", are covered.
+  test.each(['polygon', 'Polygon'])(
+    'should correctly parse polygon geometry when the boundary column is itself named "%s"',
+    columnName => {
+      const collidingColumnNameProps = {
+        ...mockChartProps,
+        rawFormData: {
+          ...mockChartProps.rawFormData,
+          line_column: columnName,
+        },
+        queriesData: [
+          {
+            data: [
+              {
+                [columnName]: JSON.stringify({
+                  type: 'Feature',
+                  geometry: {
+                    type: 'Polygon',
+                    coordinates: [
+                      [
+                        [-122.4, 37.8],
+                        [-122.3, 37.8],
+                        [-122.3, 37.9],
+                        [-122.4, 37.9],
+                      ],
+                    ],
+                  },
+                  properties: { NOM_COM: 'TEST' },
+                }),
+                population: 50000,
+              },
+            ],
+          },
+        ],
+      };
+
+      const result = transformProps(collidingColumnNameProps as ChartProps);
+      const features = result.payload.data.features as PolygonFeature[];
+
+      expect(features).toHaveLength(1);
+      expect(features[0]?.polygon).toEqual([
+        [-122.4, 37.8],
+        [-122.3, 37.8],
+        [-122.3, 37.9],
+        [-122.4, 37.9],
+      ]);
+    },
+  );
 });