Filter
The Filter processor passes rows that match the filter condition to downstream stages. Rows that do not match the filter condition are removed from the pipeline.
Use the Filter processor to remove unwanted rows from the pipeline. To route data to separate downstream branches based on different conditions, use the Stream Selector processor.
When you configure the Filter processor, you specify the filter condition to use.
Filter Condition
The filter condition determines the data that passes downstream. The filter condition must evaluate to true or false. Rows that evaluate to true pass to the rest of the pipeline.
You can use a condition as simple as AccountID is NOT NULL
or you can
create as complex a condition as needed.
Here are some guidelines for filter conditions:
- When you define a condition, you typically base it on column values in the row.
For information about referencing columns in the condition, see Referencing Columns in Snowflake SQL Expressions.
- You can use any syntax that can be used in the WHERE clause of a query,
including functions such as
isnull
ortrim
and operators such as=
or<=
.For more information about the WHERE clause, see the Snowflake documentation.
- Do not include WHERE in the condition.
-
You can also use user-defined functions (UDFs) in the condition.
year(transaction_date) >= 2000
Sample Conditions
The following table lists some common scenarios that you might adapt for your use:Condition Example | Description |
---|---|
total > 0 |
If the value in the total column is greater
than 0, the row passes downstream. If not, the row is
dropped from the pipeline. |
total <= 0 |
If the value in the total column is less than
or equal to 0, the row passes downstream. If not, the row
is dropped from the pipeline. |
accountId is NOT NULL |
If the row has a value in the accountId
column, the row passes downstream. If the column contains a
null value, the row is dropped from the pipeline.Note that
|
upper(message) like '%ERROR%' |
If the message column contains the string,
ERROR , the row passes downstream. If
not, the row is dropped from the pipeline.The condition
changes the strings in the |
initcap(country) like 'China' OR initcap(country)
like 'Japan' |
If the value in the country column is
China or Japan , the row
passes downstream. If not, the row is dropped from the
pipeline.The condition changes the strings in the
|
Configuring a Filter Processor
Configure a Filter processor to allow only the rows that match a specified condition to pass downstream.
-
On the General tab, configure the following
properties:
General Property Description Name Stage name. Description Optional description. Cache Data Caches processed data. - On the Filter tab, specify the filter condition to use.