public static class AggregateArgs.Apply extends Object implements AggregateArgs.PipelineOperation
Applies a 1-to-1 transformation on one or more properties and either stores the result as a new property down the pipeline or replaces any property using this transformation. APPLY can perform arithmetic operations on numeric properties or apply functions depending on property types.
{
@code
// Calculate total value from price and quantity
Apply totalValue = new Apply("@price * @quantity", "total_value");
// Mathematical operations
Apply discount = new Apply("@price * 0.9", "discounted_price");
// String operations
Apply fullName = new Apply("@first_name + ' ' + @last_name", "full_name");
// Date operations
Apply dayOfWeek = new Apply("day(@timestamp)", "day");
}
The expression is evaluated dynamically for each record in the pipeline and the result is stored as a new property that can be referenced by further operations.
| Modifier and Type | Method and Description |
|---|---|
void |
build(CommandArgs<?,?> args)
Build the operation arguments into the command args.
|
static AggregateArgs.Apply |
of(String expression,
String name)
Static factory method to create an Apply instance with a single name and expression pair.
|
public void build(CommandArgs<?,?> args)
AggregateArgs.PipelineOperationbuild in interface AggregateArgs.PipelineOperationargs - the command args to build intopublic static AggregateArgs.Apply of(String expression, String name)
name - the name of the expressionexpression - the expression to applyCopyright © 2026 lettuce.io. All rights reserved.