Skip to content

refactor: rename PromQL-specific QueryExpr nodes (and Merge/Distinct/WindowFunc/EvalTime) for clarity - #226

Merged
zzylol merged 2 commits into
mainfrom
rename/query-expr-clarity
Aug 22, 2026
Merged

zzylol merged 2 commits into
mainfrom
rename/query-expr-clarity

Conversation

@zzylol

@zzylol zzylol commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Applies the rename table agreed in #183: renames several QueryExpr variants (and two operator-kind types) whose names don't signal what they are or which language they're for, once you're not the person who just wrote them.

Old New
Distinct Dedup
Merge (+ QueryExprError::EmptyMerge) Concat (+ EmptyConcat)
WindowFunc SQLWindowFunc
Scalar PromqlScalar
VectorFromScalar / ScalarFromVector PromqlVectorFromScalar / PromqlScalarFromVector
Relabel PromqlRelabel
InfoJoin PromqlInfoEnrich
Sample PromqlSeriesSample
Subquery PromqlSubquery
Arith (both QueryExpr::Arith and BinaryOpKind::Arith) Arithmetic
ArithOp / CompareOp (types) ArithmeticOpKind / CompareOpKind
EvalTime QueryTimestamp (per the issue author's follow-up comment, not the originally proposed TimeNow)
Compare unchanged

Pure mechanical rename plus matching doc-comment/prose updates (including docs/pre-asap-ir.md's "PromQL-specific nodes" section) — no behavior change.

Two judgment calls made along the way, called out for review:

  • BinaryOpKind::Arith was renamed alongside QueryExpr::Arith even though the approved table only said "Arith (variant)" without disambiguating — the two are cross-referenced in each other's doc comments as the same concept.
  • QueryExprError::EmptyMergeEmptyConcat wasn't explicitly in the table but is the error variant for the renamed Merge/Concat node.

DataFusion's own like-named types (LogicalPlan::Distinct, Distinct::On/Distinct::All, Expr::Subquery) and a few unrelated same-named symbols elsewhere in the codebase (SummaryFamilyType::Sample, Implementation::Sample) were deliberately left untouched.

Test plan

  • cargo build --workspace --all-targets
  • cargo test --workspace

Closes #183

🤖 Generated with Claude Code

zzylol and others added 2 commits August 22, 2026 14:07
…ames

Renames several QueryExpr variants (and two operator-kind types) whose
names don't signal what they are or which language they're for:

- Scalar, EvalTime, VectorFromScalar, ScalarFromVector, Relabel,
  InfoJoin, Sample, Subquery -> Promql*-prefixed or renamed, since
  nothing in the old names marked them PromQL-only
- Distinct -> Dedup (collided with AggIntent::Cardinality's
  COUNT(DISTINCT ...) in conversation/review)
- Merge -> Concat, plus QueryExprError::EmptyMerge -> EmptyConcat
  (collided conceptually with SQL JOIN / merge-join)
- WindowFunc -> SQLWindowFunc (one character from the reserved,
  unimplemented streaming Window node)
- Arith -> Arithmetic (QueryExpr::Arith and BinaryOpKind::Arith, the
  same concept in two places)
- ArithOp -> ArithmeticOpKind, CompareOp -> CompareOpKind, matching
  the codebase's existing Kind-suffix convention for these enums
- EvalTime -> QueryTimestamp specifically (not TimeNow, which reads as
  a different meaning than what EvalTime denoted)

Compare is left unchanged. Pure rename; no behavior change.

Closes #183

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@zzylol zzylol changed the title Rename PromQL-specific QueryExpr nodes (and Merge/Distinct/WindowFunc/EvalTime) for clarity refactor: rename PromQL-specific QueryExpr nodes (and Merge/Distinct/WindowFunc/EvalTime) for clarity Aug 22, 2026
@zzylol
zzylol merged commit c39b357 into main Aug 22, 2026
4 checks passed
@zzylol
zzylol deleted the rename/query-expr-clarity branch August 22, 2026 20:25
zzylol added a commit that referenced this pull request Aug 22, 2026
…og (#225)

Rebased onto main now that #227 (the catalog crate + generalized
ClickHouse-builtin mechanism) and #226 (the QueryExpr rename) have
landed there — this PR's own content is unchanged, just reapplied
cleanly on top of current main instead of the now-deleted
feat/sql-function-catalog-225 branch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
zzylol added a commit that referenced this pull request Aug 22, 2026
Rebased onto main now that #226 (the QueryExpr rename) and #227 (the
SQL function catalog) have landed there. This PR's own design and
content are unchanged; adapted the new cse.rs module's exhaustive
QueryExpr match to the current post-rename variant names (Merge ->
Concat, Distinct -> Dedup, Scalar -> PromqlScalar, EvalTime ->
QueryTimestamp, WindowFunc -> SQLWindowFunc, Arith -> Arithmetic,
VectorFromScalar/ScalarFromVector/Relabel/InfoJoin/Sample/Subquery ->
their Promql*-prefixed names, ArithOp/CompareOp -> ArithmeticOpKind/
CompareOpKind) and reapplied mod.rs's doc/pub-use additions around the
renamed expr_ir re-export.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
zzylol added a commit that referenced this pull request Aug 22, 2026
#235)

Rebased onto main now that #226 (the QueryExpr rename) and #227 (the
SQL function catalog) have landed there. This PR's own design and
content are unchanged; adapted the new cse.rs module's exhaustive
QueryExpr match to the current post-rename variant names (Merge ->
Concat, Distinct -> Dedup, Scalar -> PromqlScalar, EvalTime ->
QueryTimestamp, WindowFunc -> SQLWindowFunc, Arith -> Arithmetic,
VectorFromScalar/ScalarFromVector/Relabel/InfoJoin/Sample/Subquery ->
their Promql*-prefixed names, ArithOp/CompareOp -> ArithmeticOpKind/
CompareOpKind) and reapplied mod.rs's doc/pub-use additions around the
renamed expr_ir re-export.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
zzylol added a commit that referenced this pull request Aug 22, 2026
…og (#225) (#233)

Rebased onto main now that #227 (the catalog crate + generalized
ClickHouse-builtin mechanism) and #226 (the QueryExpr rename) have
landed there — this PR's own content is unchanged, just reapplied
cleanly on top of current main instead of the now-deleted
feat/sql-function-catalog-225 branch.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename PromQL-specific QueryExpr nodes (and Merge/Distinct/WindowFunc/EvalTime) for clarity

1 participant