matrixorigin / matrixorigin/matrixone

[Compatibility]: spatial distance functions lack MySQL length-unit arguments

Open
#28,200 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

## Description

MySQL 的 `ST_Distance`、`ST_FrechetDistance`、`ST_HausdorffDistance` 支持可选长度单位字符串,MO 未注册这些 overload。地理查询无法直接请求 kilometre/foot 等单位;其中 `ST_Distance` 的第三参数在 MO 被定义成整数 SRID,与 MySQL 接口冲突。

## Environment

- `main` commit `e7bb0572235ec4bac81eb098eb0ad8900f0065ab`
- MatrixOne local single node; MySQL 8.3.0 reference
- Date: 2026-09-05

## Reproduction

```sql
SELECT ST_Distance(
ST_GeomFromText('POINT(0 0)',4326),
ST_GeomFromText('POINT(0 1)',4326),
'kilometre'
);
SELECT ST_FrechetDistance(
ST_GeomFromText('LINESTRING(0 0,1 0)',4326),
ST_GeomFromText('LINESTRING(0 1,1 1)',4326),
'kilometre'
);
SELECT ST_HausdorffDistance(
ST_GeomFromText('LINESTRING(0 0,1 0)',4326),
ST_GeomFromText('LINESTRING(0 1,1 1)',4326),
'kilometre'
);
```

MO 分别返回 string-to-int cast 或 no-overload 错误;MySQL 8.3.0 三者均返回 `111.31949079326246`。每项重复 3 次;去掉单位参数后 MO 可执行,说明是 overload 缺失。

MySQL reference: https://dev.mysql.com/doc/refman/8.0/en/spatial-relation-functions-object-shapes.html

MO registrations:https://github.com/matrixorigin/matrixone/blob/e7bb0572235ec4bac81eb098eb0ad8900f0065ab/pkg/sql/plan/function/list_builtIn.go#L5336-L5363 、https://github.com/matrixorigin/matrixone/blob/e7bb0572235ec4bac81eb098eb0ad8900f0065ab/pkg/sql/plan/function/list_builtIn.go#L5669-L5705

修复时应覆盖 metre/kilometre/foot、未知单位、SRID 0、SRID 4326、NULL、大小写与 Prepared Statement;同时明确兼容现有 MO-specific explicit-SRID overload 的解析规则。

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.