Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions velox/experimental/cudf/expression/ExpressionEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,23 @@ class CardinalityFunction : public CudfFunction {
}
};

class NotFunction : public CudfFunction {
public:
NotFunction(const std::shared_ptr<velox::exec::Expr>& expr) {
VELOX_CHECK_EQ(expr->inputs().size(), 1, "not expects exactly 1 input");
VELOX_CHECK(
expr->inputs()[0]->type()->isBoolean(), "not expects a boolean input");
}

ColumnOrView eval(
std::vector<ColumnOrView>& inputColumns,
rmm::cuda_stream_view stream,
rmm::device_async_resource_ref mr) const override {
auto inputCol = asView(inputColumns[0]);
return cudf::unary_operation(inputCol, cudf::unary_operator::NOT, stream);
}
};

class RoundFunction : public CudfFunction {
public:
explicit RoundFunction(const std::shared_ptr<velox::exec::Expr>& expr) {
Expand Down Expand Up @@ -844,6 +861,16 @@ bool registerBuiltinFunctions(const std::string& prefix) {
.argumentType("array(any)")
.build()});

registerCudfFunction(
prefix + "not",
[](const std::string&, const std::shared_ptr<velox::exec::Expr>& expr) {
return std::make_shared<NotFunction>(expr);
},
{FunctionSignatureBuilder()
.returnType("boolean")
.argumentType("boolean")
.build()});

registerCudfFunctions(
{prefix + "substr", prefix + "substring"},
[](const std::string&, const std::shared_ptr<velox::exec::Expr>& expr) {
Expand Down
Loading