filter
Syntax
result = filter rows by predicate;
Usage
A predicate is a Boolean expression that uses comparison or logical operators. The predicate is evaluated for every row. If the predicate is true, the row is included in the result. Comparisons on dimensions are lexicographic, and comparisons on measures are numerical.
When a filter is applied to grouped data, the filter is applied to the rows in the group. If all member rows are filtered out, groups are eliminated. You can run a filter statement before or after group to filter out members of the groups.
Example
The following example returns only rows where the origin is ORD, LAX, or LGA:
a1 = filter a by origin in ["ORD", "LAX", "LGA"];
Example
The following example returns only rows where the destination is LAX or the number of miles is greater than 1,500:
y = filter x by dest == "LAX" || miles > 1500;
Example
a = load "0Fbxx000000002qCAA/0Fcxx000000002WCAQ";
a = filter a by Year in [];
c = group a by ('Year', 'Name');
d = foreach c generate 'Name' as 'group::AName', 'Year' as 'group::Year', sum(accounts::Revenue) as 'sRev';