stoneatom / stonedb

StoneDB is an Open-Source MySQL HTAP and MySQL-Native DataBase for OLTP, Real-Time Analytics, a counterpart of MySQLHeatWave. (https://stonedb.io)
https://stonedb.io/
GNU General Public License v2.0
866 stars 141 forks source link

bug: Group by null values did not return result. #1959

Open haitaoguan opened 1 year ago

haitaoguan commented 1 year ago

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

Describe the problem

SELECT b.TENANT_ID, a.CLASS_ID, a.INNER_CODE
  FROM v_c1am_busi_type a
  LEFT JOIN (SELECT b.TENANT_ID, a.INNER_CODE
               FROM v_c1am_busi_type a
              CROSS JOIN (SELECT a.TENANT_ID, b.CURRENCY_ID
                           FROM C1AM_BANK_CLASS a, c1AM_BANK_LIST b
                          where a.SERIAL_ID = b.ROW_ID
                            and F_DATE_FORMAT(b.TRADE_DATE) BETWEEN
                                DATE_FORMAT('2023-06-06', '%Y-%m-%d') AND
                                DATE_FORMAT('2023-06-06', '%Y-%m-%d')
                          GROUP BY a.TENANT_ID, b.CURRENCY_ID) b) b
    ON a.INNER_CODE =
  LEFT(b.INNER_CODE, LENGTH(a.INNER_CODE))
 GROUP BY b.TENANT_ID;

Expected behavior

+-----------+------------------+------------+
| TENANT_ID | CLASS_ID         | INNER_CODE |
+-----------+------------------+------------+
|      NULL | 3000000000233027 | 100        |
+-----------+------------------+------------+

How To Reproduce

No response

Environment

./mysqld Ver 5.7.36-StoneDB-v1.0.4 for Linux on x86_64 (build-) build information as follow: Repository address: https://github.com/stoneatom/stonedb.git:stonedb-5.7-dev Branch name: stonedb-5.7-dev Last commit ID: 98a2591 Last commit time: Date: Thu Jul 20 10:38:44 2023 +0800 Build time: Date: Thu Jul 20 02:57:45 UTC 2023

Are you interested in submitting a PR to solve the problem?