← All nodes
Transformations

Sample

Takes a smaller, representative subset of the rows: a random percentage, a random fixed number, or simply the first or last rows.

When to use it

Use it to spot-check a large load, to build and test a flow quickly on a slice of a million-row file, or to pull an audit sample. For a strict top-N after sorting, Limit / Head-Tail reads more clearly.

In a pipeline

Settings

SettingTypeRequiredDefault or hint
Sample byselect—percent
Percent of rowsnumber—10
Number of rowsnumber—100
Seed (same seed, same rows)number—1

Example

A 50% spot-check of orders

  • Sample by=Random percent
  • Percent of rows=50
  • Seed (same seed, same rows)=1
Orders
OrderAmount
A-10411240
A-1042860
A-1043312.5
A-104495
Two of the four, in their original order
OrderAmount
A-1042860
A-1043312.5

Which rows are drawn depends on the seed; the same seed and the same data always draw the same rows.

Worth knowing

  • Random samples are repeatable: keep the Seed to get the same rows on every run, or change it (or use a variable) for a fresh draw.
  • Sampled rows keep the order they arrived in; add Sort Rows afterwards for a different order.
  • A percentage always keeps at least one row when there is any data, and 100% passes every row through.

Others in Transformations