duql unnamed block entries are named in the parser, and case { } parses to the positional case call
DecisionVerified 30 Sep 2026Holds project: dftracer-utils
Decision. The context, the choice, why, and the options that were turned down.
Context#
duql needed entries in a group, agg, window or pivot block without a name, and a case { c => a, else => d } form. Python builders needed matching forms.
Decision#
- An unnamed block entry is named in the parser from its canonical text: runs of non-alphanumeric characters become one
_, trimmed at the ends. The printer, equality, lowering and builders then need no new tree. case { c => a, else => d }parses to the positional callcase(...). Whenelseis missing, the parser adds a null default, because positionalcaseneeds one.=>is a new FATARROW token.caseis a keyword only before{.- In Python,
Pipe.groupkeeps positional arguments for keys, so onlyPipe.aggtakes unnamed positional aggregates (a Col key and a Col aggregate cannot be told apart).case_takes a list of pairs, because a Col cannot be a dict key.
Why#
Naming in the parser keeps every later stage unchanged. The positional call reuses the existing case lowering.
Rejected options#
Naming the entry in the lowering: it would need changes in the printer, equality, lowering and builders.
Also found by searching
- duql group block entry without a name, what column name does it get
- I wrote an unnamed aggregate in a duql agg block and want to know its output name
- how do I write a case expression with case { cond => a, else => b } in duql
- duql FATARROW case block parses to positional case(...) with null default when else missing
- duql group block entry without a name, how is it named
- duql case { c => a, else => d } syntax, what happens without else
- parser error on => token in duql, FATARROW, positional case call
- how do I write unnamed entries in agg, window or pivot blocks in duql and python builders