-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Description
Context
Current velox-cudf expression errors out during runtime that certain operator type operations are not supported. This needs to be found during DriverAdapter stage (when replacing CPUoperators), so that we don't replace CPUOperator with unsupported expression type. @devavret added the infrastructure to check this during DriverAdapter stage for Functions used in expressions with FunctionEvaluator. Expressions are also supported with AST. We need to add this infrastructure for ASTEvaluator.
Typed expression evaluation Infrastructure for Function is created in PR #80 (with other changes)
This Infrastructure can check if a TypedExpr can be evaluated. This can be called during DriverAdapter stage, to decide to replace CPUOperators with GPUOperators.
Functions are used in FilterProject operator.
AST is used in FilterProject, TableScan, HashJoin.
Proposed Solution
For AST, here is the plan
- Infrastructure for Typed expression evaluation for AST
- similar to
std::unordered_map<std::string, CudfFunctionSpec> getCudfFunctionRegistry()->
std::unordered_map<std::string, CudfFunctionSpec> getCudfASTOperatorRegistry()will be created. - Similar to
registerCudfFunction->registerCudfASTOperatorwill be created for registering. - 2 functions similar to
FunctionExpression::canEvaluatewill be created inASTExpression::canEvaluate - Infra code to handle special functions like "switch", "between", "in", etc.
- cudf already has following functions to check return type of AST operator.
cudf::size_type ast_operator_arity(ast_operator op)
ast_operator_return_type(ast_operator op, std::vector<cudf::data_type> const& operand_types)
Both types for binary operators should be same in AST.
and the type mapping is in velox/experimental/cudf/exec/VeloxCudfInterop.cpp
- Using these functions, we can create a map of "operator" , , for all input types.
- This can be done either (compile time, runtime, or offline)
We also need to collate Velox/cudf types to Signature names (like "bigint", "any")
Ref velox/expression/signature_parser/SignatureParser.yy
- AST Type Expression support in TableScan, HashJoin
Both TableScan, HashJoin can have filters, and these filters are replaced with AST.
- Assuming,
ASTExpression::canEvaluateis available in (1), this needs to be plugged intoToCudf.cpp, to check during DriverAdapter if these 2 operators can be replaced or not.