void* ExprUnary::ExprEvaluate(ExprEvalCnxt& eecnxt) { OperFuncInfoData oper_info; oper_info.args_[0] = arg0_->ExprEvaluate(eecnxt); oper_info.args_num_ = 1; oper_info.result_ = value_; data_type_oper_func_(&oper_info); return type_cast_func_(oper_info.result_, value_); }
void* ExprDate::ExprEvaluate(void* tuple, Schema* schema) { OperFuncInfoData oper_info; oper_info.args_[0] = arg0_->ExprEvaluate(tuple, schema); oper_info.args_[1] = arg1_->ExprEvaluate(tuple, schema); oper_info.args_num_ = 2; oper_info.result_ = value_; DataTypeOperFunc_(&oper_info); return type_cast_func_(oper_info.result_, value_); }
void* ExprCaseWhen::ExprEvaluate(void* tuple, Schema* schema) { ExprNode* then = case_then_[case_then_.size() - 1]; void* result; for (int i = 0; i < case_when_.size(); i++) { if (*static_cast<bool*>(case_when_[i]->ExprEvaluate(tuple, schema)) == true) { then = case_then_[i]; break; } } // case_then_ shouldn't be NULL, checked before result = then->ExprEvaluate(tuple, schema); return type_cast_func_(result, value_); }
void* ExprIn::ExprEvaluate(ExprEvalCnxt& eecnxt) { bool result = false; bool tmp_result = true; for (int i = 0; i < right_node_.size() && !result; ++i) { tmp_result = true; for (int j = 0; j < right_node_[i].size() && tmp_result; ++j) { tmp_result = *(static_cast<bool*>( ExprItemEvaluate(eecnxt, cmp_expr_[j], right_node_[i][j]))); } result = tmp_result; } return type_cast_func_(&result, value_); }
void* ExprColumn::ExprEvaluate(ExprEvalCnxt& eecnxt) { void* result = eecnxt.schema[table_id_]->getColumnAddess( attr_id_, eecnxt.tuple[table_id_]); return type_cast_func_(result, value_); }