title: Basic math operations with SUM() - unexpected values
body: <p>we had this problem: updated version of <strong>MariaDB Columnstore</strong> from <strong>1.2.2</strong> to <strong>1.2.4</strong> and nonsense started.</p>
  
  <p>We have these columns <code>col1, col2</code> both are <code>DECIMAL(15,3)</code>
  there was already working query to calculate these two columns (see alias <code>A</code>) and this wasn't calculating right when <code>col2</code> had zero sum - after db update. Alias <code>B</code> was first approach which didn't help. And <code>C</code> was solution for proper working.</p>
  
  <p>I want to know explanation why this happened and what caused this behaviour.</p>
  
  <pre><code>SELECT
  id,
  SUM(col1) AS c1,
  SUM(col2) AS c2,
  SUM(col1 - col2) AS A,
  SUM(CAST(col1 AS DOUBLE) - CAST(col2 AS DOUBLE)) AS B,
  SUM(CAST(col1 AS DECIMAL(15,3)) - CAST(col2 AS DECIMAL(15,3))) AS C
  FROM table GROUP BY id
  </code></pre>
  
  <p>1.2.2:</p>
  
  <pre><code>+----+----------+--------+-----------+
  | id |    c1    |   c2   |     A     |
  +----+----------+--------+-----------+
  |  1 | 1199.940 |  0.000 |  1199.940 |
  |  2 |  979.860 | 69.990 |   909.870 |
  +----+----------+--------+-----------+
  </code></pre>
  
  <p>1.2.4 with extra SUMs</p>
  
  <pre><code>+----+----------+--------+-----------------------+---------+-----------+
  | id |    c1    |   c2   |           A           |    B    |     C     |
  +----+----------+--------+-----------------------+---------+-----------+
  |  1 | 1199.940 |  0.000 | -9223372036853575.868 |       0 |  1199.940 |
  |  2 |  979.860 | 69.990 |               909.870 |  909.87 |   909.870 |
  +----+----------+--------+-----------------------+---------+-----------+
  </code></pre>