Parcourir la source

doc(sql): clear description for join/group by

Closes: #937

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang il y a 3 ans
Parent
commit
2822500ad5

+ 2 - 2
docs/en_US/sqls/query_language_elements.md

@@ -7,9 +7,9 @@ eKuiper provides a variety of elements for building queries. They are summarized
 | --------------------- | ------------------------------------------------------------ |
 | [SELECT](#select)     | SELECT is used to retrieve rows from input streams and enables the selection of one or many columns from one or many input streams in eKuiper. |
 | [FROM](#from)         | FROM specifies the input stream. The FROM clause is always required for any SELECT statement. |
-| [JOIN](#join)         | JOIN is used to combine records from two or more input streams. JOIN includes LEFT, RIGHT, FULL & CROSS. |
+| [JOIN](#join)         | JOIN is used to combine records from two or more input streams. JOIN includes LEFT, RIGHT, FULL & CROSS. Join can apply to multiple streams join or stream/table join. To join multiple streams, it must run within a [window](./windows.md). |
 | [WHERE](#where)       | WHERE specifies the search condition for the rows returned by the query. |
-| [GROUP BY](#group-by) | GROUP BY groups a selected set of rows into a set of summary rows grouped by the values of one or more columns or expressions. |
+| [GROUP BY](#group-by) | GROUP BY groups a selected set of rows into a set of summary rows grouped by the values of one or more columns or expressions. It must run within a [window](./windows.md). |
 | [ORDER BY](#order-by) | Order the rows by values of one or more columns.             |
 | [HAVING](#having)     | HAVING specifies a search condition for a group or an aggregate. HAVING can be used only with the SELECT expression.             |
 

+ 2 - 2
docs/zh_CN/sqls/query_language_elements.md

@@ -7,9 +7,9 @@ eKuiper 提供了用于构建查询的各种元素。 总结如下。
 | --------------------- | ------------------------------------------------------------ |
 | [SELECT](#select)     | SELECT 用于从输入流中检索行,并允许从 eKuiper 中的一个或多个输入流中选择一个或多个列。 |
 | [FROM](#from)         | FROM 指定输入流。 任何 SELECT 语句始终需要 FROM 子句。       |
-| [JOIN](#join)         | JOIN 用于合并来自两个或更多输入流的记录。 JOIN 包括 LEFT,RIGHT,FULL 和 CROSS。 |
+| [JOIN](#join)         | JOIN 用于合并来自两个或更多输入流的记录。 JOIN 包括 LEFT,RIGHT,FULL 和 CROSS。JOIN 可用于多个流或者流和表格。当用于多个流时,必须运行在[窗口](./windows.md)中,否则每次单条数据,JOIN 没有意义。|
 | [WHERE](#where)       | WHERE 指定查询返回的行的搜索条件。                           |
-| [GROUP BY](#group-by) | GROUP BY 将一组选定的行分组为一组汇总行,这些汇总行按一个或多个列或表达式的值分组。 |
+| [GROUP BY](#group-by) | GROUP BY 将一组选定的行分组为一组汇总行,这些汇总行按一个或多个列或表达式的值分组。该语句必须运行在[窗口](./windows.md)中。 |
 | [ORDER BY](#order-by) | 按一列或多列的值对行进行排序。                               |
 | [HAVING](#having)     | HAVING 为组或集合指定搜索条件。 HAVING 只能与 SELECT 表达式一起使用。 |
 |                       |                                                              |

+ 1 - 1
internal/topo/planner/planner.go

@@ -266,7 +266,7 @@ func createLogicalPlan(stmt *ast.SelectStatement, opt *api.RuleOption, store kv.
 			p.SetChildren(append(children, tableChildren...))
 			children = []LogicalPlan{p}
 		} else if w == nil {
-			return nil, errors.New("need to run stream join in windows")
+			return nil, errors.New("a time window or count window is required to join multiple streams")
 		}
 		// TODO extract on filter
 		p = JoinPlan{