true. This makes it useful for pipeline control flow, data quality checks, and conditional execution.
How it works
Each output port contains a condition that must evaluate to a single boolean value (true or false).
The Condition gem evaluates output ports from top to bottom:
- Evaluate the first output condition.
- If the condition evaluates to
true, route the entire input dataset to that output. - Otherwise, evaluate the next output.
- Continue until a condition evaluates to
true. - If no conditions evaluate to
true, route the dataset to the final (default) output.
Only one output receives the input dataset. The Condition gem chooses a single route for the entire dataset; it does not split rows across multiple outputs.
true, later conditions are not evaluated.
Condition requirements
Each condition must return exactly one row containing a boolean value. Conditions that return multiple rows are invalid and cause the pipeline to fail with a scalar subquery error. For example:
Conditions typically use aggregate functions or expressions that evaluate the input dataset as a whole.
Use the Condition gem
- Add a Condition gem to your pipeline from the Custom category.
- Connect an input to the gem.
- Define a condition for each output.
- Click Add Routing Rule or + to add additional outputs.
- Arrange outputs in the order you want them evaluated.
- Connect downstream gems to each output.
Output behavior
Only one output receives the input dataset. All downstream branches still execute, even when they receive zero rows. Outputs that are not selected receive empty dataframes. For example, ifout0 evaluates to true, the pipeline behaves like this:
Downstream transformations should therefore handle empty dataframes.
Some operations, such as aggregations, may still produce output when their input dataframe is empty. For example, a count aggregation can return a single row.
Example: Route based on row count
Assume your pipeline receives 25 rows. Configure the Condition gem as follows:out0:count(*) < 10out1:count(*) < 100out2: default
count(*) < 10evaluates tofalse.count(*) < 100evaluates totrue.
out1.
out0 and out2 still execute but receive empty dataframes.
Example: Invalid condition
Assume the input contains:
The following condition is invalid:
Because the condition returns multiple rows instead of a single boolean value, the Condition gem fails with a scalar subquery error.
To use the Condition gem successfully, each condition must evaluate to exactly one boolean value.
Example use cases
Use the Condition gem when you need to:- Route a pipeline based on dataset size.
- Apply data quality guardrails.
- Trigger different processing paths based on aggregate metrics.
- Implement pipeline control flow.
Limitations
- Conditions are evaluated from top to bottom.
- The first condition that evaluates to
truedetermines the output. - Only one output receives the input dataset.
- Each condition must evaluate to exactly one boolean value.
- Conditions that return multiple rows cause the pipeline to fail.
- Downstream logic must handle empty dataframes.

