-
Bug
-
Resolution: Done
-
Major
-
1.7.0.Final
-
None
-
False
-
False
-
Couldn't parse this view which we weren't replicating in any case but it was in the bin log.
CREATE OR REPLACE VIEW account_equity_monthly_view AS
SELECT e.account_id,
e.execution_venue_id,
e.start_date,
e.currency,
e.start_equity,
e.end_equity,
e.start_variation,
e.end_variation,
e.trading_settlements,
e.net_deposits,
IF(ABS(e.end_equity - e.start_equity - e.net_deposits - e.end_variation + e.start_variation -
e.trading_settlements) < 1, 0,
e.end_equity - e.start_equity - e.net_deposits - e.end_variation + e.start_variation -
e.trading_settlements) AS brokerage_fees
FROM (
SELECT eq.account_id,
eq.execution_venue_id,
eq.start_date,
eq.currency,
COALESCE(LAG(last_eq.end_equity)
OVER (PARTITION BY eq.account_id, eq.execution_venue_id, eq.currency ORDER BY eq.start_date),
0) AS start_equity,
last_eq.end_equity,
COALESCE(LAG(last_eq.end_variation)
OVER (PARTITION BY eq.account_id, eq.execution_venue_id, eq.currency ORDER BY eq.start_date),
0) AS start_variation,
last_eq.end_variation,
eq.trading_settlements,
eq.net_deposits,
eq.brokerage_fees
FROM (
SELECT eq.account_id,
eq.execution_venue_id,
start_date,
eq.currency,
MAX(date) AS last_date,
SUM(eq.trading_settlements) AS trading_settlements,
SUM(eq.net_deposits) AS net_deposits,
SUM(eq.brokerage_fees) AS brokerage_fees
FROM account_equity_daily eq
JOIN account acc ON eq.account_id = acc.account_id AND eq.execution_venue_id = acc.execution_venue_id
JOIN investment_period tp ON tp.product_id = acc.product_id AND eq.date BETWEEN tp.start_date AND tp.end_date
GROUP BY
eq.account_id,
eq.execution_venue_id,
tp.start_date,
eq.currency ) eq
JOIN account_equity_daily last_eq
ON eq.account_id = last_eq.account_id AND eq.execution_venue_id = last_eq.execution_venue_id AND
eq.currency = last_eq.currency AND
eq.last_date = last_eq.date
ORDER BY
eq.execution_venue_id,
eq.account_id,
eq.start_date,
eq.currency ) e;
- account is impacted by
-
DBZ-4193 Parse the "window" keyword for agg and nonagg function in mysql8
- Closed