incubator-doris [Feature] support limit offset, size use default order

tkqqtvp1  于 2022-04-22  发布在  Java
关注(0)|答案(3)|浏览(566)

Search before asking

  • I had searched in the issues and found no similar issues.

Description

support limit offset, size use default order, Currently, we need to manually specify order by to use it, which is incompatible with mysql syntax

Use case

[42000][1064] errCode = 2, detailMessage = OFFSET requires an ORDER BY clause: LIMIT 1, 10

  • No response*

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

mrzz3bfm

mrzz3bfm1#

Could you give a certain example?

fnatzsnv

fnatzsnv2#

CREATE TABLE `test` (
  `courseId` int(11) NOT NULL COMMENT "",
  `lessonId` int(11) NOT NULL COMMENT "",
  `type` int(11) REPLACE_IF_NOT_NULL NULL COMMENT ""
) ENGINE=OLAP
AGGREGATE KEY(`courseId`, `lessonId`)
COMMENT "测试"
DISTRIBUTED BY HASH(`courseId`) BUCKETS 150
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"storage_format" = "V2"
);

select * from test limit 10
select * from test limit 1, 10 (default order by courseId)

4sup72z8

4sup72z83#

CREATE TABLE `test` (
  `courseId` int(11) NOT NULL COMMENT "",
  `lessonId` int(11) NOT NULL COMMENT "",
  `type` int(11) REPLACE_IF_NOT_NULL NULL COMMENT ""
) ENGINE=OLAP
AGGREGATE KEY(`courseId`, `lessonId`)
COMMENT "测试"
DISTRIBUTED BY HASH(`courseId`) BUCKETS 150
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"storage_format" = "V2"
);

select * from test limit 10
select * from test limit 1, 10 (default order by courseId)

It makes me confused...
And what about a more complex query?

相关问题