From 98f92d53b20eb07c84f0065bc5f89c3102ba0268 Mon Sep 17 00:00:00 2001 From: Andrew Hutchings Date: Fri, 16 Dec 2016 21:42:52 +0000 Subject: [PATCH] MCOL-301 Fix nested arithmatic in aggregate Arithmatic on two functions inside an aggregate function caused an error due to the function not being parsed correctly. This fix parses the function for the arithmatic. --- dbcon/mysql/ha_calpont_execplan.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 87c985f60..1ad9f8e96 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -2506,7 +2506,20 @@ ArithmeticColumn* buildArithmeticColumn(Item_func* item, gp_walk_info& gwi, bool if (gwi.clauseType == SELECT || /*gwi.clauseType == HAVING || */gwi.clauseType == GROUP_BY || gwi.clauseType == FROM) // select list { lhs = new ParseTree(buildReturnedColumn(sfitempp[0], gwi, nonSupport)); + if (!lhs->data() && (sfitempp[0]->type() == Item::FUNC_ITEM)) + { + delete lhs; + Item_func* ifp = (Item_func*)sfitempp[0]; + lhs = buildParseTree(ifp, gwi, nonSupport); + } + rhs = new ParseTree(buildReturnedColumn(sfitempp[1], gwi, nonSupport)); + if (!rhs->data() && (sfitempp[1]->type() == Item::FUNC_ITEM)) + { + delete rhs; + Item_func* ifp = (Item_func*)sfitempp[1]; + rhs = buildParseTree(ifp, gwi, nonSupport); + } } else // where clause {