Implementation:Apache Druid NumberMenuItems
| Knowledge Sources | |
|---|---|
| Domains | Web_Console, Query_Workbench |
| Last Updated | 2026-02-10 10:00 GMT |
Overview
NumberMenuItems is a React component that renders context menu items for numeric columns in the workbench column tree.
Description
The component provides a set of menu items specifically tailored for numeric column operations within the SQL query workbench. It offers filter operations (greater than / less than or equal to 9000), group by options (raw and truncated), and aggregate functions (SUM, MIN, MAX, AVG, COUNT DISTINCT, APPROX_QUANTILE, LATEST). Each menu action programmatically modifies the current parsed SQL query and triggers the onQueryChange callback.
Usage
Used within the column tree context menu when the user right-clicks on a numeric column in the workbench view's schema browser. The component is rendered as a set of BlueprintJS MenuItem elements that modify the active SQL query.
Code Reference
Source Location
- Repository: Apache Druid
- File: web-console/src/views/workbench-view/column-tree/column-tree-menu/number-menu-items/number-menu-items.tsx
- Lines: 1-158
Signature
export interface NumberMenuItemsProps {
table: string;
schema: string;
columnName: string;
parsedQuery: SqlQuery;
onQueryChange: (query: SqlQuery, run?: boolean) => void;
}
export const NumberMenuItems = React.memo(function NumberMenuItems(props: NumberMenuItemsProps): JSX.Element;
Import
import { NumberMenuItems } from 'web-console/src/views/workbench-view/column-tree/column-tree-menu/number-menu-items/number-menu-items';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| table | string | Yes | The table name the column belongs to |
| schema | string | Yes | The schema name the column belongs to |
| columnName | string | Yes | The name of the numeric column |
| parsedQuery | SqlQuery | Yes | The current parsed SQL query to modify |
| onQueryChange | (query: SqlQuery, run?: boolean) => void | Yes | Callback invoked when a menu item modifies the query |
Outputs
| Name | Type | Description |
|---|---|---|
| JSX.Element | React Fragment | A fragment containing Filter, Remove filter, Group by, Remove group by, and Aggregate menu items |
Usage Examples
<NumberMenuItems
table="my_table"
schema="druid"
columnName="revenue"
parsedQuery={currentParsedQuery}
onQueryChange={(newQuery, shouldRun) => {
setQuery(newQuery);
if (shouldRun) runQuery();
}}
/>