Reputation: 59
I try to filter rows of a dataset using variables like so :
Dataset<Row> dataset = dF.select(dF.col("*")).filter(col(list.get(0)) == lit(list.get(1))));
But i get a compilation error :
Cannot resolve filter(boolean)
What's the solution to this ?
Upvotes: 1
Views: 38
Reputation: 5078
Filter takes column instead of boolean as parameter. So to compare columns you should use equalTo
method that will return a column instead of ==
:
Dataset<Row> dataset = dF.select(dF.col("*")).filter(col(list.get(0)).equalTo(lit(list.get(1)))));
Upvotes: 1