Skip to content

Typed Expression Evaluation in AST #86

@karthikeyann

Description

@karthikeyann

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

  1. 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 -> registerCudfASTOperator will be created for registering.
  • 2 functions similar to FunctionExpression::canEvaluate will be created in ASTExpression::canEvaluate
  • Infra code to handle special functions like "switch", "between", "in", etc.
  1. 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

  1. AST Type Expression support in TableScan, HashJoin
    Both TableScan, HashJoin can have filters, and these filters are replaced with AST.
  • Assuming, ASTExpression::canEvaluate is available in (1), this needs to be plugged into ToCudf.cpp, to check during DriverAdapter if these 2 operators can be replaced or not.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions