opendistro-for-elasticsearch / sql

🔍 Open Distro SQL Plugin
https://opendistro.github.io/for-elasticsearch/features/SQL%20Support.html
Apache License 2.0
620 stars 186 forks source link

Proposal for separating components into sub-modules #257

Closed dai-chen closed 4 years ago

dai-chen commented 4 years ago

Currently all our code is in a single Gradle module at root. As the code base keeps growing, we should consider split major components into different sub-modules to have clear boundary and dependency.

Based on classic compiler and database engine architecture, here is one option:

  1. Front end - query parser: perform syntax and semantic check and generate parse tree (or annotated AST).
  2. Middle end - relational expression: generate relational expression (logical plan) and perform optimization based on relation algebra.
  3. Back end - execution plan: generate and choose optimal execution plan (physical plan) and execute it in ES engine.

Apart from 3 major stages as above, we can also separate utility function into common module. And other candidate modules includes ES domain layer, documentation, benchmark etc.

Reference: https://en.wikipedia.org/wiki/Compiler and project structure in Calcite and CrateDb.

dai-chen commented 4 years ago

Recently we added doctest and correctness folder for doc generation and comparison test. These two along with integration test may be candidates for individual module too.

penghuo commented 4 years ago

Proposed sub-modules