Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Apache Druid TimeMenuItems

From Leeroopedia


Knowledge Sources
Domains Web_Console, Query_Workbench
Last Updated 2026-02-10 10:00 GMT

Overview

TimeMenuItems is a React component that renders context menu items for timestamp columns in the workbench column tree.

Description

The component provides time-specific context menu operations for timestamp columns in the SQL workbench schema browser. It supports relative time filters (latest hour, day, week, month, year), absolute time range filters (current hour, day, month, year), group by time floor operations (by hour, day, month, year), group by time extract operations (hour of, day of, month of, year of), and aggregate functions (MAX, MIN). Predefined SQL expression templates are used with the chronoshift library for UTC-based time boundary calculations.

Usage

Used within the column tree context menu when the user right-clicks on a timestamp column in the workbench view's schema browser. Time filter expressions use CURRENT_TIMESTAMP and INTERVAL syntax for relative filters, and explicit BETWEEN-style bounds for absolute period filters.

Code Reference

Source Location

Signature

export interface TimeMenuItemsProps {
  table: string;
  schema: string;
  columnName: string;
  parsedQuery: SqlQuery;
  onQueryChange: (query: SqlQuery, run?: boolean) => void;
}

export const TimeMenuItems = React.memo(function TimeMenuItems(props: TimeMenuItemsProps): JSX.Element;

Import

import { TimeMenuItems } from 'web-console/src/views/workbench-view/column-tree/column-tree-menu/time-menu-items/time-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 timestamp 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 (relative and absolute), Remove filter, Group by (TIME_FLOOR and TIME_EXTRACT), Remove group by, and Aggregate menu items

Usage Examples

Rendering time menu items for __time column

<TimeMenuItems
  table="wikipedia"
  schema="druid"
  columnName="__time"
  parsedQuery={currentParsedQuery}
  onQueryChange={(newQuery, shouldRun) => {
    setQuery(newQuery);
    if (shouldRun) runQuery();
  }}
/>

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment