From 513eabfde44e155f89a63f92683fbba1c42e416c Mon Sep 17 00:00:00 2001 From: openGaussDev Date: Wed, 9 Mar 2022 20:21:10 +0800 Subject: [PATCH] fix xgboost Error information Offering: openGaussDev More detail: fix xgboost Error information:Delete Stack Print Match-id-80e36471ef2d99815d78f1b667b900bd016a43e0 --- .../dbmind/db4ai/executor/xgboost/xgboost.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/gausskernel/dbmind/db4ai/executor/xgboost/xgboost.cpp b/src/gausskernel/dbmind/db4ai/executor/xgboost/xgboost.cpp index 76b88897f..b36bd79c7 100644 --- a/src/gausskernel/dbmind/db4ai/executor/xgboost/xgboost.cpp +++ b/src/gausskernel/dbmind/db4ai/executor/xgboost/xgboost.cpp @@ -80,8 +80,11 @@ static MemoryContext g_xgboostMcxt = NULL; #define safe_xgboost(call) { \ int err = (call); \ if (err != 0) { \ + char *str = const_cast(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