From e9a920b4e87fe4340d3ba65a79cf488d21e4d32f Mon Sep 17 00:00:00 2001 From: David Hall Date: Wed, 6 Mar 2019 13:57:49 -0600 Subject: [PATCH] MCOL-1951 Don't crash when MariaDB UDAF not defined in Columnstore --- dbcon/mysql/ha_calpont_execplan.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 2de5dfa56..2383f7ff7 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -3984,10 +3984,19 @@ ReturnedColumn* buildAggregateColumn(Item* item, gp_walk_info& gwi) colTypes.push_back(make_pair(udafc->functionParms()->alias(), udafc->functionParms()->resultType().colDataType)); // Call the user supplied init() - if (context.getFunction()->init(&context, colTypes) == mcsv1_UDAF::ERROR) + try + { + if (context.getFunction()->init(&context, colTypes) == mcsv1_UDAF::ERROR) + { + gwi.fatalParseError = true; + gwi.parseErrorText = udafc->getContext().getErrorMessage(); + return NULL; + } + } + catch (std::exception& e) { gwi.fatalParseError = true; - gwi.parseErrorText = udafc->getContext().getErrorMessage(); + gwi.parseErrorText = e.what(); return NULL; } if (udafc->getContext().getRunFlag(UDAF_OVER_REQUIRED))