You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2026/09/04 13:56:49 UTC

(superset) 01/01: feat(explore): indicate when a filter is mirrored onto a partition column

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

hughhhh pushed a commit to branch hughhhh/pfm-6-explore-indicator
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 949b0afdd82fdd0bac25469ed2c2fbec56757fdb
Author: Hugh A Miles II <hu...@gmail.com>
AuthorDate: Fri Sep 4 10:56:33 2026 -0300

    feat(explore): indicate when a filter is mirrored onto a partition column
    
    Sixth and last of the stack, implementing wireframe 1d. A chart author
    configures none of this and ideally never learns the word "partition"; the
    glyph exists only to explain why their query got faster and to point at the
    generated SQL where the extra predicate is visible.
    
    The indicator renders on any filter whose column the dataset maps, which covers
    the time range too -- Explore models it as a TEMPORAL_RANGE adhoc filter, so it
    is the same chip. `DndAdhocFilterOption` -> `OptionWrapper` -> `Option` is the
    path that actually renders in Explore; `OptionControlLabel` and the legacy
    `AdhocFilterOption` are wired as well so the indicator does not silently vanish
    on whichever surface uses them. The standalone `time_range` control gets the
    mapping through a new `mapStateToProps`, for viz types that still have one.
    
    `partitionColumn` already exists on these components as the unrelated Presto
    `latest_partition` feature, so this is `partitionMapping` throughout.
    
    Also fixes a bug the indicator made visible: `partition_filter_mapping_summary`
    was not gated on the feature flag, so with `PARTITION_FILTER_MAPPING` off the
    payload still reported `active: true`. Nothing is mirrored in that state --
    `resolve_partition_mapping` returns None -- so the glyph was promising a
    predicate the query never carried. The summary now gates the same way the query
    path does. It was invisible until something rendered from it.
    
    Verified in Explore against a real partitioned table: the glyph appears on the
    `event_time` time-range chip and on nothing else, the tooltip reads "This filter
    is also applied to a partition column for faster queries", and with the flag off
    the mapping serializes as null and no glyph renders.
    
    Co-Authored-By: Claude Opus 5 (1M context) <no...@anthropic.com>
---
 .../src/shared-controls/sharedControls.tsx         |  6 ++
 .../PartitionPruningIndicator.test.tsx             | 76 ++++++++++++++++++++
 .../components/PartitionPruningIndicator/index.tsx | 80 ++++++++++++++++++++++
 .../controls/DateFilterControl/DateFilterLabel.tsx |  9 ++-
 .../components/controls/DateFilterControl/types.ts |  8 +++
 .../DndAdhocFilterOption.tsx                       | 22 ++++++
 .../controls/DndColumnSelectControl/Option.tsx     |  3 +
 .../DndColumnSelectControl/OptionWrapper.tsx       |  2 +
 .../controls/DndColumnSelectControl/types.ts       |  3 +
 .../AdhocFilterOption/AdhocFilterOption.test.tsx   | 57 +++++++++++++++
 .../FilterControl/AdhocFilterOption/index.tsx      | 21 ++++++
 .../components/controls/OptionControls/index.tsx   |  6 ++
 superset/connectors/sqla/models.py                 | 14 +++-
 .../partition_mapping_serialization_test.py        | 19 +++++
 14 files changed, 323 insertions(+), 3 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx
index 1bbe5e832bb..9e208f91ce7 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/shared-controls/sharedControls.tsx
@@ -211,6 +211,12 @@ const time_grain_sqla: SharedControlConfig<'SelectControl'> = {
 const time_range: SharedControlConfig<'DateFilterControl'> = {
   type: 'DateFilterControl',
   freeForm: true,
+  // The indicator needs to know whether this filter is mirrored onto a
+  // partition column; the summary is self-contained on the datasource so this
+  // does not have to reach into `columns`.
+  mapStateToProps: ({ datasource }) => ({
+    partitionMapping: (datasource as Dataset)?.partition_filter_mapping ?? null,
+  }),
   label: TIME_FILTER_LABELS.time_range,
   default: NO_TIME_RANGE, // this value is an empty filter constant so shouldn't translate it.
   description: t(
diff --git a/superset-frontend/src/explore/components/PartitionPruningIndicator/PartitionPruningIndicator.test.tsx b/superset-frontend/src/explore/components/PartitionPruningIndicator/PartitionPruningIndicator.test.tsx
new file mode 100644
index 00000000000..85070d2dff3
--- /dev/null
+++ b/superset-frontend/src/explore/components/PartitionPruningIndicator/PartitionPruningIndicator.test.tsx
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { render, screen, userEvent } from 'spec/helpers/testing-library';
+import PartitionPruningIndicator, { isMirroredColumn } from '.';
+
+const ACTIVE = {
+  partition_column: 'dt_epoch',
+  mapped_column: 'event_time',
+  active: true,
+};
+
+test('the glyph appears for an active mapping', () => {
+  render(<PartitionPruningIndicator mapping={ACTIVE} />);
+
+  expect(screen.getByTestId('partition-pruning-indicator')).toBeInTheDocument();
+});
+
+test('an inactive mapping shows nothing', () => {
+  // Configured but inert -- no transform yet. Claiming the query is pruning
+  // when it is not would be worse than staying quiet.
+  const { container } = render(
+    <PartitionPruningIndicator mapping={{ ...ACTIVE, active: false }} />,
+  );
+
+  expect(container).toBeEmptyDOMElement();
+});
+
+test('no mapping at all shows nothing', () => {
+  const { container } = render(<PartitionPruningIndicator mapping={null} />);
+
+  expect(container).toBeEmptyDOMElement();
+});
+
+test('the tooltip explains the speed-up without saying "partition column" twice', async () => {
+  render(<PartitionPruningIndicator mapping={ACTIVE} />);
+
+  await userEvent.hover(screen.getByTestId('partition-pruning-indicator'));
+
+  expect(
+    await screen.findByText(
+      /also applied to a partition column for faster queries/,
+    ),
+  ).toBeInTheDocument();
+});
+
+test('only the mapped column counts as mirrored', () => {
+  // The model allows exactly one mapped column, so every other filter on the
+  // chart -- including one on the partition column itself -- gets no glyph.
+  expect(isMirroredColumn(ACTIVE, 'event_time')).toBe(true);
+  expect(isMirroredColumn(ACTIVE, 'country')).toBe(false);
+  expect(isMirroredColumn(ACTIVE, 'dt_epoch')).toBe(false);
+});
+
+test('nothing is mirrored when the mapping is inactive or absent', () => {
+  expect(isMirroredColumn({ ...ACTIVE, active: false }, 'event_time')).toBe(
+    false,
+  );
+  expect(isMirroredColumn(null, 'event_time')).toBe(false);
+  expect(isMirroredColumn(ACTIVE, undefined)).toBe(false);
+});
diff --git a/superset-frontend/src/explore/components/PartitionPruningIndicator/index.tsx b/superset-frontend/src/explore/components/PartitionPruningIndicator/index.tsx
new file mode 100644
index 00000000000..51cf80bff88
--- /dev/null
+++ b/superset-frontend/src/explore/components/PartitionPruningIndicator/index.tsx
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { t } from '@apache-superset/core/translation';
+import { css, useTheme } from '@apache-superset/core/theme';
+import { Icons, Tooltip } from '@superset-ui/core/components';
+import type { PartitionFilterMapping } from '@superset-ui/chart-controls';
+
+interface PartitionPruningIndicatorProps {
+  /** The dataset's mapping summary, straight off the datasource payload. */
+  mapping?: PartitionFilterMapping | null;
+}
+
+/**
+ * The glyph on a filter whose column is mirrored onto a partition column
+ * (wireframe 1d).
+ *
+ * Chart authors do not configure any of this and ideally never learn the word
+ * "partition"; the indicator exists only to explain why their query got faster,
+ * and to point at the generated SQL where the extra predicate is visible.
+ */
+export default function PartitionPruningIndicator({
+  mapping,
+}: PartitionPruningIndicatorProps) {
+  const theme = useTheme();
+
+  if (!mapping?.active) {
+    return null;
+  }
+
+  return (
+    <Tooltip
+      placement="top"
+      title={t(
+        'This filter is also applied to a partition column for faster queries. See "View query" for the generated SQL.',
+      )}
+    >
+      <span data-test="partition-pruning-indicator">
+        <Icons.FilterOutlined
+          iconSize="s"
+          iconColor={theme.colorSuccess}
+          css={css`
+            margin-left: ${theme.sizeUnit}px;
+            vertical-align: middle;
+          `}
+        />
+      </span>
+    </Tooltip>
+  );
+}
+
+/**
+ * Whether a filter on `columnName` is the one being mirrored.
+ *
+ * The mapping names exactly one mapped column, so anything else on the chart --
+ * including other filters on the same dataset -- gets no indicator.
+ */
+export function isMirroredColumn(
+  mapping: PartitionFilterMapping | null | undefined,
+  columnName: string | null | undefined,
+): boolean {
+  return Boolean(
+    mapping?.active && columnName && mapping.mapped_column === columnName,
+  );
+}
diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx b/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx
index 942d83db135..94c62a97e9c 100644
--- a/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx
+++ b/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx
@@ -35,8 +35,10 @@ import {
   Divider,
   Tooltip,
   Select,
+  Flex,
 } from '@superset-ui/core/components';
 import ControlHeader from 'src/explore/components/ControlHeader';
+import PartitionPruningIndicator from 'src/explore/components/PartitionPruningIndicator';
 import { Icons } from '@superset-ui/core/components/Icons';
 import { useDebouncedEffect } from 'src/explore/exploreUtils';
 import { noOp } from 'src/utils/common';
@@ -391,7 +393,12 @@ export default function DateFilterLabel(props: DateFilterControlProps) {
   return (
     <>
       <ControlHeader {...props} />
-      {popoverContent}
+      {/* The glyph sits outside the popover trigger so clicking it opens the
+          tooltip rather than the time-range editor. */}
+      <Flex align="center" gap={theme.sizeUnit}>
+        {popoverContent}
+        <PartitionPruningIndicator mapping={props.partitionMapping} />
+      </Flex>
     </>
   );
 }
diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/types.ts b/superset-frontend/src/explore/components/controls/DateFilterControl/types.ts
index e06c5409cce..8c4bbae044b 100644
--- a/superset-frontend/src/explore/components/controls/DateFilterControl/types.ts
+++ b/superset-frontend/src/explore/components/controls/DateFilterControl/types.ts
@@ -16,6 +16,8 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+import type { PartitionFilterMapping } from '@superset-ui/chart-controls';
+
 export type SelectOptionType = {
   value: string;
   label: string;
@@ -113,4 +115,10 @@ export interface DateFilterControlProps {
   onOpenPopover?: () => void;
   onClosePopover?: () => void;
   isOverflowingFilterBar?: boolean;
+  /**
+   * The dataset's partition filter mapping, injected by the control's
+   * `mapStateToProps`. Present and active means this time range is also
+   * applied to a partition column.
+   */
+  partitionMapping?: PartitionFilterMapping | null;
 }
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndAdhocFilterOption.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndAdhocFilterOption.tsx
index 525b2350496..0b85a1e0e3b 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndAdhocFilterOption.tsx
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndAdhocFilterOption.tsx
@@ -22,6 +22,8 @@ import AdhocFilterPopoverTrigger from 'src/explore/components/controls/FilterCon
 import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter';
 import { OptionSortType } from 'src/explore/types';
 import { useGetTimeRangeLabel } from 'src/explore/components/controls/FilterControl/utils';
+import { isMirroredColumn } from 'src/explore/components/PartitionPruningIndicator';
+import type { PartitionFilterMapping } from '@superset-ui/chart-controls';
 import OptionWrapper from './OptionWrapper';
 import { datasetLabelLower } from 'src/features/semanticLayers/label';
 
@@ -48,6 +50,21 @@ export default function DndAdhocFilterOption({
 }: DndAdhocFilterOptionProps) {
   const { actualTimeRange, title } = useGetTimeRangeLabel(adhocFilter);
 
+  // Note `partitionColumn` above is the unrelated Presto `latest_partition`
+  // feature. This is the dataset's partition filter mapping, carried on the
+  // datasource as a self-contained summary.
+  const partitionMapping = datasource?.partition_filter_mapping as
+    | PartitionFilterMapping
+    | null
+    | undefined;
+  const subject = adhocFilter.subject as
+    | string
+    | { column_name?: string }
+    | null
+    | undefined;
+  const subjectName =
+    typeof subject === 'string' ? subject : subject?.column_name;
+
   return (
     <AdhocFilterPopoverTrigger
       key={index}
@@ -67,6 +84,11 @@ export default function DndAdhocFilterOption({
         type={DndItemType.FilterOption}
         withCaret
         isExtra={adhocFilter.isExtra}
+        partitionMapping={
+          isMirroredColumn(partitionMapping, subjectName)
+            ? partitionMapping
+            : undefined
+        }
         datasourceWarningMessage={
           adhocFilter.datasourceWarning
             ? t(
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/Option.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/Option.tsx
index 21ce7b2d595..80a001d26e4 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/Option.tsx
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/Option.tsx
@@ -27,6 +27,7 @@ import {
   Label,
 } from 'src/explore/components/controls/OptionControls';
 import { OptionProps } from 'src/explore/components/controls/DndColumnSelectControl/types';
+import PartitionPruningIndicator from 'src/explore/components/PartitionPruningIndicator';
 
 const StyledInfoTooltip = styled(InfoTooltip)`
   margin: 0 ${({ theme }) => theme.sizeUnit}px;
@@ -39,6 +40,7 @@ export default function Option({
   withCaret,
   isExtra,
   datasourceWarningMessage,
+  partitionMapping,
   canDelete = true,
   multiValueWarningMessage,
 }: OptionProps) {
@@ -71,6 +73,7 @@ export default function Option({
         </CloseContainer>
       )}
       <Label data-test="control-label">{children}</Label>
+      <PartitionPruningIndicator mapping={partitionMapping} />
       {!!multiValueWarningMessage && (
         <StyledInfoTooltip
           type="warning"
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/OptionWrapper.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/OptionWrapper.tsx
index 70a9e5f3c86..13bfbe0f5ee 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/OptionWrapper.tsx
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/OptionWrapper.tsx
@@ -58,6 +58,7 @@ export default function OptionWrapper(
     canDelete = true,
     tooltipOverlay,
     multiValueWarningMessage,
+    partitionMapping,
     ...rest
   } = props;
   const labelRef = useRef<HTMLDivElement>(null);
@@ -166,6 +167,7 @@ export default function OptionWrapper(
         datasourceWarningMessage={datasourceWarningMessage}
         canDelete={canDelete}
         multiValueWarningMessage={multiValueWarningMessage}
+        partitionMapping={partitionMapping}
       >
         <Label />
       </Option>
diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/types.ts b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/types.ts
index 873bba01ff5..3444cdb7348 100644
--- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/types.ts
+++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/types.ts
@@ -20,6 +20,7 @@ import { ReactNode } from 'react';
 import { AdhocColumn, JsonValue } from '@superset-ui/core';
 import { ControlComponentProps } from 'src/explore/components/Control';
 import { ColumnMeta } from '@superset-ui/chart-controls';
+import type { PartitionFilterMapping } from '@superset-ui/chart-controls';
 
 export interface OptionProps {
   children?: ReactNode;
@@ -34,6 +35,8 @@ export interface OptionProps {
   canDelete?: boolean;
   tooltipOverlay?: ReactNode;
   multiValueWarningMessage?: string;
+  /** Set when this filter's column is mirrored onto a partition column. */
+  partitionMapping?: PartitionFilterMapping | null;
 }
 
 export interface OptionItemInterface {
diff --git a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx
index 1469ef1ac64..70ad31f463d 100644
--- a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx
+++ b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/AdhocFilterOption.test.tsx
@@ -90,3 +90,60 @@ test('should render the Popover on clicking the right caret', async () => {
   userEvent.click(rightCaret);
   expect(screen.getByRole('tooltip')).toBeInTheDocument();
 });
+
+test('a filter on the mapped column carries the partition pruning glyph', () => {
+  // Wireframe 1d: the chart author never configured any of this and only sees
+  // an explanation of why the query got faster.
+  render(
+    setup({
+      ...mockedProps,
+      datasource: {
+        partition_filter_mapping: {
+          partition_column: 'dt_epoch',
+          mapped_column: 'value',
+          active: true,
+        },
+      },
+    }),
+  );
+
+  expect(screen.getByTestId('partition-pruning-indicator')).toBeInTheDocument();
+});
+
+test('a filter on any other column carries no glyph', () => {
+  render(
+    setup({
+      ...mockedProps,
+      datasource: {
+        partition_filter_mapping: {
+          partition_column: 'dt_epoch',
+          mapped_column: 'some_other_column',
+          active: true,
+        },
+      },
+    }),
+  );
+
+  expect(
+    screen.queryByTestId('partition-pruning-indicator'),
+  ).not.toBeInTheDocument();
+});
+
+test('an inactive mapping leaves the chip alone', () => {
+  render(
+    setup({
+      ...mockedProps,
+      datasource: {
+        partition_filter_mapping: {
+          partition_column: 'dt_epoch',
+          mapped_column: 'value',
+          active: false,
+        },
+      },
+    }),
+  );
+
+  expect(
+    screen.queryByTestId('partition-pruning-indicator'),
+  ).not.toBeInTheDocument();
+});
diff --git a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/index.tsx b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/index.tsx
index ca406143ec3..ca58b61d2c5 100644
--- a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/index.tsx
+++ b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterOption/index.tsx
@@ -23,6 +23,8 @@ import AdhocFilterPopoverTrigger from 'src/explore/components/controls/FilterCon
 import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter';
 import { OptionSortType } from 'src/explore/types';
 import { Operators } from 'src/explore/constants';
+import { isMirroredColumn } from 'src/explore/components/PartitionPruningIndicator';
+import type { PartitionFilterMapping } from '@superset-ui/chart-controls';
 import { useGetTimeRangeLabel } from '../utils';
 
 export interface AdhocFilterOptionProps {
@@ -54,6 +56,24 @@ export default function AdhocFilterOption({
 }: AdhocFilterOptionProps) {
   const { actualTimeRange, title } = useGetTimeRangeLabel(adhocFilter);
 
+  // `partitionColumn` above is the unrelated Presto `latest_partition` feature.
+  // This is the dataset's partition filter mapping, which the datasource
+  // carries as a self-contained summary.
+  const partitionMapping = datasource?.partition_filter_mapping as
+    | PartitionFilterMapping
+    | null
+    | undefined;
+  // `subject` is a bare column name for simple filters and a column object
+  // when the filter was built from a dropped column.
+  const subject = adhocFilter.subject as
+    | string
+    | { column_name?: string }
+    | null
+    | undefined;
+  const subjectName =
+    typeof subject === 'string' ? subject : subject?.column_name;
+  const isMirrored = isMirroredColumn(partitionMapping, subjectName);
+
   return (
     <AdhocFilterPopoverTrigger
       sections={sections}
@@ -78,6 +98,7 @@ export default function AdhocFilterOption({
         type={DndItemType.FilterOption}
         withCaret
         isExtra={adhocFilter.isExtra}
+        partitionMapping={isMirrored ? partitionMapping : undefined}
       />
     </AdhocFilterPopoverTrigger>
   );
diff --git a/superset-frontend/src/explore/components/controls/OptionControls/index.tsx b/superset-frontend/src/explore/components/controls/OptionControls/index.tsx
index d8854ae5af2..7ec61df0fe9 100644
--- a/superset-frontend/src/explore/components/controls/OptionControls/index.tsx
+++ b/superset-frontend/src/explore/components/controls/OptionControls/index.tsx
@@ -24,6 +24,8 @@ import { styled, useTheme, css, keyframes } from '@apache-superset/core/theme';
 import { InfoTooltip, Icons, Tooltip } from '@superset-ui/core/components';
 import { savedMetricType } from 'src/explore/components/controls/MetricControl/types';
 import AdhocMetric from 'src/explore/components/controls/MetricControl/AdhocMetric';
+import PartitionPruningIndicator from 'src/explore/components/PartitionPruningIndicator';
+import type { PartitionFilterMapping } from '@superset-ui/chart-controls';
 import { StyledMetricOption } from '../../optionRenderers';
 
 export const DragContainer = styled.div`
@@ -260,6 +262,7 @@ export const OptionControlLabel = ({
   isExtra,
   datasourceWarningMessage,
   tooltipTitle,
+  partitionMapping,
   multi = true,
   ...props
 }: {
@@ -277,6 +280,8 @@ export const OptionControlLabel = ({
   isExtra?: boolean;
   datasourceWarningMessage?: string;
   tooltipTitle?: string;
+  /** Set when this filter's column is mirrored onto a partition column. */
+  partitionMapping?: PartitionFilterMapping | null;
   multi?: boolean;
 }) => {
   const theme = useTheme();
@@ -373,6 +378,7 @@ export const OptionControlLabel = ({
         {isFunction && <Icons.FunctionOutlined iconSize="m" />}
         {getLabelContent()}
       </Label>
+      <PartitionPruningIndicator mapping={partitionMapping} />
       {(!!datasourceWarningMessage || isExtra) && (
         <StyledInfoTooltip
           type="warning"
diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 0eaa702a103..e6985c768f7 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -71,7 +71,10 @@ from superset_core.common.models import Dataset as CoreDataset
 
 from superset import db, is_feature_enabled, security_manager
 from superset.common.db_query_status import QueryStatus
-from superset.connectors.sqla.partition_mapping import resolve_partition_mapping
+from superset.connectors.sqla.partition_mapping import (
+    FEATURE_FLAG as PARTITION_FILTER_MAPPING_FLAG,
+    resolve_partition_mapping,
+)
 from superset.connectors.sqla.utils import (
     get_columns_description,
     get_physical_table_metadata,
@@ -1843,8 +1846,15 @@ class SqlaTable(
         on every chart and dashboard load, so parsing the transform here would
         put a per-request cost on a hot path for a value that only changes on
         save.
+
+        Gated on the feature flag for the same reason `resolve_partition_mapping`
+        is: with the flag off nothing is mirrored, so reporting an active mapping
+        would have the Explore indicator promise a predicate the query never
+        carries.
         """
-        if not self.partition_column:
+        if not self.partition_column or not is_feature_enabled(
+            PARTITION_FILTER_MAPPING_FLAG
+        ):
             return None
 
         columns_by_name = {column.column_name: column for column in self.columns}
diff --git a/tests/unit_tests/datasets/partition_mapping_serialization_test.py b/tests/unit_tests/datasets/partition_mapping_serialization_test.py
index 82c5a5e682b..606696803e0 100644
--- a/tests/unit_tests/datasets/partition_mapping_serialization_test.py
+++ b/tests/unit_tests/datasets/partition_mapping_serialization_test.py
@@ -274,3 +274,22 @@ def test_the_engine_transform_default_is_readable_over_the_api() -> None:
     from superset.datasets.api import DatasetRestApi
 
     assert "partition_value_transform_default" in DatasetRestApi.show_columns
+
+
+def test_the_mapping_summary_is_gated_on_the_feature_flag(app: Flask) -> None:
+    """
+    With the flag off nothing is mirrored, so an "active" summary would have the
+    Explore indicator promise a predicate the query never carries -- worse than
+    showing nothing at all.
+    """
+    table = _table()
+
+    with app.app_context():
+        app.config["DEFAULT_FEATURE_FLAGS"]["PARTITION_FILTER_MAPPING"] = False
+        assert table.partition_filter_mapping_summary is None
+
+        app.config["DEFAULT_FEATURE_FLAGS"]["PARTITION_FILTER_MAPPING"] = True
+        summary = table.partition_filter_mapping_summary
+
+    assert summary is not None
+    assert summary["active"] is True