Implementation:Apache Druid StringMenuItems
| Knowledge Sources | |
|---|---|
| Domains | Web_Console, Query_Workbench |
| Last Updated | 2026-02-10 10:00 GMT |
Overview
StringMenuItems is a React component that renders context menu items for string columns in the workbench column tree.
Description
The component provides context menu operations specific to string-typed columns in the SQL workbench schema browser. It supports filter operations (IS NOT NULL, equals, LIKE, REGEXP_LIKE), group by expressions (raw, SUBSTRING, REGEXP_EXTRACT), aggregation functions (COUNT DISTINCT, filtered COUNT, ANY_VALUE, LATEST), and join operations (LEFT JOIN and INNER JOIN) for lookup schema tables. Each action modifies the current SQL query via the druid-query-toolkit API.
Usage
Used within the column tree context menu when the user right-clicks on a string column. For columns in the lookup schema, additional join and remove-join menu items are rendered.
Code Reference
Source Location
- Repository: Apache Druid
- File: web-console/src/views/workbench-view/column-tree/column-tree-menu/string-menu-items/string-menu-items.tsx
- Lines: 1-232
Signature
export interface StringMenuItemsProps {
schema: string;
table: string;
columnName: string;
parsedQuery: SqlQuery;
onQueryChange: (query: SqlQuery, run?: boolean) => void;
}
export const StringMenuItems = React.memo(function StringMenuItems(props: StringMenuItemsProps): JSX.Element;
Import
import { StringMenuItems } from 'web-console/src/views/workbench-view/column-tree/column-tree-menu/string-menu-items/string-menu-items';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| schema | string | Yes | The schema name (enables join menu when 'lookup') |
| table | string | Yes | The table name the column belongs to |
| columnName | string | Yes | The name of the string 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, Aggregate, Join, and Remove join menu items |
Usage Examples
<StringMenuItems
schema="lookup"
table="my_lookup"
columnName="city_name"
parsedQuery={currentParsedQuery}
onQueryChange={(newQuery, shouldRun) => {
setQuery(newQuery);
if (shouldRun) runQuery();
}}
/>