diff --git a/src/graph/util/ExpressionUtils.cpp b/src/graph/util/ExpressionUtils.cpp index bdd0dc7143f..415532cddd2 100644 --- a/src/graph/util/ExpressionUtils.cpp +++ b/src/graph/util/ExpressionUtils.cpp @@ -588,7 +588,7 @@ StatusOr ExpressionUtils::filterTransform(const Expression *filter } // Rewrite relational expression - auto rewrittenExpr = rewriteRelExpr(newFilter); + auto rewrittenExpr = rewriteRelExpr(newFilter->clone()); // Fold constant expression auto constantFoldRes = foldConstantExpr(rewrittenExpr); diff --git a/src/graph/visitor/test/FilterTransformTest.cpp b/src/graph/visitor/test/FilterTransformTest.cpp index ab86225ede0..733e50ba3b2 100644 --- a/src/graph/visitor/test/FilterTransformTest.cpp +++ b/src/graph/visitor/test/FilterTransformTest.cpp @@ -32,7 +32,8 @@ TEST_F(FilterTransformTest, TestCalculationOverflow) { auto res = ExpressionUtils::filterTransform(expr); ASSERT(res.ok()); auto expected = expr; - ASSERT_EQ(res.value(), expected) << res.value() << " vs. " << expected->toString(); + ASSERT_EQ(res.value()->toString(), expected->toString()) + << res.value()->toString() << " vs. " << expected->toString(); } // (v.age + 1 < -9223372036854775808) => unchanged { @@ -40,7 +41,8 @@ TEST_F(FilterTransformTest, TestCalculationOverflow) { auto res = ExpressionUtils::filterTransform(expr); ASSERT(res.ok()); auto expected = expr; - ASSERT_EQ(res.value(), expected) << res.value() << " vs. " << expected->toString(); + ASSERT_EQ(res.value()->toString(), expected->toString()) + << res.value()->toString() << " vs. " << expected->toString(); } // (v.age - 1 < 9223372036854775807 + 1) => overflow { @@ -71,7 +73,8 @@ TEST_F(FilterTransformTest, TestCalculationOverflow) { auto res = ExpressionUtils::filterTransform(expr); ASSERT(res.ok()); auto expected = expr; - ASSERT_EQ(res.value(), expected) << res.value()->toString() << " vs. " << expected->toString(); + ASSERT_EQ(res.value()->toString(), expected->toString()) + << res.value()->toString() << " vs. " << expected->toString(); } // !!!(v.age + 1 < -9223372036854775808) => unchanged { @@ -80,7 +83,8 @@ TEST_F(FilterTransformTest, TestCalculationOverflow) { auto res = ExpressionUtils::filterTransform(expr); ASSERT(res.ok()); auto expected = expr; - ASSERT_EQ(res.value(), expected) << res.value()->toString() << " vs. " << expected->toString(); + ASSERT_EQ(res.value()->toString(), expected->toString()) + << res.value()->toString() << " vs. " << expected->toString(); } }