This module contains the Frontend (FE) logical type system. It defines the full set of SQL-visible types and related helpers used by the analyzer, optimizer, catalog, and planner.
- Define the type hierarchy in
com.starrocks.type:- Core:
Type,ScalarType,PrimitiveType - Complex:
ArrayType,MapType,StructType,StructField,JsonType - String and binary:
CharType,VarcharType,StringType,VarbinaryType - Numerics and date/time:
IntegerType,FloatType,DecimalType,DateType - Special/aggregate:
BitmapType,HLLType,PercentileType,FunctionType,VariantType,AggStateDesc - Wildcards and helpers:
Any*types,ComplexTypeAccessPath,ComplexTypeAccessPathType
- Core:
- Keep this module free of FE business logic; it is a pure model layer used across FE.
- Construction entry points live in
fe/fe-coreviaTypeFactory(e.g.,TypeFactory.createCharType,createUnifiedDecimalType,createDecimalV3Type, etc.). - Analyzer, optimizer, catalog, and planner consume
com.starrocks.type.*from this module. - Connectors/plugins should not expose FE types over SPI; avoid leaking
com.starrocks.type.*across SPI boundaries.
- Decimal V2 vs V3 is selected by configuration (
Config.enable_decimal_v3). - Large precision handling may fall back to
DOUBLEor cap toDECIMAL256based on session variables (seeTypeFactory).
- Prefer factory methods in FE core:
TypeFactory.createCharType(10)TypeFactory.createVarcharType(255)TypeFactory.createUnifiedDecimalType(10, 2)new ArrayType(TypeFactory.createVarcharType(100))
- Do not add FE-specific behavior or I/O here; keep types immutable except for well-scoped, package-private setters used by
TypeFactory. - Respect
Type.MAX_NESTING_DEPTHto avoid pathological structures.
- FE overview:
fe/README.md - FE core factory:
fe/fe-core/src/main/java/com/starrocks/type/TypeFactory.java - Package:
com.starrocks.type