Skip to content

Commit

Permalink
delete useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
windtalker committed Apr 13, 2021
1 parent 4daa32d commit 34ba8b5
Showing 1 changed file with 0 additions and 57 deletions.
57 changes: 0 additions & 57 deletions src/expression/binary_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,54 +236,6 @@ std::shared_ptr<const Column> add(const Context &ctx, ThreadId thread_id,
return createArrowColumnVector(result_type, res.make_array());
}

template <typename LeftColumn, typename RightColumn> struct Equal {
template <typename LeftArrowType, typename RightArrowType,
std::enable_if_t<!arrow::is_number_type<LeftArrowType>::value ||
!arrow::is_number_type<RightArrowType>::value> * =
nullptr>
std::shared_ptr<const Column>
operator()(const Context &ctx, ThreadId thread_id, LeftColumn &&left,
RightColumn &&right) const {
arrow::compute::ExecContext context(
ctx.memory_resource->preConcatenate(thread_id));
const auto &res = CURA_GET_ARROW_RESULT(arrow::compute::Compare(
left->arrow(), right->arrow(),
arrow::compute::CompareOptions(arrow::compute::CompareOperator::EQUAL),
&context));
CURA_ASSERT(res.kind() == arrow::Datum::ARRAY,
"Binary op result must be an arrow array");
return createArrowColumnVector(result_type, res.make_array());
}

template <typename LeftArrowType, typename RightArrowType,
std::enable_if_t<arrow::is_number_type<LeftArrowType>::value &&
arrow::is_number_type<RightArrowType>::value> * =
nullptr>
std::shared_ptr<const Column>
operator()(const Context &ctx, ThreadId thread_id, LeftColumn &&left,
RightColumn &&right) const {
using CommonCType = std::common_type_t<typename LeftArrowType::c_type,
typename RightArrowType::c_type>;
arrow::compute::ExecContext context(
ctx.memory_resource->preConcatenate(thread_id));
const auto &common_type = arrow::CTypeTraits<CommonCType>::type_singleton();
const auto &left_casted = CURA_GET_ARROW_RESULT(
arrow::compute::Cast(left->arrow(), common_type,
arrow::compute::CastOptions::Safe(), &context));
const auto &right_casted = CURA_GET_ARROW_RESULT(
arrow::compute::Cast(right->arrow(), common_type));
const auto &res = CURA_GET_ARROW_RESULT(arrow::compute::Compare(
left_casted, right_casted,
arrow::compute::CompareOptions(arrow::compute::CompareOperator::EQUAL),
&context));
CURA_ASSERT(res.kind() == arrow::Datum::ARRAY,
"Binary op result must be an arrow array");
return createArrowColumnVector(result_type, res.make_array());
}

const DataType &result_type;
};

template <typename LeftColumn, typename RightColumn,
arrow::compute::CompareOperator compareOp>
struct Compare {
Expand Down Expand Up @@ -332,15 +284,6 @@ struct Compare {
const DataType &result_type;
};

template <typename LeftColumn, typename RightColumn>
std::shared_ptr<const Column> eq(const Context &ctx, ThreadId thread_id,
LeftColumn &&left, RightColumn &&right,
const DataType &result_type) {
Equal<LeftColumn, RightColumn> eq{result_type};
return dispatchDualTypes(ctx, thread_id, std::forward<LeftColumn>(left),
std::forward<RightColumn>(right), eq);
}

template <typename LeftColumn, typename RightColumn,
arrow::compute::CompareOperator compareOp>
std::shared_ptr<const Column> compare(const Context &ctx, ThreadId thread_id,
Expand Down

0 comments on commit 34ba8b5

Please sign in to comment.