Ray's Knowledge Base
Unlock

Expand duql macros before lowering

DecisionVerified 30 Sep 2026Holds project: dftracer-utils
Decision. The context, the choice, why, and the options that were turned down.

Context#

Macro definitions must work with later planning and pushdown steps.

Decision#

Expand def macros as a syntax-tree rewrite in duql/macros.{h,cpp} before lowering.

Why#

Every later step sees the expanded tree and needs no macro-specific logic. Observer inbox 5f2574cd39 records this design.

Rejected options#

Expansion during lowering would leave earlier consumers needing macro knowledge.

Also found by searching

  • duql def macro not seen by pushdown or planning steps
  • where should user-defined query macros be expanded in the duql pipeline
  • how do I implement def macros so later lowering needs no macro logic
  • macro expansion as syntax tree rewrite before lowering vs during lowering
  • where in the duql pipeline should def macros be expanded?
  • how are macro definitions handled so pushdown and planning see them?
  • should macro expansion happen at lowering or earlier as a syntax tree rewrite?
  • duql macros.h macros.cpp expansion before lowering design decision