-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] 使用开窗函数count(1) over(),当where后有limit...offset...时查询结果为空 #36699
Comments
morrySnow
added a commit
to morrySnow/incubator-doris
that referenced
this issue
Oct 28, 2024
intro by apache#39316. it want to fix a problem intro by apache#36699. but forgot to remove all wrong code in apache#36699. after apache#39316, we should not set offset on exchange, when the exchange is on the top of a limit with offset.
morrySnow
added a commit
to morrySnow/incubator-doris
that referenced
this issue
Oct 28, 2024
…apache#42576) pick from master apache#42576 intro by apache#39316. it want to fix a problem intro by apache#36699. but forgot to remove all wrong code in apache#36699. after apache#39316, we should not set offset on exchange, when the exchange is on the top of a limit with offset.
morrySnow
added a commit
to morrySnow/incubator-doris
that referenced
this issue
Oct 28, 2024
intro by apache#39316. it want to fix a problem intro by apache#36699. but forgot to remove all wrong code in apache#36699. after apache#39316, we should not set offset on exchange, when the exchange is on the top of a limit with offset.
morrySnow
added a commit
to morrySnow/incubator-doris
that referenced
this issue
Oct 28, 2024
…apache#42576) pick from master apache#42576 intro by apache#39316. it want to fix a problem intro by apache#36699. but forgot to remove all wrong code in apache#36699. after apache#39316, we should not set offset on exchange, when the exchange is on the top of a limit with offset.
morrySnow
added a commit
to morrySnow/incubator-doris
that referenced
this issue
Oct 28, 2024
…apache#42576) pick from master apache#42576 intro by apache#39316. it want to fix a problem intro by apache#36699. but forgot to remove all wrong code in apache#36699. after apache#39316, we should not set offset on exchange, when the exchange is on the top of a limit with offset.
morrySnow
added a commit
to morrySnow/incubator-doris
that referenced
this issue
Oct 28, 2024
…apache#42576) pick from master apache#42576 intro by apache#39316. it want to fix a problem intro by apache#36699. but forgot to remove all wrong code in apache#36699. after apache#39316, we should not set offset on exchange, when the exchange is on the top of a limit with offset.
morrySnow
added a commit
to morrySnow/incubator-doris
that referenced
this issue
Oct 28, 2024
…apache#42576) pick from master apache#42576 intro by apache#39316. it want to fix a problem intro by apache#36699. but forgot to remove all wrong code in apache#36699. after apache#39316, we should not set offset on exchange, when the exchange is on the top of a limit with offset.
morrySnow
added a commit
to morrySnow/incubator-doris
that referenced
this issue
Oct 29, 2024
…apache#42576) pick from master apache#42576 intro by apache#39316. it want to fix a problem intro by apache#36699. but forgot to remove all wrong code in apache#36699. after apache#39316, we should not set offset on exchange, when the exchange is on the top of a limit with offset.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Search before asking
Version
2.0.7、 2.0.11
What's Wrong?
select语句中包含count() over()等开窗函数时,最后使用了分页查询limit xxx offset xxx,如果limit前没有order by子句,则无法查询出数据
What You Expected?
即使不加order by , 也正常返回数据
How to Reproduce?
create database demo;
CREATE TABLE demo.dma_emp (
empno
INT NULL,ename
VARCHAR(255) NULL,job
VARCHAR(255) NULL,mgr
INT NULL,hiredate
VARCHAR(255) NULL,sal
FLOAT NULL,comm
FLOAT NULL,deptno
INT NULL) ENGINE=OLAP
DUPLICATE KEY(
empno
,ename
)DISTRIBUTED BY HASH(
empno
) BUCKETS 10;
INSERT INTO demo.dma_emp VALUES (7788, 'SCOTT', 'ANALYST', 7566, '1987-04-19', 3000, 0, 20);
INSERT INTO demo.dma_emp VALUES (7844, 'TURNER', 'SALESMAN', 7698, '1981-09-08', 1500, 0, 30);
INSERT INTO demo.dma_emp VALUES (7934, 'MILLER', 'CLERK', 7782, '1982-01-23', 1300, 0, 10);
INSERT INTO demo.dma_emp VALUES (7499, 'ALLEN', 'SALESMAN', 7698, '1981-02-20', 1600, 300, 30);
INSERT INTO demo.dma_emp VALUES (7566, 'JONES', 'MANAGER', 7839, '1981-04-02', 2975, 0, 20);
INSERT INTO demo.dma_emp VALUES (7654, 'MARTIN', 'SALESMAN', 7698, '1981-09-28', 1250, 1400, 30);
INSERT INTO demo.dma_emp VALUES (7782, 'CLARK', 'MANAGER', 7839, '1981-06-09', 2450, 0, 10);
INSERT INTO demo.dma_emp VALUES (7876, 'ADAMS', 'CLERK', 7788, '1987-05-23', 1100, 0, 20);
INSERT INTO demo.dma_emp VALUES (7698, 'BLAKE', 'MANAGER', 7839, '1981-05-01', 2850, 0, 30);
INSERT INTO demo.dma_emp VALUES (7839, 'KING', 'PRESIDENT', NULL, '1981-11-17', 5000, 0, 10);
INSERT INTO demo.dma_emp VALUES (7369, 'SMITH', 'CLERK', 7902, '1980-12-17', 800, 0, 20);
INSERT INTO demo.dma_emp VALUES (7902, 'FORD', 'ANALYST', 7566, '1981-12-03', 3000, 0, 20);
INSERT INTO demo.dma_emp VALUES (7521, 'WARD', 'SALESMAN', 7698, '1981-02-22', 1250, 500, 30);
INSERT INTO demo.dma_emp VALUES (7900, 'JAMES', 'CLERK', 7698, '1981-12-03', 950, 0, 30);
-- 1、不加order by 无法返回数据
select
count() over() sal_order,
t.*
from demo.dma_emp t
-- order by sal asc
limit 2 offset 2;
-- 2、不加order by 无法返回数据
select
row_number() over(order by sal desc) sal_order,
t.*
from demo.dma_emp t
-- order by sal asc
limit 2 offset 2;
Anything Else?
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: