src/backend/bridge/dml/expr/expr_transformer.cpp
/**
 * @brief Transform a ExprState tree (Postgres) to a AbstractExpression tree
 * (Peloton) recursively.
 * @return  The transformed expression tree. NULL if input is empty.
 */
@brief Transform a ExprState tree (Postgres) to a AbstractExpression tree
(Peloton) recursively.
@return  The transformed expression tree. NULL if input is empty.
@brief Transform a ExprState tree ( Postgres ) to a AbstractExpression tree ( Peloton ) recursively . @return The transformed expression tree . NULL if input is empty .
expression::AbstractExpression *ExprTransformer::TransformExpr(
    const ExprState *expr_state) {
  if (nullptr == expr_state) {
    LOG_TRACE("Null expression");
    return nullptr;
  }
  expression::AbstractExpression *peloton_expr = nullptr;
  if (expr_state->type == T_List) {
    peloton_expr = TransformList(expr_state);
    return peloton_expr;
  }
  switch (nodeTag(expr_state->expr)) {
    case T_Const:
      peloton_expr = TransformConst(expr_state);
      break;
    case T_OpExpr:
      peloton_expr = TransformOp(expr_state);
      break;
    case T_ScalarArrayOpExpr:
      peloton_expr = TransformScalarArrayOp(expr_state);
      break;
    case T_ArrayExpr:
      peloton_expr = TransformArray(expr_state);
      break;
    case T_Var:
      peloton_expr = TransformVar(expr_state);
      break;
    case T_BoolExpr:
      peloton_expr = TransformBool(expr_state);
      break;
    case T_Param:
      peloton_expr = TransformParam(expr_state);
      break;
    case T_RelabelType:
      peloton_expr = TransformRelabelType(expr_state);
      break;
    case T_FuncExpr:
      peloton_expr = TransformFunc(expr_state);
      break;
    case T_CaseExpr:
      peloton_expr = TransformCaseExpr(expr_state);
      break;
    case T_CoalesceExpr:
      peloton_expr = TransformCoalesce(expr_state);
      break;
    case T_NullIfExpr:
      peloton_expr = TransformNullIf(expr_state);
      break;
    case T_Aggref:
      peloton_expr = TransformAggRef(expr_state);
      break;
    default:
      LOG_ERROR("Unsupported Postgres Expr type: %u (see 'nodes.h')",
                nodeTag(expr_state->expr));
  }
  return peloton_expr;
}
expression :: AbstractExpression * ExprTransformer :: TransformExpr ( const ExprState * expr_state ) { if ( nullptr == expr_state ) { LOG_TRACE ( " " ) ; return nullptr ; } expression :: AbstractExpression * peloton_expr = nullptr ; if ( expr_state -> type == T_List ) { peloton_expr = TransformList ( expr_state ) ; return peloton_expr ; } switch ( nodeTag ( expr_state -> expr ) ) { case T_Const : peloton_expr = TransformConst ( expr_state ) ; break ; case T_OpExpr : peloton_expr = TransformOp ( expr_state ) ; break ; case T_ScalarArrayOpExpr : peloton_expr = TransformScalarArrayOp ( expr_state ) ; break ; case T_ArrayExpr : peloton_expr = TransformArray ( expr_state ) ; break ; case T_Var : peloton_expr = TransformVar ( expr_state ) ; break ; case T_BoolExpr : peloton_expr = TransformBool ( expr_state ) ; break ; case T_Param : peloton_expr = TransformParam ( expr_state ) ; break ; case T_RelabelType : peloton_expr = TransformRelabelType ( expr_state ) ; break ; case T_FuncExpr : peloton_expr = TransformFunc ( expr_state ) ; break ; case T_CaseExpr : peloton_expr = TransformCaseExpr ( expr_state ) ; break ; case T_CoalesceExpr : peloton_expr = TransformCoalesce ( expr_state ) ; break ; case T_NullIfExpr : peloton_expr = TransformNullIf ( expr_state ) ; break ; case T_Aggref : peloton_expr = TransformAggRef ( expr_state ) ; break ; default : LOG_ERROR ( " " , nodeTag ( expr_state -> expr ) ) ; } return peloton_expr ; }
@brief Transform a ExprState tree (Postgres) to a AbstractExpression tree
 (Peloton) recursively.
@brief Transform a ExprState tree ( Postgres ) to a AbstractExpression tree ( Peloton ) recursively .
/* Special case:
   * Input is a list of expressions.
   * Transform it to a conjunction tree.
   */