Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
oceanbase
提交
c1696101
O
oceanbase
项目概览
oceanbase
/
oceanbase
大约 1 年 前同步成功
通知
261
Star
6084
Fork
1301
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c1696101
编写于
3月 27, 2024
作者:
O
obdev
提交者:
ob-robot
3月 27, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] [GIS] query range shoud be linked by or
上级
47b31944
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
135 addition
and
2 deletion
+135
-2
src/sql/rewrite/ob_query_range.cpp
src/sql/rewrite/ob_query_range.cpp
+4
-2
tools/deploy/mysql_test/test_suite/geometry/r/mysql/geometry_filter_mysql.result
.../test_suite/geometry/r/mysql/geometry_filter_mysql.result
+82
-0
tools/deploy/mysql_test/test_suite/geometry/t/geometry_filter_mysql.test
...sql_test/test_suite/geometry/t/geometry_filter_mysql.test
+49
-0
未找到文件。
src/sql/rewrite/ob_query_range.cpp
浏览文件 @
c1696101
...
...
@@ -3527,7 +3527,8 @@ int ObQueryRange::pre_extract_and_or_op(const ObOpRawExpr *m_expr,
query_range_ctx_
->
cur_expr_is_precise_
=
false
;
if
(
OB_FAIL
(
preliminary_extract
(
m_expr
->
get_param_expr
(
i
),
tmp
,
dtc_params
)))
{
LOG_WARN
(
"preliminary_extract failed"
,
K
(
ret
));
}
else
if
(
T_OP_AND
==
m_expr
->
get_expr_type
())
{
}
else
if
(
!
is_contain_geo_filters
()
// geo range linked by or
&&
T_OP_AND
==
m_expr
->
get_expr_type
())
{
if
(
OB_FAIL
(
add_and_item
(
key_part_list
,
tmp
)))
{
LOG_WARN
(
"push back failed"
,
K
(
ret
));
}
...
...
@@ -3542,7 +3543,8 @@ int ObQueryRange::pre_extract_and_or_op(const ObOpRawExpr *m_expr,
}
if
(
OB_SUCC
(
ret
))
{
query_range_ctx_
->
cur_expr_is_precise_
=
cur_expr_is_precise
;
if
(
T_OP_AND
==
m_expr
->
get_expr_type
())
{
if
(
!
is_contain_geo_filters
()
// geo range linked by or
&&
T_OP_AND
==
m_expr
->
get_expr_type
())
{
if
(
OB_FAIL
(
and_range_graph
(
key_part_list
,
out_key_part
)))
{
LOG_WARN
(
"and range graph failed"
,
K
(
ret
));
}
...
...
tools/deploy/mysql_test/test_suite/geometry/r/mysql/geometry_filter_mysql.result
浏览文件 @
c1696101
...
...
@@ -3226,3 +3226,85 @@ Outputs & filters:
select id, min, max, st_astext(line_geo) from spatial_point_in_line ignore index(geom_idx_1) where ST_Contains(line_geo, LineString(Point(80, 0), Point(91, 0)));
id min max st_astext(line_geo)
2 80 100 LINESTRING(80 0,100 0)
drop table t1;
create table t1 (c1 int primary key, g GEOMETRY NOT NULL SRID 4326, SPATIAL INDEX(g));
insert into t1 values (1, ST_GeomFromText('POINT(1 1)', 4326));
insert into t1 values (2, ST_GeomFromText('POINT(-1 1)', 4326));
insert into t1 values (3, ST_GeomFromText('POINT(-1 -1)', 4326));
insert into t1 values (4, ST_GeomFromText('POINT(1 -1)', 4326));
insert into t1 values (5, ST_GeomFromText('POLYGON((0 0, 1 0, 1 -1, 0 -1, 0 0))', 4326));
insert into t1 values (6, ST_GeomFromText('LINESTRING(-1 -1, 3 3)', 4326));
insert into t1 values (7, ST_GeomFromText('POLYGON((1 1, -1 1, -1 -1, 1 -1, 1 1))', 4326));
insert into t1 values (8, ST_GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 4326));
insert into t1 values (9, ST_GeomFromText('POINT(0 0)', 4326));
select /*+ index(t1 g) */ c1, ST_AsText(g) FROM t1 where ST_Intersects(g, ST_GeomFromText('POINT(1 -1)', 4326)) or (ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 4326)) and ST_Intersects(g, ST_GeomFromText('POINT(1 1)', 4326)));
c1 ST_AsText(g)
1 POINT(1 1)
4 POINT(1 -1)
5 POLYGON((0 0,1 0,1 -1,0 -1,0 0))
7 POLYGON((1 1,-1 1,-1 -1,1 -1,1 1))
8 POLYGON((0 0,0 2,2 2,2 0,0 0))
select /*+ full(t1) */ c1, ST_AsText(g) FROM t1 where ST_Intersects(g, ST_GeomFromText('POINT(1 -1)', 4326)) or (ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 4326)) and ST_Intersects(g, ST_GeomFromText('POINT(1 1)', 4326)));
c1 ST_AsText(g)
1 POINT(1 1)
4 POINT(1 -1)
5 POLYGON((0 0,1 0,1 -1,0 -1,0 0))
7 POLYGON((1 1,-1 1,-1 -1,1 -1,1 1))
8 POLYGON((0 0,0 2,2 2,2 0,0 0))
select /*+ index(t1 g) */ c1, ST_AsText(g) FROM t1 where ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 4326))
and (ST_Intersects(g, ST_GeomFromText('POINT(1 -1)', 4326))
or ST_Intersects(g, ST_GeomFromText('POINT(1 1)', 4326)));
c1 ST_AsText(g)
1 POINT(1 1)
5 POLYGON((0 0,1 0,1 -1,0 -1,0 0))
7 POLYGON((1 1,-1 1,-1 -1,1 -1,1 1))
8 POLYGON((0 0,0 2,2 2,2 0,0 0))
select /*+ full(t1) */ c1, ST_AsText(g) FROM t1 where ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 4326))
and (ST_Intersects(g, ST_GeomFromText('POINT(1 -1)', 4326))
or ST_Intersects(g, ST_GeomFromText('POINT(1 1)', 4326)));
c1 ST_AsText(g)
1 POINT(1 1)
5 POLYGON((0 0,1 0,1 -1,0 -1,0 0))
7 POLYGON((1 1,-1 1,-1 -1,1 -1,1 1))
8 POLYGON((0 0,0 2,2 2,2 0,0 0))
select /*+ index(t1 g) */ c1, ST_AsText(g) FROM t1 where (ST_Intersects(g, ST_GeomFromText('POINT(1 -1)', 4326))
and ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 -2, 2 -2, 2 0, 0 0))', 4326)))
or (ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 4326))
and ST_Intersects(g, ST_GeomFromText('POINT(1 1)', 4326)));
c1 ST_AsText(g)
1 POINT(1 1)
4 POINT(1 -1)
5 POLYGON((0 0,1 0,1 -1,0 -1,0 0))
7 POLYGON((1 1,-1 1,-1 -1,1 -1,1 1))
8 POLYGON((0 0,0 2,2 2,2 0,0 0))
select /*+ full(t1) */ c1, ST_AsText(g) FROM t1 where (ST_Intersects(g, ST_GeomFromText('POINT(1 -1)', 4326))
and ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 -2, 2 -2, 2 0, 0 0))', 4326)))
or (ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 4326))
and ST_Intersects(g, ST_GeomFromText('POINT(1 1)', 4326)));
c1 ST_AsText(g)
1 POINT(1 1)
4 POINT(1 -1)
5 POLYGON((0 0,1 0,1 -1,0 -1,0 0))
7 POLYGON((1 1,-1 1,-1 -1,1 -1,1 1))
8 POLYGON((0 0,0 2,2 2,2 0,0 0))
select /*+ index(t1 g) */ c1, ST_AsText(g) FROM t1 where (ST_Intersects(g, ST_GeomFromText('POINT(1 -1)', 4326))
or ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 -2, 2 -2, 2 0, 0 0))', 4326)))
and (ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 4326))
or ST_Intersects(g, ST_GeomFromText('POINT(1 1)', 4326)));
c1 ST_AsText(g)
5 POLYGON((0 0,1 0,1 -1,0 -1,0 0))
6 LINESTRING(-1 -1,3 3)
7 POLYGON((1 1,-1 1,-1 -1,1 -1,1 1))
8 POLYGON((0 0,0 2,2 2,2 0,0 0))
9 POINT(0 0)
select /*+ full(t1) */ c1, ST_AsText(g) FROM t1 where (ST_Intersects(g, ST_GeomFromText('POINT(1 -1)', 4326))
or ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 -2, 2 -2, 2 0, 0 0))', 4326)))
and (ST_Intersects(g, ST_GeomFromText('POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))', 4326))
or ST_Intersects(g, ST_GeomFromText('POINT(1 1)', 4326)));
c1 ST_AsText(g)
5 POLYGON((0 0,1 0,1 -1,0 -1,0 0))
6 LINESTRING(-1 -1,3 3)
7 POLYGON((1 1,-1 1,-1 -1,1 -1,1 1))
8 POLYGON((0 0,0 2,2 2,2 0,0 0))
9 POINT(0 0)
drop table t1;
tools/deploy/mysql_test/test_suite/geometry/t/geometry_filter_mysql.test
浏览文件 @
c1696101
...
...
@@ -510,3 +510,52 @@ insert into spatial_point_in_line (min, max, line_geo) values
select
id
,
min
,
max
,
st_astext
(
line_geo
)
from
spatial_point_in_line
where
ST_Contains
(
line_geo
,
LineString
(
Point
(
80
,
0
),
Point
(
91
,
0
)));
explain
select
id
,
min
,
max
,
st_astext
(
line_geo
)
from
spatial_point_in_line
where
ST_Contains
(
line_geo
,
LineString
(
Point
(
80
,
0
),
Point
(
91
,
0
)));
select
id
,
min
,
max
,
st_astext
(
line_geo
)
from
spatial_point_in_line
ignore
index
(
geom_idx_1
)
where
ST_Contains
(
line_geo
,
LineString
(
Point
(
80
,
0
),
Point
(
91
,
0
)));
--
error
0
,
1051
drop
table
t1
;
create
table
t1
(
c1
int
primary
key
,
g
GEOMETRY
NOT
NULL
SRID
4326
,
SPATIAL
INDEX
(
g
));
insert
into
t1
values
(
1
,
ST_GeomFromText
(
'POINT(1 1)'
,
4326
));
insert
into
t1
values
(
2
,
ST_GeomFromText
(
'POINT(-1 1)'
,
4326
));
insert
into
t1
values
(
3
,
ST_GeomFromText
(
'POINT(-1 -1)'
,
4326
));
insert
into
t1
values
(
4
,
ST_GeomFromText
(
'POINT(1 -1)'
,
4326
));
insert
into
t1
values
(
5
,
ST_GeomFromText
(
'POLYGON((0 0, 1 0, 1 -1, 0 -1, 0 0))'
,
4326
));
insert
into
t1
values
(
6
,
ST_GeomFromText
(
'LINESTRING(-1 -1, 3 3)'
,
4326
));
insert
into
t1
values
(
7
,
ST_GeomFromText
(
'POLYGON((1 1, -1 1, -1 -1, 1 -1, 1 1))'
,
4326
));
insert
into
t1
values
(
8
,
ST_GeomFromText
(
'POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'
,
4326
));
insert
into
t1
values
(
9
,
ST_GeomFromText
(
'POINT(0 0)'
,
4326
));
# c1 or (c2 and c3)
select
/*+ index(t1 g) */
c1
,
ST_AsText
(
g
)
FROM
t1
where
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 -1)'
,
4326
))
or
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'
,
4326
))
and
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 1)'
,
4326
)));
select
/*+ full(t1) */
c1
,
ST_AsText
(
g
)
FROM
t1
where
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 -1)'
,
4326
))
or
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'
,
4326
))
and
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 1)'
,
4326
)));
#c1 and (c2 or c3)
select
/*+ index(t1 g) */
c1
,
ST_AsText
(
g
)
FROM
t1
where
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'
,
4326
))
and
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 -1)'
,
4326
))
or
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 1)'
,
4326
)));
select
/*+ full(t1) */
c1
,
ST_AsText
(
g
)
FROM
t1
where
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'
,
4326
))
and
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 -1)'
,
4326
))
or
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 1)'
,
4326
)));
# (c1 and c2) or (c3 and c4)
select
/*+ index(t1 g) */
c1
,
ST_AsText
(
g
)
FROM
t1
where
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 -1)'
,
4326
))
and
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 -2, 2 -2, 2 0, 0 0))'
,
4326
)))
or
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'
,
4326
))
and
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 1)'
,
4326
)));
select
/*+ full(t1) */
c1
,
ST_AsText
(
g
)
FROM
t1
where
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 -1)'
,
4326
))
and
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 -2, 2 -2, 2 0, 0 0))'
,
4326
)))
or
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'
,
4326
))
and
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 1)'
,
4326
)));
# (c1 or c2) and (c3 or c4)
select
/*+ index(t1 g) */
c1
,
ST_AsText
(
g
)
FROM
t1
where
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 -1)'
,
4326
))
or
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 -2, 2 -2, 2 0, 0 0))'
,
4326
)))
and
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'
,
4326
))
or
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 1)'
,
4326
)));
select
/*+ full(t1) */
c1
,
ST_AsText
(
g
)
FROM
t1
where
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 -1)'
,
4326
))
or
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 -2, 2 -2, 2 0, 0 0))'
,
4326
)))
and
(
ST_Intersects
(
g
,
ST_GeomFromText
(
'POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))'
,
4326
))
or
ST_Intersects
(
g
,
ST_GeomFromText
(
'POINT(1 1)'
,
4326
)));
drop
table
t1
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录