fix xgboost Error information

Offering: openGaussDev

More detail: fix xgboost Error information:Delete Stack Print

Match-id-80e36471ef2d99815d78f1b667b900bd016a43e0
This commit is contained in:
openGaussDev
2022-03-09 20:21:10 +08:00
committed by yanghao
parent 430ffd0582
commit 513eabfde4

View File

@ -80,8 +80,11 @@ static MemoryContext g_xgboostMcxt = NULL;
#define safe_xgboost(call) { \
int err = (call); \
if (err != 0) { \
char *str = const_cast<char*>(g_xgboostApi->XGBGetLastError()); \
char *res = strchr(str, '\n'); \
*res = '\0'; \
ereport(ERROR, (errmodule(MOD_DB4AI), errcode(ERRCODE_INVALID_PARAMETER_VALUE), \
errmsg("%s:%d: error in %s: %s\n", __FILE__, __LINE__, #call, g_xgboostApi->XGBGetLastError()))); \
errmsg("%s:%d: error in: %s\n", __FILE__, __LINE__, str))); \
} \
}
@ -549,12 +552,6 @@ static void xgboost_run(AlgorithmAPI *self, TrainModelState *pstate, Model **mod
ModelTuple const *outer_tuple_slot = nullptr;
// Check max_depth parameter
if (xg_hyperp->max_depth == 0 && (0 != strcmp(xgboost_boost_str[BOOST_GBLINEAR_IDX], xg_hyperp->booster))) {
ereport(ERROR, (errmodule(MOD_DB4AI),
errmsg("Max_depth must be larger than 0 when booster is non_linear value.")));
}
load_xgboost_library();
// data holder for in-between (chunk-wise) invocation of XGBoost training algorithm