dup
Input Stack: |
⇨ |
Output Stack: |
Duplicates the item on the top of the stack, pushing a copy of it onto the stack. This is commonly
used when you need to apply multiple operations to the same value or expression.
Parameters
- item: Any value or expression that will be duplicated
Examples
Basic duplication of a time expression:
Common pattern for applying multiple aggregations to the same query:
Before | After |
 |  |
name,sps,:eq,
:sum
| name,sps,:eq,
:dup,
:sum,
:swap,
:count,
:div
|
- :over - Copy the second item to the top
- :swap - Exchange the top two stack items
- :tuck - Copy the top item to the third position