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
- 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
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.
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
TypedExprcan 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
std::unordered_map<std::string, CudfFunctionSpec> getCudfFunctionRegistry()->std::unordered_map<std::string, CudfFunctionSpec> getCudfASTOperatorRegistry()will be created.registerCudfFunction->registerCudfASTOperatorwill be created for registering.FunctionExpression::canEvaluatewill be created inASTExpression::canEvaluatecudf::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.cppWe also need to collate Velox/cudf types to Signature names (like "bigint", "any")
Ref
velox/expression/signature_parser/SignatureParser.yyBoth TableScan, HashJoin can have filters, and these filters are replaced with AST.
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.