Merge branch '3.0' into feat/sangshuduo/TD-14141-update-taostools-for3.0

This commit is contained in:
Shuduo Sang 2022-08-01 18:48:28 +08:00
commit c10b8b290f
96 changed files with 2004 additions and 2383 deletions

View File

@ -163,18 +163,6 @@ option(
ON ON
) )
option(
BUILD_WITH_CRAFT
"If build with canonical-raft"
OFF
)
option(
BUILD_WITH_TRAFT
"If build with traft"
OFF
)
IF(${TD_LINUX} MATCHES TRUE) IF(${TD_LINUX} MATCHES TRUE)
option( option(

View File

@ -1,14 +0,0 @@
# canonical-raft
ExternalProject_Add(craft
GIT_REPOSITORY https://github.com/canonical/raft.git
GIT_TAG v0.11.2
SOURCE_DIR "${TD_CONTRIB_DIR}/craft"
BINARY_DIR "${TD_CONTRIB_DIR}/craft"
#BUILD_IN_SOURCE TRUE
# https://answers.ros.org/question/333125/how-to-include-external-automakeautoconf-projects-into-ament_cmake/
CONFIGURE_COMMAND COMMAND autoreconf -i COMMAND ./configure --enable-example
BUILD_COMMAND "$(MAKE)"
INSTALL_COMMAND ""
TEST_COMMAND ""
)

View File

@ -1,14 +0,0 @@
# traft
ExternalProject_Add(traft
GIT_REPOSITORY https://github.com/taosdata/traft.git
GIT_TAG for_3.0
SOURCE_DIR "${TD_CONTRIB_DIR}/traft"
BINARY_DIR "${TD_CONTRIB_DIR}/traft"
#BUILD_IN_SOURCE TRUE
# https://answers.ros.org/question/333125/how-to-include-external-automakeautoconf-projects-into-ament_cmake/
CONFIGURE_COMMAND COMMAND autoreconf -i COMMAND ./configure
BUILD_COMMAND "$(MAKE)"
INSTALL_COMMAND ""
TEST_COMMAND ""
)

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/taosdata/driver-go/v2/af" "github.com/taosdata/driver-go/v3/af"
) )
func main() { func main() {

View File

@ -4,7 +4,7 @@ import (
"database/sql" "database/sql"
"fmt" "fmt"
_ "github.com/taosdata/driver-go/v2/taosSql" _ "github.com/taosdata/driver-go/v3/taosSql"
) )
func main() { func main() {

View File

@ -4,7 +4,7 @@ import (
"database/sql" "database/sql"
"fmt" "fmt"
_ "github.com/taosdata/driver-go/v2/taosRestful" _ "github.com/taosdata/driver-go/v3/taosRestful"
) )
func main() { func main() {

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/taosdata/driver-go/v2/wrapper" "github.com/taosdata/driver-go/v3/wrapper"
) )
func main() { func main() {

View File

@ -2,5 +2,5 @@ module goexample
go 1.17 go 1.17
require github.com/taosdata/driver-go/v2 develop require github.com/taosdata/driver-go/v3 3.0

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/taosdata/driver-go/v2/af" "github.com/taosdata/driver-go/v3/af"
) )
func prepareDatabase(conn *af.Connector) { func prepareDatabase(conn *af.Connector) {

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/taosdata/driver-go/v2/af" "github.com/taosdata/driver-go/v3/af"
) )
func prepareDatabase(conn *af.Connector) { func prepareDatabase(conn *af.Connector) {

View File

@ -4,7 +4,7 @@ import (
"database/sql" "database/sql"
"fmt" "fmt"
_ "github.com/taosdata/driver-go/v2/taosRestful" _ "github.com/taosdata/driver-go/v3/taosRestful"
) )
func createStable(taos *sql.DB) { func createStable(taos *sql.DB) {

View File

@ -4,9 +4,9 @@ import (
"fmt" "fmt"
"time" "time"
"github.com/taosdata/driver-go/v2/af" "github.com/taosdata/driver-go/v3/af"
"github.com/taosdata/driver-go/v2/af/param" "github.com/taosdata/driver-go/v3/af/param"
"github.com/taosdata/driver-go/v2/common" "github.com/taosdata/driver-go/v3/common"
) )
func checkErr(err error, prompt string) { func checkErr(err error, prompt string) {

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/taosdata/driver-go/v2/af" "github.com/taosdata/driver-go/v3/af"
) )
func prepareDatabase(conn *af.Connector) { func prepareDatabase(conn *af.Connector) {

View File

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"time" "time"
_ "github.com/taosdata/driver-go/v2/taosRestful" _ "github.com/taosdata/driver-go/v3/taosRestful"
) )
func main() { func main() {

View File

@ -1,53 +1,120 @@
package main package main
import ( import (
"database/sql/driver" "context"
"encoding/json"
"fmt" "fmt"
"io" "strconv"
"os"
"time" "time"
taos "github.com/taosdata/driver-go/v2/af" "github.com/taosdata/driver-go/v3/af"
"github.com/taosdata/driver-go/v3/af/tmq"
"github.com/taosdata/driver-go/v3/common"
"github.com/taosdata/driver-go/v3/errors"
"github.com/taosdata/driver-go/v3/wrapper"
) )
func main() { func main() {
db, err := taos.Open("", "", "", "log", 0) db, err := af.Open("", "root", "taosdata", "", 0)
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, err) panic(err)
os.Exit(1)
} }
defer db.Close() defer db.Close()
topic, err := db.Subscribe(false, "taoslogtail", "select ts, level, ipaddr, content from log", time.Second) _, err = db.Exec("create database if not exists example_tmq")
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, err) panic(err)
os.Exit(2)
} }
defer topic.Unsubscribe(true) _, err = db.Exec("create topic if not exists example_tmq_topic with meta as DATABASE example_tmq")
for {
func() {
rows, err := topic.Consume()
defer func() { rows.Close(); time.Sleep(time.Second) }()
if err != nil { if err != nil {
fmt.Println(err) panic(err)
os.Exit(3) }
config := tmq.NewConfig()
defer config.Destroy()
err = config.SetGroupID("test")
if err != nil {
panic(err)
}
err = config.SetAutoOffsetReset("earliest")
if err != nil {
panic(err)
}
err = config.SetConnectIP("127.0.0.1")
if err != nil {
panic(err)
}
err = config.SetConnectUser("root")
if err != nil {
panic(err)
}
err = config.SetConnectPass("taosdata")
if err != nil {
panic(err)
}
err = config.SetConnectPort("6030")
if err != nil {
panic(err)
}
err = config.SetMsgWithTableName(true)
if err != nil {
panic(err)
}
err = config.EnableHeartBeat()
if err != nil {
panic(err)
}
err = config.EnableAutoCommit(func(result *wrapper.TMQCommitCallbackResult) {
if result.ErrCode != 0 {
errStr := wrapper.TMQErr2Str(result.ErrCode)
err := errors.NewError(int(result.ErrCode), errStr)
panic(err)
}
})
if err != nil {
panic(err)
}
consumer, err := tmq.NewConsumer(config)
if err != nil {
panic(err)
}
err = consumer.Subscribe([]string{"example_tmq_topic"})
if err != nil {
panic(err)
}
_, err = db.Exec("create table example_tmq.t1 (ts timestamp,v int)")
if err != nil {
panic(err)
} }
for { for {
values := make([]driver.Value, 4) result, err := consumer.Poll(time.Second)
err := rows.Next(values) if err != nil {
if err == io.EOF { panic(err)
}
if result.Type != common.TMQ_RES_TABLE_META {
panic("want message type 2 got " + strconv.Itoa(int(result.Type)))
}
data, _ := json.Marshal(result.Meta)
fmt.Println(string(data))
consumer.Commit(context.Background(), result.Message)
consumer.FreeMessage(result.Message)
break break
} else if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(4)
} }
ts := values[0].(time.Time) _, err = db.Exec("insert into example_tmq.t1 values(now,1)")
level := values[1].(int8) if err != nil {
ipaddr := values[2].(string) panic(err)
content := values[3].(string)
fmt.Printf("%s %d %s %s\n", ts.Format(time.StampMilli), level, ipaddr, content)
} }
}() for {
result, err := consumer.Poll(time.Second)
if err != nil {
panic(err)
} }
if result.Type != common.TMQ_RES_DATA {
panic("want message type 1 got " + strconv.Itoa(int(result.Type)))
}
data, _ := json.Marshal(result.Data)
fmt.Println(string(data))
consumer.Commit(context.Background(), result.Message)
consumer.FreeMessage(result.Message)
break
}
consumer.Close()
} }
// 未完成

View File

@ -4,11 +4,11 @@ sidebar_label: 文档首页
slug: / slug: /
--- ---
TDengine 是一款[高性能](https://www.taosdata.com/fast)、[分布式](https://www.taosdata.com/scalable)、[支持 SQL](https://www.taosdata.com/sql-support) 的时序数据库 (Database)。本文档是 TDengine 用户手册,主要是介绍 TDengine 的基本概念、安装、使用、功能、开发接口、运营维护、TDengine 内核设计等等,它主要是面向架构师、开发者与系统管理员的。 TDengine是一款开源、[高性能](https://www.taosdata.com/fast)、云原生的专为物联网、工业互联网、金融等优化设计的时序数据库(Time-Series Database)。同时它还带有内建的缓存、流式计算、数据订阅等系统功能,能大幅减少系统设计的复杂度,降低研发和运营成本,是一极简的时序数据处理平台。本文档是 TDengine 用户手册,主要是介绍 TDengine 的基本概念、安装、使用、功能、开发接口、运营维护、TDengine 内核设计等等,它主要是面向架构师、开发者与系统管理员的。
TDengine 充分利用了时序数据的特点提出了“一个数据采集点一张表”与“超级表”的概念设计了创新的存储引擎让数据的写入、查询和存储效率都得到极大的提升。为正确理解并使用TDengine, 无论如何,请您仔细阅读[基本概念](./concept)一章。 TDengine 充分利用了时序数据的特点提出了“一个数据采集点一张表”与“超级表”的概念设计了创新的存储引擎让数据的写入、查询和存储效率都得到极大的提升。为正确理解并使用TDengine, 无论如何,请您仔细阅读[基本概念](./concept)一章。
如果你是开发者,请一定仔细阅读[开发指南](./develop)一章,该部分对数据库连接、建模、插入数据、查询、连续查询、缓存、数据订阅、用户自定义函数等功能都做了详细介绍,并配有各种编程语言的示例代码。大部分情况下,你只要把示例代码拷贝粘贴,针对自己的应用稍作改动,就能跑起来。 如果你是开发者,请一定仔细阅读[开发指南](./develop)一章,该部分对数据库连接、建模、插入数据、查询、流式计算、缓存、数据订阅、用户自定义函数等功能都做了详细介绍,并配有各种编程语言的示例代码。大部分情况下,你只要把示例代码拷贝粘贴,针对自己的应用稍作改动,就能跑起来。
我们已经生活在大数据的时代,纵向扩展已经无法满足日益增长的业务需求,任何系统都必须具有水平扩展的能力,集群成为大数据以及 database 系统的不可缺失功能。TDengine 团队不仅实现了集群功能,而且将这一重要核心功能开源。怎么部署、管理和维护 TDengine 集群,请参考[集群管理](./cluster)一章。 我们已经生活在大数据的时代,纵向扩展已经无法满足日益增长的业务需求,任何系统都必须具有水平扩展的能力,集群成为大数据以及 database 系统的不可缺失功能。TDengine 团队不仅实现了集群功能,而且将这一重要核心功能开源。怎么部署、管理和维护 TDengine 集群,请参考[集群管理](./cluster)一章。

View File

@ -5,7 +5,7 @@ title: REST API
为支持各种不同类型平台的开发TDengine 提供符合 REST 设计标准的 API即 REST API。为最大程度降低学习成本不同于其他数据库 REST API 的设计方法TDengine 直接通过 HTTP POST 请求 BODY 中包含的 SQL 语句来操作数据库,仅需要一个 URL。REST 连接器的使用参见[视频教程](https://www.taosdata.com/blog/2020/11/11/1965.html)。 为支持各种不同类型平台的开发TDengine 提供符合 REST 设计标准的 API即 REST API。为最大程度降低学习成本不同于其他数据库 REST API 的设计方法TDengine 直接通过 HTTP POST 请求 BODY 中包含的 SQL 语句来操作数据库,仅需要一个 URL。REST 连接器的使用参见[视频教程](https://www.taosdata.com/blog/2020/11/11/1965.html)。
:::note :::note
与原生连接器的一个区别是RESTful 接口是无状态的,因此 `USE db_name` 指令没有效果,所有对表名、超级表名的引用都需要指定数据库名前缀。从 2.2.0.0 版本开始,支持在 RESTful URL 中指定 db_name这时如果 SQL 语句中没有指定数据库名前缀的话,会使用 URL 中指定的这个 db_name。从 2.4.0.0 版本开始RESTful 默认由 taosAdapter 提供,要求必须在 URL 中指定 db_name。 与原生连接器的一个区别是RESTful 接口是无状态的,因此 `USE db_name` 指令没有效果,所有对表名、超级表名的引用都需要指定数据库名前缀。支持在 RESTful URL 中指定 db_name这时如果 SQL 语句中没有指定数据库名前缀的话,会使用 URL 中指定的这个 db_name。
::: :::
## 安装 ## 安装
@ -28,54 +28,204 @@ curl -L -H "Authorization: Basic cm9vdDp0YW9zZGF0YQ==" -d "show databases;" h1.t
```json ```json
{ {
"status": "succ", "code": 0,
"head": [ "column_meta": [
[
"name", "name",
"created_time", "VARCHAR",
"ntables", 64
],
[
"create_time",
"TIMESTAMP",
8
],
[
"vgroups", "vgroups",
"SMALLINT",
2
],
[
"ntables",
"BIGINT",
8
],
[
"replica", "replica",
"quorum", "TINYINT",
"days", 1
"keep1,keep2,keep(D)", ],
"cache(MB)", [
"blocks", "strict",
"VARCHAR",
4
],
[
"duration",
"VARCHAR",
10
],
[
"keep",
"VARCHAR",
32
],
[
"buffer",
"INT",
4
],
[
"pagesize",
"INT",
4
],
[
"pages",
"INT",
4
],
[
"minrows", "minrows",
"INT",
4
],
[
"maxrows", "maxrows",
"wallevel", "INT",
"fsync", 4
],
[
"comp", "comp",
"TINYINT",
1
],
[
"precision", "precision",
"status" "VARCHAR",
2
],
[
"status",
"VARCHAR",
10
],
[
"retention",
"VARCHAR",
60
],
[
"single_stable",
"BOOL",
1
],
[
"cachemodel",
"VARCHAR",
11
],
[
"cachesize",
"INT",
4
],
[
"wal_level",
"TINYINT",
1
],
[
"wal_fsync_period",
"INT",
4
],
[
"wal_retention_period",
"INT",
4
],
[
"wal_retention_size",
"BIGINT",
8
],
[
"wal_roll_period",
"INT",
4
],
[
"wal_seg_size",
"BIGINT",
8
]
], ],
"data": [ "data": [
[ [
"log", "information_schema",
"2020-09-02 17:23:00.039", null,
4, null,
1, 14,
1, null,
1, null,
10, null,
"30,30,30", null,
1, null,
null,
null,
null,
null,
null,
null,
"ready",
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
],
[
"performance_schema",
null,
null,
3, 3,
100, null,
4096, null,
1, null,
3000, null,
2, null,
"us", null,
"ready" null,
null,
null,
null,
null,
"ready",
null,
null,
null,
null,
null,
null,
null,
null,
null,
null
] ]
], ],
"rows": 1 "rows": 2
} }
``` ```
## HTTP 请求格式 ## HTTP 请求格式
``` ```text
http://<fqdn>:<port>/rest/sql/[db_name] http://<fqdn>:<port>/rest/sql/[db_name]
``` ```
@ -83,21 +233,21 @@ http://<fqdn>:<port>/rest/sql/[db_name]
- fqnd: 集群中的任一台主机 FQDN 或 IP 地址 - fqnd: 集群中的任一台主机 FQDN 或 IP 地址
- port: 配置文件中 httpPort 配置项,缺省为 6041 - port: 配置文件中 httpPort 配置项,缺省为 6041
- db_name: 可选参数,指定本次所执行的 SQL 语句的默认数据库库名。(从 2.2.0.0 版本开始支持) - db_name: 可选参数,指定本次所执行的 SQL 语句的默认数据库库名。
例如:`http://h1.taos.com:6041/rest/sql/test` 是指向地址为 `h1.taos.com:6041` 的 URL并将默认使用的数据库库名设置为 `test`。 例如:`http://h1.taos.com:6041/rest/sql/test` 是指向地址为 `h1.taos.com:6041` 的 URL并将默认使用的数据库库名设置为 `test`。
HTTP 请求的 Header 里需带有身份认证信息TDengine 支持 Basic 认证与自定义认证两种机制,后续版本将提供标准安全的数字签名机制来做身份验证。 HTTP 请求的 Header 里需带有身份认证信息TDengine 支持 Basic 认证与自定义认证两种机制,后续版本将提供标准安全的数字签名机制来做身份验证。
- 自定义身份认证信息如下所示token 稍后介绍) - [自定义身份认证信息](#自定义授权码)如下所示
``` ```text
Authorization: Taosd <TOKEN> Authorization: Taosd <TOKEN>
``` ```
- Basic 身份认证信息如下所示 - Basic 身份认证信息如下所示
``` ```text
Authorization: Basic <TOKEN> Authorization: Basic <TOKEN>
``` ```
@ -119,41 +269,165 @@ curl -L -u username:password -d "<SQL>" <ip>:<PORT>/rest/sql/[db_name]
## HTTP 返回格式 ## HTTP 返回格式
返回值为 JSON 格式,如下: ### HTTP 响应码
| **response code** | **说明** |
|-------------------|----------------|
| 200 | 正确返回和 C 接口错误返回 |
| 400 | 参数错误返回 |
| 401 | 鉴权失败 |
| 404 | 接口不存在 |
| 500 | 内部错误 |
| 503 | 系统资源不足 |
### HTTP body 结构
<table>
<tr>
<th>执行结果</th>
<th>说明</th>
<th>样例</th>
</tr>
<tr>
<td>正确执行</td>
<td>
codeint0 代表成功
<br/>
<br/>
column_meta[][3]any列信息每个列会用三个值来说明分别为列名(string)、列类型(string)、类型长度(int)
<br/>
<br/>
rowsint数据返回行数
<br/>
<br/>
data[][]any具体数据内容
</td>
<td>
```json ```json
{ {
"status": "succ", "code": 0,
"head": ["ts","current", …], "column_meta": [["affected_rows", "INT", 4]],
"column_meta": [["ts",9,8],["current",6,4], …], "data": [[0]],
"data": [ "rows": 1
["2018-10-03 14:38:05.000", 10.3, …],
["2018-10-03 14:38:15.000", 12.6, …]
],
"rows": 2
} }
``` ```
说明: </td>
</tr>
<tr>
<td>正确查询</td>
<td>
codeint0 代表成功
<br/>
<br/>
column_meta[][3]any 列信息每个列会用三个值来说明分别为列名string、列类型string、类型长度int
<br/>
<br/>
rowsint数据返回行数
<br/>
<br/>
data[][]any具体数据内容
</td>
<td>
- status: 告知操作结果是成功还是失败。 ```json
- head: 表的定义,如果不返回结果集,则仅有一列 “affected_rows”。从 2.0.17.0 版本开始,建议不要依赖 head 返回值来判断数据列类型,而推荐使用 column_meta。在后续版本中有可能会从返回值中去掉 head 这一项。) {
- column_meta: 从 2.0.17.0 版本开始,返回值中增加这一项来说明 data 里每一列的数据类型。具体每个列会用三个值来说明,分别为:列名、列类型、类型长度。例如`["current",6,4]`表示列名为“current”列类型为 6也即 float 类型;类型长度为 4也即对应 4 个字节表示的 float。如果列类型为 binary 或 nchar则类型长度表示该列最多可以保存的内容长度而不是本次返回值中的具体数据长度。当列类型是 nchar 的时候,其类型长度表示可以保存的 unicode 字符数量,而不是 bytes。 "code": 0,
- data: 具体返回的数据,一行一行的呈现,如果不返回结果集,那么就仅有 [[affected_rows]]。data 中每一行的数据列顺序,与 column_meta 中描述数据列的顺序完全一致。 "column_meta": [
- rows: 表明总共多少行数据。 ["ts", "TIMESTAMP", 8],
["count", "BIGINT", 8],
["endpoint", "VARCHAR", 45],
["status_code", "INT", 4],
["client_ip", "VARCHAR", 40],
["request_method", "VARCHAR", 15],
["request_uri", "VARCHAR", 128]
],
"data": [
[
"2022-06-29T05:50:55.401Z",
2,
"LAPTOP-NNKFTLTG:6041",
200,
"172.23.208.1",
"POST",
"/rest/sql"
],
[
"2022-06-29T05:52:16.603Z",
1,
"LAPTOP-NNKFTLTG:6041",
200,
"172.23.208.1",
"POST",
"/rest/sql"
],
[
"2022-06-29T06:28:14.118Z",
1,
"LAPTOP-NNKFTLTG:6041",
200,
"172.23.208.1",
"POST",
"/rest/sql"
],
[
"2022-06-29T05:52:16.603Z",
2,
"LAPTOP-NNKFTLTG:6041",
401,
"172.23.208.1",
"POST",
"/rest/sql"
]
],
"rows": 4
}
```
column_meta 中的列类型说明: </td>
</tr>
<tr>
<td>错误</td>
<td>
codeint错误码
<br/>
<br/>
descstring错误描述
</td>
<td>
- 1BOOL ```json
- 2TINYINT {
- 3SMALLINT "code": 9728,
- 4INT "desc": "syntax error near \"1\""
- 5BIGINT }
- 6FLOAT ```
- 7DOUBLE
- 8BINARY </td>
- 9TIMESTAMP </tr>
- 10NCHAR </table>
### 说明
- 时间格式仅支持 RFC3339结果集为 0 时区
- 列类型使用如下字符串:
> "NULL"
> "BOOL"
> "TINYINT"
> "SMALLINT"
> "INT"
> "BIGINT"
> "FLOAT"
> "DOUBLE"
> "VARCHAR"
> "TIMESTAMP"
> "NCHAR"
> "TINYINT UNSIGNED"
> "SMALLINT UNSIGNED"
> "INT UNSIGNED"
> "BIGINT UNSIGNED"
> "JSON"
## 自定义授权码 ## 自定义授权码
@ -199,17 +473,42 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata
```json ```json
{ {
"status": "succ", "code": 0,
"head": ["ts", "current", "voltage", "phase"],
"column_meta": [ "column_meta": [
["ts", 9, 8], [
["current", 6, 4], "ts",
["voltage", 4, 4], "TIMESTAMP",
["phase", 6, 4] 8
],
[
"current",
"FLOAT",
4
],
[
"voltage",
"INT",
4
],
[
"phase",
"FLOAT",
4
]
], ],
"data": [ "data": [
["2018-10-03 14:38:05.000", 10.3, 219, 0.31], [
["2018-10-03 14:38:15.000", 12.6, 218, 0.33] "2022-07-30T06:44:40.32Z",
10.3,
219,
0.31
],
[
"2022-07-30T06:44:41.32Z",
12.6,
218,
0.33
]
], ],
"rows": 2 "rows": 2
} }
@ -225,83 +524,23 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata
```json ```json
{ {
"status": "succ", "code": 0,
"head": ["affected_rows"], "column_meta": [
"column_meta": [["affected_rows", 4, 4]], [
"data": [[1]], "affected_rows",
"INT",
4
]
],
"data": [
[
0
]
],
"rows": 1 "rows": 1
} }
``` ```
## 其他用法 ## 参考
### 结果集采用 Unix 时间戳 [taosAdapter](/reference/taosadapter/)
HTTP 请求 URL 采用 `/rest/sqlt` 时,返回结果集的时间戳将采用 Unix 时间戳格式表示,例如
```bash
curl -L -H "Authorization: Basic cm9vdDp0YW9zZGF0YQ==" -d "select * from demo.d1001" 192.168.0.1:6041/rest/sqlt
```
返回结果:
```json
{
"status": "succ",
"head": ["ts", "current", "voltage", "phase"],
"column_meta": [
["ts", 9, 8],
["current", 6, 4],
["voltage", 4, 4],
["phase", 6, 4]
],
"data": [
[1538548685000, 10.3, 219, 0.31],
[1538548695000, 12.6, 218, 0.33]
],
"rows": 2
}
```
### 结果集采用 UTC 时间字符串
HTTP 请求 URL 采用 `/rest/sqlutc` 时,返回结果集的时间戳将采用 UTC 时间字符串表示,例如
```bash
curl -L -H "Authorization: Basic cm9vdDp0YW9zZGF0YQ==" -d "select * from demo.t1" 192.168.0.1:6041/rest/sqlutc
```
返回值:
```json
{
"status": "succ",
"head": ["ts", "current", "voltage", "phase"],
"column_meta": [
["ts", 9, 8],
["current", 6, 4],
["voltage", 4, 4],
["phase", 6, 4]
],
"data": [
["2018-10-03T14:38:05.000+0800", 10.3, 219, 0.31],
["2018-10-03T14:38:15.000+0800", 12.6, 218, 0.33]
],
"rows": 2
}
```
## 重要配置项
下面仅列出一些与 RESTful 接口有关的配置参数,其他系统参数请看配置文件里的说明。
- 对外提供 RESTful 服务的端口号,默认绑定到 6041实际取值是 serverPort + 11因此可以通过修改 serverPort 参数的设置来修改)。
- httpMaxThreads: 启动的线程数量,默认为 22.0.17.0 版本开始,默认值改为 CPU 核数的一半向下取整)。
- restfulRowLimit: 返回结果集JSON 格式)的最大条数,默认值为 10240。
- httpEnableCompress: 是否支持压缩,默认不支持,目前 TDengine 仅支持 gzip 压缩格式。
- httpDebugFlag: 日志开关,默认 131。131仅错误和报警信息135调试信息143非常详细的调试信息。
- httpDbNameMandatory: 是否必须在 RESTful URL 中指定默认的数据库名。默认为 0即关闭此检查。如果设置为 1那么每个 RESTful URL 中都必须设置一个默认数据库名,否则无论此时执行的 SQL 语句是否需要指定数据库,都会返回一个执行错误,拒绝执行此 SQL 语句。
:::note
如果使用 taosd 提供的 REST API, 那么以上配置需要写在 taosd 的配置文件 taos.cfg 中。如果使用 taosAdapter 提供的 REST API, 那么需要参考 taosAdapter [对应的配置方法](/reference/taosadapter/)。
:::

View File

@ -65,7 +65,7 @@ REST 连接支持所有能运行 Go 的平台。
### 使用 go get 安装 ### 使用 go get 安装
`go get -u github.com/taosdata/driver-go/v2@develop` `go get -u github.com/taosdata/driver-go/v3@latest`
### 使用 go mod 管理 ### 使用 go mod 管理
@ -80,7 +80,7 @@ REST 连接支持所有能运行 Go 的平台。
```go ```go
import ( import (
"database/sql" "database/sql"
_ "github.com/taosdata/driver-go/v2/taosSql" _ "github.com/taosdata/driver-go/v3/taosSql"
) )
``` ```
@ -132,7 +132,7 @@ import (
"database/sql" "database/sql"
"fmt" "fmt"
_ "github.com/taosdata/driver-go/v2/taosSql" _ "github.com/taosdata/driver-go/v3/taosSql"
) )
func main() { func main() {
@ -164,7 +164,7 @@ import (
"database/sql" "database/sql"
"fmt" "fmt"
_ "github.com/taosdata/driver-go/v2/taosRestful" _ "github.com/taosdata/driver-go/v3/taosRestful"
) )
func main() { func main() {
@ -205,14 +205,14 @@ func main() {
### 更多示例程序 ### 更多示例程序
* [示例程序](https://github.com/taosdata/TDengine/tree/develop/examples/go) * [示例程序](https://github.com/taosdata/driver-go/tree/3.0/examples)
* [视频教程](https://www.taosdata.com/blog/2020/11/11/1951.html)。 * [视频教程](https://www.taosdata.com/blog/2020/11/11/1951.html)。
## 使用限制 ## 使用限制
由于 REST 接口无状态所以 `use db` 语法不会生效,需要将 db 名称放到 SQL 语句中,如:`create table if not exists tb1 (ts timestamp, a int)`改为`create table if not exists test.tb1 (ts timestamp, a int)`否则将报错`[0x217] Database not specified or available`。 由于 REST 接口无状态所以 `use db` 语法不会生效,需要将 db 名称放到 SQL 语句中,如:`create table if not exists tb1 (ts timestamp, a int)`改为`create table if not exists test.tb1 (ts timestamp, a int)`否则将报错`[0x217] Database not specified or available`。
也可以将 db 名称放到 DSN 中,将 `root:taosdata@http(localhost:6041)/` 改为 `root:taosdata@http(localhost:6041)/test`,此方法在 TDengine 2.4.0.5 版本的 taosAdapter 开始支持。当指定的 db 不存在时执行 `create database` 语句不会报错,而执行针对该 db 的其他查询或写入操作会报错。 也可以将 db 名称放到 DSN 中,将 `root:taosdata@http(localhost:6041)/` 改为 `root:taosdata@http(localhost:6041)/test`。当指定的 db 不存在时执行 `create database` 语句不会报错,而执行针对该 db 的其他查询或写入操作会报错。
完整示例如下: 完整示例如下:
@ -224,7 +224,7 @@ import (
"fmt" "fmt"
"time" "time"
_ "github.com/taosdata/driver-go/v2/taosRestful" _ "github.com/taosdata/driver-go/v3/taosRestful"
) )
func main() { func main() {
@ -266,35 +266,27 @@ func main() {
## 常见问题 ## 常见问题
1. 无法找到包 `github.com/taosdata/driver-go/v2/taosRestful` 1. database/sql 中 stmt参数绑定相关接口崩溃
将 `go.mod` 中 require 块对`github.com/taosdata/driver-go/v2`的引用改为`github.com/taosdata/driver-go/v2 develop`,之后执行 `go mod tidy`。
2. database/sql 中 stmt参数绑定相关接口崩溃
REST 不支持参数绑定相关接口,建议使用`db.Exec`和`db.Query`。 REST 不支持参数绑定相关接口,建议使用`db.Exec`和`db.Query`。
3. 使用 `use db` 语句后执行其他语句报错 `[0x217] Database not specified or available` 2. 使用 `use db` 语句后执行其他语句报错 `[0x217] Database not specified or available`
在 REST 接口中 SQL 语句的执行无上下文关联,使用 `use db` 语句不会生效,解决办法见上方使用限制章节。 在 REST 接口中 SQL 语句的执行无上下文关联,使用 `use db` 语句不会生效,解决办法见上方使用限制章节。
4. 使用 taosSql 不报错使用 taosRestful 报错 `[0x217] Database not specified or available` 3. 使用 taosSql 不报错使用 taosRestful 报错 `[0x217] Database not specified or available`
因为 REST 接口无状态,使用 `use db` 语句不会生效,解决办法见上方使用限制章节。 因为 REST 接口无状态,使用 `use db` 语句不会生效,解决办法见上方使用限制章节。
5. 升级 `github.com/taosdata/driver-go/v2/taosRestful` 4. `readBufferSize` 参数调大后无明显效果
将 `go.mod` 文件中对 `github.com/taosdata/driver-go/v2` 的引用改为 `github.com/taosdata/driver-go/v2 develop`,之后执行 `go mod tidy`。
6. `readBufferSize` 参数调大后无明显效果
`readBufferSize` 调大后会减少获取结果时 `syscall` 的调用。如果查询结果的数据量不大,修改该参数不会带来明显提升,如果该参数修改过大,瓶颈会在解析 JSON 数据。如果需要优化查询速度,需要根据实际情况调整该值来达到查询效果最优。 `readBufferSize` 调大后会减少获取结果时 `syscall` 的调用。如果查询结果的数据量不大,修改该参数不会带来明显提升,如果该参数修改过大,瓶颈会在解析 JSON 数据。如果需要优化查询速度,需要根据实际情况调整该值来达到查询效果最优。
7. `disableCompression` 参数设置为 `false` 时查询效率降低 5. `disableCompression` 参数设置为 `false` 时查询效率降低
当 `disableCompression` 参数设置为 `false` 时查询结果会使用 `gzip` 压缩后传输,拿到数据后要先进行 `gzip` 解压。 当 `disableCompression` 参数设置为 `false` 时查询结果会使用 `gzip` 压缩后传输,拿到数据后要先进行 `gzip` 解压。
8. `go get` 命令无法获取包,或者获取包超时 6. `go get` 命令无法获取包,或者获取包超时
设置 Go 代理 `go env -w GOPROXY=https://goproxy.cn,direct`。 设置 Go 代理 `go env -w GOPROXY=https://goproxy.cn,direct`。
@ -334,17 +326,33 @@ func main() {
#### 订阅 #### 订阅
* `func (conn *Connector) Subscribe(restart bool, topic string, sql string, interval time.Duration) (Subscriber, error)` * `func NewConsumer(conf *Config) (*Consumer, error)`
订阅数据 创建消费者
* `func (s *taosSubscriber) Consume() (driver.Rows, error)` * `func (c *Consumer) Subscribe(topics []string) error`
消费订阅数据,返回 `database/sql/driver` 包的 `Rows` 结构 订阅主题
* `func (s *taosSubscriber) Unsubscribe(keepProgress bool)` * `func (c *Consumer) Poll(timeout time.Duration) (*Result, error)`
取消订阅数据。 轮询消息。
* `func (c *Consumer) Commit(ctx context.Context, message unsafe.Pointer) error`
提交消息。
* `func (c *Consumer) FreeMessage(message unsafe.Pointer)`
释放消息。
* `func (c *Consumer) Unsubscribe() error`
取消订阅。
* `func (c *Consumer) Close() error`
关闭消费者。
#### schemaless #### schemaless
@ -366,10 +374,6 @@ func main() {
参数绑定单行插入。 参数绑定单行插入。
* `func (conn *Connector) StmtQuery(sql string, params *param.Param) (rows driver.Rows, err error)`
参数绑定查询,返回 `database/sql/driver` 包的 `Rows` 结构。
* `func (conn *Connector) InsertStmt() *insertstmt.InsertStmt` * `func (conn *Connector) InsertStmt() *insertstmt.InsertStmt`
初始化参数。 初始化参数。
@ -408,4 +412,4 @@ func main() {
## API 参考 ## API 参考
全部 API 见 [driver-go 文档](https://pkg.go.dev/github.com/taosdata/driver-go/v2) 全部 API 见 [driver-go 文档](https://pkg.go.dev/github.com/taosdata/driver-go/v3)

View File

@ -56,7 +56,6 @@ enum {
STREAM_INPUT__DATA_SUBMIT = 1, STREAM_INPUT__DATA_SUBMIT = 1,
STREAM_INPUT__DATA_BLOCK, STREAM_INPUT__DATA_BLOCK,
STREAM_INPUT__MERGED_SUBMIT, STREAM_INPUT__MERGED_SUBMIT,
// STREAM_INPUT__TABLE_SCAN,
STREAM_INPUT__TQ_SCAN, STREAM_INPUT__TQ_SCAN,
STREAM_INPUT__DATA_RETRIEVE, STREAM_INPUT__DATA_RETRIEVE,
STREAM_INPUT__GET_RES, STREAM_INPUT__GET_RES,

View File

@ -202,6 +202,7 @@ bool fmIsForbidStreamFunc(int32_t funcId);
bool fmIsIntervalInterpoFunc(int32_t funcId); bool fmIsIntervalInterpoFunc(int32_t funcId);
bool fmIsInterpFunc(int32_t funcId); bool fmIsInterpFunc(int32_t funcId);
bool fmIsLastRowFunc(int32_t funcId); bool fmIsLastRowFunc(int32_t funcId);
bool fmIsSelectValueFunc(int32_t funcId);
bool fmIsSystemInfoFunc(int32_t funcId); bool fmIsSystemInfoFunc(int32_t funcId);
bool fmIsImplicitTsFunc(int32_t funcId); bool fmIsImplicitTsFunc(int32_t funcId);
bool fmIsClientPseudoColumnFunc(int32_t funcId); bool fmIsClientPseudoColumnFunc(int32_t funcId);

View File

@ -283,6 +283,7 @@ typedef struct SCreateIndexStmt {
EIndexType indexType; EIndexType indexType;
bool ignoreExists; bool ignoreExists;
char indexName[TSDB_INDEX_NAME_LEN]; char indexName[TSDB_INDEX_NAME_LEN];
char dbName[TSDB_DB_NAME_LEN];
char tableName[TSDB_TABLE_NAME_LEN]; char tableName[TSDB_TABLE_NAME_LEN];
SNodeList* pCols; SNodeList* pCols;
SIndexOptions* pOptions; SIndexOptions* pOptions;

View File

@ -34,11 +34,16 @@ typedef struct SUpdateInfo {
TSKEY minTS; TSKEY minTS;
SScalableBf* pCloseWinSBF; SScalableBf* pCloseWinSBF;
SHashObj* pMap; SHashObj* pMap;
STimeWindow scanWindow;
uint64_t scanGroupId;
uint64_t maxVersion;
} SUpdateInfo; } SUpdateInfo;
SUpdateInfo *updateInfoInitP(SInterval* pInterval, int64_t watermark); SUpdateInfo *updateInfoInitP(SInterval* pInterval, int64_t watermark);
SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t watermark); SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t watermark);
bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts); bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts);
void updateInfoSetScanRange(SUpdateInfo *pInfo, STimeWindow* pWin, uint64_t groupId, uint64_t version);
bool updateInfoIgnore(SUpdateInfo *pInfo, STimeWindow* pWin, uint64_t groupId, uint64_t version);
void updateInfoDestroy(SUpdateInfo *pInfo); void updateInfoDestroy(SUpdateInfo *pInfo);
void updateInfoAddCloseWindowSBF(SUpdateInfo *pInfo); void updateInfoAddCloseWindowSBF(SUpdateInfo *pInfo);
void updateInfoDestoryColseWinSBF(SUpdateInfo *pInfo); void updateInfoDestoryColseWinSBF(SUpdateInfo *pInfo);

View File

@ -41,7 +41,7 @@ extern "C" {
#define WAL_REFRESH_MS 1000 #define WAL_REFRESH_MS 1000
#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12) #define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12)
#define WAL_FILE_LEN (WAL_PATH_LEN + 32) #define WAL_FILE_LEN (WAL_PATH_LEN + 32)
#define WAL_MAGIC 0xFAFBFCFDULL #define WAL_MAGIC 0xFAFBFCFDF4F3F2F1ULL
#define WAL_SCAN_BUF_SIZE (1024 * 1024 * 3) #define WAL_SCAN_BUF_SIZE (1024 * 1024 * 3)
typedef enum { typedef enum {

View File

@ -258,6 +258,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_SINGLE_STB_MODE_DB TAOS_DEF_ERROR_CODE(0, 0x03C5) #define TSDB_CODE_MND_SINGLE_STB_MODE_DB TAOS_DEF_ERROR_CODE(0, 0x03C5)
#define TSDB_CODE_MND_INVALID_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x03C6) #define TSDB_CODE_MND_INVALID_SCHEMA_VER TAOS_DEF_ERROR_CODE(0, 0x03C6)
#define TSDB_CODE_MND_STABLE_UID_NOT_MATCH TAOS_DEF_ERROR_CODE(0, 0x03C7) #define TSDB_CODE_MND_STABLE_UID_NOT_MATCH TAOS_DEF_ERROR_CODE(0, 0x03C7)
#define TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA TAOS_DEF_ERROR_CODE(0, 0x03C8)
// mnode-trans // mnode-trans
#define TSDB_CODE_MND_TRANS_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D0) #define TSDB_CODE_MND_TRANS_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D0)

View File

@ -316,6 +316,7 @@ void doDestroyRequest(void *p) {
taosArrayDestroy(pRequest->tableList); taosArrayDestroy(pRequest->tableList);
taosArrayDestroy(pRequest->dbList); taosArrayDestroy(pRequest->dbList);
taosArrayDestroy(pRequest->targetTableList);
destroyQueryExecRes(&pRequest->body.resInfo.execRes); destroyQueryExecRes(&pRequest->body.resInfo.execRes);

View File

@ -1231,9 +1231,7 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) {
colDataAssign(pDst, pSrc, src->info.rows, &src->info); colDataAssign(pDst, pSrc, src->info.rows, &src->info);
} }
dst->info.rows = src->info.rows; dst->info = src->info;
dst->info.window = src->info.window;
dst->info.type = src->info.type;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -1708,9 +1706,9 @@ char* dumpBlockData(SSDataBlock* pDataBlock, const char* flag, char** pDataBuf)
int32_t colNum = taosArrayGetSize(pDataBlock->pDataBlock); int32_t colNum = taosArrayGetSize(pDataBlock->pDataBlock);
int32_t rows = pDataBlock->info.rows; int32_t rows = pDataBlock->info.rows;
int32_t len = 0; int32_t len = 0;
len += snprintf(dumpBuf + len, size - len, "===stream===%s |block type %d|child id %d|group id:%" PRIu64 "|uid:%ld|rows:%d\n", flag, len += snprintf(dumpBuf + len, size - len, "===stream===%s|block type %d|child id %d|group id:%" PRIu64 "|uid:%ld|rows:%d|version:%" PRIu64 "\n", flag,
(int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.groupId, (int32_t)pDataBlock->info.type, pDataBlock->info.childId, pDataBlock->info.groupId,
pDataBlock->info.uid, pDataBlock->info.rows); pDataBlock->info.uid, pDataBlock->info.rows, pDataBlock->info.version);
if (len >= size - 1) return dumpBuf; if (len >= size - 1) return dumpBuf;
for (int32_t j = 0; j < rows; j++) { for (int32_t j = 0; j < rows; j++) {

View File

@ -162,10 +162,7 @@ int32_t tNameGetDbName(const SName* name, char* dst) {
return 0; return 0;
} }
const char* tNameGetDbNameP(const SName* name) { const char* tNameGetDbNameP(const SName* name) { return &name->dbname[0]; }
return &name->dbname[0];
}
int32_t tNameGetFullDbName(const SName* name, char* dst) { int32_t tNameGetFullDbName(const SName* name, char* dst) {
assert(name != NULL && dst != NULL); assert(name != NULL && dst != NULL);
@ -212,7 +209,6 @@ int32_t tNameAddTbName(SName* dst, const char* tbName, size_t nameLen) {
return 0; return 0;
} }
int32_t tNameSetAcctId(SName* dst, int32_t acctId) { int32_t tNameSetAcctId(SName* dst, int32_t acctId) {
assert(dst != NULL); assert(dst != NULL);
dst->acctId = acctId; dst->acctId = acctId;
@ -266,12 +262,22 @@ int32_t tNameFromString(SName* dst, const char* str, uint32_t type) {
char* start = (char*)((p == NULL) ? str : (p + 1)); char* start = (char*)((p == NULL) ? str : (p + 1));
int32_t len = 0; int32_t len = 0;
if (TS_ESCAPE_CHAR == *start) {
++start;
char* end = start;
while ('`' != *end) {
++end;
}
len = end - start;
p = ++end;
} else {
p = strstr(start, TS_PATH_DELIMITER); p = strstr(start, TS_PATH_DELIMITER);
if (p == NULL) { if (p == NULL) {
len = (int32_t)strlen(start); len = (int32_t)strlen(start);
} else { } else {
len = (int32_t)(p - start); len = (int32_t)(p - start);
} }
}
// too long account id or too long db name // too long account id or too long db name
if ((len >= tListLen(dst->dbname)) || (len <= 0)) { if ((len >= tListLen(dst->dbname)) || (len <= 0)) {
@ -288,6 +294,10 @@ int32_t tNameFromString(SName* dst, const char* str, uint32_t type) {
// too long account id or too long db name // too long account id or too long db name
int32_t len = (int32_t)strlen(start); int32_t len = (int32_t)strlen(start);
if (TS_ESCAPE_CHAR == *start) {
len -= 2;
++start;
}
if ((len >= tListLen(dst->tname)) || (len <= 0)) { if ((len >= tListLen(dst->tname)) || (len <= 0)) {
return -1; return -1;
} }
@ -340,7 +350,7 @@ void buildChildTableName(RandTableName* rName) {
char temp[8] = {0}; char temp[8] = {0};
rName->childTableName[0] = 't'; rName->childTableName[0] = 't';
rName->childTableName[1] = '_'; rName->childTableName[1] = '_';
for(int i = 0; i < 16; i++){ for (int i = 0; i < 16; i++) {
sprintf(temp, "%02x", context.digest[i]); sprintf(temp, "%02x", context.digest[i]);
strcat(rName->childTableName, temp); strcat(rName->childTableName, temp);
} }

View File

@ -37,8 +37,6 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]);
int32_t mndSetTopicCommitLogs(SMnode *pMnode, STrans *pTrans, SMqTopicObj *pTopic); int32_t mndSetTopicCommitLogs(SMnode *pMnode, STrans *pTrans, SMqTopicObj *pTopic);
int32_t mndCheckColAndTagModifiable(SMnode *pMnode, const char* stbname, int64_t suid, col_id_t colId);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1639,10 +1639,10 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walRetentionPeriod, false); colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walRetentionPeriod, false);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walRollPeriod, false); colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walRetentionSize, false);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walRetentionSize, false); colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walRollPeriod, false);
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walSegmentSize, false); colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walSegmentSize, false);

View File

@ -446,20 +446,6 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
return -1; return -1;
} }
do {
char *syncNodeStr = sync2SimpleStr(pMgmt->sync);
static int64_t mndTick = 0;
if (++mndTick % 10 == 1) {
mTrace("vgId:%d, sync trace msg:%s, %s", syncGetVgId(pMgmt->sync), TMSG_INFO(pMsg->msgType), syncNodeStr);
}
if (gRaftDetailLog) {
char logBuf[512] = {0};
snprintf(logBuf, sizeof(logBuf), "==mndProcessSyncMsg== msgType:%d, syncNode: %s", pMsg->msgType, syncNodeStr);
syncRpcMsgLog2(logBuf, pMsg);
}
taosMemoryFree(syncNodeStr);
} while (0);
// ToDo: ugly! use function pointer // ToDo: ugly! use function pointer
if (syncNodeStrategy(pSyncNode) == SYNC_STRATEGY_STANDARD_SNAPSHOT) { if (syncNodeStrategy(pSyncNode) == SYNC_STRATEGY_STANDARD_SNAPSHOT) {
if (pMsg->msgType == TDMT_SYNC_TIMEOUT) { if (pMsg->msgType == TDMT_SYNC_TIMEOUT) {

View File

@ -687,6 +687,7 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
int32_t numOfRows = 0; int32_t numOfRows = 0;
int32_t cols = 0; int32_t cols = 0;
SConnObj *pConn = NULL; SConnObj *pConn = NULL;
int32_t keepTime = tsShellActivityTimer * 3;
if (pShow->pIter == NULL) { if (pShow->pIter == NULL) {
SProfileMgmt *pMgmt = &pMnode->profileMgmt; SProfileMgmt *pMgmt = &pMnode->profileMgmt;
@ -700,6 +701,10 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl
break; break;
} }
if ((taosGetTimestampMs() - pConn->lastAccessTimeMs) > (keepTime * 1000)) {
continue;
}
cols = 0; cols = 0;
SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);

View File

@ -45,7 +45,9 @@ static int32_t mndProcessTableMetaReq(SRpcMsg *pReq);
static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
static void mndCancelGetNextStb(SMnode *pMnode, void *pIter); static void mndCancelGetNextStb(SMnode *pMnode, void *pIter);
static int32_t mndProcessTableCfgReq(SRpcMsg *pReq); static int32_t mndProcessTableCfgReq(SRpcMsg *pReq);
static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp, void* alterOriData, int32_t alterOriDataLen); static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp,
void *alterOriData, int32_t alterOriDataLen);
static int32_t mndCheckColAndTagModifiable(SMnode *pMnode, const char *stbname, int64_t suid, col_id_t colId);
int32_t mndInitStb(SMnode *pMnode) { int32_t mndInitStb(SMnode *pMnode) {
SSdbTable table = { SSdbTable table = {
@ -409,7 +411,8 @@ static FORCE_INLINE int32_t schemaExColIdCompare(const void *colId, const void *
return 0; return 0;
} }
static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb, int32_t *pContLen, void* alterOriData, int32_t alterOriDataLen) { static void *mndBuildVCreateStbReq(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb, int32_t *pContLen,
void *alterOriData, int32_t alterOriDataLen) {
SEncoder encoder = {0}; SEncoder encoder = {0};
int32_t contLen; int32_t contLen;
SName name = {0}; SName name = {0};
@ -709,7 +712,8 @@ int32_t mndBuildStbFromReq(SMnode *pMnode, SStbObj *pDst, SMCreateStbReq *pCreat
memcpy(pDst->db, pDb->name, TSDB_DB_FNAME_LEN); memcpy(pDst->db, pDb->name, TSDB_DB_FNAME_LEN);
pDst->createdTime = taosGetTimestampMs(); pDst->createdTime = taosGetTimestampMs();
pDst->updateTime = pDst->createdTime; pDst->updateTime = pDst->createdTime;
pDst->uid = (pCreate->source == TD_REQ_FROM_TAOX) ? pCreate->suid : mndGenerateUid(pCreate->name, TSDB_TABLE_FNAME_LEN); pDst->uid =
(pCreate->source == TD_REQ_FROM_TAOX) ? pCreate->suid : mndGenerateUid(pCreate->name, TSDB_TABLE_FNAME_LEN);
pDst->dbUid = pDb->uid; pDst->dbUid = pDb->uid;
pDst->tagVer = 1; pDst->tagVer = 1;
pDst->colVer = 1; pDst->colVer = 1;
@ -895,9 +899,9 @@ static int32_t mndBuildStbFromAlter(SStbObj *pStb, SStbObj *pDst, SMCreateStbReq
pSchema->flags = pField->flags; pSchema->flags = pField->flags;
memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN);
int32_t cIndex = mndFindSuperTableColumnIndex(pStb, pField->name); int32_t cIndex = mndFindSuperTableColumnIndex(pStb, pField->name);
if (cIndex >= 0){ if (cIndex >= 0) {
pSchema->colId = pStb->pColumns[cIndex].colId; pSchema->colId = pStb->pColumns[cIndex].colId;
}else{ } else {
pSchema->colId = pDst->nextColId++; pSchema->colId = pDst->nextColId++;
} }
} }
@ -909,12 +913,11 @@ static int32_t mndBuildStbFromAlter(SStbObj *pStb, SStbObj *pDst, SMCreateStbReq
pSchema->bytes = pField->bytes; pSchema->bytes = pField->bytes;
memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN);
int32_t cIndex = mndFindSuperTableTagIndex(pStb, pField->name); int32_t cIndex = mndFindSuperTableTagIndex(pStb, pField->name);
if (cIndex >= 0){ if (cIndex >= 0) {
pSchema->colId = pStb->pTags[cIndex].colId; pSchema->colId = pStb->pTags[cIndex].colId;
}else{ } else {
pSchema->colId = pDst->nextColId++; pSchema->colId = pDst->nextColId++;
} }
} }
pDst->tagVer = createReq->tagVer; pDst->tagVer = createReq->tagVer;
pDst->colVer = createReq->colVer; pDst->colVer = createReq->colVer;
@ -982,7 +985,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) {
} }
} else if (terrno != TSDB_CODE_MND_STB_NOT_EXIST) { } else if (terrno != TSDB_CODE_MND_STB_NOT_EXIST) {
goto _OVER; goto _OVER;
} else if (createReq.source == TD_REQ_FROM_TAOX && (createReq.tagVer != 1 || createReq.colVer != 1)){ } else if (createReq.source == TD_REQ_FROM_TAOX && (createReq.tagVer != 1 || createReq.colVer != 1)) {
mInfo("stb:%s, alter table does not need to be done, because table is deleted", createReq.name); mInfo("stb:%s, alter table does not need to be done, because table is deleted", createReq.name);
code = 0; code = 0;
goto _OVER; goto _OVER;
@ -1137,6 +1140,99 @@ static int32_t mndAddSuperTableTag(const SStbObj *pOld, SStbObj *pNew, SArray *p
return 0; return 0;
} }
int32_t mndCheckColAndTagModifiable(SMnode *pMnode, const char *stbname, int64_t suid, col_id_t colId) {
SSdb *pSdb = pMnode->pSdb;
void *pIter = NULL;
while (1) {
SMqTopicObj *pTopic = NULL;
pIter = sdbFetch(pSdb, SDB_TOPIC, pIter, (void **)&pTopic);
if (pIter == NULL) break;
mDebug("topic:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, subType:%d sql:%s",
pTopic->name, stbname, suid, colId, pTopic->subType, pTopic->sql);
if (pTopic->subType != TOPIC_SUB_TYPE__COLUMN) {
sdbRelease(pSdb, pTopic);
continue;
}
SNode *pAst = NULL;
if (nodesStringToNode(pTopic->ast, &pAst) != 0) {
ASSERT(0);
return -1;
}
SNodeList *pNodeList = NULL;
nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList);
SNode *pNode = NULL;
FOREACH(pNode, pNodeList) {
SColumnNode *pCol = (SColumnNode *)pNode;
mDebug("topic:%s, check colId:%d tableId:%" PRId64 " ctbStbUid:%" PRId64, pTopic->name, pCol->colId,
pCol->tableId, pTopic->ctbStbUid);
if (pCol->tableId != suid && pTopic->ctbStbUid != suid) {
mDebug("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
goto NEXT;
}
if (pCol->colId > 0 && pCol->colId == colId) {
sdbRelease(pSdb, pTopic);
nodesDestroyNode(pAst);
terrno = TSDB_CODE_MND_FIELD_CONFLICT_WITH_TOPIC;
mError("topic:%s, check colId:%d conflicted", pTopic->name, pCol->colId);
return -1;
}
mDebug("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
}
NEXT:
sdbRelease(pSdb, pTopic);
nodesDestroyNode(pAst);
}
while (1) {
SSmaObj *pSma = NULL;
pIter = sdbFetch(pSdb, SDB_SMA, pIter, (void **)&pSma);
if (pIter == NULL) break;
mDebug("tsma:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, sql:%s", pSma->name, stbname,
suid, colId, pSma->sql);
SNode *pAst = NULL;
if (nodesStringToNode(pSma->ast, &pAst) != 0) {
terrno = TSDB_CODE_SDB_INVALID_DATA_CONTENT;
mError("tsma:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d failed since parse AST err",
pSma->name, stbname, suid, colId);
return -1;
}
SNodeList *pNodeList = NULL;
nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList);
SNode *pNode = NULL;
FOREACH(pNode, pNodeList) {
SColumnNode *pCol = (SColumnNode *)pNode;
mDebug("tsma:%s, check colId:%d tableId:%" PRId64, pSma->name, pCol->colId, pCol->tableId);
if ((pCol->tableId != suid) && (pSma->stbUid != suid)) {
mDebug("tsma:%s, check colId:%d passed", pSma->name, pCol->colId);
goto NEXT2;
}
if ((pCol->colId) > 0 && (pCol->colId == colId)) {
sdbRelease(pSdb, pSma);
nodesDestroyNode(pAst);
terrno = TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA;
mError("tsma:%s, check colId:%d conflicted", pSma->name, pCol->colId);
return -1;
}
mDebug("tsma:%s, check colId:%d passed", pSma->name, pCol->colId);
}
NEXT2:
sdbRelease(pSdb, pSma);
nodesDestroyNode(pAst);
}
return 0;
}
static int32_t mndDropSuperTableTag(SMnode *pMnode, const SStbObj *pOld, SStbObj *pNew, const char *tagName) { static int32_t mndDropSuperTableTag(SMnode *pMnode, const SStbObj *pOld, SStbObj *pNew, const char *tagName) {
int32_t tag = mndFindSuperTableTagIndex(pOld, tagName); int32_t tag = mndFindSuperTableTagIndex(pOld, tagName);
if (tag < 0) { if (tag < 0) {
@ -1380,7 +1476,8 @@ static int32_t mndSetAlterStbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj *
return 0; return 0;
} }
static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb, void* alterOriData, int32_t alterOriDataLen) { static int32_t mndSetAlterStbRedoActions(SMnode *pMnode, STrans *pTrans, SDbObj *pDb, SStbObj *pStb, void *alterOriData,
int32_t alterOriDataLen) {
SSdb *pSdb = pMnode->pSdb; SSdb *pSdb = pMnode->pSdb;
SVgObj *pVgroup = NULL; SVgObj *pVgroup = NULL;
void *pIter = NULL; void *pIter = NULL;
@ -1607,7 +1704,8 @@ static int32_t mndBuildSMAlterStbRsp(SDbObj *pDb, SStbObj *pObj, void **pCont, i
return 0; return 0;
} }
static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp, void* alterOriData, int32_t alterOriDataLen) { static int32_t mndAlterStbImp(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb, SStbObj *pStb, bool needRsp,
void *alterOriData, int32_t alterOriDataLen) {
int32_t code = -1; int32_t code = -1;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq); STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq);
if (pTrans == NULL) goto _OVER; if (pTrans == NULL) goto _OVER;

View File

@ -72,56 +72,6 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]) {
return strchr(topic, '.') + 1; return strchr(topic, '.') + 1;
} }
int32_t mndCheckColAndTagModifiable(SMnode *pMnode, const char* stbname, int64_t suid, col_id_t colId) {
SSdb *pSdb = pMnode->pSdb;
void *pIter = NULL;
while (1) {
SMqTopicObj *pTopic = NULL;
pIter = sdbFetch(pSdb, SDB_TOPIC, pIter, (void **)&pTopic);
if (pIter == NULL) break;
mDebug("topic:%s, check tag and column modifiable, stb:%s suid:%" PRId64 " colId:%d, subType:%d sql:%s",
pTopic->name, stbname, suid, colId, pTopic->subType, pTopic->sql);
if (pTopic->subType != TOPIC_SUB_TYPE__COLUMN) {
sdbRelease(pSdb, pTopic);
continue;
}
SNode *pAst = NULL;
if (nodesStringToNode(pTopic->ast, &pAst) != 0) {
ASSERT(0);
return -1;
}
SNodeList *pNodeList = NULL;
nodesCollectColumns((SSelectStmt *)pAst, SQL_CLAUSE_FROM, NULL, COLLECT_COL_TYPE_ALL, &pNodeList);
SNode *pNode = NULL;
FOREACH(pNode, pNodeList) {
SColumnNode *pCol = (SColumnNode *)pNode;
mDebug("topic:%s, check colId:%d tableId:%" PRId64 " ctbStbUid:%" PRId64, pTopic->name, pCol->colId, pCol->tableId, pTopic->ctbStbUid);
if (pCol->tableId != suid && pTopic->ctbStbUid != suid) {
mDebug("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
goto NEXT;
}
if (pCol->colId > 0 && pCol->colId == colId) {
sdbRelease(pSdb, pTopic);
nodesDestroyNode(pAst);
terrno = TSDB_CODE_MND_FIELD_CONFLICT_WITH_TOPIC;
mError("topic:%s, check colId:%d conflicted", pTopic->name, pCol->colId);
return -1;
}
mDebug("topic:%s, check colId:%d passed", pTopic->name, pCol->colId);
}
NEXT:
sdbRelease(pSdb, pTopic);
nodesDestroyNode(pAst);
}
return 0;
}
SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) { SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) {
terrno = TSDB_CODE_OUT_OF_MEMORY; terrno = TSDB_CODE_OUT_OF_MEMORY;

View File

@ -137,6 +137,7 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader *pReader, STableBlockDistInfo *pTa
int64_t tsdbGetNumOfRowsInMemTable(STsdbReader *pHandle); int64_t tsdbGetNumOfRowsInMemTable(STsdbReader *pHandle);
void *tsdbGetIdx(SMeta *pMeta); void *tsdbGetIdx(SMeta *pMeta);
void *tsdbGetIvtIdx(SMeta *pMeta); void *tsdbGetIvtIdx(SMeta *pMeta);
uint64_t getReaderMaxVersion(STsdbReader *pReader);
int32_t tsdbLastRowReaderOpen(void *pVnode, int32_t type, SArray *pTableIdList, int32_t numOfCols, void **pReader); int32_t tsdbLastRowReaderOpen(void *pVnode, int32_t type, SArray *pTableIdList, int32_t numOfCols, void **pReader);
int32_t tsdbRetrieveLastRow(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds, SArray *pTableUids); int32_t tsdbRetrieveLastRow(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds, SArray *pTableUids);

View File

@ -79,6 +79,9 @@ struct SMeta {
TTB* pTtlIdx; TTB* pTtlIdx;
TTB* pSmaIdx; TTB* pSmaIdx;
TTB* pTaskIdx;
SMetaIdx* pIdx; SMetaIdx* pIdx;
}; };

View File

@ -43,6 +43,7 @@ typedef struct STbDataIter STbDataIter;
typedef struct SMapData SMapData; typedef struct SMapData SMapData;
typedef struct SBlockIdx SBlockIdx; typedef struct SBlockIdx SBlockIdx;
typedef struct SBlock SBlock; typedef struct SBlock SBlock;
typedef struct SBlockL SBlockL;
typedef struct SColData SColData; typedef struct SColData SColData;
typedef struct SBlockDataHdr SBlockDataHdr; typedef struct SBlockDataHdr SBlockDataHdr;
typedef struct SBlockData SBlockData; typedef struct SBlockData SBlockData;
@ -414,6 +415,29 @@ struct SBlock {
SSubBlock aSubBlock[TSDB_MAX_SUBBLOCKS]; SSubBlock aSubBlock[TSDB_MAX_SUBBLOCKS];
}; };
struct SBlockL {
struct {
int64_t uid;
int64_t version;
TSKEY ts;
} minKey;
struct {
int64_t uid;
int64_t version;
TSKEY ts;
} maxKey;
int64_t minVer;
int64_t maxVer;
int32_t nRow;
int8_t cmprAlg;
int64_t offset;
int32_t szBlock;
int32_t szBlockCol;
int32_t szUid;
int32_t szVer;
int32_t szTSKEY;
};
struct SColData { struct SColData {
int16_t cid; int16_t cid;
int8_t type; int8_t type;

View File

@ -153,7 +153,7 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, char* msg, int32_t msgLen);
int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen); int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen);
int32_t tqProcessTaskDropReq(STQ* pTq, char* msg, int32_t msgLen); int32_t tqProcessTaskDropReq(STQ* pTq, char* msg, int32_t msgLen);
int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* data); int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* data, int64_t ver);
int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessTaskRunReq(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg);
int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg);

View File

@ -22,6 +22,7 @@ static int tagIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kL
static int ttlIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2); static int ttlIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
static int uidIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2); static int uidIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
static int smaIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2); static int smaIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
static int taskIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2);
static int32_t metaInitLock(SMeta *pMeta) { return taosThreadRwlockInit(&pMeta->lock, NULL); } static int32_t metaInitLock(SMeta *pMeta) { return taosThreadRwlockInit(&pMeta->lock, NULL); }
static int32_t metaDestroyLock(SMeta *pMeta) { return taosThreadRwlockDestroy(&pMeta->lock); } static int32_t metaDestroyLock(SMeta *pMeta) { return taosThreadRwlockDestroy(&pMeta->lock); }
@ -130,6 +131,12 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
goto _err; goto _err;
} }
ret = tdbTbOpen("stream.task.db", sizeof(int64_t), -1, taskIdxKeyCmpr, pMeta->pEnv, &pMeta->pTaskIdx);
if (ret < 0) {
metaError("vgId: %d, failed to open meta stream task index since %s", TD_VID(pVnode), tstrerror(terrno));
goto _err;
}
// open index // open index
if (metaOpenIdx(pMeta) < 0) { if (metaOpenIdx(pMeta) < 0) {
metaError("vgId:%d, failed to open meta index since %s", TD_VID(pVnode), tstrerror(terrno)); metaError("vgId:%d, failed to open meta index since %s", TD_VID(pVnode), tstrerror(terrno));
@ -143,6 +150,7 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) {
_err: _err:
if (pMeta->pIdx) metaCloseIdx(pMeta); if (pMeta->pIdx) metaCloseIdx(pMeta);
if (pMeta->pTaskIdx) tdbTbClose(pMeta->pTaskIdx);
if (pMeta->pSmaIdx) tdbTbClose(pMeta->pSmaIdx); if (pMeta->pSmaIdx) tdbTbClose(pMeta->pSmaIdx);
if (pMeta->pTtlIdx) tdbTbClose(pMeta->pTtlIdx); if (pMeta->pTtlIdx) tdbTbClose(pMeta->pTtlIdx);
if (pMeta->pTagIvtIdx) indexClose(pMeta->pTagIvtIdx); if (pMeta->pTagIvtIdx) indexClose(pMeta->pTagIvtIdx);
@ -162,6 +170,7 @@ _err:
int metaClose(SMeta *pMeta) { int metaClose(SMeta *pMeta) {
if (pMeta) { if (pMeta) {
if (pMeta->pIdx) metaCloseIdx(pMeta); if (pMeta->pIdx) metaCloseIdx(pMeta);
if (pMeta->pTaskIdx) tdbTbClose(pMeta->pTaskIdx);
if (pMeta->pSmaIdx) tdbTbClose(pMeta->pSmaIdx); if (pMeta->pSmaIdx) tdbTbClose(pMeta->pSmaIdx);
if (pMeta->pTtlIdx) tdbTbClose(pMeta->pTtlIdx); if (pMeta->pTtlIdx) tdbTbClose(pMeta->pTtlIdx);
if (pMeta->pTagIvtIdx) indexClose(pMeta->pTagIvtIdx); if (pMeta->pTagIvtIdx) indexClose(pMeta->pTagIvtIdx);
@ -378,3 +387,16 @@ static int smaIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kL
return 0; return 0;
} }
static int taskIdxKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2) {
int32_t uid1 = *(int32_t *)pKey1;
int32_t uid2 = *(int32_t *)pKey2;
if (uid1 > uid2) {
return 1;
} else if (uid1 < uid2) {
return -1;
}
return 0;
}

View File

@ -695,7 +695,7 @@ FAIL:
return -1; return -1;
} }
int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq) { int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq, int64_t ver) {
void* pIter = NULL; void* pIter = NULL;
bool failed = false; bool failed = false;
SStreamDataSubmit* pSubmit = NULL; SStreamDataSubmit* pSubmit = NULL;
@ -713,7 +713,7 @@ int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq) {
SStreamTask* pTask = *(SStreamTask**)pIter; SStreamTask* pTask = *(SStreamTask**)pIter;
if (!pTask->isDataScan) continue; if (!pTask->isDataScan) continue;
qDebug("data submit enqueue stream task: %d", pTask->taskId); qDebug("data submit enqueue stream task: %d, ver: %ld", pTask->taskId, ver);
if (!failed) { if (!failed) {
if (streamTaskInput(pTask, (SStreamQueueItem*)pSubmit) < 0) { if (streamTaskInput(pTask, (SStreamQueueItem*)pSubmit) < 0) {

View File

@ -48,7 +48,7 @@ int32_t tqMetaOpen(STQ* pTq) {
ASSERT(0); ASSERT(0);
} }
if (tdbTbOpen("handles", -1, -1, 0, pTq->pMetaStore, &pTq->pExecStore) < 0) { if (tdbTbOpen("handles", -1, -1, NULL, pTq->pMetaStore, &pTq->pExecStore) < 0) {
ASSERT(0); ASSERT(0);
} }

View File

@ -252,7 +252,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver)
SSubmitReq* pReq = (SSubmitReq*)data; SSubmitReq* pReq = (SSubmitReq*)data;
pReq->version = ver; pReq->version = ver;
tqProcessStreamTrigger(pTq, data); tqProcessStreamTrigger(pTq, data, ver);
} }
return 0; return 0;

View File

@ -36,14 +36,18 @@ typedef struct {
TSKEY minKey; TSKEY minKey;
TSKEY maxKey; TSKEY maxKey;
// commit file data // commit file data
struct {
SDataFReader *pReader; SDataFReader *pReader;
SArray *aBlockIdx; // SArray<SBlockIdx> SArray *aBlockIdx; // SArray<SBlockIdx>
SMapData oBlockMap; // SMapData<SBlock>, read from reader SMapData mBlock; // SMapData<SBlock>, read from reader
SBlockData oBlockData; SBlockData bData;
} dReader;
struct {
SDataFWriter *pWriter; SDataFWriter *pWriter;
SArray *aBlockIdxN; // SArray<SBlockIdx> SArray *aBlockIdx; // SArray<SBlockIdx>
SMapData nBlockMap; // SMapData<SBlock> SMapData mBlock; // SMapData<SBlock>
SBlockData nBlockData; SBlockData bData;
} dWriter;
SSkmInfo skmTable; SSkmInfo skmTable;
SSkmInfo skmRow; SSkmInfo skmRow;
/* commit del */ /* commit del */
@ -276,16 +280,16 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
pCommitter->nextKey = TSKEY_MAX; pCommitter->nextKey = TSKEY_MAX;
// old // old
taosArrayClear(pCommitter->aBlockIdx); taosArrayClear(pCommitter->dReader.aBlockIdx);
tMapDataReset(&pCommitter->oBlockMap); tMapDataReset(&pCommitter->dReader.mBlock);
tBlockDataReset(&pCommitter->oBlockData); tBlockDataReset(&pCommitter->dReader.bData);
pRSet = (SDFileSet *)taosArraySearch(pCommitter->fs.aDFileSet, &(SDFileSet){.fid = pCommitter->commitFid}, pRSet = (SDFileSet *)taosArraySearch(pCommitter->fs.aDFileSet, &(SDFileSet){.fid = pCommitter->commitFid},
tDFileSetCmprFn, TD_EQ); tDFileSetCmprFn, TD_EQ);
if (pRSet) { if (pRSet) {
code = tsdbDataFReaderOpen(&pCommitter->pReader, pTsdb, pRSet); code = tsdbDataFReaderOpen(&pCommitter->dReader.pReader, pTsdb, pRSet);
if (code) goto _err; if (code) goto _err;
code = tsdbReadBlockIdx(pCommitter->pReader, pCommitter->aBlockIdx, NULL); code = tsdbReadBlockIdx(pCommitter->dReader.pReader, pCommitter->dReader.aBlockIdx, NULL);
if (code) goto _err; if (code) goto _err;
} }
@ -296,9 +300,9 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
SSmaFile fSma; SSmaFile fSma;
SDFileSet wSet = {.pHeadF = &fHead, .pDataF = &fData, .pLastF = &fLast, .pSmaF = &fSma}; SDFileSet wSet = {.pHeadF = &fHead, .pDataF = &fData, .pLastF = &fLast, .pSmaF = &fSma};
taosArrayClear(pCommitter->aBlockIdxN); taosArrayClear(pCommitter->dWriter.aBlockIdx);
tMapDataReset(&pCommitter->nBlockMap); tMapDataReset(&pCommitter->dWriter.mBlock);
tBlockDataReset(&pCommitter->nBlockData); tBlockDataReset(&pCommitter->dWriter.bData);
if (pRSet) { if (pRSet) {
wSet.diskId = pRSet->diskId; wSet.diskId = pRSet->diskId;
wSet.fid = pCommitter->commitFid; wSet.fid = pCommitter->commitFid;
@ -320,7 +324,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) {
fLast = (SLastFile){.commitID = pCommitter->commitID, .size = 0}; fLast = (SLastFile){.commitID = pCommitter->commitID, .size = 0};
fSma = (SSmaFile){.commitID = pCommitter->commitID, .size = 0}; fSma = (SSmaFile){.commitID = pCommitter->commitID, .size = 0};
} }
code = tsdbDataFWriterOpen(&pCommitter->pWriter, pTsdb, &wSet); code = tsdbDataFWriterOpen(&pCommitter->dWriter.pWriter, pTsdb, &wSet);
if (code) goto _err; if (code) goto _err;
_exit: _exit:
@ -391,10 +395,11 @@ static int32_t tsdbCommitBlockData(SCommitter *pCommitter, SBlockData *pBlockDat
} }
} }
code = tsdbWriteBlockData(pCommitter->pWriter, pBlockData, NULL, NULL, pBlockIdx, pBlock, pCommitter->cmprAlg); code =
tsdbWriteBlockData(pCommitter->dWriter.pWriter, pBlockData, NULL, NULL, pBlockIdx, pBlock, pCommitter->cmprAlg);
if (code) goto _err; if (code) goto _err;
code = tMapDataPutItem(&pCommitter->nBlockMap, pBlock, tPutBlock); code = tMapDataPutItem(&pCommitter->dWriter.mBlock, pBlock, tPutBlock);
if (code) goto _err; if (code) goto _err;
return code; return code;
@ -407,8 +412,8 @@ static int32_t tsdbMergeTableData(SCommitter *pCommitter, STbDataIter *pIter, SB
int8_t toDataOnly) { int8_t toDataOnly) {
int32_t code = 0; int32_t code = 0;
SBlockIdx *pBlockIdx = &(SBlockIdx){.suid = pIter->pTbData->suid, .uid = pIter->pTbData->uid}; SBlockIdx *pBlockIdx = &(SBlockIdx){.suid = pIter->pTbData->suid, .uid = pIter->pTbData->uid};
SBlockData *pBlockDataMerge = &pCommitter->oBlockData; SBlockData *pBlockDataMerge = &pCommitter->dReader.bData;
SBlockData *pBlockData = &pCommitter->nBlockData; SBlockData *pBlockData = &pCommitter->dWriter.bData;
SBlock block; SBlock block;
SBlock *pBlock = &block; SBlock *pBlock = &block;
TSDBROW *pRow1; TSDBROW *pRow1;
@ -416,7 +421,7 @@ static int32_t tsdbMergeTableData(SCommitter *pCommitter, STbDataIter *pIter, SB
TSDBROW *pRow2 = &row2; TSDBROW *pRow2 = &row2;
// read SBlockData // read SBlockData
code = tsdbReadBlockData(pCommitter->pReader, pBlockIdx, pBlockMerge, pBlockDataMerge, NULL, NULL); code = tsdbReadBlockData(pCommitter->dReader.pReader, pBlockIdx, pBlockMerge, pBlockDataMerge, NULL, NULL);
if (code) goto _err; if (code) goto _err;
code = tBlockDataSetSchema(pBlockData, pCommitter->skmTable.pTSchema); code = tBlockDataSetSchema(pBlockData, pCommitter->skmTable.pTSchema);
@ -513,7 +518,7 @@ static int32_t tsdbCommitTableMemData(SCommitter *pCommitter, STbDataIter *pIter
TSDBROW *pRow; TSDBROW *pRow;
SBlock block; SBlock block;
SBlock *pBlock = &block; SBlock *pBlock = &block;
SBlockData *pBlockData = &pCommitter->nBlockData; SBlockData *pBlockData = &pCommitter->dWriter.bData;
int64_t suid = pIter->pTbData->suid; int64_t suid = pIter->pTbData->suid;
int64_t uid = pIter->pTbData->uid; int64_t uid = pIter->pTbData->uid;
@ -575,14 +580,14 @@ static int32_t tsdbCommitTableDiskData(SCommitter *pCommitter, SBlock *pBlock, S
SBlock block; SBlock block;
if (pBlock->last) { if (pBlock->last) {
code = tsdbReadBlockData(pCommitter->pReader, pBlockIdx, pBlock, &pCommitter->oBlockData, NULL, NULL); code = tsdbReadBlockData(pCommitter->dReader.pReader, pBlockIdx, pBlock, &pCommitter->dReader.bData, NULL, NULL);
if (code) goto _err; if (code) goto _err;
tBlockReset(&block); tBlockReset(&block);
code = tsdbCommitBlockData(pCommitter, &pCommitter->oBlockData, &block, pBlockIdx, 0); code = tsdbCommitBlockData(pCommitter, &pCommitter->dReader.bData, &block, pBlockIdx, 0);
if (code) goto _err; if (code) goto _err;
} else { } else {
code = tMapDataPutItem(&pCommitter->nBlockMap, pBlock, tPutBlock); code = tMapDataPutItem(&pCommitter->dWriter.mBlock, pBlock, tPutBlock);
if (code) goto _err; if (code) goto _err;
} }
@ -598,10 +603,10 @@ static int32_t tsdbCommitTableDataEnd(SCommitter *pCommitter, int64_t suid, int6
SBlockIdx blockIdx = {.suid = suid, .uid = uid}; SBlockIdx blockIdx = {.suid = suid, .uid = uid};
SBlockIdx *pBlockIdx = &blockIdx; SBlockIdx *pBlockIdx = &blockIdx;
code = tsdbWriteBlock(pCommitter->pWriter, &pCommitter->nBlockMap, NULL, pBlockIdx); code = tsdbWriteBlock(pCommitter->dWriter.pWriter, &pCommitter->dWriter.mBlock, NULL, pBlockIdx);
if (code) goto _err; if (code) goto _err;
if (taosArrayPush(pCommitter->aBlockIdxN, pBlockIdx) == NULL) { if (taosArrayPush(pCommitter->dWriter.aBlockIdx, pBlockIdx) == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
goto _err; goto _err;
} }
@ -643,7 +648,7 @@ static int32_t tsdbGetOvlpNRow(STbDataIter *pIter, SBlock *pBlock) {
static int32_t tsdbMergeAsSubBlock(SCommitter *pCommitter, STbDataIter *pIter, SBlock *pBlock) { static int32_t tsdbMergeAsSubBlock(SCommitter *pCommitter, STbDataIter *pIter, SBlock *pBlock) {
int32_t code = 0; int32_t code = 0;
SBlockData *pBlockData = &pCommitter->nBlockData; SBlockData *pBlockData = &pCommitter->dWriter.bData;
SBlockIdx *pBlockIdx = &(SBlockIdx){.suid = pIter->pTbData->suid, .uid = pIter->pTbData->uid}; SBlockIdx *pBlockIdx = &(SBlockIdx){.suid = pIter->pTbData->suid, .uid = pIter->pTbData->uid};
SBlock block; SBlock block;
TSDBROW *pRow; TSDBROW *pRow;
@ -711,10 +716,10 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
} }
if (pBlockIdx) { if (pBlockIdx) {
code = tsdbReadBlock(pCommitter->pReader, pBlockIdx, &pCommitter->oBlockMap, NULL); code = tsdbReadBlock(pCommitter->dReader.pReader, pBlockIdx, &pCommitter->dReader.mBlock, NULL);
if (code) goto _err; if (code) goto _err;
nBlock = pCommitter->oBlockMap.nItem; nBlock = pCommitter->dReader.mBlock.nItem;
ASSERT(nBlock > 0); ASSERT(nBlock > 0);
suid = pBlockIdx->suid; suid = pBlockIdx->suid;
@ -726,13 +731,13 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
if (pRow == NULL && nBlock == 0) goto _exit; if (pRow == NULL && nBlock == 0) goto _exit;
// start =========== // start ===========
tMapDataReset(&pCommitter->nBlockMap); tMapDataReset(&pCommitter->dWriter.mBlock);
SBlock block; SBlock block;
SBlock *pBlock = &block; SBlock *pBlock = &block;
iBlock = 0; iBlock = 0;
if (iBlock < nBlock) { if (iBlock < nBlock) {
tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock, pBlock, tGetBlock); tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pBlock, tGetBlock);
} else { } else {
pBlock = NULL; pBlock = NULL;
} }
@ -756,7 +761,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
if (pRow && TSDBROW_TS(pRow) > pCommitter->maxKey) pRow = NULL; if (pRow && TSDBROW_TS(pRow) > pCommitter->maxKey) pRow = NULL;
iBlock++; iBlock++;
if (iBlock < nBlock) { if (iBlock < nBlock) {
tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock, pBlock, tGetBlock); tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pBlock, tGetBlock);
} else { } else {
pBlock = NULL; pBlock = NULL;
} }
@ -771,7 +776,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
iBlock++; iBlock++;
if (iBlock < nBlock) { if (iBlock < nBlock) {
tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock, pBlock, tGetBlock); tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pBlock, tGetBlock);
} else { } else {
pBlock = NULL; pBlock = NULL;
} }
@ -798,7 +803,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
SBlock nextBlock = {0}; SBlock nextBlock = {0};
tBlockReset(&nextBlock); tBlockReset(&nextBlock);
tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock + 1, &nextBlock, tGetBlock); tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock + 1, &nextBlock, tGetBlock);
toKey = nextBlock.minKey; toKey = nextBlock.minKey;
} }
@ -810,7 +815,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
if (pRow && TSDBROW_TS(pRow) > pCommitter->maxKey) pRow = NULL; if (pRow && TSDBROW_TS(pRow) > pCommitter->maxKey) pRow = NULL;
iBlock++; iBlock++;
if (iBlock < nBlock) { if (iBlock < nBlock) {
tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock, pBlock, tGetBlock); tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pBlock, tGetBlock);
} else { } else {
pBlock = NULL; pBlock = NULL;
} }
@ -822,7 +827,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl
iBlock++; iBlock++;
if (iBlock < nBlock) { if (iBlock < nBlock) {
tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock, pBlock, tGetBlock); tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pBlock, tGetBlock);
} else { } else {
pBlock = NULL; pBlock = NULL;
} }
@ -857,23 +862,23 @@ static int32_t tsdbCommitFileDataEnd(SCommitter *pCommitter) {
int32_t code = 0; int32_t code = 0;
// write blockIdx // write blockIdx
code = tsdbWriteBlockIdx(pCommitter->pWriter, pCommitter->aBlockIdxN, NULL); code = tsdbWriteBlockIdx(pCommitter->dWriter.pWriter, pCommitter->dWriter.aBlockIdx, NULL);
if (code) goto _err; if (code) goto _err;
// update file header // update file header
code = tsdbUpdateDFileSetHeader(pCommitter->pWriter); code = tsdbUpdateDFileSetHeader(pCommitter->dWriter.pWriter);
if (code) goto _err; if (code) goto _err;
// upsert SDFileSet // upsert SDFileSet
code = tsdbFSUpsertFSet(&pCommitter->fs, &pCommitter->pWriter->wSet); code = tsdbFSUpsertFSet(&pCommitter->fs, &pCommitter->dWriter.pWriter->wSet);
if (code) goto _err; if (code) goto _err;
// close and sync // close and sync
code = tsdbDataFWriterClose(&pCommitter->pWriter, 1); code = tsdbDataFWriterClose(&pCommitter->dWriter.pWriter, 1);
if (code) goto _err; if (code) goto _err;
if (pCommitter->pReader) { if (pCommitter->dReader.pReader) {
code = tsdbDataFReaderClose(&pCommitter->pReader); code = tsdbDataFReaderClose(&pCommitter->dReader.pReader);
if (code) goto _err; if (code) goto _err;
} }
@ -898,14 +903,14 @@ static int32_t tsdbCommitFileData(SCommitter *pCommitter) {
int32_t iTbData = 0; int32_t iTbData = 0;
int32_t nTbData = taosArrayGetSize(pMemTable->aTbData); int32_t nTbData = taosArrayGetSize(pMemTable->aTbData);
int32_t iBlockIdx = 0; int32_t iBlockIdx = 0;
int32_t nBlockIdx = taosArrayGetSize(pCommitter->aBlockIdx); int32_t nBlockIdx = taosArrayGetSize(pCommitter->dReader.aBlockIdx);
STbData *pTbData; STbData *pTbData;
SBlockIdx *pBlockIdx; SBlockIdx *pBlockIdx;
ASSERT(nTbData > 0); ASSERT(nTbData > 0);
pTbData = (STbData *)taosArrayGetP(pMemTable->aTbData, iTbData); pTbData = (STbData *)taosArrayGetP(pMemTable->aTbData, iTbData);
pBlockIdx = (iBlockIdx < nBlockIdx) ? (SBlockIdx *)taosArrayGet(pCommitter->aBlockIdx, iBlockIdx) : NULL; pBlockIdx = (iBlockIdx < nBlockIdx) ? (SBlockIdx *)taosArrayGet(pCommitter->dReader.aBlockIdx, iBlockIdx) : NULL;
while (pTbData || pBlockIdx) { while (pTbData || pBlockIdx) {
if (pTbData && pBlockIdx) { if (pTbData && pBlockIdx) {
int32_t c = tTABLEIDCmprFn(pTbData, pBlockIdx); int32_t c = tTABLEIDCmprFn(pTbData, pBlockIdx);
@ -936,7 +941,7 @@ static int32_t tsdbCommitFileData(SCommitter *pCommitter) {
if (code) goto _err; if (code) goto _err;
iBlockIdx++; iBlockIdx++;
pBlockIdx = (iBlockIdx < nBlockIdx) ? (SBlockIdx *)taosArrayGet(pCommitter->aBlockIdx, iBlockIdx) : NULL; pBlockIdx = (iBlockIdx < nBlockIdx) ? (SBlockIdx *)taosArrayGet(pCommitter->dReader.aBlockIdx, iBlockIdx) : NULL;
continue; continue;
_commit_table_mem_and_disk: _commit_table_mem_and_disk:
@ -944,7 +949,7 @@ static int32_t tsdbCommitFileData(SCommitter *pCommitter) {
if (code) goto _err; if (code) goto _err;
iBlockIdx++; iBlockIdx++;
pBlockIdx = (iBlockIdx < nBlockIdx) ? (SBlockIdx *)taosArrayGet(pCommitter->aBlockIdx, iBlockIdx) : NULL; pBlockIdx = (iBlockIdx < nBlockIdx) ? (SBlockIdx *)taosArrayGet(pCommitter->dReader.aBlockIdx, iBlockIdx) : NULL;
iTbData++; iTbData++;
pTbData = (iTbData < nTbData) ? (STbData *)taosArrayGetP(pMemTable->aTbData, iTbData) : NULL; pTbData = (iTbData < nTbData) ? (STbData *)taosArrayGetP(pMemTable->aTbData, iTbData) : NULL;
continue; continue;
@ -958,8 +963,8 @@ static int32_t tsdbCommitFileData(SCommitter *pCommitter) {
_err: _err:
tsdbError("vgId:%d commit file data failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code)); tsdbError("vgId:%d commit file data failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code));
tsdbDataFReaderClose(&pCommitter->pReader); tsdbDataFReaderClose(&pCommitter->dReader.pReader);
tsdbDataFWriterClose(&pCommitter->pWriter, 0); tsdbDataFWriterClose(&pCommitter->dWriter.pWriter, 0);
return code; return code;
} }
@ -996,22 +1001,22 @@ _err:
static int32_t tsdbCommitDataStart(SCommitter *pCommitter) { static int32_t tsdbCommitDataStart(SCommitter *pCommitter) {
int32_t code = 0; int32_t code = 0;
pCommitter->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx)); pCommitter->dReader.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
if (pCommitter->aBlockIdx == NULL) { if (pCommitter->dReader.aBlockIdx == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
goto _exit; goto _exit;
} }
pCommitter->aBlockIdxN = taosArrayInit(0, sizeof(SBlockIdx)); pCommitter->dWriter.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx));
if (pCommitter->aBlockIdxN == NULL) { if (pCommitter->dWriter.aBlockIdx == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY; code = TSDB_CODE_OUT_OF_MEMORY;
goto _exit; goto _exit;
} }
code = tBlockDataInit(&pCommitter->oBlockData); code = tBlockDataInit(&pCommitter->dReader.bData);
if (code) goto _exit; if (code) goto _exit;
code = tBlockDataInit(&pCommitter->nBlockData); code = tBlockDataInit(&pCommitter->dWriter.bData);
if (code) goto _exit; if (code) goto _exit;
_exit: _exit:
@ -1019,12 +1024,12 @@ _exit:
} }
static void tsdbCommitDataEnd(SCommitter *pCommitter) { static void tsdbCommitDataEnd(SCommitter *pCommitter) {
taosArrayDestroy(pCommitter->aBlockIdx); taosArrayDestroy(pCommitter->dReader.aBlockIdx);
tMapDataClear(&pCommitter->oBlockMap); tMapDataClear(&pCommitter->dReader.mBlock);
tBlockDataClear(&pCommitter->oBlockData, 1); tBlockDataClear(&pCommitter->dReader.bData, 1);
taosArrayDestroy(pCommitter->aBlockIdxN); taosArrayDestroy(pCommitter->dWriter.aBlockIdx);
tMapDataClear(&pCommitter->nBlockMap); tMapDataClear(&pCommitter->dWriter.mBlock);
tBlockDataClear(&pCommitter->nBlockData, 1); tBlockDataClear(&pCommitter->dWriter.bData, 1);
tTSchemaDestroy(pCommitter->skmTable.pTSchema); tTSchemaDestroy(pCommitter->skmTable.pTSchema);
tTSchemaDestroy(pCommitter->skmRow.pTSchema); tTSchemaDestroy(pCommitter->skmRow.pTSchema);
} }

View File

@ -2502,6 +2502,10 @@ void* tsdbGetIvtIdx(SMeta* pMeta) {
return metaGetIvtIdx(pMeta); return metaGetIvtIdx(pMeta);
} }
uint64_t getReaderMaxVersion(STsdbReader *pReader) {
return pReader->verRange.maxVer;
}
/** /**
* @brief Get all suids since suid * @brief Get all suids since suid
* *

View File

@ -30,12 +30,20 @@ void ctgFreeMsgSendParam(void* param) {
taosMemoryFree(param); taosMemoryFree(param);
} }
void ctgFreeBatchMsg(void* msg) {
if (NULL == msg) {
return;
}
SBatchMsg* pMsg = (SBatchMsg*)msg;
taosMemoryFree(pMsg->msg);
}
void ctgFreeBatch(SCtgBatch *pBatch) { void ctgFreeBatch(SCtgBatch *pBatch) {
if (NULL == pBatch) { if (NULL == pBatch) {
return; return;
} }
taosArrayDestroy(pBatch->pMsgs); taosArrayDestroyEx(pBatch->pMsgs, ctgFreeBatchMsg);
taosArrayDestroy(pBatch->pTaskIds); taosArrayDestroy(pBatch->pTaskIds);
} }

View File

@ -437,6 +437,7 @@ typedef struct SessionWindowSupporter {
SStreamAggSupporter* pStreamAggSup; SStreamAggSupporter* pStreamAggSup;
int64_t gap; int64_t gap;
uint8_t parentType; uint8_t parentType;
SAggSupporter* pIntervalAggSup;
} SessionWindowSupporter; } SessionWindowSupporter;
typedef struct STimeWindowSupp { typedef struct STimeWindowSupp {
@ -1009,6 +1010,7 @@ int32_t updateSessionWindowInfo(SResultWindowInfo* pWinInfo, TSKEY* pStartTs,
TSKEY* pEndTs, int32_t rows, int32_t start, int64_t gap, SHashObj* pStDeleted); TSKEY* pEndTs, int32_t rows, int32_t start, int64_t gap, SHashObj* pStDeleted);
bool functionNeedToExecute(SqlFunctionCtx* pCtx); bool functionNeedToExecute(SqlFunctionCtx* pCtx);
bool isCloseWindow(STimeWindow* pWin, STimeWindowAggSupp* pSup); bool isCloseWindow(STimeWindow* pWin, STimeWindowAggSupp* pSup);
bool isDeletedWindow(STimeWindow* pWin, uint64_t groupId, SAggSupporter* pSup);
void appendOneRow(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid); void appendOneRow(SSDataBlock* pBlock, TSKEY* pStartTs, TSKEY* pEndTs, uint64_t* pUid);
void printDataBlock(SSDataBlock* pBlock, const char* flag); void printDataBlock(SSDataBlock* pBlock, const char* flag);

View File

@ -672,6 +672,10 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
numOfRows = pfCtx->fpSet.process(pfCtx); numOfRows = pfCtx->fpSet.process(pfCtx);
} else if (fmIsAggFunc(pfCtx->functionId)) { } else if (fmIsAggFunc(pfCtx->functionId)) {
// selective value output should be set during corresponding function execution
if (fmIsSelectValueFunc(pfCtx->functionId)) {
continue;
}
// _group_key function for "partition by tbname" + csum(col_name) query // _group_key function for "partition by tbname" + csum(col_name) query
SColumnInfoData* pOutput = taosArrayGet(pResult->pDataBlock, outputSlotId); SColumnInfoData* pOutput = taosArrayGet(pResult->pDataBlock, outputSlotId);
int32_t slotId = pfCtx->param[0].pCol->slotId; int32_t slotId = pfCtx->param[0].pCol->slotId;

View File

@ -1131,7 +1131,8 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock
STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, tsCol[rowId], &pInfo->interval, TSDB_ORDER_ASC); STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, tsCol[rowId], &pInfo->interval, TSDB_ORDER_ASC);
// must check update info first. // must check update info first.
bool update = updateInfoIsUpdated(pInfo->pUpdateInfo, pBlock->info.uid, tsCol[rowId]); bool update = updateInfoIsUpdated(pInfo->pUpdateInfo, pBlock->info.uid, tsCol[rowId]);
if ((update || (isSignleIntervalWindow(pInfo) && isCloseWindow(&win, &pInfo->twAggSup))) && out) { if ((update || (isSignleIntervalWindow(pInfo) && isCloseWindow(&win, &pInfo->twAggSup) &&
isDeletedWindow(&win, pBlock->info.groupId, pInfo->sessionSup.pIntervalAggSup))) && out) {
appendOneRow(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.uid); appendOneRow(pInfo->pUpdateDataRes, tsCol + rowId, tsCol + rowId, &pBlock->info.uid);
} }
} }
@ -1337,6 +1338,9 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
case STREAM_SCAN_FROM_DATAREADER_RETRIEVE: { case STREAM_SCAN_FROM_DATAREADER_RETRIEVE: {
SSDataBlock* pSDB = doRangeScan(pInfo, pInfo->pUpdateRes, pInfo->primaryTsIndex, &pInfo->updateResIndex); SSDataBlock* pSDB = doRangeScan(pInfo, pInfo->pUpdateRes, pInfo->primaryTsIndex, &pInfo->updateResIndex);
if (pSDB) { if (pSDB) {
STableScanInfo* pTableScanInfo = pInfo->pTableScanOp->info;
uint64_t version = getReaderMaxVersion(pTableScanInfo->dataReader);
updateInfoSetScanRange(pInfo->pUpdateInfo, &pTableScanInfo->cond.twindows, pInfo->groupId,version);
pSDB->info.type = pInfo->scanMode == STREAM_SCAN_FROM_DATAREADER_RANGE ? STREAM_NORMAL : STREAM_PULL_DATA; pSDB->info.type = pInfo->scanMode == STREAM_SCAN_FROM_DATAREADER_RANGE ? STREAM_NORMAL : STREAM_PULL_DATA;
checkUpdateData(pInfo, true, pSDB, false); checkUpdateData(pInfo, true, pSDB, false);
return pSDB; return pSDB;
@ -1390,6 +1394,12 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
setBlockIntoRes(pInfo, &block); setBlockIntoRes(pInfo, &block);
if (updateInfoIgnore(pInfo->pUpdateInfo, &pInfo->pRes->info.window, pInfo->pRes->info.groupId, pInfo->pRes->info.version)) {
printDataBlock(pInfo->pRes, "stream scan ignore");
blockDataCleanup(pInfo->pRes);
continue;
}
if (pBlockInfo->rows > 0) { if (pBlockInfo->rows > 0) {
break; break;
} }
@ -1406,6 +1416,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) {
// record the scan action. // record the scan action.
pInfo->numOfExec++; pInfo->numOfExec++;
pOperator->resultInfo.totalRows += pBlockInfo->rows; pOperator->resultInfo.totalRows += pBlockInfo->rows;
printDataBlock(pInfo->pRes, "stream scan");
if (pBlockInfo->rows == 0) { if (pBlockInfo->rows == 0) {
updateInfoDestoryColseWinSBF(pInfo->pUpdateInfo); updateInfoDestoryColseWinSBF(pInfo->pUpdateInfo);

View File

@ -1456,6 +1456,7 @@ static int32_t getAllIntervalWindow(SHashObj* pHashMap, SArray* resWins) {
static int32_t closeIntervalWindow(SHashObj* pHashMap, STimeWindowAggSupp* pSup, SInterval* pInterval, static int32_t closeIntervalWindow(SHashObj* pHashMap, STimeWindowAggSupp* pSup, SInterval* pInterval,
SHashObj* pPullDataMap, SArray* closeWins, SArray* pRecyPages, SHashObj* pPullDataMap, SArray* closeWins, SArray* pRecyPages,
SDiskbasedBuf* pDiscBuf) { SDiskbasedBuf* pDiscBuf) {
qDebug("===stream===close interval window");
void* pIte = NULL; void* pIte = NULL;
size_t keyLen = 0; size_t keyLen = 0;
while ((pIte = taosHashIterate(pHashMap, pIte)) != NULL) { while ((pIte = taosHashIterate(pHashMap, pIte)) != NULL) {
@ -1772,10 +1773,11 @@ SSDataBlock* createDeleteBlock() {
return pBlock; return pBlock;
} }
void initIntervalDownStream(SOperatorInfo* downstream, uint8_t type) { void initIntervalDownStream(SOperatorInfo* downstream, uint8_t type, SAggSupporter* pSup) {
ASSERT(downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN); ASSERT(downstream->operatorType == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN);
SStreamScanInfo* pScanInfo = downstream->info; SStreamScanInfo* pScanInfo = downstream->info;
pScanInfo->sessionSup.parentType = type; pScanInfo->sessionSup.parentType = type;
pScanInfo->sessionSup.pIntervalAggSup = pSup;
} }
SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
@ -1851,7 +1853,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo*
destroyIntervalOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL); destroyIntervalOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL);
if (nodeType(pPhyNode) == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL) { if (nodeType(pPhyNode) == QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL) {
initIntervalDownStream(downstream, QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL); initIntervalDownStream(downstream, QUERY_NODE_PHYSICAL_PLAN_STREAM_INTERVAL, &pInfo->aggSup);
} }
code = appendDownstream(pOperator, &downstream, 1); code = appendDownstream(pOperator, &downstream, 1);
@ -3111,7 +3113,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream,
createOperatorFpSet(NULL, doStreamFinalIntervalAgg, NULL, NULL, destroyStreamFinalIntervalOperatorInfo, createOperatorFpSet(NULL, doStreamFinalIntervalAgg, NULL, NULL, destroyStreamFinalIntervalOperatorInfo,
aggEncodeResultRow, aggDecodeResultRow, NULL); aggEncodeResultRow, aggDecodeResultRow, NULL);
if (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL) { if (pPhyNode->type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SEMI_INTERVAL) {
initIntervalDownStream(downstream, pPhyNode->type); initIntervalDownStream(downstream, pPhyNode->type, &pInfo->aggSup);
} }
code = appendDownstream(pOperator, &downstream, 1); code = appendDownstream(pOperator, &downstream, 1);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {

View File

@ -2465,7 +2465,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "statecount", .name = "statecount",
.type = FUNCTION_TYPE_STATE_COUNT, .type = FUNCTION_TYPE_STATE_COUNT,
.classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC,
.translateFunc = translateStateCount, .translateFunc = translateStateCount,
.getEnvFunc = getStateFuncEnv, .getEnvFunc = getStateFuncEnv,
.initFunc = functionSetup, .initFunc = functionSetup,
@ -2476,7 +2476,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "stateduration", .name = "stateduration",
.type = FUNCTION_TYPE_STATE_DURATION, .type = FUNCTION_TYPE_STATE_DURATION,
.classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC | FUNC_MGT_FORBID_STREAM_FUNC,
.translateFunc = translateStateDuration, .translateFunc = translateStateDuration,
.getEnvFunc = getStateFuncEnv, .getEnvFunc = getStateFuncEnv,
.initFunc = functionSetup, .initFunc = functionSetup,
@ -2487,7 +2487,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "csum", .name = "csum",
.type = FUNCTION_TYPE_CSUM, .type = FUNCTION_TYPE_CSUM,
.classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC, .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_CUMULATIVE_FUNC,
.translateFunc = translateCsum, .translateFunc = translateCsum,
.getEnvFunc = getCsumFuncEnv, .getEnvFunc = getCsumFuncEnv,
.initFunc = functionSetup, .initFunc = functionSetup,
@ -2499,7 +2499,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "mavg", .name = "mavg",
.type = FUNCTION_TYPE_MAVG, .type = FUNCTION_TYPE_MAVG,
.classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC, .classification = FUNC_MGT_INDEFINITE_ROWS_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_FORBID_STREAM_FUNC,
.translateFunc = translateMavg, .translateFunc = translateMavg,
.getEnvFunc = getMavgFuncEnv, .getEnvFunc = getMavgFuncEnv,
.initFunc = mavgFunctionSetup, .initFunc = mavgFunctionSetup,

View File

@ -4651,10 +4651,15 @@ int32_t stateCountFunction(SqlFunctionCtx* pCtx) {
numOfElems++; numOfElems++;
if (colDataIsNull_f(pInputCol->nullbitmap, i)) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
colDataAppendNULL(pOutput, i); colDataAppendNULL(pOutput, i);
// handle selectivity
if (pCtx->subsidiaries.num > 0) {
appendSelectivityValue(pCtx, i, i);
}
continue; continue;
} }
bool ret = checkStateOp(op, pInputCol, i, pCtx->param[2].param); bool ret = checkStateOp(op, pInputCol, i, pCtx->param[2].param);
int64_t output = -1; int64_t output = -1;
if (ret) { if (ret) {
output = ++pInfo->count; output = ++pInfo->count;
@ -4662,6 +4667,11 @@ int32_t stateCountFunction(SqlFunctionCtx* pCtx) {
pInfo->count = 0; pInfo->count = 0;
} }
colDataAppend(pOutput, i, (char*)&output, false); colDataAppend(pOutput, i, (char*)&output, false);
// handle selectivity
if (pCtx->subsidiaries.num > 0) {
appendSelectivityValue(pCtx, i, i);
}
} }
return numOfElems; return numOfElems;
@ -4694,6 +4704,10 @@ int32_t stateDurationFunction(SqlFunctionCtx* pCtx) {
numOfElems++; numOfElems++;
if (colDataIsNull_f(pInputCol->nullbitmap, i)) { if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
colDataAppendNULL(pOutput, i); colDataAppendNULL(pOutput, i);
// handle selectivity
if (pCtx->subsidiaries.num > 0) {
appendSelectivityValue(pCtx, i, i);
}
continue; continue;
} }
@ -4710,6 +4724,11 @@ int32_t stateDurationFunction(SqlFunctionCtx* pCtx) {
pInfo->durationStart = 0; pInfo->durationStart = 0;
} }
colDataAppend(pOutput, i, (char*)&output, false); colDataAppend(pOutput, i, (char*)&output, false);
// handle selectivity
if (pCtx->subsidiaries.num > 0) {
appendSelectivityValue(pCtx, i, i);
}
} }
return numOfElems; return numOfElems;
@ -4762,6 +4781,11 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) {
} }
} }
// handle selectivity
if (pCtx->subsidiaries.num > 0) {
appendSelectivityValue(pCtx, i, pos);
}
numOfElems++; numOfElems++;
} }
@ -4834,6 +4858,11 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) {
colDataAppend(pOutput, pos, (char*)&result, false); colDataAppend(pOutput, pos, (char*)&result, false);
} }
// handle selectivity
if (pCtx->subsidiaries.num > 0) {
appendSelectivityValue(pCtx, i, pos);
}
numOfElems++; numOfElems++;
} }

View File

@ -221,6 +221,13 @@ bool fmIsLastRowFunc(int32_t funcId) {
return FUNCTION_TYPE_LAST_ROW == funcMgtBuiltins[funcId].type; return FUNCTION_TYPE_LAST_ROW == funcMgtBuiltins[funcId].type;
} }
bool fmIsSelectValueFunc(int32_t funcId) {
if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
return false;
}
return FUNCTION_TYPE_SELECT_VALUE == funcMgtBuiltins[funcId].type;
}
void fmFuncMgtDestroy() { void fmFuncMgtDestroy() {
void* m = gFunMgtService.pFuncNameHashTable; void* m = gFunMgtService.pFuncNameHashTable;
if (m != NULL && atomic_val_compare_exchange_ptr((void**)&gFunMgtService.pFuncNameHashTable, m, 0) == m) { if (m != NULL && atomic_val_compare_exchange_ptr((void**)&gFunMgtService.pFuncNameHashTable, m, 0) == m) {

View File

@ -745,6 +745,7 @@ void nodesDestroyNode(SNode* pNode) {
} }
taosArrayDestroy(pQuery->pDbList); taosArrayDestroy(pQuery->pDbList);
taosArrayDestroy(pQuery->pTableList); taosArrayDestroy(pQuery->pTableList);
taosArrayDestroy(pQuery->pTargetTableList);
taosArrayDestroy(pQuery->pPlaceholderValues); taosArrayDestroy(pQuery->pPlaceholderValues);
nodesDestroyNode(pQuery->pPrepareRoot); nodesDestroyNode(pQuery->pPrepareRoot);
break; break;

View File

@ -177,7 +177,7 @@ SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const
SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode); SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode);
SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const SToken* pConfig, const SToken* pValue); SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const SToken* pConfig, const SToken* pValue);
SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName, SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName,
SToken* pTableName, SNodeList* pCols, SNode* pOptions); SNode* pRealTable, SNodeList* pCols, SNode* pOptions);
SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInterval, SNode* pOffset, SNode* pSliding, SNode* createIndexOption(SAstCreateContext* pCxt, SNodeList* pFuncs, SNode* pInterval, SNode* pOffset, SNode* pSliding,
SNode* pStreamOptions); SNode* pStreamOptions);
SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName); SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName);

View File

@ -33,6 +33,8 @@
} else { } else {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INCOMPLETE_SQL); pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INCOMPLETE_SQL);
} }
} else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z);
} }
} }
@ -422,9 +424,7 @@ from_db_opt(A) ::= FROM db_name(B).
/************************************************ create index ********************************************************/ /************************************************ create index ********************************************************/
cmd ::= CREATE SMA INDEX not_exists_opt(D) cmd ::= CREATE SMA INDEX not_exists_opt(D)
index_name(A) ON table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, &A, &B, NULL, C); } index_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, &A, B, NULL, C); }
//cmd ::= CREATE FULLTEXT INDEX not_exists_opt(D)
// index_name(A) ON table_name(B) NK_LP col_name_list(C) NK_RP. { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_FULLTEXT, D, &A, &B, C, NULL); }
cmd ::= DROP INDEX exists_opt(B) index_name(A). { pCxt->pRootNode = createDropIndexStmt(pCxt, B, &A); } cmd ::= DROP INDEX exists_opt(B) index_name(A). { pCxt->pRootNode = createDropIndexStmt(pCxt, B, &A); }
index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL index_options(A) ::= FUNCTION NK_LP func_list(B) NK_RP INTERVAL

View File

@ -1403,9 +1403,9 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const
} }
SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName, SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SToken* pIndexName,
SToken* pTableName, SNodeList* pCols, SNode* pOptions) { SNode* pRealTable, SNodeList* pCols, SNode* pOptions) {
CHECK_PARSER_STATUS(pCxt); CHECK_PARSER_STATUS(pCxt);
if (!checkIndexName(pCxt, pIndexName) || !checkTableName(pCxt, pTableName) || !checkDbName(pCxt, NULL, true)) { if (!checkIndexName(pCxt, pIndexName)) {
return NULL; return NULL;
} }
SCreateIndexStmt* pStmt = (SCreateIndexStmt*)nodesMakeNode(QUERY_NODE_CREATE_INDEX_STMT); SCreateIndexStmt* pStmt = (SCreateIndexStmt*)nodesMakeNode(QUERY_NODE_CREATE_INDEX_STMT);
@ -1413,7 +1413,9 @@ SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool igno
pStmt->indexType = type; pStmt->indexType = type;
pStmt->ignoreExists = ignoreExists; pStmt->ignoreExists = ignoreExists;
COPY_STRING_FORM_ID_TOKEN(pStmt->indexName, pIndexName); COPY_STRING_FORM_ID_TOKEN(pStmt->indexName, pIndexName);
COPY_STRING_FORM_ID_TOKEN(pStmt->tableName, pTableName); strcpy(pStmt->dbName, ((SRealTableNode*)pRealTable)->table.dbName);
strcpy(pStmt->tableName, ((SRealTableNode*)pRealTable)->table.tableName);
nodesDestroyNode(pRealTable);
pStmt->pCols = pCols; pStmt->pCols = pCols;
pStmt->pOptions = (SIndexOptions*)pOptions; pStmt->pOptions = (SIndexOptions*)pOptions;
return (SNode*)pStmt; return (SNode*)pStmt;

View File

@ -244,7 +244,10 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS
} }
static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) { static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) {
int32_t code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); int32_t code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
if (TSDB_CODE_SUCCESS == code) {
code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); code = reserveTableVgroupInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
} }
@ -252,7 +255,11 @@ static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTabl
} }
static int32_t collectMetaKeyFromAlterStable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) { static int32_t collectMetaKeyFromAlterStable(SCollectMetaKeyCxt* pCxt, SAlterTableStmt* pStmt) {
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache); int32_t code = reserveDbCfgInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pCxt->pMetaCache);
if (TSDB_CODE_SUCCESS == code) {
code = reserveTableMetaInCache(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, pCxt->pMetaCache);
}
return code;
} }
static int32_t collectMetaKeyFromUseDatabase(SCollectMetaKeyCxt* pCxt, SUseDatabaseStmt* pStmt) { static int32_t collectMetaKeyFromUseDatabase(SCollectMetaKeyCxt* pCxt, SUseDatabaseStmt* pStmt) {

View File

@ -434,7 +434,7 @@ static FORCE_INLINE int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf,
} }
static bool isNullStr(SToken* pToken) { static bool isNullStr(SToken* pToken) {
return ((pToken->type == TK_NK_STRING) && (pToken->n != 0) && return ((pToken->type == TK_NK_STRING) && (strlen(TSDB_DATA_NULL_STR_L) == pToken->n) &&
(strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0)); (strncasecmp(TSDB_DATA_NULL_STR_L, pToken->z, pToken->n) == 0));
} }
@ -1175,11 +1175,6 @@ static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks,
getSTSRowAppendInfo(pBuilder->rowType, spd, i, &param.toffset, &param.colIdx); getSTSRowAppendInfo(pBuilder->rowType, spd, i, &param.toffset, &param.colIdx);
CHECK_CODE(parseValueToken(&pCxt->pSql, &sToken, pSchema, timePrec, tmpTokenBuf, MemRowAppend, &param, &pCxt->msg)); CHECK_CODE(parseValueToken(&pCxt->pSql, &sToken, pSchema, timePrec, tmpTokenBuf, MemRowAppend, &param, &pCxt->msg));
if (PRIMARYKEY_TIMESTAMP_COL_ID == pSchema->colId) {
TSKEY tsKey = TD_ROW_KEY(row);
checkTimestamp(pDataBlocks, (const char*)&tsKey);
}
if (i < spd->numOfBound - 1) { if (i < spd->numOfBound - 1) {
NEXT_VALID_TOKEN(pCxt->pSql, sToken); NEXT_VALID_TOKEN(pCxt->pSql, sToken);
if (TK_NK_COMMA != sToken.type) { if (TK_NK_COMMA != sToken.type) {
@ -1188,6 +1183,9 @@ static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks,
} }
} }
TSKEY tsKey = TD_ROW_KEY(row);
checkTimestamp(pDataBlocks, (const char*)&tsKey);
if (!isParseBindParam) { if (!isParseBindParam) {
// set the null value for the columns that do not assign values // set the null value for the columns that do not assign values
if ((spd->numOfBound < spd->numOfCols) && TD_IS_TP_ROW(row)) { if ((spd->numOfBound < spd->numOfCols) && TD_IS_TP_ROW(row)) {

View File

@ -398,6 +398,7 @@ static void destroyTranslateContext(STranslateContext* pCxt) {
taosHashCleanup(pCxt->pDbs); taosHashCleanup(pCxt->pDbs);
taosHashCleanup(pCxt->pTables); taosHashCleanup(pCxt->pTables);
taosHashCleanup(pCxt->pTargetTables);
} }
static bool isSelectStmt(SNode* pCurrStmt) { static bool isSelectStmt(SNode* pCurrStmt) {
@ -885,8 +886,7 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal,
} }
case TSDB_DATA_TYPE_VARCHAR: case TSDB_DATA_TYPE_VARCHAR:
case TSDB_DATA_TYPE_VARBINARY: { case TSDB_DATA_TYPE_VARBINARY: {
if (strict && (!IS_VAR_DATA_TYPE(pVal->node.resType.type) || if (strict && (pVal->node.resType.bytes > targetDt.bytes - VARSTR_HEADER_SIZE)) {
pVal->node.resType.bytes > targetDt.bytes - VARSTR_HEADER_SIZE)) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal);
} }
pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1); pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1);
@ -906,9 +906,6 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal,
break; break;
} }
case TSDB_DATA_TYPE_NCHAR: { case TSDB_DATA_TYPE_NCHAR: {
if (strict && !IS_VAR_DATA_TYPE(pVal->node.resType.type)) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal);
}
pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1); pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1);
if (NULL == pVal->datum.p) { if (NULL == pVal->datum.p) {
return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY);
@ -4126,7 +4123,7 @@ static SSchema* getTagSchema(STableMeta* pTableMeta, const char* pTagName) {
return NULL; return NULL;
} }
static int32_t checkAlterSuperTableImpl(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta) { static int32_t checkAlterSuperTableBySchema(STranslateContext* pCxt, SAlterTableStmt* pStmt, STableMeta* pTableMeta) {
SSchema* pTagsSchema = getTableTagSchema(pTableMeta); SSchema* pTagsSchema = getTableTagSchema(pTableMeta);
if (getNumOfTags(pTableMeta) == 1 && pTagsSchema->type == TSDB_DATA_TYPE_JSON && if (getNumOfTags(pTableMeta) == 1 && pTagsSchema->type == TSDB_DATA_TYPE_JSON &&
(pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG || pStmt->alterType == TSDB_ALTER_TABLE_DROP_TAG || (pStmt->alterType == TSDB_ALTER_TABLE_ADD_TAG || pStmt->alterType == TSDB_ALTER_TABLE_DROP_TAG ||
@ -4152,11 +4149,16 @@ static int32_t checkAlterSuperTableImpl(STranslateContext* pCxt, SAlterTableStmt
} }
static int32_t checkAlterSuperTable(STranslateContext* pCxt, SAlterTableStmt* pStmt) { static int32_t checkAlterSuperTable(STranslateContext* pCxt, SAlterTableStmt* pStmt) {
if (TSDB_ALTER_TABLE_UPDATE_TAG_VAL == pStmt->alterType || TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME == pStmt->alterType) { if (TSDB_ALTER_TABLE_UPDATE_TAG_VAL == pStmt->alterType) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE, return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE,
"Set tag value only available for child table"); "Set tag value only available for child table");
} }
if (TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME == pStmt->alterType) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE,
"Rename column only available for normal table");
}
if (pStmt->alterType == TSDB_ALTER_TABLE_UPDATE_OPTIONS && -1 != pStmt->pOptions->ttl) { if (pStmt->alterType == TSDB_ALTER_TABLE_UPDATE_OPTIONS && -1 != pStmt->pOptions->ttl) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE); return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE);
} }
@ -4169,10 +4171,21 @@ static int32_t checkAlterSuperTable(STranslateContext* pCxt, SAlterTableStmt* pS
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COL_JSON); return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_COL_JSON);
} }
SDbCfgInfo dbCfg = {0};
int32_t code = getDBCfg(pCxt, pStmt->dbName, &dbCfg);
if (TSDB_CODE_SUCCESS == code && NULL != dbCfg.pRetensions &&
(TSDB_ALTER_TABLE_ADD_COLUMN == pStmt->alterType || TSDB_ALTER_TABLE_DROP_COLUMN == pStmt->alterType ||
TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES == pStmt->alterType)) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ALTER_TABLE,
"Modifying the table schema is not supported in databases "
"configured with the 'RETENTIONS' option");
}
STableMeta* pTableMeta = NULL; STableMeta* pTableMeta = NULL;
int32_t code = getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pTableMeta);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = checkAlterSuperTableImpl(pCxt, pStmt, pTableMeta); code = getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pTableMeta);
}
if (TSDB_CODE_SUCCESS == code) {
code = checkAlterSuperTableBySchema(pCxt, pStmt, pTableMeta);
} }
taosMemoryFree(pTableMeta); taosMemoryFree(pTableMeta);
return code; return code;
@ -4310,9 +4323,8 @@ static int32_t getSmaIndexAst(STranslateContext* pCxt, SCreateIndexStmt* pStmt,
static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateSmaReq* pReq) { static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateSmaReq* pReq) {
SName name; SName name;
tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, pStmt->indexName, &name), pReq->name); tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, pStmt->indexName, &name), pReq->name);
strcpy(name.tname, pStmt->tableName); memset(&name, 0, sizeof(SName));
name.tname[strlen(pStmt->tableName)] = '\0'; tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), pReq->stb);
tNameExtractFullName(&name, pReq->stb);
pReq->igExists = pStmt->ignoreExists; pReq->igExists = pStmt->ignoreExists;
pReq->interval = ((SValueNode*)pStmt->pOptions->pInterval)->datum.i; pReq->interval = ((SValueNode*)pStmt->pOptions->pInterval)->datum.i;
pReq->intervalUnit = ((SValueNode*)pStmt->pOptions->pInterval)->unit; pReq->intervalUnit = ((SValueNode*)pStmt->pOptions->pInterval)->unit;
@ -4390,7 +4402,7 @@ static int32_t translateCreateSmaIndex(STranslateContext* pCxt, SCreateIndexStmt
static int32_t buildCreateFullTextReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateFullTextReq* pReq) { static int32_t buildCreateFullTextReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateFullTextReq* pReq) {
// impl later // impl later
return 0; return TSDB_CODE_SUCCESS;
} }
static int32_t translateCreateFullTextIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) { static int32_t translateCreateFullTextIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) {
@ -4404,12 +4416,10 @@ static int32_t translateCreateFullTextIndex(STranslateContext* pCxt, SCreateInde
} }
static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) { static int32_t translateCreateIndex(STranslateContext* pCxt, SCreateIndexStmt* pStmt) {
if (INDEX_TYPE_SMA == pStmt->indexType) { if (INDEX_TYPE_FULLTEXT == pStmt->indexType) {
return translateCreateSmaIndex(pCxt, pStmt);
} else if (INDEX_TYPE_FULLTEXT == pStmt->indexType) {
return translateCreateFullTextIndex(pCxt, pStmt); return translateCreateFullTextIndex(pCxt, pStmt);
} }
return TSDB_CODE_FAILED; return translateCreateSmaIndex(pCxt, pStmt);
} }
static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt) { static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt) {

View File

@ -653,7 +653,7 @@ static int32_t reserveTableReqInCacheImpl(const char* pTbFName, int32_t len, SHa
static int32_t reserveTableReqInCache(int32_t acctId, const char* pDb, const char* pTable, SHashObj** pTables) { static int32_t reserveTableReqInCache(int32_t acctId, const char* pDb, const char* pTable, SHashObj** pTables) {
char fullName[TSDB_TABLE_FNAME_LEN]; char fullName[TSDB_TABLE_FNAME_LEN];
int32_t len = snprintf(fullName, sizeof(fullName), "%d.%s.%s", acctId, pDb, pTable); int32_t len = snprintf(fullName, sizeof(fullName), "%d.`%s`.`%s`", acctId, pDb, pTable);
return reserveTableReqInCacheImpl(fullName, len, pTables); return reserveTableReqInCacheImpl(fullName, len, pTables);
} }

View File

@ -219,82 +219,82 @@ typedef union {
#define YY_ACTTAB_COUNT (2395) #define YY_ACTTAB_COUNT (2395)
static const YYACTIONTYPE yy_action[] = { static const YYACTIONTYPE yy_action[] = {
/* 0 */ 433, 1937, 434, 1503, 1654, 1655, 1599, 326, 441, 548, /* 0 */ 433, 1937, 434, 1503, 1654, 1655, 1599, 326, 441, 548,
/* 10 */ 434, 1503, 39, 37, 1936, 143, 1709, 1776, 1934, 1937, /* 10 */ 434, 1503, 39, 37, 1936, 144, 1709, 1776, 1934, 1937,
/* 20 */ 339, 1469, 1264, 513, 1610, 40, 38, 36, 35, 34, /* 20 */ 339, 1469, 1264, 513, 1610, 40, 38, 36, 35, 34,
/* 30 */ 1793, 325, 163, 1341, 1706, 1262, 1934, 124, 1290, 1023, /* 30 */ 1793, 325, 164, 1341, 1706, 1262, 1934, 125, 1290, 1023,
/* 40 */ 1006, 1022, 104, 1772, 1778, 103, 102, 101, 100, 99, /* 40 */ 1006, 1022, 105, 1772, 1778, 104, 103, 102, 101, 100,
/* 50 */ 98, 97, 96, 95, 156, 570, 1336, 73, 1811, 344, /* 50 */ 99, 98, 97, 96, 157, 570, 1336, 73, 1811, 344,
/* 60 */ 147, 14, 1653, 1655, 1568, 88, 577, 1647, 1270, 1024, /* 60 */ 148, 14, 1653, 1655, 1568, 89, 577, 1647, 1270, 1024,
/* 70 */ 1023, 1762, 1022, 576, 39, 37, 1404, 122, 121, 1604, /* 70 */ 1023, 1762, 1022, 576, 39, 37, 1404, 123, 122, 1604,
/* 80 */ 1010, 1011, 339, 1530, 1264, 469, 1600, 553, 145, 1, /* 80 */ 1010, 1011, 339, 1530, 1264, 469, 1600, 553, 146, 1,
/* 90 */ 1480, 550, 158, 1879, 1880, 1341, 1884, 1262, 1825, 551, /* 90 */ 1480, 550, 159, 1879, 1880, 1341, 1884, 1262, 1825, 551,
/* 100 */ 1024, 64, 91, 1794, 579, 1796, 1797, 575, 1660, 570, /* 100 */ 1024, 64, 92, 1794, 579, 1796, 1797, 575, 1660, 570,
/* 110 */ 1291, 662, 1871, 1408, 1937, 312, 306, 1867, 1336, 1289, /* 110 */ 1291, 662, 1871, 1408, 1937, 312, 306, 1867, 1336, 1289,
/* 120 */ 36, 35, 34, 14, 1658, 1343, 1344, 1935, 1937, 104, /* 120 */ 36, 35, 34, 14, 1658, 1343, 1344, 1935, 1937, 105,
/* 130 */ 1270, 1934, 103, 102, 101, 100, 99, 98, 97, 96, /* 130 */ 1270, 1934, 104, 103, 102, 101, 100, 99, 98, 97,
/* 140 */ 95, 164, 450, 1161, 1162, 1934, 639, 638, 637, 636, /* 140 */ 96, 165, 450, 1161, 1162, 1934, 639, 638, 637, 636,
/* 150 */ 349, 2, 635, 634, 125, 629, 628, 627, 626, 625, /* 150 */ 349, 2, 635, 634, 126, 629, 628, 627, 626, 625,
/* 160 */ 624, 623, 136, 619, 618, 617, 348, 347, 614, 613, /* 160 */ 624, 623, 137, 619, 618, 617, 348, 347, 614, 613,
/* 170 */ 1265, 316, 1263, 662, 1491, 33, 32, 1466, 1937, 40, /* 170 */ 1265, 316, 1263, 662, 1491, 33, 32, 1466, 1937, 40,
/* 180 */ 38, 36, 35, 34, 30, 261, 63, 1343, 1344, 432, /* 180 */ 38, 36, 35, 34, 30, 261, 63, 1343, 1344, 432,
/* 190 */ 1290, 163, 436, 1268, 1269, 1934, 1318, 1319, 1321, 1322, /* 190 */ 1290, 164, 436, 1268, 1269, 1934, 1318, 1319, 1321, 1322,
/* 200 */ 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337, 1338, /* 200 */ 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337, 1338,
/* 210 */ 1339, 1340, 1342, 1345, 1468, 1762, 33, 32, 612, 551, /* 210 */ 1339, 1340, 1342, 1345, 1468, 1762, 33, 32, 612, 551,
/* 220 */ 40, 38, 36, 35, 34, 1289, 317, 165, 315, 314, /* 220 */ 40, 38, 36, 35, 34, 1289, 317, 166, 315, 314,
/* 230 */ 610, 473, 1265, 209, 1263, 475, 1425, 354, 113, 112, /* 230 */ 610, 473, 1265, 210, 1263, 475, 1425, 354, 114, 113,
/* 240 */ 111, 110, 109, 108, 107, 106, 105, 253, 384, 134, /* 240 */ 112, 111, 110, 109, 108, 107, 106, 253, 384, 135,
/* 250 */ 133, 607, 606, 605, 63, 1268, 1269, 474, 1318, 1319, /* 250 */ 134, 607, 606, 605, 63, 1268, 1269, 474, 1318, 1319,
/* 260 */ 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, /* 260 */ 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, 1335,
/* 270 */ 1337, 1338, 1339, 1340, 1342, 1345, 39, 37, 1937, 534, /* 270 */ 1337, 1338, 1339, 1340, 1342, 1345, 39, 37, 1937, 534,
/* 280 */ 1423, 1424, 1426, 1427, 339, 303, 1264, 378, 43, 75, /* 280 */ 1423, 1424, 1426, 1427, 339, 303, 1264, 378, 43, 75,
/* 290 */ 305, 162, 221, 515, 1793, 1934, 1320, 1341, 1435, 1262, /* 290 */ 305, 163, 222, 515, 1793, 1934, 1320, 1341, 1435, 1262,
/* 300 */ 1119, 601, 600, 599, 1123, 598, 1125, 1126, 597, 1128, /* 300 */ 1119, 601, 600, 599, 1123, 598, 1125, 1126, 597, 1128,
/* 310 */ 594, 487, 1134, 591, 1136, 1137, 588, 585, 440, 1811, /* 310 */ 594, 487, 1134, 591, 1136, 1137, 588, 585, 440, 1811,
/* 320 */ 1336, 436, 1811, 537, 165, 14, 497, 541, 1937, 1461, /* 320 */ 1336, 436, 1811, 537, 166, 14, 497, 541, 1937, 1461,
/* 330 */ 577, 1699, 1270, 551, 377, 1762, 376, 576, 39, 37, /* 330 */ 577, 1699, 1270, 551, 377, 1762, 376, 576, 39, 37,
/* 340 */ 208, 162, 170, 63, 548, 1934, 339, 49, 1264, 525, /* 340 */ 209, 163, 171, 63, 548, 1934, 339, 49, 1264, 525,
/* 350 */ 665, 1244, 1245, 2, 490, 1490, 222, 223, 484, 1341, /* 350 */ 665, 1244, 1245, 2, 490, 1490, 223, 224, 484, 1341,
/* 360 */ 55, 1262, 1825, 207, 268, 540, 93, 1794, 579, 1796, /* 360 */ 55, 1262, 1825, 208, 268, 540, 94, 1794, 579, 1796,
/* 370 */ 1797, 575, 124, 570, 1289, 662, 1871, 1608, 154, 143, /* 370 */ 1797, 575, 125, 570, 1289, 662, 1871, 1608, 155, 144,
/* 380 */ 1870, 1867, 1336, 655, 651, 647, 643, 266, 1611, 1343, /* 380 */ 1870, 1867, 1336, 655, 651, 647, 643, 266, 1611, 1343,
/* 390 */ 1344, 1270, 165, 1264, 1270, 58, 1762, 216, 57, 1489, /* 390 */ 1344, 1270, 166, 1264, 1270, 58, 1762, 217, 57, 1489,
/* 400 */ 543, 538, 42, 39, 37, 1346, 1262, 1780, 496, 1488, /* 400 */ 543, 538, 42, 39, 37, 1346, 1262, 1780, 496, 1488,
/* 410 */ 548, 339, 122, 1264, 305, 8, 1460, 515, 1776, 89, /* 410 */ 548, 339, 123, 1264, 305, 8, 1460, 515, 1776, 90,
/* 420 */ 73, 494, 231, 492, 1341, 542, 1262, 159, 1879, 1880, /* 420 */ 73, 494, 231, 492, 1341, 542, 1262, 160, 1879, 1880,
/* 430 */ 63, 1884, 77, 119, 1265, 1351, 1263, 662, 124, 1270, /* 430 */ 63, 1884, 77, 120, 1265, 1351, 1263, 662, 125, 1270,
/* 440 */ 1762, 1289, 1603, 63, 1772, 1778, 328, 1336, 479, 478, /* 440 */ 1762, 1289, 1603, 63, 1772, 1778, 328, 1336, 479, 478,
/* 450 */ 1762, 1343, 1344, 11, 10, 522, 570, 1268, 1269, 1270, /* 450 */ 1762, 1343, 1344, 11, 10, 522, 570, 1268, 1269, 1270,
/* 460 */ 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, /* 460 */ 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, 572, 568,
/* 470 */ 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, 122, 215, /* 470 */ 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, 123, 216,
/* 480 */ 9, 165, 662, 482, 481, 165, 171, 218, 1586, 195, /* 480 */ 9, 166, 662, 482, 481, 166, 172, 219, 1586, 196,
/* 490 */ 120, 633, 631, 160, 1879, 1880, 1265, 1884, 1263, 1660, /* 490 */ 121, 633, 631, 161, 1879, 1880, 1265, 1884, 1263, 1660,
/* 500 */ 477, 480, 662, 149, 61, 1236, 327, 211, 467, 463, /* 500 */ 477, 480, 662, 150, 61, 1236, 327, 212, 467, 463,
/* 510 */ 459, 455, 194, 1585, 76, 1658, 1343, 1344, 71, 1268, /* 510 */ 459, 455, 195, 1585, 76, 1658, 1343, 1344, 71, 1268,
/* 520 */ 1269, 70, 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, /* 520 */ 1269, 70, 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326,
/* 530 */ 572, 568, 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, /* 530 */ 572, 568, 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345,
/* 540 */ 165, 1265, 1377, 1263, 74, 1583, 1288, 192, 450, 81, /* 540 */ 166, 1265, 1377, 1263, 74, 1583, 1288, 193, 450, 82,
/* 550 */ 33, 32, 342, 165, 40, 38, 36, 35, 34, 1533, /* 550 */ 33, 32, 342, 166, 40, 38, 36, 35, 34, 1533,
/* 560 */ 143, 1265, 1584, 1263, 1268, 1269, 621, 512, 165, 1610, /* 560 */ 144, 1265, 1584, 1263, 1268, 1269, 621, 512, 166, 1610,
/* 570 */ 1601, 1699, 33, 32, 1010, 1011, 40, 38, 36, 35, /* 570 */ 1601, 1699, 33, 32, 1010, 1011, 40, 38, 36, 35,
/* 580 */ 34, 165, 173, 604, 1268, 1269, 1081, 1318, 1319, 1321, /* 580 */ 34, 166, 174, 604, 1268, 1269, 1081, 1318, 1319, 1321,
/* 590 */ 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337, /* 590 */ 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337,
/* 600 */ 1338, 1339, 1340, 1342, 1345, 39, 37, 22, 1937, 191, /* 600 */ 1338, 1339, 1340, 1342, 1345, 39, 37, 22, 1937, 192,
/* 610 */ 184, 1793, 189, 339, 610, 1264, 446, 1597, 1320, 1083, /* 610 */ 185, 1793, 190, 339, 610, 1264, 446, 1597, 1320, 1083,
/* 620 */ 513, 162, 612, 482, 481, 1934, 1341, 525, 1262, 1593, /* 620 */ 513, 163, 612, 482, 481, 1934, 1341, 525, 1262, 1593,
/* 630 */ 120, 1707, 182, 134, 133, 607, 606, 605, 114, 1811, /* 630 */ 121, 1707, 183, 135, 134, 607, 606, 605, 115, 1811,
/* 640 */ 477, 480, 7, 345, 548, 471, 610, 577, 1487, 1336, /* 640 */ 477, 480, 7, 345, 548, 471, 610, 577, 1487, 1336,
/* 650 */ 438, 143, 1762, 525, 576, 1608, 1287, 1595, 419, 352, /* 650 */ 438, 144, 1762, 525, 576, 1608, 1287, 1595, 419, 352,
/* 660 */ 1610, 1270, 351, 1365, 167, 134, 133, 607, 606, 605, /* 660 */ 1610, 1270, 351, 1365, 168, 135, 134, 607, 606, 605,
/* 670 */ 33, 32, 124, 1486, 40, 38, 36, 35, 34, 1825, /* 670 */ 33, 32, 125, 1486, 40, 38, 36, 35, 34, 1825,
/* 680 */ 1485, 1608, 9, 280, 1794, 579, 1796, 1797, 575, 1762, /* 680 */ 1485, 1608, 9, 280, 1794, 579, 1796, 1797, 575, 1762,
/* 690 */ 570, 33, 32, 553, 505, 40, 38, 36, 35, 34, /* 690 */ 570, 33, 32, 553, 505, 40, 38, 36, 35, 34,
/* 700 */ 1937, 33, 32, 1937, 662, 40, 38, 36, 35, 34, /* 700 */ 1937, 33, 32, 1937, 662, 40, 38, 36, 35, 34,
/* 710 */ 175, 174, 122, 162, 1762, 498, 162, 1934, 1343, 1344, /* 710 */ 176, 175, 123, 163, 1762, 498, 163, 1934, 1343, 1344,
/* 720 */ 1934, 1762, 1705, 307, 300, 27, 1484, 251, 1879, 547, /* 720 */ 1934, 1762, 1705, 307, 300, 27, 1484, 251, 1879, 547,
/* 730 */ 525, 546, 39, 37, 1937, 1370, 1483, 302, 1886, 1287, /* 730 */ 525, 546, 39, 37, 1937, 1370, 1483, 302, 1886, 1287,
/* 740 */ 339, 114, 1264, 525, 307, 555, 412, 164, 476, 424, /* 740 */ 339, 115, 1264, 525, 307, 555, 412, 165, 476, 424,
/* 750 */ 1591, 1934, 1303, 1341, 382, 1262, 1937, 212, 1608, 373, /* 750 */ 1591, 1934, 1303, 1341, 382, 1262, 1937, 213, 1608, 373,
/* 760 */ 1363, 1886, 1883, 1265, 1509, 1263, 397, 1762, 425, 162, /* 760 */ 1363, 1886, 1883, 1265, 1509, 1263, 397, 1762, 425, 163,
/* 770 */ 399, 1608, 1482, 1934, 1479, 1292, 1336, 1762, 375, 371, /* 770 */ 399, 1608, 1482, 1934, 1479, 1292, 1336, 1762, 375, 371,
/* 780 */ 1704, 1363, 300, 1415, 1478, 1882, 1268, 1269, 1270, 1318, /* 780 */ 1704, 1363, 300, 1415, 1478, 1882, 1268, 1269, 1270, 1318,
/* 790 */ 1319, 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, /* 790 */ 1319, 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, 1334,
@ -311,111 +311,111 @@ static const YYACTIONTYPE yy_action[] = {
/* 900 */ 1359, 1360, 1361, 1362, 1366, 1367, 1368, 1369, 1471, 1762, /* 900 */ 1359, 1360, 1361, 1362, 1366, 1367, 1368, 1369, 1471, 1762,
/* 910 */ 1793, 1881, 233, 1268, 1269, 1762, 1318, 1319, 1321, 1322, /* 910 */ 1793, 1881, 233, 1268, 1269, 1762, 1318, 1319, 1321, 1322,
/* 920 */ 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337, 1338, /* 920 */ 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337, 1338,
/* 930 */ 1339, 1340, 1342, 1345, 525, 144, 525, 525, 1811, 1273, /* 930 */ 1339, 1340, 1342, 1345, 525, 145, 525, 525, 1811, 1273,
/* 940 */ 279, 525, 1891, 1397, 548, 383, 577, 389, 404, 1762, /* 940 */ 279, 525, 1891, 1397, 548, 383, 577, 389, 404, 1762,
/* 950 */ 603, 1762, 405, 576, 277, 60, 273, 132, 59, 1638, /* 950 */ 603, 1762, 405, 576, 277, 60, 273, 133, 59, 1638,
/* 960 */ 44, 4, 1608, 1749, 1608, 1608, 1481, 553, 200, 1608, /* 960 */ 44, 4, 1608, 1749, 1608, 1608, 1481, 553, 201, 1608,
/* 970 */ 525, 198, 124, 1520, 178, 429, 427, 1780, 1825, 1515, /* 970 */ 525, 199, 125, 1520, 179, 429, 427, 1780, 1825, 1515,
/* 980 */ 560, 449, 91, 1794, 579, 1796, 1797, 575, 1776, 570, /* 980 */ 560, 449, 92, 1794, 579, 1796, 1797, 575, 1776, 570,
/* 990 */ 566, 202, 1871, 553, 201, 483, 306, 1867, 1608, 336, /* 990 */ 566, 203, 1871, 553, 202, 483, 306, 1867, 1608, 336,
/* 1000 */ 335, 485, 525, 41, 54, 557, 63, 220, 1937, 1278, /* 1000 */ 335, 485, 525, 41, 54, 557, 63, 221, 1937, 1278,
/* 1010 */ 361, 1513, 122, 1605, 1772, 1778, 334, 53, 509, 1320, /* 1010 */ 361, 1513, 123, 1605, 1772, 1778, 334, 53, 509, 1320,
/* 1020 */ 1341, 162, 1271, 11, 10, 1934, 570, 251, 1879, 547, /* 1020 */ 1341, 163, 1271, 11, 10, 1934, 570, 251, 1879, 547,
/* 1030 */ 1608, 546, 256, 488, 1937, 525, 204, 1781, 206, 203, /* 1030 */ 1608, 546, 256, 488, 1937, 525, 205, 1781, 207, 204,
/* 1040 */ 128, 205, 1793, 1336, 90, 131, 1737, 162, 1776, 51, /* 1040 */ 129, 206, 1793, 1336, 91, 132, 1737, 163, 1776, 51,
/* 1050 */ 1213, 1934, 33, 32, 224, 1270, 40, 38, 36, 35, /* 1050 */ 1213, 1934, 33, 32, 225, 1270, 40, 38, 36, 35,
/* 1060 */ 34, 33, 32, 1608, 132, 40, 38, 36, 35, 34, /* 1060 */ 34, 33, 32, 1608, 133, 40, 38, 36, 35, 34,
/* 1070 */ 1811, 525, 1463, 1464, 1772, 1778, 1276, 1569, 552, 68, /* 1070 */ 1811, 525, 1463, 1464, 1772, 1778, 1276, 1569, 552, 68,
/* 1080 */ 67, 381, 506, 1762, 169, 576, 570, 518, 51, 1783, /* 1080 */ 67, 381, 506, 1762, 170, 576, 570, 518, 468, 1783,
/* 1090 */ 615, 535, 230, 1272, 87, 468, 1371, 1400, 565, 1608, /* 1090 */ 615, 535, 230, 1272, 88, 245, 1371, 1400, 565, 1608,
/* 1100 */ 301, 499, 237, 369, 84, 367, 363, 359, 356, 353, /* 1100 */ 301, 499, 51, 369, 85, 367, 363, 359, 356, 353,
/* 1110 */ 1825, 1112, 1069, 41, 92, 1794, 579, 1796, 1797, 575, /* 1110 */ 1825, 1112, 1069, 237, 93, 1794, 579, 1796, 1797, 575,
/* 1120 */ 525, 570, 1355, 525, 1871, 525, 525, 525, 330, 1867, /* 1120 */ 525, 570, 1355, 525, 1871, 525, 525, 525, 330, 1867,
/* 1130 */ 157, 510, 1785, 1050, 523, 1422, 524, 262, 346, 616, /* 1130 */ 158, 510, 1785, 1050, 227, 525, 523, 524, 262, 616,
/* 1140 */ 41, 1793, 161, 1303, 165, 245, 350, 1504, 1608, 240, /* 1140 */ 41, 1793, 162, 1303, 166, 350, 346, 1504, 1608, 1422,
/* 1150 */ 1897, 1608, 583, 1608, 1608, 1608, 1812, 1279, 131, 1274, /* 1150 */ 1897, 1608, 41, 1608, 1608, 1608, 1812, 1279, 583, 1274,
/* 1160 */ 1327, 1067, 1648, 132, 1901, 116, 1051, 549, 250, 1811, /* 1160 */ 240, 1067, 1648, 1608, 1901, 132, 1051, 549, 255, 1811,
/* 1170 */ 255, 258, 3, 260, 131, 5, 355, 552, 313, 360, /* 1170 */ 250, 258, 3, 260, 133, 117, 355, 552, 132, 5,
/* 1180 */ 1282, 1284, 1762, 1793, 576, 561, 1229, 272, 172, 269, /* 1180 */ 1282, 1284, 1762, 1793, 576, 561, 360, 1327, 313, 269,
/* 1190 */ 385, 1287, 568, 1334, 1335, 1337, 1338, 1339, 1340, 1140, /* 1190 */ 173, 1229, 568, 1334, 1335, 1337, 1338, 1339, 1340, 272,
/* 1200 */ 406, 142, 1701, 413, 421, 1144, 420, 422, 558, 1825, /* 1200 */ 385, 143, 1287, 406, 1701, 1140, 421, 413, 558, 1825,
/* 1210 */ 1151, 1811, 1149, 92, 1794, 579, 1796, 1797, 575, 577, /* 1210 */ 426, 1811, 1144, 93, 1794, 579, 1796, 1797, 575, 577,
/* 1220 */ 570, 135, 426, 1871, 1762, 428, 576, 330, 1867, 157, /* 1220 */ 570, 1151, 1149, 1871, 1762, 136, 576, 330, 1867, 158,
/* 1230 */ 1275, 1293, 431, 430, 439, 1296, 1793, 1295, 442, 181, /* 1230 */ 1275, 420, 422, 428, 430, 1293, 1793, 431, 1296, 439,
/* 1240 */ 183, 443, 444, 1297, 447, 445, 186, 188, 1294, 1898, /* 1240 */ 182, 443, 442, 184, 444, 1295, 1297, 447, 445, 1898,
/* 1250 */ 448, 1825, 190, 1793, 72, 92, 1794, 579, 1796, 1797, /* 1250 */ 187, 1825, 189, 1793, 1294, 93, 1794, 579, 1796, 1797,
/* 1260 */ 575, 193, 570, 451, 1811, 1871, 470, 1742, 500, 330, /* 1260 */ 575, 448, 570, 191, 1811, 1871, 72, 451, 194, 330,
/* 1270 */ 1867, 1950, 577, 472, 1598, 304, 197, 1762, 1594, 576, /* 1270 */ 1867, 1950, 577, 472, 470, 304, 1598, 1762, 198, 576,
/* 1280 */ 1905, 1811, 199, 115, 137, 507, 138, 1596, 1592, 577, /* 1280 */ 1905, 1811, 116, 1594, 1742, 211, 200, 500, 138, 577,
/* 1290 */ 210, 139, 270, 501, 1762, 140, 576, 213, 511, 322, /* 1290 */ 270, 139, 1596, 507, 1762, 1592, 576, 140, 141, 214,
/* 1300 */ 533, 217, 514, 129, 1825, 519, 226, 271, 92, 1794, /* 1300 */ 511, 218, 322, 501, 1825, 533, 519, 1292, 93, 1794,
/* 1310 */ 579, 1796, 1797, 575, 1292, 570, 1793, 504, 1871, 520, /* 1310 */ 579, 1796, 1797, 575, 1609, 570, 1793, 228, 1871, 504,
/* 1320 */ 1741, 1825, 330, 1867, 1950, 92, 1794, 579, 1796, 1797, /* 1320 */ 130, 1825, 330, 1867, 1950, 93, 1794, 579, 1796, 1797,
/* 1330 */ 575, 228, 570, 1928, 1711, 1871, 516, 130, 324, 330, /* 1330 */ 575, 514, 570, 1928, 1741, 1871, 1711, 516, 131, 330,
/* 1340 */ 1867, 1950, 80, 521, 1811, 1609, 536, 1902, 529, 531, /* 1340 */ 1867, 1950, 324, 521, 1811, 271, 81, 520, 1902, 529,
/* 1350 */ 1890, 235, 577, 239, 6, 532, 1912, 1762, 329, 576, /* 1350 */ 1890, 235, 577, 536, 239, 6, 1912, 1762, 531, 576,
/* 1360 */ 545, 539, 530, 528, 527, 1397, 1793, 123, 249, 1291, /* 1360 */ 545, 532, 530, 329, 539, 1911, 1793, 528, 527, 1397,
/* 1370 */ 1887, 562, 1911, 553, 559, 331, 1793, 48, 82, 1893, /* 1370 */ 124, 249, 1291, 553, 562, 559, 1793, 48, 331, 1887,
/* 1380 */ 581, 1652, 1581, 658, 1825, 274, 659, 246, 286, 1794, /* 1380 */ 83, 581, 1652, 246, 1825, 248, 1893, 265, 286, 1794,
/* 1390 */ 579, 1796, 1797, 575, 1811, 570, 52, 265, 244, 248, /* 1390 */ 579, 1796, 1797, 575, 1811, 570, 658, 274, 1581, 659,
/* 1400 */ 151, 254, 577, 1933, 1811, 1953, 661, 1762, 247, 576, /* 1400 */ 247, 1933, 577, 661, 1811, 52, 244, 1762, 151, 576,
/* 1410 */ 1852, 150, 577, 276, 1937, 287, 1756, 1762, 1793, 576, /* 1410 */ 152, 1852, 577, 276, 1937, 287, 297, 1762, 1793, 576,
/* 1420 */ 297, 278, 296, 553, 556, 563, 1755, 164, 257, 65, /* 1420 */ 278, 1756, 296, 553, 254, 1755, 556, 165, 257, 1953,
/* 1430 */ 1754, 1934, 1753, 66, 1825, 259, 1750, 357, 286, 1794, /* 1430 */ 65, 1934, 1754, 1753, 1825, 66, 1750, 259, 286, 1794,
/* 1440 */ 579, 1796, 1797, 575, 1825, 570, 1811, 358, 93, 1794, /* 1440 */ 579, 1796, 1797, 575, 1825, 570, 1811, 563, 94, 1794,
/* 1450 */ 579, 1796, 1797, 575, 574, 570, 1256, 1257, 1871, 1762, /* 1450 */ 579, 1796, 1797, 575, 574, 570, 358, 357, 1871, 1762,
/* 1460 */ 168, 576, 564, 1867, 1937, 362, 1748, 366, 364, 365, /* 1460 */ 362, 576, 564, 1867, 1937, 1256, 1257, 1748, 1747, 169,
/* 1470 */ 1747, 368, 1793, 370, 1745, 372, 1744, 162, 1746, 374, /* 1470 */ 364, 366, 1793, 365, 1746, 370, 368, 163, 1745, 372,
/* 1480 */ 1232, 1934, 1231, 1722, 1793, 1721, 1825, 379, 1720, 380, /* 1480 */ 1744, 1934, 374, 1232, 1793, 1231, 1825, 1722, 1721, 380,
/* 1490 */ 294, 1794, 579, 1796, 1797, 575, 573, 570, 567, 1843, /* 1490 */ 294, 1794, 579, 1796, 1797, 575, 573, 570, 567, 1843,
/* 1500 */ 1811, 1719, 1201, 1694, 126, 1693, 1692, 1691, 577, 69, /* 1500 */ 1811, 379, 1720, 1719, 1201, 1694, 127, 1693, 577, 1692,
/* 1510 */ 1690, 1689, 1811, 1762, 1688, 576, 1687, 1686, 395, 396, /* 1510 */ 1691, 69, 1811, 1762, 1690, 576, 1689, 1688, 1687, 1686,
/* 1520 */ 577, 1685, 398, 1684, 1683, 1762, 1682, 576, 1681, 1680, /* 1520 */ 577, 395, 1685, 398, 396, 1762, 1684, 576, 1683, 1682,
/* 1530 */ 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672, 1671, 1670, /* 1530 */ 1681, 1680, 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672,
/* 1540 */ 1825, 1793, 127, 1669, 146, 1794, 579, 1796, 1797, 575, /* 1540 */ 1825, 1793, 1671, 128, 147, 1794, 579, 1796, 1797, 575,
/* 1550 */ 1668, 570, 1825, 180, 176, 1534, 93, 1794, 579, 1796, /* 1550 */ 1670, 570, 1825, 180, 177, 1534, 94, 1794, 579, 1796,
/* 1560 */ 1797, 575, 1667, 570, 1666, 1793, 1871, 1203, 1664, 1811, /* 1560 */ 1797, 575, 1669, 570, 1668, 1793, 1871, 1203, 1664, 1811,
/* 1570 */ 1665, 1868, 1663, 1662, 323, 1661, 1535, 577, 177, 1532, /* 1570 */ 1667, 1868, 1666, 1665, 323, 1663, 1662, 577, 1661, 1535,
/* 1580 */ 1500, 117, 1762, 1793, 576, 1013, 179, 435, 554, 1951, /* 1580 */ 178, 1532, 1762, 1793, 576, 1500, 118, 156, 554, 1951,
/* 1590 */ 155, 1012, 437, 1811, 1499, 118, 1735, 1729, 526, 1718, /* 1590 */ 1499, 1013, 435, 1811, 1012, 437, 181, 119, 526, 1735,
/* 1600 */ 185, 577, 187, 1717, 1703, 1587, 1762, 1531, 576, 1825, /* 1600 */ 1729, 577, 1718, 188, 186, 1717, 1762, 1703, 576, 1825,
/* 1610 */ 1043, 1811, 1529, 295, 1794, 579, 1796, 1797, 575, 577, /* 1610 */ 1587, 1811, 1531, 295, 1794, 579, 1796, 1797, 575, 577,
/* 1620 */ 570, 452, 454, 1527, 1762, 453, 576, 456, 457, 458, /* 1620 */ 570, 1043, 1529, 452, 1762, 454, 576, 1527, 456, 453,
/* 1630 */ 1525, 461, 462, 1825, 1523, 460, 464, 295, 1794, 579, /* 1630 */ 457, 458, 1525, 1825, 461, 462, 460, 295, 1794, 579,
/* 1640 */ 1796, 1797, 575, 1512, 570, 1793, 1511, 466, 1496, 465, /* 1640 */ 1796, 1797, 575, 1523, 570, 1793, 464, 466, 1512, 1511,
/* 1650 */ 1589, 1825, 50, 196, 1154, 290, 1794, 579, 1796, 1797, /* 1650 */ 465, 1825, 1496, 1589, 1588, 290, 1794, 579, 1796, 1797,
/* 1660 */ 575, 1155, 570, 1793, 1588, 630, 1080, 632, 1077, 1075, /* 1660 */ 575, 50, 570, 1793, 1155, 197, 1154, 630, 1080, 632,
/* 1670 */ 1076, 1521, 1516, 1811, 318, 319, 486, 1514, 320, 489, /* 1670 */ 1077, 1076, 1075, 1811, 1521, 1516, 1514, 318, 319, 486,
/* 1680 */ 1495, 577, 1494, 1493, 491, 495, 1762, 94, 576, 493, /* 1680 */ 320, 577, 489, 1495, 1494, 1493, 1762, 495, 576, 95,
/* 1690 */ 1734, 1811, 1238, 544, 1728, 502, 1716, 56, 141, 574, /* 1690 */ 1734, 1811, 491, 544, 493, 1238, 1728, 56, 142, 574,
/* 1700 */ 1714, 1715, 1713, 214, 1762, 1712, 576, 15, 503, 321, /* 1700 */ 502, 1716, 1714, 1715, 1762, 503, 576, 1713, 215, 321,
/* 1710 */ 219, 1710, 1702, 1825, 225, 1793, 229, 146, 1794, 579, /* 1710 */ 508, 1712, 15, 1825, 226, 1793, 1710, 147, 1794, 579,
/* 1720 */ 1796, 1797, 575, 227, 570, 508, 78, 79, 84, 517, /* 1720 */ 1796, 1797, 575, 1248, 570, 1702, 517, 220, 78, 80,
/* 1730 */ 41, 1825, 232, 1793, 23, 294, 1794, 579, 1796, 1797, /* 1730 */ 79, 1825, 232, 1793, 23, 294, 1794, 579, 1796, 1797,
/* 1740 */ 575, 1248, 570, 1811, 1844, 1437, 16, 234, 338, 236, /* 1740 */ 575, 85, 570, 1811, 1844, 243, 16, 229, 338, 41,
/* 1750 */ 1419, 577, 47, 242, 238, 148, 1762, 1793, 576, 1421, /* 1750 */ 1783, 577, 1437, 234, 17, 238, 1762, 1793, 576, 252,
/* 1760 */ 1414, 1811, 1952, 241, 24, 243, 340, 1783, 83, 577, /* 1760 */ 236, 1811, 1952, 1419, 47, 242, 340, 1421, 149, 577,
/* 1770 */ 25, 1394, 252, 46, 1762, 1393, 576, 1782, 1454, 152, /* 1770 */ 241, 24, 25, 46, 1762, 1449, 576, 1414, 84, 1782,
/* 1780 */ 18, 1443, 1449, 1825, 1448, 1811, 332, 295, 1794, 579, /* 1780 */ 153, 18, 1394, 1825, 1393, 1811, 45, 295, 1794, 579,
/* 1790 */ 1796, 1797, 575, 577, 570, 1453, 17, 1452, 1762, 333, /* 1790 */ 1796, 1797, 575, 577, 570, 1454, 1448, 13, 1762, 1443,
/* 1800 */ 576, 1825, 10, 1280, 1356, 295, 1794, 579, 1796, 1797, /* 1800 */ 576, 1825, 332, 1453, 1452, 295, 1794, 579, 1796, 1797,
/* 1810 */ 575, 19, 570, 1793, 45, 1331, 13, 1828, 569, 153, /* 1810 */ 575, 333, 570, 1793, 10, 1280, 19, 1828, 154, 1311,
/* 1820 */ 166, 1311, 580, 578, 1329, 1825, 1328, 1793, 31, 281, /* 1820 */ 569, 1356, 582, 167, 31, 1825, 1331, 1793, 12, 281,
/* 1830 */ 1794, 579, 1796, 1797, 575, 12, 570, 20, 582, 21, /* 1830 */ 1794, 579, 1796, 1797, 575, 1329, 570, 1328, 20, 21,
/* 1840 */ 341, 1811, 1141, 584, 586, 1138, 587, 589, 1135, 577, /* 1840 */ 341, 1811, 580, 1141, 584, 587, 578, 1138, 586, 577,
/* 1850 */ 590, 592, 595, 1129, 1762, 1811, 576, 1127, 593, 596, /* 1850 */ 1135, 589, 590, 592, 1762, 1811, 576, 595, 1118, 1133,
/* 1860 */ 1118, 85, 1150, 577, 86, 62, 1133, 602, 1762, 1793, /* 1860 */ 1129, 1127, 1150, 577, 593, 1132, 602, 596, 1762, 1793,
/* 1870 */ 576, 263, 1132, 1146, 1072, 1041, 611, 1071, 1131, 1793, /* 1870 */ 576, 1131, 1130, 263, 86, 87, 1146, 62, 611, 1793,
/* 1880 */ 1070, 1825, 1068, 1066, 1130, 282, 1794, 579, 1796, 1797, /* 1880 */ 1072, 1825, 1041, 1071, 1070, 282, 1794, 579, 1796, 1797,
/* 1890 */ 575, 1065, 570, 1064, 1087, 1825, 264, 1811, 620, 289, /* 1890 */ 575, 1068, 570, 1066, 1065, 1825, 1064, 1811, 620, 289,
/* 1900 */ 1794, 579, 1796, 1797, 575, 577, 570, 1811, 1062, 1061, /* 1900 */ 1794, 579, 1796, 1797, 575, 577, 570, 1811, 1087, 264,
/* 1910 */ 1762, 1060, 576, 1059, 1058, 577, 1057, 1056, 1084, 1082, /* 1910 */ 1762, 1062, 576, 1061, 1060, 577, 1059, 1058, 1057, 1056,
/* 1920 */ 1762, 1793, 576, 1053, 1047, 1528, 1052, 1526, 1049, 1048, /* 1920 */ 1762, 1793, 576, 1084, 1082, 1047, 1053, 1528, 1052, 1049,
/* 1930 */ 1046, 640, 641, 644, 645, 1524, 642, 1825, 646, 648, /* 1930 */ 1526, 1048, 1046, 640, 641, 644, 1524, 1825, 642, 648,
/* 1940 */ 650, 291, 1794, 579, 1796, 1797, 575, 1825, 570, 1811, /* 1940 */ 646, 291, 1794, 579, 1796, 1797, 575, 1825, 570, 1811,
/* 1950 */ 649, 283, 1794, 579, 1796, 1797, 575, 577, 570, 1522, /* 1950 */ 650, 283, 1794, 579, 1796, 1797, 575, 577, 570, 645,
/* 1960 */ 653, 652, 1762, 654, 576, 1510, 656, 1003, 1492, 267, /* 1960 */ 649, 1522, 1762, 652, 576, 653, 1510, 656, 654, 1003,
/* 1970 */ 660, 1467, 1266, 275, 1793, 663, 664, 1467, 1467, 1467, /* 1970 */ 1492, 267, 660, 663, 1793, 1266, 275, 664, 1467, 1467,
/* 1980 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1825, /* 1980 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1825,
/* 1990 */ 1467, 1467, 1793, 292, 1794, 579, 1796, 1797, 575, 1467, /* 1990 */ 1467, 1467, 1793, 292, 1794, 579, 1796, 1797, 575, 1467,
/* 2000 */ 570, 1467, 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467, /* 2000 */ 570, 1467, 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467,
@ -568,96 +568,96 @@ static const YYCODETYPE yy_lookahead[] = {
/* 1050 */ 90, 375, 8, 9, 90, 68, 12, 13, 14, 15, /* 1050 */ 90, 375, 8, 9, 90, 68, 12, 13, 14, 15,
/* 1060 */ 16, 8, 9, 296, 43, 12, 13, 14, 15, 16, /* 1060 */ 16, 8, 9, 296, 43, 12, 13, 14, 15, 16,
/* 1070 */ 288, 268, 125, 126, 327, 328, 172, 277, 296, 162, /* 1070 */ 288, 268, 125, 126, 327, 328, 172, 277, 296, 162,
/* 1080 */ 163, 164, 279, 301, 167, 303, 339, 90, 43, 46, /* 1080 */ 163, 164, 279, 301, 167, 303, 339, 90, 269, 46,
/* 1090 */ 13, 369, 90, 35, 89, 269, 90, 228, 111, 296, /* 1090 */ 13, 369, 90, 35, 89, 365, 90, 228, 111, 296,
/* 1100 */ 183, 324, 43, 186, 99, 188, 189, 190, 191, 192, /* 1100 */ 183, 324, 43, 186, 99, 188, 189, 190, 191, 192,
/* 1110 */ 328, 90, 35, 43, 332, 333, 334, 335, 336, 337, /* 1110 */ 328, 90, 35, 43, 332, 333, 334, 335, 336, 337,
/* 1120 */ 268, 339, 193, 268, 342, 268, 268, 268, 346, 347, /* 1120 */ 268, 339, 193, 268, 342, 268, 268, 268, 346, 347,
/* 1130 */ 348, 279, 89, 35, 279, 90, 279, 279, 279, 13, /* 1130 */ 348, 279, 89, 35, 279, 268, 279, 279, 279, 13,
/* 1140 */ 43, 260, 360, 90, 227, 365, 269, 267, 296, 90, /* 1140 */ 43, 260, 360, 90, 227, 269, 279, 267, 296, 90,
/* 1150 */ 368, 296, 43, 296, 296, 296, 288, 170, 43, 172, /* 1150 */ 368, 296, 43, 296, 296, 296, 288, 170, 43, 172,
/* 1160 */ 90, 35, 300, 43, 331, 43, 68, 356, 349, 288, /* 1160 */ 90, 35, 300, 296, 331, 43, 68, 356, 372, 288,
/* 1170 */ 372, 372, 359, 372, 43, 229, 326, 296, 325, 47, /* 1170 */ 349, 372, 359, 372, 43, 43, 326, 296, 43, 229,
/* 1180 */ 193, 194, 301, 260, 303, 248, 168, 90, 42, 319, /* 1180 */ 193, 194, 301, 260, 303, 248, 47, 90, 325, 319,
/* 1190 */ 308, 20, 205, 206, 207, 208, 209, 210, 211, 90, /* 1190 */ 42, 168, 205, 206, 207, 208, 209, 210, 211, 90,
/* 1200 */ 268, 157, 268, 308, 152, 90, 306, 306, 246, 328, /* 1200 */ 308, 157, 20, 268, 268, 90, 152, 308, 246, 328,
/* 1210 */ 90, 288, 90, 332, 333, 334, 335, 336, 337, 296, /* 1210 */ 268, 288, 90, 332, 333, 334, 335, 336, 337, 296,
/* 1220 */ 339, 90, 268, 342, 301, 268, 303, 346, 347, 348, /* 1220 */ 339, 90, 90, 342, 301, 90, 303, 346, 347, 348,
/* 1230 */ 172, 20, 262, 268, 262, 20, 260, 20, 323, 272, /* 1230 */ 172, 306, 306, 268, 268, 20, 260, 262, 20, 262,
/* 1240 */ 272, 303, 316, 20, 316, 318, 272, 272, 20, 368, /* 1240 */ 272, 303, 323, 272, 316, 20, 20, 316, 318, 368,
/* 1250 */ 309, 328, 272, 260, 272, 332, 333, 334, 335, 336, /* 1250 */ 272, 328, 272, 260, 20, 332, 333, 334, 335, 336,
/* 1260 */ 337, 272, 339, 268, 288, 342, 262, 301, 175, 346, /* 1260 */ 337, 309, 339, 272, 288, 342, 272, 268, 272, 346,
/* 1270 */ 347, 348, 296, 288, 288, 262, 288, 301, 288, 303, /* 1270 */ 347, 348, 296, 288, 262, 262, 288, 301, 288, 303,
/* 1280 */ 357, 288, 288, 268, 288, 268, 288, 288, 288, 296, /* 1280 */ 357, 288, 268, 288, 301, 270, 288, 175, 288, 296,
/* 1290 */ 270, 288, 323, 322, 301, 288, 303, 270, 268, 316, /* 1290 */ 323, 288, 288, 268, 301, 288, 303, 288, 288, 270,
/* 1300 */ 234, 270, 301, 312, 328, 154, 296, 284, 332, 333, /* 1300 */ 268, 270, 316, 322, 328, 234, 154, 20, 332, 333,
/* 1310 */ 334, 335, 336, 337, 20, 339, 260, 303, 342, 310, /* 1310 */ 334, 335, 336, 337, 296, 339, 260, 270, 342, 303,
/* 1320 */ 301, 328, 346, 347, 348, 332, 333, 334, 335, 336, /* 1320 */ 312, 328, 346, 347, 348, 332, 333, 334, 335, 336,
/* 1330 */ 337, 270, 339, 357, 301, 342, 301, 312, 301, 346, /* 1330 */ 337, 301, 339, 357, 301, 342, 301, 301, 312, 346,
/* 1340 */ 347, 348, 270, 309, 288, 296, 235, 331, 301, 301, /* 1340 */ 347, 348, 301, 309, 288, 284, 270, 310, 331, 301,
/* 1350 */ 357, 312, 296, 312, 241, 301, 364, 301, 301, 303, /* 1350 */ 357, 312, 296, 235, 312, 241, 364, 301, 301, 303,
/* 1360 */ 161, 301, 243, 242, 230, 226, 260, 296, 326, 20, /* 1360 */ 161, 301, 243, 301, 301, 364, 260, 242, 230, 226,
/* 1370 */ 330, 247, 364, 317, 245, 250, 260, 89, 89, 367, /* 1370 */ 296, 326, 20, 317, 247, 245, 260, 89, 250, 330,
/* 1380 */ 292, 301, 278, 36, 328, 268, 263, 363, 332, 333, /* 1380 */ 89, 292, 301, 363, 328, 361, 367, 270, 332, 333,
/* 1390 */ 334, 335, 336, 337, 288, 339, 320, 270, 366, 361, /* 1390 */ 334, 335, 336, 337, 288, 339, 36, 268, 278, 263,
/* 1400 */ 364, 373, 296, 374, 288, 379, 262, 301, 362, 303, /* 1400 */ 362, 374, 296, 262, 288, 320, 366, 301, 315, 303,
/* 1410 */ 345, 315, 296, 271, 358, 282, 0, 301, 260, 303, /* 1410 */ 364, 345, 296, 271, 358, 282, 282, 301, 260, 303,
/* 1420 */ 282, 258, 282, 317, 374, 374, 0, 371, 373, 177, /* 1420 */ 258, 0, 282, 317, 373, 0, 374, 371, 373, 379,
/* 1430 */ 0, 375, 0, 42, 328, 373, 0, 35, 332, 333, /* 1430 */ 177, 375, 0, 0, 328, 42, 0, 373, 332, 333,
/* 1440 */ 334, 335, 336, 337, 328, 339, 288, 187, 332, 333, /* 1440 */ 334, 335, 336, 337, 328, 339, 288, 374, 332, 333,
/* 1450 */ 334, 335, 336, 337, 296, 339, 35, 35, 342, 301, /* 1450 */ 334, 335, 336, 337, 296, 339, 187, 35, 342, 301,
/* 1460 */ 35, 303, 346, 347, 358, 187, 0, 187, 35, 35, /* 1460 */ 187, 303, 346, 347, 358, 35, 35, 0, 0, 35,
/* 1470 */ 0, 187, 260, 35, 0, 22, 0, 371, 0, 35, /* 1470 */ 35, 187, 260, 35, 0, 35, 187, 371, 0, 22,
/* 1480 */ 172, 375, 170, 0, 260, 0, 328, 166, 0, 165, /* 1480 */ 0, 375, 35, 172, 260, 170, 328, 0, 0, 165,
/* 1490 */ 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, /* 1490 */ 332, 333, 334, 335, 336, 337, 338, 339, 340, 341,
/* 1500 */ 288, 0, 46, 0, 42, 0, 0, 0, 296, 149, /* 1500 */ 288, 166, 0, 0, 46, 0, 42, 0, 296, 0,
/* 1510 */ 0, 0, 288, 301, 0, 303, 0, 0, 144, 35, /* 1510 */ 0, 149, 288, 301, 0, 303, 0, 0, 0, 0,
/* 1520 */ 296, 0, 144, 0, 0, 301, 0, 303, 0, 0, /* 1520 */ 296, 144, 0, 144, 35, 301, 0, 303, 0, 0,
/* 1530 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1530 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 1540 */ 328, 260, 42, 0, 332, 333, 334, 335, 336, 337, /* 1540 */ 328, 260, 0, 42, 332, 333, 334, 335, 336, 337,
/* 1550 */ 0, 339, 328, 40, 56, 0, 332, 333, 334, 335, /* 1550 */ 0, 339, 328, 42, 56, 0, 332, 333, 334, 335,
/* 1560 */ 336, 337, 0, 339, 0, 260, 342, 22, 0, 288, /* 1560 */ 336, 337, 0, 339, 0, 260, 342, 22, 0, 288,
/* 1570 */ 0, 347, 0, 0, 293, 0, 0, 296, 56, 0, /* 1570 */ 0, 347, 0, 0, 293, 0, 0, 296, 0, 0,
/* 1580 */ 0, 39, 301, 260, 303, 14, 42, 46, 376, 377, /* 1580 */ 56, 0, 301, 260, 303, 0, 39, 43, 376, 377,
/* 1590 */ 43, 14, 46, 288, 0, 39, 0, 0, 293, 0, /* 1590 */ 0, 14, 46, 288, 14, 46, 40, 39, 293, 0,
/* 1600 */ 39, 296, 161, 0, 0, 0, 301, 0, 303, 328, /* 1600 */ 0, 296, 0, 161, 39, 0, 301, 0, 303, 328,
/* 1610 */ 62, 288, 0, 332, 333, 334, 335, 336, 337, 296, /* 1610 */ 0, 288, 0, 332, 333, 334, 335, 336, 337, 296,
/* 1620 */ 339, 35, 39, 0, 301, 47, 303, 35, 47, 39, /* 1620 */ 339, 62, 0, 35, 301, 39, 303, 0, 35, 47,
/* 1630 */ 0, 47, 39, 328, 0, 35, 35, 332, 333, 334, /* 1630 */ 47, 39, 0, 328, 47, 39, 35, 332, 333, 334,
/* 1640 */ 335, 336, 337, 0, 339, 260, 0, 39, 0, 47, /* 1640 */ 335, 336, 337, 0, 339, 260, 35, 39, 0, 0,
/* 1650 */ 0, 328, 98, 96, 22, 332, 333, 334, 335, 336, /* 1650 */ 47, 328, 0, 0, 0, 332, 333, 334, 335, 336,
/* 1660 */ 337, 35, 339, 260, 0, 43, 35, 43, 35, 22, /* 1660 */ 337, 98, 339, 260, 35, 96, 22, 43, 35, 43,
/* 1670 */ 35, 0, 0, 288, 22, 22, 49, 0, 22, 35, /* 1670 */ 35, 35, 22, 288, 0, 0, 0, 22, 22, 49,
/* 1680 */ 0, 296, 0, 0, 35, 22, 301, 20, 303, 35, /* 1680 */ 22, 296, 35, 0, 0, 0, 301, 22, 303, 20,
/* 1690 */ 0, 288, 35, 370, 0, 22, 0, 157, 173, 296, /* 1690 */ 0, 288, 35, 370, 35, 35, 0, 157, 173, 296,
/* 1700 */ 0, 0, 0, 154, 301, 0, 303, 89, 157, 157, /* 1700 */ 22, 0, 0, 0, 301, 157, 303, 0, 154, 157,
/* 1710 */ 90, 0, 0, 328, 89, 260, 153, 332, 333, 334, /* 1710 */ 159, 0, 89, 328, 89, 260, 0, 332, 333, 334,
/* 1720 */ 335, 336, 337, 39, 339, 159, 89, 89, 99, 155, /* 1720 */ 335, 336, 337, 182, 339, 0, 155, 90, 89, 89,
/* 1730 */ 43, 328, 46, 260, 89, 332, 333, 334, 335, 336, /* 1730 */ 39, 328, 46, 260, 89, 332, 333, 334, 335, 336,
/* 1740 */ 337, 182, 339, 288, 341, 90, 231, 89, 293, 90, /* 1740 */ 337, 99, 339, 288, 341, 46, 231, 153, 293, 43,
/* 1750 */ 90, 296, 43, 43, 89, 89, 301, 260, 303, 90, /* 1750 */ 46, 296, 90, 89, 231, 89, 301, 260, 303, 46,
/* 1760 */ 90, 288, 377, 89, 89, 46, 293, 46, 89, 296, /* 1760 */ 90, 288, 377, 90, 43, 43, 293, 90, 89, 296,
/* 1770 */ 43, 90, 46, 43, 301, 90, 303, 46, 90, 46, /* 1770 */ 89, 89, 43, 43, 301, 35, 303, 90, 89, 46,
/* 1780 */ 43, 90, 35, 328, 35, 288, 35, 332, 333, 334, /* 1780 */ 46, 43, 90, 328, 90, 288, 225, 332, 333, 334,
/* 1790 */ 335, 336, 337, 296, 339, 35, 231, 35, 301, 35, /* 1790 */ 335, 336, 337, 296, 339, 90, 35, 231, 301, 90,
/* 1800 */ 303, 328, 2, 22, 193, 332, 333, 334, 335, 336, /* 1800 */ 303, 328, 35, 35, 35, 332, 333, 334, 335, 336,
/* 1810 */ 337, 43, 339, 260, 225, 90, 231, 89, 89, 46, /* 1810 */ 337, 35, 339, 260, 2, 22, 43, 89, 46, 22,
/* 1820 */ 46, 22, 100, 195, 90, 328, 90, 260, 89, 332, /* 1820 */ 89, 193, 35, 46, 89, 328, 90, 260, 89, 332,
/* 1830 */ 333, 334, 335, 336, 337, 89, 339, 89, 35, 89, /* 1830 */ 333, 334, 335, 336, 337, 90, 339, 90, 89, 89,
/* 1840 */ 35, 288, 90, 89, 35, 90, 89, 35, 90, 296, /* 1840 */ 35, 288, 100, 90, 89, 89, 195, 90, 35, 296,
/* 1850 */ 89, 35, 35, 90, 301, 288, 303, 90, 89, 89, /* 1850 */ 90, 35, 89, 35, 301, 288, 303, 35, 22, 113,
/* 1860 */ 22, 89, 35, 296, 89, 89, 113, 101, 301, 260, /* 1860 */ 90, 90, 35, 296, 89, 113, 101, 89, 301, 260,
/* 1870 */ 303, 43, 113, 22, 35, 62, 61, 35, 113, 260, /* 1870 */ 303, 113, 113, 43, 89, 89, 22, 89, 61, 260,
/* 1880 */ 35, 328, 35, 35, 113, 332, 333, 334, 335, 336, /* 1880 */ 35, 328, 62, 35, 35, 332, 333, 334, 335, 336,
/* 1890 */ 337, 35, 339, 35, 68, 328, 43, 288, 87, 332, /* 1890 */ 337, 35, 339, 35, 35, 328, 35, 288, 87, 332,
/* 1900 */ 333, 334, 335, 336, 337, 296, 339, 288, 35, 35, /* 1900 */ 333, 334, 335, 336, 337, 296, 339, 288, 68, 43,
/* 1910 */ 301, 22, 303, 35, 22, 296, 35, 35, 68, 35, /* 1910 */ 301, 35, 303, 35, 22, 296, 35, 22, 35, 35,
/* 1920 */ 301, 260, 303, 35, 22, 0, 35, 0, 35, 35, /* 1920 */ 301, 260, 303, 68, 35, 22, 35, 0, 35, 35,
/* 1930 */ 35, 35, 47, 35, 47, 0, 39, 328, 39, 35, /* 1930 */ 0, 35, 35, 35, 47, 35, 0, 328, 39, 35,
/* 1940 */ 39, 332, 333, 334, 335, 336, 337, 328, 339, 288, /* 1940 */ 39, 332, 333, 334, 335, 336, 337, 328, 339, 288,
/* 1950 */ 47, 332, 333, 334, 335, 336, 337, 296, 339, 0, /* 1950 */ 39, 332, 333, 334, 335, 336, 337, 296, 339, 47,
/* 1960 */ 47, 35, 301, 39, 303, 0, 35, 35, 0, 22, /* 1960 */ 47, 0, 301, 35, 303, 47, 0, 35, 39, 35,
/* 1970 */ 21, 380, 22, 22, 260, 21, 20, 380, 380, 380, /* 1970 */ 0, 22, 21, 21, 260, 22, 22, 20, 380, 380,
/* 1980 */ 380, 380, 380, 380, 380, 380, 380, 380, 380, 328, /* 1980 */ 380, 380, 380, 380, 380, 380, 380, 380, 380, 328,
/* 1990 */ 380, 380, 260, 332, 333, 334, 335, 336, 337, 380, /* 1990 */ 380, 380, 260, 332, 333, 334, 335, 336, 337, 380,
/* 2000 */ 339, 380, 288, 380, 380, 380, 380, 380, 380, 380, /* 2000 */ 339, 380, 288, 380, 380, 380, 380, 380, 380, 380,
@ -703,7 +703,7 @@ static const YYCODETYPE yy_lookahead[] = {
}; };
#define YY_SHIFT_COUNT (665) #define YY_SHIFT_COUNT (665)
#define YY_SHIFT_MIN (0) #define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (1968) #define YY_SHIFT_MAX (1970)
static const unsigned short int yy_shift_ofst[] = { static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 917, 0, 0, 62, 62, 264, 264, 264, 326, 326, /* 0 */ 917, 0, 0, 62, 62, 264, 264, 264, 326, 326,
/* 10 */ 264, 264, 391, 593, 720, 593, 593, 593, 593, 593, /* 10 */ 264, 264, 391, 593, 720, 593, 593, 593, 593, 593,
@ -712,66 +712,66 @@ static const unsigned short int yy_shift_ofst[] = {
/* 40 */ 593, 593, 313, 313, 199, 199, 199, 987, 987, 354, /* 40 */ 593, 593, 313, 313, 199, 199, 199, 987, 987, 354,
/* 50 */ 987, 987, 165, 341, 254, 258, 254, 79, 79, 36, /* 50 */ 987, 987, 165, 341, 254, 258, 254, 79, 79, 36,
/* 60 */ 36, 97, 18, 254, 254, 79, 79, 79, 79, 79, /* 60 */ 36, 97, 18, 254, 254, 79, 79, 79, 79, 79,
/* 70 */ 79, 79, 79, 79, 82, 79, 79, 79, 170, 205, /* 70 */ 79, 79, 79, 79, 82, 79, 79, 79, 170, 79,
/* 80 */ 79, 79, 205, 405, 79, 205, 205, 205, 79, 158, /* 80 */ 205, 79, 79, 205, 405, 79, 205, 205, 205, 79,
/* 90 */ 719, 662, 683, 683, 108, 371, 371, 371, 371, 371, /* 90 */ 158, 719, 662, 683, 683, 108, 371, 371, 371, 371,
/* 100 */ 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, /* 100 */ 371, 371, 371, 371, 371, 371, 371, 371, 371, 371,
/* 110 */ 371, 371, 371, 371, 134, 419, 18, 636, 636, 488, /* 110 */ 371, 371, 371, 371, 371, 134, 419, 18, 636, 636,
/* 120 */ 551, 562, 90, 90, 90, 551, 526, 526, 170, 16, /* 120 */ 488, 551, 562, 90, 90, 90, 551, 526, 526, 170,
/* 130 */ 16, 205, 205, 323, 323, 483, 498, 198, 198, 198, /* 130 */ 16, 16, 205, 205, 323, 323, 483, 498, 198, 198,
/* 140 */ 198, 198, 198, 198, 331, 21, 167, 559, 43, 50, /* 140 */ 198, 198, 198, 198, 198, 331, 21, 167, 559, 43,
/* 150 */ 112, 168, 99, 421, 19, 530, 771, 755, 717, 603, /* 150 */ 50, 112, 168, 99, 421, 19, 530, 771, 755, 717,
/* 160 */ 717, 918, 501, 501, 501, 869, 822, 946, 1132, 1018, /* 160 */ 603, 717, 918, 501, 501, 501, 869, 822, 950, 1139,
/* 170 */ 1146, 1171, 1171, 1146, 1052, 1052, 1171, 1171, 1171, 1211, /* 170 */ 1023, 1148, 1182, 1182, 1148, 1054, 1054, 1182, 1182, 1182,
/* 180 */ 1211, 1215, 82, 170, 82, 1217, 1223, 82, 1217, 82, /* 180 */ 1215, 1215, 1218, 82, 170, 82, 1225, 1226, 82, 1225,
/* 190 */ 1228, 82, 82, 1171, 82, 1211, 205, 205, 205, 205, /* 190 */ 82, 1234, 82, 82, 1182, 82, 1215, 205, 205, 205,
/* 200 */ 205, 205, 205, 205, 205, 205, 205, 1171, 1211, 323, /* 200 */ 205, 205, 205, 205, 205, 205, 205, 205, 1182, 1215,
/* 210 */ 1215, 158, 1093, 170, 158, 1171, 1171, 1217, 158, 1066, /* 210 */ 323, 1218, 158, 1112, 170, 158, 1182, 1182, 1225, 158,
/* 220 */ 323, 323, 323, 323, 1066, 323, 1151, 526, 1228, 158, /* 220 */ 1071, 323, 323, 323, 323, 1071, 323, 1152, 1234, 158,
/* 230 */ 483, 158, 526, 1294, 323, 1111, 1066, 323, 323, 1111, /* 230 */ 483, 158, 526, 1287, 323, 1118, 1071, 323, 323, 1118,
/* 240 */ 1066, 323, 323, 205, 1113, 1199, 1111, 1119, 1121, 1134, /* 240 */ 1071, 323, 323, 205, 1114, 1199, 1118, 1119, 1125, 1138,
/* 250 */ 946, 1139, 526, 1349, 1124, 1129, 1125, 1124, 1129, 1124, /* 250 */ 950, 1143, 526, 1352, 1127, 1130, 1128, 1127, 1130, 1127,
/* 260 */ 1129, 1288, 1289, 323, 498, 1171, 158, 1347, 1211, 2395, /* 260 */ 1130, 1288, 1291, 323, 498, 1182, 158, 1360, 1215, 2395,
/* 270 */ 2395, 2395, 2395, 2395, 2395, 2395, 83, 456, 214, 307, /* 270 */ 2395, 2395, 2395, 2395, 2395, 2395, 83, 456, 214, 307,
/* 280 */ 208, 564, 693, 808, 824, 1044, 1053, 513, 542, 542, /* 280 */ 208, 564, 693, 808, 824, 1044, 1053, 513, 542, 542,
/* 290 */ 542, 542, 542, 542, 542, 542, 545, 129, 13, 13, /* 290 */ 542, 542, 542, 542, 542, 542, 545, 129, 13, 13,
/* 300 */ 236, 594, 430, 581, 387, 172, 452, 511, 106, 106, /* 300 */ 236, 594, 430, 581, 387, 172, 452, 511, 106, 106,
/* 310 */ 106, 106, 914, 963, 875, 898, 943, 945, 973, 979, /* 310 */ 106, 106, 914, 963, 875, 898, 943, 945, 973, 979,
/* 320 */ 1011, 423, 860, 960, 964, 997, 1002, 1021, 1045, 1059, /* 320 */ 1011, 423, 860, 960, 964, 997, 1002, 1021, 1059, 1070,
/* 330 */ 1022, 947, 962, 937, 1006, 904, 1058, 929, 1070, 1043, /* 330 */ 1022, 947, 962, 937, 1006, 904, 1058, 929, 1097, 1043,
/* 340 */ 1097, 1109, 1115, 1120, 1122, 1131, 1005, 1077, 1126, 1098, /* 340 */ 1109, 1115, 1122, 1131, 1132, 1135, 1005, 1077, 1126, 1098,
/* 350 */ 764, 1416, 1426, 1252, 1430, 1432, 1391, 1436, 1402, 1260, /* 350 */ 764, 1421, 1425, 1253, 1432, 1433, 1393, 1436, 1422, 1269,
/* 360 */ 1421, 1422, 1425, 1278, 1466, 1433, 1434, 1280, 1470, 1284, /* 360 */ 1430, 1431, 1434, 1273, 1467, 1435, 1438, 1284, 1468, 1289,
/* 370 */ 1478, 1438, 1474, 1453, 1476, 1444, 1308, 1312, 1483, 1485, /* 370 */ 1474, 1440, 1478, 1457, 1480, 1447, 1311, 1315, 1487, 1488,
/* 380 */ 1321, 1324, 1488, 1501, 1456, 1503, 1462, 1505, 1506, 1507, /* 380 */ 1335, 1324, 1502, 1503, 1458, 1505, 1464, 1507, 1509, 1510,
/* 390 */ 1360, 1510, 1511, 1514, 1516, 1517, 1374, 1484, 1521, 1378, /* 390 */ 1362, 1514, 1516, 1517, 1518, 1519, 1377, 1489, 1522, 1379,
/* 400 */ 1523, 1524, 1526, 1528, 1529, 1530, 1531, 1532, 1533, 1534, /* 400 */ 1526, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536,
/* 410 */ 1535, 1536, 1537, 1538, 1500, 1539, 1543, 1550, 1562, 1564, /* 410 */ 1537, 1538, 1539, 1542, 1501, 1550, 1562, 1564, 1570, 1572,
/* 420 */ 1570, 1545, 1568, 1572, 1573, 1575, 1576, 1498, 1555, 1522, /* 420 */ 1573, 1545, 1568, 1575, 1576, 1578, 1579, 1498, 1555, 1524,
/* 430 */ 1579, 1580, 1544, 1542, 1547, 1571, 1541, 1577, 1546, 1594, /* 430 */ 1581, 1585, 1511, 1547, 1544, 1577, 1546, 1580, 1549, 1590,
/* 440 */ 1513, 1556, 1596, 1597, 1599, 1561, 1441, 1603, 1604, 1605, /* 440 */ 1556, 1558, 1599, 1600, 1602, 1565, 1442, 1605, 1607, 1610,
/* 450 */ 1548, 1607, 1612, 1586, 1578, 1583, 1623, 1592, 1581, 1590, /* 450 */ 1559, 1612, 1622, 1588, 1582, 1586, 1627, 1593, 1583, 1592,
/* 460 */ 1630, 1600, 1584, 1593, 1634, 1601, 1602, 1608, 1643, 1646, /* 460 */ 1632, 1601, 1587, 1596, 1643, 1611, 1603, 1608, 1648, 1649,
/* 470 */ 1648, 1650, 1554, 1557, 1626, 1632, 1664, 1631, 1622, 1624, /* 470 */ 1652, 1653, 1563, 1569, 1629, 1644, 1654, 1633, 1624, 1626,
/* 480 */ 1633, 1635, 1647, 1671, 1652, 1672, 1653, 1627, 1677, 1656, /* 480 */ 1635, 1636, 1650, 1674, 1655, 1675, 1656, 1630, 1676, 1658,
/* 490 */ 1644, 1680, 1649, 1682, 1654, 1683, 1663, 1667, 1690, 1540, /* 490 */ 1647, 1683, 1657, 1684, 1659, 1685, 1665, 1669, 1690, 1540,
/* 500 */ 1657, 1694, 1525, 1673, 1551, 1549, 1696, 1700, 1552, 1566, /* 500 */ 1660, 1696, 1525, 1678, 1548, 1554, 1701, 1702, 1552, 1551,
/* 510 */ 1701, 1702, 1705, 1618, 1620, 1559, 1711, 1625, 1574, 1637, /* 510 */ 1703, 1707, 1711, 1623, 1637, 1541, 1716, 1625, 1571, 1639,
/* 520 */ 1712, 1684, 1563, 1638, 1629, 1686, 1687, 1515, 1645, 1655, /* 520 */ 1725, 1691, 1594, 1640, 1642, 1686, 1706, 1515, 1645, 1662,
/* 530 */ 1658, 1659, 1660, 1665, 1709, 1669, 1666, 1674, 1675, 1670, /* 530 */ 1664, 1670, 1673, 1666, 1721, 1677, 1679, 1681, 1682, 1687,
/* 540 */ 1710, 1719, 1721, 1679, 1727, 1565, 1681, 1685, 1726, 1589, /* 540 */ 1722, 1699, 1704, 1689, 1729, 1523, 1692, 1694, 1713, 1561,
/* 550 */ 1730, 1731, 1733, 1688, 1737, 1585, 1691, 1747, 1749, 1751, /* 550 */ 1730, 1733, 1734, 1705, 1738, 1566, 1709, 1740, 1761, 1767,
/* 560 */ 1760, 1762, 1764, 1691, 1800, 1781, 1611, 1768, 1728, 1725, /* 560 */ 1768, 1769, 1776, 1709, 1812, 1793, 1628, 1773, 1728, 1736,
/* 570 */ 1729, 1734, 1739, 1736, 1773, 1746, 1748, 1774, 1799, 1628, /* 570 */ 1731, 1745, 1735, 1747, 1772, 1739, 1749, 1777, 1797, 1651,
/* 580 */ 1750, 1722, 1752, 1803, 1805, 1754, 1755, 1809, 1757, 1758, /* 580 */ 1750, 1742, 1753, 1787, 1805, 1755, 1757, 1813, 1756, 1760,
/* 590 */ 1812, 1761, 1763, 1816, 1769, 1767, 1817, 1770, 1753, 1759, /* 590 */ 1816, 1763, 1770, 1818, 1775, 1771, 1822, 1778, 1746, 1752,
/* 600 */ 1765, 1771, 1838, 1766, 1772, 1775, 1827, 1776, 1828, 1828, /* 600 */ 1758, 1759, 1836, 1765, 1785, 1786, 1827, 1788, 1830, 1830,
/* 610 */ 1851, 1813, 1815, 1839, 1842, 1845, 1847, 1848, 1856, 1858, /* 610 */ 1854, 1820, 1817, 1845, 1848, 1849, 1856, 1858, 1859, 1861,
/* 620 */ 1826, 1811, 1853, 1873, 1874, 1889, 1878, 1892, 1881, 1882, /* 620 */ 1840, 1811, 1866, 1876, 1878, 1892, 1881, 1895, 1883, 1884,
/* 630 */ 1850, 1622, 1884, 1624, 1888, 1891, 1893, 1894, 1902, 1895, /* 630 */ 1855, 1624, 1889, 1626, 1891, 1893, 1894, 1896, 1903, 1897,
/* 640 */ 1925, 1896, 1885, 1897, 1927, 1898, 1887, 1899, 1935, 1904, /* 640 */ 1927, 1898, 1887, 1899, 1930, 1900, 1912, 1901, 1936, 1904,
/* 650 */ 1903, 1901, 1959, 1926, 1913, 1924, 1965, 1931, 1932, 1968, /* 650 */ 1913, 1911, 1961, 1928, 1918, 1929, 1966, 1932, 1934, 1970,
/* 660 */ 1947, 1949, 1950, 1951, 1954, 1956, /* 660 */ 1949, 1951, 1953, 1954, 1952, 1957,
}; };
#define YY_REDUCE_COUNT (275) #define YY_REDUCE_COUNT (275)
#define YY_REDUCE_MIN (-357) #define YY_REDUCE_MIN (-357)
@ -784,27 +784,27 @@ static const short yy_reduce_ofst[] = {
/* 40 */ 2045, 2055, 376, 676, -259, 76, 142, 117, 687, -180, /* 40 */ 2045, 2055, 376, 676, -259, 76, 142, 117, 687, -180,
/* 50 */ -284, 747, -30, 250, 342, 345, 398, 359, 462, -264, /* 50 */ -284, 747, -30, 250, 342, 345, 398, 359, 462, -264,
/* 60 */ -256, -357, -240, -339, -244, 81, 385, 475, 666, 668, /* 60 */ -256, -357, -240, -339, -244, 81, 385, 475, 666, 668,
/* 70 */ 669, 673, 702, 734, 148, 767, 803, 852, -280, -273, /* 70 */ 669, 673, 702, 734, 148, 767, 803, 852, -280, 855,
/* 80 */ 855, 857, 211, 31, 858, 272, 523, 363, 859, -205, /* 80 */ -273, 857, 858, 211, 31, 859, 272, 523, 363, 867,
/* 90 */ -20, -159, -159, -159, -171, -86, 95, 139, 149, 388, /* 90 */ -205, -20, -159, -159, -159, -171, -86, 95, 139, 149,
/* 100 */ 413, 420, 466, 476, 512, 514, 524, 548, 570, 574, /* 100 */ 388, 413, 420, 466, 476, 512, 514, 524, 548, 570,
/* 110 */ 588, 608, 614, 648, -233, -213, -298, -76, 53, -215, /* 110 */ 574, 588, 608, 614, 648, -233, -213, -298, -76, 53,
/* 120 */ 174, 279, 408, 431, 557, 217, 35, 275, 317, 409, /* 120 */ -215, 174, 279, 408, 431, 557, 217, 35, 275, 317,
/* 130 */ 467, 91, 540, 590, 595, 675, 565, 328, 340, 368, /* 130 */ 409, 467, 91, 540, 590, 595, 675, 565, 328, 340,
/* 140 */ 461, 468, 606, 661, 373, 705, 654, 800, 722, 826, /* 140 */ 368, 461, 468, 606, 661, 373, 705, 654, 800, 722,
/* 150 */ 777, 780, 868, 868, 877, 880, 862, 833, 811, 811, /* 150 */ 819, 777, 730, 868, 868, 876, 880, 862, 833, 811,
/* 160 */ 811, 819, 798, 799, 801, 813, 868, 850, 853, 870, /* 160 */ 811, 811, 821, 796, 799, 801, 813, 868, 850, 863,
/* 170 */ 882, 932, 934, 895, 900, 901, 954, 957, 965, 970, /* 170 */ 870, 892, 935, 936, 899, 925, 926, 942, 965, 966,
/* 180 */ 972, 915, 967, 938, 968, 926, 927, 974, 928, 975, /* 180 */ 975, 977, 919, 968, 938, 971, 928, 930, 978, 931,
/* 190 */ 941, 980, 982, 995, 989, 1004, 985, 986, 988, 990, /* 190 */ 980, 952, 991, 994, 999, 996, 1012, 985, 988, 990,
/* 200 */ 994, 996, 998, 999, 1000, 1003, 1007, 1015, 1013, 966, /* 200 */ 995, 998, 1000, 1003, 1004, 1007, 1009, 1010, 1014, 1013,
/* 210 */ 969, 1020, 971, 1014, 1027, 1017, 1030, 983, 1031, 991, /* 210 */ 983, 967, 1015, 981, 1016, 1029, 1025, 1032, 986, 1031,
/* 220 */ 1001, 1019, 1033, 1035, 1025, 1037, 1009, 1010, 1034, 1061, /* 220 */ 1008, 1030, 1033, 1035, 1036, 1026, 1041, 1037, 1034, 1047,
/* 230 */ 1023, 1072, 1049, 1016, 1047, 992, 1039, 1048, 1054, 1008, /* 230 */ 1061, 1076, 1018, 1017, 1048, 992, 1039, 1057, 1060, 1001,
/* 240 */ 1041, 1057, 1060, 868, 1012, 1032, 1036, 1024, 1046, 1038, /* 240 */ 1042, 1062, 1063, 868, 1019, 1040, 1046, 1020, 1038, 1024,
/* 250 */ 1042, 811, 1071, 1040, 1029, 1028, 1026, 1050, 1055, 1051, /* 250 */ 1045, 811, 1074, 1049, 1027, 1051, 1050, 1052, 1055, 1073,
/* 260 */ 1062, 1065, 1088, 1080, 1104, 1117, 1127, 1123, 1144, 1076, /* 260 */ 1064, 1066, 1089, 1081, 1120, 1129, 1117, 1136, 1141, 1085,
/* 270 */ 1096, 1133, 1138, 1140, 1142, 1163, /* 270 */ 1093, 1133, 1134, 1140, 1142, 1162,
}; };
static const YYACTIONTYPE yy_default[] = { static const YYACTIONTYPE yy_default[] = {
/* 0 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, /* 0 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
@ -815,21 +815,21 @@ static const YYACTIONTYPE yy_default[] = {
/* 50 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, /* 50 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
/* 60 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, /* 60 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
/* 70 */ 1465, 1465, 1465, 1465, 1539, 1465, 1465, 1465, 1465, 1465, /* 70 */ 1465, 1465, 1465, 1465, 1539, 1465, 1465, 1465, 1465, 1465,
/* 80 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1537, /* 80 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
/* 90 */ 1695, 1465, 1873, 1465, 1465, 1465, 1465, 1465, 1465, 1465, /* 90 */ 1537, 1695, 1465, 1873, 1465, 1465, 1465, 1465, 1465, 1465,
/* 100 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, /* 100 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
/* 110 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1539, /* 110 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
/* 120 */ 1465, 1537, 1885, 1885, 1885, 1465, 1465, 1465, 1465, 1738, /* 120 */ 1539, 1465, 1537, 1885, 1885, 1885, 1465, 1465, 1465, 1465,
/* 130 */ 1738, 1465, 1465, 1465, 1465, 1637, 1465, 1465, 1465, 1465, /* 130 */ 1738, 1738, 1465, 1465, 1465, 1465, 1637, 1465, 1465, 1465,
/* 140 */ 1465, 1465, 1465, 1465, 1730, 1465, 1954, 1465, 1465, 1465, /* 140 */ 1465, 1465, 1465, 1465, 1465, 1730, 1465, 1954, 1465, 1465,
/* 150 */ 1736, 1908, 1465, 1465, 1465, 1465, 1590, 1900, 1877, 1891, /* 150 */ 1465, 1736, 1908, 1465, 1465, 1465, 1465, 1590, 1900, 1877,
/* 160 */ 1878, 1875, 1939, 1939, 1939, 1894, 1465, 1904, 1465, 1723, /* 160 */ 1891, 1878, 1875, 1939, 1939, 1939, 1894, 1465, 1904, 1465,
/* 170 */ 1700, 1465, 1465, 1700, 1697, 1697, 1465, 1465, 1465, 1465, /* 170 */ 1723, 1700, 1465, 1465, 1700, 1697, 1697, 1465, 1465, 1465,
/* 180 */ 1465, 1465, 1539, 1465, 1539, 1465, 1465, 1539, 1465, 1539, /* 180 */ 1465, 1465, 1465, 1539, 1465, 1539, 1465, 1465, 1539, 1465,
/* 190 */ 1465, 1539, 1539, 1465, 1539, 1465, 1465, 1465, 1465, 1465, /* 190 */ 1539, 1465, 1539, 1539, 1465, 1539, 1465, 1465, 1465, 1465,
/* 200 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, /* 200 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465,
/* 210 */ 1465, 1537, 1732, 1465, 1537, 1465, 1465, 1465, 1537, 1913, /* 210 */ 1465, 1465, 1537, 1732, 1465, 1537, 1465, 1465, 1465, 1537,
/* 220 */ 1465, 1465, 1465, 1465, 1913, 1465, 1465, 1465, 1465, 1537, /* 220 */ 1913, 1465, 1465, 1465, 1465, 1913, 1465, 1465, 1465, 1537,
/* 230 */ 1465, 1537, 1465, 1465, 1465, 1915, 1913, 1465, 1465, 1915, /* 230 */ 1465, 1537, 1465, 1465, 1465, 1915, 1913, 1465, 1465, 1915,
/* 240 */ 1913, 1465, 1465, 1465, 1927, 1923, 1915, 1931, 1929, 1906, /* 240 */ 1913, 1465, 1465, 1465, 1927, 1923, 1915, 1931, 1929, 1906,
/* 250 */ 1904, 1891, 1465, 1465, 1945, 1941, 1957, 1945, 1941, 1945, /* 250 */ 1904, 1891, 1465, 1465, 1945, 1941, 1957, 1945, 1941, 1945,
@ -1858,7 +1858,7 @@ static const char *const yyRuleName[] = {
/* 231 */ "table_name_cond ::= table_name", /* 231 */ "table_name_cond ::= table_name",
/* 232 */ "from_db_opt ::=", /* 232 */ "from_db_opt ::=",
/* 233 */ "from_db_opt ::= FROM db_name", /* 233 */ "from_db_opt ::= FROM db_name",
/* 234 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options", /* 234 */ "cmd ::= CREATE SMA INDEX not_exists_opt index_name ON full_table_name index_options",
/* 235 */ "cmd ::= DROP INDEX exists_opt index_name", /* 235 */ "cmd ::= DROP INDEX exists_opt index_name",
/* 236 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt", /* 236 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
/* 237 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt", /* 237 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt",
@ -2949,7 +2949,7 @@ static const struct {
{ 307, -1 }, /* (231) table_name_cond ::= table_name */ { 307, -1 }, /* (231) table_name_cond ::= table_name */
{ 308, 0 }, /* (232) from_db_opt ::= */ { 308, 0 }, /* (232) from_db_opt ::= */
{ 308, -2 }, /* (233) from_db_opt ::= FROM db_name */ { 308, -2 }, /* (233) from_db_opt ::= FROM db_name */
{ 257, -8 }, /* (234) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ { 257, -8 }, /* (234) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON full_table_name index_options */
{ 257, -4 }, /* (235) cmd ::= DROP INDEX exists_opt index_name */ { 257, -4 }, /* (235) cmd ::= DROP INDEX exists_opt index_name */
{ 310, -10 }, /* (236) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ { 310, -10 }, /* (236) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
{ 310, -12 }, /* (237) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ { 310, -12 }, /* (237) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */
@ -4064,8 +4064,8 @@ static YYACTIONTYPE yy_reduce(
case 233: /* from_db_opt ::= FROM db_name */ case 233: /* from_db_opt ::= FROM db_name */
{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); } { yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); }
break; break;
case 234: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ case 234: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON full_table_name index_options */
{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy337, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, NULL, yymsp[0].minor.yy712); } { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy337, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy712, NULL, yymsp[0].minor.yy712); }
break; break;
case 235: /* cmd ::= DROP INDEX exists_opt index_name */ case 235: /* cmd ::= DROP INDEX exists_opt index_name */
{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); } { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); }
@ -4805,6 +4805,8 @@ static void yy_syntax_error(
} else { } else {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INCOMPLETE_SQL); pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INCOMPLETE_SQL);
} }
} else if (TSDB_CODE_PAR_DB_NOT_SPECIFIED == pCxt->errCode && TK_NK_FLOAT == TOKEN.type) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, TOKEN.z);
} }
/************ End %syntax_error code ******************************************/ /************ End %syntax_error code ******************************************/
ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */

View File

@ -2427,5 +2427,8 @@ static int32_t applyOptimizeRule(SPlanContext* pCxt, SLogicSubplan* pLogicSubpla
} }
int32_t optimizeLogicPlan(SPlanContext* pCxt, SLogicSubplan* pLogicSubplan) { int32_t optimizeLogicPlan(SPlanContext* pCxt, SLogicSubplan* pLogicSubplan) {
if (SUBPLAN_TYPE_MODIFY == pLogicSubplan->subplanType && NULL == pLogicSubplan->pNode->pChildren) {
return TSDB_CODE_SUCCESS;
}
return applyOptimizeRule(pCxt, pLogicSubplan); return applyOptimizeRule(pCxt, pLogicSubplan);
} }

View File

@ -779,8 +779,10 @@ static SNode* stbSplCreateColumnNode(SExprNode* pExpr) {
strcpy(pCol->dbName, ((SColumnNode*)pExpr)->dbName); strcpy(pCol->dbName, ((SColumnNode*)pExpr)->dbName);
strcpy(pCol->tableName, ((SColumnNode*)pExpr)->tableName); strcpy(pCol->tableName, ((SColumnNode*)pExpr)->tableName);
strcpy(pCol->tableAlias, ((SColumnNode*)pExpr)->tableAlias); strcpy(pCol->tableAlias, ((SColumnNode*)pExpr)->tableAlias);
} strcpy(pCol->colName, ((SColumnNode*)pExpr)->colName);
} else {
strcpy(pCol->colName, pExpr->aliasName); strcpy(pCol->colName, pExpr->aliasName);
}
strcpy(pCol->node.aliasName, pExpr->aliasName); strcpy(pCol->node.aliasName, pExpr->aliasName);
pCol->node.resType = pExpr->resType; pCol->node.resType = pExpr->resType;
return (SNode*)pCol; return (SNode*)pCol;

View File

@ -42,9 +42,6 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = createPhysiPlan(pCxt, pLogicPlan, pPlan, pExecNodeList); code = createPhysiPlan(pCxt, pLogicPlan, pPlan, pExecNodeList);
} }
if (TSDB_CODE_SUCCESS == code) {
dumpQueryPlan(*pPlan);
}
nodesDestroyNode((SNode*)pLogicSubplan); nodesDestroyNode((SNode*)pLogicSubplan);
nodesDestroyNode((SNode*)pLogicPlan); nodesDestroyNode((SNode*)pLogicPlan);

View File

@ -64,6 +64,12 @@ TEST_F(PlanSubqeuryTest, innerFill) {
"WHERE ts > '2022-04-06 00:00:00'"); "WHERE ts > '2022-04-06 00:00:00'");
} }
TEST_F(PlanSubqeuryTest, innerOrderBy) {
useDb("root", "test");
run("SELECT c2 FROM (SELECT c2 FROM st1 ORDER BY c1, _rowts)");
}
TEST_F(PlanSubqeuryTest, outerInterval) { TEST_F(PlanSubqeuryTest, outerInterval) {
useDb("root", "test"); useDb("root", "test");

View File

@ -140,13 +140,23 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY);
} }
colDataDestroy(out.columnData);
taosMemoryFreeClear(out.columnData);
out.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData));
cell = cell->pNext; cell = cell->pNext;
} }
*data = pObj; *data = pObj;
colDataDestroy(out.columnData);
taosMemoryFreeClear(out.columnData);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
_return: _return:
colDataDestroy(out.columnData);
taosMemoryFreeClear(out.columnData);
taosHashCleanup(pObj); taosHashCleanup(pObj);
SCL_RET(code); SCL_RET(code);
} }

View File

@ -92,7 +92,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
switch (msgType) { switch (msgType) {
case TDMT_VND_COMMIT_RSP: { case TDMT_VND_COMMIT_RSP: {
SCH_ERR_JRET(rspCode); SCH_ERR_JRET(rspCode);
SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
break; break;
} }
case TDMT_VND_CREATE_TABLE_RSP: { case TDMT_VND_CREATE_TABLE_RSP: {
@ -118,7 +118,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
SCH_ERR_JRET(rspCode); SCH_ERR_JRET(rspCode);
taosMemoryFreeClear(msg); taosMemoryFreeClear(msg);
SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
break; break;
} }
case TDMT_VND_DROP_TABLE_RSP: { case TDMT_VND_DROP_TABLE_RSP: {
@ -144,7 +144,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
SCH_ERR_JRET(rspCode); SCH_ERR_JRET(rspCode);
taosMemoryFreeClear(msg); taosMemoryFreeClear(msg);
SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
break; break;
} }
case TDMT_VND_ALTER_TABLE_RSP: { case TDMT_VND_ALTER_TABLE_RSP: {
@ -169,7 +169,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
taosMemoryFreeClear(msg); taosMemoryFreeClear(msg);
SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
break; break;
} }
case TDMT_VND_SUBMIT_RSP: { case TDMT_VND_SUBMIT_RSP: {
@ -218,7 +218,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
taosMemoryFreeClear(msg); taosMemoryFreeClear(msg);
SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
break; break;
} }
@ -238,7 +238,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
taosMemoryFreeClear(msg); taosMemoryFreeClear(msg);
SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
break; break;
} }
@ -263,7 +263,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa
taosMemoryFreeClear(msg); taosMemoryFreeClear(msg);
SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask));
break; break;
} }
@ -379,13 +379,15 @@ int32_t schHandleCallback(void *param, SDataBuf *pMsg, int32_t rspCode) {
qDebug("begin to handle rsp msg, type:%s, handle:%p, code:%s", TMSG_INFO(pMsg->msgType), pMsg->handle, qDebug("begin to handle rsp msg, type:%s, handle:%p, code:%s", TMSG_INFO(pMsg->msgType), pMsg->handle,
tstrerror(rspCode)); tstrerror(rspCode));
SCH_ERR_RET(schProcessOnCbBegin(&pJob, &pTask, pParam->queryId, pParam->refId, pParam->taskId)); SCH_ERR_JRET(schProcessOnCbBegin(&pJob, &pTask, pParam->queryId, pParam->refId, pParam->taskId));
code = schHandleResponseMsg(pJob, pTask, pParam->execId, pMsg, rspCode); code = schHandleResponseMsg(pJob, pTask, pParam->execId, pMsg, rspCode);
pMsg->pData = NULL; pMsg->pData = NULL;
schProcessOnCbEnd(pJob, pTask, code); schProcessOnCbEnd(pJob, pTask, code);
_return:
taosMemoryFreeClear(pMsg->pData); taosMemoryFreeClear(pMsg->pData);
qDebug("end to handle rsp msg, type:%s, handle:%p, code:%s", TMSG_INFO(pMsg->msgType), pMsg->handle, qDebug("end to handle rsp msg, type:%s, handle:%p, code:%s", TMSG_INFO(pMsg->msgType), pMsg->handle,
@ -398,6 +400,9 @@ int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) {
SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param; SSchTaskCallbackParam *pParam = (SSchTaskCallbackParam *)param;
qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " drop task rsp received, code:0x%x", pParam->queryId, pParam->taskId, qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " drop task rsp received, code:0x%x", pParam->queryId, pParam->taskId,
code); code);
if (pMsg) {
taosMemoryFree(pMsg->pData);
}
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -408,6 +413,8 @@ int32_t schHandleLinkBrokenCallback(void *param, SDataBuf *pMsg, int32_t code) {
qDebug("handle %p is broken", pMsg->handle); qDebug("handle %p is broken", pMsg->handle);
if (head->isHbParam) { if (head->isHbParam) {
taosMemoryFree(pMsg->pData);
SSchHbCallbackParam *hbParam = (SSchHbCallbackParam *)param; SSchHbCallbackParam *hbParam = (SSchHbCallbackParam *)param;
SSchTrans trans = {.pTrans = hbParam->pTrans, .pHandle = NULL}; SSchTrans trans = {.pTrans = hbParam->pTrans, .pHandle = NULL};
SCH_ERR_RET(schUpdateHbConnection(&hbParam->nodeEpId, &trans)); SCH_ERR_RET(schUpdateHbConnection(&hbParam->nodeEpId, &trans));

View File

@ -424,10 +424,15 @@ int32_t schHandleRedirect(SSchJob *pJob, SSchTask *pTask, SDataBuf *pData, int32
} }
} }
SCH_RET(schDoTaskRedirect(pJob, pTask, pData, rspCode)); code = schDoTaskRedirect(pJob, pTask, pData, rspCode);
taosMemoryFree(pData->pData);
SCH_RET(code);
_return: _return:
taosMemoryFree(pData->pData);
SCH_RET(schProcessOnTaskFailure(pJob, pTask, code)); SCH_RET(schProcessOnTaskFailure(pJob, pTask, code));
} }

View File

@ -125,6 +125,9 @@ SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t waterma
pInfo->pCloseWinSBF = NULL; pInfo->pCloseWinSBF = NULL;
_hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY);
pInfo->pMap = taosHashInit(DEFAULT_MAP_CAPACITY, hashFn, true, HASH_NO_LOCK); pInfo->pMap = taosHashInit(DEFAULT_MAP_CAPACITY, hashFn, true, HASH_NO_LOCK);
pInfo->maxVersion = 0;
pInfo->scanGroupId = 0;
pInfo->scanWindow = (STimeWindow){.skey = INT64_MIN, .ekey = INT64_MAX};
return pInfo; return pInfo;
} }
@ -185,15 +188,36 @@ bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts) {
} }
if (ts < pInfo->minTS) { if (ts < pInfo->minTS) {
qDebug("===stream===Update. tableId:%" PRIu64 ", maxTs:%" PRIu64 ", mapMaxTs:%" PRIu64 ", ts:%" PRIu64 , tableId, maxTs, *pMapMaxTs, ts);
return true; return true;
} else if (res == TSDB_CODE_SUCCESS) { } else if (res == TSDB_CODE_SUCCESS) {
return false; return false;
} }
qDebug("===stream===bucket:%d, tableId:%" PRIu64 ", maxTs:" PRIu64 ", maxMapTs:" PRIu64 ", ts:%" PRIu64, index, tableId, maxTs, *pMapMaxTs, ts); qDebug("===stream===Update. tableId:%" PRIu64 ", maxTs:%" PRIu64 ", mapMaxTs:%" PRIu64 ", ts:%" PRIu64 , tableId, maxTs, *pMapMaxTs, ts);
// check from tsdb api // check from tsdb api
return true; return true;
} }
void updateInfoSetScanRange(SUpdateInfo *pInfo, STimeWindow* pWin, uint64_t groupId, uint64_t version) {
qDebug("===stream===groupId:%" PRIu64 ", startTs:%" PRIu64 ", endTs:%" PRIu64 ", version:%" PRIu64 , groupId, pWin->skey, pWin->ekey, version);
pInfo->scanWindow = *pWin;
pInfo->scanGroupId = groupId;
pInfo->maxVersion = version;
}
bool updateInfoIgnore(SUpdateInfo *pInfo, STimeWindow* pWin, uint64_t groupId, uint64_t version) {
if (!pInfo) {
return false;
}
qDebug("===stream===check groupId:%" PRIu64 ", startTs:%" PRIu64 ", endTs:%" PRIu64 ", version:%" PRIu64 , groupId, pWin->skey, pWin->ekey, version);
if (pInfo->scanGroupId == groupId && pInfo->scanWindow.skey <= pWin->skey &&
pWin->ekey <= pInfo->scanWindow.ekey && version <= pInfo->maxVersion ) {
qDebug("===stream===ignore groupId:%" PRIu64 ", startTs:%" PRIu64 ", endTs:%" PRIu64 ", version:%" PRIu64 , groupId, pWin->skey, pWin->ekey, version);
return true;
}
return false;
}
void updateInfoDestroy(SUpdateInfo *pInfo) { void updateInfoDestroy(SUpdateInfo *pInfo) {
if (pInfo == NULL) { if (pInfo == NULL) {
return; return;

View File

@ -335,10 +335,6 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries
// nextIndex' = [nextIndex EXCEPT ![i][j] = m.mmatchIndex + 1] // nextIndex' = [nextIndex EXCEPT ![i][j] = m.mmatchIndex + 1]
syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), pMsg->matchIndex + 1); syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), pMsg->matchIndex + 1);
if (gRaftDetailLog) {
sTrace("update next match, index:%" PRId64 ", success:%d", pMsg->matchIndex + 1, pMsg->success);
}
// matchIndex' = [matchIndex EXCEPT ![i][j] = m.mmatchIndex] // matchIndex' = [matchIndex EXCEPT ![i][j] = m.mmatchIndex]
syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), pMsg->matchIndex); syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), pMsg->matchIndex);
@ -349,9 +345,6 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries
} else { } else {
SyncIndex nextIndex = syncIndexMgrGetIndex(ths->pNextIndex, &(pMsg->srcId)); SyncIndex nextIndex = syncIndexMgrGetIndex(ths->pNextIndex, &(pMsg->srcId));
if (gRaftDetailLog) {
sTrace("update next index not match, begin, index:%" PRId64 ", success:%d", nextIndex, pMsg->success);
}
// notice! int64, uint64 // notice! int64, uint64
if (nextIndex > SYNC_INDEX_BEGIN) { if (nextIndex > SYNC_INDEX_BEGIN) {
@ -393,9 +386,6 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries
} }
syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), nextIndex); syncIndexMgrSetIndex(ths->pNextIndex, &(pMsg->srcId), nextIndex);
if (gRaftDetailLog) {
sTrace("update next index not match, end, index:%" PRId64 ", success:%d", nextIndex, pMsg->success);
}
} }
SyncIndex afterNextIndex = syncIndexMgrGetIndex(ths->pNextIndex, &(pMsg->srcId)); SyncIndex afterNextIndex = syncIndexMgrGetIndex(ths->pNextIndex, &(pMsg->srcId));

View File

@ -88,10 +88,6 @@ int64_t syncOpen(const SSyncInfo* pSyncInfo) {
SSyncNode* pSyncNode = syncNodeOpen(pSyncInfo); SSyncNode* pSyncNode = syncNodeOpen(pSyncInfo);
ASSERT(pSyncNode != NULL); ASSERT(pSyncNode != NULL);
if (gRaftDetailLog) {
syncNodeLog2("syncNodeOpen open success", pSyncNode);
}
pSyncNode->rid = taosAddRef(tsNodeRefId, pSyncNode); pSyncNode->rid = taosAddRef(tsNodeRefId, pSyncNode);
if (pSyncNode->rid < 0) { if (pSyncNode->rid < 0) {
syncFreeNode(pSyncNode); syncFreeNode(pSyncNode);
@ -246,10 +242,6 @@ int32_t syncReconfig(int64_t rid, const SSyncCfg* pNewCfg) {
} }
char* newconfig = syncCfg2Str((SSyncCfg*)pNewCfg); char* newconfig = syncCfg2Str((SSyncCfg*)pNewCfg);
if (gRaftDetailLog) {
sInfo("==syncReconfig== newconfig:%s", newconfig);
}
int32_t ret = 0; int32_t ret = 0;
SRpcMsg rpcMsg = {0}; SRpcMsg rpcMsg = {0};
@ -912,12 +904,6 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) {
ASSERT(pSyncNode->pRaftCfg != NULL); ASSERT(pSyncNode->pRaftCfg != NULL);
pSyncInfo->syncCfg = pSyncNode->pRaftCfg->cfg; pSyncInfo->syncCfg = pSyncNode->pRaftCfg->cfg;
if (gRaftDetailLog) {
char* seralized = raftCfg2Str(pSyncNode->pRaftCfg);
sInfo("syncNodeOpen update config :%s", seralized);
taosMemoryFree(seralized);
}
raftCfgClose(pSyncNode->pRaftCfg); raftCfgClose(pSyncNode->pRaftCfg);
} }
@ -1348,13 +1334,6 @@ int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRp
SEpSet epSet; SEpSet epSet;
syncUtilraftId2EpSet(destRaftId, &epSet); syncUtilraftId2EpSet(destRaftId, &epSet);
if (pSyncNode->FpSendMsg != NULL) { if (pSyncNode->FpSendMsg != NULL) {
if (gRaftDetailLog) {
char* JsonStr = syncRpcMsg2Str(pMsg);
syncUtilJson2Line(JsonStr);
sTrace("sync send msg, vgId:%d, type:%d, msg:%s", pSyncNode->vgId, pMsg->msgType, JsonStr);
taosMemoryFree(JsonStr);
}
// htonl // htonl
syncUtilMsgHtoN(pMsg->pCont); syncUtilMsgHtoN(pMsg->pCont);

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
if [ $# != 5 ] ; then if [ $# != 7 ] ; then
echo "Uasge: $0 instances vgroups replica ctables rows" echo "Uasge: $0 instances vgroups replica ctables rows weak drop(yes/no)"
echo "" echo ""
exit 1 exit 1
fi fi
@ -11,11 +11,14 @@ vgroups=$2
replica=$3 replica=$3
ctables=$4 ctables=$4
rows=$5 rows=$5
weak=$6
drop=$7
echo "params: instances:${instances}, vgroups:${vgroups}, replica:${replica}, ctables:${ctables}, rows:${rows}"
echo "params: instances:${instances}, vgroups:${vgroups}, replica:${replica}, ctables:${ctables}, rows:${rows}, weak:${weak}, drop:${drop}"
dt=`date "+%Y-%m-%d-%H-%M-%S"` dt=`date "+%Y-%m-%d-%H-%M-%S"`
casedir=instances_${instances}_vgroups_${vgroups}_replica_${replica}_ctables_${ctables}_rows_${rows}_${dt} casedir=instances_${instances}_vgroups_${vgroups}_replica_${replica}_ctables_${ctables}_rows_${rows}_weak_${weak}_drop_${drop}_${dt}
mkdir ${casedir} mkdir ${casedir}
cp ./insert.tpl.json ${casedir} cp ./insert.tpl.json ${casedir}
cd ${casedir} cd ${casedir}
@ -25,6 +28,7 @@ for i in `seq 1 ${instances}`;do
cfg_file=bench_${i}.json cfg_file=bench_${i}.json
cp ./insert.tpl.json ${cfg_file} cp ./insert.tpl.json ${cfg_file}
rstfile=result_${i} rstfile=result_${i}
sed -i 's/tpl_drop_tpl/'${drop}'/g' ${cfg_file}
sed -i 's/tpl_vgroups_tpl/'${vgroups}'/g' ${cfg_file} sed -i 's/tpl_vgroups_tpl/'${vgroups}'/g' ${cfg_file}
sed -i 's/tpl_replica_tpl/'${replica}'/g' ${cfg_file} sed -i 's/tpl_replica_tpl/'${replica}'/g' ${cfg_file}
sed -i 's/tpl_ctables_tpl/'${ctables}'/g' ${cfg_file} sed -i 's/tpl_ctables_tpl/'${ctables}'/g' ${cfg_file}

View File

@ -15,8 +15,11 @@
"databases": [ "databases": [
{ {
"dbinfo": { "dbinfo": {
"name": "db1", "name": "db_auto",
"drop": "yes", "drop": "tpl_drop_tpl",
"wal_retention_period": -1,
"wal_retention_size": -1,
"drop": "no",
"vgroups": tpl_vgroups_tpl, "vgroups": tpl_vgroups_tpl,
"replica": tpl_replica_tpl "replica": tpl_replica_tpl
}, },

View File

@ -381,8 +381,8 @@ void cliHandleResp(SCliConn* conn) {
STraceId* trace = &transMsg.info.traceId; STraceId* trace = &transMsg.info.traceId;
tGTrace("%s conn %p %s received from %s, local info:%s, msg size:%d, code:0x%x", CONN_GET_INST_LABEL(conn), conn, tGTrace("%s conn %p %s received from %s, local info:%s, len:%d, code str:%s", CONN_GET_INST_LABEL(conn), conn,
TMSG_INFO(pHead->msgType), conn->dst, conn->src, transMsg.contLen, transMsg.code); TMSG_INFO(pHead->msgType), conn->dst, conn->src, transMsg.contLen, tstrerror(transMsg.code));
if (pCtx == NULL && CONN_NO_PERSIST_BY_APP(conn)) { if (pCtx == NULL && CONN_NO_PERSIST_BY_APP(conn)) {
tDebug("%s except, conn %p read while cli ignore it", CONN_GET_INST_LABEL(conn), conn); tDebug("%s except, conn %p read while cli ignore it", CONN_GET_INST_LABEL(conn), conn);
@ -549,6 +549,8 @@ static void addConnToPool(void* pool, SCliConn* conn) {
CONN_CONSTRUCT_HASH_KEY(key, conn->ip, conn->port); CONN_CONSTRUCT_HASH_KEY(key, conn->ip, conn->port);
tTrace("%s conn %p added to conn pool, read buf cap:%d", CONN_GET_INST_LABEL(conn), conn, conn->readBuf.cap); tTrace("%s conn %p added to conn pool, read buf cap:%d", CONN_GET_INST_LABEL(conn), conn, conn->readBuf.cap);
conn->list = taosHashGet((SHashObj*)pool, key, strlen(key)); conn->list = taosHashGet((SHashObj*)pool, key, strlen(key));
} else {
tTrace("%s conn %p added to conn pool, read buf cap:%d", CONN_GET_INST_LABEL(conn), conn, conn->readBuf.cap);
} }
assert(conn->list != NULL); assert(conn->list != NULL);
QUEUE_INIT(&conn->q); QUEUE_INIT(&conn->q);
@ -756,8 +758,8 @@ void cliSend(SCliConn* pConn) {
uv_buf_t wb = uv_buf_init((char*)pHead, msgLen); uv_buf_t wb = uv_buf_init((char*)pHead, msgLen);
STraceId* trace = &pMsg->info.traceId; STraceId* trace = &pMsg->info.traceId;
tGTrace("%s conn %p %s is sent to %s, local info %s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pHead->msgType), tGTrace("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn,
pConn->dst, pConn->src); TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, pMsg->contLen);
if (pHead->persist == 1) { if (pHead->persist == 1) {
CONN_SET_PERSIST_BY_APP(pConn); CONN_SET_PERSIST_BY_APP(pConn);

View File

@ -253,11 +253,11 @@ static void uvHandleReq(SSvrConn* pConn) {
if (pConn->status == ConnNormal && pHead->noResp == 0) { if (pConn->status == ConnNormal && pHead->noResp == 0) {
transRefSrvHandle(pConn); transRefSrvHandle(pConn);
tGTrace("%s conn %p %s received from %s, local info:%s, msg size:%d", transLabel(pTransInst), pConn, tGTrace("%s conn %p %s received from %s, local info:%s, len:%d", transLabel(pTransInst), pConn,
TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, transMsg.contLen); TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, transMsg.contLen);
} else { } else {
tGTrace("%s conn %p %s received from %s, local info:%s, msg size:%d, resp:%d, code:%d", transLabel(pTransInst), tGTrace("%s conn %p %s received from %s, local info:%s, len:%d, resp:%d, code:%d", transLabel(pTransInst), pConn,
pConn, TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, transMsg.contLen, pHead->noResp, transMsg.code); TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, transMsg.contLen, pHead->noResp, transMsg.code);
} }
// pHead->noResp = 1, // pHead->noResp = 1,
@ -296,11 +296,9 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
if (nread > 0) { if (nread > 0) {
pBuf->len += nread; pBuf->len += nread;
tTrace("%s conn %p total read:%d, current read:%d", transLabel(pTransInst), conn, pBuf->len, (int)nread); tTrace("%s conn %p total read:%d, current read:%d", transLabel(pTransInst), conn, pBuf->len, (int)nread);
if (transReadComplete(pBuf)) { while (transReadComplete(pBuf)) {
tTrace("%s conn %p alread read complete packet", transLabel(pTransInst), conn); tTrace("%s conn %p alread read complete packet", transLabel(pTransInst), conn);
uvHandleReq(conn); uvHandleReq(conn);
} else {
tTrace("%s conn %p read partial packet, continue to read", transLabel(pTransInst), conn);
} }
return; return;
} }
@ -418,8 +416,8 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
STrans* pTransInst = pConn->pTransInst; STrans* pTransInst = pConn->pTransInst;
STraceId* trace = &pMsg->info.traceId; STraceId* trace = &pMsg->info.traceId;
tGTrace("%s conn %p %s is sent to %s, local info:%s, msglen:%d", transLabel(pTransInst), pConn, tGTrace("%s conn %p %s is sent to %s, local info:%s, len:%d", transLabel(pTransInst), pConn,
TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, len); TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, pMsg->contLen);
pHead->msgLen = htonl(len); pHead->msgLen = htonl(len);
wb->base = msg; wb->base = msg;

View File

@ -116,15 +116,15 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
} }
walBuildIdxName(pWal, walGetCurFileFirstVer(pWal), fnameStr); walBuildIdxName(pWal, walGetCurFileFirstVer(pWal), fnameStr);
TdFilePtr pIdxTFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND); TdFilePtr pIdxFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND);
if (pIdxTFile == NULL) { if (pIdxFile == NULL) {
ASSERT(0); ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex); taosThreadMutexUnlock(&pWal->mutex);
return -1; return -1;
} }
int64_t idxOff = walGetVerIdxOffset(pWal, ver); int64_t idxOff = walGetVerIdxOffset(pWal, ver);
code = taosLSeekFile(pIdxTFile, idxOff, SEEK_SET); code = taosLSeekFile(pIdxFile, idxOff, SEEK_SET);
if (code < 0) { if (code < 0) {
ASSERT(0); ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex); taosThreadMutexUnlock(&pWal->mutex);
@ -132,7 +132,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
} }
// read idx file and get log file pos // read idx file and get log file pos
SWalIdxEntry entry; SWalIdxEntry entry;
if (taosReadFile(pIdxTFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) { if (taosReadFile(pIdxFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) {
ASSERT(0); ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex); taosThreadMutexUnlock(&pWal->mutex);
return -1; return -1;
@ -140,24 +140,24 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
ASSERT(entry.ver == ver); ASSERT(entry.ver == ver);
walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr); walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr);
TdFilePtr pLogTFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND); TdFilePtr pLogFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND);
if (pLogTFile == NULL) { if (pLogFile == NULL) {
ASSERT(0);
// TODO // TODO
terrno = TAOS_SYSTEM_ERROR(errno);
taosThreadMutexUnlock(&pWal->mutex); taosThreadMutexUnlock(&pWal->mutex);
return -1; return -1;
} }
code = taosLSeekFile(pLogTFile, entry.offset, SEEK_SET); code = taosLSeekFile(pLogFile, entry.offset, SEEK_SET);
if (code < 0) { if (code < 0) {
ASSERT(0);
// TODO // TODO
terrno = TAOS_SYSTEM_ERROR(errno);
taosThreadMutexUnlock(&pWal->mutex); taosThreadMutexUnlock(&pWal->mutex);
return -1; return -1;
} }
// validate offset // validate offset
SWalCkHead head; SWalCkHead head;
ASSERT(taosValidFile(pLogTFile)); ASSERT(taosValidFile(pLogFile));
int64_t size = taosReadFile(pLogTFile, &head, sizeof(SWalCkHead)); int64_t size = taosReadFile(pLogFile, &head, sizeof(SWalCkHead));
if (size != sizeof(SWalCkHead)) { if (size != sizeof(SWalCkHead)) {
ASSERT(0); ASSERT(0);
taosThreadMutexUnlock(&pWal->mutex); taosThreadMutexUnlock(&pWal->mutex);
@ -180,14 +180,14 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
} }
// truncate old files // truncate old files
code = taosFtruncateFile(pLogTFile, entry.offset); code = taosFtruncateFile(pLogFile, entry.offset);
if (code < 0) { if (code < 0) {
ASSERT(0); ASSERT(0);
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
taosThreadMutexUnlock(&pWal->mutex); taosThreadMutexUnlock(&pWal->mutex);
return -1; return -1;
} }
code = taosFtruncateFile(pIdxTFile, idxOff); code = taosFtruncateFile(pIdxFile, idxOff);
if (code < 0) { if (code < 0) {
ASSERT(0); ASSERT(0);
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
@ -205,8 +205,10 @@ int32_t walRollback(SWal *pWal, int64_t ver) {
ASSERT(((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->fileSize == 0); ASSERT(((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->fileSize == 0);
((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->firstVer = -1; ((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->firstVer = -1;
} }
taosCloseFile(&pIdxTFile); taosCloseFile(&pIdxFile);
taosCloseFile(&pLogTFile); taosCloseFile(&pLogFile);
walSaveMeta(pWal);
// unlock // unlock
taosThreadMutexUnlock(&pWal->mutex); taosThreadMutexUnlock(&pWal->mutex);

View File

@ -261,6 +261,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_FIELD_CONFLICT_WITH_TOPIC,"Field used by topic")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SINGLE_STB_MODE_DB, "Database is single stable mode") TAOS_DEFINE_ERROR(TSDB_CODE_MND_SINGLE_STB_MODE_DB, "Database is single stable mode")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SCHEMA_VER, "Invalid schema version while alter stb") TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_SCHEMA_VER, "Invalid schema version while alter stb")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_STABLE_UID_NOT_MATCH, "Invalid stable uid while alter stb") TAOS_DEFINE_ERROR(TSDB_CODE_MND_STABLE_UID_NOT_MATCH, "Invalid stable uid while alter stb")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_FIELD_CONFLICT_WITH_TSMA, "Field used by tsma")
// mnode-trans // mnode-trans
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists") TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists")

View File

@ -78,8 +78,8 @@ class DataSet:
self.float_data.append( float(i * float_step % FLOAT_MAX )) self.float_data.append( float(i * float_step % FLOAT_MAX ))
self.double_data.append( float(i * double_step % DOUBLE_MAX )) self.double_data.append( float(i * double_step % DOUBLE_MAX ))
self.bool_data.append( bool((i + bool_start) % 2 )) self.bool_data.append( bool((i + bool_start) % 2 ))
self.vchar_data.append( f"{vchar_prefix}_{i * vchar_step}" ) self.vchar_data.append( f"{vchar_prefix}{i * vchar_step}" )
self.nchar_data.append( f"{nchar_prefix}_{i * nchar_step}") self.nchar_data.append( f"{nchar_prefix}{i * nchar_step}")
self.ts_data.append( int(datetime.timestamp(datetime.now()) * 1000 - i * ts_step)) self.ts_data.append( int(datetime.timestamp(datetime.now()) * 1000 - i * ts_step))
def get_disorder_set(self, rows, **kwargs): def get_disorder_set(self, rows, **kwargs):

View File

@ -194,6 +194,14 @@ class TDSql:
args = (caller.filename, caller.lineno, self.sql, self.queryRows, expectRows) args = (caller.filename, caller.lineno, self.sql, self.queryRows, expectRows)
tdLog.exit("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args) tdLog.exit("%s(%d) failed: sql:%s, queryRows:%d != expect:%d" % args)
def checkRows_range(self, excepte_row_list):
if self.queryRows in excepte_row_list:
tdLog.info(f"sql:{self.sql}, queryRows:{self.queryRows} in expect:{excepte_row_list}")
return True
else:
caller = inspect.getframeinfo(inspect.stack()[1][0])
tdLog.exit(f"{caller.filename}({caller.lineno}) failed: sql:{self.sql}, queryRows:{self.queryRows} not in expect:{excepte_row_list}")
def checkCols(self, expectCols): def checkCols(self, expectCols):
if self.queryCols == expectCols: if self.queryCols == expectCols:
tdLog.info("sql:%s, queryCols:%d == expect:%d" % (self.sql, self.queryCols, expectCols)) tdLog.info("sql:%s, queryCols:%d == expect:%d" % (self.sql, self.queryCols, expectCols))

View File

@ -111,7 +111,7 @@ class TAdapter:
self.taosadapter_cfg_dict[key] = value self.taosadapter_cfg_dict[key] = value
def check_adapter(self): def check_adapter(self):
if getPath(tool="taosadapter"): if get_path(tool="taosadapter"):
return False return False
else: else:
return True return True

View File

@ -27,7 +27,7 @@
./test.sh -f tsim/db/delete_writing2.sim ./test.sh -f tsim/db/delete_writing2.sim
# unsupport ./test.sh -f tsim/db/dropdnodes.sim # unsupport ./test.sh -f tsim/db/dropdnodes.sim
./test.sh -f tsim/db/error1.sim ./test.sh -f tsim/db/error1.sim
# TD-17592 ./test.sh -f tsim/db/keep.sim ./test.sh -f tsim/db/keep.sim
./test.sh -f tsim/db/len.sim ./test.sh -f tsim/db/len.sim
./test.sh -f tsim/db/repeat.sim ./test.sh -f tsim/db/repeat.sim
./test.sh -f tsim/db/show_create_db.sim ./test.sh -f tsim/db/show_create_db.sim
@ -89,7 +89,7 @@
./test.sh -f tsim/parser/alter_column.sim ./test.sh -f tsim/parser/alter_column.sim
./test.sh -f tsim/parser/alter_stable.sim ./test.sh -f tsim/parser/alter_stable.sim
./test.sh -f tsim/parser/alter.sim ./test.sh -f tsim/parser/alter.sim
# TD-17959 ./test.sh -f tsim/parser/alter1.sim ./test.sh -f tsim/parser/alter1.sim
./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim ./test.sh -f tsim/parser/auto_create_tb_drop_tb.sim
./test.sh -f tsim/parser/auto_create_tb.sim ./test.sh -f tsim/parser/auto_create_tb.sim
./test.sh -f tsim/parser/between_and.sim ./test.sh -f tsim/parser/between_and.sim
@ -131,8 +131,8 @@
./test.sh -f tsim/parser/insert_tb.sim ./test.sh -f tsim/parser/insert_tb.sim
# TD-17038 ./test.sh -f tsim/parser/interp.sim # TD-17038 ./test.sh -f tsim/parser/interp.sim
./test.sh -f tsim/parser/join_manyblocks.sim ./test.sh -f tsim/parser/join_manyblocks.sim
# TD-17713 ./test.sh -f tsim/parser/join_multitables.sim # TD-18018 ./test.sh -f tsim/parser/join_multitables.sim
# TD-17713 ./test.sh -f tsim/parser/join_multivnode.sim ./test.sh -f tsim/parser/join_multivnode.sim
# TD-17707 ./test.sh -f tsim/parser/join.sim # TD-17707 ./test.sh -f tsim/parser/join.sim
./test.sh -f tsim/parser/last_cache.sim ./test.sh -f tsim/parser/last_cache.sim
./test.sh -f tsim/parser/last_groupby.sim ./test.sh -f tsim/parser/last_groupby.sim
@ -144,7 +144,7 @@
# TD-17623 ./test.sh -f tsim/parser/limit2.sim # TD-17623 ./test.sh -f tsim/parser/limit2.sim
./test.sh -f tsim/parser/mixed_blocks.sim ./test.sh -f tsim/parser/mixed_blocks.sim
./test.sh -f tsim/parser/nchar.sim ./test.sh -f tsim/parser/nchar.sim
# TD-17703 ./test.sh -f tsim/parser/nestquery.sim ./test.sh -f tsim/parser/nestquery.sim
./test.sh -f tsim/parser/null_char.sim ./test.sh -f tsim/parser/null_char.sim
./test.sh -f tsim/parser/precision_ns.sim ./test.sh -f tsim/parser/precision_ns.sim
./test.sh -f tsim/parser/projection_limit_offset.sim ./test.sh -f tsim/parser/projection_limit_offset.sim
@ -179,7 +179,6 @@
./test.sh -f tsim/query/scalarFunction.sim ./test.sh -f tsim/query/scalarFunction.sim
./test.sh -f tsim/query/scalarNull.sim ./test.sh -f tsim/query/scalarNull.sim
./test.sh -f tsim/query/session.sim ./test.sh -f tsim/query/session.sim
./test.sh -f tsim/query/udf.sim
# ---- qnode # ---- qnode
./test.sh -f tsim/qnode/basic1.sim ./test.sh -f tsim/qnode/basic1.sim
@ -316,6 +315,7 @@
./test.sh -f tsim/valgrind/checkError5.sim ./test.sh -f tsim/valgrind/checkError5.sim
./test.sh -f tsim/valgrind/checkError6.sim ./test.sh -f tsim/valgrind/checkError6.sim
./test.sh -f tsim/valgrind/checkError7.sim ./test.sh -f tsim/valgrind/checkError7.sim
./test.sh -f tsim/valgrind/checkUdf.sim
# --- vnode # --- vnode
# unsupport ./test.sh -f tsim/vnode/replica3_basic.sim # unsupport ./test.sh -f tsim/vnode/replica3_basic.sim
@ -339,7 +339,7 @@
# --- catalog ---- # --- catalog ----
./test.sh -f tsim/catalog/alterInCurrent.sim ./test.sh -f tsim/catalog/alterInCurrent.sim
# --- scalar # --- scalar ----
./test.sh -f tsim/scalar/in.sim ./test.sh -f tsim/scalar/in.sim
./test.sh -f tsim/scalar/scalar.sim ./test.sh -f tsim/scalar/scalar.sim
@ -384,7 +384,7 @@
./test.sh -f tsim/compute/sum.sim ./test.sh -f tsim/compute/sum.sim
./test.sh -f tsim/compute/top.sim ./test.sh -f tsim/compute/top.sim
# ---- field # ---- field ----
./test.sh -f tsim/field/2.sim ./test.sh -f tsim/field/2.sim
./test.sh -f tsim/field/3.sim ./test.sh -f tsim/field/3.sim
./test.sh -f tsim/field/4.sim ./test.sh -f tsim/field/4.sim
@ -401,7 +401,7 @@
./test.sh -f tsim/field/tinyint.sim ./test.sh -f tsim/field/tinyint.sim
./test.sh -f tsim/field/unsigined_bigint.sim ./test.sh -f tsim/field/unsigined_bigint.sim
# ---- vector # ---- vector ----
./test.sh -f tsim/vector/metrics_field.sim ./test.sh -f tsim/vector/metrics_field.sim
./test.sh -f tsim/vector/metrics_mix.sim ./test.sh -f tsim/vector/metrics_mix.sim
./test.sh -f tsim/vector/metrics_query.sim ./test.sh -f tsim/vector/metrics_query.sim
@ -414,14 +414,14 @@
./test.sh -f tsim/vector/table_query.sim ./test.sh -f tsim/vector/table_query.sim
./test.sh -f tsim/vector/table_time.sim ./test.sh -f tsim/vector/table_time.sim
# ---- wal # ---- wal ----
./test.sh -f tsim/wal/kill.sim ./test.sh -f tsim/wal/kill.sim
# ---- tag # ---- tag ----
./test.sh -f tsim/tag/3.sim ./test.sh -f tsim/tag/3.sim
./test.sh -f tsim/tag/4.sim ./test.sh -f tsim/tag/4.sim
./test.sh -f tsim/tag/5.sim ./test.sh -f tsim/tag/5.sim
# TD-17382 ./test.sh -f tsim/tag/6.sim ./test.sh -f tsim/tag/6.sim
./test.sh -f tsim/tag/add.sim ./test.sh -f tsim/tag/add.sim
./test.sh -f tsim/tag/bigint.sim ./test.sh -f tsim/tag/bigint.sim
./test.sh -f tsim/tag/binary_binary.sim ./test.sh -f tsim/tag/binary_binary.sim
@ -429,18 +429,18 @@
./test.sh -f tsim/tag/bool_binary.sim ./test.sh -f tsim/tag/bool_binary.sim
./test.sh -f tsim/tag/bool_int.sim ./test.sh -f tsim/tag/bool_int.sim
./test.sh -f tsim/tag/bool.sim ./test.sh -f tsim/tag/bool.sim
# TD-17407 ./test.sh -f tsim/tag/change.sim ./test.sh -f tsim/tag/change.sim
./test.sh -f tsim/tag/column.sim ./test.sh -f tsim/tag/column.sim
./test.sh -f tsim/tag/commit.sim ./test.sh -f tsim/tag/commit.sim
# TD-17407 ./test.sh -f tsim/tag/create.sim ./test.sh -f tsim/tag/create.sim
# TD-17407 ./test.sh -f tsim/tag/delete.sim ./test.sh -f tsim/tag/delete.sim
# TD-17407 ./test.sh -f tsim/tag/double.sim ./test.sh -f tsim/tag/double.sim
./test.sh -f tsim/tag/filter.sim ./test.sh -f tsim/tag/filter.sim
# TD-17407 ./test.sh -f tsim/tag/float.sim ./test.sh -f tsim/tag/float.sim
./test.sh -f tsim/tag/int_binary.sim ./test.sh -f tsim/tag/int_binary.sim
./test.sh -f tsim/tag/int_float.sim ./test.sh -f tsim/tag/int_float.sim
./test.sh -f tsim/tag/int.sim ./test.sh -f tsim/tag/int.sim
# TD-17959 ./test.sh -f tsim/tag/set.sim ./test.sh -f tsim/tag/set.sim
./test.sh -f tsim/tag/smallint.sim ./test.sh -f tsim/tag/smallint.sim
./test.sh -f tsim/tag/tinyint.sim ./test.sh -f tsim/tag/tinyint.sim

View File

@ -63,12 +63,10 @@ print ===> rows $rows last $data01
if $rows >= 80 then if $rows >= 80 then
return -1 return -1
endi endi
if $rows <= 50 then if $rows <= 45 then
return -1 return -1
endi endi
return
print ======== step5 stop dnode print ======== step5 stop dnode
system sh/exec.sh -n dnode2 -s stop -x SIGKILL system sh/exec.sh -n dnode2 -s stop -x SIGKILL
system sh/exec.sh -n dnode2 -s start system sh/exec.sh -n dnode2 -s start
@ -78,7 +76,7 @@ print ===> rows $rows last $data01
if $rows >= 80 then if $rows >= 80 then
return -1 return -1
endi endi
if $rows <= 50 then if $rows <= 45 then
return -1 return -1
endi endi
@ -109,8 +107,8 @@ print ======== step8 insert data
$x = 81 $x = 81
while $x < 121 while $x < 121
$time = $x . d $time = $x . d
sql insert into tb values (now - $time , $x ) -x step4 sql insert into tb values (now - $time , $x ) -x step8
step4: step8:
$x = $x + 1 $x = $x + 1
endw endw

View File

@ -26,8 +26,8 @@ endi
print =============== step3-1 insert records into ct1 print =============== step3-1 insert records into ct1
sql insert into ct1 values('2022-05-03 16:59:00.010', 10, 20, 'n','n',30); sql insert into ct1 values('2022-05-03 16:59:00.010', 10, 20, 'n','n',30);
sql insert into ct1 values('2022-05-03 16:59:00.011', 'N', 'n', 'N',"N",30); sql insert into ct1 values('2022-05-03 16:59:00.011', 'null', 'null', 'N',"N",30);
sql insert into ct1 values('2022-05-03 16:59:00.012', 'Nu', 'nul', 'Nul','NUL',30); sql insert into ct1 values('2022-05-03 16:59:00.012', 'null', 'null', 'Nul','NUL',30);
sql insert into ct1 values('2022-05-03 16:59:00.013', NULL, 'null', 'Null',null,30); sql insert into ct1 values('2022-05-03 16:59:00.013', NULL, 'null', 'Null',null,30);
sql insert into ct1 values('2022-05-03 16:59:00.014', NULL, 'NuLL', 'Null',NULL,30); sql insert into ct1 values('2022-05-03 16:59:00.014', NULL, 'NuLL', 'Null',NULL,30);

File diff suppressed because it is too large Load Diff

View File

@ -831,16 +831,10 @@ sql alter table $mt add tag tgcol4 int
sql alter table $mt add tag tgcol5 bigint sql alter table $mt add tag tgcol5 bigint
sql alter table $mt add tag tgcol6 bigint sql alter table $mt add tag tgcol6 bigint
return sql reset query cache
sql alter table $mt add tag tgcol7 bigint -x step141
return -1
step141:
sql reset query cache
sql alter table $mt drop tag tgcol6 sql alter table $mt drop tag tgcol6
sql alter table $mt add tag tgcol7 bigint sql alter table $mt add tag tgcol7 bigint
sql alter table $mt add tag tgcol8 bigint -x step142 sql alter table $mt add tag tgcol8 bigint
return -1
step142:
print =============== clear print =============== clear
sql drop database $db sql drop database $db

View File

@ -179,7 +179,7 @@ $tb = $tbPrefix . $i
sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool) sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool)
sql create table $tb using $mt tags( 1, 2 ) sql create table $tb using $mt tags( 1, 2 )
sql insert into $tb values(now, 1) sql insert into $tb values(now, 1)
sql select * from $mt where tgcol2 = 2 sql select * from $mt where tgcol2 = 1
if $rows != 1 then if $rows != 1 then
print expect 1, actual: $rows print expect 1, actual: $rows
return -1 return -1
@ -453,7 +453,7 @@ endi
if $data01 != 1 then if $data01 != 1 then
return -1 return -1
endi endi
sql select * from $mt where tgcol2 = 2 sql select * from $mt where tgcol2 = 1
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi

View File

@ -45,17 +45,7 @@ while $i < $tbNum
endw endw
print =============== step3: tb print =============== step3: tb
sql explain analyze select ts from stb where -2; sql select _wstart, count(*) from tb1 session(ts,1m)
sql explain analyze select ts from tb1;
sql explain analyze select ts from stb order by ts;
sql explain analyze select * from information_schema.user_stables;
sql explain analyze select count(*),sum(tbcol) from tb1;
sql explain analyze select count(*),sum(tbcol) from stb;
sql explain analyze select count(*),sum(tbcol) from stb group by tbcol;
sql explain analyze select * from information_schema.user_stables;
sql explain analyze verbose true select * from information_schema.user_stables where db_name='db2';
sql explain analyze verbose true select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
sql explain select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
_OVER: _OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -1,7 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c debugflag -v 131 system sh/exec.sh -n dnode1 -s start -v
system sh/exec.sh -n dnode1 -s start
sql connect sql connect
print =============== step1: create drop show dnodes print =============== step1: create drop show dnodes
@ -42,53 +41,16 @@ while $i < $tbNum
sql insert into $tb values ($ms , $x , $x , $x ) sql insert into $tb values ($ms , $x , $x , $x )
$x = $x + 1 $x = $x + 1
endw endw
$cc = $x * 60000
$ms = 1601481600000 + $cc
sql insert into $tb values ($ms , NULL , NULL , NULL )
$i = $i + 1 $i = $i + 1
endw endw
system sh/exec.sh -n dnode1 -s stop -x SIGINT
system sh/exec.sh -n dnode1 -s start -v
print =============== step3: tb print =============== step3: tb
sql select avg(tbcol) from tb1 sql select * from tb1 where ts in ('2018-07-10 16:31:01', '2022-07-10 16:31:03', 1657441865000);
sql select avg(tbcol) from tb1 where ts <= 1601481840000 sql select * from tb1 where tbcol2 in (257);
sql select avg(tbcol) as b from tb1 sql select * from tb1 where tbcol3 in (2, 257);
sql select avg(tbcol) as b from tb1 interval(1d) sql select * from stb where ts in ('2018-07-10 16:31:01', '2022-07-10 16:31:03', 1657441865000);
sql select avg(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) sql select * from stb where tbcol2 in (257);
sql select bottom(tbcol, 2) from tb1 where ts <= 1601481840000 sql select * from stb where tbcol3 in (2, 257);
sql select top(tbcol, 2) from tb1 where ts <= 1601481840000
sql select percentile(tbcol, 2) from tb1 where ts <= 1601481840000
sql select leastsquares(tbcol, 1, 1) as b from tb1 where ts <= 1601481840000
sql show table distributed tb1
sql select count(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m)
sql select diff(tbcol) from tb1 where ts <= 1601481840000
sql select diff(tbcol) from tb1 where tbcol > 5 and tbcol < 20
sql select first(tbcol), last(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m)
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from tb1 where ts <= 1601481840000 partition by tgcol interval(1m)
#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
sql select last_row(*) from tb1 where tbcol > 5 and tbcol < 20
print =============== step4: stb
sql select avg(tbcol) as c from stb
sql select avg(tbcol) as c from stb where ts <= 1601481840000
sql select avg(tbcol) as c from stb where tgcol < 5 and ts <= 1601481840000
sql select avg(tbcol) as c from stb interval(1m)
sql select avg(tbcol) as c from stb interval(1d)
sql select avg(tbcol) as b from stb where ts <= 1601481840000 interval(1m)
sql select avg(tbcol) as c from stb group by tgcol
sql select avg(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m)
sql show table distributed stb
sql select count(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m)
sql select diff(tbcol) from stb where ts <= 1601481840000
sql select first(tbcol), last(tbcol) as c from stb group by tgcol
sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 and tbcol2 is null partition by tgcol interval(1m)
sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m)
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from stb where ts <= 1601481840000 partition by tgcol interval(1m)
#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
sql select last_row(tbcol), stddev(tbcol) from stb where tbcol > 5 and tbcol < 20 group by tgcol
_OVER: _OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT

View File

@ -104,7 +104,9 @@ sql insert into db.ctb2 values(now, 1, 2, 3)
print =============== step6: query data print =============== step6: query data
sql select * from db.stb where tbname = 'ctb2'; sql select * from db.stb where tbname = 'ctb2';
sql alter table ctb2 set tag t1=1;
sql alter table ctb2 set tag t3='3';
sql select * from db.stb where t1 = 1;
print =============== step7: normal table print =============== step7: normal table
sql create database d1 replica 1 duration 7 keep 50 sql create database d1 replica 1 duration 7 keep 50

View File

@ -104,9 +104,31 @@ sql select length("abcd1234"), char_length("abcd1234=-+*") from stb
sql select tbcol4, length(tbcol4), lower(tbcol4), upper(tbcol4), ltrim(tbcol4), rtrim(tbcol4), concat(tbcol4, tbcol5), concat_ws('_', tbcol4, tbcol5), substr(tbcol4, 1, 4) from stb sql select tbcol4, length(tbcol4), lower(tbcol4), upper(tbcol4), ltrim(tbcol4), rtrim(tbcol4), concat(tbcol4, tbcol5), concat_ws('_', tbcol4, tbcol5), substr(tbcol4, 1, 4) from stb
sql select * from stb where tbcol not in (1,2,3,null); sql select * from stb where tbcol not in (1,2,3,null);
sql select * from stb where tbcol + 3 <> null; sql select * from stb where tbcol + 3 <> null;
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from stb where tbcol = 1 and tbcol2 = 1 and tbcol3 = 1 partition by tgcol interval(1d)
print =============== step5: explain print =============== step5: explain
sql explain analyze select ts from stb where -2;
sql explain analyze select ts from tb1;
sql explain analyze select ts from stb order by ts;
sql explain analyze select * from information_schema.user_stables;
sql explain analyze select count(*),sum(tbcol) from tb1;
sql explain analyze select count(*),sum(tbcol) from stb;
sql explain analyze select count(*),sum(tbcol) from stb group by tbcol;
sql explain analyze select * from information_schema.user_stables;
sql explain analyze verbose true select * from information_schema.user_stables where db_name='db2';
sql explain analyze verbose true select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
sql explain select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0)
print =============== step6: in cast
sql select 1+1n;
sql select cast(1 as timestamp)+1n;
sql select cast(1 as timestamp)+1y;
sql select * from tb1 where ts in ('2018-07-10 16:31:01', '2022-07-10 16:31:03', 1657441865000);
sql select * from tb1 where tbcol2 in (257);
sql select * from tb1 where tbcol3 in (2, 257);
sql select * from stb where ts in ('2018-07-10 16:31:01', '2022-07-10 16:31:03', 1657441865000);
sql select * from stb where tbcol2 in (257);
sql select * from stb where tbcol3 in (2, 257);
print =============== check print =============== check
$null= $null=

View File

@ -1,8 +1,6 @@
system sh/stop_dnodes.sh system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1 system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c udf -v 1 system sh/cfg.sh -n dnode1 -c udf -v 1
print ========= start dnode1 as leader
system sh/exec.sh -n dnode1 -s start system sh/exec.sh -n dnode1 -s start
sql connect sql connect
@ -149,4 +147,18 @@ if $rows != 0 then
return -1 return -1
endi endi
system sh/exec.sh -n dnode1 -s stop -x SIGTERM _OVER:
system sh/exec.sh -n dnode1 -s stop -x SIGINT
print =============== check
$null=
system_content sh/checkValgrind.sh -n dnode1
print cmd return result ----> [ $system_content ]
if $system_content > 0 then
return -1
endi
if $system_content == $null then
return -1
endi

View File

@ -1,11 +1,11 @@
import datetime from datetime import datetime
import time
from dataclasses import dataclass, field
from typing import List
from util.log import * from util.log import *
from util.sql import * from util.sql import *
from util.cases import * from util.cases import *
from util.dnodes import * from util.dnodes import *
from util.common import *
PRIMARY_COL = "ts" PRIMARY_COL = "ts"
@ -24,44 +24,24 @@ BINARY_COL = "c_binary"
NCHAR_COL = "c_nchar" NCHAR_COL = "c_nchar"
TS_COL = "c_ts" TS_COL = "c_ts"
NUM_COL = [INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, TINT_UN_COL, SINT_UN_COL, BINT_UN_COL, INT_UN_COL]
CHAR_COL = [BINARY_COL, NCHAR_COL, ]
BOOLEAN_COL = [BOOL_COL, ]
TS_TYPE_COL = [TS_COL, ]
INT_TAG = "t_int" INT_TAG = "t_int"
ALL_COL = [PRIMARY_COL, INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, BINARY_COL, NCHAR_COL, BOOL_COL, TS_COL]
TAG_COL = [INT_TAG] TAG_COL = [INT_TAG]
## insert data args ## insert data args
TIME_STEP = 10000 TIME_STEP = 10000
NOW = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) NOW = int(datetime.timestamp(datetime.now()) * 1000)
# init db/table # init db/table
DBNAME = "db" DBNAME = "db"
DB1 = "db1"
DB2 = "db2"
DB3 = "db3"
DB4 = "db4"
STBNAME = "stb1" STBNAME = "stb1"
CTBNAME = "ct1" CTBNAME = "ct1"
NTBNAME = "nt1" NTBNAME = "nt1"
@dataclass
class DataSet:
ts_data : List[int] = field(default_factory=list)
int_data : List[int] = field(default_factory=list)
bint_data : List[int] = field(default_factory=list)
sint_data : List[int] = field(default_factory=list)
tint_data : List[int] = field(default_factory=list)
int_un_data : List[int] = field(default_factory=list)
bint_un_data: List[int] = field(default_factory=list)
sint_un_data: List[int] = field(default_factory=list)
tint_un_data: List[int] = field(default_factory=list)
float_data : List[float] = field(default_factory=list)
double_data : List[float] = field(default_factory=list)
bool_data : List[int] = field(default_factory=list)
binary_data : List[str] = field(default_factory=list)
nchar_data : List[str] = field(default_factory=list)
class TDTestCase: class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
@ -83,8 +63,8 @@ class TDTestCase:
@property @property
def create_databases_sql_current(self): def create_databases_sql_current(self):
return [ return [
"create database db1 retentions 1s:1d", f"create database {DB1} retentions 1s:1d",
"create database db2 retentions 1s:1d,2m:2d,3h:3d", f"create database {DB2} retentions 1s:1d,2m:2d,3h:3d",
] ]
@property @property
@ -95,21 +75,22 @@ class TDTestCase:
] ]
@property @property
def create_stable_sql_err(self): def create_stable_sql_err(self, dbname=DB2):
return [ return [
f"create stable stb11 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(ceil) watermark 1s max_delay 1m", f"create stable {dbname}.stb11 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(ceil) watermark 1s max_delay 1m",
f"create stable stb12 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(count) watermark 1min", f"create stable {dbname}.stb12 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(count) watermark 1min",
f"create stable stb13 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) max_delay -1s", f"create stable {dbname}.stb13 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) max_delay -1s",
f"create stable stb14 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) watermark -1m", f"create stable {dbname}.stb14 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) watermark -1m",
f"create stable stb15 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) watermark 1m ", f"create stable {dbname}.stb15 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) watermark 1m ",
f"create stable stb16 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) max_delay 1m ", f"create stable {dbname}.stb16 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) max_delay 1m ",
f"create stable stb21 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} binary(16)) tags (tag1 int) rollup(avg) watermark 1s", f"create stable {dbname}.stb21 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} binary(16)) tags (tag1 int) rollup(avg) watermark 1s",
f"create stable stb22 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) tags (tag1 int) rollup(avg) max_delay 1m", f"create stable {dbname}.stb22 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) tags (tag1 int) rollup(avg) max_delay 1m",
f"create table ntb_1 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) rollup(avg) watermark 1s max_delay 1s", f"create table {dbname}.ntb_1 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) rollup(avg) watermark 1s max_delay 1s",
f"create stable stb23 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) tags (tag1 int) " , f"create table {dbname}.ntb_2 ({PRIMARY_COL} timestamp, {INT_COL} int) " ,
f"create stable stb24 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) " , f"create stable {dbname}.stb23 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) tags (tag1 int) " ,
f"create stable stb25 ({PRIMARY_COL} timestamp, {INT_COL} int) " , f"create stable {dbname}.stb24 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) " ,
f"create stable stb26 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} nchar(16)) " , f"create stable {dbname}.stb25 ({PRIMARY_COL} timestamp, {INT_COL} int) " ,
f"create stable {dbname}.stb26 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} nchar(16)) " ,
# watermark, max_delay: [0, 900000], [ms, s, m, ?] # watermark, max_delay: [0, 900000], [ms, s, m, ?]
f"create stable stb17 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) max_delay 1u", f"create stable stb17 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) max_delay 1u",
@ -135,7 +116,7 @@ class TDTestCase:
f"create stable stb7 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(first) watermark 5s max_delay 1m sma({INT_COL})", f"create stable stb7 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(first) watermark 5s max_delay 1m sma({INT_COL})",
] ]
def test_create_stb(self, db="db2"): def test_create_stb(self, db=DB2):
tdSql.execute(f"use {db}") tdSql.execute(f"use {db}")
for err_sql in self.create_stable_sql_err: for err_sql in self.create_stable_sql_err:
tdSql.error(err_sql) tdSql.error(err_sql)
@ -146,7 +127,7 @@ class TDTestCase:
tdSql.checkRows(len(self.create_stable_sql_current)) tdSql.checkRows(len(self.create_stable_sql_current))
tdSql.execute("use db") # because db is a noraml database, not a rollup database, should not be able to create a rollup stable tdSql.execute("use db") # because db is a noraml database, not a rollup database, should not be able to create a rollup stable
tdSql.error(f"create stable nor_db_rollup_stb ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) watermark 5s max_delay 1m") tdSql.error(f"create stable db.nor_db_rollup_stb ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) watermark 5s max_delay 1m")
def test_create_databases(self): def test_create_databases(self):
@ -162,9 +143,26 @@ class TDTestCase:
self.test_create_databases() self.test_create_databases()
self.test_create_stb() self.test_create_stb()
def __create_tb(self, stb=STBNAME, ctb_num=20, ntbnum=1, rsma=False): def __create_tb(self, stb=STBNAME, ctb_num=20, ntbnum=1, rsma=False, dbname=DBNAME, rsma_type="sum"):
tdLog.printNoPrefix("==========step: create table") tdLog.printNoPrefix("==========step: create table")
create_stb_sql = f'''create table {stb}( if rsma:
if rsma_type.lower().strip() in ("last", "first"):
create_stb_sql = f'''create table {dbname}.{stb}(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned,
{INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned, {BINARY_COL} binary(16)
) tags ({INT_TAG} int) rollup({rsma_type}) watermark 5s,5s max_delay 5s,5s
'''
else:
create_stb_sql = f'''create table {dbname}.{stb}(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned,
{INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned
) tags ({INT_TAG} int) rollup({rsma_type}) watermark 5s,5s max_delay 5s,5s
'''
tdSql.execute(create_stb_sql)
else:
create_stb_sql = f'''create table {dbname}.{stb}(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
{BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp,
@ -172,9 +170,10 @@ class TDTestCase:
{INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned
) tags ({INT_TAG} int) ) tags ({INT_TAG} int)
''' '''
for i in range(ntbnum): tdSql.execute(create_stb_sql)
create_ntb_sql = f'''create table nt{i+1}( for i in range(ntbnum):
create_ntb_sql = f'''create table {dbname}.nt{i+1}(
ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint,
{FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool,
{BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp,
@ -182,74 +181,45 @@ class TDTestCase:
{INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned
) )
''' '''
tdSql.execute(create_stb_sql)
tdSql.execute(create_ntb_sql) tdSql.execute(create_ntb_sql)
for i in range(ctb_num): for i in range(ctb_num):
tdSql.execute(f'create table ct{i+1} using {stb} tags ( {i+1} )') tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.{stb} tags ( {i+1} )')
def __data_set(self, rows): def __insert_data(self, rows, ctb_num=20, dbname=DBNAME, rsma=False, rsma_type="sum"):
data_set = DataSet() tdLog.printNoPrefix("==========step: start inser data into tables now.....")
# from ...pytest.util.common import DataSet
data = DataSet()
data.get_order_set(rows)
for i in range(rows): for i in range(rows):
data_set.ts_data.append(NOW + 1 * (rows - i)) if rsma:
data_set.int_data.append(rows - i) if rsma_type.lower().strip() in ("last", "first"):
data_set.bint_data.append(11111 * (rows - i))
data_set.sint_data.append(111 * (rows - i) % 32767)
data_set.tint_data.append(11 * (rows - i) % 127)
data_set.int_un_data.append(rows - i)
data_set.bint_un_data.append(11111 * (rows - i))
data_set.sint_un_data.append(111 * (rows - i) % 32767)
data_set.tint_un_data.append(11 * (rows - i) % 127)
data_set.float_data.append(1.11 * (rows - i))
data_set.double_data.append(1100.0011 * (rows - i))
data_set.bool_data.append((rows - i) % 2)
data_set.binary_data.append(f'binary{(rows - i)}')
data_set.nchar_data.append(f'nchar_测试_{(rows - i)}')
return data_set
def __insert_data(self):
tdLog.printNoPrefix("==========step: start inser data into tables now.....")
data = self.__data_set(rows=self.rows)
# now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000)
null_data = '''null, null, null, null, null, null, null, null, null, null, null, null, null, null'''
zero_data = "0, 0, 0, 0, 0, 0, 0, 'binary_0', 'nchar_0', 0, 0, 0, 0, 0"
for i in range(self.rows):
row_data = f''' row_data = f'''
{data.int_data[i]}, {data.bint_data[i]}, {data.sint_data[i]}, {data.tint_data[i]}, {data.float_data[i]}, {data.double_data[i]}, {data.int_data[i]}, {data.bint_data[i]}, {data.sint_data[i]}, {data.tint_data[i]}, {data.float_data[i]}, {data.double_data[i]},
{data.bool_data[i]}, '{data.binary_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {data.tint_un_data[i]}, {data.utint_data[i]}, {data.usint_data[i]}, {data.uint_data[i]}, {data.ubint_data[i]}, '{data.vchar_data[i]}'
{data.sint_un_data[i]}, {data.int_un_data[i]}, {data.bint_un_data[i]}
''' '''
neg_row_data = f''' else:
{-1 * data.int_data[i]}, {-1 * data.bint_data[i]}, {-1 * data.sint_data[i]}, {-1 * data.tint_data[i]}, {-1 * data.float_data[i]}, {-1 * data.double_data[i]}, row_data = f'''
{data.bool_data[i]}, '{data.binary_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {1 * data.tint_un_data[i]}, {data.int_data[i]}, {data.bint_data[i]}, {data.sint_data[i]}, {data.tint_data[i]}, {data.float_data[i]}, {data.double_data[i]},
{1 * data.sint_un_data[i]}, {1 * data.int_un_data[i]}, {1 * data.bint_un_data[i]} {data.utint_data[i]}, {data.usint_data[i]}, {data.uint_data[i]}, {data.ubint_data[i]}
''' '''
else:
row_data = f'''
{data.int_data[i]}, {data.bint_data[i]}, {data.sint_data[i]}, {data.tint_data[i]}, {data.float_data[i]}, {data.double_data[i]},
{data.bool_data[i]}, '{data.vchar_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {data.utint_data[i]},
{data.usint_data[i]}, {data.uint_data[i]}, {data.ubint_data[i]}
'''
tdSql.execute( f"insert into {dbname}.{NTBNAME} values ( {NOW - i * int(TIME_STEP * 1.2)}, {row_data} )" )
tdSql.execute( f"insert into ct1 values ( {NOW - i * TIME_STEP}, {row_data} )" )
tdSql.execute( f"insert into ct2 values ( {NOW - i * int(TIME_STEP * 0.6)}, {neg_row_data} )" )
tdSql.execute( f"insert into ct4 values ( {NOW - i * int(TIME_STEP * 0.8) }, {row_data} )" )
tdSql.execute( f"insert into {NTBNAME} values ( {NOW - i * int(TIME_STEP * 1.2)}, {row_data} )" )
tdSql.execute( f"insert into ct2 values ( {NOW + int(TIME_STEP * 0.6)}, {null_data} )" ) for j in range(ctb_num):
tdSql.execute( f"insert into ct2 values ( {NOW - (self.rows + 1) * int(TIME_STEP * 0.6)}, {null_data} )" ) tdSql.execute( f"insert into {dbname}.ct{j+1} values ( {NOW - i * TIME_STEP}, {row_data} )" )
tdSql.execute( f"insert into ct2 values ( {NOW - self.rows * int(TIME_STEP * 0.29) }, {null_data} )" )
tdSql.execute( f"insert into ct4 values ( {NOW + int(TIME_STEP * 0.8)}, {null_data} )" )
tdSql.execute( f"insert into ct4 values ( {NOW - (self.rows + 1) * int(TIME_STEP * 0.8)}, {null_data} )" )
tdSql.execute( f"insert into ct4 values ( {NOW - self.rows * int(TIME_STEP * 0.39)}, {null_data} )" )
tdSql.execute( f"insert into {NTBNAME} values ( {NOW + int(TIME_STEP * 1.2)}, {null_data} )" )
tdSql.execute( f"insert into {NTBNAME} values ( {NOW - (self.rows + 1) * int(TIME_STEP * 1.2)}, {null_data} )" )
tdSql.execute( f"insert into {NTBNAME} values ( {NOW - self.rows * int(TIME_STEP * 0.59)}, {null_data} )" )
def run(self): def run(self):
self.rows = 10 self.rows = 10
tdSql.prepare() tdSql.prepare(dbname=DBNAME)
tdLog.printNoPrefix("==========step0:all check") tdLog.printNoPrefix("==========step0:all check")
self.all_test() self.all_test()
@ -257,26 +227,94 @@ class TDTestCase:
tdLog.printNoPrefix("==========step1:create table in normal database") tdLog.printNoPrefix("==========step1:create table in normal database")
tdSql.prepare() tdSql.prepare()
self.__create_tb() self.__create_tb()
self.__insert_data() self.__insert_data(rows=self.rows)
# return
tdLog.printNoPrefix("==========step2:create table in rollup database") tdLog.printNoPrefix("==========step2:create table in rollup database")
tdSql.execute("create database db3 retentions 1s:4m,2s:8m,3s:12m") tdLog.printNoPrefix("==========step2.1 : rolluo func is not last/first")
tdSql.prepare(dbname=DB3, **{"retentions": "1s:1d, 3s:3d, 5s:5d"})
tdSql.execute("drop database if exists db1 ") db3_ctb_num = 10
tdSql.execute("drop database if exists db2 ") self.__create_tb(rsma=True, dbname=DB3, ctb_num=db3_ctb_num, stb=STBNAME)
self.__insert_data(rows=self.rows, rsma=True, dbname=DB3, ctb_num=db3_ctb_num)
time.sleep(6)
tdSql.query(f"select count(*) from {DB3}.{STBNAME} where ts > now()-5m")
tdSql.checkRows(1)
tdSql.checkData(0, 0, self.rows * db3_ctb_num)
tdSql.execute(f"flush database {DB3}")
tdSql.query(f"select count(*) from {DB3}.{STBNAME} where ts > now()-5m")
tdSql.checkData(0, 0, self.rows * db3_ctb_num)
tdSql.checkRows(1)
tdSql.query(f"select {INT_COL} from {DB3}.{CTBNAME} where ts > now()-4d")
tdSql.checkData(0, 0, self.rows-1)
tdSql.query(f"select {INT_COL} from {DB3}.{CTBNAME} where ts > now()-6d")
tdSql.checkData(0, 0, self.rows-1)
tdSql.execute("use db3") # from ...pytest.util.sql import tdSql
self.test_create_stb(db="db3")
# self.__create_tb()
# self.__insert_data()
self.all_test()
tdSql.execute("drop database if exists db1 ") tdLog.printNoPrefix("==========step2.1.1 : alter stb schemaL drop column")
tdSql.execute("drop database if exists db2 ") tdSql.query(f"select {BINT_COL} from {DB3}.{STBNAME}")
#tdSql.execute(f"alter stable {DB3}.stb1 drop column {BINT_COL}")
# not support alter stable schema anymore
tdSql.error(f"alter stable {DB3}.stb1 drop column {BINT_COL}")
#tdSql.error(f"select {BINT_COL} from {DB3}.{STBNAME}")
tdDnodes.stop(1)
tdDnodes.start(1) tdLog.printNoPrefix("==========step2.1.2 : alter stb schemaL add num_column")
# not support alter stable schema anymore
tdSql.error(f"alter stable {DB3}.stb1 add column {INT_COL}_1 int")
tdSql.error(f"select {INT_COL}_1 from {DB3}.{STBNAME}")
#tdSql.execute(f"alter stable {DB3}.stb1 add column {INT_COL}_1 int")
#tdSql.query(f"select count({INT_COL}_1) from {DB3}.{STBNAME} where _c0 > now-5m")
#tdSql.checkData(0, 0, 0)
#tdSql.execute(f"insert into {DB3}.{CTBNAME} ({PRIMARY_COL}, {INT_COL}, {INT_COL}_1) values({NOW}+20s, 111, 112)")
#time.sleep(7)
#tdSql.query(f"select _rowts, {INT_COL}, {INT_COL}_1 from {DB3}.{CTBNAME} where _c0 > now()-1h and _c0>{NOW}")
#tdSql.checkRows(1)
#tdSql.checkData(0, 1, 111)
#tdSql.checkData(0, 2, 112)
#
#tdSql.query(f"select _rowts, {INT_COL}, {INT_COL}_1 from {DB3}.{CTBNAME} where _c0 > now()-2d and _c0>{NOW}")
#tdSql.checkRows(1)
#tdSql.checkData(0, 1, 111)
#tdSql.checkData(0, 2, 112)
#tdSql.query(f"select _rowts, {INT_COL}, {INT_COL}_1 from {DB3}.{CTBNAME} where _c0 > now()-7d and _c0>{NOW}")
#tdSql.checkRows(1)
#tdSql.checkData(0, 1, 111)
#tdSql.checkData(0, 2, 112)
tdLog.printNoPrefix("==========step2.1.3 : drop child-table")
tdSql.execute(f"drop table {DB3}.{CTBNAME} ")
tdLog.printNoPrefix("==========step2.2 : rolluo func is last/first")
tdSql.prepare(dbname=DB4, **{"retentions": "1s:1d, 2m:3d, 3m:5d"})
db4_ctb_num = 10
tdSql.execute(f"use {DB4}")
self.__create_tb(rsma=True, dbname=DB4, ctb_num=db4_ctb_num, rsma_type="last")
self.__insert_data(rows=self.rows, rsma=True, dbname=DB4, ctb_num=db4_ctb_num, rsma_type="last")
time.sleep(7)
tdSql.query(f"select count(*) from {DB4}.stb1 where ts > now()-5m")
tdSql.checkRows(1)
tdSql.checkData(0, 0, self.rows * db4_ctb_num)
tdSql.execute(f"flush database {DB4}")
tdSql.query(f"select count(*) from {DB4}.stb1 where ts > now()-5m")
tdSql.checkRows(1)
tdSql.checkData(0, 0, self.rows * db4_ctb_num)
tdSql.query(f"select {INT_COL} from {DB4}.ct1 where ts > now()-4d")
tdSql.checkRows_range([1,2])
# tdSql.checkData(0, 0, self.rows-1)
tdSql.query(f"select {INT_COL} from {DB4}.ct1 where ts > now()-6d")
tdSql.checkRows_range([1,2])
# tdSql.checkData(0, 0, self.rows-1)
# return
tdSql.execute(f"drop database if exists {DB1} ")
tdSql.execute(f"drop database if exists {DB2} ")
# self.all_test()
# tdDnodes.stop(1)
# tdDnodes.start(1)
tdSql.execute(f"flush database {DBNAME}")
tdLog.printNoPrefix("==========step4:after wal, all check again ") tdLog.printNoPrefix("==========step4:after wal, all check again ")
self.all_test() self.all_test()

View File

@ -279,14 +279,14 @@ class TDTestCase:
tdSql.error(self.csum_query_form(alias=", diff(c1)")) # mix with calculation function 2 tdSql.error(self.csum_query_form(alias=", diff(c1)")) # mix with calculation function 2
# tdSql.error(self.csum_query_form(alias=" + 2")) # mix with arithmetic 1 # tdSql.error(self.csum_query_form(alias=" + 2")) # mix with arithmetic 1
tdSql.error(self.csum_query_form(alias=" + avg(c1)")) # mix with arithmetic 2 tdSql.error(self.csum_query_form(alias=" + avg(c1)")) # mix with arithmetic 2
tdSql.error(self.csum_query_form(alias=", c2")) # mix with other 1 # tdSql.error(self.csum_query_form(alias=", c2")) # mix with other 1
# tdSql.error(self.csum_query_form(table_expr="stb1")) # select stb directly # tdSql.error(self.csum_query_form(table_expr="stb1")) # select stb directly
stb_join = { #stb_join = {
"col": "stb1.c1", # "col": "stb1.c1",
"table_expr": "stb1, stb2", # "table_expr": "stb1, stb2",
"condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts" # "condition": "where stb1.ts=stb2.ts and stb1.st1=stb2.st2 order by stb1.ts"
} #}
tdSql.error(self.csum_query_form(**stb_join)) # stb join #tdSql.error(self.csum_query_form(**stb_join)) # stb join
interval_sql = { interval_sql = {
"condition": "where ts>0 and ts < now interval(1h) fill(next)" "condition": "where ts>0 and ts < now interval(1h) fill(next)"
} }
@ -421,6 +421,19 @@ class TDTestCase:
tdSql.query("select csum(abs(c1))+2 from db.t1 ") tdSql.query("select csum(abs(c1))+2 from db.t1 ")
tdSql.checkRows(4) tdSql.checkRows(4)
# support selectivity
tdSql.query("select ts, c1, csum(1) from db.t1")
tdSql.checkRows(7)
tdSql.query("select csum(1), ts, c1 from db.t1")
tdSql.checkRows(7)
tdSql.query("select ts, c1, c2, c3, csum(1), ts, c4, c5, c6 from db.t1")
tdSql.checkRows(7)
tdSql.query("select ts, c1, csum(1), c4, c5, csum(1), c6 from db.t1")
tdSql.checkRows(7)
def csum_support_stable(self): def csum_support_stable(self):
tdSql.query(" select csum(1) from db.stb1 ") tdSql.query(" select csum(1) from db.stb1 ")
tdSql.checkRows(70) tdSql.checkRows(70)
@ -474,6 +487,7 @@ class TDTestCase:
# tdSql.checkRows(4) # tdSql.checkRows(4)
def run(self): def run(self):
import traceback import traceback
try: try:

View File

@ -104,8 +104,6 @@ class TDTestCase:
"select stateduration(c1 ,'GT',1,1s) , min(c1) from t1", "select stateduration(c1 ,'GT',1,1s) , min(c1) from t1",
"select stateduration(c1 ,'GT',1,1s) , spread(c1) from t1", "select stateduration(c1 ,'GT',1,1s) , spread(c1) from t1",
"select stateduration(c1 ,'GT',1,1s) , diff(c1) from t1", "select stateduration(c1 ,'GT',1,1s) , diff(c1) from t1",
"select stateduration(c1 ,'GT',1,1s) , abs(c1) from t1",
"select stateduration(c1 ,'GT',1,1s) , c1 from t1",
] ]
for error_sql in error_sql_lists: for error_sql in error_sql_lists:
tdSql.error(error_sql) tdSql.error(error_sql)
@ -226,18 +224,24 @@ class TDTestCase:
tdSql.query("select stateduration(c6,'GT',1,1s) from ct4") tdSql.query("select stateduration(c6,'GT',1,1s) from ct4")
tdSql.checkRows(12) tdSql.checkRows(12)
tdSql.error("select stateduration(c6,'GT',1,1s),tbname from ct1") tdSql.query("select stateduration(c6,'GT',1,1s),tbname from ct1")
tdSql.error("select stateduration(c6,'GT',1,1s),t1 from ct1") tdSql.checkRows(13)
tdSql.query("select stateduration(c6,'GT',1,1s),t1 from ct1")
tdSql.checkRows(13)
# unique with common col # unique with common col
tdSql.error("select stateduration(c6,'GT',1,1s) ,ts from ct1") tdSql.query("select stateduration(c6,'GT',1,1s) ,ts from ct1")
tdSql.error("select stateduration(c6,'GT',1,1s) ,c1 from ct1") tdSql.checkRows(13)
tdSql.query("select stateduration(c6,'GT',1,1s) ,c1 from ct1")
tdSql.checkRows(13)
# unique with scalar function # unique with scalar function
tdSql.error("select stateduration(c6,'GT',1,1s) ,abs(c1) from ct1") tdSql.query("select stateduration(c6,'GT',1,1s) , abs(c1) from ct1")
tdSql.error("select stateduration(c6,'GT',1,1s) , unique(c2) from ct1") tdSql.checkRows(13)
tdSql.error("select stateduration(c6,'GT',1,1s) , abs(c2)+2 from ct1") tdSql.query("select stateduration(c6,'GT',1,1s) , abs(c2)+2 from ct1")
tdSql.checkRows(13)
tdSql.error("select stateduration(c6,'GT',1,1s) , unique(c2) from ct1")
# unique with aggregate function # unique with aggregate function
tdSql.error("select stateduration(c6,'GT',1,1s) ,sum(c1) from ct1") tdSql.error("select stateduration(c6,'GT',1,1s) ,sum(c1) from ct1")

View File

@ -105,8 +105,6 @@ class TDTestCase:
"select statecount(c1 ,'GT',1) , min(c1) from t1", "select statecount(c1 ,'GT',1) , min(c1) from t1",
"select statecount(c1 ,'GT',1) , spread(c1) from t1", "select statecount(c1 ,'GT',1) , spread(c1) from t1",
"select statecount(c1 ,'GT',1) , diff(c1) from t1", "select statecount(c1 ,'GT',1) , diff(c1) from t1",
"select statecount(c1 ,'GT',1) , abs(c1) from t1",
"select statecount(c1 ,'GT',1) , c1 from t1",
] ]
for error_sql in error_sql_lists: for error_sql in error_sql_lists:
tdSql.error(error_sql) tdSql.error(error_sql)
@ -227,17 +225,56 @@ class TDTestCase:
tdSql.query("select statecount(c6,'GT',1) from ct4") tdSql.query("select statecount(c6,'GT',1) from ct4")
tdSql.checkRows(12) tdSql.checkRows(12)
tdSql.error("select statecount(c6,'GT',1),tbname from ct1") tdSql.query("select statecount(c6,'GT',1),tbname from ct1")
tdSql.error("select statecount(c6,'GT',1),t1 from ct1") tdSql.checkRows(13)
tdSql.query("select statecount(c6,'GT',1),t1 from ct1")
tdSql.checkRows(13)
# unique with common col # unique with common col
tdSql.error("select statecount(c6,'GT',1) ,ts from ct1") tdSql.query("select statecount(c6,'GT',1) ,ts from ct1")
tdSql.error("select statecount(c6,'GT',1) ,c1 from ct1") tdSql.checkRows(13)
tdSql.query("select ts, statecount(c6,'GT',1) from ct1")
tdSql.checkRows(13)
tdSql.query("select statecount(c6,'GT',1) ,c1 from ct1")
tdSql.checkRows(13)
tdSql.query("select c1, statecount(c6,'GT',1) from ct1")
tdSql.checkRows(13)
tdSql.query("select ts, c1, c2, c3, statecount(c6,'GT',1) from ct1")
tdSql.checkRows(13)
tdSql.query("select statecount(c6,'GT',1), ts, c1, c2, c3 from ct1")
tdSql.checkRows(13)
tdSql.query("select ts, c1, c2, c3, statecount(c6,'GT',1), ts, c4, c5, c6 from ct1")
tdSql.checkRows(13)
tdSql.query("select stateduration(c6,'GT',1) ,ts from ct1")
tdSql.checkRows(13)
tdSql.query("select ts, stateduration(c6,'GT',1) from ct1")
tdSql.checkRows(13)
tdSql.query("select stateduration(c6,'GT',1) ,c1 from ct1")
tdSql.checkRows(13)
tdSql.query("select c1, stateduration(c6,'GT',1) from ct1")
tdSql.checkRows(13)
tdSql.query("select ts, c1, c2, c3, stateduration(c6,'GT',1) from ct1")
tdSql.checkRows(13)
tdSql.query("select stateduration(c6,'GT',1), ts, c1, c2, c3 from ct1")
tdSql.checkRows(13)
tdSql.query("select ts, c1, c2, c3, stateduration(c6,'GT',1), ts, c4, c5, c6 from ct1")
tdSql.checkRows(13)
# unique with scalar function # unique with scalar function
tdSql.error("select statecount(c6,'GT',1) ,abs(c1) from ct1") tdSql.query("select statecount(c6,'GT',1) , abs(c1) from ct1")
tdSql.checkRows(13)
tdSql.query("select statecount(c6,'GT',1) , abs(c2)+2 from ct1")
tdSql.checkRows(13)
tdSql.error("select statecount(c6,'GT',1) , unique(c2) from ct1") tdSql.error("select statecount(c6,'GT',1) , unique(c2) from ct1")
tdSql.error("select statecount(c6,'GT',1) , abs(c2)+2 from ct1")
tdSql.query("select stateduration(c6,'GT',1) , abs(c1) from ct1")
tdSql.checkRows(13)
tdSql.query("select stateduration(c6,'GT',1) , abs(c2)+2 from ct1")
tdSql.checkRows(13)
tdSql.error("select stateduration(c6,'GT',1) , unique(c2) from ct1")
# unique with aggregate function # unique with aggregate function

View File

@ -31,6 +31,7 @@ python3 ./test.py -f 1-insert/time_range_wise.py
python3 ./test.py -f 1-insert/block_wise.py python3 ./test.py -f 1-insert/block_wise.py
python3 ./test.py -f 1-insert/create_retentions.py python3 ./test.py -f 1-insert/create_retentions.py
python3 ./test.py -f 1-insert/table_param_ttl.py python3 ./test.py -f 1-insert/table_param_ttl.py
python3 ./test.py -f 1-insert/mutil_stage.py
python3 ./test.py -f 1-insert/update_data_muti_rows.py python3 ./test.py -f 1-insert/update_data_muti_rows.py
@ -146,7 +147,7 @@ python3 ./test.py -f 2-query/query_cols_tags_and_or.py
python3 ./test.py -f 2-query/elapsed.py python3 ./test.py -f 2-query/elapsed.py
python3 ./test.py -f 2-query/csum.py python3 ./test.py -f 2-query/csum.py
python3 ./test.py -f 2-query/mavg.py #python3 ./test.py -f 2-query/mavg.py
python3 ./test.py -f 2-query/sample.py python3 ./test.py -f 2-query/sample.py
python3 ./test.py -f 2-query/function_diff.py python3 ./test.py -f 2-query/function_diff.py
python3 ./test.py -f 2-query/unique.py python3 ./test.py -f 2-query/unique.py
@ -340,7 +341,7 @@ python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 2
python3 ./test.py -f 2-query/avg.py -Q 2 python3 ./test.py -f 2-query/avg.py -Q 2
# python3 ./test.py -f 2-query/elapsed.py -Q 2 # python3 ./test.py -f 2-query/elapsed.py -Q 2
python3 ./test.py -f 2-query/csum.py -Q 2 python3 ./test.py -f 2-query/csum.py -Q 2
python3 ./test.py -f 2-query/mavg.py -Q 2 #python3 ./test.py -f 2-query/mavg.py -Q 2
python3 ./test.py -f 2-query/sample.py -Q 2 python3 ./test.py -f 2-query/sample.py -Q 2
python3 ./test.py -f 2-query/function_diff.py -Q 2 python3 ./test.py -f 2-query/function_diff.py -Q 2
python3 ./test.py -f 2-query/unique.py -Q 2 python3 ./test.py -f 2-query/unique.py -Q 2
@ -427,7 +428,7 @@ python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 3
# python3 ./test.py -f 2-query/avg.py -Q 3 # python3 ./test.py -f 2-query/avg.py -Q 3
# python3 ./test.py -f 2-query/elapsed.py -Q 3 # python3 ./test.py -f 2-query/elapsed.py -Q 3
python3 ./test.py -f 2-query/csum.py -Q 3 python3 ./test.py -f 2-query/csum.py -Q 3
python3 ./test.py -f 2-query/mavg.py -Q 3 #python3 ./test.py -f 2-query/mavg.py -Q 3
python3 ./test.py -f 2-query/sample.py -Q 3 python3 ./test.py -f 2-query/sample.py -Q 3
python3 ./test.py -f 2-query/function_diff.py -Q 3 python3 ./test.py -f 2-query/function_diff.py -Q 3
python3 ./test.py -f 2-query/unique.py -Q 3 python3 ./test.py -f 2-query/unique.py -Q 3