You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/10/21 19:44:28 UTC

[PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

rusackas opened a new pull request, #45585:
URL: https://github.com/apache/superset/pull/45585

   ### SUMMARY
   Include empty/null results for the categorical color column in Scatterplot and Arc charts instead of dropping those points. This is a rebase of @DamianPendrak's work in #39430, opened fresh because the token used here lacks the `workflow` scope needed to push directly to their fork.
   
   Closes #39430 - thanks for the work here @DamianPendrak!
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   See #39430 for before/after screenshots.
   
   ### TESTING INSTRUCTIONS
   Create a deck.gl Scatterplot or Arc chart with a categorical color column that has some null/empty values. Confirm those points render (grouped under a "N/A" legend entry) instead of being dropped.
   
   ### ADDITIONAL INFORMATION
   - [x] Has associated issue: Closes #39430
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   πŸ€– Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #45585:
URL: https://github.com/apache/superset/pull/45585#discussion_r4367112720


##########
superset-frontend/plugins/preset-chart-deckgl/src/utilities/tooltipUtils.tsx:
##########
@@ -348,6 +349,12 @@ export function createHandlebarsTooltipData(
     data = { ...data, ...tooltipData };
   }
 
+  // Applied after the tooltip-contents merge so a configured `cat_color` item
+  // cannot reintroduce the raw null sentinel.
+  if (data.cat_color != null) {
+    data = { ...data, cat_color: formatNullCategory(`${data.cat_color}`) };

Review Comment:
   @sadpandajoe good catch. The replacement now only runs when `cat_color` is the null sentinel; other values pass through untouched. Added a test with an array `cat_color`.



##########
superset-frontend/plugins/preset-chart-deckgl/src/utilities/tooltipUtils.tsx:
##########
@@ -58,7 +59,7 @@ export const CommonTooltipRows = {
     o.object?.cat_color ? (
       <TooltipRow
         label={`${t('Category')}: `}
-        value={`${o.object.cat_color}`}
+        value={formatNullCategory(`${o.object.cat_color}`)}

Review Comment:
   @sadpandajoe yes, the field-based branch now formats the sentinel through `formatNullCategory` too, with a test.



##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/Scatter.tsx:
##########
@@ -67,7 +67,7 @@ function setTooltipContent(
         {o.object?.cat_color && (
           <TooltipRow
             label={`${t('Category')}: `}
-            value={`${o.object?.cat_color}`}
+            value={formatNullCategory(`${o.object?.cat_color}`)}

Review Comment:
   @sadpandajoe added `Scatter.test.tsx`: calls `onHover` through `getLayer` with no template or contents and a sentinel `cat_color`, then asserts `N/A` shows and `<NULL>` does not.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #45585:
URL: https://github.com/apache/superset/pull/45585#discussion_r4356310398


##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.ts:
##########
@@ -155,9 +156,10 @@ function processScatterData(
       }
     }
 
-    const categoryValue = getSourceValue(categoryColumn);
-    if (categoryValue != null) {
-      scatterPoint.cat_color = String(categoryValue);
+    if (categoryColumn) {
+      const categoryValue = getSourceValue(categoryColumn);
+      scatterPoint.cat_color =

Review Comment:
   Good catch. Scatter and Path now assign `cat_color` after the property copy, same as Arc, so a `cat_color` column can no longer clobber it (864f1c849f).



##########
superset-frontend/plugins/preset-chart-deckgl/src/utilities/tooltipUtils.tsx:
##########
@@ -58,7 +59,7 @@ export const CommonTooltipRows = {
     o.object?.cat_color ? (
       <TooltipRow
         label={`${t('Category')}: `}
-        value={`${o.object.cat_color}`}
+        value={formatNullCategory(`${o.object.cat_color}`)}

Review Comment:
   Yep, fair. `createHandlebarsTooltipData` now runs `cat_color` through `formatNullCategory`, so templates show N/A to match the legend (864f1c849f).



##########
superset-frontend/plugins/preset-chart-deckgl/src/CategoricalDeckGLContainer.test.tsx:
##########
@@ -275,3 +276,25 @@ test('with autozoom a tilt written back by Explore keeps the viewer on the same
   );
   expect(mockViewports.at(-1)).toEqual(fitted);
 });
+
+test('rows with a null dimension get their own legend category', () => {
+  const fd = {
+    datasource: '1__table',
+    viz_type: 'deck_scatter',
+    color_scheme_type: COLOR_SCHEME_TYPES.categorical_palette,
+    color_scheme: 'supersetColors',
+    dimension: 'category',
+    slice_id: 42,
+    color_picker: { r: 0, g: 0, b: 0, a: 1 },
+  } as unknown as QueryFormData;
+  const data = [{ cat_color: 'A' }, { cat_color: NULL_CATEGORY_KEY }];
+
+  const categories = getCategories(fd, data);
+
+  expect(categories[NULL_CATEGORY_KEY]?.enabled).toBe(true);
+  expect(categories[NULL_CATEGORY_KEY]?.color).toBeDefined();
+
+  // Without a category entry the container drops the feature entirely, which is
+  // how null-dimension rows used to disappear from the map.
+  expect(data.filter(d => categories[d.cat_color]?.enabled)).toHaveLength(2);

Review Comment:
   Agreed, the old test was mostly restating the filter. Added a render test that mounts `CategoricalDeckGLContainer` with `A` and null rows, checks both reach the layer (null row with its own color), and that clicking N/A in the legend drops only the null row. I could not run Jest locally here, so CI will be the first real run (864f1c849f).



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #45585:
URL: https://github.com/apache/superset/pull/45585#issuecomment-6418851399

   @aminghadersohi good call. The container render test now builds its payload from real Scatter `transformProps` output (null `category` row included) instead of a hand-written `<NULL>` fixture (4722bc0be3).


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #45585:
URL: https://github.com/apache/superset/pull/45585#discussion_r4341270086


##########
superset-frontend/plugins/preset-chart-deckgl/src/utils.ts:
##########
@@ -25,12 +25,20 @@ import {
   QueryFormData,
   SequentialScheme,
 } from '@superset-ui/core';
+import { Constants } from '@superset-ui/core/components';
 import { Color } from '@deck.gl/core';
 import { hexToRGB } from './utils/colors';
 import { ColorBreakpointType } from './types';
 
 export const TRANSPARENT_COLOR_ARRAY = [0, 0, 0, 0] as Color;
 export const HIGHLIGHT_COLOR_ARRAY = [255, 0, 0, 255] as Color;
+// Stands in for a null dimension value so those rows still get a category, a
+// color and a legend entry. Kept distinct from NULL_DISPLAY so the key stays
+// stable across locales.
+export const NULL_CATEGORY_KEY = '<NULL>';

Review Comment:
   **Suggestion:** A real category value of `<NULL>` collides with the null sentinel, so its points share the missing-data category and both appear as N/A.
   
   **Assessment:** 🟠 `Major` Β· πŸ” `Occurrence: Rarely` Β· 🏷️ `Logic error`
   
   [![Use CodeAnt Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill) [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=86c6ffb7c88f4971b8bad42c8f664578&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=86c6ffb7c88f4971b8bad42c8f664578&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/plugins/preset-chart-deckgl/src/utils.ts
   **Line:** 38:38
   **Comment:**
   	*Logic Error: A real category value of `<NULL>` collides with the null sentinel, so its points share the missing-data category and both appear as N/A.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45585&comment_hash=828c340b982def46dfadff960cb4c2ce7c7d1ee2f717f2cb60d8257a672c6d2e&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45585&comment_hash=828c340b982def46dfadff960cb4c2ce7c7d1ee2f717f2cb60d8257a672c6d2e&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #45585:
URL: https://github.com/apache/superset/pull/45585#discussion_r4343184460


##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Arc/transformProps.ts:
##########
@@ -65,8 +66,11 @@ function processArcData(
         extraProps: {},
       };
 
-      if (dimension && record[dimension] != null) {
-        arcPoint.cat_color = String(record[dimension]);
+      if (dimension) {
+        arcPoint.cat_color =
+          record[dimension] != null
+            ? String(record[dimension])
+            : NULL_CATEGORY_KEY;

Review Comment:
   Fixed: `cat_color` is now assigned after the property copy, so a column with that name can no longer overwrite the selected dimension.



##########
superset-frontend/plugins/preset-chart-deckgl/src/utils.ts:
##########
@@ -25,12 +25,20 @@ import {
   QueryFormData,
   SequentialScheme,
 } from '@superset-ui/core';
+import { Constants } from '@superset-ui/core/components';
 import { Color } from '@deck.gl/core';
 import { hexToRGB } from './utils/colors';
 import { ColorBreakpointType } from './types';
 
 export const TRANSPARENT_COLOR_ARRAY = [0, 0, 0, 0] as Color;
 export const HIGHLIGHT_COLOR_ARRAY = [255, 0, 0, 255] as Color;
+// Stands in for a null dimension value so those rows still get a category, a
+// color and a legend entry. Kept distinct from NULL_DISPLAY so the key stays
+// stable across locales.
+export const NULL_CATEGORY_KEY = '<NULL>';

Review Comment:
   A literal `<NULL>` category value is the one case this collides on. I am keeping the sentinel since it has to be a string that survives the category-to-color mapping, and a real value spelled exactly `<NULL>` is vanishingly unlikely.



##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.ts:
##########
@@ -155,9 +156,10 @@ function processScatterData(
       }
     }
 
-    const categoryValue = getSourceValue(categoryColumn);
-    if (categoryValue != null) {
-      scatterPoint.cat_color = String(categoryValue);
+    if (categoryColumn) {
+      const categoryValue = getSourceValue(categoryColumn);
+      scatterPoint.cat_color =
+        categoryValue != null ? String(categoryValue) : NULL_CATEGORY_KEY;

Review Comment:
   Same as the `utils.ts` thread: a literal `<NULL>` category is the accepted trade-off for the sentinel.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #45585:
URL: https://github.com/apache/superset/pull/45585#discussion_r4365645518


##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.test.ts:
##########
@@ -197,6 +198,49 @@ test('Scatter transformProps should handle dimension for category colors', () =>
   expect(features[1]?.cat_color).toBe('B');
 });
 
+test('Scatter transformProps should fall back to NULL_CATEGORY_KEY for empty dimension values', () => {
+  const propsWithNullCategory = {
+    ...mockChartProps,
+    rawFormData: {
+      ...mockChartProps.rawFormData,
+      dimension: 'category',
+      point_radius_fixed: {
+        type: 'fix',
+        value: '1000',
+      },
+    },
+    queriesData: [
+      {
+        data: [
+          {
+            LATITUDE: 37.8,
+            LONGITUDE: -122.4,
+            category: 'A',
+          },
+          {
+            LATITUDE: 37.9,
+            LONGITUDE: -122.3,
+            category: null,
+          },
+          {
+            LATITUDE: 38.0,
+            LONGITUDE: -122.2,
+            category: undefined,
+          },
+        ],
+      },
+    ],
+  };
+
+  const result = transformProps(propsWithNullCategory as ChartProps);
+  const features = result.payload.data.features as ScatterFeature[];
+
+  expect(features).toHaveLength(3);
+  expect(features[0]?.cat_color).toBe('A');
+  expect(features[1]?.cat_color).toBe(NULL_CATEGORY_KEY);

Review Comment:
   The ordering fix (assigning `cat_color` after `addPropertiesToFeature`) has no test: none of the Scatter, Arc or Path fixtures include a source column literally named `cat_color`, so moving the assignment back above the property copy would leave every test here green while null-dimension points vanish again. Could you add a row like `{ category: null, cat_color: 'unrelated' }` and assert the feature's `cat_color` is `NULL_CATEGORY_KEY`, in each of the three transforms?



##########
superset-frontend/plugins/preset-chart-deckgl/src/utilities/tooltipUtils.tsx:
##########
@@ -58,7 +59,7 @@ export const CommonTooltipRows = {
     o.object?.cat_color ? (
       <TooltipRow
         label={`${t('Category')}: `}
-        value={`${o.object.cat_color}`}
+        value={formatNullCategory(`${o.object.cat_color}`)}

Review Comment:
   The default category row is fixed, but a null-category point can still show `<NULL>` in the tooltip: when `cat_color` is one of the configured tooltip contents, the merge of `tooltipData` near the end of `createHandlebarsTooltipData` replaces the normalized `N/A` with the raw feature value, so `{{cat_color}}` still disagrees with the legend. Could the formatting be applied after that merge instead?



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #45585:
URL: https://github.com/apache/superset/pull/45585#discussion_r4351908440


##########
superset-frontend/plugins/preset-chart-deckgl/src/utilities/tooltipUtils.tsx:
##########
@@ -58,7 +59,7 @@ export const CommonTooltipRows = {
     o.object?.cat_color ? (
       <TooltipRow
         label={`${t('Category')}: `}
-        value={`${o.object.cat_color}`}
+        value={formatNullCategory(`${o.object.cat_color}`)}

Review Comment:
   The sentinel is only formatted here, in the default category row. `createHandlebarsTooltipData` still spreads the raw feature, so a custom tooltip template with `{{cat_color}}` will show `<NULL>` for a null-category point, while the legend shows N/A for the same point. These points were previously dropped, so this is newly reachable. Should the handlebars data apply `formatNullCategory` to `cat_color` too?



##########
superset-frontend/plugins/preset-chart-deckgl/src/CategoricalDeckGLContainer.test.tsx:
##########
@@ -275,3 +276,25 @@ test('with autozoom a tilt written back by Explore keeps the viewer on the same
   );
   expect(mockViewports.at(-1)).toEqual(fitted);
 });
+
+test('rows with a null dimension get their own legend category', () => {
+  const fd = {
+    datasource: '1__table',
+    viz_type: 'deck_scatter',
+    color_scheme_type: COLOR_SCHEME_TYPES.categorical_palette,
+    color_scheme: 'supersetColors',
+    dimension: 'category',
+    slice_id: 42,
+    color_picker: { r: 0, g: 0, b: 0, a: 1 },
+  } as unknown as QueryFormData;
+  const data = [{ cat_color: 'A' }, { cat_color: NULL_CATEGORY_KEY }];
+
+  const categories = getCategories(fd, data);
+
+  expect(categories[NULL_CATEGORY_KEY]?.enabled).toBe(true);
+  expect(categories[NULL_CATEGORY_KEY]?.color).toBeDefined();
+
+  // Without a category entry the container drops the feature entirely, which is
+  // how null-dimension rows used to disappear from the map.
+  expect(data.filter(d => categories[d.cat_color]?.enabled)).toHaveLength(2);

Review Comment:
   This test feeds `getCategories` an already-normalized `<NULL>` key and then repeats the container's legend filter inline, so it would still pass if the container or a layer dropped null rows. Nothing renders `CategoricalDeckGLContainer` with real `transformProps` output for mixed `'A'`/null rows. Could you add a render test asserting both rows reach the mocked layer with the N/A category color, and that toggling N/A in the legend removes only the null row?



##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.ts:
##########
@@ -155,9 +156,10 @@ function processScatterData(
       }
     }
 
-    const categoryValue = getSourceValue(categoryColumn);
-    if (categoryValue != null) {
-      scatterPoint.cat_color = String(categoryValue);
+    if (categoryColumn) {
+      const categoryValue = getSourceValue(categoryColumn);
+      scatterPoint.cat_color =

Review Comment:
   The sentinel is assigned before `addPropertiesToFeature` runs, so a selected column literally named `cat_color` (e.g. one added for tooltips) is copied over it. With a null dimension value and a null `cat_color` column, the feature ends up with `cat_color: null`, which `getCategories` skips and the legend filter drops, so that point still disappears. Arc was reordered to assign after the copy for this reason; Path (`layers/Path/transformProps.ts`, the `feature.cat_color =` block) has the same ordering. Should these two assign after the copy as well?



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #45585:
URL: https://github.com/apache/superset/pull/45585#discussion_r4366610158


##########
superset-frontend/plugins/preset-chart-deckgl/src/utilities/tooltipUtils.tsx:
##########
@@ -348,6 +349,12 @@ export function createHandlebarsTooltipData(
     data = { ...data, ...tooltipData };
   }
 
+  // Applied after the tooltip-contents merge so a configured `cat_color` item
+  // cannot reintroduce the raw null sentinel.
+  if (data.cat_color != null) {
+    data = { ...data, cat_color: formatNullCategory(`${data.cat_color}`) };

Review Comment:
   This now rewrites `cat_color` for every chart that reaches this function, not only the null sentinel. For a Screengrid chart with no dimension and `tooltip_contents` containing a real column named `cat_color`, `processTooltipContentItem` sets `cat_color` to the array `['A', 'B']`; the template literal turns it into the string `'A,B'`, so `{{first cat_color}}` renders nothing and `{{#each cat_color}}` iterates characters. Numeric values also become strings. Could the replacement only happen when the value is `NULL_CATEGORY_KEY` and otherwise leave the value untouched?



##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/Scatter.tsx:
##########
@@ -67,7 +67,7 @@ function setTooltipContent(
         {o.object?.cat_color && (
           <TooltipRow
             label={`${t('Category')}: `}
-            value={`${o.object?.cat_color}`}
+            value={formatNullCategory(`${o.object?.cat_color}`)}

Review Comment:
   Scatter has its own default tooltip renderer, and nothing in the tests exercises it: the new `CommonTooltipRows.category` test covers a different function, and there is no `Scatter.test.tsx`. If this `formatNullCategory` call were reverted, every test would stay green while hovering a null-category point showed `Category: <NULL>`. Could you add a `getLayer` test with no tooltip template or contents that invokes `onHover` with a picked feature whose `cat_color` is the sentinel, renders the captured tooltip, and asserts `N/A` appears and `<NULL>` does not?



##########
superset-frontend/plugins/preset-chart-deckgl/src/utilities/tooltipUtils.tsx:
##########
@@ -58,7 +59,7 @@ export const CommonTooltipRows = {
     o.object?.cat_color ? (
       <TooltipRow
         label={`${t('Category')}: `}
-        value={`${o.object.cat_color}`}
+        value={formatNullCategory(`${o.object.cat_color}`)}

Review Comment:
   The sentinel is formatted here and in the Handlebars path, but the field-based branch (`buildFieldBasedTooltipItems`, reached when `tooltip_contents` is set and the template is empty) still passes the raw value through `formatValue`. With a Scatter, Arc or Path chart that has a nullable dimension and `cat_color` in Tooltip contents, a null row shows `N/A` in the legend but `cat_color: <NULL>` on hover. Should that branch run the value through `formatNullCategory` too?



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #45585:
URL: https://github.com/apache/superset/pull/45585#issuecomment-6329239585

   ### <span aria-hidden="true">βœ…</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">πŸ”¨</span> Latest commit | c4f51cbd07896107672842c8d905c90bef43b43c |
   |<span aria-hidden="true">πŸ”</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6ad950c5efa80bf3792e3974 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-45585--superset-docs-preview.netlify.app](https://deploy-preview-45585--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">πŸ“±</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQ1NTg1LS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.nVybcXEfafSteLH5XvErWhinC6IUmNuO7Gy2QtYVQd0)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   |<span aria-hidden="true">πŸ€–</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DctNDkAwEEDhu8xao1F_dQPHqOkUMUzTkBBxd929xfdeiEn2eMIAUMCU3IFL7rDepbG10coTbjOr42JW6E6aJT0KhSVl7ymyPKPPR-u8bTQ2FFyvp2A6W5GxXQ3fDw) |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-45585--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #45585:
URL: https://github.com/apache/superset/pull/45585#discussion_r4343187139


##########
superset-frontend/plugins/preset-chart-deckgl/src/utils.ts:
##########
@@ -25,12 +25,20 @@ import {
   QueryFormData,
   SequentialScheme,
 } from '@superset-ui/core';
+import { Constants } from '@superset-ui/core/components';
 import { Color } from '@deck.gl/core';
 import { hexToRGB } from './utils/colors';
 import { ColorBreakpointType } from './types';
 
 export const TRANSPARENT_COLOR_ARRAY = [0, 0, 0, 0] as Color;
 export const HIGHLIGHT_COLOR_ARRAY = [255, 0, 0, 255] as Color;
+// Stands in for a null dimension value so those rows still get a category, a
+// color and a legend entry. Kept distinct from NULL_DISPLAY so the key stays
+// stable across locales.
+export const NULL_CATEGORY_KEY = '<NULL>';

Review Comment:
   βœ… **Customized review instruction saved!**
   
   **Instruction:**
   > Do not flag the `<NULL>` sentinel's potential collision with a literal category value; it must remain a string for category-to-color mapping, and the exact collision is considered acceptably rare.
   
   **Applied to:**
     - `superset-frontend/plugins/preset-chart-deckgl/src/utils.ts`
   
   ---
   πŸ’‘ *To manage or update this instruction, visit: [CodeAnt AI Settings](https://app.codeant.ai/org/settings/learnings)*



##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.ts:
##########
@@ -155,9 +156,10 @@ function processScatterData(
       }
     }
 
-    const categoryValue = getSourceValue(categoryColumn);
-    if (categoryValue != null) {
-      scatterPoint.cat_color = String(categoryValue);
+    if (categoryColumn) {
+      const categoryValue = getSourceValue(categoryColumn);
+      scatterPoint.cat_color =
+        categoryValue != null ? String(categoryValue) : NULL_CATEGORY_KEY;

Review Comment:
   βœ… **Customized review instruction saved!**
   
   **Instruction:**
   > Do not flag the intentional use of `<NULL>` as the null-category sentinel, even though it collides with a literal `<NULL>` category.
   
   **Applied to:**
     - `superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.ts`
   
   ---
   πŸ’‘ *To manage or update this instruction, visit: [CodeAnt AI Settings](https://app.codeant.ai/org/settings/learnings)*



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #45585:
URL: https://github.com/apache/superset/pull/45585#issuecomment-6325275293

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/45585?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 65.45%. Comparing base ([`b7bfbd3`](https://app.codecov.io/gh/apache/superset/commit/b7bfbd365e6ee63934f59d6284afb296e07f7a24?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`9053da3`](https://app.codecov.io/gh/apache/superset/commit/9053da369367312474847cb9e404ed16dd215b73?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 8 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #45585      +/-   ##
   ==========================================
   + Coverage   65.44%   65.45%   +0.01%     
   ==========================================
     Files        3056     3056              
     Lines      201163   201173      +10     
     Branches    47040    47047       +7     
   ==========================================
   + Hits       131647   131684      +37     
   + Misses      66556    66529      -27     
     Partials     2960     2960              
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/45585/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Ξ” | |
   |---|---|---|
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/45585/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `80.14% <100.00%> (+0.03%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/45585?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #45585:
URL: https://github.com/apache/superset/pull/45585#issuecomment-6325140133

   ## CodeAnt PR Risk: Medium Risk
   
   - The PR needs attention before merging because a real category value can be confused with missing data.
   - Values equal to β€œ<NULL>” share the null category’s color and display as N/A across the DeckGL category handling.
   
   **Assessed commit:** `9053da369367`


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #45585:
URL: https://github.com/apache/superset/pull/45585#discussion_r4341275343


##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.ts:
##########
@@ -155,9 +156,10 @@ function processScatterData(
       }
     }
 
-    const categoryValue = getSourceValue(categoryColumn);
-    if (categoryValue != null) {
-      scatterPoint.cat_color = String(categoryValue);
+    if (categoryColumn) {
+      const categoryValue = getSourceValue(categoryColumn);
+      scatterPoint.cat_color =
+        categoryValue != null ? String(categoryValue) : NULL_CATEGORY_KEY;

Review Comment:
   **Suggestion:** A real category named `<NULL>` takes the same key as missing values, so it is mislabeled N/A and merged with them.
   
   **Assessment:** 🟠 `Major` Β· πŸ” `Occurrence: Rarely` Β· 🏷️ `Logic error`
   
   [![Use CodeAnt Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill) [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=03fabe805ed547dc8f8f07c719ba63a6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=03fabe805ed547dc8f8f07c719ba63a6&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.ts
   **Line:** 161:162
   **Comment:**
   	*Logic Error: A real category named `<NULL>` takes the same key as missing values, so it is mislabeled N/A and merged with them.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45585&comment_hash=e62bf7f32d78a4e819d2410a05856b05e0e15e0c744e7c1df53a72d090a4c61b&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45585&comment_hash=e62bf7f32d78a4e819d2410a05856b05e0e15e0c744e7c1df53a72d090a4c61b&reaction=dislike'>πŸ‘Ž</a>



##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Arc/transformProps.ts:
##########
@@ -65,8 +66,11 @@ function processArcData(
         extraProps: {},
       };
 
-      if (dimension && record[dimension] != null) {
-        arcPoint.cat_color = String(record[dimension]);
+      if (dimension) {
+        arcPoint.cat_color =
+          record[dimension] != null
+            ? String(record[dimension])
+            : NULL_CATEGORY_KEY;

Review Comment:
   **Suggestion:** If a tooltip/query field is named `cat_color`, the later property copy overwrites this value, so Arc categories use that field instead of the selected dimension.
   
   **Assessment:** 🟠 `Major` Β· πŸ” `Occurrence: Rarely` Β· 🏷️ `Incorrect variable usage`
   
   [![Use CodeAnt Skill](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/use-codeant-skill-flat-v2.svg)](https://docs.codeant.ai/cli/resolve-pr-comments-skill) [![Fix in Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=bb8d21e7156c4544afdc156ee087f81f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [![Fix in VSCode Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=bb8d21e7156c4544afdc156ee087f81f&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   <details>
   <summary><b>Prompt for AI Agent πŸ€– </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** superset-frontend/plugins/preset-chart-deckgl/src/layers/Arc/transformProps.ts
   **Line:** 70:73
   **Comment:**
   	*Incorrect Variable Usage: If a tooltip/query field is named `cat_color`, the later property copy overwrites this value, so Arc categories use that field instead of the selected dimension.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45585&comment_hash=3b936cc46e1cb80a3d4f6d0bfa7f502c758c95613ac2e324a424eb9e71db0c23&reaction=like'>πŸ‘</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F45585&comment_hash=3b936cc46e1cb80a3d4f6d0bfa7f502c758c95613ac2e324a424eb9e71db0c23&reaction=dislike'>πŸ‘Ž</a>



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #45585:
URL: https://github.com/apache/superset/pull/45585#discussion_r4366136543


##########
superset-frontend/plugins/preset-chart-deckgl/src/utilities/tooltipUtils.tsx:
##########
@@ -58,7 +59,7 @@ export const CommonTooltipRows = {
     o.object?.cat_color ? (
       <TooltipRow
         label={`${t('Category')}: `}
-        value={`${o.object.cat_color}`}
+        value={formatNullCategory(`${o.object.cat_color}`)}

Review Comment:
   Good catch. cat_color is now formatted after the tooltip_contents merge, so a configured cat_color item shows N/A too (b9a0e568bc), with a test for both cases.



##########
superset-frontend/plugins/preset-chart-deckgl/src/layers/Scatter/transformProps.test.ts:
##########
@@ -197,6 +198,49 @@ test('Scatter transformProps should handle dimension for category colors', () =>
   expect(features[1]?.cat_color).toBe('B');
 });
 
+test('Scatter transformProps should fall back to NULL_CATEGORY_KEY for empty dimension values', () => {
+  const propsWithNullCategory = {
+    ...mockChartProps,
+    rawFormData: {
+      ...mockChartProps.rawFormData,
+      dimension: 'category',
+      point_radius_fixed: {
+        type: 'fix',
+        value: '1000',
+      },
+    },
+    queriesData: [
+      {
+        data: [
+          {
+            LATITUDE: 37.8,
+            LONGITUDE: -122.4,
+            category: 'A',
+          },
+          {
+            LATITUDE: 37.9,
+            LONGITUDE: -122.3,
+            category: null,
+          },
+          {
+            LATITUDE: 38.0,
+            LONGITUDE: -122.2,
+            category: undefined,
+          },
+        ],
+      },
+    ],
+  };
+
+  const result = transformProps(propsWithNullCategory as ChartProps);
+  const features = result.payload.data.features as ScatterFeature[];
+
+  expect(features).toHaveLength(3);
+  expect(features[0]?.cat_color).toBe('A');
+  expect(features[1]?.cat_color).toBe(NULL_CATEGORY_KEY);

Review Comment:
   Added a row with a null dimension and an unrelated cat_color column to each of the Scatter, Arc and Path transform tests, asserting NULL_CATEGORY_KEY (b9a0e568bc).



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(deck.gl): scatterplot stops rendering points with empty value of categorical color [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #45585:
URL: https://github.com/apache/superset/pull/45585


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org