Conditional Expression
A composable, parameterized boolean expression used by WHERE / HAVING / ON clauses.
Internally it is a thin wrapper around an immutable SqlNode tree (see com.zxhhyj.storm.sql). The infix operators (eq, and, or, not, gt, like, in, …) build new trees; the actual SQL text and bound arguments are produced on demand by buildFragment (which runs the tree through the Normalizer first, then the Renderer).
Why a tree of nodes instead of a flat list of SqlFragments? See the "AST 是什么" discussion — the tree lets us
emit parens correctly (e.g.
(a OR b) AND cinstead of relying on SQL precedence),fix the
NOT a > 5misparse by always wrapping aNOT's operand,rewrite dialect quirks in one place (
eq null→IS NULL,IN ()→0) instead of special-casing each call site.