matrixorigin / matrixorigin/matrixone

[Compatibility]: EXCEPT ALL multiset subtraction is not implemented

Open
#28,234 0 comments 0 reactions 1 assignee Claimed by @XuPeng-SH View on GitHub
kind/bug needs-triage
Dominant language
Go
Stars
1.9k
Forks
311
Avg merge
1d 3h
Merged PRs (30d)
768

Description

## 问题

MatrixOne 可以执行 `INTERSECT ALL`,但 `EXCEPT ALL` / `MINUS ALL` 被明确拒绝为未实现。MySQL 8.3 支持 `EXCEPT ALL`,迁移包含多重集差集的 SQL 时无法直接执行。

## 环境

- MatrixOne: official `main`
- commit: `e7bb0572235ec4bac81eb098eb0ad8900f0065ab`
- comparison: MySQL 8.3

## 复现

```sql
create database except_all_repro;
use except_all_repro;

create table a(v int);
insert into a values (1),(1),(2),(null),(null);

create table b(v int);
insert into b values (1),(1),(1),(3),(null);

select v,count(*) from (
select v from a
except all
select v from b
) q
group by v
order by v is null,v;
```

MatrixOne 返回:

```text
EXCEPT/MINUS ALL clause is not yet implemented
```

MySQL 8.3 返回:

```text
2 | 1
NULL | 1
```

结果符合多重集差集规则:右侧每个值(包括 NULL)的出现次数从左侧对应次数中扣减,最低为 0。

同一数据上的 `UNION [ALL]`、`INTERSECT [ALL]` 和不带 ALL 的 `EXCEPT` 在 MatrixOne 中均可执行,重复值和 NULL 基数正确。

## 期望

支持 MySQL 8.3 的 `EXCEPT ALL` 多重集语义,包括重复值和 NULL 的计数扣减;`MINUS ALL` 如作为同义词保留,应使用同一执行能力。

该最小场景重复执行 3 次,结果稳定。

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.