映射数据流中的筛选转换Filter transformation in mapping data flow

适用于: Azure 数据工厂 Azure Synapse Analytics

筛选转换允许根据条件对行进行筛选。The Filter transforms allows row filtering based upon a condition. 输出流包括与筛选条件匹配的所有行。The output stream includes all rows that matching the filtering condition. 筛选转换类似于 SQL 中的 WHERE 子句。The filter transformation is similar to a WHERE clause in SQL.

ConfigurationConfiguration

使用数据流表达式生成器为筛选条件输入表达式。Use the data flow expression builder to enter an expression for the filter condition. 若要打开表达式生成器,请单击蓝色框。To open the expression builder, click on the blue box. 筛选条件必须为布尔型。The filter condition must be of type boolean. 有关如何创建表达式的详细信息,请参阅表达式生成器文档。For more information on how to create an expression, see the expression builder documentation.

筛选转换Filter transformation

数据流脚本Data flow script

语法Syntax

<incomingStream>
    filter(
        <conditionalExpression>
    ) ~> <filterTransformationName>

示例Example

下面的示例是一个名为 FilterBefore1960 的筛选转换,它接收传入流 CleanDataThe below example is a filter transformation named FilterBefore1960 that takes in incoming stream CleanData. 筛选条件是 year <= 1960 表达式。The filter condition is the expression year <= 1960.

在数据工厂 UX 中,此转换如下图所示:In the Data Factory UX, this transformation looks like the below image:

筛选转换Filter transformation

此转换的数据流脚本位于下面的代码片段中:The data flow script for this transformation is in the snippet below:

CleanData
    filter(
        year <= 1960
    ) ~> FilterBefore1960

后续步骤Next steps

使用选择转换筛选掉列Filter out columns with the select transformation