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 Paimon DataTypeFamily

From Leeroopedia
Revision as of 14:20, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Apache_Paimon_DataTypeFamily.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources
Domains Type System, Type Classification
Last Updated 2026-02-08 00:00 GMT

Overview

DataTypeFamily is an enumeration that clusters DataTypeRoot entries into logical categories for type family classification.

Description

DataTypeFamily is a public enum that provides a hierarchical categorization system for data types in Apache Paimon. Rather than working with individual type roots, this enumeration allows grouping related types into families such as NUMERIC, CHARACTER_STRING, DATETIME, and COLLECTION. This classification system closely follows the SQL standard in terms of naming and structure while including some Paimon-specific extensions marked as EXTENSION.

The enum defines 14 distinct families: PREDEFINED (basic SQL types), CONSTRUCTED (complex types built from other types), CHARACTER_STRING (text types), BINARY_STRING (binary data), NUMERIC (all numbers), INTEGER_NUMERIC (whole numbers), EXACT_NUMERIC (precise numbers including integers and decimals), APPROXIMATE_NUMERIC (floating-point), DATETIME (temporal types), TIME (time without date), TIMESTAMP (point in time types), COLLECTION (arrays, multisets, vectors), and EXTENSION (Paimon-specific additions).

The family system enables type checking at a higher level of abstraction than individual type roots. For example, instead of checking if a type is INT, BIGINT, TINYINT, or SMALLINT, code can check if it belongs to the INTEGER_NUMERIC family. This makes type validation and compatibility checking more maintainable and expressive. Available since version 0.4.0 and marked as @Public API.

Usage

Use DataTypeFamily when implementing type compatibility checks, validation rules, or processing logic that should apply to groups of related types rather than individual types. It is particularly useful for implementing SQL semantics where operations are defined for entire type families like numeric or string types.

Code Reference

Source Location

Signature

@Public
public enum DataTypeFamily {
    PREDEFINED,
    CONSTRUCTED,
    CHARACTER_STRING,
    BINARY_STRING,
    NUMERIC,
    INTEGER_NUMERIC,
    EXACT_NUMERIC,
    APPROXIMATE_NUMERIC,
    DATETIME,
    TIME,
    TIMESTAMP,
    COLLECTION,
    EXTENSION
}

Import

import org.apache.paimon.types.DataTypeFamily;

I/O Contract

Inputs

Name Type Required Description
Family constant DataTypeFamily Yes One of the predefined family enum values

Outputs

Name Type Description
Family enum DataTypeFamily The family classification for use in type checks

Usage Examples

// Check if a type belongs to a family
DataType intType = DataTypes.INT();
boolean isNumeric = intType.is(DataTypeFamily.NUMERIC); // true
boolean isInteger = intType.is(DataTypeFamily.INTEGER_NUMERIC); // true
boolean isString = intType.is(DataTypeFamily.CHARACTER_STRING); // false

// Check against multiple families
DataType decimalType = DataTypes.DECIMAL(10, 2);
boolean isNumericType = decimalType.isAnyOf(
    DataTypeFamily.NUMERIC,
    DataTypeFamily.CHARACTER_STRING
); // true (matches NUMERIC)

// String types
DataType varchar = DataTypes.STRING();
boolean isCharString = varchar.is(DataTypeFamily.CHARACTER_STRING); // true
boolean isPredefined = varchar.is(DataTypeFamily.PREDEFINED); // true

// Collection types
DataType array = DataTypes.ARRAY(DataTypes.INT());
boolean isCollection = array.is(DataTypeFamily.COLLECTION); // true
boolean isConstructed = array.is(DataTypeFamily.CONSTRUCTED); // true

// Temporal types
DataType timestamp = DataTypes.TIMESTAMP();
boolean isDateTime = timestamp.is(DataTypeFamily.DATETIME); // true
boolean isTimestampFamily = timestamp.is(DataTypeFamily.TIMESTAMP); // true

// Using in validation logic
public boolean canPerformArithmetic(DataType type) {
    return type.is(DataTypeFamily.NUMERIC);
}

public boolean canConcat(DataType type) {
    return type.is(DataTypeFamily.CHARACTER_STRING);
}

// Generic type family checking
public void processType(DataType type) {
    if (type.is(DataTypeFamily.NUMERIC)) {
        System.out.println("Processing numeric type");
    } else if (type.is(DataTypeFamily.CHARACTER_STRING)) {
        System.out.println("Processing string type");
    } else if (type.is(DataTypeFamily.COLLECTION)) {
        System.out.println("Processing collection type");
    }
}

Related Pages

Page Connections

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