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 Type Registry

From Leeroopedia


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

Overview

Maps Druid data types to Blueprint.js icon names and display widths for column rendering in the web console.

Description

The Type Registry module provides functions to convert druid-query-toolkit Column objects into display metadata. It resolves the effective column type (preferring nativeType over sqlType for most types), then maps that type string to a Blueprint.js IconName for visual identification and a pixel width for table column sizing. The module covers all standard Druid types including TIMESTAMP, VARCHAR, BIGINT, DOUBLE, ARRAY variants, COMPLEX types (JSON, HyperUnique, HLLSketch, ThetaSketch, quantile sketches, variance, IP address, bloom filters, KLL sketches, compressed BigDecimal, text, and vector), with sensible fallback defaults.

Usage

Used in result table views, column headers, and schema displays throughout the web console to render type-specific icons and appropriately sized columns.

Code Reference

Source Location

Signature

export function columnToSummary(column: Column): string;
export function columnToIcon(column: Column): IconName | undefined;
export function dataTypeToIcon(dataType: string): IconName;
export function columnToWidth(column: Column): number;
export function dataTypeToWidth(dataType: string | undefined): number;

Import

import { columnToIcon, columnToWidth, dataTypeToIcon } from './utils/types';

I/O Contract

Inputs

Name Type Required Description
column Column Yes A druid-query-toolkit Column object with name, sqlType, and nativeType properties
dataType string Yes A Druid type string (e.g., 'VARCHAR', 'BIGINT', 'COMPLEX<JSON>')

Outputs

Name Type Description
(return) IconName A Blueprint.js icon name corresponding to the data type (e.g., IconNames.TIME for TIMESTAMP)
(return) number A pixel width value for rendering table columns (e.g., 180 for TIMESTAMP, 120 for numeric types)
(return) string A multi-line summary string containing name, SQL type, and native type

Usage Examples

Get icon for a column

import { columnToIcon } from './utils/types';

const icon = columnToIcon({ name: '__time', sqlType: 'TIMESTAMP', nativeType: 'LONG' });
// icon === IconNames.TIME

Get width for a data type

import { dataTypeToWidth } from './utils/types';

const width = dataTypeToWidth('COMPLEX<JSON>');
// width === 300

const defaultWidth = dataTypeToWidth('VARCHAR');
// defaultWidth === 150

Generate column summary

import { columnToSummary } from './utils/types';

const summary = columnToSummary({ name: 'count', sqlType: 'BIGINT', nativeType: 'LONG' });
// summary === 'count\nSQL type: BIGINT\nNative type: LONG'

Related Pages

Page Connections

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