diff --git a/cpp/include/gar/utils/expression.h b/cpp/include/gar/utils/expression.h index cbe638bb4..dff9be54d 100644 --- a/cpp/include/gar/utils/expression.h +++ b/cpp/include/gar/utils/expression.h @@ -278,21 +278,53 @@ inline Expression* Expression::Make(const Property& p1, const Property& p2) { return new OpType(new ExpressionProperty(p1), new ExpressionProperty(p2)); } -static inline Expression* Not(Expression* expr) { +static inline Expression* _Property(const Property& property) { + return new ExpressionProperty(property); +} + +static inline Expression* _Property(const std::string& name) { + return new ExpressionProperty(Property(name)); +} + +template +static inline Expression* _Literal(T value) { + return new ExpressionLiteral(value); +} + +static inline Expression* _Not(Expression* expr) { return new OperatorNot(expr); } -static inline Expression* IsNull(Expression* expr, bool nan_is_null = false) { +static inline Expression* _IsNull(Expression* expr, bool nan_is_null = false) { return new OperatorIsNull(expr, nan_is_null); } -static inline Expression* And(Expression* lhs, Expression* rhs) { +static inline Expression* _And(Expression* lhs, Expression* rhs) { return new OperatorAnd(lhs, rhs); } -static inline Expression* Or(Expression* lhs, Expression* rhs) { +static inline Expression* _Or(Expression* lhs, Expression* rhs) { return new OperatorOr(lhs, rhs); } +static inline Expression* _Equal(Expression* lhs, Expression* rhs) { + return new Equal(lhs, rhs); +} +static inline Expression* _NotEqual(Expression* lhs, Expression* rhs) { + return new NotEqual(lhs, rhs); +} +static inline Expression* _GreaterThan(Expression* lhs, Expression* rhs) { + return new GreaterThan(lhs, rhs); +} +static inline Expression* _GreaterEqual(Expression* lhs, Expression* rhs) { + return new GreaterEqual(lhs, rhs); +} +static inline Expression* _LessThan(Expression* lhs, Expression* rhs) { + return new LessThan(lhs, rhs); +} +static inline Expression* _LessEqual(Expression* lhs, Expression* rhs) { + return new LessEqual(lhs, rhs); +} + } // namespace GAR_NAMESPACE_INTERNAL #endif // GAR_UTILS_EXPRESSION_H_ diff --git a/cpp/test/test_arrow_chunk_reader.cc b/cpp/test/test_arrow_chunk_reader.cc index a05304d41..3abec393d 100644 --- a/cpp/test/test_arrow_chunk_reader.cc +++ b/cpp/test/test_arrow_chunk_reader.cc @@ -295,7 +295,7 @@ TEST_CASE("test_adj_list_property_pushdown") { auto expr1 = Expression::Make("2012-06-02T04:30:44.526+0000", prop); auto expr2 = Expression::Make(prop, prop); - auto filter = And(expr1, expr2); + auto filter = _And(expr1, expr2); auto defer = std::unique_ptr(filter); std::vector expected_cols{"creationDate"};