Skip to content
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

docs(sql): update SQL syntax for WINDOW and JOIN #3555

Merged
merged 6 commits into from
Nov 20, 2023

Conversation

aceforeverd
Copy link
Collaborator

@aceforeverd aceforeverd commented Oct 16, 2023

most SQL changes come from #3533, #3554, #3565, #3576

@aceforeverd aceforeverd requested a review from lumianph October 16, 2023 12:30
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 16, 2023
@aceforeverd aceforeverd marked this pull request as draft October 16, 2023 12:30
@aceforeverd

This comment was marked as outdated.

@aceforeverd aceforeverd force-pushed the docs-online-requirements branch from bd277f9 to 59c36bc Compare October 16, 2023 12:34
@aceforeverd aceforeverd marked this pull request as ready for review November 3, 2023 08:32
- 右表 TableRef
1. 仅支持`LAST JOIN`类型。
2. 至少有一个JOIN条件是形如`left_source.column=right_source.column`的EQUAL条件,**并且`right_source.column`列需要命中右表的索引(key 列)**。
3. 带排序LAST JOIN的情况下,`ORDER BY`只支持单列的列引用表达式,列类型为 int16, int32, int64 or timestamp, **并且列需要命中右表索引的时间列**。满足条件 2 和 3 的情况我们简单称做表能被 LAST JOIN 的 JOIN 条件优化
Copy link
Collaborator

@vagetablechicken vagetablechicken Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts column type should be bigint or timestamp? Can we order by?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the five types is supported in SQL engine, is there any difference in deployment ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if you deploy, creating index will be failed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's indeed index's restriction, anyway I've remove the two types in case confusing.

- **Since OpenMLDB 0.8.0** 带 WHERE 条件过滤的简单列筛选 ( 例如 `select * from tb where id > 10`)
- 窗口聚合子查询, 例如 `select id, count(val) over w as cnt from t1 window w as (...)`.
- OpenMLDB 0.8.4 之前, LAST JOIN 的窗口聚合子查询需要和 LAST JOIN 的左边输入 source 有相同的主表
- [ALPHA] OpenMLDB >= 0.8.4, 允许 LAST JOIN 下的窗口聚合子查询不带主表. 详细见下面的例子
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不带主表的例子是?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个例子不能体现?可否加一个不是主表的例子。也要和“没有主表”区别开,“不带主表”这个词有点歧义

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aceforeverd aceforeverd merged commit 1c153e0 into 4paradigm:main Nov 20, 2023
8 checks passed
@aceforeverd aceforeverd deleted the docs-online-requirements branch November 20, 2023 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants