Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tonivade committed Dec 5, 2024
1 parent 5ecce4e commit 9a7e4a2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/pq/FilterParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ final class FilterParser extends GrammarDefinition {

private static final Parser FALSE = StringParser.of("false");
private static final Parser TRUE = StringParser.of("true");
private static final Parser NULL = StringParser.of("null").map(x -> null);
private static final Parser NULL = StringParser.of("null").map(_ -> null);

private static final Parser ID = letter().seq(word().or(UNDERSCORE).or(DOT).star()).flatten();

Expand Down Expand Up @@ -180,16 +180,16 @@ yield switch (columnDescription.getPrimitiveType().getPrimitiveTypeName()) {
case Expression(var left, var operator, var right) ->
new TypedExpression(left.apply(schema), operator, right.apply(schema));
case NotExpression(var inner) -> new TypedNotExpression(inner.apply(schema));
case NullExpression ignore -> new TypedNullExpression();
case NullExpression _ -> new TypedNullExpression();
};
}

default Set<String> columns() {
return switch(this) {
case Condition(var column, var operator, var value) -> Set.of(column);
case Expression(var left, var operator, var right) -> merge(left.columns(), right.columns());
case Condition(var column, var _, var _) -> Set.of(column);
case Expression(var left, var _, var right) -> merge(left.columns(), right.columns());
case NotExpression(var inner) -> inner.columns();
case NullExpression ignore -> Set.of();
case NullExpression _ -> Set.of();
};
}

Expand Down Expand Up @@ -269,7 +269,7 @@ case TypedExpression(var left, var operator, var right) ->
case OR -> or(left.convert(), right.convert());
};
case TypedNotExpression(var inner) -> FilterApi.not(inner.convert());
case TypedNullExpression ignore -> null;
case TypedNullExpression _ -> null;
};
}
}
Expand Down

0 comments on commit 9a7e4a2

Please sign in to comment.