Skip to content

Commit

Permalink
Refactor: clean header files
Browse files Browse the repository at this point in the history
Signed-off-by: Ziy1-Tan <[email protected]>
  • Loading branch information
Ziy1-Tan committed Jun 27, 2023
1 parent 020f57f commit 282e1d8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
27 changes: 14 additions & 13 deletions cpp/include/gar/utils/expression.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ class OperatorNotEqual : public BinaryOperator {
ArrowExpression Evaluate() override;
};

class OperatorGreater : public BinaryOperator {
class OperatorGreaterThan : public BinaryOperator {
public:
OperatorGreater() = default;
OperatorGreater(Expression* lhs, Expression* rhs)
OperatorGreaterThan() = default;
OperatorGreaterThan(Expression* lhs, Expression* rhs)
: BinaryOperator(lhs, rhs) {}
OperatorGreater(const OperatorGreater& other) = default;
~OperatorGreater() = default;
OperatorGreaterThan(const OperatorGreaterThan& other) = default;
~OperatorGreaterThan() = default;

ArrowExpression Evaluate() override;
};
Expand All @@ -209,12 +209,13 @@ class OperatorGreaterEqual : public BinaryOperator {
ArrowExpression Evaluate() override;
};

class OperatorLess : public BinaryOperator {
class OperatorLessThan : public BinaryOperator {
public:
OperatorLess() = default;
OperatorLess(Expression* lhs, Expression* rhs) : BinaryOperator(lhs, rhs) {}
OperatorLess(const OperatorLess& other) = default;
~OperatorLess() = default;
OperatorLessThan() = default;
OperatorLessThan(Expression* lhs, Expression* rhs)
: BinaryOperator(lhs, rhs) {}
OperatorLessThan(const OperatorLessThan& other) = default;
~OperatorLessThan() = default;

ArrowExpression Evaluate() override;
};
Expand Down Expand Up @@ -252,9 +253,9 @@ class OperatorOr : public BinaryOperator {

using Equal = OperatorEqual;
using NotEqual = OperatorNotEqual;
using Greater = OperatorGreater;
using GreaterThan = OperatorGreaterEqual;
using Less = OperatorLess;
using GreaterThan = OperatorGreaterThan;
using GreaterEqual = OperatorGreaterEqual;
using LessThan = OperatorLessThan;
using LessEqual = OperatorLessEqual;

/**
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/expression.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ ArrowExpression OperatorNotEqual::Evaluate() {
return arrow::compute::not_equal(lhs_->Evaluate(), rhs_->Evaluate());
}

ArrowExpression OperatorGreater::Evaluate() {
ArrowExpression OperatorGreaterThan::Evaluate() {
return arrow::compute::greater(lhs_->Evaluate(), rhs_->Evaluate());
}

ArrowExpression OperatorGreaterEqual::Evaluate() {
return arrow::compute::greater_equal(lhs_->Evaluate(), rhs_->Evaluate());
}

ArrowExpression OperatorLess::Evaluate() {
ArrowExpression OperatorLessThan::Evaluate() {
return arrow::compute::less(lhs_->Evaluate(), rhs_->Evaluate());
}

Expand Down
13 changes: 2 additions & 11 deletions cpp/test/test_arrow_chunk_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,17 @@ limitations under the License.

#include <cstdlib>

#include "arrow/adapters/orc/adapter.h"
#include "arrow/api.h"
#include "arrow/csv/api.h"
#include "arrow/filesystem/api.h"
#include "arrow/io/api.h"
#include "arrow/stl.h"
#include "arrow/util/uri.h"
#include "parquet/arrow/writer.h"

#include "./util.h"
#include "gar/reader/arrow_chunk_reader.h"
#include "gar/utils/expression.h"
#include "gar/writer/arrow_chunk_writer.h"

#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>

using GAR_NAMESPACE::Equal;
using GAR_NAMESPACE::Expression;
using GAR_NAMESPACE::Less;
using GAR_NAMESPACE::LessThan;
using GAR_NAMESPACE::Property;
using GAR_NAMESPACE::utils::FilterOptions;

Expand Down Expand Up @@ -308,7 +299,7 @@ TEST_CASE("test_adj_list_property_pushdown") {
// construct pushdown options
Property prop("creationDate");

auto expr1 = Expression::Make<Less>("2012-06-02T04:30:44.526+0000", prop);
auto expr1 = Expression::Make<LessThan>("2012-06-02T04:30:44.526+0000", prop);
auto expr2 = Expression::Make<Equal>(prop, prop);
auto filter = And(expr1, expr2);
auto defer = std::unique_ptr<Expression>(filter);
Expand Down

0 comments on commit 282e1d8

Please sign in to comment.