starrocks/fe
SevenJ ffa6a5f504
[Enhancement] revise some hive catalog cache code (#63459)
Signed-off-by: SevenJ <wenjun7j@gmail.com>
2025-09-24 12:29:46 +00:00
..
connector [Refactor] Make the FE codebase more modular and maintainable with multi module (#62220) 2025-08-22 17:54:20 +08:00
fe-core [Enhancement] revise some hive catalog cache code (#63459) 2025-09-24 12:29:46 +00:00
fe-grammar [Enhancement] Implement grant and revoke role functionality for external groups (#63258) 2025-09-22 14:56:37 +08:00
fe-parser [Enhancement] Implement grant and revoke role functionality for external groups (#63258) 2025-09-22 14:56:37 +08:00
fe-server [Refactor] Refactors the Frontend (FE) module structure versioning management (#63086) 2025-09-16 10:42:43 +08:00
fe-spi [Refactor] Refactors the Frontend (FE) module structure versioning management (#63086) 2025-09-16 10:42:43 +08:00
fe-testing [Refactor] Refactors the Frontend (FE) module structure versioning management (#63086) 2025-09-16 10:42:43 +08:00
fe-utils [Refactor] Refactors the Frontend (FE) module structure versioning management (#63086) 2025-09-16 10:42:43 +08:00
gradle/wrapper [Tool] Add Gradle wrapper files for build configuration (#62656) 2025-09-03 10:53:50 +08:00
plugin [Refactor] Refactors the Frontend (FE) module structure versioning management (#63086) 2025-09-16 10:42:43 +08:00
.cursorrules [Refactor] Make the FE codebase more modular and maintainable with multi module (#62220) 2025-08-22 17:54:20 +08:00
.gitignore [Enhancement] FlatJSON-V2: part fe (#61598) 2025-08-07 14:22:43 +08:00
README [Refactor] Make the FE codebase more modular and maintainable with multi module (#62220) 2025-08-22 17:54:20 +08:00
README.md [Refactor] Introducing a new fe-grammar module to removing ANTLR plugin and dependencies (#62239) 2025-08-25 09:41:26 +08:00
build.gradle.kts [BugFix] Fix the bug where UserProperty priority is lower than Session Variable (#63173) 2025-09-17 11:33:53 +08:00
checkstyle-apache-header.txt
checkstyle.xml [Tool] Update Checkstyle configuration and dependencies in gradle (#62778) 2025-09-08 18:12:19 +08:00
gradle.properties [Enhancement] Add gradle build for FE (#60933) 2025-07-24 11:30:37 +08:00
gradlew [Tool] Add Gradle wrapper files for build configuration (#62656) 2025-09-03 10:53:50 +08:00
gradlew.bat [Tool] Add Gradle wrapper files for build configuration (#62656) 2025-09-03 10:53:50 +08:00
pom.xml [BugFix] update staros to v3.5-rc4 (#63398) 2025-09-24 04:41:22 +00:00
settings.gradle.kts [Refactor] Refactors the Frontend (FE) module structure versioning management (#63086) 2025-09-16 10:42:43 +08:00
starrocks_intellij_style.xml

README.md

StarRocks Frontend (FE) Overview

The Frontend (FE) is the Java layer of StarRocks that provides the SQL interface and cluster coordination. It parses and validates SQL, builds optimized query plans, manages metadata, and coordinates execution with the Backend (BE).

Key responsibilities

  • SQL parsing and AST construction
  • Semantic analysis and validation
  • Cost-based optimization and plan generation
  • Metadata/catalog management and statistics
  • Session management, authentication, and authorization
  • Scheduling and coordination of query execution with BEs

Directory layout (high level)

  • fe-core/
    • src/main/java/com/starrocks/
      • sql/ — Analyzer and optimizer
      • planner/ — Plan fragments and physical planning
      • catalog/ — Metadata (databases, tables, partitions, statistics)
      • qe/ — Query execution coordination and session management
      • privilege/ — Authentication and authorization
      • scheduler/, load/, backup/ — Scheduling, data loading, backup/restore
  • fe/fe-grammar/ — ANTLR grammars (.g4) for StarRocks SQL
  • fe/fe-parser/ — StarRocks SQL parser and full AST definitions
  • fe/fe-spi/ — FE Service Provider Interfaces (contracts for connectors/plugins)
  • fe/connector/ — Data source connector implementations and FE-side integration
  • fe/plugin/ — Plugin implementations extending FE core capabilities (non-data-source)
  • fe/fe-utils/ — FE utilities and base libraries (no business logic)
  • fe/fe-testing/ — Shared test utilities, fixtures, and mock implementations

Related:

  • be/ — C++ Backend engine (execution and storage)

Extensibility overview

  • Syntax/AST:
    • Extend SQL grammar in fe/fe-grammar/ (ANTLR .g4 files).
    • Parser and AST live in fe/fe-parser/ (package com.starrocks.sql.parser and com.starrocks.sql.ast).
    • Follow AST conventions: include source positions; keep nodes immutable; push semantics to analyzer.
    • Update analyzer/optimizer and add tests.
  • Connectors (data sources):
    • Implement FE SPI in a dedicated module; provide discovery metadata (e.g., ServiceLoader or plugin manifest).
    • Register catalogs and handle metadata/scan capabilities.
  • Plugins (core extensions):
    • Implement FE SPI to extend authentication, authorization, auditing, observability, governance, etc.
    • Examples: Ranger-based authorization, LDAP/Kerberos authentication.

Development guidelines

  • AST immutability:
    • Do not add setter methods to AST nodes; do not use AST as temporary storage between Parser and Analyzer; keep the AST immutable.
  • Utilities:
    • fe/fe-utils/ contains general-purpose helpers only; no business logic or FE internals.
  • SPI boundaries:
    • Keep connectors/plugins decoupled from FE internals; depend only on fe/fe-spi/.
  • Performance and correctness:
    • Prefer unambiguous grammar; avoid heavy work in the parser; push semantic checks to analyzer.
  • Security:
    • Validate inputs; avoid leaking secrets/PII in logs; honor FE authN/authZ policies.

Testing

  • Unit tests for FE modules: fe/fe-'xxx'/src/test/
  • Shared testing helpers and mocks: fe/fe-testing/
  • Add positive/negative/edge cases for new syntax, SPI implementations, and security paths.

Critical notes

  • Build system is heavy. Avoid running full builds or UT unless necessary.
  • Prefer targeted changes and module-level verification.

References

  • Grammar: fe/fe-grammar/
  • Parser and AST: fe/fe-parser/
  • SPI contracts: fe/fe-spi/
  • Connectors: fe/connector/
  • Plugins: fe/plugin/
  • Utilities: fe/fe-utils/
  • Testing: fe/fe-testing/
  • Docs: https://docs.starrocks.io/