[MCOL-3569] Query causing "error in TupleAggregateSte" Created: 2019-10-20  Updated: 2022-03-04  Resolved: 2022-03-04

Status: Closed
Project: MariaDB ColumnStore
Component/s: ExeMgr
Affects Version/s: 1.2.5, 5.4.3
Fix Version/s: 6.3.1

Type: Bug Priority: Critical
Reporter: David Hill (Inactive) Assignee: Allen Herrera
Resolution: Not a Bug Votes: 2
Labels: None

Issue Links:
Blocks
is blocked by MCOL-563 Implement Disk-based aggregation Closed
Sprint: 2021-6, 2021-7, 2021-8, 2021-9, 2021-10, 2021-11, 2021-12, 2021-13, 2021-14, 2021-15, 2021-16, 2021-17

 Description   

Customer reporting issue on both the 1.2.3 and the 1.2.5 builds.

This is a complete error that is showing when we run some of our queries:
ERROR 1815 (HY000): Internal error: An unexpected condition within the query caused an internal processing error within Columnstore. Please check the log files for more details. Additional Information: error in TupleAggregateSte.

They found MCOL-2091 that has a similar error message, but they believe this is a different problem.

I post the query in the next comments



 Comments   
Comment by David Hill (Inactive) [ 2019-10-20 ]

From customer, this issue is critical to them

am trying to do something here meanwhile. Going to bump all our decimals definition to 18,x because I hope that if it is that getDecimalVal: decimal overflow and it is overflowing the size that is declared for the table (most probably wishful thinking on my side) we may have a temporary remedy - very crappy one, but at least it will save our face at front of our client.

Unfortunately this is a SERIOUS issue as they are currently approaching their end of fiscal year and heavily relay on our analytical platform to get some important number that want to report. Up until we processed the data for last week everything worked just fine. We probably were very close to the ceiling without knowing about it.

Please communicate the level of urgency to the development team. The only reason why I did not log an issue with S1 is that it is not a complete outage but the bug renders our platform to be a non reliable source of information fur our users, which is pretty much very similar to an outage description with only difference - that database is technically running.

Comment by David Hill (Inactive) [ 2019-10-21 ]

Update from customer

Just finished that quick test and after bumping all of the decimals to 18,x precision definition. I ran the query on the same data but loaded to the tables with enhanced decimal size declaration. Unfortunately - no dice. Same result, same error message.

Comment by Andrew Hutchings (Inactive) [ 2019-10-23 ]

Spoken to Roman, he believes it is because regular functions do not have support for the LONG DOUBLE overflow that David Hall added for aggregates.

Comment by Martin Adamec [ 2019-10-23 ]

I ran a test on the data set that is triggering this issue after our email exchange with Andrew. The test was to run the query after removing ROUND() from it completely. It did not help. An issue is still present even ROUND() is out of the picture. Here is what I observed:

MariaDB [dds_zmnlu2chkwifdugygq9v]> SELECT be.`customer`, SUM((CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`cust_qty` ELSE 0.0 END)) AS cust_qty, SUM((CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1))ELSE 0.0 END)) AS cross_qty, SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) AS commission, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_option` IS NULL, 0.0, bedv.`pnl_option`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END)) AS total_opt_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`delta_pnl_attr` IS NULL, 0.0, bedv.`delta_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)) AS delta_opt_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`gamma_pnl_attr` IS NULL, 0.0, bedv.`gamma_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)) AS gamma_opt_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`vega_pnl_attr` IS NULL, 0.0, bedv.`vega_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)) AS vega_opt_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`rho_pnl_attr` IS NULL, 0.0, bedv.`rho_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)) AS rho_opt_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`theta_pnl_attr` IS NULL, 0.0, bedv.`theta_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)) AS theta_opt_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`divyield_pnl_attr` IS NULL, 0.0, bedv.`divyield_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)) AS div_yield_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`unexplaind_pnl_attr` IS NULL, 0.0, bedv.`unexplaind_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END)) AS unexp_opt_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_total` IS NULL, 0.0, bedv.`pnl_total`), 0.0)) AS total_hdg_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_delta` IS NULL, 0.0, bedv.`pnl_delta`), 0.0)) AS delta_hdg_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_trade` IS NULL, 0.0, bedv.`pnl_trade`), 0.0)) AS trade_hdg_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_basis` IS NULL, 0.0, bedv.`pnl_basis`), 0.0)) AS basis_hdg_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`dividend` IS NULL, 0.0, bedv.`dividend`), 0.0)) AS dividend, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_unexplained` IS NULL, 0.0, bedv.`pnl_unexplained`), 0.0)) AS unexp_hdg_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_option` IS NULL, 0.0, bedv.`pnl_option`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_total` IS NULL, 0.0, bedv.`pnl_total`), 0.0)) AS total_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`delta_pnl_attr` IS NULL, 0.0, bedv.`delta_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_delta` IS NULL, 0.0, bedv.`pnl_delta`), 0.0)) AS total_delta_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`gamma_pnl_attr` IS NULL, 0.0, bedv.`gamma_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)) AS total_gamma_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`vega_pnl_attr` IS NULL, 0.0, bedv.`vega_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)) AS total_vega_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`theta_pnl_attr` IS NULL, 0.0, bedv.`theta_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)) AS total_theta_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`rho_pnl_attr` IS NULL, 0.0, bedv.`rho_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)) AS total_rho_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_trade` IS NULL, 0.0, bedv.`pnl_trade`), 0.0)) AS total_tc, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`divyield_pnl_attr` IS NULL, 0.0, bedv.`divyield_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_basis` IS NULL, 0.0, bedv.`pnl_basis`), 0.0) + IF(be.`fixed_retention` IS NULL, IF(bedv.`dividend` IS NULL, 0.0, bedv.`dividend`), 0.0)) AS total_div_basis_pnl, SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`unexplaind_pnl_attr` IS NULL, 0.0, bedv.`unexplaind_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_unexplained` IS NULL, 0.0, bedv.`pnl_unexplained`), 0.0)) AS total_unexp_pnl, SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) + SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_option` IS NULL, 0.0, bedv.`pnl_option`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_total` IS NULL, 0.0, bedv.`pnl_total`), 0.0)) AS total_net_revenue, (SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) + SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_option` IS NULL, 0.0, bedv.`pnl_option`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_total` IS NULL, 0.0, bedv.`pnl_total`), 0.0))) * 100 / SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) AS ret_perc, ((SUM((CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1))ELSE 0.0 END)) * 100) / SUM((CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`cust_qty` ELSE 0.0 END))) AS cross_perc, SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`gamma_cash` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * IF(UPPER(be.`bs_firm_action`) = "S", -1, 1) ELSE 0.0 END) AS gamma, SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) / SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`gamma_cash` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * IF(UPPER(be.`bs_firm_action`) = "S", -1, 1) ELSE 0.0 END) AS comm_gm, SUM(CASE WHEN bedv.`daycounter` = 0 THEN (bedv.`vega_pos` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) / 100) * IF(UPPER(be.`bs_firm_action`) = "S", -1, 1) ELSE 0.0 END) AS vega, SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) / SUM(CASE WHEN bedv.`daycounter` = 0 THEN (bedv.`vega_pos` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) / 100) * IF(UPPER(be.`bs_firm_action`) = "S", -1, 1) ELSE 0.0 END) AS comm_vg, SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`gamma_cash` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) ELSE 0.0 END) AS abs_gamma, SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) / SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`gamma_cash` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) ELSE 0.0 END) AS comm_gmabs, SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`vega_pos` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) / 100 ELSE 0.0 END) AS abs_vega, SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) / SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`vega_pos` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) / 100 ELSE 0.0 END) AS comm_vgabs FROM `book_entry_daily_values` AS bedv RIGHT JOIN `book_entry_cs` AS be ON bedv.`book_entry_id` = be.`id` WHERE (bedv.`active` = 1 OR bedv.`active` IS NULL) AND be.`active` = 1 AND(be.`invalid` = '0000-00-00' or be.`invalid` IS NULL) AND bedv.`cross_mode` = 'f100' AND bedv.`hedge_lens` = 'cliff' AND bedv.`tc_mode` = 'vwp3' AND be.`instrument_type` = 'option' AND (bedv.`daycounter` IS NULL OR bedv.`daycounter` BETWEEN 0 AND 10) AND be.`trade_date` BETWEEN '2017-12-01' AND '2019-10-18' GROUP BY be.`customer`;
ERROR 1815 (HY000): Internal error: An unexpected condition within the query caused an internal processing error within Columnstore. Please check the log files for more details. Additional Information: error in TupleAggregateSte

And for comparison this is the same one with ROUND() in it as we originally have it in our application code:

MariaDB [dds_zmnlu2chkwifdugygq9v]> SELECT be.`customer`, ROUND(SUM((CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`cust_qty` ELSE 0.0 END)), 0) AS cust_qty, ROUND(SUM((CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1))ELSE 0.0 END)), 0) AS cross_qty, ROUND(SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END), 0) AS commission, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_option` IS NULL, 0.0, bedv.`pnl_option`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END)), 0) AS total_opt_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`delta_pnl_attr` IS NULL, 0.0, bedv.`delta_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)), 0) AS delta_opt_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`gamma_pnl_attr` IS NULL, 0.0, bedv.`gamma_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)), 0) AS gamma_opt_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`vega_pnl_attr` IS NULL, 0.0, bedv.`vega_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)), 0) AS vega_opt_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`rho_pnl_attr` IS NULL, 0.0, bedv.`rho_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)), 0) AS rho_opt_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`theta_pnl_attr` IS NULL, 0.0, bedv.`theta_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)), 0) AS theta_opt_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`divyield_pnl_attr` IS NULL, 0.0, bedv.`divyield_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)), 0) AS div_yield_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`unexplaind_pnl_attr` IS NULL, 0.0, bedv.`unexplaind_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END)), 0) AS unexp_opt_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_total` IS NULL, 0.0, bedv.`pnl_total`), 0.0)), 0) AS total_hdg_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_delta` IS NULL, 0.0, bedv.`pnl_delta`), 0.0)), 0) AS delta_hdg_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_trade` IS NULL, 0.0, bedv.`pnl_trade`), 0.0)), 0) AS trade_hdg_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_basis` IS NULL, 0.0, bedv.`pnl_basis`), 0.0)), 0) AS basis_hdg_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`dividend` IS NULL, 0.0, bedv.`dividend`), 0.0)), 0) AS dividend, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_unexplained` IS NULL, 0.0, bedv.`pnl_unexplained`), 0.0)), 0) AS unexp_hdg_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_option` IS NULL, 0.0, bedv.`pnl_option`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_total` IS NULL, 0.0, bedv.`pnl_total`), 0.0)), 0) AS total_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`delta_pnl_attr` IS NULL, 0.0, bedv.`delta_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_delta` IS NULL, 0.0, bedv.`pnl_delta`), 0.0)), 0) AS total_delta_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`gamma_pnl_attr` IS NULL, 0.0, bedv.`gamma_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)), 0) AS total_gamma_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`vega_pnl_attr` IS NULL, 0.0, bedv.`vega_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)), 0) AS total_vega_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`theta_pnl_attr` IS NULL, 0.0, bedv.`theta_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)), 0) AS total_theta_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`rho_pnl_attr` IS NULL, 0.0, bedv.`rho_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0)), 0) AS total_rho_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_trade` IS NULL, 0.0, bedv.`pnl_trade`), 0.0)), 0) AS total_tc, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`divyield_pnl_attr` IS NULL, 0.0, bedv.`divyield_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, 0.0) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_basis` IS NULL, 0.0, bedv.`pnl_basis`), 0.0) + IF(be.`fixed_retention` IS NULL, IF(bedv.`dividend` IS NULL, 0.0, bedv.`dividend`), 0.0)), 0) AS total_div_basis_pnl, ROUND(SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`unexplaind_pnl_attr` IS NULL, 0.0, bedv.`unexplaind_pnl_attr`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_unexplained` IS NULL, 0.0, bedv.`pnl_unexplained`), 0.0)), 0) AS total_unexp_pnl, ROUND(SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) + SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_option` IS NULL, 0.0, bedv.`pnl_option`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_total` IS NULL, 0.0, bedv.`pnl_total`), 0.0)), 0) AS total_net_revenue, ROUND((SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) + SUM(IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_option` IS NULL, 0.0, bedv.`pnl_option`) * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * be.`multiplier`, CASE WHEN bedv.`daycounter` = 0 THEN be.`comm_total` * (be.`fixed_retention` - 1.0) ELSE 0.0 END) + IF(be.`fixed_retention` IS NULL, IF(bedv.`pnl_total` IS NULL, 0.0, bedv.`pnl_total`), 0.0))) * 100 / SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END), 0) AS ret_perc, ((ROUND(SUM((CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1))ELSE 0.0 END)), 0) * 100) / ROUND(SUM((CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`cust_qty` ELSE 0.0 END)), 0)) AS cross_perc, ROUND(SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`gamma_cash` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * IF(UPPER(be.`bs_firm_action`) = "S", -1, 1) ELSE 0.0 END), 0) AS gamma, ROUND(SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) / SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`gamma_cash` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) * IF(UPPER(be.`bs_firm_action`) = "S", -1, 1) ELSE 0.0 END), 6) AS comm_gm, ROUND(SUM(CASE WHEN bedv.`daycounter` = 0 THEN (bedv.`vega_pos` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) / 100) * IF(UPPER(be.`bs_firm_action`) = "S", -1, 1) ELSE 0.0 END), 0) AS vega, ROUND(SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) / SUM(CASE WHEN bedv.`daycounter` = 0 THEN (bedv.`vega_pos` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) / 100) * IF(UPPER(be.`bs_firm_action`) = "S", -1, 1) ELSE 0.0 END), 6) AS comm_vg, ROUND(SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`gamma_cash` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) ELSE 0.0 END), 0) AS abs_gamma, ROUND(SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) / SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`gamma_cash` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) ELSE 0.0 END), 6) AS comm_gmabs, ROUND(SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`vega_pos` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) / 100 ELSE 0.0 END), 0) AS abs_vega, ROUND(SUM(CASE WHEN bedv.`daycounter` = 0 OR bedv.`daycounter` is NULL THEN be.`comm_total` ELSE 0.0 END) / SUM(CASE WHEN bedv.`daycounter` = 0 THEN bedv.`vega_pos` * IF(be.flags IS NOT NULL AND INSTR(be.flags,'L') > 0, 0,CEIL(be.`cust_qty` * 1)) / 100 ELSE 0.0 END), 6) AS comm_vgabs FROM `book_entry_daily_values` AS bedv RIGHT JOIN `book_entry_cs` AS be ON bedv.`book_entry_id` = be.`id` WHERE (bedv.`active` = 1 OR bedv.`active` IS NULL) AND be.`active` = 1 AND(be.`invalid` = '0000-00-00' or be.`invalid` IS NULL) AND bedv.`cross_mode` = 'f100' AND bedv.`hedge_lens` = 'cliff' AND bedv.`tc_mode` = 'vwp3' AND be.`instrument_type` = 'option' AND (bedv.`daycounter` IS NULL OR bedv.`daycounter` BETWEEN 0 AND 10) AND be.`trade_date` BETWEEN '2017-12-01' AND '2019-10-18' GROUP BY be.`customer`;
ERROR 1815 (HY000): Internal error: An unexpected condition within the query caused an internal processing error within Columnstore. Please check the log files for more details. Additional Information: error in TupleAggregateSte

Comment by Roman [ 2019-10-26 ]

Suggested workaround is to set the session variable:
set infinidb_double_for_decimal_math=1;

Comment by Valerii Kravchuk [ 2020-12-24 ]

Customer recently got the same error with 5.4.3:

...
 
ERROR 1815 (HY000): Internal error: An unexpected condition within the query caused an internal processing error within Columnstore. Please check the log files for more details. Additional Information: error in TupleAggregateSte

See more details in the associated issue.

Comment by David Hall (Inactive) [ 2021-01-07 ]

Checking the Support Report, I noticed that TotalUmMemory = 100%. The above error is caused by running out of memory – an error which would have been caught by TotalUmMemory had it been a reasonable value. This can be seen in the log files (ExeMgr on PM1):
Dec 24 10:14:24 nvmesh-target-a joblist[271762]: 24.042524 |175|0|0| C 05 CAL0000: TupleAggregateStep::threadedAggregateRowGroups() caught std::bad_alloc

The user was having trouble with TotalUmMemory = 25% (The default) and tried various things ending up with 100%. Since the query returns many millions of rows, each with a large footprint, even the extremely large system used isn't big enough. For this query, something needs to be done to break it into smaller chunks somehow. MCOL-

Comment by David Hall (Inactive) [ 2021-02-23 ]

The latest run by the user with a correct TotalUmMemory setting shows exhaustion of Aggregation/Distinct memory. This should be fixed with the implementation of MCOL-563 hopefully available in columnstore 6.1.1

Generated at Thu Feb 08 02:43:42 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.