diff --git a/cmake/cmake.options b/cmake/cmake.options index 090b5d4135..bec64f7bf0 100644 --- a/cmake/cmake.options +++ b/cmake/cmake.options @@ -163,18 +163,6 @@ option( 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) option( diff --git a/cmake/craft_CMakeLists.txt.in b/cmake/craft_CMakeLists.txt.in deleted file mode 100644 index f0ec7feaf2..0000000000 --- a/cmake/craft_CMakeLists.txt.in +++ /dev/null @@ -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 "" -) diff --git a/cmake/traft_CMakeLists.txt.in b/cmake/traft_CMakeLists.txt.in deleted file mode 100644 index 0934e2c35c..0000000000 --- a/cmake/traft_CMakeLists.txt.in +++ /dev/null @@ -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 "" -) diff --git a/docs/examples/go/connect/afconn/main.go b/docs/examples/go/connect/afconn/main.go index 2d36ef03ab..3c16212a45 100644 --- a/docs/examples/go/connect/afconn/main.go +++ b/docs/examples/go/connect/afconn/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/taosdata/driver-go/v2/af" + "github.com/taosdata/driver-go/v3/af" ) func main() { diff --git a/docs/examples/go/connect/cgoexample/main.go b/docs/examples/go/connect/cgoexample/main.go index ba7ed0f728..57b8d5d91f 100644 --- a/docs/examples/go/connect/cgoexample/main.go +++ b/docs/examples/go/connect/cgoexample/main.go @@ -4,7 +4,7 @@ import ( "database/sql" "fmt" - _ "github.com/taosdata/driver-go/v2/taosSql" + _ "github.com/taosdata/driver-go/v3/taosSql" ) func main() { diff --git a/docs/examples/go/connect/restexample/main.go b/docs/examples/go/connect/restexample/main.go index 1efc98b988..f10151f04f 100644 --- a/docs/examples/go/connect/restexample/main.go +++ b/docs/examples/go/connect/restexample/main.go @@ -4,7 +4,7 @@ import ( "database/sql" "fmt" - _ "github.com/taosdata/driver-go/v2/taosRestful" + _ "github.com/taosdata/driver-go/v3/taosRestful" ) func main() { diff --git a/docs/examples/go/connect/wrapper/main.go b/docs/examples/go/connect/wrapper/main.go index d7e71a8baf..a459539db3 100644 --- a/docs/examples/go/connect/wrapper/main.go +++ b/docs/examples/go/connect/wrapper/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/taosdata/driver-go/v2/wrapper" + "github.com/taosdata/driver-go/v3/wrapper" ) func main() { diff --git a/docs/examples/go/go.mod b/docs/examples/go/go.mod index 5945e395e9..2bc1a74cb6 100644 --- a/docs/examples/go/go.mod +++ b/docs/examples/go/go.mod @@ -2,5 +2,5 @@ module goexample go 1.17 -require github.com/taosdata/driver-go/v2 develop +require github.com/taosdata/driver-go/v3 3.0 diff --git a/docs/examples/go/insert/json/main.go b/docs/examples/go/insert/json/main.go index 6be375270e..805c123342 100644 --- a/docs/examples/go/insert/json/main.go +++ b/docs/examples/go/insert/json/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/taosdata/driver-go/v2/af" + "github.com/taosdata/driver-go/v3/af" ) func prepareDatabase(conn *af.Connector) { diff --git a/docs/examples/go/insert/line/main.go b/docs/examples/go/insert/line/main.go index c17e1a5270..1a09edc40c 100644 --- a/docs/examples/go/insert/line/main.go +++ b/docs/examples/go/insert/line/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/taosdata/driver-go/v2/af" + "github.com/taosdata/driver-go/v3/af" ) func prepareDatabase(conn *af.Connector) { diff --git a/docs/examples/go/insert/sql/main.go b/docs/examples/go/insert/sql/main.go index 6cd5f860e6..a493ef5fb0 100644 --- a/docs/examples/go/insert/sql/main.go +++ b/docs/examples/go/insert/sql/main.go @@ -4,7 +4,7 @@ import ( "database/sql" "fmt" - _ "github.com/taosdata/driver-go/v2/taosRestful" + _ "github.com/taosdata/driver-go/v3/taosRestful" ) func createStable(taos *sql.DB) { diff --git a/docs/examples/go/insert/stmt/main.go b/docs/examples/go/insert/stmt/main.go index 7093fdf1e5..d23a6e345c 100644 --- a/docs/examples/go/insert/stmt/main.go +++ b/docs/examples/go/insert/stmt/main.go @@ -4,9 +4,9 @@ import ( "fmt" "time" - "github.com/taosdata/driver-go/v2/af" - "github.com/taosdata/driver-go/v2/af/param" - "github.com/taosdata/driver-go/v2/common" + "github.com/taosdata/driver-go/v3/af" + "github.com/taosdata/driver-go/v3/af/param" + "github.com/taosdata/driver-go/v3/common" ) func checkErr(err error, prompt string) { diff --git a/docs/examples/go/insert/telnet/main.go b/docs/examples/go/insert/telnet/main.go index 91fafbe71a..4cf4375db5 100644 --- a/docs/examples/go/insert/telnet/main.go +++ b/docs/examples/go/insert/telnet/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/taosdata/driver-go/v2/af" + "github.com/taosdata/driver-go/v3/af" ) func prepareDatabase(conn *af.Connector) { diff --git a/docs/examples/go/query/sync/main.go b/docs/examples/go/query/sync/main.go index 0326c7a7da..add422e385 100644 --- a/docs/examples/go/query/sync/main.go +++ b/docs/examples/go/query/sync/main.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - _ "github.com/taosdata/driver-go/v2/taosRestful" + _ "github.com/taosdata/driver-go/v3/taosRestful" ) func main() { diff --git a/docs/examples/go/sub/main.go b/docs/examples/go/sub/main.go index c44521b340..7721eed134 100644 --- a/docs/examples/go/sub/main.go +++ b/docs/examples/go/sub/main.go @@ -1,53 +1,120 @@ package main import ( - "database/sql/driver" + "context" + "encoding/json" "fmt" - "io" - "os" + "strconv" "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() { - db, err := taos.Open("", "", "", "log", 0) + db, err := af.Open("", "root", "taosdata", "", 0) if err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) + panic(err) } 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 { - fmt.Fprintln(os.Stderr, err) - os.Exit(2) + panic(err) + } + _, err = db.Exec("create topic if not exists example_tmq_topic with meta as DATABASE example_tmq") + if err != nil { + panic(err) + } + 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) } - defer topic.Unsubscribe(true) for { - func() { - rows, err := topic.Consume() - defer func() { rows.Close(); time.Sleep(time.Second) }() - if err != nil { - fmt.Println(err) - os.Exit(3) - } - for { - values := make([]driver.Value, 4) - err := rows.Next(values) - if err == io.EOF { - break - } else if err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(4) - } - ts := values[0].(time.Time) - level := values[1].(int8) - ipaddr := values[2].(string) - content := values[3].(string) - fmt.Printf("%s %d %s %s\n", ts.Format(time.StampMilli), level, ipaddr, content) - } - }() + result, err := consumer.Poll(time.Second) + if err != nil { + 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 } + _, err = db.Exec("insert into example_tmq.t1 values(now,1)") + if err != nil { + panic(err) + } + 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() } - -// 未完成 diff --git a/docs/zh/01-index.md b/docs/zh/01-index.md index d2e6706892..0db1df0de9 100644 --- a/docs/zh/01-index.md +++ b/docs/zh/01-index.md @@ -4,11 +4,11 @@ sidebar_label: 文档首页 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)一章。 -如果你是开发者,请一定仔细阅读[开发指南](./develop)一章,该部分对数据库连接、建模、插入数据、查询、连续查询、缓存、数据订阅、用户自定义函数等功能都做了详细介绍,并配有各种编程语言的示例代码。大部分情况下,你只要把示例代码拷贝粘贴,针对自己的应用稍作改动,就能跑起来。 +如果你是开发者,请一定仔细阅读[开发指南](./develop)一章,该部分对数据库连接、建模、插入数据、查询、流式计算、缓存、数据订阅、用户自定义函数等功能都做了详细介绍,并配有各种编程语言的示例代码。大部分情况下,你只要把示例代码拷贝粘贴,针对自己的应用稍作改动,就能跑起来。 我们已经生活在大数据的时代,纵向扩展已经无法满足日益增长的业务需求,任何系统都必须具有水平扩展的能力,集群成为大数据以及 database 系统的不可缺失功能。TDengine 团队不仅实现了集群功能,而且将这一重要核心功能开源。怎么部署、管理和维护 TDengine 集群,请参考[集群管理](./cluster)一章。 diff --git a/docs/zh/14-reference/02-rest-api/02-rest-api.mdx b/docs/zh/14-reference/02-rest-api/02-rest-api.mdx index a8a92606e4..ba43aa30fd 100644 --- a/docs/zh/14-reference/02-rest-api/02-rest-api.mdx +++ b/docs/zh/14-reference/02-rest-api/02-rest-api.mdx @@ -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)。 :::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 { - "status": "succ", - "head": [ - "name", - "created_time", - "ntables", - "vgroups", - "replica", - "quorum", - "days", - "keep1,keep2,keep(D)", - "cache(MB)", - "blocks", - "minrows", - "maxrows", - "wallevel", - "fsync", - "comp", - "precision", - "status" - ], - "data": [ - [ - "log", - "2020-09-02 17:23:00.039", - 4, - 1, - 1, - 1, - 10, - "30,30,30", - 1, - 3, - 100, - 4096, - 1, - 3000, - 2, - "us", - "ready" - ] - ], - "rows": 1 + "code": 0, + "column_meta": [ + [ + "name", + "VARCHAR", + 64 + ], + [ + "create_time", + "TIMESTAMP", + 8 + ], + [ + "vgroups", + "SMALLINT", + 2 + ], + [ + "ntables", + "BIGINT", + 8 + ], + [ + "replica", + "TINYINT", + 1 + ], + [ + "strict", + "VARCHAR", + 4 + ], + [ + "duration", + "VARCHAR", + 10 + ], + [ + "keep", + "VARCHAR", + 32 + ], + [ + "buffer", + "INT", + 4 + ], + [ + "pagesize", + "INT", + 4 + ], + [ + "pages", + "INT", + 4 + ], + [ + "minrows", + "INT", + 4 + ], + [ + "maxrows", + "INT", + 4 + ], + [ + "comp", + "TINYINT", + 1 + ], + [ + "precision", + "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": [ + [ + "information_schema", + null, + null, + 14, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + "ready", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ], + [ + "performance_schema", + null, + null, + 3, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + "ready", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null + ] + ], + "rows": 2 } ``` ## HTTP 请求格式 -``` +```text http://:/rest/sql/[db_name] ``` @@ -83,21 +233,21 @@ http://:/rest/sql/[db_name] - fqnd: 集群中的任一台主机 FQDN 或 IP 地址 - 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 请求的 Header 里需带有身份认证信息,TDengine 支持 Basic 认证与自定义认证两种机制,后续版本将提供标准安全的数字签名机制来做身份验证。 -- 自定义身份认证信息如下所示(token 稍后介绍) +- [自定义身份认证信息](#自定义授权码)如下所示 - ``` + ```text Authorization: Taosd ``` - Basic 身份认证信息如下所示 - ``` + ```text Authorization: Basic ``` @@ -119,41 +269,165 @@ curl -L -u username:password -d "" :/rest/sql/[db_name] ## HTTP 返回格式 -返回值为 JSON 格式,如下: +### HTTP 响应码 + +| **response code** | **说明** | +|-------------------|----------------| +| 200 | 正确返回和 C 接口错误返回 | +| 400 | 参数错误返回 | +| 401 | 鉴权失败 | +| 404 | 接口不存在 | +| 500 | 内部错误 | +| 503 | 系统资源不足 | + +### HTTP body 结构 + + + + + + + + + + + + + + + + + + + + + + +
执行结果说明样例
正确执行 + code:(int)0 代表成功 +
+
+ column_meta:([][3]any)列信息,每个列会用三个值来说明,分别为:列名(string)、列类型(string)、类型长度(int) +
+
+ rows:(int)数据返回行数 +
+
+ data:([][]any)具体数据内容 +
```json { - "status": "succ", - "head": ["ts","current", …], - "column_meta": [["ts",9,8],["current",6,4], …], - "data": [ - ["2018-10-03 14:38:05.000", 10.3, …], - ["2018-10-03 14:38:15.000", 12.6, …] - ], - "rows": 2 + "code": 0, + "column_meta": [["affected_rows", "INT", 4]], + "data": [[0]], + "rows": 1 } ``` -说明: +
正确查询 + code:(int)0 代表成功 +
+
+ column_meta:([][3]any) 列信息,每个列会用三个值来说明,分别为:列名(string)、列类型(string)、类型长度(int) +
+
+ rows:(int)数据返回行数 +
+
+ data:([][]any)具体数据内容 +
-- status: 告知操作结果是成功还是失败。 -- 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。 -- data: 具体返回的数据,一行一行的呈现,如果不返回结果集,那么就仅有 [[affected_rows]]。data 中每一行的数据列顺序,与 column_meta 中描述数据列的顺序完全一致。 -- rows: 表明总共多少行数据。 +```json +{ + "code": 0, + "column_meta": [ + ["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 中的列类型说明: +
错误 + code:(int)错误码 +
+
+ desc:(string)错误描述 +
-- 1:BOOL -- 2:TINYINT -- 3:SMALLINT -- 4:INT -- 5:BIGINT -- 6:FLOAT -- 7:DOUBLE -- 8:BINARY -- 9:TIMESTAMP -- 10:NCHAR +```json +{ + "code": 9728, + "desc": "syntax error near \"1\"" +} +``` + +
+ +### 说明 + +- 时间格式仅支持 RFC3339,结果集为 0 时区 +- 列类型使用如下字符串: + > "NULL" + > "BOOL" + > "TINYINT" + > "SMALLINT" + > "INT" + > "BIGINT" + > "FLOAT" + > "DOUBLE" + > "VARCHAR" + > "TIMESTAMP" + > "NCHAR" + > "TINYINT UNSIGNED" + > "SMALLINT UNSIGNED" + > "INT UNSIGNED" + > "BIGINT UNSIGNED" + > "JSON" ## 自定义授权码 @@ -199,19 +473,44 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata ```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-03 14:38:05.000", 10.3, 219, 0.31], - ["2018-10-03 14:38:15.000", 12.6, 218, 0.33] - ], - "rows": 2 + "code": 0, + "column_meta": [ + [ + "ts", + "TIMESTAMP", + 8 + ], + [ + "current", + "FLOAT", + 4 + ], + [ + "voltage", + "INT", + 4 + ], + [ + "phase", + "FLOAT", + 4 + ] + ], + "data": [ + [ + "2022-07-30T06:44:40.32Z", + 10.3, + 219, + 0.31 + ], + [ + "2022-07-30T06:44:41.32Z", + 12.6, + 218, + 0.33 + ] + ], + "rows": 2 } ``` @@ -225,83 +524,23 @@ curl http://192.168.0.1:6041/rest/login/root/taosdata ```json { - "status": "succ", - "head": ["affected_rows"], - "column_meta": [["affected_rows", 4, 4]], - "data": [[1]], - "rows": 1 + "code": 0, + "column_meta": [ + [ + "affected_rows", + "INT", + 4 + ] + ], + "data": [ + [ + 0 + ] + ], + "rows": 1 } ``` -## 其他用法 +## 参考 -### 结果集采用 Unix 时间戳 - -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: 启动的线程数量,默认为 2(2.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/)。 -::: +[taosAdapter](/reference/taosadapter/) diff --git a/docs/zh/14-reference/03-connector/go.mdx b/docs/zh/14-reference/03-connector/go.mdx index 88b09aa5d0..a87c948d4a 100644 --- a/docs/zh/14-reference/03-connector/go.mdx +++ b/docs/zh/14-reference/03-connector/go.mdx @@ -65,7 +65,7 @@ REST 连接支持所有能运行 Go 的平台。 ### 使用 go get 安装 -`go get -u github.com/taosdata/driver-go/v2@develop` +`go get -u github.com/taosdata/driver-go/v3@latest` ### 使用 go mod 管理 @@ -80,7 +80,7 @@ REST 连接支持所有能运行 Go 的平台。 ```go import ( "database/sql" - _ "github.com/taosdata/driver-go/v2/taosSql" + _ "github.com/taosdata/driver-go/v3/taosSql" ) ``` @@ -132,7 +132,7 @@ import ( "database/sql" "fmt" - _ "github.com/taosdata/driver-go/v2/taosSql" + _ "github.com/taosdata/driver-go/v3/taosSql" ) func main() { @@ -164,7 +164,7 @@ import ( "database/sql" "fmt" - _ "github.com/taosdata/driver-go/v2/taosRestful" + _ "github.com/taosdata/driver-go/v3/taosRestful" ) 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)。 ## 使用限制 由于 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" "time" - _ "github.com/taosdata/driver-go/v2/taosRestful" + _ "github.com/taosdata/driver-go/v3/taosRestful" ) func main() { @@ -266,35 +266,27 @@ func main() { ## 常见问题 -1. 无法找到包 `github.com/taosdata/driver-go/v2/taosRestful` - - 将 `go.mod` 中 require 块对`github.com/taosdata/driver-go/v2`的引用改为`github.com/taosdata/driver-go/v2 develop`,之后执行 `go mod tidy`。 - -2. database/sql 中 stmt(参数绑定)相关接口崩溃 +1. database/sql 中 stmt(参数绑定)相关接口崩溃 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` 语句不会生效,解决办法见上方使用限制章节。 -4. 使用 taosSql 不报错使用 taosRestful 报错 `[0x217] Database not specified or available` +3. 使用 taosSql 不报错使用 taosRestful 报错 `[0x217] Database not specified or available` 因为 REST 接口无状态,使用 `use db` 语句不会生效,解决办法见上方使用限制章节。 -5. 升级 `github.com/taosdata/driver-go/v2/taosRestful` - - 将 `go.mod` 文件中对 `github.com/taosdata/driver-go/v2` 的引用改为 `github.com/taosdata/driver-go/v2 develop`,之后执行 `go mod tidy`。 - -6. `readBufferSize` 参数调大后无明显效果 +4. `readBufferSize` 参数调大后无明显效果 `readBufferSize` 调大后会减少获取结果时 `syscall` 的调用。如果查询结果的数据量不大,修改该参数不会带来明显提升,如果该参数修改过大,瓶颈会在解析 JSON 数据。如果需要优化查询速度,需要根据实际情况调整该值来达到查询效果最优。 -7. `disableCompression` 参数设置为 `false` 时查询效率降低 +5. `disableCompression` 参数设置为 `false` 时查询效率降低 当 `disableCompression` 参数设置为 `false` 时查询结果会使用 `gzip` 压缩后传输,拿到数据后要先进行 `gzip` 解压。 -8. `go get` 命令无法获取包,或者获取包超时 +6. `go get` 命令无法获取包,或者获取包超时 设置 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 @@ -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` 初始化参数。 @@ -408,4 +412,4 @@ func main() { ## 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) diff --git a/include/common/tcommon.h b/include/common/tcommon.h index c5404085bb..4eea744be1 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -56,7 +56,6 @@ enum { STREAM_INPUT__DATA_SUBMIT = 1, STREAM_INPUT__DATA_BLOCK, STREAM_INPUT__MERGED_SUBMIT, - // STREAM_INPUT__TABLE_SCAN, STREAM_INPUT__TQ_SCAN, STREAM_INPUT__DATA_RETRIEVE, STREAM_INPUT__GET_RES, @@ -154,7 +153,7 @@ typedef struct SQueryTableDataCond { int32_t order; // desc|asc order to iterate the data block int32_t numOfCols; SColumnInfo* colList; - int32_t type; // data block load type: + int32_t type; // data block load type: STimeWindow twindows; int64_t startVersion; int64_t endVersion; diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index 98db7be0d3..f6f2ceb957 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -202,6 +202,7 @@ bool fmIsForbidStreamFunc(int32_t funcId); bool fmIsIntervalInterpoFunc(int32_t funcId); bool fmIsInterpFunc(int32_t funcId); bool fmIsLastRowFunc(int32_t funcId); +bool fmIsSelectValueFunc(int32_t funcId); bool fmIsSystemInfoFunc(int32_t funcId); bool fmIsImplicitTsFunc(int32_t funcId); bool fmIsClientPseudoColumnFunc(int32_t funcId); diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h index fc1d524506..32a53c9f4e 100644 --- a/include/libs/nodes/cmdnodes.h +++ b/include/libs/nodes/cmdnodes.h @@ -283,6 +283,7 @@ typedef struct SCreateIndexStmt { EIndexType indexType; bool ignoreExists; char indexName[TSDB_INDEX_NAME_LEN]; + char dbName[TSDB_DB_NAME_LEN]; char tableName[TSDB_TABLE_NAME_LEN]; SNodeList* pCols; SIndexOptions* pOptions; diff --git a/include/libs/stream/tstreamUpdate.h b/include/libs/stream/tstreamUpdate.h index 6e4a8d62d0..a4728e6382 100644 --- a/include/libs/stream/tstreamUpdate.h +++ b/include/libs/stream/tstreamUpdate.h @@ -34,11 +34,16 @@ typedef struct SUpdateInfo { TSKEY minTS; SScalableBf* pCloseWinSBF; SHashObj* pMap; + STimeWindow scanWindow; + uint64_t scanGroupId; + uint64_t maxVersion; } SUpdateInfo; SUpdateInfo *updateInfoInitP(SInterval* pInterval, int64_t watermark); SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t watermark); 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 updateInfoAddCloseWindowSBF(SUpdateInfo *pInfo); void updateInfoDestoryColseWinSBF(SUpdateInfo *pInfo); diff --git a/include/libs/wal/wal.h b/include/libs/wal/wal.h index 1417369096..980e01a65c 100644 --- a/include/libs/wal/wal.h +++ b/include/libs/wal/wal.h @@ -41,7 +41,7 @@ extern "C" { #define WAL_REFRESH_MS 1000 #define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12) #define WAL_FILE_LEN (WAL_PATH_LEN + 32) -#define WAL_MAGIC 0xFAFBFCFDULL +#define WAL_MAGIC 0xFAFBFCFDF4F3F2F1ULL #define WAL_SCAN_BUF_SIZE (1024 * 1024 * 3) typedef enum { diff --git a/include/util/taoserror.h b/include/util/taoserror.h index da2f58307d..1c48a46614 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -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_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_FIELD_CONFLICT_WITH_TSMA TAOS_DEF_ERROR_CODE(0, 0x03C8) // mnode-trans #define TSDB_CODE_MND_TRANS_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x03D0) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 3d539ea251..95ce5c8338 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -316,6 +316,7 @@ void doDestroyRequest(void *p) { taosArrayDestroy(pRequest->tableList); taosArrayDestroy(pRequest->dbList); + taosArrayDestroy(pRequest->targetTableList); destroyQueryExecRes(&pRequest->body.resInfo.execRes); diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index f8e64a3409..7cfc1c0b1d 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1231,9 +1231,7 @@ int32_t copyDataBlock(SSDataBlock* dst, const SSDataBlock* src) { colDataAssign(pDst, pSrc, src->info.rows, &src->info); } - dst->info.rows = src->info.rows; - dst->info.window = src->info.window; - dst->info.type = src->info.type; + dst->info = src->info; 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 rows = pDataBlock->info.rows; 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, - pDataBlock->info.uid, pDataBlock->info.rows); + pDataBlock->info.uid, pDataBlock->info.rows, pDataBlock->info.version); if (len >= size - 1) return dumpBuf; for (int32_t j = 0; j < rows; j++) { diff --git a/source/common/src/tname.c b/source/common/src/tname.c index b6f49a7219..7c9f476f43 100644 --- a/source/common/src/tname.c +++ b/source/common/src/tname.c @@ -162,10 +162,7 @@ int32_t tNameGetDbName(const SName* name, char* dst) { return 0; } -const char* tNameGetDbNameP(const SName* name) { - return &name->dbname[0]; -} - +const char* tNameGetDbNameP(const SName* name) { return &name->dbname[0]; } int32_t tNameGetFullDbName(const SName* name, char* dst) { assert(name != NULL && dst != NULL); @@ -212,7 +209,6 @@ int32_t tNameAddTbName(SName* dst, const char* tbName, size_t nameLen) { return 0; } - int32_t tNameSetAcctId(SName* dst, int32_t acctId) { assert(dst != NULL); dst->acctId = acctId; @@ -266,11 +262,21 @@ int32_t tNameFromString(SName* dst, const char* str, uint32_t type) { char* start = (char*)((p == NULL) ? str : (p + 1)); int32_t len = 0; - p = strstr(start, TS_PATH_DELIMITER); - if (p == NULL) { - len = (int32_t)strlen(start); + if (TS_ESCAPE_CHAR == *start) { + ++start; + char* end = start; + while ('`' != *end) { + ++end; + } + len = end - start; + p = ++end; } else { - len = (int32_t)(p - start); + p = strstr(start, TS_PATH_DELIMITER); + if (p == NULL) { + len = (int32_t)strlen(start); + } else { + len = (int32_t)(p - start); + } } // too long account id or too long db name @@ -288,6 +294,10 @@ int32_t tNameFromString(SName* dst, const char* str, uint32_t type) { // too long account id or too long db name int32_t len = (int32_t)strlen(start); + if (TS_ESCAPE_CHAR == *start) { + len -= 2; + ++start; + } if ((len >= tListLen(dst->tname)) || (len <= 0)) { return -1; } @@ -340,7 +350,7 @@ void buildChildTableName(RandTableName* rName) { char temp[8] = {0}; rName->childTableName[0] = 't'; rName->childTableName[1] = '_'; - for(int i = 0; i < 16; i++){ + for (int i = 0; i < 16; i++) { sprintf(temp, "%02x", context.digest[i]); strcat(rName->childTableName, temp); } diff --git a/source/dnode/mnode/impl/inc/mndTopic.h b/source/dnode/mnode/impl/inc/mndTopic.h index 7eb53dbdbb..c5c4800e02 100644 --- a/source/dnode/mnode/impl/inc/mndTopic.h +++ b/source/dnode/mnode/impl/inc/mndTopic.h @@ -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 mndCheckColAndTagModifiable(SMnode *pMnode, const char* stbname, int64_t suid, col_id_t colId); - #ifdef __cplusplus } #endif diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index 9684753ace..0120e1146d 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -1639,10 +1639,10 @@ static void dumpDbInfoData(SSDataBlock *pBlock, SDbObj *pDb, SShowObj *pShow, in colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walRetentionPeriod, false); 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++); - colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walRetentionSize, false); + colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walRollPeriod, false); pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, rows, (const char *)&pDb->cfg.walSegmentSize, false); diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 443d70aef9..c3296ac5c1 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -416,7 +416,7 @@ int32_t mndStart(SMnode *pMnode) { } mndSetRestore(pMnode, true); } - + grantReset(pMnode, TSDB_GRANT_ALL, 0); return mndInitTimer(pMnode); @@ -446,20 +446,6 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) { 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 if (syncNodeStrategy(pSyncNode) == SYNC_STRATEGY_STANDARD_SNAPSHOT) { if (pMsg->msgType == TDMT_SYNC_TIMEOUT) { diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 4b57f45631..e55c562e38 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -687,6 +687,7 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl int32_t numOfRows = 0; int32_t cols = 0; SConnObj *pConn = NULL; + int32_t keepTime = tsShellActivityTimer * 3; if (pShow->pIter == NULL) { SProfileMgmt *pMgmt = &pMnode->profileMgmt; @@ -700,6 +701,10 @@ static int32_t mndRetrieveConns(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBl break; } + if ((taosGetTimestampMs() - pConn->lastAccessTimeMs) > (keepTime * 1000)) { + continue; + } + cols = 0; SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index aab0c7e815..1b0a2c2a13 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -45,7 +45,9 @@ static int32_t mndProcessTableMetaReq(SRpcMsg *pReq); static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows); static void mndCancelGetNextStb(SMnode *pMnode, void *pIter); 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) { SSdbTable table = { @@ -409,7 +411,8 @@ static FORCE_INLINE int32_t schemaExColIdCompare(const void *colId, const void * 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}; int32_t contLen; 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); pDst->createdTime = taosGetTimestampMs(); 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->tagVer = 1; pDst->colVer = 1; @@ -895,9 +899,9 @@ static int32_t mndBuildStbFromAlter(SStbObj *pStb, SStbObj *pDst, SMCreateStbReq pSchema->flags = pField->flags; memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); int32_t cIndex = mndFindSuperTableColumnIndex(pStb, pField->name); - if (cIndex >= 0){ + if (cIndex >= 0) { pSchema->colId = pStb->pColumns[cIndex].colId; - }else{ + } else { pSchema->colId = pDst->nextColId++; } } @@ -909,12 +913,11 @@ static int32_t mndBuildStbFromAlter(SStbObj *pStb, SStbObj *pDst, SMCreateStbReq pSchema->bytes = pField->bytes; memcpy(pSchema->name, pField->name, TSDB_COL_NAME_LEN); int32_t cIndex = mndFindSuperTableTagIndex(pStb, pField->name); - if (cIndex >= 0){ + if (cIndex >= 0) { pSchema->colId = pStb->pTags[cIndex].colId; - }else{ + } else { pSchema->colId = pDst->nextColId++; } - } pDst->tagVer = createReq->tagVer; pDst->colVer = createReq->colVer; @@ -982,7 +985,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { } } else if (terrno != TSDB_CODE_MND_STB_NOT_EXIST) { 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); code = 0; goto _OVER; @@ -1009,7 +1012,7 @@ static int32_t mndProcessCreateStbReq(SRpcMsg *pReq) { } if (isAlter) { - bool needRsp = false; + bool needRsp = false; SStbObj pDst = {0}; if (mndBuildStbFromAlter(pStb, &pDst, &createReq) != 0) { taosMemoryFreeClear(pDst.pTags); @@ -1137,6 +1140,99 @@ static int32_t mndAddSuperTableTag(const SStbObj *pOld, SStbObj *pNew, SArray *p 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) { int32_t tag = mndFindSuperTableTagIndex(pOld, tagName); if (tag < 0) { @@ -1380,7 +1476,8 @@ static int32_t mndSetAlterStbCommitLogs(SMnode *pMnode, STrans *pTrans, SDbObj * 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; SVgObj *pVgroup = NULL; void *pIter = NULL; @@ -1607,7 +1704,8 @@ static int32_t mndBuildSMAlterStbRsp(SDbObj *pDb, SStbObj *pObj, void **pCont, i 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; STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_DB_INSIDE, pReq); if (pTrans == NULL) goto _OVER; @@ -2204,12 +2302,12 @@ static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc pColInfo = taosArrayGet(pBlock->pDataBlock, cols++); colDataAppend(pColInfo, numOfRows, (const char *)maxDelay, false); - char rollup[128 + VARSTR_HEADER_SIZE] = {0}; + char rollup[128 + VARSTR_HEADER_SIZE] = {0}; int32_t rollupNum = (int32_t)taosArrayGetSize(pStb->pFuncs); for (int32_t i = 0; i < rollupNum; ++i) { char *funcName = taosArrayGet(pStb->pFuncs, i); if (i) { - strcat(varDataVal(rollup), ", "); + strcat(varDataVal(rollup), ", "); } strcat(varDataVal(rollup), funcName); } diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index 7e3e5a9838..f343c2e055 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -72,56 +72,6 @@ const char *mndTopicGetShowName(const char topic[TSDB_TOPIC_FNAME_LEN]) { 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) { terrno = TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/dnode/vnode/inc/vnode.h b/source/dnode/vnode/inc/vnode.h index dcf374f4c4..46519dce14 100644 --- a/source/dnode/vnode/inc/vnode.h +++ b/source/dnode/vnode/inc/vnode.h @@ -137,6 +137,7 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader *pReader, STableBlockDistInfo *pTa int64_t tsdbGetNumOfRowsInMemTable(STsdbReader *pHandle); void *tsdbGetIdx(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 tsdbRetrieveLastRow(void *pReader, SSDataBlock *pResBlock, const int32_t *slotIds, SArray *pTableUids); diff --git a/source/dnode/vnode/src/inc/meta.h b/source/dnode/vnode/src/inc/meta.h index e08925acc3..12c3f7f2e8 100644 --- a/source/dnode/vnode/src/inc/meta.h +++ b/source/dnode/vnode/src/inc/meta.h @@ -78,7 +78,10 @@ struct SMeta { TTB* pTagIdx; TTB* pTtlIdx; - TTB* pSmaIdx; + TTB* pSmaIdx; + + TTB* pTaskIdx; + SMetaIdx* pIdx; }; diff --git a/source/dnode/vnode/src/inc/tsdb.h b/source/dnode/vnode/src/inc/tsdb.h index 0bd5dbb602..f1e980c026 100644 --- a/source/dnode/vnode/src/inc/tsdb.h +++ b/source/dnode/vnode/src/inc/tsdb.h @@ -43,6 +43,7 @@ typedef struct STbDataIter STbDataIter; typedef struct SMapData SMapData; typedef struct SBlockIdx SBlockIdx; typedef struct SBlock SBlock; +typedef struct SBlockL SBlockL; typedef struct SColData SColData; typedef struct SBlockDataHdr SBlockDataHdr; typedef struct SBlockData SBlockData; @@ -414,6 +415,29 @@ struct SBlock { 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 { int16_t cid; int8_t type; diff --git a/source/dnode/vnode/src/inc/vnodeInt.h b/source/dnode/vnode/src/inc/vnodeInt.h index ce83b335d7..d47b1cc5cb 100644 --- a/source/dnode/vnode/src/inc/vnodeInt.h +++ b/source/dnode/vnode/src/inc/vnodeInt.h @@ -153,7 +153,7 @@ int32_t tqProcessOffsetCommitReq(STQ* pTq, char* msg, int32_t msgLen); int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessTaskDeployReq(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 tqProcessTaskDispatchReq(STQ* pTq, SRpcMsg* pMsg); int32_t tqProcessTaskRecoverReq(STQ* pTq, SRpcMsg* pMsg); diff --git a/source/dnode/vnode/src/meta/metaOpen.c b/source/dnode/vnode/src/meta/metaOpen.c index 396a58c988..4910830c7d 100644 --- a/source/dnode/vnode/src/meta/metaOpen.c +++ b/source/dnode/vnode/src/meta/metaOpen.c @@ -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 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 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 metaDestroyLock(SMeta *pMeta) { return taosThreadRwlockDestroy(&pMeta->lock); } @@ -130,6 +131,12 @@ int metaOpen(SVnode *pVnode, SMeta **ppMeta) { 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 if (metaOpenIdx(pMeta) < 0) { 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: if (pMeta->pIdx) metaCloseIdx(pMeta); + if (pMeta->pTaskIdx) tdbTbClose(pMeta->pTaskIdx); if (pMeta->pSmaIdx) tdbTbClose(pMeta->pSmaIdx); if (pMeta->pTtlIdx) tdbTbClose(pMeta->pTtlIdx); if (pMeta->pTagIvtIdx) indexClose(pMeta->pTagIvtIdx); @@ -162,6 +170,7 @@ _err: int metaClose(SMeta *pMeta) { if (pMeta) { if (pMeta->pIdx) metaCloseIdx(pMeta); + if (pMeta->pTaskIdx) tdbTbClose(pMeta->pTaskIdx); if (pMeta->pSmaIdx) tdbTbClose(pMeta->pSmaIdx); if (pMeta->pTtlIdx) tdbTbClose(pMeta->pTtlIdx); 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; } + +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; +} diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 86b016b8be..a05013d996 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -695,7 +695,7 @@ FAIL: return -1; } -int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq) { +int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq, int64_t ver) { void* pIter = NULL; bool failed = false; SStreamDataSubmit* pSubmit = NULL; @@ -713,7 +713,7 @@ int32_t tqProcessStreamTrigger(STQ* pTq, SSubmitReq* pReq) { SStreamTask* pTask = *(SStreamTask**)pIter; 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 (streamTaskInput(pTask, (SStreamQueueItem*)pSubmit) < 0) { diff --git a/source/dnode/vnode/src/tq/tqMeta.c b/source/dnode/vnode/src/tq/tqMeta.c index 290ffe5c8d..e866112250 100644 --- a/source/dnode/vnode/src/tq/tqMeta.c +++ b/source/dnode/vnode/src/tq/tqMeta.c @@ -48,7 +48,7 @@ int32_t tqMetaOpen(STQ* pTq) { 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); } diff --git a/source/dnode/vnode/src/tq/tqPush.c b/source/dnode/vnode/src/tq/tqPush.c index 6097ddd49e..0720cf015b 100644 --- a/source/dnode/vnode/src/tq/tqPush.c +++ b/source/dnode/vnode/src/tq/tqPush.c @@ -252,7 +252,7 @@ int tqPushMsg(STQ* pTq, void* msg, int32_t msgLen, tmsg_t msgType, int64_t ver) SSubmitReq* pReq = (SSubmitReq*)data; pReq->version = ver; - tqProcessStreamTrigger(pTq, data); + tqProcessStreamTrigger(pTq, data, ver); } return 0; diff --git a/source/dnode/vnode/src/tsdb/tsdbCommit.c b/source/dnode/vnode/src/tsdb/tsdbCommit.c index 24b300cb1e..e6db812865 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCommit.c +++ b/source/dnode/vnode/src/tsdb/tsdbCommit.c @@ -36,16 +36,20 @@ typedef struct { TSKEY minKey; TSKEY maxKey; // commit file data - SDataFReader *pReader; - SArray *aBlockIdx; // SArray - SMapData oBlockMap; // SMapData, read from reader - SBlockData oBlockData; - SDataFWriter *pWriter; - SArray *aBlockIdxN; // SArray - SMapData nBlockMap; // SMapData - SBlockData nBlockData; - SSkmInfo skmTable; - SSkmInfo skmRow; + struct { + SDataFReader *pReader; + SArray *aBlockIdx; // SArray + SMapData mBlock; // SMapData, read from reader + SBlockData bData; + } dReader; + struct { + SDataFWriter *pWriter; + SArray *aBlockIdx; // SArray + SMapData mBlock; // SMapData + SBlockData bData; + } dWriter; + SSkmInfo skmTable; + SSkmInfo skmRow; /* commit del */ SDelFReader *pDelFReader; SDelFWriter *pDelFWriter; @@ -276,16 +280,16 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { pCommitter->nextKey = TSKEY_MAX; // old - taosArrayClear(pCommitter->aBlockIdx); - tMapDataReset(&pCommitter->oBlockMap); - tBlockDataReset(&pCommitter->oBlockData); + taosArrayClear(pCommitter->dReader.aBlockIdx); + tMapDataReset(&pCommitter->dReader.mBlock); + tBlockDataReset(&pCommitter->dReader.bData); pRSet = (SDFileSet *)taosArraySearch(pCommitter->fs.aDFileSet, &(SDFileSet){.fid = pCommitter->commitFid}, tDFileSetCmprFn, TD_EQ); if (pRSet) { - code = tsdbDataFReaderOpen(&pCommitter->pReader, pTsdb, pRSet); + code = tsdbDataFReaderOpen(&pCommitter->dReader.pReader, pTsdb, pRSet); if (code) goto _err; - code = tsdbReadBlockIdx(pCommitter->pReader, pCommitter->aBlockIdx, NULL); + code = tsdbReadBlockIdx(pCommitter->dReader.pReader, pCommitter->dReader.aBlockIdx, NULL); if (code) goto _err; } @@ -296,9 +300,9 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { SSmaFile fSma; SDFileSet wSet = {.pHeadF = &fHead, .pDataF = &fData, .pLastF = &fLast, .pSmaF = &fSma}; - taosArrayClear(pCommitter->aBlockIdxN); - tMapDataReset(&pCommitter->nBlockMap); - tBlockDataReset(&pCommitter->nBlockData); + taosArrayClear(pCommitter->dWriter.aBlockIdx); + tMapDataReset(&pCommitter->dWriter.mBlock); + tBlockDataReset(&pCommitter->dWriter.bData); if (pRSet) { wSet.diskId = pRSet->diskId; wSet.fid = pCommitter->commitFid; @@ -320,7 +324,7 @@ static int32_t tsdbCommitFileDataStart(SCommitter *pCommitter) { fLast = (SLastFile){.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; _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; - code = tMapDataPutItem(&pCommitter->nBlockMap, pBlock, tPutBlock); + code = tMapDataPutItem(&pCommitter->dWriter.mBlock, pBlock, tPutBlock); if (code) goto _err; return code; @@ -407,8 +412,8 @@ static int32_t tsdbMergeTableData(SCommitter *pCommitter, STbDataIter *pIter, SB int8_t toDataOnly) { int32_t code = 0; SBlockIdx *pBlockIdx = &(SBlockIdx){.suid = pIter->pTbData->suid, .uid = pIter->pTbData->uid}; - SBlockData *pBlockDataMerge = &pCommitter->oBlockData; - SBlockData *pBlockData = &pCommitter->nBlockData; + SBlockData *pBlockDataMerge = &pCommitter->dReader.bData; + SBlockData *pBlockData = &pCommitter->dWriter.bData; SBlock block; SBlock *pBlock = █ TSDBROW *pRow1; @@ -416,7 +421,7 @@ static int32_t tsdbMergeTableData(SCommitter *pCommitter, STbDataIter *pIter, SB TSDBROW *pRow2 = &row2; // 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; code = tBlockDataSetSchema(pBlockData, pCommitter->skmTable.pTSchema); @@ -513,7 +518,7 @@ static int32_t tsdbCommitTableMemData(SCommitter *pCommitter, STbDataIter *pIter TSDBROW *pRow; SBlock block; SBlock *pBlock = █ - SBlockData *pBlockData = &pCommitter->nBlockData; + SBlockData *pBlockData = &pCommitter->dWriter.bData; int64_t suid = pIter->pTbData->suid; int64_t uid = pIter->pTbData->uid; @@ -575,14 +580,14 @@ static int32_t tsdbCommitTableDiskData(SCommitter *pCommitter, SBlock *pBlock, S SBlock block; 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; tBlockReset(&block); - code = tsdbCommitBlockData(pCommitter, &pCommitter->oBlockData, &block, pBlockIdx, 0); + code = tsdbCommitBlockData(pCommitter, &pCommitter->dReader.bData, &block, pBlockIdx, 0); if (code) goto _err; } else { - code = tMapDataPutItem(&pCommitter->nBlockMap, pBlock, tPutBlock); + code = tMapDataPutItem(&pCommitter->dWriter.mBlock, pBlock, tPutBlock); 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 *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 (taosArrayPush(pCommitter->aBlockIdxN, pBlockIdx) == NULL) { + if (taosArrayPush(pCommitter->dWriter.aBlockIdx, pBlockIdx) == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; goto _err; } @@ -643,7 +648,7 @@ static int32_t tsdbGetOvlpNRow(STbDataIter *pIter, SBlock *pBlock) { static int32_t tsdbMergeAsSubBlock(SCommitter *pCommitter, STbDataIter *pIter, SBlock *pBlock) { int32_t code = 0; - SBlockData *pBlockData = &pCommitter->nBlockData; + SBlockData *pBlockData = &pCommitter->dWriter.bData; SBlockIdx *pBlockIdx = &(SBlockIdx){.suid = pIter->pTbData->suid, .uid = pIter->pTbData->uid}; SBlock block; TSDBROW *pRow; @@ -711,10 +716,10 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl } if (pBlockIdx) { - code = tsdbReadBlock(pCommitter->pReader, pBlockIdx, &pCommitter->oBlockMap, NULL); + code = tsdbReadBlock(pCommitter->dReader.pReader, pBlockIdx, &pCommitter->dReader.mBlock, NULL); if (code) goto _err; - nBlock = pCommitter->oBlockMap.nItem; + nBlock = pCommitter->dReader.mBlock.nItem; ASSERT(nBlock > 0); suid = pBlockIdx->suid; @@ -726,13 +731,13 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl if (pRow == NULL && nBlock == 0) goto _exit; // start =========== - tMapDataReset(&pCommitter->nBlockMap); + tMapDataReset(&pCommitter->dWriter.mBlock); SBlock block; SBlock *pBlock = █ iBlock = 0; if (iBlock < nBlock) { - tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock, pBlock, tGetBlock); + tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pBlock, tGetBlock); } else { pBlock = NULL; } @@ -756,7 +761,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl if (pRow && TSDBROW_TS(pRow) > pCommitter->maxKey) pRow = NULL; iBlock++; if (iBlock < nBlock) { - tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock, pBlock, tGetBlock); + tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pBlock, tGetBlock); } else { pBlock = NULL; } @@ -771,7 +776,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl iBlock++; if (iBlock < nBlock) { - tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock, pBlock, tGetBlock); + tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pBlock, tGetBlock); } else { pBlock = NULL; } @@ -798,7 +803,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl SBlock nextBlock = {0}; tBlockReset(&nextBlock); - tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock + 1, &nextBlock, tGetBlock); + tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock + 1, &nextBlock, tGetBlock); 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; iBlock++; if (iBlock < nBlock) { - tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock, pBlock, tGetBlock); + tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pBlock, tGetBlock); } else { pBlock = NULL; } @@ -822,7 +827,7 @@ static int32_t tsdbCommitTableData(SCommitter *pCommitter, STbData *pTbData, SBl iBlock++; if (iBlock < nBlock) { - tMapDataGetItemByIdx(&pCommitter->oBlockMap, iBlock, pBlock, tGetBlock); + tMapDataGetItemByIdx(&pCommitter->dReader.mBlock, iBlock, pBlock, tGetBlock); } else { pBlock = NULL; } @@ -857,23 +862,23 @@ static int32_t tsdbCommitFileDataEnd(SCommitter *pCommitter) { int32_t code = 0; // write blockIdx - code = tsdbWriteBlockIdx(pCommitter->pWriter, pCommitter->aBlockIdxN, NULL); + code = tsdbWriteBlockIdx(pCommitter->dWriter.pWriter, pCommitter->dWriter.aBlockIdx, NULL); if (code) goto _err; // update file header - code = tsdbUpdateDFileSetHeader(pCommitter->pWriter); + code = tsdbUpdateDFileSetHeader(pCommitter->dWriter.pWriter); if (code) goto _err; // upsert SDFileSet - code = tsdbFSUpsertFSet(&pCommitter->fs, &pCommitter->pWriter->wSet); + code = tsdbFSUpsertFSet(&pCommitter->fs, &pCommitter->dWriter.pWriter->wSet); if (code) goto _err; // close and sync - code = tsdbDataFWriterClose(&pCommitter->pWriter, 1); + code = tsdbDataFWriterClose(&pCommitter->dWriter.pWriter, 1); if (code) goto _err; - if (pCommitter->pReader) { - code = tsdbDataFReaderClose(&pCommitter->pReader); + if (pCommitter->dReader.pReader) { + code = tsdbDataFReaderClose(&pCommitter->dReader.pReader); if (code) goto _err; } @@ -898,14 +903,14 @@ static int32_t tsdbCommitFileData(SCommitter *pCommitter) { int32_t iTbData = 0; int32_t nTbData = taosArrayGetSize(pMemTable->aTbData); int32_t iBlockIdx = 0; - int32_t nBlockIdx = taosArrayGetSize(pCommitter->aBlockIdx); + int32_t nBlockIdx = taosArrayGetSize(pCommitter->dReader.aBlockIdx); STbData *pTbData; SBlockIdx *pBlockIdx; ASSERT(nTbData > 0); 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) { if (pTbData && pBlockIdx) { int32_t c = tTABLEIDCmprFn(pTbData, pBlockIdx); @@ -936,7 +941,7 @@ static int32_t tsdbCommitFileData(SCommitter *pCommitter) { if (code) goto _err; iBlockIdx++; - pBlockIdx = (iBlockIdx < nBlockIdx) ? (SBlockIdx *)taosArrayGet(pCommitter->aBlockIdx, iBlockIdx) : NULL; + pBlockIdx = (iBlockIdx < nBlockIdx) ? (SBlockIdx *)taosArrayGet(pCommitter->dReader.aBlockIdx, iBlockIdx) : NULL; continue; _commit_table_mem_and_disk: @@ -944,7 +949,7 @@ static int32_t tsdbCommitFileData(SCommitter *pCommitter) { if (code) goto _err; iBlockIdx++; - pBlockIdx = (iBlockIdx < nBlockIdx) ? (SBlockIdx *)taosArrayGet(pCommitter->aBlockIdx, iBlockIdx) : NULL; + pBlockIdx = (iBlockIdx < nBlockIdx) ? (SBlockIdx *)taosArrayGet(pCommitter->dReader.aBlockIdx, iBlockIdx) : NULL; iTbData++; pTbData = (iTbData < nTbData) ? (STbData *)taosArrayGetP(pMemTable->aTbData, iTbData) : NULL; continue; @@ -958,8 +963,8 @@ static int32_t tsdbCommitFileData(SCommitter *pCommitter) { _err: tsdbError("vgId:%d commit file data failed since %s", TD_VID(pTsdb->pVnode), tstrerror(code)); - tsdbDataFReaderClose(&pCommitter->pReader); - tsdbDataFWriterClose(&pCommitter->pWriter, 0); + tsdbDataFReaderClose(&pCommitter->dReader.pReader); + tsdbDataFWriterClose(&pCommitter->dWriter.pWriter, 0); return code; } @@ -996,22 +1001,22 @@ _err: static int32_t tsdbCommitDataStart(SCommitter *pCommitter) { int32_t code = 0; - pCommitter->aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx)); - if (pCommitter->aBlockIdx == NULL) { + pCommitter->dReader.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx)); + if (pCommitter->dReader.aBlockIdx == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } - pCommitter->aBlockIdxN = taosArrayInit(0, sizeof(SBlockIdx)); - if (pCommitter->aBlockIdxN == NULL) { + pCommitter->dWriter.aBlockIdx = taosArrayInit(0, sizeof(SBlockIdx)); + if (pCommitter->dWriter.aBlockIdx == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; } - code = tBlockDataInit(&pCommitter->oBlockData); + code = tBlockDataInit(&pCommitter->dReader.bData); if (code) goto _exit; - code = tBlockDataInit(&pCommitter->nBlockData); + code = tBlockDataInit(&pCommitter->dWriter.bData); if (code) goto _exit; _exit: @@ -1019,12 +1024,12 @@ _exit: } static void tsdbCommitDataEnd(SCommitter *pCommitter) { - taosArrayDestroy(pCommitter->aBlockIdx); - tMapDataClear(&pCommitter->oBlockMap); - tBlockDataClear(&pCommitter->oBlockData, 1); - taosArrayDestroy(pCommitter->aBlockIdxN); - tMapDataClear(&pCommitter->nBlockMap); - tBlockDataClear(&pCommitter->nBlockData, 1); + taosArrayDestroy(pCommitter->dReader.aBlockIdx); + tMapDataClear(&pCommitter->dReader.mBlock); + tBlockDataClear(&pCommitter->dReader.bData, 1); + taosArrayDestroy(pCommitter->dWriter.aBlockIdx); + tMapDataClear(&pCommitter->dWriter.mBlock); + tBlockDataClear(&pCommitter->dWriter.bData, 1); tTSchemaDestroy(pCommitter->skmTable.pTSchema); tTSchemaDestroy(pCommitter->skmRow.pTSchema); } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index ed2558d344..e924b29fd4 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -2502,6 +2502,10 @@ void* tsdbGetIvtIdx(SMeta* pMeta) { return metaGetIvtIdx(pMeta); } +uint64_t getReaderMaxVersion(STsdbReader *pReader) { + return pReader->verRange.maxVer; +} + /** * @brief Get all suids since suid * diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index e61becbe17..bdf60b110b 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -30,12 +30,20 @@ void ctgFreeMsgSendParam(void* param) { taosMemoryFree(param); } +void ctgFreeBatchMsg(void* msg) { + if (NULL == msg) { + return; + } + SBatchMsg* pMsg = (SBatchMsg*)msg; + taosMemoryFree(pMsg->msg); +} + void ctgFreeBatch(SCtgBatch *pBatch) { if (NULL == pBatch) { return; } - taosArrayDestroy(pBatch->pMsgs); + taosArrayDestroyEx(pBatch->pMsgs, ctgFreeBatchMsg); taosArrayDestroy(pBatch->pTaskIds); } diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index d587e201ef..577f9772be 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -437,6 +437,7 @@ typedef struct SessionWindowSupporter { SStreamAggSupporter* pStreamAggSup; int64_t gap; uint8_t parentType; + SAggSupporter* pIntervalAggSup; } SessionWindowSupporter; 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); bool functionNeedToExecute(SqlFunctionCtx* pCtx); 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 printDataBlock(SSDataBlock* pBlock, const char* flag); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index d031494057..e52cbf40a9 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -672,6 +672,10 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc numOfRows = pfCtx->fpSet.process(pfCtx); } 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 SColumnInfoData* pOutput = taosArrayGet(pResult->pDataBlock, outputSlotId); int32_t slotId = pfCtx->param[0].pCol->slotId; diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index e38034f4aa..8821dbd5a1 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1131,7 +1131,8 @@ static void checkUpdateData(SStreamScanInfo* pInfo, bool invertible, SSDataBlock STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, tsCol[rowId], &pInfo->interval, TSDB_ORDER_ASC); // must check update info first. 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); } } @@ -1337,6 +1338,9 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { case STREAM_SCAN_FROM_DATAREADER_RETRIEVE: { SSDataBlock* pSDB = doRangeScan(pInfo, pInfo->pUpdateRes, pInfo->primaryTsIndex, &pInfo->updateResIndex); 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; checkUpdateData(pInfo, true, pSDB, false); return pSDB; @@ -1390,6 +1394,12 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { 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) { break; } @@ -1406,6 +1416,7 @@ static SSDataBlock* doStreamScan(SOperatorInfo* pOperator) { // record the scan action. pInfo->numOfExec++; pOperator->resultInfo.totalRows += pBlockInfo->rows; + printDataBlock(pInfo->pRes, "stream scan"); if (pBlockInfo->rows == 0) { updateInfoDestoryColseWinSBF(pInfo->pUpdateInfo); diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index 63143875a3..802e1f2306 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -1456,6 +1456,7 @@ static int32_t getAllIntervalWindow(SHashObj* pHashMap, SArray* resWins) { static int32_t closeIntervalWindow(SHashObj* pHashMap, STimeWindowAggSupp* pSup, SInterval* pInterval, SHashObj* pPullDataMap, SArray* closeWins, SArray* pRecyPages, SDiskbasedBuf* pDiscBuf) { + qDebug("===stream===close interval window"); void* pIte = NULL; size_t keyLen = 0; while ((pIte = taosHashIterate(pHashMap, pIte)) != NULL) { @@ -1772,10 +1773,11 @@ SSDataBlock* createDeleteBlock() { 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); SStreamScanInfo* pScanInfo = downstream->info; pScanInfo->sessionSup.parentType = type; + pScanInfo->sessionSup.pIntervalAggSup = pSup; } SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols, @@ -1851,7 +1853,7 @@ SOperatorInfo* createIntervalOperatorInfo(SOperatorInfo* downstream, SExprInfo* destroyIntervalOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL); 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); @@ -3111,7 +3113,7 @@ SOperatorInfo* createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, createOperatorFpSet(NULL, doStreamFinalIntervalAgg, NULL, NULL, destroyStreamFinalIntervalOperatorInfo, aggEncodeResultRow, aggDecodeResultRow, NULL); 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); if (code != TSDB_CODE_SUCCESS) { diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index e58e7475df..6383179fee 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -2465,7 +2465,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "statecount", .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, .getEnvFunc = getStateFuncEnv, .initFunc = functionSetup, @@ -2476,7 +2476,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "stateduration", .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, .getEnvFunc = getStateFuncEnv, .initFunc = functionSetup, @@ -2487,7 +2487,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "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, .getEnvFunc = getCsumFuncEnv, .initFunc = functionSetup, @@ -2499,7 +2499,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { { .name = "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, .getEnvFunc = getMavgFuncEnv, .initFunc = mavgFunctionSetup, diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 0767c2e5a2..fe4e9fd43e 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -4651,10 +4651,15 @@ int32_t stateCountFunction(SqlFunctionCtx* pCtx) { numOfElems++; if (colDataIsNull_f(pInputCol->nullbitmap, i)) { colDataAppendNULL(pOutput, i); + // handle selectivity + if (pCtx->subsidiaries.num > 0) { + appendSelectivityValue(pCtx, i, i); + } 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; if (ret) { output = ++pInfo->count; @@ -4662,6 +4667,11 @@ int32_t stateCountFunction(SqlFunctionCtx* pCtx) { pInfo->count = 0; } colDataAppend(pOutput, i, (char*)&output, false); + + // handle selectivity + if (pCtx->subsidiaries.num > 0) { + appendSelectivityValue(pCtx, i, i); + } } return numOfElems; @@ -4694,6 +4704,10 @@ int32_t stateDurationFunction(SqlFunctionCtx* pCtx) { numOfElems++; if (colDataIsNull_f(pInputCol->nullbitmap, i)) { colDataAppendNULL(pOutput, i); + // handle selectivity + if (pCtx->subsidiaries.num > 0) { + appendSelectivityValue(pCtx, i, i); + } continue; } @@ -4710,6 +4724,11 @@ int32_t stateDurationFunction(SqlFunctionCtx* pCtx) { pInfo->durationStart = 0; } colDataAppend(pOutput, i, (char*)&output, false); + + // handle selectivity + if (pCtx->subsidiaries.num > 0) { + appendSelectivityValue(pCtx, i, i); + } } return numOfElems; @@ -4762,6 +4781,11 @@ int32_t csumFunction(SqlFunctionCtx* pCtx) { } } + // handle selectivity + if (pCtx->subsidiaries.num > 0) { + appendSelectivityValue(pCtx, i, pos); + } + numOfElems++; } @@ -4834,6 +4858,11 @@ int32_t mavgFunction(SqlFunctionCtx* pCtx) { colDataAppend(pOutput, pos, (char*)&result, false); } + // handle selectivity + if (pCtx->subsidiaries.num > 0) { + appendSelectivityValue(pCtx, i, pos); + } + numOfElems++; } diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index 5fc4e7882c..339ff3808b 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -221,6 +221,13 @@ bool fmIsLastRowFunc(int32_t funcId) { 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* m = gFunMgtService.pFuncNameHashTable; if (m != NULL && atomic_val_compare_exchange_ptr((void**)&gFunMgtService.pFuncNameHashTable, m, 0) == m) { diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c index 37d80917b3..abab2126c0 100644 --- a/source/libs/nodes/src/nodesUtilFuncs.c +++ b/source/libs/nodes/src/nodesUtilFuncs.c @@ -745,6 +745,7 @@ void nodesDestroyNode(SNode* pNode) { } taosArrayDestroy(pQuery->pDbList); taosArrayDestroy(pQuery->pTableList); + taosArrayDestroy(pQuery->pTargetTableList); taosArrayDestroy(pQuery->pPlaceholderValues); nodesDestroyNode(pQuery->pPrepareRoot); break; diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h index 705ba9d339..d0c994e210 100644 --- a/source/libs/parser/inc/parAst.h +++ b/source/libs/parser/inc/parAst.h @@ -177,7 +177,7 @@ SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode); SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const SToken* pConfig, const SToken* pValue); 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* pStreamOptions); SNode* createDropIndexStmt(SAstCreateContext* pCxt, bool ignoreNotExists, SToken* pIndexName); diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index f625ebd388..21cb310f10 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -33,6 +33,8 @@ } else { 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 ********************************************************/ 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); } -//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); } + index_name(A) ON full_table_name(B) index_options(C). { pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, D, &A, B, NULL, C); } 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 diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c index d555e86306..41c614eba8 100644 --- a/source/libs/parser/src/parAstCreater.c +++ b/source/libs/parser/src/parAstCreater.c @@ -1403,9 +1403,9 @@ SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const } 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); - if (!checkIndexName(pCxt, pIndexName) || !checkTableName(pCxt, pTableName) || !checkDbName(pCxt, NULL, true)) { + if (!checkIndexName(pCxt, pIndexName)) { return NULL; } 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->ignoreExists = ignoreExists; 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->pOptions = (SIndexOptions*)pOptions; return (SNode*)pStmt; diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c index a93091707a..2d4e29a553 100644 --- a/source/libs/parser/src/parAstParser.c +++ b/source/libs/parser/src/parAstParser.c @@ -244,7 +244,10 @@ static int32_t collectMetaKeyFromDropTable(SCollectMetaKeyCxt* pCxt, SDropTableS } 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) { 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) { - 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) { diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index d564d53633..fbc5e1b4b0 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -434,7 +434,7 @@ static FORCE_INLINE int32_t checkAndTrimValue(SToken* pToken, char* tmpTokenBuf, } 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)); } @@ -1175,11 +1175,6 @@ static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks, getSTSRowAppendInfo(pBuilder->rowType, spd, i, ¶m.toffset, ¶m.colIdx); CHECK_CODE(parseValueToken(&pCxt->pSql, &sToken, pSchema, timePrec, tmpTokenBuf, MemRowAppend, ¶m, &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) { NEXT_VALID_TOKEN(pCxt->pSql, sToken); 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) { // set the null value for the columns that do not assign values if ((spd->numOfBound < spd->numOfCols) && TD_IS_TP_ROW(row)) { diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 02a7ca0fbb..1930adcfa4 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -398,6 +398,7 @@ static void destroyTranslateContext(STranslateContext* pCxt) { taosHashCleanup(pCxt->pDbs); taosHashCleanup(pCxt->pTables); + taosHashCleanup(pCxt->pTargetTables); } 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_VARBINARY: { - if (strict && (!IS_VAR_DATA_TYPE(pVal->node.resType.type) || - pVal->node.resType.bytes > targetDt.bytes - VARSTR_HEADER_SIZE)) { + if (strict && (pVal->node.resType.bytes > targetDt.bytes - VARSTR_HEADER_SIZE)) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_PAR_WRONG_VALUE_TYPE, pVal->literal); } pVal->datum.p = taosMemoryCalloc(1, targetDt.bytes + 1); @@ -906,9 +906,6 @@ static EDealRes translateNormalValue(STranslateContext* pCxt, SValueNode* pVal, break; } 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); if (NULL == pVal->datum.p) { return generateDealNodeErrMsg(pCxt, TSDB_CODE_OUT_OF_MEMORY); @@ -4126,7 +4123,7 @@ static SSchema* getTagSchema(STableMeta* pTableMeta, const char* pTagName) { 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); if (getNumOfTags(pTableMeta) == 1 && pTagsSchema->type == TSDB_DATA_TYPE_JSON && (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) { - 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, "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) { 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); } + 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; - int32_t code = getTableMeta(pCxt, pStmt->dbName, pStmt->tableName, &pTableMeta); 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); return code; @@ -4310,9 +4323,8 @@ static int32_t getSmaIndexAst(STranslateContext* pCxt, SCreateIndexStmt* pStmt, static int32_t buildCreateSmaReq(STranslateContext* pCxt, SCreateIndexStmt* pStmt, SMCreateSmaReq* pReq) { SName name; tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pCxt->pParseCxt->db, pStmt->indexName, &name), pReq->name); - strcpy(name.tname, pStmt->tableName); - name.tname[strlen(pStmt->tableName)] = '\0'; - tNameExtractFullName(&name, pReq->stb); + memset(&name, 0, sizeof(SName)); + tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name), pReq->stb); pReq->igExists = pStmt->ignoreExists; pReq->interval = ((SValueNode*)pStmt->pOptions->pInterval)->datum.i; 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) { // impl later - return 0; + return TSDB_CODE_SUCCESS; } 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) { - if (INDEX_TYPE_SMA == pStmt->indexType) { - return translateCreateSmaIndex(pCxt, pStmt); - } else if (INDEX_TYPE_FULLTEXT == pStmt->indexType) { + if (INDEX_TYPE_FULLTEXT == pStmt->indexType) { return translateCreateFullTextIndex(pCxt, pStmt); } - return TSDB_CODE_FAILED; + return translateCreateSmaIndex(pCxt, pStmt); } static int32_t translateDropIndex(STranslateContext* pCxt, SDropIndexStmt* pStmt) { diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index e51800aece..44d8784b7f 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -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) { 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); } diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index af5a51a903..549e8d68ff 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -219,82 +219,82 @@ typedef union { #define YY_ACTTAB_COUNT (2395) static const YYACTIONTYPE yy_action[] = { /* 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, - /* 30 */ 1793, 325, 163, 1341, 1706, 1262, 1934, 124, 1290, 1023, - /* 40 */ 1006, 1022, 104, 1772, 1778, 103, 102, 101, 100, 99, - /* 50 */ 98, 97, 96, 95, 156, 570, 1336, 73, 1811, 344, - /* 60 */ 147, 14, 1653, 1655, 1568, 88, 577, 1647, 1270, 1024, - /* 70 */ 1023, 1762, 1022, 576, 39, 37, 1404, 122, 121, 1604, - /* 80 */ 1010, 1011, 339, 1530, 1264, 469, 1600, 553, 145, 1, - /* 90 */ 1480, 550, 158, 1879, 1880, 1341, 1884, 1262, 1825, 551, - /* 100 */ 1024, 64, 91, 1794, 579, 1796, 1797, 575, 1660, 570, + /* 30 */ 1793, 325, 164, 1341, 1706, 1262, 1934, 125, 1290, 1023, + /* 40 */ 1006, 1022, 105, 1772, 1778, 104, 103, 102, 101, 100, + /* 50 */ 99, 98, 97, 96, 157, 570, 1336, 73, 1811, 344, + /* 60 */ 148, 14, 1653, 1655, 1568, 89, 577, 1647, 1270, 1024, + /* 70 */ 1023, 1762, 1022, 576, 39, 37, 1404, 123, 122, 1604, + /* 80 */ 1010, 1011, 339, 1530, 1264, 469, 1600, 553, 146, 1, + /* 90 */ 1480, 550, 159, 1879, 1880, 1341, 1884, 1262, 1825, 551, + /* 100 */ 1024, 64, 92, 1794, 579, 1796, 1797, 575, 1660, 570, /* 110 */ 1291, 662, 1871, 1408, 1937, 312, 306, 1867, 1336, 1289, - /* 120 */ 36, 35, 34, 14, 1658, 1343, 1344, 1935, 1937, 104, - /* 130 */ 1270, 1934, 103, 102, 101, 100, 99, 98, 97, 96, - /* 140 */ 95, 164, 450, 1161, 1162, 1934, 639, 638, 637, 636, - /* 150 */ 349, 2, 635, 634, 125, 629, 628, 627, 626, 625, - /* 160 */ 624, 623, 136, 619, 618, 617, 348, 347, 614, 613, + /* 120 */ 36, 35, 34, 14, 1658, 1343, 1344, 1935, 1937, 105, + /* 130 */ 1270, 1934, 104, 103, 102, 101, 100, 99, 98, 97, + /* 140 */ 96, 165, 450, 1161, 1162, 1934, 639, 638, 637, 636, + /* 150 */ 349, 2, 635, 634, 126, 629, 628, 627, 626, 625, + /* 160 */ 624, 623, 137, 619, 618, 617, 348, 347, 614, 613, /* 170 */ 1265, 316, 1263, 662, 1491, 33, 32, 1466, 1937, 40, /* 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, /* 210 */ 1339, 1340, 1342, 1345, 1468, 1762, 33, 32, 612, 551, - /* 220 */ 40, 38, 36, 35, 34, 1289, 317, 165, 315, 314, - /* 230 */ 610, 473, 1265, 209, 1263, 475, 1425, 354, 113, 112, - /* 240 */ 111, 110, 109, 108, 107, 106, 105, 253, 384, 134, - /* 250 */ 133, 607, 606, 605, 63, 1268, 1269, 474, 1318, 1319, + /* 220 */ 40, 38, 36, 35, 34, 1289, 317, 166, 315, 314, + /* 230 */ 610, 473, 1265, 210, 1263, 475, 1425, 354, 114, 113, + /* 240 */ 112, 111, 110, 109, 108, 107, 106, 253, 384, 135, + /* 250 */ 134, 607, 606, 605, 63, 1268, 1269, 474, 1318, 1319, /* 260 */ 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, /* 270 */ 1337, 1338, 1339, 1340, 1342, 1345, 39, 37, 1937, 534, /* 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, /* 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, - /* 340 */ 208, 162, 170, 63, 548, 1934, 339, 49, 1264, 525, - /* 350 */ 665, 1244, 1245, 2, 490, 1490, 222, 223, 484, 1341, - /* 360 */ 55, 1262, 1825, 207, 268, 540, 93, 1794, 579, 1796, - /* 370 */ 1797, 575, 124, 570, 1289, 662, 1871, 1608, 154, 143, + /* 340 */ 209, 163, 171, 63, 548, 1934, 339, 49, 1264, 525, + /* 350 */ 665, 1244, 1245, 2, 490, 1490, 223, 224, 484, 1341, + /* 360 */ 55, 1262, 1825, 208, 268, 540, 94, 1794, 579, 1796, + /* 370 */ 1797, 575, 125, 570, 1289, 662, 1871, 1608, 155, 144, /* 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, - /* 410 */ 548, 339, 122, 1264, 305, 8, 1460, 515, 1776, 89, - /* 420 */ 73, 494, 231, 492, 1341, 542, 1262, 159, 1879, 1880, - /* 430 */ 63, 1884, 77, 119, 1265, 1351, 1263, 662, 124, 1270, + /* 410 */ 548, 339, 123, 1264, 305, 8, 1460, 515, 1776, 90, + /* 420 */ 73, 494, 231, 492, 1341, 542, 1262, 160, 1879, 1880, + /* 430 */ 63, 1884, 77, 120, 1265, 1351, 1263, 662, 125, 1270, /* 440 */ 1762, 1289, 1603, 63, 1772, 1778, 328, 1336, 479, 478, /* 450 */ 1762, 1343, 1344, 11, 10, 522, 570, 1268, 1269, 1270, /* 460 */ 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, - /* 470 */ 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, 122, 215, - /* 480 */ 9, 165, 662, 482, 481, 165, 171, 218, 1586, 195, - /* 490 */ 120, 633, 631, 160, 1879, 1880, 1265, 1884, 1263, 1660, - /* 500 */ 477, 480, 662, 149, 61, 1236, 327, 211, 467, 463, - /* 510 */ 459, 455, 194, 1585, 76, 1658, 1343, 1344, 71, 1268, + /* 470 */ 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, 123, 216, + /* 480 */ 9, 166, 662, 482, 481, 166, 172, 219, 1586, 196, + /* 490 */ 121, 633, 631, 161, 1879, 1880, 1265, 1884, 1263, 1660, + /* 500 */ 477, 480, 662, 150, 61, 1236, 327, 212, 467, 463, + /* 510 */ 459, 455, 195, 1585, 76, 1658, 1343, 1344, 71, 1268, /* 520 */ 1269, 70, 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, /* 530 */ 572, 568, 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, - /* 540 */ 165, 1265, 1377, 1263, 74, 1583, 1288, 192, 450, 81, - /* 550 */ 33, 32, 342, 165, 40, 38, 36, 35, 34, 1533, - /* 560 */ 143, 1265, 1584, 1263, 1268, 1269, 621, 512, 165, 1610, + /* 540 */ 166, 1265, 1377, 1263, 74, 1583, 1288, 193, 450, 82, + /* 550 */ 33, 32, 342, 166, 40, 38, 36, 35, 34, 1533, + /* 560 */ 144, 1265, 1584, 1263, 1268, 1269, 621, 512, 166, 1610, /* 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, - /* 600 */ 1338, 1339, 1340, 1342, 1345, 39, 37, 22, 1937, 191, - /* 610 */ 184, 1793, 189, 339, 610, 1264, 446, 1597, 1320, 1083, - /* 620 */ 513, 162, 612, 482, 481, 1934, 1341, 525, 1262, 1593, - /* 630 */ 120, 1707, 182, 134, 133, 607, 606, 605, 114, 1811, + /* 600 */ 1338, 1339, 1340, 1342, 1345, 39, 37, 22, 1937, 192, + /* 610 */ 185, 1793, 190, 339, 610, 1264, 446, 1597, 1320, 1083, + /* 620 */ 513, 163, 612, 482, 481, 1934, 1341, 525, 1262, 1593, + /* 630 */ 121, 1707, 183, 135, 134, 607, 606, 605, 115, 1811, /* 640 */ 477, 480, 7, 345, 548, 471, 610, 577, 1487, 1336, - /* 650 */ 438, 143, 1762, 525, 576, 1608, 1287, 1595, 419, 352, - /* 660 */ 1610, 1270, 351, 1365, 167, 134, 133, 607, 606, 605, - /* 670 */ 33, 32, 124, 1486, 40, 38, 36, 35, 34, 1825, + /* 650 */ 438, 144, 1762, 525, 576, 1608, 1287, 1595, 419, 352, + /* 660 */ 1610, 1270, 351, 1365, 168, 135, 134, 607, 606, 605, + /* 670 */ 33, 32, 125, 1486, 40, 38, 36, 35, 34, 1825, /* 680 */ 1485, 1608, 9, 280, 1794, 579, 1796, 1797, 575, 1762, /* 690 */ 570, 33, 32, 553, 505, 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, /* 730 */ 525, 546, 39, 37, 1937, 1370, 1483, 302, 1886, 1287, - /* 740 */ 339, 114, 1264, 525, 307, 555, 412, 164, 476, 424, - /* 750 */ 1591, 1934, 1303, 1341, 382, 1262, 1937, 212, 1608, 373, - /* 760 */ 1363, 1886, 1883, 1265, 1509, 1263, 397, 1762, 425, 162, + /* 740 */ 339, 115, 1264, 525, 307, 555, 412, 165, 476, 424, + /* 750 */ 1591, 1934, 1303, 1341, 382, 1262, 1937, 213, 1608, 373, + /* 760 */ 1363, 1886, 1883, 1265, 1509, 1263, 397, 1762, 425, 163, /* 770 */ 399, 1608, 1482, 1934, 1479, 1292, 1336, 1762, 375, 371, /* 780 */ 1704, 1363, 300, 1415, 1478, 1882, 1268, 1269, 1270, 1318, /* 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, /* 910 */ 1793, 1881, 233, 1268, 1269, 1762, 1318, 1319, 1321, 1322, /* 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, - /* 950 */ 603, 1762, 405, 576, 277, 60, 273, 132, 59, 1638, - /* 960 */ 44, 4, 1608, 1749, 1608, 1608, 1481, 553, 200, 1608, - /* 970 */ 525, 198, 124, 1520, 178, 429, 427, 1780, 1825, 1515, - /* 980 */ 560, 449, 91, 1794, 579, 1796, 1797, 575, 1776, 570, - /* 990 */ 566, 202, 1871, 553, 201, 483, 306, 1867, 1608, 336, - /* 1000 */ 335, 485, 525, 41, 54, 557, 63, 220, 1937, 1278, - /* 1010 */ 361, 1513, 122, 1605, 1772, 1778, 334, 53, 509, 1320, - /* 1020 */ 1341, 162, 1271, 11, 10, 1934, 570, 251, 1879, 547, - /* 1030 */ 1608, 546, 256, 488, 1937, 525, 204, 1781, 206, 203, - /* 1040 */ 128, 205, 1793, 1336, 90, 131, 1737, 162, 1776, 51, - /* 1050 */ 1213, 1934, 33, 32, 224, 1270, 40, 38, 36, 35, - /* 1060 */ 34, 33, 32, 1608, 132, 40, 38, 36, 35, 34, + /* 950 */ 603, 1762, 405, 576, 277, 60, 273, 133, 59, 1638, + /* 960 */ 44, 4, 1608, 1749, 1608, 1608, 1481, 553, 201, 1608, + /* 970 */ 525, 199, 125, 1520, 179, 429, 427, 1780, 1825, 1515, + /* 980 */ 560, 449, 92, 1794, 579, 1796, 1797, 575, 1776, 570, + /* 990 */ 566, 203, 1871, 553, 202, 483, 306, 1867, 1608, 336, + /* 1000 */ 335, 485, 525, 41, 54, 557, 63, 221, 1937, 1278, + /* 1010 */ 361, 1513, 123, 1605, 1772, 1778, 334, 53, 509, 1320, + /* 1020 */ 1341, 163, 1271, 11, 10, 1934, 570, 251, 1879, 547, + /* 1030 */ 1608, 546, 256, 488, 1937, 525, 205, 1781, 207, 204, + /* 1040 */ 129, 206, 1793, 1336, 91, 132, 1737, 163, 1776, 51, + /* 1050 */ 1213, 1934, 33, 32, 225, 1270, 40, 38, 36, 35, + /* 1060 */ 34, 33, 32, 1608, 133, 40, 38, 36, 35, 34, /* 1070 */ 1811, 525, 1463, 1464, 1772, 1778, 1276, 1569, 552, 68, - /* 1080 */ 67, 381, 506, 1762, 169, 576, 570, 518, 51, 1783, - /* 1090 */ 615, 535, 230, 1272, 87, 468, 1371, 1400, 565, 1608, - /* 1100 */ 301, 499, 237, 369, 84, 367, 363, 359, 356, 353, - /* 1110 */ 1825, 1112, 1069, 41, 92, 1794, 579, 1796, 1797, 575, + /* 1080 */ 67, 381, 506, 1762, 170, 576, 570, 518, 468, 1783, + /* 1090 */ 615, 535, 230, 1272, 88, 245, 1371, 1400, 565, 1608, + /* 1100 */ 301, 499, 51, 369, 85, 367, 363, 359, 356, 353, + /* 1110 */ 1825, 1112, 1069, 237, 93, 1794, 579, 1796, 1797, 575, /* 1120 */ 525, 570, 1355, 525, 1871, 525, 525, 525, 330, 1867, - /* 1130 */ 157, 510, 1785, 1050, 523, 1422, 524, 262, 346, 616, - /* 1140 */ 41, 1793, 161, 1303, 165, 245, 350, 1504, 1608, 240, - /* 1150 */ 1897, 1608, 583, 1608, 1608, 1608, 1812, 1279, 131, 1274, - /* 1160 */ 1327, 1067, 1648, 132, 1901, 116, 1051, 549, 250, 1811, - /* 1170 */ 255, 258, 3, 260, 131, 5, 355, 552, 313, 360, - /* 1180 */ 1282, 1284, 1762, 1793, 576, 561, 1229, 272, 172, 269, - /* 1190 */ 385, 1287, 568, 1334, 1335, 1337, 1338, 1339, 1340, 1140, - /* 1200 */ 406, 142, 1701, 413, 421, 1144, 420, 422, 558, 1825, - /* 1210 */ 1151, 1811, 1149, 92, 1794, 579, 1796, 1797, 575, 577, - /* 1220 */ 570, 135, 426, 1871, 1762, 428, 576, 330, 1867, 157, - /* 1230 */ 1275, 1293, 431, 430, 439, 1296, 1793, 1295, 442, 181, - /* 1240 */ 183, 443, 444, 1297, 447, 445, 186, 188, 1294, 1898, - /* 1250 */ 448, 1825, 190, 1793, 72, 92, 1794, 579, 1796, 1797, - /* 1260 */ 575, 193, 570, 451, 1811, 1871, 470, 1742, 500, 330, - /* 1270 */ 1867, 1950, 577, 472, 1598, 304, 197, 1762, 1594, 576, - /* 1280 */ 1905, 1811, 199, 115, 137, 507, 138, 1596, 1592, 577, - /* 1290 */ 210, 139, 270, 501, 1762, 140, 576, 213, 511, 322, - /* 1300 */ 533, 217, 514, 129, 1825, 519, 226, 271, 92, 1794, - /* 1310 */ 579, 1796, 1797, 575, 1292, 570, 1793, 504, 1871, 520, - /* 1320 */ 1741, 1825, 330, 1867, 1950, 92, 1794, 579, 1796, 1797, - /* 1330 */ 575, 228, 570, 1928, 1711, 1871, 516, 130, 324, 330, - /* 1340 */ 1867, 1950, 80, 521, 1811, 1609, 536, 1902, 529, 531, - /* 1350 */ 1890, 235, 577, 239, 6, 532, 1912, 1762, 329, 576, - /* 1360 */ 545, 539, 530, 528, 527, 1397, 1793, 123, 249, 1291, - /* 1370 */ 1887, 562, 1911, 553, 559, 331, 1793, 48, 82, 1893, - /* 1380 */ 581, 1652, 1581, 658, 1825, 274, 659, 246, 286, 1794, - /* 1390 */ 579, 1796, 1797, 575, 1811, 570, 52, 265, 244, 248, - /* 1400 */ 151, 254, 577, 1933, 1811, 1953, 661, 1762, 247, 576, - /* 1410 */ 1852, 150, 577, 276, 1937, 287, 1756, 1762, 1793, 576, - /* 1420 */ 297, 278, 296, 553, 556, 563, 1755, 164, 257, 65, - /* 1430 */ 1754, 1934, 1753, 66, 1825, 259, 1750, 357, 286, 1794, - /* 1440 */ 579, 1796, 1797, 575, 1825, 570, 1811, 358, 93, 1794, - /* 1450 */ 579, 1796, 1797, 575, 574, 570, 1256, 1257, 1871, 1762, - /* 1460 */ 168, 576, 564, 1867, 1937, 362, 1748, 366, 364, 365, - /* 1470 */ 1747, 368, 1793, 370, 1745, 372, 1744, 162, 1746, 374, - /* 1480 */ 1232, 1934, 1231, 1722, 1793, 1721, 1825, 379, 1720, 380, + /* 1130 */ 158, 510, 1785, 1050, 227, 525, 523, 524, 262, 616, + /* 1140 */ 41, 1793, 162, 1303, 166, 350, 346, 1504, 1608, 1422, + /* 1150 */ 1897, 1608, 41, 1608, 1608, 1608, 1812, 1279, 583, 1274, + /* 1160 */ 240, 1067, 1648, 1608, 1901, 132, 1051, 549, 255, 1811, + /* 1170 */ 250, 258, 3, 260, 133, 117, 355, 552, 132, 5, + /* 1180 */ 1282, 1284, 1762, 1793, 576, 561, 360, 1327, 313, 269, + /* 1190 */ 173, 1229, 568, 1334, 1335, 1337, 1338, 1339, 1340, 272, + /* 1200 */ 385, 143, 1287, 406, 1701, 1140, 421, 413, 558, 1825, + /* 1210 */ 426, 1811, 1144, 93, 1794, 579, 1796, 1797, 575, 577, + /* 1220 */ 570, 1151, 1149, 1871, 1762, 136, 576, 330, 1867, 158, + /* 1230 */ 1275, 420, 422, 428, 430, 1293, 1793, 431, 1296, 439, + /* 1240 */ 182, 443, 442, 184, 444, 1295, 1297, 447, 445, 1898, + /* 1250 */ 187, 1825, 189, 1793, 1294, 93, 1794, 579, 1796, 1797, + /* 1260 */ 575, 448, 570, 191, 1811, 1871, 72, 451, 194, 330, + /* 1270 */ 1867, 1950, 577, 472, 470, 304, 1598, 1762, 198, 576, + /* 1280 */ 1905, 1811, 116, 1594, 1742, 211, 200, 500, 138, 577, + /* 1290 */ 270, 139, 1596, 507, 1762, 1592, 576, 140, 141, 214, + /* 1300 */ 511, 218, 322, 501, 1825, 533, 519, 1292, 93, 1794, + /* 1310 */ 579, 1796, 1797, 575, 1609, 570, 1793, 228, 1871, 504, + /* 1320 */ 130, 1825, 330, 1867, 1950, 93, 1794, 579, 1796, 1797, + /* 1330 */ 575, 514, 570, 1928, 1741, 1871, 1711, 516, 131, 330, + /* 1340 */ 1867, 1950, 324, 521, 1811, 271, 81, 520, 1902, 529, + /* 1350 */ 1890, 235, 577, 536, 239, 6, 1912, 1762, 531, 576, + /* 1360 */ 545, 532, 530, 329, 539, 1911, 1793, 528, 527, 1397, + /* 1370 */ 124, 249, 1291, 553, 562, 559, 1793, 48, 331, 1887, + /* 1380 */ 83, 581, 1652, 246, 1825, 248, 1893, 265, 286, 1794, + /* 1390 */ 579, 1796, 1797, 575, 1811, 570, 658, 274, 1581, 659, + /* 1400 */ 247, 1933, 577, 661, 1811, 52, 244, 1762, 151, 576, + /* 1410 */ 152, 1852, 577, 276, 1937, 287, 297, 1762, 1793, 576, + /* 1420 */ 278, 1756, 296, 553, 254, 1755, 556, 165, 257, 1953, + /* 1430 */ 65, 1934, 1754, 1753, 1825, 66, 1750, 259, 286, 1794, + /* 1440 */ 579, 1796, 1797, 575, 1825, 570, 1811, 563, 94, 1794, + /* 1450 */ 579, 1796, 1797, 575, 574, 570, 358, 357, 1871, 1762, + /* 1460 */ 362, 576, 564, 1867, 1937, 1256, 1257, 1748, 1747, 169, + /* 1470 */ 364, 366, 1793, 365, 1746, 370, 368, 163, 1745, 372, + /* 1480 */ 1744, 1934, 374, 1232, 1793, 1231, 1825, 1722, 1721, 380, /* 1490 */ 294, 1794, 579, 1796, 1797, 575, 573, 570, 567, 1843, - /* 1500 */ 1811, 1719, 1201, 1694, 126, 1693, 1692, 1691, 577, 69, - /* 1510 */ 1690, 1689, 1811, 1762, 1688, 576, 1687, 1686, 395, 396, - /* 1520 */ 577, 1685, 398, 1684, 1683, 1762, 1682, 576, 1681, 1680, - /* 1530 */ 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672, 1671, 1670, - /* 1540 */ 1825, 1793, 127, 1669, 146, 1794, 579, 1796, 1797, 575, - /* 1550 */ 1668, 570, 1825, 180, 176, 1534, 93, 1794, 579, 1796, - /* 1560 */ 1797, 575, 1667, 570, 1666, 1793, 1871, 1203, 1664, 1811, - /* 1570 */ 1665, 1868, 1663, 1662, 323, 1661, 1535, 577, 177, 1532, - /* 1580 */ 1500, 117, 1762, 1793, 576, 1013, 179, 435, 554, 1951, - /* 1590 */ 155, 1012, 437, 1811, 1499, 118, 1735, 1729, 526, 1718, - /* 1600 */ 185, 577, 187, 1717, 1703, 1587, 1762, 1531, 576, 1825, - /* 1610 */ 1043, 1811, 1529, 295, 1794, 579, 1796, 1797, 575, 577, - /* 1620 */ 570, 452, 454, 1527, 1762, 453, 576, 456, 457, 458, - /* 1630 */ 1525, 461, 462, 1825, 1523, 460, 464, 295, 1794, 579, - /* 1640 */ 1796, 1797, 575, 1512, 570, 1793, 1511, 466, 1496, 465, - /* 1650 */ 1589, 1825, 50, 196, 1154, 290, 1794, 579, 1796, 1797, - /* 1660 */ 575, 1155, 570, 1793, 1588, 630, 1080, 632, 1077, 1075, - /* 1670 */ 1076, 1521, 1516, 1811, 318, 319, 486, 1514, 320, 489, - /* 1680 */ 1495, 577, 1494, 1493, 491, 495, 1762, 94, 576, 493, - /* 1690 */ 1734, 1811, 1238, 544, 1728, 502, 1716, 56, 141, 574, - /* 1700 */ 1714, 1715, 1713, 214, 1762, 1712, 576, 15, 503, 321, - /* 1710 */ 219, 1710, 1702, 1825, 225, 1793, 229, 146, 1794, 579, - /* 1720 */ 1796, 1797, 575, 227, 570, 508, 78, 79, 84, 517, - /* 1730 */ 41, 1825, 232, 1793, 23, 294, 1794, 579, 1796, 1797, - /* 1740 */ 575, 1248, 570, 1811, 1844, 1437, 16, 234, 338, 236, - /* 1750 */ 1419, 577, 47, 242, 238, 148, 1762, 1793, 576, 1421, - /* 1760 */ 1414, 1811, 1952, 241, 24, 243, 340, 1783, 83, 577, - /* 1770 */ 25, 1394, 252, 46, 1762, 1393, 576, 1782, 1454, 152, - /* 1780 */ 18, 1443, 1449, 1825, 1448, 1811, 332, 295, 1794, 579, - /* 1790 */ 1796, 1797, 575, 577, 570, 1453, 17, 1452, 1762, 333, - /* 1800 */ 576, 1825, 10, 1280, 1356, 295, 1794, 579, 1796, 1797, - /* 1810 */ 575, 19, 570, 1793, 45, 1331, 13, 1828, 569, 153, - /* 1820 */ 166, 1311, 580, 578, 1329, 1825, 1328, 1793, 31, 281, - /* 1830 */ 1794, 579, 1796, 1797, 575, 12, 570, 20, 582, 21, - /* 1840 */ 341, 1811, 1141, 584, 586, 1138, 587, 589, 1135, 577, - /* 1850 */ 590, 592, 595, 1129, 1762, 1811, 576, 1127, 593, 596, - /* 1860 */ 1118, 85, 1150, 577, 86, 62, 1133, 602, 1762, 1793, - /* 1870 */ 576, 263, 1132, 1146, 1072, 1041, 611, 1071, 1131, 1793, - /* 1880 */ 1070, 1825, 1068, 1066, 1130, 282, 1794, 579, 1796, 1797, - /* 1890 */ 575, 1065, 570, 1064, 1087, 1825, 264, 1811, 620, 289, - /* 1900 */ 1794, 579, 1796, 1797, 575, 577, 570, 1811, 1062, 1061, - /* 1910 */ 1762, 1060, 576, 1059, 1058, 577, 1057, 1056, 1084, 1082, - /* 1920 */ 1762, 1793, 576, 1053, 1047, 1528, 1052, 1526, 1049, 1048, - /* 1930 */ 1046, 640, 641, 644, 645, 1524, 642, 1825, 646, 648, - /* 1940 */ 650, 291, 1794, 579, 1796, 1797, 575, 1825, 570, 1811, - /* 1950 */ 649, 283, 1794, 579, 1796, 1797, 575, 577, 570, 1522, - /* 1960 */ 653, 652, 1762, 654, 576, 1510, 656, 1003, 1492, 267, - /* 1970 */ 660, 1467, 1266, 275, 1793, 663, 664, 1467, 1467, 1467, + /* 1500 */ 1811, 379, 1720, 1719, 1201, 1694, 127, 1693, 577, 1692, + /* 1510 */ 1691, 69, 1811, 1762, 1690, 576, 1689, 1688, 1687, 1686, + /* 1520 */ 577, 395, 1685, 398, 396, 1762, 1684, 576, 1683, 1682, + /* 1530 */ 1681, 1680, 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672, + /* 1540 */ 1825, 1793, 1671, 128, 147, 1794, 579, 1796, 1797, 575, + /* 1550 */ 1670, 570, 1825, 180, 177, 1534, 94, 1794, 579, 1796, + /* 1560 */ 1797, 575, 1669, 570, 1668, 1793, 1871, 1203, 1664, 1811, + /* 1570 */ 1667, 1868, 1666, 1665, 323, 1663, 1662, 577, 1661, 1535, + /* 1580 */ 178, 1532, 1762, 1793, 576, 1500, 118, 156, 554, 1951, + /* 1590 */ 1499, 1013, 435, 1811, 1012, 437, 181, 119, 526, 1735, + /* 1600 */ 1729, 577, 1718, 188, 186, 1717, 1762, 1703, 576, 1825, + /* 1610 */ 1587, 1811, 1531, 295, 1794, 579, 1796, 1797, 575, 577, + /* 1620 */ 570, 1043, 1529, 452, 1762, 454, 576, 1527, 456, 453, + /* 1630 */ 457, 458, 1525, 1825, 461, 462, 460, 295, 1794, 579, + /* 1640 */ 1796, 1797, 575, 1523, 570, 1793, 464, 466, 1512, 1511, + /* 1650 */ 465, 1825, 1496, 1589, 1588, 290, 1794, 579, 1796, 1797, + /* 1660 */ 575, 50, 570, 1793, 1155, 197, 1154, 630, 1080, 632, + /* 1670 */ 1077, 1076, 1075, 1811, 1521, 1516, 1514, 318, 319, 486, + /* 1680 */ 320, 577, 489, 1495, 1494, 1493, 1762, 495, 576, 95, + /* 1690 */ 1734, 1811, 491, 544, 493, 1238, 1728, 56, 142, 574, + /* 1700 */ 502, 1716, 1714, 1715, 1762, 503, 576, 1713, 215, 321, + /* 1710 */ 508, 1712, 15, 1825, 226, 1793, 1710, 147, 1794, 579, + /* 1720 */ 1796, 1797, 575, 1248, 570, 1702, 517, 220, 78, 80, + /* 1730 */ 79, 1825, 232, 1793, 23, 294, 1794, 579, 1796, 1797, + /* 1740 */ 575, 85, 570, 1811, 1844, 243, 16, 229, 338, 41, + /* 1750 */ 1783, 577, 1437, 234, 17, 238, 1762, 1793, 576, 252, + /* 1760 */ 236, 1811, 1952, 1419, 47, 242, 340, 1421, 149, 577, + /* 1770 */ 241, 24, 25, 46, 1762, 1449, 576, 1414, 84, 1782, + /* 1780 */ 153, 18, 1394, 1825, 1393, 1811, 45, 295, 1794, 579, + /* 1790 */ 1796, 1797, 575, 577, 570, 1454, 1448, 13, 1762, 1443, + /* 1800 */ 576, 1825, 332, 1453, 1452, 295, 1794, 579, 1796, 1797, + /* 1810 */ 575, 333, 570, 1793, 10, 1280, 19, 1828, 154, 1311, + /* 1820 */ 569, 1356, 582, 167, 31, 1825, 1331, 1793, 12, 281, + /* 1830 */ 1794, 579, 1796, 1797, 575, 1329, 570, 1328, 20, 21, + /* 1840 */ 341, 1811, 580, 1141, 584, 587, 578, 1138, 586, 577, + /* 1850 */ 1135, 589, 590, 592, 1762, 1811, 576, 595, 1118, 1133, + /* 1860 */ 1129, 1127, 1150, 577, 593, 1132, 602, 596, 1762, 1793, + /* 1870 */ 576, 1131, 1130, 263, 86, 87, 1146, 62, 611, 1793, + /* 1880 */ 1072, 1825, 1041, 1071, 1070, 282, 1794, 579, 1796, 1797, + /* 1890 */ 575, 1068, 570, 1066, 1065, 1825, 1064, 1811, 620, 289, + /* 1900 */ 1794, 579, 1796, 1797, 575, 577, 570, 1811, 1087, 264, + /* 1910 */ 1762, 1062, 576, 1061, 1060, 577, 1059, 1058, 1057, 1056, + /* 1920 */ 1762, 1793, 576, 1084, 1082, 1047, 1053, 1528, 1052, 1049, + /* 1930 */ 1526, 1048, 1046, 640, 641, 644, 1524, 1825, 642, 648, + /* 1940 */ 646, 291, 1794, 579, 1796, 1797, 575, 1825, 570, 1811, + /* 1950 */ 650, 283, 1794, 579, 1796, 1797, 575, 577, 570, 645, + /* 1960 */ 649, 1522, 1762, 652, 576, 653, 1510, 656, 654, 1003, + /* 1970 */ 1492, 267, 660, 663, 1793, 1266, 275, 664, 1467, 1467, /* 1980 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1825, /* 1990 */ 1467, 1467, 1793, 292, 1794, 579, 1796, 1797, 575, 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, /* 1060 */ 16, 8, 9, 296, 43, 12, 13, 14, 15, 16, /* 1070 */ 288, 268, 125, 126, 327, 328, 172, 277, 296, 162, - /* 1080 */ 163, 164, 279, 301, 167, 303, 339, 90, 43, 46, - /* 1090 */ 13, 369, 90, 35, 89, 269, 90, 228, 111, 296, + /* 1080 */ 163, 164, 279, 301, 167, 303, 339, 90, 269, 46, + /* 1090 */ 13, 369, 90, 35, 89, 365, 90, 228, 111, 296, /* 1100 */ 183, 324, 43, 186, 99, 188, 189, 190, 191, 192, /* 1110 */ 328, 90, 35, 43, 332, 333, 334, 335, 336, 337, /* 1120 */ 268, 339, 193, 268, 342, 268, 268, 268, 346, 347, - /* 1130 */ 348, 279, 89, 35, 279, 90, 279, 279, 279, 13, - /* 1140 */ 43, 260, 360, 90, 227, 365, 269, 267, 296, 90, + /* 1130 */ 348, 279, 89, 35, 279, 268, 279, 279, 279, 13, + /* 1140 */ 43, 260, 360, 90, 227, 269, 279, 267, 296, 90, /* 1150 */ 368, 296, 43, 296, 296, 296, 288, 170, 43, 172, - /* 1160 */ 90, 35, 300, 43, 331, 43, 68, 356, 349, 288, - /* 1170 */ 372, 372, 359, 372, 43, 229, 326, 296, 325, 47, - /* 1180 */ 193, 194, 301, 260, 303, 248, 168, 90, 42, 319, - /* 1190 */ 308, 20, 205, 206, 207, 208, 209, 210, 211, 90, - /* 1200 */ 268, 157, 268, 308, 152, 90, 306, 306, 246, 328, - /* 1210 */ 90, 288, 90, 332, 333, 334, 335, 336, 337, 296, - /* 1220 */ 339, 90, 268, 342, 301, 268, 303, 346, 347, 348, - /* 1230 */ 172, 20, 262, 268, 262, 20, 260, 20, 323, 272, - /* 1240 */ 272, 303, 316, 20, 316, 318, 272, 272, 20, 368, - /* 1250 */ 309, 328, 272, 260, 272, 332, 333, 334, 335, 336, - /* 1260 */ 337, 272, 339, 268, 288, 342, 262, 301, 175, 346, - /* 1270 */ 347, 348, 296, 288, 288, 262, 288, 301, 288, 303, - /* 1280 */ 357, 288, 288, 268, 288, 268, 288, 288, 288, 296, - /* 1290 */ 270, 288, 323, 322, 301, 288, 303, 270, 268, 316, - /* 1300 */ 234, 270, 301, 312, 328, 154, 296, 284, 332, 333, - /* 1310 */ 334, 335, 336, 337, 20, 339, 260, 303, 342, 310, - /* 1320 */ 301, 328, 346, 347, 348, 332, 333, 334, 335, 336, - /* 1330 */ 337, 270, 339, 357, 301, 342, 301, 312, 301, 346, - /* 1340 */ 347, 348, 270, 309, 288, 296, 235, 331, 301, 301, - /* 1350 */ 357, 312, 296, 312, 241, 301, 364, 301, 301, 303, - /* 1360 */ 161, 301, 243, 242, 230, 226, 260, 296, 326, 20, - /* 1370 */ 330, 247, 364, 317, 245, 250, 260, 89, 89, 367, - /* 1380 */ 292, 301, 278, 36, 328, 268, 263, 363, 332, 333, - /* 1390 */ 334, 335, 336, 337, 288, 339, 320, 270, 366, 361, - /* 1400 */ 364, 373, 296, 374, 288, 379, 262, 301, 362, 303, - /* 1410 */ 345, 315, 296, 271, 358, 282, 0, 301, 260, 303, - /* 1420 */ 282, 258, 282, 317, 374, 374, 0, 371, 373, 177, - /* 1430 */ 0, 375, 0, 42, 328, 373, 0, 35, 332, 333, - /* 1440 */ 334, 335, 336, 337, 328, 339, 288, 187, 332, 333, - /* 1450 */ 334, 335, 336, 337, 296, 339, 35, 35, 342, 301, - /* 1460 */ 35, 303, 346, 347, 358, 187, 0, 187, 35, 35, - /* 1470 */ 0, 187, 260, 35, 0, 22, 0, 371, 0, 35, - /* 1480 */ 172, 375, 170, 0, 260, 0, 328, 166, 0, 165, + /* 1160 */ 90, 35, 300, 296, 331, 43, 68, 356, 372, 288, + /* 1170 */ 349, 372, 359, 372, 43, 43, 326, 296, 43, 229, + /* 1180 */ 193, 194, 301, 260, 303, 248, 47, 90, 325, 319, + /* 1190 */ 42, 168, 205, 206, 207, 208, 209, 210, 211, 90, + /* 1200 */ 308, 157, 20, 268, 268, 90, 152, 308, 246, 328, + /* 1210 */ 268, 288, 90, 332, 333, 334, 335, 336, 337, 296, + /* 1220 */ 339, 90, 90, 342, 301, 90, 303, 346, 347, 348, + /* 1230 */ 172, 306, 306, 268, 268, 20, 260, 262, 20, 262, + /* 1240 */ 272, 303, 323, 272, 316, 20, 20, 316, 318, 368, + /* 1250 */ 272, 328, 272, 260, 20, 332, 333, 334, 335, 336, + /* 1260 */ 337, 309, 339, 272, 288, 342, 272, 268, 272, 346, + /* 1270 */ 347, 348, 296, 288, 262, 262, 288, 301, 288, 303, + /* 1280 */ 357, 288, 268, 288, 301, 270, 288, 175, 288, 296, + /* 1290 */ 323, 288, 288, 268, 301, 288, 303, 288, 288, 270, + /* 1300 */ 268, 270, 316, 322, 328, 234, 154, 20, 332, 333, + /* 1310 */ 334, 335, 336, 337, 296, 339, 260, 270, 342, 303, + /* 1320 */ 312, 328, 346, 347, 348, 332, 333, 334, 335, 336, + /* 1330 */ 337, 301, 339, 357, 301, 342, 301, 301, 312, 346, + /* 1340 */ 347, 348, 301, 309, 288, 284, 270, 310, 331, 301, + /* 1350 */ 357, 312, 296, 235, 312, 241, 364, 301, 301, 303, + /* 1360 */ 161, 301, 243, 301, 301, 364, 260, 242, 230, 226, + /* 1370 */ 296, 326, 20, 317, 247, 245, 260, 89, 250, 330, + /* 1380 */ 89, 292, 301, 363, 328, 361, 367, 270, 332, 333, + /* 1390 */ 334, 335, 336, 337, 288, 339, 36, 268, 278, 263, + /* 1400 */ 362, 374, 296, 262, 288, 320, 366, 301, 315, 303, + /* 1410 */ 364, 345, 296, 271, 358, 282, 282, 301, 260, 303, + /* 1420 */ 258, 0, 282, 317, 373, 0, 374, 371, 373, 379, + /* 1430 */ 177, 375, 0, 0, 328, 42, 0, 373, 332, 333, + /* 1440 */ 334, 335, 336, 337, 328, 339, 288, 374, 332, 333, + /* 1450 */ 334, 335, 336, 337, 296, 339, 187, 35, 342, 301, + /* 1460 */ 187, 303, 346, 347, 358, 35, 35, 0, 0, 35, + /* 1470 */ 35, 187, 260, 35, 0, 35, 187, 371, 0, 22, + /* 1480 */ 0, 375, 35, 172, 260, 170, 328, 0, 0, 165, /* 1490 */ 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, - /* 1500 */ 288, 0, 46, 0, 42, 0, 0, 0, 296, 149, - /* 1510 */ 0, 0, 288, 301, 0, 303, 0, 0, 144, 35, - /* 1520 */ 296, 0, 144, 0, 0, 301, 0, 303, 0, 0, + /* 1500 */ 288, 166, 0, 0, 46, 0, 42, 0, 296, 0, + /* 1510 */ 0, 149, 288, 301, 0, 303, 0, 0, 0, 0, + /* 1520 */ 296, 144, 0, 144, 35, 301, 0, 303, 0, 0, /* 1530 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* 1540 */ 328, 260, 42, 0, 332, 333, 334, 335, 336, 337, - /* 1550 */ 0, 339, 328, 40, 56, 0, 332, 333, 334, 335, + /* 1540 */ 328, 260, 0, 42, 332, 333, 334, 335, 336, 337, + /* 1550 */ 0, 339, 328, 42, 56, 0, 332, 333, 334, 335, /* 1560 */ 336, 337, 0, 339, 0, 260, 342, 22, 0, 288, - /* 1570 */ 0, 347, 0, 0, 293, 0, 0, 296, 56, 0, - /* 1580 */ 0, 39, 301, 260, 303, 14, 42, 46, 376, 377, - /* 1590 */ 43, 14, 46, 288, 0, 39, 0, 0, 293, 0, - /* 1600 */ 39, 296, 161, 0, 0, 0, 301, 0, 303, 328, - /* 1610 */ 62, 288, 0, 332, 333, 334, 335, 336, 337, 296, - /* 1620 */ 339, 35, 39, 0, 301, 47, 303, 35, 47, 39, - /* 1630 */ 0, 47, 39, 328, 0, 35, 35, 332, 333, 334, - /* 1640 */ 335, 336, 337, 0, 339, 260, 0, 39, 0, 47, - /* 1650 */ 0, 328, 98, 96, 22, 332, 333, 334, 335, 336, - /* 1660 */ 337, 35, 339, 260, 0, 43, 35, 43, 35, 22, - /* 1670 */ 35, 0, 0, 288, 22, 22, 49, 0, 22, 35, - /* 1680 */ 0, 296, 0, 0, 35, 22, 301, 20, 303, 35, - /* 1690 */ 0, 288, 35, 370, 0, 22, 0, 157, 173, 296, - /* 1700 */ 0, 0, 0, 154, 301, 0, 303, 89, 157, 157, - /* 1710 */ 90, 0, 0, 328, 89, 260, 153, 332, 333, 334, - /* 1720 */ 335, 336, 337, 39, 339, 159, 89, 89, 99, 155, - /* 1730 */ 43, 328, 46, 260, 89, 332, 333, 334, 335, 336, - /* 1740 */ 337, 182, 339, 288, 341, 90, 231, 89, 293, 90, - /* 1750 */ 90, 296, 43, 43, 89, 89, 301, 260, 303, 90, - /* 1760 */ 90, 288, 377, 89, 89, 46, 293, 46, 89, 296, - /* 1770 */ 43, 90, 46, 43, 301, 90, 303, 46, 90, 46, - /* 1780 */ 43, 90, 35, 328, 35, 288, 35, 332, 333, 334, - /* 1790 */ 335, 336, 337, 296, 339, 35, 231, 35, 301, 35, - /* 1800 */ 303, 328, 2, 22, 193, 332, 333, 334, 335, 336, - /* 1810 */ 337, 43, 339, 260, 225, 90, 231, 89, 89, 46, - /* 1820 */ 46, 22, 100, 195, 90, 328, 90, 260, 89, 332, - /* 1830 */ 333, 334, 335, 336, 337, 89, 339, 89, 35, 89, - /* 1840 */ 35, 288, 90, 89, 35, 90, 89, 35, 90, 296, - /* 1850 */ 89, 35, 35, 90, 301, 288, 303, 90, 89, 89, - /* 1860 */ 22, 89, 35, 296, 89, 89, 113, 101, 301, 260, - /* 1870 */ 303, 43, 113, 22, 35, 62, 61, 35, 113, 260, - /* 1880 */ 35, 328, 35, 35, 113, 332, 333, 334, 335, 336, - /* 1890 */ 337, 35, 339, 35, 68, 328, 43, 288, 87, 332, - /* 1900 */ 333, 334, 335, 336, 337, 296, 339, 288, 35, 35, - /* 1910 */ 301, 22, 303, 35, 22, 296, 35, 35, 68, 35, - /* 1920 */ 301, 260, 303, 35, 22, 0, 35, 0, 35, 35, - /* 1930 */ 35, 35, 47, 35, 47, 0, 39, 328, 39, 35, + /* 1570 */ 0, 347, 0, 0, 293, 0, 0, 296, 0, 0, + /* 1580 */ 56, 0, 301, 260, 303, 0, 39, 43, 376, 377, + /* 1590 */ 0, 14, 46, 288, 14, 46, 40, 39, 293, 0, + /* 1600 */ 0, 296, 0, 161, 39, 0, 301, 0, 303, 328, + /* 1610 */ 0, 288, 0, 332, 333, 334, 335, 336, 337, 296, + /* 1620 */ 339, 62, 0, 35, 301, 39, 303, 0, 35, 47, + /* 1630 */ 47, 39, 0, 328, 47, 39, 35, 332, 333, 334, + /* 1640 */ 335, 336, 337, 0, 339, 260, 35, 39, 0, 0, + /* 1650 */ 47, 328, 0, 0, 0, 332, 333, 334, 335, 336, + /* 1660 */ 337, 98, 339, 260, 35, 96, 22, 43, 35, 43, + /* 1670 */ 35, 35, 22, 288, 0, 0, 0, 22, 22, 49, + /* 1680 */ 22, 296, 35, 0, 0, 0, 301, 22, 303, 20, + /* 1690 */ 0, 288, 35, 370, 35, 35, 0, 157, 173, 296, + /* 1700 */ 22, 0, 0, 0, 301, 157, 303, 0, 154, 157, + /* 1710 */ 159, 0, 89, 328, 89, 260, 0, 332, 333, 334, + /* 1720 */ 335, 336, 337, 182, 339, 0, 155, 90, 89, 89, + /* 1730 */ 39, 328, 46, 260, 89, 332, 333, 334, 335, 336, + /* 1740 */ 337, 99, 339, 288, 341, 46, 231, 153, 293, 43, + /* 1750 */ 46, 296, 90, 89, 231, 89, 301, 260, 303, 46, + /* 1760 */ 90, 288, 377, 90, 43, 43, 293, 90, 89, 296, + /* 1770 */ 89, 89, 43, 43, 301, 35, 303, 90, 89, 46, + /* 1780 */ 46, 43, 90, 328, 90, 288, 225, 332, 333, 334, + /* 1790 */ 335, 336, 337, 296, 339, 90, 35, 231, 301, 90, + /* 1800 */ 303, 328, 35, 35, 35, 332, 333, 334, 335, 336, + /* 1810 */ 337, 35, 339, 260, 2, 22, 43, 89, 46, 22, + /* 1820 */ 89, 193, 35, 46, 89, 328, 90, 260, 89, 332, + /* 1830 */ 333, 334, 335, 336, 337, 90, 339, 90, 89, 89, + /* 1840 */ 35, 288, 100, 90, 89, 89, 195, 90, 35, 296, + /* 1850 */ 90, 35, 89, 35, 301, 288, 303, 35, 22, 113, + /* 1860 */ 90, 90, 35, 296, 89, 113, 101, 89, 301, 260, + /* 1870 */ 303, 113, 113, 43, 89, 89, 22, 89, 61, 260, + /* 1880 */ 35, 328, 62, 35, 35, 332, 333, 334, 335, 336, + /* 1890 */ 337, 35, 339, 35, 35, 328, 35, 288, 87, 332, + /* 1900 */ 333, 334, 335, 336, 337, 296, 339, 288, 68, 43, + /* 1910 */ 301, 35, 303, 35, 22, 296, 35, 22, 35, 35, + /* 1920 */ 301, 260, 303, 68, 35, 22, 35, 0, 35, 35, + /* 1930 */ 0, 35, 35, 35, 47, 35, 0, 328, 39, 35, /* 1940 */ 39, 332, 333, 334, 335, 336, 337, 328, 339, 288, - /* 1950 */ 47, 332, 333, 334, 335, 336, 337, 296, 339, 0, - /* 1960 */ 47, 35, 301, 39, 303, 0, 35, 35, 0, 22, - /* 1970 */ 21, 380, 22, 22, 260, 21, 20, 380, 380, 380, + /* 1950 */ 39, 332, 333, 334, 335, 336, 337, 296, 339, 47, + /* 1960 */ 47, 0, 301, 35, 303, 47, 0, 35, 39, 35, + /* 1970 */ 0, 22, 21, 21, 260, 22, 22, 20, 380, 380, /* 1980 */ 380, 380, 380, 380, 380, 380, 380, 380, 380, 328, /* 1990 */ 380, 380, 260, 332, 333, 334, 335, 336, 337, 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_MIN (0) -#define YY_SHIFT_MAX (1968) +#define YY_SHIFT_MAX (1970) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 917, 0, 0, 62, 62, 264, 264, 264, 326, 326, /* 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, /* 50 */ 987, 987, 165, 341, 254, 258, 254, 79, 79, 36, /* 60 */ 36, 97, 18, 254, 254, 79, 79, 79, 79, 79, - /* 70 */ 79, 79, 79, 79, 82, 79, 79, 79, 170, 205, - /* 80 */ 79, 79, 205, 405, 79, 205, 205, 205, 79, 158, - /* 90 */ 719, 662, 683, 683, 108, 371, 371, 371, 371, 371, + /* 70 */ 79, 79, 79, 79, 82, 79, 79, 79, 170, 79, + /* 80 */ 205, 79, 79, 205, 405, 79, 205, 205, 205, 79, + /* 90 */ 158, 719, 662, 683, 683, 108, 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, - /* 120 */ 551, 562, 90, 90, 90, 551, 526, 526, 170, 16, - /* 130 */ 16, 205, 205, 323, 323, 483, 498, 198, 198, 198, - /* 140 */ 198, 198, 198, 198, 331, 21, 167, 559, 43, 50, - /* 150 */ 112, 168, 99, 421, 19, 530, 771, 755, 717, 603, - /* 160 */ 717, 918, 501, 501, 501, 869, 822, 946, 1132, 1018, - /* 170 */ 1146, 1171, 1171, 1146, 1052, 1052, 1171, 1171, 1171, 1211, - /* 180 */ 1211, 1215, 82, 170, 82, 1217, 1223, 82, 1217, 82, - /* 190 */ 1228, 82, 82, 1171, 82, 1211, 205, 205, 205, 205, - /* 200 */ 205, 205, 205, 205, 205, 205, 205, 1171, 1211, 323, - /* 210 */ 1215, 158, 1093, 170, 158, 1171, 1171, 1217, 158, 1066, - /* 220 */ 323, 323, 323, 323, 1066, 323, 1151, 526, 1228, 158, - /* 230 */ 483, 158, 526, 1294, 323, 1111, 1066, 323, 323, 1111, - /* 240 */ 1066, 323, 323, 205, 1113, 1199, 1111, 1119, 1121, 1134, - /* 250 */ 946, 1139, 526, 1349, 1124, 1129, 1125, 1124, 1129, 1124, - /* 260 */ 1129, 1288, 1289, 323, 498, 1171, 158, 1347, 1211, 2395, + /* 110 */ 371, 371, 371, 371, 371, 134, 419, 18, 636, 636, + /* 120 */ 488, 551, 562, 90, 90, 90, 551, 526, 526, 170, + /* 130 */ 16, 16, 205, 205, 323, 323, 483, 498, 198, 198, + /* 140 */ 198, 198, 198, 198, 198, 331, 21, 167, 559, 43, + /* 150 */ 50, 112, 168, 99, 421, 19, 530, 771, 755, 717, + /* 160 */ 603, 717, 918, 501, 501, 501, 869, 822, 950, 1139, + /* 170 */ 1023, 1148, 1182, 1182, 1148, 1054, 1054, 1182, 1182, 1182, + /* 180 */ 1215, 1215, 1218, 82, 170, 82, 1225, 1226, 82, 1225, + /* 190 */ 82, 1234, 82, 82, 1182, 82, 1215, 205, 205, 205, + /* 200 */ 205, 205, 205, 205, 205, 205, 205, 205, 1182, 1215, + /* 210 */ 323, 1218, 158, 1112, 170, 158, 1182, 1182, 1225, 158, + /* 220 */ 1071, 323, 323, 323, 323, 1071, 323, 1152, 1234, 158, + /* 230 */ 483, 158, 526, 1287, 323, 1118, 1071, 323, 323, 1118, + /* 240 */ 1071, 323, 323, 205, 1114, 1199, 1118, 1119, 1125, 1138, + /* 250 */ 950, 1143, 526, 1352, 1127, 1130, 1128, 1127, 1130, 1127, + /* 260 */ 1130, 1288, 1291, 323, 498, 1182, 158, 1360, 1215, 2395, /* 270 */ 2395, 2395, 2395, 2395, 2395, 2395, 83, 456, 214, 307, /* 280 */ 208, 564, 693, 808, 824, 1044, 1053, 513, 542, 542, /* 290 */ 542, 542, 542, 542, 542, 542, 545, 129, 13, 13, /* 300 */ 236, 594, 430, 581, 387, 172, 452, 511, 106, 106, /* 310 */ 106, 106, 914, 963, 875, 898, 943, 945, 973, 979, - /* 320 */ 1011, 423, 860, 960, 964, 997, 1002, 1021, 1045, 1059, - /* 330 */ 1022, 947, 962, 937, 1006, 904, 1058, 929, 1070, 1043, - /* 340 */ 1097, 1109, 1115, 1120, 1122, 1131, 1005, 1077, 1126, 1098, - /* 350 */ 764, 1416, 1426, 1252, 1430, 1432, 1391, 1436, 1402, 1260, - /* 360 */ 1421, 1422, 1425, 1278, 1466, 1433, 1434, 1280, 1470, 1284, - /* 370 */ 1478, 1438, 1474, 1453, 1476, 1444, 1308, 1312, 1483, 1485, - /* 380 */ 1321, 1324, 1488, 1501, 1456, 1503, 1462, 1505, 1506, 1507, - /* 390 */ 1360, 1510, 1511, 1514, 1516, 1517, 1374, 1484, 1521, 1378, - /* 400 */ 1523, 1524, 1526, 1528, 1529, 1530, 1531, 1532, 1533, 1534, - /* 410 */ 1535, 1536, 1537, 1538, 1500, 1539, 1543, 1550, 1562, 1564, - /* 420 */ 1570, 1545, 1568, 1572, 1573, 1575, 1576, 1498, 1555, 1522, - /* 430 */ 1579, 1580, 1544, 1542, 1547, 1571, 1541, 1577, 1546, 1594, - /* 440 */ 1513, 1556, 1596, 1597, 1599, 1561, 1441, 1603, 1604, 1605, - /* 450 */ 1548, 1607, 1612, 1586, 1578, 1583, 1623, 1592, 1581, 1590, - /* 460 */ 1630, 1600, 1584, 1593, 1634, 1601, 1602, 1608, 1643, 1646, - /* 470 */ 1648, 1650, 1554, 1557, 1626, 1632, 1664, 1631, 1622, 1624, - /* 480 */ 1633, 1635, 1647, 1671, 1652, 1672, 1653, 1627, 1677, 1656, - /* 490 */ 1644, 1680, 1649, 1682, 1654, 1683, 1663, 1667, 1690, 1540, - /* 500 */ 1657, 1694, 1525, 1673, 1551, 1549, 1696, 1700, 1552, 1566, - /* 510 */ 1701, 1702, 1705, 1618, 1620, 1559, 1711, 1625, 1574, 1637, - /* 520 */ 1712, 1684, 1563, 1638, 1629, 1686, 1687, 1515, 1645, 1655, - /* 530 */ 1658, 1659, 1660, 1665, 1709, 1669, 1666, 1674, 1675, 1670, - /* 540 */ 1710, 1719, 1721, 1679, 1727, 1565, 1681, 1685, 1726, 1589, - /* 550 */ 1730, 1731, 1733, 1688, 1737, 1585, 1691, 1747, 1749, 1751, - /* 560 */ 1760, 1762, 1764, 1691, 1800, 1781, 1611, 1768, 1728, 1725, - /* 570 */ 1729, 1734, 1739, 1736, 1773, 1746, 1748, 1774, 1799, 1628, - /* 580 */ 1750, 1722, 1752, 1803, 1805, 1754, 1755, 1809, 1757, 1758, - /* 590 */ 1812, 1761, 1763, 1816, 1769, 1767, 1817, 1770, 1753, 1759, - /* 600 */ 1765, 1771, 1838, 1766, 1772, 1775, 1827, 1776, 1828, 1828, - /* 610 */ 1851, 1813, 1815, 1839, 1842, 1845, 1847, 1848, 1856, 1858, - /* 620 */ 1826, 1811, 1853, 1873, 1874, 1889, 1878, 1892, 1881, 1882, - /* 630 */ 1850, 1622, 1884, 1624, 1888, 1891, 1893, 1894, 1902, 1895, - /* 640 */ 1925, 1896, 1885, 1897, 1927, 1898, 1887, 1899, 1935, 1904, - /* 650 */ 1903, 1901, 1959, 1926, 1913, 1924, 1965, 1931, 1932, 1968, - /* 660 */ 1947, 1949, 1950, 1951, 1954, 1956, + /* 320 */ 1011, 423, 860, 960, 964, 997, 1002, 1021, 1059, 1070, + /* 330 */ 1022, 947, 962, 937, 1006, 904, 1058, 929, 1097, 1043, + /* 340 */ 1109, 1115, 1122, 1131, 1132, 1135, 1005, 1077, 1126, 1098, + /* 350 */ 764, 1421, 1425, 1253, 1432, 1433, 1393, 1436, 1422, 1269, + /* 360 */ 1430, 1431, 1434, 1273, 1467, 1435, 1438, 1284, 1468, 1289, + /* 370 */ 1474, 1440, 1478, 1457, 1480, 1447, 1311, 1315, 1487, 1488, + /* 380 */ 1335, 1324, 1502, 1503, 1458, 1505, 1464, 1507, 1509, 1510, + /* 390 */ 1362, 1514, 1516, 1517, 1518, 1519, 1377, 1489, 1522, 1379, + /* 400 */ 1526, 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, 1536, + /* 410 */ 1537, 1538, 1539, 1542, 1501, 1550, 1562, 1564, 1570, 1572, + /* 420 */ 1573, 1545, 1568, 1575, 1576, 1578, 1579, 1498, 1555, 1524, + /* 430 */ 1581, 1585, 1511, 1547, 1544, 1577, 1546, 1580, 1549, 1590, + /* 440 */ 1556, 1558, 1599, 1600, 1602, 1565, 1442, 1605, 1607, 1610, + /* 450 */ 1559, 1612, 1622, 1588, 1582, 1586, 1627, 1593, 1583, 1592, + /* 460 */ 1632, 1601, 1587, 1596, 1643, 1611, 1603, 1608, 1648, 1649, + /* 470 */ 1652, 1653, 1563, 1569, 1629, 1644, 1654, 1633, 1624, 1626, + /* 480 */ 1635, 1636, 1650, 1674, 1655, 1675, 1656, 1630, 1676, 1658, + /* 490 */ 1647, 1683, 1657, 1684, 1659, 1685, 1665, 1669, 1690, 1540, + /* 500 */ 1660, 1696, 1525, 1678, 1548, 1554, 1701, 1702, 1552, 1551, + /* 510 */ 1703, 1707, 1711, 1623, 1637, 1541, 1716, 1625, 1571, 1639, + /* 520 */ 1725, 1691, 1594, 1640, 1642, 1686, 1706, 1515, 1645, 1662, + /* 530 */ 1664, 1670, 1673, 1666, 1721, 1677, 1679, 1681, 1682, 1687, + /* 540 */ 1722, 1699, 1704, 1689, 1729, 1523, 1692, 1694, 1713, 1561, + /* 550 */ 1730, 1733, 1734, 1705, 1738, 1566, 1709, 1740, 1761, 1767, + /* 560 */ 1768, 1769, 1776, 1709, 1812, 1793, 1628, 1773, 1728, 1736, + /* 570 */ 1731, 1745, 1735, 1747, 1772, 1739, 1749, 1777, 1797, 1651, + /* 580 */ 1750, 1742, 1753, 1787, 1805, 1755, 1757, 1813, 1756, 1760, + /* 590 */ 1816, 1763, 1770, 1818, 1775, 1771, 1822, 1778, 1746, 1752, + /* 600 */ 1758, 1759, 1836, 1765, 1785, 1786, 1827, 1788, 1830, 1830, + /* 610 */ 1854, 1820, 1817, 1845, 1848, 1849, 1856, 1858, 1859, 1861, + /* 620 */ 1840, 1811, 1866, 1876, 1878, 1892, 1881, 1895, 1883, 1884, + /* 630 */ 1855, 1624, 1889, 1626, 1891, 1893, 1894, 1896, 1903, 1897, + /* 640 */ 1927, 1898, 1887, 1899, 1930, 1900, 1912, 1901, 1936, 1904, + /* 650 */ 1913, 1911, 1961, 1928, 1918, 1929, 1966, 1932, 1934, 1970, + /* 660 */ 1949, 1951, 1953, 1954, 1952, 1957, }; #define YY_REDUCE_COUNT (275) #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, /* 50 */ -284, 747, -30, 250, 342, 345, 398, 359, 462, -264, /* 60 */ -256, -357, -240, -339, -244, 81, 385, 475, 666, 668, - /* 70 */ 669, 673, 702, 734, 148, 767, 803, 852, -280, -273, - /* 80 */ 855, 857, 211, 31, 858, 272, 523, 363, 859, -205, - /* 90 */ -20, -159, -159, -159, -171, -86, 95, 139, 149, 388, - /* 100 */ 413, 420, 466, 476, 512, 514, 524, 548, 570, 574, - /* 110 */ 588, 608, 614, 648, -233, -213, -298, -76, 53, -215, - /* 120 */ 174, 279, 408, 431, 557, 217, 35, 275, 317, 409, - /* 130 */ 467, 91, 540, 590, 595, 675, 565, 328, 340, 368, - /* 140 */ 461, 468, 606, 661, 373, 705, 654, 800, 722, 826, - /* 150 */ 777, 780, 868, 868, 877, 880, 862, 833, 811, 811, - /* 160 */ 811, 819, 798, 799, 801, 813, 868, 850, 853, 870, - /* 170 */ 882, 932, 934, 895, 900, 901, 954, 957, 965, 970, - /* 180 */ 972, 915, 967, 938, 968, 926, 927, 974, 928, 975, - /* 190 */ 941, 980, 982, 995, 989, 1004, 985, 986, 988, 990, - /* 200 */ 994, 996, 998, 999, 1000, 1003, 1007, 1015, 1013, 966, - /* 210 */ 969, 1020, 971, 1014, 1027, 1017, 1030, 983, 1031, 991, - /* 220 */ 1001, 1019, 1033, 1035, 1025, 1037, 1009, 1010, 1034, 1061, - /* 230 */ 1023, 1072, 1049, 1016, 1047, 992, 1039, 1048, 1054, 1008, - /* 240 */ 1041, 1057, 1060, 868, 1012, 1032, 1036, 1024, 1046, 1038, - /* 250 */ 1042, 811, 1071, 1040, 1029, 1028, 1026, 1050, 1055, 1051, - /* 260 */ 1062, 1065, 1088, 1080, 1104, 1117, 1127, 1123, 1144, 1076, - /* 270 */ 1096, 1133, 1138, 1140, 1142, 1163, + /* 70 */ 669, 673, 702, 734, 148, 767, 803, 852, -280, 855, + /* 80 */ -273, 857, 858, 211, 31, 859, 272, 523, 363, 867, + /* 90 */ -205, -20, -159, -159, -159, -171, -86, 95, 139, 149, + /* 100 */ 388, 413, 420, 466, 476, 512, 514, 524, 548, 570, + /* 110 */ 574, 588, 608, 614, 648, -233, -213, -298, -76, 53, + /* 120 */ -215, 174, 279, 408, 431, 557, 217, 35, 275, 317, + /* 130 */ 409, 467, 91, 540, 590, 595, 675, 565, 328, 340, + /* 140 */ 368, 461, 468, 606, 661, 373, 705, 654, 800, 722, + /* 150 */ 819, 777, 730, 868, 868, 876, 880, 862, 833, 811, + /* 160 */ 811, 811, 821, 796, 799, 801, 813, 868, 850, 863, + /* 170 */ 870, 892, 935, 936, 899, 925, 926, 942, 965, 966, + /* 180 */ 975, 977, 919, 968, 938, 971, 928, 930, 978, 931, + /* 190 */ 980, 952, 991, 994, 999, 996, 1012, 985, 988, 990, + /* 200 */ 995, 998, 1000, 1003, 1004, 1007, 1009, 1010, 1014, 1013, + /* 210 */ 983, 967, 1015, 981, 1016, 1029, 1025, 1032, 986, 1031, + /* 220 */ 1008, 1030, 1033, 1035, 1036, 1026, 1041, 1037, 1034, 1047, + /* 230 */ 1061, 1076, 1018, 1017, 1048, 992, 1039, 1057, 1060, 1001, + /* 240 */ 1042, 1062, 1063, 868, 1019, 1040, 1046, 1020, 1038, 1024, + /* 250 */ 1045, 811, 1074, 1049, 1027, 1051, 1050, 1052, 1055, 1073, + /* 260 */ 1064, 1066, 1089, 1081, 1120, 1129, 1117, 1136, 1141, 1085, + /* 270 */ 1093, 1133, 1134, 1140, 1142, 1162, }; static const YYACTIONTYPE yy_default[] = { /* 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, /* 60 */ 1465, 1465, 1465, 1465, 1465, 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, - /* 90 */ 1695, 1465, 1873, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 80 */ 1465, 1465, 1465, 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, - /* 110 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1539, - /* 120 */ 1465, 1537, 1885, 1885, 1885, 1465, 1465, 1465, 1465, 1738, - /* 130 */ 1738, 1465, 1465, 1465, 1465, 1637, 1465, 1465, 1465, 1465, - /* 140 */ 1465, 1465, 1465, 1465, 1730, 1465, 1954, 1465, 1465, 1465, - /* 150 */ 1736, 1908, 1465, 1465, 1465, 1465, 1590, 1900, 1877, 1891, - /* 160 */ 1878, 1875, 1939, 1939, 1939, 1894, 1465, 1904, 1465, 1723, - /* 170 */ 1700, 1465, 1465, 1700, 1697, 1697, 1465, 1465, 1465, 1465, - /* 180 */ 1465, 1465, 1539, 1465, 1539, 1465, 1465, 1539, 1465, 1539, - /* 190 */ 1465, 1539, 1539, 1465, 1539, 1465, 1465, 1465, 1465, 1465, + /* 110 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 120 */ 1539, 1465, 1537, 1885, 1885, 1885, 1465, 1465, 1465, 1465, + /* 130 */ 1738, 1738, 1465, 1465, 1465, 1465, 1637, 1465, 1465, 1465, + /* 140 */ 1465, 1465, 1465, 1465, 1465, 1730, 1465, 1954, 1465, 1465, + /* 150 */ 1465, 1736, 1908, 1465, 1465, 1465, 1465, 1590, 1900, 1877, + /* 160 */ 1891, 1878, 1875, 1939, 1939, 1939, 1894, 1465, 1904, 1465, + /* 170 */ 1723, 1700, 1465, 1465, 1700, 1697, 1697, 1465, 1465, 1465, + /* 180 */ 1465, 1465, 1465, 1539, 1465, 1539, 1465, 1465, 1539, 1465, + /* 190 */ 1539, 1465, 1539, 1539, 1465, 1539, 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, - /* 220 */ 1465, 1465, 1465, 1465, 1913, 1465, 1465, 1465, 1465, 1537, + /* 210 */ 1465, 1465, 1537, 1732, 1465, 1537, 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, /* 240 */ 1913, 1465, 1465, 1465, 1927, 1923, 1915, 1931, 1929, 1906, /* 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", /* 232 */ "from_db_opt ::=", /* 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", /* 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", @@ -2949,7 +2949,7 @@ static const struct { { 307, -1 }, /* (231) table_name_cond ::= table_name */ { 308, 0 }, /* (232) from_db_opt ::= */ { 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 */ { 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 */ @@ -4064,8 +4064,8 @@ static YYACTIONTYPE yy_reduce( case 233: /* from_db_opt ::= FROM db_name */ { yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); } break; - case 234: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON 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); } + 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.yy712, NULL, yymsp[0].minor.yy712); } break; case 235: /* cmd ::= DROP INDEX exists_opt index_name */ { pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); } @@ -4805,6 +4805,8 @@ static void yy_syntax_error( } else { 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 ******************************************/ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */ diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c index cb62c0390b..c02ef64707 100644 --- a/source/libs/planner/src/planOptimizer.c +++ b/source/libs/planner/src/planOptimizer.c @@ -2427,5 +2427,8 @@ static int32_t applyOptimizeRule(SPlanContext* pCxt, SLogicSubplan* pLogicSubpla } 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); } diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c index 3d77010c76..74c78b970d 100644 --- a/source/libs/planner/src/planSpliter.c +++ b/source/libs/planner/src/planSpliter.c @@ -779,8 +779,10 @@ static SNode* stbSplCreateColumnNode(SExprNode* pExpr) { strcpy(pCol->dbName, ((SColumnNode*)pExpr)->dbName); strcpy(pCol->tableName, ((SColumnNode*)pExpr)->tableName); 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); pCol->node.resType = pExpr->resType; return (SNode*)pCol; diff --git a/source/libs/planner/src/planner.c b/source/libs/planner/src/planner.c index f3174ce70a..0554779746 100644 --- a/source/libs/planner/src/planner.c +++ b/source/libs/planner/src/planner.c @@ -42,9 +42,6 @@ int32_t qCreateQueryPlan(SPlanContext* pCxt, SQueryPlan** pPlan, SArray* pExecNo if (TSDB_CODE_SUCCESS == code) { code = createPhysiPlan(pCxt, pLogicPlan, pPlan, pExecNodeList); } - if (TSDB_CODE_SUCCESS == code) { - dumpQueryPlan(*pPlan); - } nodesDestroyNode((SNode*)pLogicSubplan); nodesDestroyNode((SNode*)pLogicPlan); diff --git a/source/libs/planner/test/planSubqueryTest.cpp b/source/libs/planner/test/planSubqueryTest.cpp index aed77c0811..522f1bf746 100644 --- a/source/libs/planner/test/planSubqueryTest.cpp +++ b/source/libs/planner/test/planSubqueryTest.cpp @@ -64,6 +64,12 @@ TEST_F(PlanSubqeuryTest, innerFill) { "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) { useDb("root", "test"); diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 8e4e31d6cc..a18fc73494 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -98,7 +98,7 @@ rangeCompFunc filterGetRangeCompFunc(char sflag, char eflag) { if (FILTER_GET_FLAG(eflag, RANGE_FLG_EXCLUDE)) { return filterRangeCompLe; } - + return filterRangeCompLi; } @@ -106,7 +106,7 @@ rangeCompFunc filterGetRangeCompFunc(char sflag, char eflag) { if (FILTER_GET_FLAG(sflag, RANGE_FLG_EXCLUDE)) { return filterRangeCompGe; } - + return filterRangeCompGi; } @@ -131,7 +131,7 @@ rangeCompFunc gRangeCompare[] = {filterRangeCompee, filterRangeCompei, filterRan int8_t filterGetRangeCompFuncFromOptrs(uint8_t optr, uint8_t optr2) { if (optr2) { - assert(optr2 == OP_TYPE_LOWER_THAN || optr2 == OP_TYPE_LOWER_EQUAL); + assert(optr2 == OP_TYPE_LOWER_THAN || optr2 == OP_TYPE_LOWER_EQUAL); if (optr == OP_TYPE_GREATER_THAN) { if (optr2 == OP_TYPE_LOWER_THAN) { @@ -165,9 +165,9 @@ int8_t filterGetRangeCompFuncFromOptrs(uint8_t optr, uint8_t optr2) { } __compar_fn_t gDataCompare[] = {compareInt32Val, compareInt8Val, compareInt16Val, compareInt64Val, compareFloatVal, - compareDoubleVal, compareLenPrefixedStr, compareStrPatternMatch, compareChkInString, compareWStrPatternMatch, + compareDoubleVal, compareLenPrefixedStr, compareStrPatternMatch, compareChkInString, compareWStrPatternMatch, compareLenPrefixedWStr, compareUint8Val, compareUint16Val, compareUint32Val, compareUint64Val, - setChkInBytes1, setChkInBytes2, setChkInBytes4, setChkInBytes8, compareStrRegexCompMatch, + setChkInBytes1, setChkInBytes2, setChkInBytes4, setChkInBytes8, compareStrRegexCompMatch, compareStrRegexCompNMatch, setChkNotInBytes1, setChkNotInBytes2, setChkNotInBytes4, setChkNotInBytes8, compareChkNotInString, compareStrPatternNotMatch, compareWStrPatternNotMatch }; @@ -178,20 +178,20 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { if (optr == OP_TYPE_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR)) { switch (type) { case TSDB_DATA_TYPE_BOOL: - case TSDB_DATA_TYPE_TINYINT: - case TSDB_DATA_TYPE_UTINYINT: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_UTINYINT: return 15; case TSDB_DATA_TYPE_SMALLINT: case TSDB_DATA_TYPE_USMALLINT: return 16; case TSDB_DATA_TYPE_INT: case TSDB_DATA_TYPE_UINT: - case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_FLOAT: return 17; - case TSDB_DATA_TYPE_BIGINT: - case TSDB_DATA_TYPE_UBIGINT: - case TSDB_DATA_TYPE_DOUBLE: - case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_UBIGINT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: return 18; case TSDB_DATA_TYPE_JSON: terrno = TSDB_CODE_QRY_JSON_IN_ERROR; @@ -204,20 +204,20 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { if (optr == OP_TYPE_NOT_IN && (type != TSDB_DATA_TYPE_BINARY && type != TSDB_DATA_TYPE_NCHAR)) { switch (type) { case TSDB_DATA_TYPE_BOOL: - case TSDB_DATA_TYPE_TINYINT: - case TSDB_DATA_TYPE_UTINYINT: + case TSDB_DATA_TYPE_TINYINT: + case TSDB_DATA_TYPE_UTINYINT: return 21; case TSDB_DATA_TYPE_SMALLINT: case TSDB_DATA_TYPE_USMALLINT: return 22; case TSDB_DATA_TYPE_INT: case TSDB_DATA_TYPE_UINT: - case TSDB_DATA_TYPE_FLOAT: + case TSDB_DATA_TYPE_FLOAT: return 23; - case TSDB_DATA_TYPE_BIGINT: - case TSDB_DATA_TYPE_UBIGINT: - case TSDB_DATA_TYPE_DOUBLE: - case TSDB_DATA_TYPE_TIMESTAMP: + case TSDB_DATA_TYPE_BIGINT: + case TSDB_DATA_TYPE_UBIGINT: + case TSDB_DATA_TYPE_DOUBLE: + case TSDB_DATA_TYPE_TIMESTAMP: return 24; case TSDB_DATA_TYPE_JSON: terrno = TSDB_CODE_QRY_JSON_IN_ERROR; @@ -257,10 +257,10 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { } else { /* normal relational comparFn */ comparFn = 6; } - + break; } - + case TSDB_DATA_TYPE_NCHAR: { if (optr == OP_TYPE_MATCH) { comparFn = 19; @@ -289,7 +289,7 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { comparFn = 0; break; } - + return comparFn; } @@ -308,7 +308,7 @@ static FORCE_INLINE int32_t filterCompareGroupCtx(const void *pLeft, const void int32_t filterInitUnitsFields(SFilterInfo *info) { info->unitSize = FILTER_DEFAULT_UNIT_SIZE; info->units = taosMemoryCalloc(info->unitSize, sizeof(SFilterUnit)); - + info->fields[FLD_TYPE_COLUMN].num = 0; info->fields[FLD_TYPE_COLUMN].size = FILTER_DEFAULT_FIELD_SIZE; info->fields[FLD_TYPE_COLUMN].fields = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].size, sizeof(SFilterField)); @@ -321,7 +321,7 @@ int32_t filterInitUnitsFields(SFilterInfo *info) { static FORCE_INLINE SFilterRangeNode* filterNewRange(SFilterRangeCtx *ctx, SFilterRange* ra) { SFilterRangeNode *r = NULL; - + if (ctx->rf) { r = ctx->rf; ctx->rf = ctx->rf->next; @@ -341,7 +341,7 @@ void* filterInitRangeCtx(int32_t type, int32_t options) { qError("not supported range type:%d", type); return NULL; } - + SFilterRangeCtx *ctx = taosMemoryCalloc(1, sizeof(SFilterRangeCtx)); ctx->type = type; @@ -366,7 +366,7 @@ int32_t filterResetRangeCtx(SFilterRangeCtx *ctx) { ctx->isrange = false; SFilterRangeNode *r = ctx->rf; - + while (r && r->next) { r = r->next; } @@ -402,7 +402,7 @@ int32_t filterConvertRange(SFilterRangeCtx *cur, SFilterRange *ra, bool *notNull } } - + if (FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL) && FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL)) { *notNull = true; } else { @@ -438,7 +438,7 @@ int32_t filterAddRangeImpl(void* h, SFilterRange* ra, int32_t optr) { SFilterRangeCtx *ctx = (SFilterRangeCtx *)h; if (ctx->rs == NULL) { - if ((FILTER_GET_FLAG(ctx->status, MR_ST_START) == 0) + if ((FILTER_GET_FLAG(ctx->status, MR_ST_START) == 0) || (FILTER_GET_FLAG(ctx->status, MR_ST_ALL) && (optr == LOGIC_COND_TYPE_AND)) || ((!FILTER_GET_FLAG(ctx->status, MR_ST_ALL)) && (optr == LOGIC_COND_TYPE_OR))) { APPEND_RANGE(ctx, ctx->rs, ra); @@ -489,23 +489,23 @@ int32_t filterAddRangeImpl(void* h, SFilterRange* ra, int32_t optr) { //TSDB_RELATION_OR - + bool smerged = false; bool emerged = false; while (r != NULL) { cr = ctx->pCompareFunc(&r->ra.s, &ra->e); - if (FILTER_GREATER(cr, r->ra.sflag, ra->eflag)) { + if (FILTER_GREATER(cr, r->ra.sflag, ra->eflag)) { if (emerged == false) { INSERT_RANGE(ctx, r, ra); } - + break; } if (smerged == false) { cr = ctx->pCompareFunc(&ra->s, &r->ra.e); - if (FILTER_GREATER(cr, ra->sflag, r->ra.eflag)) { + if (FILTER_GREATER(cr, ra->sflag, r->ra.eflag)) { if (r->next) { r= r->next; continue; @@ -516,23 +516,23 @@ int32_t filterAddRangeImpl(void* h, SFilterRange* ra, int32_t optr) { } cr = ctx->pCompareFunc(&r->ra.s, &ra->s); - if (FILTER_GREATER(cr, r->ra.sflag, ra->sflag)) { - SIMPLE_COPY_VALUES((char *)&r->ra.s, &ra->s); + if (FILTER_GREATER(cr, r->ra.sflag, ra->sflag)) { + SIMPLE_COPY_VALUES((char *)&r->ra.s, &ra->s); cr == 0 ? (r->ra.sflag &= ra->sflag) : (r->ra.sflag = ra->sflag); } smerged = true; } - + if (emerged == false) { cr = ctx->pCompareFunc(&ra->e, &r->ra.e); if (FILTER_GREATER(cr, ra->eflag, r->ra.eflag)) { SIMPLE_COPY_VALUES((char *)&r->ra.e, &ra->e); - if (cr == 0) { + if (cr == 0) { r->ra.eflag &= ra->eflag; break; } - + r->ra.eflag = ra->eflag; emerged = true; r = r->next; @@ -553,7 +553,7 @@ int32_t filterAddRangeImpl(void* h, SFilterRange* ra, int32_t optr) { SIMPLE_COPY_VALUES(&r->prev->ra.e, (char *)&r->ra.e); cr == 0 ? (r->prev->ra.eflag &= r->ra.eflag) : (r->prev->ra.eflag = r->ra.eflag); FREE_RANGE(ctx, r); - + break; } } @@ -571,12 +571,12 @@ int32_t filterAddRangeImpl(void* h, SFilterRange* ra, int32_t optr) { } } - return TSDB_CODE_SUCCESS; + return TSDB_CODE_SUCCESS; } int32_t filterAddRange(void* h, SFilterRange* ra, int32_t optr) { SFilterRangeCtx *ctx = (SFilterRangeCtx *)h; - + if (FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) { SIMPLE_COPY_VALUES(&ra->s, getDataMin(ctx->type)); //FILTER_CLR_FLAG(ra->sflag, RA_NULL); @@ -602,7 +602,7 @@ int32_t filterAddRangeCtx(void *dst, void *src, int32_t optr) { } SFilterRangeNode *r = sctx->rs; - + while (r) { filterAddRange(dctx, &r->ra, optr); r = r->next; @@ -616,14 +616,14 @@ int32_t filterCopyRangeCtx(void *dst, void *src) { SFilterRangeCtx *sctx = (SFilterRangeCtx *)src; dctx->status = sctx->status; - + dctx->isnull = sctx->isnull; dctx->notnull = sctx->notnull; dctx->isrange = sctx->isrange; SFilterRangeNode *r = sctx->rs; SFilterRangeNode *dr = dctx->rs; - + while (r) { APPEND_RANGE(dctx, dr, &r->ra); if (dr == NULL) { @@ -649,7 +649,7 @@ int32_t filterFinishRange(void* h) { if (FILTER_GET_FLAG(ctx->options, FLT_OPTION_TIMESTAMP)) { SFilterRangeNode *r = ctx->rs; SFilterRangeNode *rn = NULL; - + while (r && r->next) { int64_t tmp = 1; operateVal(&tmp, &r->ra.e, &tmp, OP_TYPE_ADD, ctx->type); @@ -658,10 +658,10 @@ int32_t filterFinishRange(void* h) { SIMPLE_COPY_VALUES((char *)&r->next->ra.s, (char *)&r->ra.s); FREE_RANGE(ctx, r); r = rn; - + continue; } - + r = r->next; } } @@ -673,13 +673,13 @@ int32_t filterFinishRange(void* h) { int32_t filterGetRangeNum(void* h, int32_t* num) { filterFinishRange(h); - + SFilterRangeCtx *ctx = (SFilterRangeCtx *)h; *num = 0; SFilterRangeNode *r = ctx->rs; - + while (r) { ++(*num); r = r->next; @@ -695,7 +695,7 @@ int32_t filterGetRangeRes(void* h, SFilterRange *ra) { SFilterRangeCtx *ctx = (SFilterRangeCtx *)h; uint32_t num = 0; SFilterRangeNode* r = ctx->rs; - + while (r) { if (num) { ra->e = r->ra.e; @@ -712,7 +712,7 @@ int32_t filterGetRangeRes(void* h, SFilterRange *ra) { qError("no range result"); return TSDB_CODE_QRY_APP_ERROR; } - + return TSDB_CODE_SUCCESS; } @@ -740,7 +740,7 @@ int32_t filterSourceRangeFromCtx(SFilterRangeCtx *ctx, void *sctx, int32_t optr, if (!(optr == LOGIC_COND_TYPE_OR && ctx->notnull)) { filterAddRangeCtx(ctx, src, optr); } - + if (FILTER_GET_FLAG(ctx->status, MR_ST_ALL)) { *all = true; } @@ -755,11 +755,11 @@ int32_t filterFreeRangeCtx(void* h) { if (h == NULL) { return TSDB_CODE_SUCCESS; } - + SFilterRangeCtx *ctx = (SFilterRangeCtx *)h; SFilterRangeNode *r = ctx->rs; SFilterRangeNode *rn = NULL; - + while (r) { rn = r->next; taosMemoryFree(r); @@ -785,10 +785,10 @@ int32_t filterDetachCnfGroup(SFilterGroup *gp1, SFilterGroup *gp2, SArray* group gp.unitNum = gp1->unitNum + gp2->unitNum; gp.unitIdxs = taosMemoryCalloc(gp.unitNum, sizeof(*gp.unitIdxs)); memcpy(gp.unitIdxs, gp1->unitIdxs, gp1->unitNum * sizeof(*gp.unitIdxs)); - memcpy(gp.unitIdxs + gp1->unitNum, gp2->unitIdxs, gp2->unitNum * sizeof(*gp.unitIdxs)); + memcpy(gp.unitIdxs + gp1->unitNum, gp2->unitIdxs, gp2->unitNum * sizeof(*gp.unitIdxs)); gp.unitFlags = NULL; - + taosArrayPush(group, &gp); return TSDB_CODE_SUCCESS; @@ -802,7 +802,7 @@ int32_t filterDetachCnfGroups(SArray* group, SArray* left, SArray* right) { if (taosArrayGetSize(left) <= 0) { if (taosArrayGetSize(right) <= 0) { fltError("both groups are empty"); - FLT_ERR_RET(TSDB_CODE_QRY_APP_ERROR); + FLT_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } SFilterGroup *gp = NULL; @@ -813,7 +813,7 @@ int32_t filterDetachCnfGroups(SArray* group, SArray* left, SArray* right) { return TSDB_CODE_SUCCESS; } - if (taosArrayGetSize(right) <= 0) { + if (taosArrayGetSize(right) <= 0) { SFilterGroup *gp = NULL; while ((gp = (SFilterGroup *)taosArrayPop(left)) != NULL) { taosArrayPush(group, gp); @@ -821,10 +821,10 @@ int32_t filterDetachCnfGroups(SArray* group, SArray* left, SArray* right) { return TSDB_CODE_SUCCESS; } - + for (int32_t l = 0; l < leftSize; ++l) { SFilterGroup *gp1 = taosArrayGet(left, l); - + for (int32_t r = 0; r < rightSize; ++r) { SFilterGroup *gp2 = taosArrayGet(right, r); @@ -878,15 +878,15 @@ int32_t filterAddField(SFilterInfo *info, void *desc, void **data, int32_t type, idx = filterGetFiledByData(info, type, *data, dataLen); } } - + if (idx < 0) { idx = *num; if (idx >= info->fields[type].size) { info->fields[type].size += FILTER_DEFAULT_FIELD_SIZE; info->fields[type].fields = taosMemoryRealloc(info->fields[type].fields, info->fields[type].size * sizeof(SFilterField)); } - - info->fields[type].fields[idx].flag = type; + + info->fields[type].fields[idx].flag = type; info->fields[type].fields[idx].desc = desc; info->fields[type].fields[idx].data = data ? *data : NULL; @@ -900,7 +900,7 @@ int32_t filterAddField(SFilterInfo *info, void *desc, void **data, int32_t type, if (info->pctx.valHash == NULL) { info->pctx.valHash = taosHashInit(FILTER_DEFAULT_GROUP_SIZE * FILTER_DEFAULT_VALUE_SIZE, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, false); } - + taosHashPut(info->pctx.valHash, *data, dataLen, &idx, sizeof(idx)); } } else { @@ -911,7 +911,7 @@ int32_t filterAddField(SFilterInfo *info, void *desc, void **data, int32_t type, fid->type = type; fid->idx = idx; - + return TSDB_CODE_SUCCESS; } @@ -929,11 +929,11 @@ int32_t filterAddFieldFromNode(SFilterInfo *info, SNode *node, SFilterFieldId *f fltError("empty node"); FLT_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } - + if (nodeType(node) != QUERY_NODE_COLUMN && nodeType(node) != QUERY_NODE_VALUE && nodeType(node) != QUERY_NODE_NODE_LIST) { FLT_ERR_RET(TSDB_CODE_QRY_APP_ERROR); } - + int32_t type; void *v; @@ -946,7 +946,7 @@ int32_t filterAddFieldFromNode(SFilterInfo *info, SNode *node, SFilterFieldId *f } filterAddField(info, v, NULL, type, fid, 0, true); - + return TSDB_CODE_SUCCESS; } @@ -973,7 +973,7 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi } SFilterUnit *u = &info->units[info->unitNum]; - + u->compare.optr = optr; u->left = *left; if (right) { @@ -981,7 +981,7 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi } if (u->right.type == FLD_TYPE_VALUE) { - SFilterField *val = FILTER_UNIT_RIGHT_FIELD(info, u); + SFilterField *val = FILTER_UNIT_RIGHT_FIELD(info, u); assert(FILTER_GET_FLAG(val->flag, FLD_TYPE_VALUE)); } else { int32_t paramNum = scalarGetOperatorParamNum(optr); @@ -990,10 +990,10 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi return TSDB_CODE_QRY_APP_ERROR; } } - + SFilterField *col = FILTER_UNIT_LEFT_FIELD(info, u); assert(FILTER_GET_FLAG(col->flag, FLD_TYPE_COLUMN)); - + info->units[info->unitNum].compare.type = FILTER_GET_COL_FIELD_TYPE(col); info->units[info->unitNum].compare.precision = FILTER_GET_COL_FIELD_PRECISION(col); @@ -1001,12 +1001,12 @@ int32_t filterAddUnit(SFilterInfo *info, uint8_t optr, SFilterFieldId *left, SFi if (FILTER_GET_FLAG(info->options, FLT_OPTION_NEED_UNIQE)) { int64_t v = 0; - FILTER_PACKAGE_UNIT_HASH_KEY(&v, optr, left->idx, right ? right->idx : -1); + FILTER_PACKAGE_UNIT_HASH_KEY(&v, optr, left->idx, right ? right->idx : -1); taosHashPut(info->pctx.unitHash, &v, sizeof(v), uidx, sizeof(*uidx)); } - + ++info->unitNum; - + return TSDB_CODE_SUCCESS; } @@ -1017,7 +1017,7 @@ int32_t filterAddUnitToGroup(SFilterGroup *group, uint32_t unitIdx) { group->unitSize += FILTER_DEFAULT_UNIT_SIZE; group->unitIdxs = taosMemoryRealloc(group->unitIdxs, group->unitSize * sizeof(*group->unitIdxs)); } - + group->unitIdxs[group->unitNum++] = unitIdx; return TSDB_CODE_SUCCESS; @@ -1040,10 +1040,10 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode* tree, SArray *group) { SScalarParam out = {.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData))}; out.columnData->info.type = type; out.columnData->info.bytes = tDataTypes[type].bytes; - + for (int32_t i = 0; i < listNode->pNodeList->length; ++i) { SValueNode *valueNode = (SValueNode *)cell->pNode; - if (valueNode->node.resType.type != type) { + if (valueNode->node.resType.type != type) { int32_t overflow = 0; code = doConvertDataType(valueNode, &out, &overflow); if (code) { @@ -1055,7 +1055,7 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode* tree, SArray *group) { cell = cell->pNext; continue; } - + len = tDataTypes[type].bytes; filterAddField(info, NULL, (void**) &out.columnData->pData, FLD_TYPE_VALUE, &right, len, true); @@ -1066,13 +1066,13 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode* tree, SArray *group) { FLT_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); } memcpy(data, nodesGetValueFromNode(valueNode), tDataTypes[type].bytes); - filterAddField(info, NULL, (void**) &data, FLD_TYPE_VALUE, &right, len, true); + filterAddField(info, NULL, (void**) &data, FLD_TYPE_VALUE, &right, len, true); } filterAddUnit(info, OP_TYPE_EQUAL, &left, &right, &uidx); - + SFilterGroup fgroup = {0}; filterAddUnitToGroup(&fgroup, uidx); - + taosArrayPush(group, &fgroup); cell = cell->pNext; @@ -1081,14 +1081,14 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode* tree, SArray *group) { taosMemoryFree(out.columnData); } else { filterAddFieldFromNode(info, node->pRight, &right); - + FLT_ERR_RET(filterAddUnit(info, node->opType, &left, &right, &uidx)); SFilterGroup fgroup = {0}; filterAddUnitToGroup(&fgroup, uidx); - + taosArrayPush(group, &fgroup); } - + return TSDB_CODE_SUCCESS; } @@ -1100,7 +1100,7 @@ int32_t filterAddUnitFromUnit(SFilterInfo *dst, SFilterInfo *src, SFilterUnit* u filterAddField(dst, FILTER_UNIT_COL_DESC(src, u), NULL, FLD_TYPE_COLUMN, &left, 0, false); SFilterField *t = FILTER_UNIT_LEFT_FIELD(src, u); - + if (u->right.type == FLD_TYPE_VALUE) { void *data = FILTER_UNIT_VAL_DATA(src, u); if (IS_VAR_DATA_TYPE(type)) { @@ -1116,7 +1116,7 @@ int32_t filterAddUnitFromUnit(SFilterInfo *dst, SFilterInfo *src, SFilterUnit* u filterAddField(dst, NULL, &data, FLD_TYPE_VALUE, &right, tDataTypes[type].bytes, false); } - flag = FLD_DATA_NO_FREE; + flag = FLD_DATA_NO_FREE; t = FILTER_UNIT_RIGHT_FIELD(src, u); FILTER_SET_FLAG(t->flag, flag); } else { @@ -1152,7 +1152,7 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan return TSDB_CODE_SUCCESS; } - if (ctx->notnull) { + if (ctx->notnull) { assert(ctx->isnull == false && ctx->isrange == false); filterAddUnit(dst, OP_TYPE_IS_NOT_NULL, &left, NULL, &uidx); filterAddUnitToGroup(g, uidx); @@ -1167,7 +1167,7 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan assert(ctx->rs && ctx->rs->next == NULL); SFilterRange *ra = &ctx->rs->ra; - + assert(!((FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) && (FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL)))); if ((!FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) && (!FILTER_GET_FLAG(ra->eflag, RANGE_FLG_NULL))) { @@ -1178,7 +1178,7 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan filterAddField(dst, NULL, &data, FLD_TYPE_VALUE, &right, tDataTypes[type].bytes, true); filterAddUnit(dst, OP_TYPE_EQUAL, &left, &right, &uidx); filterAddUnitToGroup(g, uidx); - return TSDB_CODE_SUCCESS; + return TSDB_CODE_SUCCESS; } else { void *data = taosMemoryMalloc(sizeof(int64_t)); SIMPLE_COPY_VALUES(data, &ra->s); @@ -1186,14 +1186,14 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan void *data2 = taosMemoryMalloc(sizeof(int64_t)); SIMPLE_COPY_VALUES(data2, &ra->e); filterAddField(dst, NULL, &data2, FLD_TYPE_VALUE, &right2, tDataTypes[type].bytes, true); - + filterAddUnit(dst, FILTER_GET_FLAG(ra->sflag, RANGE_FLG_EXCLUDE) ? OP_TYPE_GREATER_THAN : OP_TYPE_GREATER_EQUAL, &left, &right, &uidx); filterAddUnitRight(dst, FILTER_GET_FLAG(ra->eflag, RANGE_FLG_EXCLUDE) ? OP_TYPE_LOWER_THAN : OP_TYPE_LOWER_EQUAL, &right2, uidx); filterAddUnitToGroup(g, uidx); - return TSDB_CODE_SUCCESS; + return TSDB_CODE_SUCCESS; } } - + if (!FILTER_GET_FLAG(ra->sflag, RANGE_FLG_NULL)) { void *data = taosMemoryMalloc(sizeof(int64_t)); SIMPLE_COPY_VALUES(data, &ra->s); @@ -1208,28 +1208,28 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan filterAddField(dst, NULL, &data, FLD_TYPE_VALUE, &right, tDataTypes[type].bytes, true); filterAddUnit(dst, FILTER_GET_FLAG(ra->eflag, RANGE_FLG_EXCLUDE) ? OP_TYPE_LOWER_THAN : OP_TYPE_LOWER_EQUAL, &left, &right, &uidx); filterAddUnitToGroup(g, uidx); - } + } - return TSDB_CODE_SUCCESS; - } + return TSDB_CODE_SUCCESS; + } // OR PROCESS - + SFilterGroup ng = {0}; g = &ng; assert(ctx->isnull || ctx->notnull || ctx->isrange); - + if (ctx->isnull) { filterAddUnit(dst, OP_TYPE_IS_NULL, &left, NULL, &uidx); - filterAddUnitToGroup(g, uidx); + filterAddUnitToGroup(g, uidx); taosArrayPush(res, g); } - + if (ctx->notnull) { assert(!ctx->isrange); memset(g, 0, sizeof(*g)); - + filterAddUnit(dst, OP_TYPE_IS_NOT_NULL, &left, NULL, &uidx); filterAddUnitToGroup(g, uidx); taosArrayPush(res, g); @@ -1242,7 +1242,7 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan } SFilterRangeNode *r = ctx->rs; - + while (r) { memset(g, 0, sizeof(*g)); @@ -1261,19 +1261,19 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan void *data2 = taosMemoryMalloc(sizeof(int64_t)); SIMPLE_COPY_VALUES(data2, &r->ra.e); filterAddField(dst, NULL, &data2, FLD_TYPE_VALUE, &right2, tDataTypes[type].bytes, true); - + filterAddUnit(dst, FILTER_GET_FLAG(r->ra.sflag, RANGE_FLG_EXCLUDE) ? OP_TYPE_GREATER_THAN : OP_TYPE_GREATER_EQUAL, &left, &right, &uidx); filterAddUnitRight(dst, FILTER_GET_FLAG(r->ra.eflag, RANGE_FLG_EXCLUDE) ? OP_TYPE_LOWER_THAN : OP_TYPE_LOWER_EQUAL, &right2, uidx); filterAddUnitToGroup(g, uidx); } taosArrayPush(res, g); - + r = r->next; - + continue; } - + if (!FILTER_GET_FLAG(r->ra.sflag, RANGE_FLG_NULL)) { void *data = taosMemoryMalloc(sizeof(int64_t)); SIMPLE_COPY_VALUES(data, &r->ra.s); @@ -1281,10 +1281,10 @@ int32_t filterAddGroupUnitFromCtx(SFilterInfo *dst, SFilterInfo *src, SFilterRan filterAddUnit(dst, FILTER_GET_FLAG(r->ra.sflag, RANGE_FLG_EXCLUDE) ? OP_TYPE_GREATER_THAN : OP_TYPE_GREATER_EQUAL, &left, &right, &uidx); filterAddUnitToGroup(g, uidx); } - + if (!FILTER_GET_FLAG(r->ra.eflag, RANGE_FLG_NULL)) { void *data = taosMemoryMalloc(sizeof(int64_t)); - SIMPLE_COPY_VALUES(data, &r->ra.e); + SIMPLE_COPY_VALUES(data, &r->ra.e); filterAddField(dst, NULL, &data, FLD_TYPE_VALUE, &right, tDataTypes[type].bytes, true); filterAddUnit(dst, FILTER_GET_FLAG(r->ra.eflag, RANGE_FLG_EXCLUDE) ? OP_TYPE_LOWER_THAN : OP_TYPE_LOWER_EQUAL, &left, &right, &uidx); filterAddUnitToGroup(g, uidx); @@ -1307,7 +1307,7 @@ static void filterFreeGroup(void *pItem) { if (pItem == NULL) { return; } - + SFilterGroup* p = (SFilterGroup*) pItem; taosMemoryFreeClear(p->unitIdxs); taosMemoryFreeClear(p->unitFlags); @@ -1329,17 +1329,17 @@ EDealRes fltTreeToGroup(SNode* pNode, void* pContext) { for (int32_t i = 0; i < node->pParameterList->length; ++i) { newGroup = taosArrayInit(4, sizeof(SFilterGroup)); resGroup = taosArrayInit(4, sizeof(SFilterGroup)); - + SFltBuildGroupCtx tctx = {.info = ctx->info, .group = newGroup}; nodesWalkExpr(cell->pNode, fltTreeToGroup, (void *)&tctx); FLT_ERR_JRET(tctx.code); - + FLT_ERR_JRET(filterDetachCnfGroups(resGroup, preGroup, newGroup)); - + taosArrayDestroyEx(newGroup, filterFreeGroup); newGroup = NULL; taosArrayDestroyEx(preGroup, filterFreeGroup); - + preGroup = resGroup; resGroup = NULL; @@ -1349,7 +1349,7 @@ EDealRes fltTreeToGroup(SNode* pNode, void* pContext) { taosArrayAddAll(ctx->group, preGroup); taosArrayDestroy(preGroup); - + return DEAL_RES_IGNORE_CHILD; } @@ -1358,23 +1358,23 @@ EDealRes fltTreeToGroup(SNode* pNode, void* pContext) { for (int32_t i = 0; i < node->pParameterList->length; ++i) { nodesWalkExpr(cell->pNode, fltTreeToGroup, (void *)pContext); FLT_ERR_JRET(ctx->code); - + cell = cell->pNext; } - + return DEAL_RES_IGNORE_CHILD; } ctx->code = TSDB_CODE_QRY_APP_ERROR; - + fltError("invalid condition type, type:%d", node->condType); return DEAL_RES_ERROR; } if (QUERY_NODE_OPERATOR == nType) { - FLT_ERR_JRET(fltAddGroupUnitFromNode(ctx->info, pNode, ctx->group)); - + FLT_ERR_JRET(fltAddGroupUnitFromNode(ctx->info, pNode, ctx->group)); + return DEAL_RES_IGNORE_CHILD; } @@ -1497,7 +1497,7 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) SValueNode *var = (SValueNode *)field->desc; SDataType *dType = &var->node.resType; if (dType->type == TSDB_DATA_TYPE_VALUE_ARRAY) { - qDebug("VAL%d => [type:TS][val:[%" PRIi64"] - [%" PRId64 "]]", i, *(int64_t *)field->data, *(((int64_t *)field->data) + 1)); + qDebug("VAL%d => [type:TS][val:[%" PRIi64"] - [%" PRId64 "]]", i, *(int64_t *)field->data, *(((int64_t *)field->data) + 1)); } else { qDebug("VAL%d => [type:%d][val:%" PRIx64"]", i, dType->type, var->datum.i); //TODO } @@ -1513,7 +1513,7 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) int32_t len = 0; int32_t tlen = 0; char str[512] = {0}; - + SFilterField *left = FILTER_UNIT_LEFT_FIELD(info, unit); SColumnNode *refNode = (SColumnNode *)left->desc; if (unit->compare.optr >= 0 && unit->compare.optr <= OP_TYPE_JSON_CONTAINS){ @@ -1538,7 +1538,7 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) if (unit->compare.optr2 >= 0 && unit->compare.optr2 <= OP_TYPE_JSON_CONTAINS){ sprintf(str + strlen(str), "[%d][%d] %s [", refNode->dataBlockId, refNode->slotId, gOptrStr[unit->compare.optr2].str); } - + if (unit->right2.type == FLD_TYPE_VALUE && FILTER_UNIT_OPTR(unit) != OP_TYPE_IN) { SFilterField *right = FILTER_UNIT_RIGHT2_FIELD(info, unit); char *data = right->data; @@ -1552,7 +1552,7 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) } strcat(str, "]"); } - + qDebug("%s", str); //TODO } @@ -1576,10 +1576,10 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) for (uint32_t i = 0; i < info->colRangeNum; ++i) { SFilterRangeCtx *ctx = info->colRange[i]; qDebug("Column ID[%d] RANGE: isnull[%d],notnull[%d],range[%d]", ctx->colId, ctx->isnull, ctx->notnull, ctx->isrange); - if (ctx->isrange) { + if (ctx->isrange) { SFilterRangeNode *r = ctx->rs; while (r) { - char str[256] = {0}; + char str[256] = {0}; int32_t tlen = 0; if (FILTER_GET_FLAG(r->ra.sflag, RANGE_FLG_NULL)) { strcat(str,"(NULL)"); @@ -1596,8 +1596,8 @@ void filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t options) fltConverToStr(str + strlen(str), ctx->type, &r->ra.e, tlen > 32 ? 32 : tlen, &tlen); FILTER_GET_FLAG(r->ra.eflag, RANGE_FLG_EXCLUDE) ? strcat(str,")") : strcat(str,"]"); } - qDebug("range: %s", str); - + qDebug("range: %s", str); + r = r->next; } } @@ -1640,7 +1640,7 @@ void filterFreeColInfo(void *data) { if (info->type == RANGE_TYPE_VAR_HASH) { //TODO } else if (info->type == RANGE_TYPE_MR_CTX) { - filterFreeRangeCtx(info->info); + filterFreeRangeCtx(info->info); } else if (info->type == RANGE_TYPE_UNIT) { taosArrayDestroy((SArray *)info->info); } @@ -1714,14 +1714,14 @@ void filterFreeInfo(SFilterInfo *info) { for (uint32_t f = 0; f < info->fields[i].num; ++f) { filterFreeField(&info->fields[i].fields[f], i); } - + taosMemoryFreeClear(info->fields[i].fields); } for (uint32_t i = 0; i < info->groupNum; ++i) { - filterFreeGroup(&info->groups[i]); + filterFreeGroup(&info->groups[i]); } - + taosMemoryFreeClear(info->groups); taosMemoryFreeClear(info->units); @@ -1745,7 +1745,7 @@ void filterFreeInfo(SFilterInfo *info) { int32_t filterHandleValueExtInfo(SFilterUnit* unit, char extInfo) { assert(extInfo > 0 || extInfo < 0); - + uint8_t optr = FILTER_UNIT_OPTR(unit); switch (optr) { case OP_TYPE_GREATER_THAN: @@ -1774,7 +1774,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) { assert(unit->compare.optr == FILTER_DUMMY_EMPTY_OPTR || scalarGetOperatorParamNum(unit->compare.optr) == 1); continue; } - + SFilterField* right = FILTER_UNIT_RIGHT_FIELD(info, unit); assert(FILTER_GET_FLAG(right->flag, FLD_TYPE_VALUE)); @@ -1782,7 +1782,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) { uint32_t type = FILTER_UNIT_DATA_TYPE(unit); int8_t precision = FILTER_UNIT_DATA_PRECISION(unit); SFilterField* fi = right; - + SValueNode* var = (SValueNode *)fi->desc; if (var == NULL) { assert(fi->data != NULL); @@ -1797,7 +1797,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) { } FILTER_SET_FLAG(fi->flag, FLD_DATA_IS_HASH); - + continue; } @@ -1950,11 +1950,11 @@ int32_t filterAddUnitRange(SFilterInfo *info, SFilterUnit* u, SFilterRangeCtx *c assert(type == TSDB_DATA_TYPE_BOOL); if (GET_INT8_VAL(val)) { SIMPLE_COPY_VALUES(&ra.s, &tmp); - SIMPLE_COPY_VALUES(&ra.e, &tmp); + SIMPLE_COPY_VALUES(&ra.e, &tmp); } else { *(bool *)&tmp = true; SIMPLE_COPY_VALUES(&ra.s, &tmp); - SIMPLE_COPY_VALUES(&ra.e, &tmp); + SIMPLE_COPY_VALUES(&ra.e, &tmp); } break; case OP_TYPE_EQUAL: @@ -1964,7 +1964,7 @@ int32_t filterAddUnitRange(SFilterInfo *info, SFilterUnit* u, SFilterRangeCtx *c default: assert(0); } - + filterAddRange(ctx, &ra, optr); return TSDB_CODE_SUCCESS; @@ -1978,13 +1978,13 @@ int32_t filterCompareRangeCtx(SFilterRangeCtx *ctx1, SFilterRangeCtx *ctx2, bool SFilterRangeNode *r1 = ctx1->rs; SFilterRangeNode *r2 = ctx2->rs; - + while (r1 && r2) { FLT_CHK_JMP(r1->ra.sflag != r2->ra.sflag); FLT_CHK_JMP(r1->ra.eflag != r2->ra.eflag); FLT_CHK_JMP(r1->ra.s != r2->ra.s); FLT_CHK_JMP(r1->ra.e != r2->ra.e); - + r1 = r1->next; r2 = r2->next; } @@ -2006,7 +2006,7 @@ int32_t filterMergeUnits(SFilterInfo *info, SFilterGroupCtx* gRes, uint32_t colI int32_t size = (int32_t)taosArrayGetSize(colArray); int32_t type = gRes->colInfo[colIdx].dataType; SFilterRangeCtx* ctx = filterInitRangeCtx(type, 0); - + for (uint32_t i = 0; i < size; ++i) { SFilterUnit* u = taosArrayGetP(colArray, i); uint8_t optr = FILTER_UNIT_OPTR(u); @@ -2045,7 +2045,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t uint32_t *colIdx = taosMemoryMalloc(info->fields[FLD_TYPE_COLUMN].num * sizeof(uint32_t)); uint32_t colIdxi = 0; uint32_t gResIdx = 0; - + for (uint32_t i = 0; i < info->groupNum; ++i) { SFilterGroup* g = info->groups + i; @@ -2053,7 +2053,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t gRes[gResIdx]->colInfo = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(SFilterColInfo)); colIdxi = 0; empty = false; - + for (uint32_t j = 0; j < g->unitNum; ++j) { SFilterUnit* u = FILTER_GROUP_UNIT(info, g, j); uint32_t cidx = FILTER_UNIT_COL_IDX(u); @@ -2067,7 +2067,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t FILTER_SET_FLAG(info->status, FI_STATUS_REWRITE); } } - + FILTER_PUSH_UNIT(gRes[gResIdx]->colInfo[cidx], u); } @@ -2093,10 +2093,10 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t FILTER_SET_FLAG(info->status, FI_STATUS_REWRITE); filterFreeGroupCtx(gRes[gResIdx]); gRes[gResIdx] = NULL; - + continue; } - + gRes[gResIdx]->colNum = colIdxi; FILTER_COPY_IDX(&gRes[gResIdx]->colIdx, colIdx, colIdxi); ++gResIdx; @@ -2105,7 +2105,7 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t taosMemoryFreeClear(colIdx); *gResNum = gResIdx; - + if (gResIdx == 0) { FILTER_SET_FLAG(info->status, FI_STATUS_EMPTY); } @@ -2116,12 +2116,12 @@ int32_t filterMergeGroupUnits(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t void filterCheckColConflict(SFilterGroupCtx* gRes1, SFilterGroupCtx* gRes2, bool *conflict) { uint32_t idx1 = 0, idx2 = 0, m = 0, n = 0; bool equal = false; - + for (; m < gRes1->colNum; ++m) { idx1 = gRes1->colIdx[m]; equal = false; - + for (; n < gRes2->colNum; ++n) { idx2 = gRes2->colIdx[n]; if (idx1 < idx2) { @@ -2146,7 +2146,7 @@ void filterCheckColConflict(SFilterGroupCtx* gRes1, SFilterGroupCtx* gRes2, bool return; } } - + ++n; equal = true; break; @@ -2185,7 +2185,7 @@ int32_t filterMergeTwoGroupsImpl(SFilterInfo *info, SFilterRangeCtx **ctx, int32 int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx** gRes1, SFilterGroupCtx** gRes2, bool *all) { bool conflict = false; - + filterCheckColConflict(*gRes1, *gRes2, &conflict); if (conflict) { return TSDB_CODE_SUCCESS; @@ -2203,7 +2203,7 @@ int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx** gRes1, SFilter for (; m < (*gRes1)->colNum; ++m) { idx1 = (*gRes1)->colIdx[m]; - + for (; n < (*gRes2)->colNum; ++n) { idx2 = (*gRes2)->colIdx[n]; @@ -2212,9 +2212,9 @@ int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx** gRes1, SFilter } assert(idx1 == idx2); - + ++merNum; - + filterMergeTwoGroupsImpl(info, &ctx, LOGIC_COND_TYPE_OR, idx1, *gRes1, *gRes2, NULL, all); FLT_CHK_JMP(*all); @@ -2231,7 +2231,7 @@ int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx** gRes1, SFilter if (equal) { ++equal1; } - + filterCompareRangeCtx(ctx, (*gRes2)->colInfo[idx2].info, &equal); if (equal) { ++equal2; @@ -2251,7 +2251,7 @@ int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx** gRes1, SFilter FLT_CHK_JMP(equal1 != merNum); colCtx.colIdx = idx1; - colCtx.ctx = ctx; + colCtx.ctx = ctx; ctx = NULL; taosArrayPush(colCtxs, &colCtx); } @@ -2273,17 +2273,17 @@ int32_t filterMergeTwoGroups(SFilterInfo *info, SFilterGroupCtx** gRes1, SFilter int32_t ctxSize = (int32_t)taosArrayGetSize(colCtxs); SFilterColCtx *pctx = NULL; - + for (int32_t i = 0; i < ctxSize; ++i) { pctx = taosArrayGet(colCtxs, i); colInfo = &(*gRes1)->colInfo[pctx->colIdx]; - + filterFreeColInfo(colInfo); FILTER_PUSH_CTX((*gRes1)->colInfo[pctx->colIdx], pctx->ctx); } taosArrayDestroy(colCtxs); - + return TSDB_CODE_SUCCESS; _return: @@ -2310,7 +2310,7 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t *gR taosSort(gRes, *gResNum, POINTER_BYTES, filterCompareGroupCtx); int32_t pEnd = 0, cStart = 0, cEnd = 0; - uint32_t pColNum = 0, cColNum = 0; + uint32_t pColNum = 0, cColNum = 0; int32_t movedNum = 0; bool all = false; @@ -2336,7 +2336,7 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t *gR if (n < ((*gResNum) - 1)) { memmove(&gRes[n], &gRes[n+1], (*gResNum-n-1) * POINTER_BYTES); } - + --cEnd; --(*gResNum); ++movedNum; @@ -2352,12 +2352,12 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t *gR filterMergeTwoGroups(info, &gRes[m], &gRes[n], &all); FLT_CHK_JMP(all); - + if (gRes[n] == NULL) { if (n < ((*gResNum) - 1)) { memmove(&gRes[n], &gRes[n+1], (*gResNum-n-1) * POINTER_BYTES); } - + --cEnd; --(*gResNum); ++movedNum; @@ -2374,13 +2374,13 @@ int32_t filterMergeGroups(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t *gR if (i >= (*gResNum)) { break; } - + cStart = i; - cColNum = gRes[i]->colNum; + cColNum = gRes[i]->colNum; } return TSDB_CODE_SUCCESS; - + _return: FILTER_SET_FLAG(info->status, FI_STATUS_ALL); @@ -2411,11 +2411,11 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t gResNum qDebug("no need rewrite"); return TSDB_CODE_SUCCESS; } - + SFilterInfo oinfo = *info; FILTER_SET_FLAG(oinfo.status, FI_STATUS_CLONED); - + SArray* group = taosArrayInit(FILTER_DEFAULT_GROUP_SIZE, sizeof(SFilterGroup)); SFilterGroupCtx *res = NULL; SFilterColInfo *colInfo = NULL; @@ -2423,7 +2423,7 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t gResNum uint32_t uidx = 0; memset(info, 0, sizeof(*info)); - + info->colRangeNum = oinfo.colRangeNum; info->colRange = oinfo.colRange; oinfo.colRangeNum = 0; @@ -2439,25 +2439,25 @@ int32_t filterRewrite(SFilterInfo *info, SFilterGroupCtx** gRes, int32_t gResNum optr = (res->colNum > 1) ? LOGIC_COND_TYPE_AND : LOGIC_COND_TYPE_OR; SFilterGroup ng = {0}; - + for (uint32_t m = 0; m < res->colNum; ++m) { colInfo = &res->colInfo[res->colIdx[m]]; if (FILTER_NO_MERGE_DATA_TYPE(colInfo->dataType)) { assert(colInfo->type == RANGE_TYPE_UNIT); int32_t usize = (int32_t)taosArrayGetSize((SArray *)colInfo->info); - + for (int32_t n = 0; n < usize; ++n) { SFilterUnit* u = taosArrayGetP((SArray *)colInfo->info, n); - + filterAddUnitFromUnit(info, &oinfo, u, &uidx); filterAddUnitToGroup(&ng, uidx); } - + continue; } - + assert(colInfo->type == RANGE_TYPE_MR_CTX); - + filterAddGroupUnitFromCtx(info, &oinfo, colInfo->info, res->colIdx[m], &ng, optr, group); } @@ -2498,7 +2498,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx** gRes, int32_ } assert(idxNum[i] == gResNum); - + if (idxs == NULL) { idxs = taosMemoryCalloc(info->fields[FLD_TYPE_COLUMN].num, sizeof(*idxs)); } @@ -2537,7 +2537,7 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx** gRes, int32_ if (all) { filterFreeRangeCtx(info->colRange[m]); info->colRange[m] = NULL; - + if (m < (info->colRangeNum - 1)) { memmove(&info->colRange[m], &info->colRange[m + 1], (info->colRangeNum - m - 1) * POINTER_BYTES); memmove(&idxs[m], &idxs[m + 1], (info->colRangeNum - m - 1) * sizeof(*idxs)); @@ -2546,10 +2546,10 @@ int32_t filterGenerateColRange(SFilterInfo *info, SFilterGroupCtx** gRes, int32_ --info->colRangeNum; --m; - FLT_CHK_JMP(info->colRangeNum <= 0); + FLT_CHK_JMP(info->colRangeNum <= 0); } - ++n; + ++n; break; } } @@ -2589,7 +2589,7 @@ int32_t filterGenerateComInfo(SFilterInfo *info) { info->cunits[i].optr = FILTER_UNIT_OPTR(unit); info->cunits[i].colData = NULL; info->cunits[i].colId = FILTER_UNIT_COL_ID(info, unit); - + if (unit->right.type == FLD_TYPE_VALUE) { info->cunits[i].valData = FILTER_UNIT_VAL_DATA(info, unit); } else { @@ -2600,11 +2600,11 @@ int32_t filterGenerateComInfo(SFilterInfo *info) { } else { info->cunits[i].valData2 = info->cunits[i].valData; } - + info->cunits[i].dataSize = FILTER_UNIT_COL_SIZE(info, unit); info->cunits[i].dataType = FILTER_UNIT_DATA_TYPE(unit); } - + return TSDB_CODE_SUCCESS; } @@ -2624,7 +2624,7 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SColumnDataAgg *pDataStatis, int3 int32_t rmUnit = 0; memset(info->blkUnitRes, 0, sizeof(*info->blkUnitRes) * info->unitNum); - + for (uint32_t k = 0; k < info->unitNum; ++k) { int32_t index = -1; SFilterComUnit *cunit = &info->cunits[k]; @@ -2663,7 +2663,7 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SColumnDataAgg *pDataStatis, int3 rmUnit = 1; continue; } - + info->blkUnitRes[k] = -1; rmUnit = 1; continue; @@ -2684,7 +2684,7 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SColumnDataAgg *pDataStatis, int3 if (cunit->dataType == TSDB_DATA_TYPE_FLOAT) { minv = (float)(*(double *)(&pDataBlockst->min)); maxv = (float)(*(double *)(&pDataBlockst->max)); - + minVal = &minv; maxVal = &maxv; } else { @@ -2708,7 +2708,7 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SColumnDataAgg *pDataStatis, int3 if (minRes && maxRes) { continue; } - + info->blkUnitRes[k] = -1; rmUnit = 1; } @@ -2727,10 +2727,10 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SColumnDataAgg *pDataStatis, int3 info->blkUnitRes[k] = -1; rmUnit = 1; } - + continue; } - + info->blkUnitRes[k] = -1; rmUnit = 1; } @@ -2744,17 +2744,17 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SColumnDataAgg *pDataStatis, int3 } info->blkGroupNum = info->groupNum; - + uint32_t *unitNum = info->blkUnits; uint32_t *unitIdx = unitNum + 1; int32_t all = 0, empty = 0; - + for (uint32_t g = 0; g < info->groupNum; ++g) { SFilterGroup *group = &info->groups[g]; *unitNum = group->unitNum; - all = 0; + all = 0; empty = 0; - + for (uint32_t u = 0; u < group->unitNum; ++u) { uint32_t uidx = group->unitIdxs[u]; if (info->blkUnitRes[uidx] == 1) { @@ -2773,14 +2773,14 @@ int32_t filterRmUnitByRange(SFilterInfo *info, SColumnDataAgg *pDataStatis, int3 if (*unitNum == 0) { --info->blkGroupNum; assert(empty || all); - + if (empty) { FILTER_SET_FLAG(info->blkFlag, FI_STATUS_BLK_EMPTY); } else { FILTER_SET_FLAG(info->blkFlag, FI_STATUS_BLK_ALL); goto _return; } - + continue; } @@ -2808,18 +2808,18 @@ bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p, if (*p == NULL) { *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); } - + for (int32_t i = 0; i < numOfRows; ++i) { //FILTER_UNIT_CLR_F(info); unitIdx = info->blkUnits; - + for (uint32_t g = 0; g < info->blkGroupNum; ++g) { uint32_t unitNum = *(unitIdx++); for (uint32_t u = 0; u < unitNum; ++u) { SFilterComUnit *cunit = &info->cunits[*(unitIdx + u)]; void *colData = colDataGetData((SColumnInfoData *)cunit->colData, i); - + //if (FILTER_UNIT_GET_F(info, uidx)) { // p[i] = FILTER_UNIT_GET_R(info, uidx); //} else { @@ -2837,7 +2837,7 @@ bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p, } else { (*p)[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, colData, cunit->valData); } - + //FILTER_UNIT_SET_R(info, uidx, p[i]); //FILTER_UNIT_SET_F(info, uidx); } @@ -2856,7 +2856,7 @@ bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p, if ((*p)[i] == 0) { all = false; - } + } } return all; @@ -2865,11 +2865,11 @@ bool filterExecuteBasedOnStatisImpl(void *pinfo, int32_t numOfRows, int8_t** p, int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols, bool* all) { - if (statis && numOfRows >= FILTER_RM_UNIT_MIN_ROWS) { + if (statis && numOfRows >= FILTER_RM_UNIT_MIN_ROWS) { info->blkFlag = 0; - + filterRmUnitByRange(info, statis, numOfCols, numOfRows); - + if (info->blkFlag) { if (FILTER_GET_FLAG(info->blkFlag, FI_STATUS_BLK_ALL)) { *all = true; @@ -2880,7 +2880,7 @@ int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, int8_t* } assert(info->unitNum > 1); - + *all = filterExecuteBasedOnStatisImpl(info, numOfRows, p, statis, numOfCols); goto _return; @@ -2891,7 +2891,7 @@ int32_t filterExecuteBasedOnStatis(SFilterInfo *info, int32_t numOfRows, int8_t* _return: info->blkFlag = 0; - + return TSDB_CODE_SUCCESS; } @@ -2913,7 +2913,7 @@ static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows, if (*p == NULL) { *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); } - + for (int32_t i = 0; i < numOfRows; ++i) { uint32_t uidx = info->groups[0].unitIdxs[0]; void *colData = colDataGetData((SColumnInfoData *)info->cunits[uidx].colData, i); @@ -2921,7 +2921,7 @@ static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows, if ((*p)[i] == 0) { all = false; - } + } } return all; @@ -2937,7 +2937,7 @@ static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows if (*p == NULL) { *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); } - + for (int32_t i = 0; i < numOfRows; ++i) { uint32_t uidx = info->groups[0].unitIdxs[0]; void *colData = colDataGetData((SColumnInfoData *)info->cunits[uidx].colData, i); @@ -2967,8 +2967,8 @@ bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SColumnD if (*p == NULL) { *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); } - - for (int32_t i = 0; i < numOfRows; ++i) { + + for (int32_t i = 0; i < numOfRows; ++i) { void *colData = colDataGetData((SColumnInfoData *)info->cunits[0].colData, i); SColumnInfoData* pData = info->cunits[0].colData; if (colData == NULL || colDataIsNull_s(pData, i)) { @@ -2977,7 +2977,7 @@ bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SColumnD } (*p)[i] = (*rfunc)(colData, colData, valData, valData2, func); - + if ((*p)[i] == 0) { all = false; } @@ -2993,11 +2993,11 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDa if (filterExecuteBasedOnStatis(info, numOfRows, p, statis, numOfCols, &all) == 0) { return all; } - + if (*p == NULL) { *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); } - + for (int32_t i = 0; i < numOfRows; ++i) { uint32_t uidx = info->groups[0].unitIdxs[0]; void *colData = colDataGetData((SColumnInfoData *)info->cunits[uidx].colData, i); @@ -3042,17 +3042,17 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAg if (*p == NULL) { *p = taosMemoryCalloc(numOfRows, sizeof(int8_t)); } - + for (int32_t i = 0; i < numOfRows; ++i) { //FILTER_UNIT_CLR_F(info); - + for (uint32_t g = 0; g < info->groupNum; ++g) { SFilterGroup *group = &info->groups[g]; for (uint32_t u = 0; u < group->unitNum; ++u) { uint32_t uidx = group->unitIdxs[u]; SFilterComUnit *cunit = &info->cunits[uidx]; void *colData = colDataGetData((SColumnInfoData *)(cunit->colData), i); - + //if (FILTER_UNIT_GET_F(info, uidx)) { // p[i] = FILTER_UNIT_GET_R(info, uidx); //} else { @@ -3082,7 +3082,7 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAg (*p)[i] = filterDoCompare(gDataCompare[cunit->func], cunit->optr, colData, cunit->valData); } } - + //FILTER_UNIT_SET_R(info, uidx, p[i]); //FILTER_UNIT_SET_F(info, uidx); } @@ -3099,7 +3099,7 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SColumnDataAg if ((*p)[i] == 0) { all = false; - } + } } return all; @@ -3133,11 +3133,11 @@ int32_t filterSetExecFunc(SFilterInfo *info) { if (info->cunits[0].rfunc >= 0) { info->func = filterExecuteImplRange; - return TSDB_CODE_SUCCESS; + return TSDB_CODE_SUCCESS; } info->func = filterExecuteImplMisc; - return TSDB_CODE_SUCCESS; + return TSDB_CODE_SUCCESS; } @@ -3145,7 +3145,7 @@ int32_t filterSetExecFunc(SFilterInfo *info) { int32_t filterPreprocess(SFilterInfo *info) { SFilterGroupCtx** gRes = taosMemoryCalloc(info->groupNum, sizeof(SFilterGroupCtx *)); int32_t gResNum = 0; - + filterMergeGroupUnits(info, gRes, &gResNum); filterMergeGroups(info, gRes, &gResNum); @@ -3155,11 +3155,11 @@ int32_t filterPreprocess(SFilterInfo *info) { goto _return; } - + if (FILTER_GET_FLAG(info->status, FI_STATUS_EMPTY)) { fltInfo("Final - FilterInfo: [EMPTY]"); goto _return; - } + } filterGenerateColRange(info, gRes, gResNum); @@ -3180,7 +3180,7 @@ _return: } taosMemoryFreeClear(gRes); - + return TSDB_CODE_SUCCESS; } @@ -3208,7 +3208,7 @@ int32_t fltSetColFieldDataImpl(SFilterInfo *info, void *param, filer_get_col_fro int32_t fltInitFromNode(SNode* tree, SFilterInfo *info, uint32_t options) { int32_t code = TSDB_CODE_SUCCESS; - + SArray* group = taosArrayInit(FILTER_DEFAULT_GROUP_SIZE, sizeof(SFilterGroup)); filterInitUnitsFields(info); @@ -3226,13 +3226,13 @@ int32_t fltInitFromNode(SNode* tree, SFilterInfo *info, uint32_t options) { filterDumpInfoToString(info, "Before preprocess", 0); FLT_ERR_JRET(filterPreprocess(info)); - + FLT_CHK_JMP(FILTER_GET_FLAG(info->status, FI_STATUS_ALL)); if (FILTER_GET_FLAG(info->status, FI_STATUS_EMPTY)) { return code; } - } + } info->unitRes = taosMemoryMalloc(info->unitNum * sizeof(*info->unitRes)); info->unitFlags = taosMemoryMalloc(info->unitNum * sizeof(*info->unitFlags)); @@ -3253,10 +3253,10 @@ bool filterRangeExecute(SFilterInfo *info, SColumnDataAgg *pDataStatis, int32_t if (FILTER_ALL_RES(info)) { return true; } - + bool ret = true; void *minVal, *maxVal; - + for (uint32_t k = 0; k < info->colRangeNum; ++k) { int32_t index = -1; SFilterRangeCtx *ctx = info->colRange[k]; @@ -3306,7 +3306,7 @@ bool filterRangeExecute(SFilterInfo *info, SColumnDataAgg *pDataStatis, int32_t if (ctx->type == TSDB_DATA_TYPE_FLOAT) { minv = (float)(*(double *)(&pDataBlockst->min)); maxv = (float)(*(double *)(&pDataBlockst->max)); - + minVal = &minv; maxVal = &maxv; } else { @@ -3321,7 +3321,7 @@ bool filterRangeExecute(SFilterInfo *info, SColumnDataAgg *pDataStatis, int32_t } r = r->next; } - + if (!ret) { return ret; } @@ -3357,10 +3357,10 @@ int32_t filterGetTimeRangeImpl(SFilterInfo *info, STimeWindow *win, bool * SFilterUnit *unit = &info->units[uidx]; uint8_t raOptr = FILTER_UNIT_OPTR(unit); - + filterAddRangeOptr(cur, raOptr, LOGIC_COND_TYPE_AND, &empty, NULL); FLT_CHK_JMP(empty); - + if (FILTER_NO_MERGE_OPTR(raOptr)) { continue; } @@ -3393,10 +3393,10 @@ int32_t filterGetTimeRangeImpl(SFilterInfo *info, STimeWindow *win, bool * *isStrict = false; qDebug("more than one time range, num:%d", num); } - + SFilterRange tra; filterGetRangeRes(prev, &tra); - win->skey = tra.s; + win->skey = tra.s; win->ekey = tra.e; if (FILTER_GET_FLAG(tra.sflag, RANGE_FLG_EXCLUDE)) { win->skey++; @@ -3428,7 +3428,7 @@ _return: int32_t filterGetTimeRange(SNode *pNode, STimeWindow *win, bool *isStrict) { SFilterInfo *info = NULL; int32_t code = 0; - + *isStrict = true; FLT_ERR_RET(filterInitFromNode(pNode, &info, FLT_OPTION_NO_REWRITE|FLT_OPTION_TIMESTAMP)); @@ -3453,7 +3453,7 @@ int32_t filterConverNcharColumns(SFilterInfo* info, int32_t rows, bool *gotNchar if (FILTER_EMPTY_RES(info) || FILTER_ALL_RES(info)) { return TSDB_CODE_SUCCESS; } - + for (uint32_t i = 0; i < info->fields[FLD_TYPE_COLUMN].num; ++i) { SFilterField* fi = &info->fields[FLD_TYPE_COLUMN].fields[i]; int32_t type = FILTER_GET_COL_FIELD_TYPE(fi); @@ -3485,7 +3485,7 @@ int32_t filterConverNcharColumns(SFilterInfo* info, int32_t rows, bool *gotNchar } fi->data = nfi.data; - + *gotNchar = true; } } @@ -3536,11 +3536,11 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) { stat->code = TSDB_CODE_QRY_INVALID_INPUT; return DEAL_RES_ERROR; } - + if ((QUERY_NODE_OPERATOR != nodeType(cell->pNode)) && (QUERY_NODE_LOGIC_CONDITION != nodeType(cell->pNode))) { stat->scalarMode = true; } - + cell = cell->pNext; } @@ -3553,11 +3553,11 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) { stat->scalarMode = true; return DEAL_RES_CONTINUE; } - + if (!FILTER_GET_FLAG(stat->info->options, FLT_OPTION_TIMESTAMP)) { return DEAL_RES_CONTINUE; } - + if (TSDB_DATA_TYPE_BINARY != valueNode->node.resType.type && TSDB_DATA_TYPE_NCHAR != valueNode->node.resType.type) { return DEAL_RES_CONTINUE; } @@ -3568,7 +3568,7 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) { stat->code = code; return DEAL_RES_ERROR; } - + return DEAL_RES_CONTINUE; } @@ -3586,7 +3586,7 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) { stat->precision = colNode->node.resType.precision; return DEAL_RES_CONTINUE; } - + if (QUERY_NODE_NODE_LIST == nodeType(*pNode)) { SNodeListNode *listNode = (SNodeListNode *)*pNode; if (QUERY_NODE_VALUE != nodeType(listNode->pNodeList->pHead->pNode)) { @@ -3624,7 +3624,7 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) { return DEAL_RES_CONTINUE; } - if (FILTER_GET_FLAG(stat->info->options, FLT_OPTION_TIMESTAMP) && + if (FILTER_GET_FLAG(stat->info->options, FLT_OPTION_TIMESTAMP) && (node->opType >= OP_TYPE_NOT_EQUAL) && (node->opType != OP_TYPE_IS_NULL && node->opType != OP_TYPE_IS_NOT_NULL)) { stat->scalarMode = true; return DEAL_RES_CONTINUE; @@ -3636,7 +3636,7 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) { stat->code = TSDB_CODE_QRY_APP_ERROR; return DEAL_RES_ERROR; } - + if (QUERY_NODE_COLUMN != nodeType(node->pLeft)) { stat->scalarMode = true; return DEAL_RES_CONTINUE; @@ -3656,7 +3656,7 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) { if ((QUERY_NODE_COLUMN != nodeType(node->pRight)) && (QUERY_NODE_VALUE != nodeType(node->pRight)) && (QUERY_NODE_NODE_LIST != nodeType(node->pRight))) { stat->scalarMode = true; return DEAL_RES_CONTINUE; - } + } if (nodeType(node->pLeft) == nodeType(node->pRight)) { stat->scalarMode = true; @@ -3699,7 +3699,7 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) { if (OP_TYPE_IN != node->opType) { SColumnNode *refNode = (SColumnNode *)node->pLeft; SValueNode *valueNode = (SValueNode *)node->pRight; - if (FILTER_GET_FLAG(stat->info->options, FLT_OPTION_TIMESTAMP) + if (FILTER_GET_FLAG(stat->info->options, FLT_OPTION_TIMESTAMP) && TSDB_DATA_TYPE_UBIGINT == valueNode->node.resType.type && valueNode->datum.u <= INT64_MAX) { valueNode->node.resType.type = TSDB_DATA_TYPE_BIGINT; } @@ -3720,12 +3720,12 @@ EDealRes fltReviseRewriter(SNode** pNode, void* pContext) { } return DEAL_RES_CONTINUE; - } - + } + fltError("invalid node type for filter, type:%d", nodeType(*pNode)); - + stat->code = TSDB_CODE_QRY_INVALID_INPUT; - + return DEAL_RES_ERROR; } @@ -3738,7 +3738,7 @@ int32_t fltReviseNodes(SFilterInfo *pInfo, SNode** pNode, SFltTreeStat *pStat) { int32_t nodeNum = taosArrayGetSize(pStat->nodeList); for (int32_t i = 0; i < nodeNum; ++i) { SValueNode *valueNode = *(SValueNode **)taosArrayGet(pStat->nodeList, i); - + FLT_ERR_JRET(sclConvertToTsValueNode(pStat->precision, valueNode)); } @@ -3757,7 +3757,7 @@ int32_t fltOptimizeNodes(SFilterInfo *pInfo, SNode** pNode, SFltTreeStat *pStat) int32_t fltGetDataFromColId(void *param, int32_t id, void **data) { int32_t numOfCols = ((SFilterColumnParam *)param)->numOfCols; SArray* pDataBlock = ((SFilterColumnParam *)param)->pDataBlock; - + for (int32_t j = 0; j < numOfCols; ++j) { SColumnInfoData* pColInfo = taosArrayGet(pDataBlock, j); if (id == pColInfo->info.colId) { @@ -3776,7 +3776,7 @@ int32_t fltGetDataFromSlotId(void *param, int32_t id, void **data) { fltError("invalid slot id, id:%d, numOfCols:%d, arraySize:%d", id, numOfCols, (int32_t)taosArrayGetSize(pDataBlock)); return TSDB_CODE_QRY_APP_ERROR; } - + SColumnInfoData* pColInfo = taosArrayGet(pDataBlock, id); *data = pColInfo; @@ -3802,7 +3802,7 @@ int32_t filterSetDataFromColId(SFilterInfo *info, void *param) { int32_t filterInitFromNode(SNode* pNode, SFilterInfo **pInfo, uint32_t options) { int32_t code = 0; SFilterInfo *info = NULL; - + if (pNode == NULL || pInfo == NULL) { fltError("invalid param"); FLT_ERR_RET(TSDB_CODE_QRY_APP_ERROR); @@ -3822,7 +3822,7 @@ int32_t filterInitFromNode(SNode* pNode, SFilterInfo **pInfo, uint32_t options) SFltTreeStat stat = {0}; stat.precision = -1; stat.info = info; - + FLT_ERR_JRET(fltReviseNodes(info, &pNode, &stat)); info->scalarMode = stat.scalarMode; @@ -3834,11 +3834,11 @@ int32_t filterInitFromNode(SNode* pNode, SFilterInfo **pInfo, uint32_t options) info->sclCtx.node = pNode; FLT_ERR_JRET(fltOptimizeNodes(info, &info->sclCtx.node, &stat)); } - + return code; _return: - + filterFreeInfo(*pInfo); *pInfo = NULL; diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index cfeac04bbd..d0c5a76f4b 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -140,13 +140,23 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) { SCL_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } + colDataDestroy(out.columnData); + taosMemoryFreeClear(out.columnData); + out.columnData = taosMemoryCalloc(1, sizeof(SColumnInfoData)); + cell = cell->pNext; } *data = pObj; + + colDataDestroy(out.columnData); + taosMemoryFreeClear(out.columnData); return TSDB_CODE_SUCCESS; _return: + + colDataDestroy(out.columnData); + taosMemoryFreeClear(out.columnData); taosHashCleanup(pObj); SCL_RET(code); } diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index 3bec91226c..544ecce175 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -92,7 +92,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa switch (msgType) { case TDMT_VND_COMMIT_RSP: { SCH_ERR_JRET(rspCode); - SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); + SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask)); break; } 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); taosMemoryFreeClear(msg); - SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); + SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask)); break; } 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); taosMemoryFreeClear(msg); - SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); + SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask)); break; } case TDMT_VND_ALTER_TABLE_RSP: { @@ -169,7 +169,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa taosMemoryFreeClear(msg); - SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); + SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask)); break; } case TDMT_VND_SUBMIT_RSP: { @@ -218,7 +218,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa taosMemoryFreeClear(msg); - SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); + SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask)); break; } @@ -238,7 +238,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa taosMemoryFreeClear(msg); - SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); + SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask)); break; } @@ -263,7 +263,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa taosMemoryFreeClear(msg); - SCH_ERR_RET(schProcessOnTaskSuccess(pJob, pTask)); + SCH_ERR_JRET(schProcessOnTaskSuccess(pJob, pTask)); 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, 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); pMsg->pData = NULL; schProcessOnCbEnd(pJob, pTask, code); +_return: + taosMemoryFreeClear(pMsg->pData); 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; qDebug("QID:0x%" PRIx64 ",TID:0x%" PRIx64 " drop task rsp received, code:0x%x", pParam->queryId, pParam->taskId, code); + if (pMsg) { + taosMemoryFree(pMsg->pData); + } 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); if (head->isHbParam) { + taosMemoryFree(pMsg->pData); + SSchHbCallbackParam *hbParam = (SSchHbCallbackParam *)param; SSchTrans trans = {.pTrans = hbParam->pTrans, .pHandle = NULL}; SCH_ERR_RET(schUpdateHbConnection(&hbParam->nodeEpId, &trans)); diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index 025891a26c..ecd0253e1c 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -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: + taosMemoryFree(pData->pData); + SCH_RET(schProcessOnTaskFailure(pJob, pTask, code)); } diff --git a/source/libs/stream/src/streamUpdate.c b/source/libs/stream/src/streamUpdate.c index f2a5ba0ab5..ff1ef7b4b9 100644 --- a/source/libs/stream/src/streamUpdate.c +++ b/source/libs/stream/src/streamUpdate.c @@ -125,6 +125,9 @@ SUpdateInfo *updateInfoInit(int64_t interval, int32_t precision, int64_t waterma pInfo->pCloseWinSBF = NULL; _hash_fn_t hashFn = taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY); 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; } @@ -185,15 +188,36 @@ bool updateInfoIsUpdated(SUpdateInfo *pInfo, uint64_t tableId, TSKEY ts) { } if (ts < pInfo->minTS) { + qDebug("===stream===Update. tableId:%" PRIu64 ", maxTs:%" PRIu64 ", mapMaxTs:%" PRIu64 ", ts:%" PRIu64 , tableId, maxTs, *pMapMaxTs, ts); return true; } else if (res == TSDB_CODE_SUCCESS) { 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 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) { if (pInfo == NULL) { return; diff --git a/source/libs/sync/src/syncAppendEntriesReply.c b/source/libs/sync/src/syncAppendEntriesReply.c index e0cc45bd1d..7279f0858b 100644 --- a/source/libs/sync/src/syncAppendEntriesReply.c +++ b/source/libs/sync/src/syncAppendEntriesReply.c @@ -335,10 +335,6 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries // nextIndex' = [nextIndex EXCEPT ![i][j] = m.mmatchIndex + 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] syncIndexMgrSetIndex(ths->pMatchIndex, &(pMsg->srcId), pMsg->matchIndex); @@ -349,9 +345,6 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries } else { 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 if (nextIndex > SYNC_INDEX_BEGIN) { @@ -393,9 +386,6 @@ int32_t syncNodeOnAppendEntriesReplySnapshotCb(SSyncNode* ths, SyncAppendEntries } 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)); diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 9a56bb3fb8..00ce1f7b68 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -88,10 +88,6 @@ int64_t syncOpen(const SSyncInfo* pSyncInfo) { SSyncNode* pSyncNode = syncNodeOpen(pSyncInfo); ASSERT(pSyncNode != NULL); - if (gRaftDetailLog) { - syncNodeLog2("syncNodeOpen open success", pSyncNode); - } - pSyncNode->rid = taosAddRef(tsNodeRefId, pSyncNode); if (pSyncNode->rid < 0) { syncFreeNode(pSyncNode); @@ -245,11 +241,7 @@ int32_t syncReconfig(int64_t rid, const SSyncCfg* pNewCfg) { return -1; } - char* newconfig = syncCfg2Str((SSyncCfg*)pNewCfg); - if (gRaftDetailLog) { - sInfo("==syncReconfig== newconfig:%s", newconfig); - } - + char* newconfig = syncCfg2Str((SSyncCfg*)pNewCfg); int32_t ret = 0; SRpcMsg rpcMsg = {0}; @@ -912,12 +904,6 @@ SSyncNode* syncNodeOpen(const SSyncInfo* pOldSyncInfo) { ASSERT(pSyncNode->pRaftCfg != NULL); pSyncInfo->syncCfg = pSyncNode->pRaftCfg->cfg; - if (gRaftDetailLog) { - char* seralized = raftCfg2Str(pSyncNode->pRaftCfg); - sInfo("syncNodeOpen update config :%s", seralized); - taosMemoryFree(seralized); - } - raftCfgClose(pSyncNode->pRaftCfg); } @@ -1348,13 +1334,6 @@ int32_t syncNodeSendMsgById(const SRaftId* destRaftId, SSyncNode* pSyncNode, SRp SEpSet epSet; syncUtilraftId2EpSet(destRaftId, &epSet); 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 syncUtilMsgHtoN(pMsg->pCont); diff --git a/source/libs/sync/test/sh/auto_bench.sh b/source/libs/sync/test/sh/auto_bench.sh index 32dc071018..d786b5f43c 100644 --- a/source/libs/sync/test/sh/auto_bench.sh +++ b/source/libs/sync/test/sh/auto_bench.sh @@ -1,7 +1,7 @@ #!/bin/bash -if [ $# != 5 ] ; then - echo "Uasge: $0 instances vgroups replica ctables rows" +if [ $# != 7 ] ; then + echo "Uasge: $0 instances vgroups replica ctables rows weak drop(yes/no)" echo "" exit 1 fi @@ -11,11 +11,14 @@ vgroups=$2 replica=$3 ctables=$4 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"` -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} cp ./insert.tpl.json ${casedir} cd ${casedir} @@ -25,6 +28,7 @@ for i in `seq 1 ${instances}`;do cfg_file=bench_${i}.json cp ./insert.tpl.json ${cfg_file} 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_replica_tpl/'${replica}'/g' ${cfg_file} sed -i 's/tpl_ctables_tpl/'${ctables}'/g' ${cfg_file} diff --git a/source/libs/sync/test/sh/insert.tpl.json b/source/libs/sync/test/sh/insert.tpl.json index 633dd70a24..1d952b98e8 100644 --- a/source/libs/sync/test/sh/insert.tpl.json +++ b/source/libs/sync/test/sh/insert.tpl.json @@ -15,8 +15,11 @@ "databases": [ { "dbinfo": { - "name": "db1", - "drop": "yes", + "name": "db_auto", + "drop": "tpl_drop_tpl", + "wal_retention_period": -1, + "wal_retention_size": -1, + "drop": "no", "vgroups": tpl_vgroups_tpl, "replica": tpl_replica_tpl }, diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index efbe110f6f..293e3e3c35 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -381,8 +381,8 @@ void cliHandleResp(SCliConn* conn) { 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, - TMSG_INFO(pHead->msgType), conn->dst, conn->src, transMsg.contLen, transMsg.code); + 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, tstrerror(transMsg.code)); 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); @@ -549,6 +549,8 @@ static void addConnToPool(void* pool, SCliConn* conn) { 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); 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); QUEUE_INIT(&conn->q); @@ -756,8 +758,8 @@ void cliSend(SCliConn* pConn) { uv_buf_t wb = uv_buf_init((char*)pHead, msgLen); 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), - pConn->dst, pConn->src); + tGTrace("%s conn %p %s is sent to %s, local info %s, len:%d", CONN_GET_INST_LABEL(pConn), pConn, + TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, pMsg->contLen); if (pHead->persist == 1) { CONN_SET_PERSIST_BY_APP(pConn); diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 4b579a1f95..fd420203e8 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -253,11 +253,11 @@ static void uvHandleReq(SSvrConn* pConn) { if (pConn->status == ConnNormal && pHead->noResp == 0) { 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); } else { - tGTrace("%s conn %p %s received from %s, local info:%s, msg size:%d, resp:%d, code:%d", transLabel(pTransInst), - pConn, TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, transMsg.contLen, pHead->noResp, transMsg.code); + tGTrace("%s conn %p %s received from %s, local info:%s, len:%d, resp:%d, code:%d", transLabel(pTransInst), pConn, + TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, transMsg.contLen, pHead->noResp, transMsg.code); } // pHead->noResp = 1, @@ -296,11 +296,9 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) { if (nread > 0) { pBuf->len += 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); uvHandleReq(conn); - } else { - tTrace("%s conn %p read partial packet, continue to read", transLabel(pTransInst), conn); } return; } @@ -418,8 +416,8 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) { STrans* pTransInst = pConn->pTransInst; STraceId* trace = &pMsg->info.traceId; - tGTrace("%s conn %p %s is sent to %s, local info:%s, msglen:%d", transLabel(pTransInst), pConn, - TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, len); + 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, pMsg->contLen); pHead->msgLen = htonl(len); wb->base = msg; diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index 68d8c54e28..a29c7a1309 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -116,15 +116,15 @@ int32_t walRollback(SWal *pWal, int64_t ver) { } 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); taosThreadMutexUnlock(&pWal->mutex); return -1; } int64_t idxOff = walGetVerIdxOffset(pWal, ver); - code = taosLSeekFile(pIdxTFile, idxOff, SEEK_SET); + code = taosLSeekFile(pIdxFile, idxOff, SEEK_SET); if (code < 0) { ASSERT(0); taosThreadMutexUnlock(&pWal->mutex); @@ -132,7 +132,7 @@ int32_t walRollback(SWal *pWal, int64_t ver) { } // read idx file and get log file pos SWalIdxEntry entry; - if (taosReadFile(pIdxTFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) { + if (taosReadFile(pIdxFile, &entry, sizeof(SWalIdxEntry)) != sizeof(SWalIdxEntry)) { ASSERT(0); taosThreadMutexUnlock(&pWal->mutex); return -1; @@ -140,24 +140,24 @@ int32_t walRollback(SWal *pWal, int64_t ver) { ASSERT(entry.ver == ver); walBuildLogName(pWal, walGetCurFileFirstVer(pWal), fnameStr); - TdFilePtr pLogTFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND); - if (pLogTFile == NULL) { - ASSERT(0); + TdFilePtr pLogFile = taosOpenFile(fnameStr, TD_FILE_WRITE | TD_FILE_READ | TD_FILE_APPEND); + if (pLogFile == NULL) { // TODO + terrno = TAOS_SYSTEM_ERROR(errno); taosThreadMutexUnlock(&pWal->mutex); return -1; } - code = taosLSeekFile(pLogTFile, entry.offset, SEEK_SET); + code = taosLSeekFile(pLogFile, entry.offset, SEEK_SET); if (code < 0) { - ASSERT(0); // TODO + terrno = TAOS_SYSTEM_ERROR(errno); taosThreadMutexUnlock(&pWal->mutex); return -1; } // validate offset SWalCkHead head; - ASSERT(taosValidFile(pLogTFile)); - int64_t size = taosReadFile(pLogTFile, &head, sizeof(SWalCkHead)); + ASSERT(taosValidFile(pLogFile)); + int64_t size = taosReadFile(pLogFile, &head, sizeof(SWalCkHead)); if (size != sizeof(SWalCkHead)) { ASSERT(0); taosThreadMutexUnlock(&pWal->mutex); @@ -180,14 +180,14 @@ int32_t walRollback(SWal *pWal, int64_t ver) { } // truncate old files - code = taosFtruncateFile(pLogTFile, entry.offset); + code = taosFtruncateFile(pLogFile, entry.offset); if (code < 0) { ASSERT(0); terrno = TAOS_SYSTEM_ERROR(errno); taosThreadMutexUnlock(&pWal->mutex); return -1; } - code = taosFtruncateFile(pIdxTFile, idxOff); + code = taosFtruncateFile(pIdxFile, idxOff); if (code < 0) { ASSERT(0); terrno = TAOS_SYSTEM_ERROR(errno); @@ -205,8 +205,10 @@ int32_t walRollback(SWal *pWal, int64_t ver) { ASSERT(((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->fileSize == 0); ((SWalFileInfo *)taosArrayGetLast(pWal->fileInfoSet))->firstVer = -1; } - taosCloseFile(&pIdxTFile); - taosCloseFile(&pLogTFile); + taosCloseFile(&pIdxFile); + taosCloseFile(&pLogFile); + + walSaveMeta(pWal); // unlock taosThreadMutexUnlock(&pWal->mutex); diff --git a/source/util/src/terror.c b/source/util/src/terror.c index f20c5d8593..3835260335 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -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_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_FIELD_CONFLICT_WITH_TSMA, "Field used by tsma") // mnode-trans TAOS_DEFINE_ERROR(TSDB_CODE_MND_TRANS_ALREADY_EXIST, "Transaction already exists") diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 6384195a1b..33ef92bf73 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -78,8 +78,8 @@ class DataSet: self.float_data.append( float(i * float_step % FLOAT_MAX )) self.double_data.append( float(i * double_step % DOUBLE_MAX )) self.bool_data.append( bool((i + bool_start) % 2 )) - self.vchar_data.append( f"{vchar_prefix}_{i * vchar_step}" ) - self.nchar_data.append( f"{nchar_prefix}_{i * nchar_step}") + self.vchar_data.append( f"{vchar_prefix}{i * vchar_step}" ) + self.nchar_data.append( f"{nchar_prefix}{i * nchar_step}") self.ts_data.append( int(datetime.timestamp(datetime.now()) * 1000 - i * ts_step)) def get_disorder_set(self, rows, **kwargs): diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index b9177d2269..4c50af6bac 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -194,6 +194,14 @@ class TDSql: args = (caller.filename, caller.lineno, self.sql, self.queryRows, expectRows) 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): if self.queryCols == expectCols: tdLog.info("sql:%s, queryCols:%d == expect:%d" % (self.sql, self.queryCols, expectCols)) diff --git a/tests/pytest/util/taosadapter.py b/tests/pytest/util/taosadapter.py index 1a198240d7..614eb95d6b 100644 --- a/tests/pytest/util/taosadapter.py +++ b/tests/pytest/util/taosadapter.py @@ -111,7 +111,7 @@ class TAdapter: self.taosadapter_cfg_dict[key] = value def check_adapter(self): - if getPath(tool="taosadapter"): + if get_path(tool="taosadapter"): return False else: return True diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index d745ecf706..755c8d537d 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -27,7 +27,7 @@ ./test.sh -f tsim/db/delete_writing2.sim # unsupport ./test.sh -f tsim/db/dropdnodes.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/repeat.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_stable.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.sim ./test.sh -f tsim/parser/between_and.sim @@ -131,8 +131,8 @@ ./test.sh -f tsim/parser/insert_tb.sim # TD-17038 ./test.sh -f tsim/parser/interp.sim ./test.sh -f tsim/parser/join_manyblocks.sim -# TD-17713 ./test.sh -f tsim/parser/join_multitables.sim -# TD-17713 ./test.sh -f tsim/parser/join_multivnode.sim +# TD-18018 ./test.sh -f tsim/parser/join_multitables.sim +./test.sh -f tsim/parser/join_multivnode.sim # TD-17707 ./test.sh -f tsim/parser/join.sim ./test.sh -f tsim/parser/last_cache.sim ./test.sh -f tsim/parser/last_groupby.sim @@ -144,7 +144,7 @@ # TD-17623 ./test.sh -f tsim/parser/limit2.sim ./test.sh -f tsim/parser/mixed_blocks.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/precision_ns.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/scalarNull.sim ./test.sh -f tsim/query/session.sim -./test.sh -f tsim/query/udf.sim # ---- qnode ./test.sh -f tsim/qnode/basic1.sim @@ -316,6 +315,7 @@ ./test.sh -f tsim/valgrind/checkError5.sim ./test.sh -f tsim/valgrind/checkError6.sim ./test.sh -f tsim/valgrind/checkError7.sim +./test.sh -f tsim/valgrind/checkUdf.sim # --- vnode # unsupport ./test.sh -f tsim/vnode/replica3_basic.sim @@ -339,7 +339,7 @@ # --- catalog ---- ./test.sh -f tsim/catalog/alterInCurrent.sim -# --- scalar +# --- scalar ---- ./test.sh -f tsim/scalar/in.sim ./test.sh -f tsim/scalar/scalar.sim @@ -384,7 +384,7 @@ ./test.sh -f tsim/compute/sum.sim ./test.sh -f tsim/compute/top.sim -# ---- field +# ---- field ---- ./test.sh -f tsim/field/2.sim ./test.sh -f tsim/field/3.sim ./test.sh -f tsim/field/4.sim @@ -401,7 +401,7 @@ ./test.sh -f tsim/field/tinyint.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_mix.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_time.sim -# ---- wal +# ---- wal ---- ./test.sh -f tsim/wal/kill.sim -# ---- tag +# ---- tag ---- ./test.sh -f tsim/tag/3.sim ./test.sh -f tsim/tag/4.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/bigint.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_int.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/commit.sim -# TD-17407 ./test.sh -f tsim/tag/create.sim -# TD-17407 ./test.sh -f tsim/tag/delete.sim -# TD-17407 ./test.sh -f tsim/tag/double.sim +./test.sh -f tsim/tag/create.sim +./test.sh -f tsim/tag/delete.sim +./test.sh -f tsim/tag/double.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_float.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/tinyint.sim diff --git a/tests/script/tsim/db/keep.sim b/tests/script/tsim/db/keep.sim index d8939eafbc..dc92492a48 100644 --- a/tests/script/tsim/db/keep.sim +++ b/tests/script/tsim/db/keep.sim @@ -63,12 +63,10 @@ print ===> rows $rows last $data01 if $rows >= 80 then return -1 endi -if $rows <= 50 then +if $rows <= 45 then return -1 endi -return - print ======== step5 stop dnode system sh/exec.sh -n dnode2 -s stop -x SIGKILL system sh/exec.sh -n dnode2 -s start @@ -78,7 +76,7 @@ print ===> rows $rows last $data01 if $rows >= 80 then return -1 endi -if $rows <= 50 then +if $rows <= 45 then return -1 endi @@ -109,8 +107,8 @@ print ======== step8 insert data $x = 81 while $x < 121 $time = $x . d - sql insert into tb values (now - $time , $x ) -x step4 - step4: + sql insert into tb values (now - $time , $x ) -x step8 + step8: $x = $x + 1 endw diff --git a/tests/script/tsim/insert/basic2.sim b/tests/script/tsim/insert/basic2.sim index 0bd64b1d02..eca46697f5 100644 --- a/tests/script/tsim/insert/basic2.sim +++ b/tests/script/tsim/insert/basic2.sim @@ -26,8 +26,8 @@ endi 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.011', 'N', 'n', '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.011', 'null', 'null', 'N',"N",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.014', NULL, 'NuLL', 'Null',NULL,30); diff --git a/tests/script/tsim/parser/join_multitables.sim b/tests/script/tsim/parser/join_multitables.sim index 7a1c77acff..6c5138f8cb 100644 --- a/tests/script/tsim/parser/join_multitables.sim +++ b/tests/script/tsim/parser/join_multitables.sim @@ -4,9 +4,7 @@ system sh/exec.sh -n dnode1 -s start sql connect print ======================== dnode1 start - $db = testdb - sql create database $db sql use $db @@ -200,7 +198,6 @@ sql insert into tb3_5 values('2021-03-03 05:00:00.000', 9935,9935.0,'35'); sql insert into tb3_5 values('2021-03-04 05:00:00.000', 9935,9935.0,'35'); sql insert into tb3_5 values('2021-03-05 05:00:00.000', 9935,9935.0,'35'); - sql insert into tb4_1 values('2021-03-01 01:00:00.000', 9941,9941.0,'41'); sql insert into tb4_1 values('2021-03-02 01:00:00.000', 9941,9941.0,'41'); sql insert into tb4_1 values('2021-03-03 01:00:00.000', 9941,9941.0,'41'); @@ -409,13 +406,10 @@ sql insert into tbb_5 values('2021-03-03 05:00:00.000', 99115,99115.0,'b5'); sql insert into tbb_5 values('2021-03-04 05:00:00.000', 99115,99115.0,'b5'); sql insert into tbb_5 values('2021-03-05 05:00:00.000', 99115,99115.0,'b5'); - sql select * from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1; - if $rows != 25 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -448,111 +442,10 @@ if $data09 != @21-03-01 01:00:00.000@ then return -1 endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != 9901 then - return -1 -endi -if $data12 != 9901.000000000 then - return -1 -endi -if $data13 != 01 then - return -1 -endi -if $data14 != 0 then - return -1 -endi -if $data15 != 1 then - return -1 -endi -if $data16 != 2.000000000 then - return -1 -endi -if $data17 != 1 then - return -1 -endi -if $data18 != 3 then - return -1 -endi -if $data19 != @21-03-02 01:00:00.000@ then - return -1 -endi - - - -if $data20 != @21-03-03 01:00:00.000@ then - return -1 -endi -if $data21 != 9901 then - return -1 -endi -if $data22 != 9901.000000000 then - return -1 -endi -if $data23 != 01 then - return -1 -endi -if $data24 != 0 then - return -1 -endi -if $data25 != 1 then - return -1 -endi -if $data26 != 2.000000000 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != 3 then - return -1 -endi -if $data29 != @21-03-03 01:00:00.000@ then - return -1 -endi - - -if $data30 != @21-03-04 01:00:00.000@ then - return -1 -endi -if $data31 != 9901 then - return -1 -endi -if $data32 != 9901.000000000 then - return -1 -endi -if $data33 != 01 then - return -1 -endi -if $data34 != 0 then - return -1 -endi -if $data35 != 1 then - return -1 -endi -if $data36 != 2.000000000 then - return -1 -endi -if $data37 != 1 then - return -1 -endi -if $data38 != 3 then - return -1 -endi -if $data39 != @21-03-04 01:00:00.000@ then - return -1 -endi - - - - sql select * from st0, st1 where st0.ts=st1.ts and st0.id2=st1.id2; - if $rows != 25 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -585,111 +478,10 @@ if $data09 != @21-03-01 01:00:00.000@ then return -1 endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != 9901 then - return -1 -endi -if $data12 != 9901.000000000 then - return -1 -endi -if $data13 != 01 then - return -1 -endi -if $data14 != 0 then - return -1 -endi -if $data15 != 1 then - return -1 -endi -if $data16 != 2.000000000 then - return -1 -endi -if $data17 != 1 then - return -1 -endi -if $data18 != 3 then - return -1 -endi -if $data19 != @21-03-02 01:00:00.000@ then - return -1 -endi - - - -if $data20 != @21-03-03 01:00:00.000@ then - return -1 -endi -if $data21 != 9901 then - return -1 -endi -if $data22 != 9901.000000000 then - return -1 -endi -if $data23 != 01 then - return -1 -endi -if $data24 != 0 then - return -1 -endi -if $data25 != 1 then - return -1 -endi -if $data26 != 2.000000000 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != 3 then - return -1 -endi -if $data29 != @21-03-03 01:00:00.000@ then - return -1 -endi - - -if $data30 != @21-03-04 01:00:00.000@ then - return -1 -endi -if $data31 != 9901 then - return -1 -endi -if $data32 != 9901.000000000 then - return -1 -endi -if $data33 != 01 then - return -1 -endi -if $data34 != 0 then - return -1 -endi -if $data35 != 1 then - return -1 -endi -if $data36 != 2.000000000 then - return -1 -endi -if $data37 != 1 then - return -1 -endi -if $data38 != 3 then - return -1 -endi -if $data39 != @21-03-04 01:00:00.000@ then - return -1 -endi - - - - sql select * from st0, st1 where st0.id3=st1.id3 and st1.ts=st0.ts; - if $rows != 25 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -722,112 +514,10 @@ if $data09 != @21-03-01 01:00:00.000@ then return -1 endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != 9901 then - return -1 -endi -if $data12 != 9901.000000000 then - return -1 -endi -if $data13 != 01 then - return -1 -endi -if $data14 != 0 then - return -1 -endi -if $data15 != 1 then - return -1 -endi -if $data16 != 2.000000000 then - return -1 -endi -if $data17 != 1 then - return -1 -endi -if $data18 != 3 then - return -1 -endi -if $data19 != @21-03-02 01:00:00.000@ then - return -1 -endi - - - -if $data20 != @21-03-03 01:00:00.000@ then - return -1 -endi -if $data21 != 9901 then - return -1 -endi -if $data22 != 9901.000000000 then - return -1 -endi -if $data23 != 01 then - return -1 -endi -if $data24 != 0 then - return -1 -endi -if $data25 != 1 then - return -1 -endi -if $data26 != 2.000000000 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != 3 then - return -1 -endi -if $data29 != @21-03-03 01:00:00.000@ then - return -1 -endi - - -if $data30 != @21-03-04 01:00:00.000@ then - return -1 -endi -if $data31 != 9901 then - return -1 -endi -if $data32 != 9901.000000000 then - return -1 -endi -if $data33 != 01 then - return -1 -endi -if $data34 != 0 then - return -1 -endi -if $data35 != 1 then - return -1 -endi -if $data36 != 2.000000000 then - return -1 -endi -if $data37 != 1 then - return -1 -endi -if $data38 != 3 then - return -1 -endi -if $data39 != @21-03-04 01:00:00.000@ then - return -1 -endi - - - - - sql select * from st0, st1 where st1.id5=st0.id5 and st0.ts=st1.ts; - if $rows != 25 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -860,111 +550,10 @@ if $data09 != @21-03-01 01:00:00.000@ then return -1 endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != 9901 then - return -1 -endi -if $data12 != 9901.000000000 then - return -1 -endi -if $data13 != 01 then - return -1 -endi -if $data14 != 0 then - return -1 -endi -if $data15 != 1 then - return -1 -endi -if $data16 != 2.000000000 then - return -1 -endi -if $data17 != 1 then - return -1 -endi -if $data18 != 3 then - return -1 -endi -if $data19 != @21-03-02 01:00:00.000@ then - return -1 -endi - - - -if $data20 != @21-03-03 01:00:00.000@ then - return -1 -endi -if $data21 != 9901 then - return -1 -endi -if $data22 != 9901.000000000 then - return -1 -endi -if $data23 != 01 then - return -1 -endi -if $data24 != 0 then - return -1 -endi -if $data25 != 1 then - return -1 -endi -if $data26 != 2.000000000 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != 3 then - return -1 -endi -if $data29 != @21-03-03 01:00:00.000@ then - return -1 -endi - - -if $data30 != @21-03-04 01:00:00.000@ then - return -1 -endi -if $data31 != 9901 then - return -1 -endi -if $data32 != 9901.000000000 then - return -1 -endi -if $data33 != 01 then - return -1 -endi -if $data34 != 0 then - return -1 -endi -if $data35 != 1 then - return -1 -endi -if $data36 != 2.000000000 then - return -1 -endi -if $data37 != 1 then - return -1 -endi -if $data38 != 3 then - return -1 -endi -if $data39 != @21-03-04 01:00:00.000@ then - return -1 -endi - - - - sql select st0.* from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1; - if $rows != 25 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -994,102 +583,10 @@ if $data08 != 3 then return -1 endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != 9901 then - return -1 -endi -if $data12 != 9901.000000000 then - return -1 -endi -if $data13 != 01 then - return -1 -endi -if $data14 != 0 then - return -1 -endi -if $data15 != 1 then - return -1 -endi -if $data16 != 2.000000000 then - return -1 -endi -if $data17 != 1 then - return -1 -endi -if $data18 != 3 then - return -1 -endi - - - -if $data20 != @21-03-03 01:00:00.000@ then - return -1 -endi -if $data21 != 9901 then - return -1 -endi -if $data22 != 9901.000000000 then - return -1 -endi -if $data23 != 01 then - return -1 -endi -if $data24 != 0 then - return -1 -endi -if $data25 != 1 then - return -1 -endi -if $data26 != 2.000000000 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != 3 then - return -1 -endi - - -if $data30 != @21-03-04 01:00:00.000@ then - return -1 -endi -if $data31 != 9901 then - return -1 -endi -if $data32 != 9901.000000000 then - return -1 -endi -if $data33 != 01 then - return -1 -endi -if $data34 != 0 then - return -1 -endi -if $data35 != 1 then - return -1 -endi -if $data36 != 2.000000000 then - return -1 -endi -if $data37 != 1 then - return -1 -endi -if $data38 != 3 then - return -1 -endi - - - - sql select st0.* from st0, st1 where st0.ts=st1.ts and st1.id2=st0.id2; - if $rows != 25 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -1119,103 +616,10 @@ if $data08 != 3 then return -1 endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != 9901 then - return -1 -endi -if $data12 != 9901.000000000 then - return -1 -endi -if $data13 != 01 then - return -1 -endi -if $data14 != 0 then - return -1 -endi -if $data15 != 1 then - return -1 -endi -if $data16 != 2.000000000 then - return -1 -endi -if $data17 != 1 then - return -1 -endi -if $data18 != 3 then - return -1 -endi - - - -if $data20 != @21-03-03 01:00:00.000@ then - return -1 -endi -if $data21 != 9901 then - return -1 -endi -if $data22 != 9901.000000000 then - return -1 -endi -if $data23 != 01 then - return -1 -endi -if $data24 != 0 then - return -1 -endi -if $data25 != 1 then - return -1 -endi -if $data26 != 2.000000000 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != 3 then - return -1 -endi - - -if $data30 != @21-03-04 01:00:00.000@ then - return -1 -endi -if $data31 != 9901 then - return -1 -endi -if $data32 != 9901.000000000 then - return -1 -endi -if $data33 != 01 then - return -1 -endi -if $data34 != 0 then - return -1 -endi -if $data35 != 1 then - return -1 -endi -if $data36 != 2.000000000 then - return -1 -endi -if $data37 != 1 then - return -1 -endi -if $data38 != 3 then - return -1 -endi - - - - - sql select st0.* from st0, st1 where st0.id3=st1.id3 and st1.ts=st0.ts; - if $rows != 25 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -1245,102 +649,10 @@ if $data08 != 3 then return -1 endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != 9901 then - return -1 -endi -if $data12 != 9901.000000000 then - return -1 -endi -if $data13 != 01 then - return -1 -endi -if $data14 != 0 then - return -1 -endi -if $data15 != 1 then - return -1 -endi -if $data16 != 2.000000000 then - return -1 -endi -if $data17 != 1 then - return -1 -endi -if $data18 != 3 then - return -1 -endi - - - -if $data20 != @21-03-03 01:00:00.000@ then - return -1 -endi -if $data21 != 9901 then - return -1 -endi -if $data22 != 9901.000000000 then - return -1 -endi -if $data23 != 01 then - return -1 -endi -if $data24 != 0 then - return -1 -endi -if $data25 != 1 then - return -1 -endi -if $data26 != 2.000000000 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != 3 then - return -1 -endi - - -if $data30 != @21-03-04 01:00:00.000@ then - return -1 -endi -if $data31 != 9901 then - return -1 -endi -if $data32 != 9901.000000000 then - return -1 -endi -if $data33 != 01 then - return -1 -endi -if $data34 != 0 then - return -1 -endi -if $data35 != 1 then - return -1 -endi -if $data36 != 2.000000000 then - return -1 -endi -if $data37 != 1 then - return -1 -endi -if $data38 != 3 then - return -1 -endi - - - - sql select st1.* from st0, st1 where st1.id5=st0.id5 and st0.ts=st1.ts; - if $rows != 25 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -1370,100 +682,10 @@ if $data08 != 3 then return -1 endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != 9911 then - return -1 -endi -if $data12 != 9911.000000000 then - return -1 -endi -if $data13 != 11 then - return -1 -endi -if $data14 != 0 then - return -1 -endi -if $data15 != 1 then - return -1 -endi -if $data16 != 2.000000000 then - return -1 -endi -if $data17 != 1 then - return -1 -endi -if $data18 != 3 then - return -1 -endi - - - -if $data20 != @21-03-03 01:00:00.000@ then - return -1 -endi -if $data21 != 9911 then - return -1 -endi -if $data22 != 9911.000000000 then - return -1 -endi -if $data23 != 11 then - return -1 -endi -if $data24 != 0 then - return -1 -endi -if $data25 != 1 then - return -1 -endi -if $data26 != 2.000000000 then - return -1 -endi -if $data27 != 1 then - return -1 -endi -if $data28 != 3 then - return -1 -endi - - -if $data30 != @21-03-04 01:00:00.000@ then - return -1 -endi -if $data31 != 9911 then - return -1 -endi -if $data32 != 9911.000000000 then - return -1 -endi -if $data33 != 11 then - return -1 -endi -if $data34 != 0 then - return -1 -endi -if $data35 != 1 then - return -1 -endi -if $data36 != 2.000000000 then - return -1 -endi -if $data37 != 1 then - return -1 -endi -if $data38 != 3 then - return -1 -endi - - sql select st0.f1,st1.f1 from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1; - if $rows != 25 then return -1 endi - if $data00 != 9901 then return -1 endi @@ -1489,16 +711,10 @@ if $data31 != 9911 then return -1 endi - - - sql select st0.ts,st1.ts from st0, st1 where st0.ts=st1.ts and st1.id2=st0.id2; - - if $rows != 25 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -1524,15 +740,10 @@ if $data31 != @21-03-04 01:00:00.000@ then return -1 endi - - sql select st1.ts,st0.ts,st0.id3,st1.id3,st0.f3,st1.f3 from st0, st1 where st0.id3=st1.id3 and st1.ts=st0.ts; - - if $rows != 25 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -1552,27 +763,6 @@ if $data05 != 11 then return -1 endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data02 != 2.000000000 then - return -1 -endi -if $data03 != 2.000000000 then - return -1 -endi -if $data04 != 01 then - return -1 -endi -if $data05 != 11 then - return -1 -endi - - - sql select st0.ts,st0.f2,st1.f3,st1.f2,st0.f3 from st0, st1 where st1.id5=st0.id5 and st0.ts=st1.ts; if $rows != 25 then return -1 @@ -1608,9 +798,6 @@ if $data14 != 01 then return -1 endi - - - sql select last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 interval(10a); if $rows != 25 then return -1 @@ -1642,35 +829,6 @@ endi if $data08 != 11 then return -1 endi -if $data10 != @21-03-01 02:00:00.000@ then - return -1 -endi -if $data11 != @21-03-01 02:00:00.000@ then - return -1 -endi -if $data12 != 9902 then - return -1 -endi -if $data13 != 9902.000000000 then - return -1 -endi -if $data14 != 02 then - return -1 -endi -if $data15 != @21-03-01 02:00:00.000@ then - return -1 -endi -if $data16 != 9912 then - return -1 -endi -if $data17 != 9912.000000000 then - return -1 -endi -if $data18 != 12 then - return -1 -endi - - sql select last(*) from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 interval(1d) sliding(1d); if $rows != 5 then @@ -1703,35 +861,6 @@ endi if $data08 != 15 then return -1 endi -if $data10 != @21-03-02 00:00:00.000@ then - return -1 -endi -if $data11 != @21-03-02 05:00:00.000@ then - return -1 -endi -if $data12 != 9905 then - return -1 -endi -if $data13 != 9905.000000000 then - return -1 -endi -if $data14 != 05 then - return -1 -endi -if $data15 != @21-03-02 05:00:00.000@ then - return -1 -endi -if $data16 != 9915 then - return -1 -endi -if $data17 != 9915.000000000 then - return -1 -endi -if $data18 != 15 then - return -1 -endi - - sql select st0.*,st1.* from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1; if $rows != 25 then @@ -1769,11 +898,7 @@ if $data09 != @21-03-01 01:00:00.000@ then endi - - - sql select st0.ts,* from st0, st1 where st0.ts=st1.ts and st0.id1=st1.id1 order by st0.ts; - if $rows != 25 then return -1 endi @@ -1844,8 +969,6 @@ if $data09 != @21-03-01 01:00:00.000@ then return -1 endi - - sql select top(st1.f1, 5) from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1; if $rows != 5 then return -1 @@ -1881,10 +1004,6 @@ if $data41 != 9915 then return -1 endi - - - - sql select top(st0.f1,5) from st0, st1 where st1.id1=st0.id1 and st0.ts=st1.ts and st1.ts=st0.ts and st0.id1=st1.id1; if $rows != 5 then return -1 @@ -1920,7 +1039,6 @@ if $data41 != 9905 then return -1 endi - #sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st3.id1 and st3.ts=st2.ts and st2.id1=st1.id1 and st1.ts=st0.ts; #sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st3.id1 and st3.ts=st2.ts and st2.id1=st1.id1 and st1.ts=st0.ts and st0.id1=st2.id1 and st1.ts=st2.ts; #if $rows != 25 then @@ -1958,8 +1076,6 @@ endi # return -1 #endi - - #sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st1.id1 and st1.ts=st0.ts and st2.id1=st3.id1 and st3.ts=st2.ts; #sql select st0.*,st1.*,st2.*,st3.* from st3,st2,st1,st0 where st0.id1=st1.id1 and st1.ts=st0.ts and st2.id1=st3.id1 and st3.ts=st2.ts and st0.id1=st2.id1 and st0.ts=st2.ts; #if $rows != 25 then @@ -1996,8 +1112,6 @@ endi # return -1 #endi - - sql select st0.*,st1.*,st2.*,st3.*,st4.*,st5.*,st6.*,st7.*,st8.*,st9.* from st0,st1,st2,st3,st4,st5,st6,st7,st8,st9 where st0.ts=st2.ts and st0.ts=st4.ts and st0.ts=st6.ts and st0.ts=st8.ts and st1.ts=st3.ts and st3.ts=st5.ts and st5.ts=st7.ts and st7.ts=st9.ts and st0.ts=st1.ts and st0.id1=st2.id1 and st0.id1=st4.id1 and st0.id1=st6.id1 and st0.id1=st8.id1 and st1.id1=st3.id1 and st3.id1=st5.id1 and st5.id1=st7.id1 and st7.id1=st9.id1 and st0.id1=st1.id1; if $rows != 25 then return -1 @@ -2033,8 +1147,6 @@ if $data09 != @21-03-01 01:00:00.000@ then return -1 endi - - sql select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts; if $rows != 5 then return -1 @@ -2088,8 +1200,6 @@ if $data17 != 11 then return -1 endi - - sql select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts and tb0_1.id1=tb1_1.id1; if $rows != 5 then return -1 @@ -2143,20 +1253,15 @@ if $data17 != 11 then return -1 endi - sql select tb0_1.*, tb1_2.*,tb2_3.*,tb3_4.*,tb4_5.* from tb0_1, tb1_2, tb2_3, tb3_4, tb4_5 where tb0_1.ts=tb1_2.ts and tb0_1.ts=tb2_3.ts and tb0_1.ts=tb3_4.ts and tb0_1.ts=tb4_5.ts; if $rows != 0 then return -1 endi - - sql select tb0_1.*, tb1_1.*,tb2_1.*,tb3_1.*,tb4_1.* from tb0_1, tb1_1, tb2_1, tb3_1, tb4_1 where tb0_1.ts=tb1_1.ts and tb0_1.ts=tb2_1.ts and tb0_1.ts=tb3_1.ts and tb0_1.ts=tb4_1.ts; - if $rows != 5 then return -1 endi - if $data00 != @21-03-01 01:00:00.000@ then return -1 endi @@ -2186,46 +1291,12 @@ if $data08 != @21-03-01 01:00:00.000@ then endi if $data09 != 9921 then return -1 -endi -if $data10 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data11 != 9901 then - return -1 -endi -if $data12 != 9901.000000000 then - return -1 -endi -if $data13 != 01 then - return -1 -endi -if $data14 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data15 != 9911 then - return -1 -endi -if $data16 != 9911.000000000 then - return -1 -endi -if $data17 != 11 then - return -1 -endi -if $data18 != @21-03-02 01:00:00.000@ then - return -1 -endi -if $data19 != 9921 then - return -1 -endi - - +endi sql select tb0_5.*, tb1_5.*,tb2_5.*,tb3_5.*,tb4_5.*,tb5_5.*, tb6_5.*,tb7_5.*,tb8_5.*,tb9_5.* from tb0_5, tb1_5, tb2_5, tb3_5, tb4_5,tb5_5, tb6_5, tb7_5, tb8_5, tb9_5 where tb9_5.ts=tb8_5.ts and tb8_5.ts=tb7_5.ts and tb7_5.ts=tb6_5.ts and tb6_5.ts=tb5_5.ts and tb5_5.ts=tb4_5.ts and tb4_5.ts=tb3_5.ts and tb3_5.ts=tb2_5.ts and tb2_5.ts=tb1_5.ts and tb1_5.ts=tb0_5.ts; - if $rows != 5 then return -1 endi - if $data00 != @21-03-01 05:00:00.000@ then return -1 endi @@ -2255,37 +1326,7 @@ if $data08 != @21-03-01 05:00:00.000@ then endi if $data09 != 9925 then return -1 -endi -if $data10 != @21-03-02 05:00:00.000@ then - return -1 -endi -if $data11 != 9905 then - return -1 -endi -if $data12 != 9905.000000000 then - return -1 -endi -if $data13 != 05 then - return -1 -endi -if $data14 != @21-03-02 05:00:00.000@ then - return -1 -endi -if $data15 != 9915 then - return -1 -endi -if $data16 != 9915.000000000 then - return -1 -endi -if $data17 != 15 then - return -1 -endi -if $data18 != @21-03-02 05:00:00.000@ then - return -1 -endi -if $data19 != 9925 then - return -1 -endi +endi sql_error select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.f1=tb1_1.f1; sql_error select tb0_1.*, tb1_1.* from tb0_1, tb1_1 where tb0_1.ts=tb1_1.ts and tb0_1.id1=tb1_1.id2; diff --git a/tests/script/tsim/tag/add.sim b/tests/script/tsim/tag/add.sim index a22d337eff..c08ae0ff4c 100644 --- a/tests/script/tsim/tag/add.sim +++ b/tests/script/tsim/tag/add.sim @@ -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 tgcol6 bigint -return -sql alter table $mt add tag tgcol7 bigint -x step141 - return -1 -step141: -sql reset query cache + sql reset query cache sql alter table $mt drop tag tgcol6 sql alter table $mt add tag tgcol7 bigint -sql alter table $mt add tag tgcol8 bigint -x step142 - return -1 -step142: +sql alter table $mt add tag tgcol8 bigint print =============== clear sql drop database $db diff --git a/tests/script/tsim/tag/create.sim b/tests/script/tsim/tag/create.sim index e25f1eb71f..da683389cb 100644 --- a/tests/script/tsim/tag/create.sim +++ b/tests/script/tsim/tag/create.sim @@ -179,7 +179,7 @@ $tb = $tbPrefix . $i sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol bool, tgcol2 bool) sql create table $tb using $mt tags( 1, 2 ) 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 print expect 1, actual: $rows return -1 @@ -453,7 +453,7 @@ endi if $data01 != 1 then return -1 endi -sql select * from $mt where tgcol2 = 2 +sql select * from $mt where tgcol2 = 1 if $rows != 1 then return -1 endi diff --git a/tests/script/tsim/valgrind/basic1.sim b/tests/script/tsim/valgrind/basic1.sim index a259dd9219..2d70284c8b 100644 --- a/tests/script/tsim/valgrind/basic1.sim +++ b/tests/script/tsim/valgrind/basic1.sim @@ -45,17 +45,7 @@ while $i < $tbNum endw print =============== step3: tb -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) +sql select _wstart, count(*) from tb1 session(ts,1m) _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/basic2.sim b/tests/script/tsim/valgrind/basic2.sim index 7c905209ee..522070f487 100644 --- a/tests/script/tsim/valgrind/basic2.sim +++ b/tests/script/tsim/valgrind/basic2.sim @@ -1,7 +1,6 @@ system sh/stop_dnodes.sh 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 +system sh/exec.sh -n dnode1 -s start -v sql connect print =============== step1: create drop show dnodes @@ -42,53 +41,16 @@ while $i < $tbNum sql insert into $tb values ($ms , $x , $x , $x ) $x = $x + 1 endw - - $cc = $x * 60000 - $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , NULL , NULL , NULL ) $i = $i + 1 endw -system sh/exec.sh -n dnode1 -s stop -x SIGINT -system sh/exec.sh -n dnode1 -s start -v - print =============== step3: tb -sql select avg(tbcol) from tb1 -sql select avg(tbcol) from tb1 where ts <= 1601481840000 -sql select avg(tbcol) as b from tb1 -sql select avg(tbcol) as b from tb1 interval(1d) -sql select avg(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) -sql select bottom(tbcol, 2) from tb1 where ts <= 1601481840000 -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 +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); _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/checkError5.sim b/tests/script/tsim/valgrind/checkError5.sim index f0786587d9..bf3f9a1b0b 100644 --- a/tests/script/tsim/valgrind/checkError5.sim +++ b/tests/script/tsim/valgrind/checkError5.sim @@ -100,11 +100,13 @@ sql select * from db.stb sql select * from db.stb sql_error create table db.ctb2 using db.stb tags(101, "102") sql create table db.ctb2 using db.stb tags(101, 102, "103", 104) -sql insert into db.ctb2 values(now, 1, 2, 3) +sql insert into db.ctb2 values(now, 1, 2, 3) print =============== step6: query data 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 sql create database d1 replica 1 duration 7 keep 50 diff --git a/tests/script/tsim/valgrind/checkError6.sim b/tests/script/tsim/valgrind/checkError6.sim index ec8ca0ad8c..7a16f5668a 100644 --- a/tests/script/tsim/valgrind/checkError6.sim +++ b/tests/script/tsim/valgrind/checkError6.sim @@ -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 * from stb where tbcol not in (1,2,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 +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 $null= diff --git a/tests/script/tsim/query/udf.sim b/tests/script/tsim/valgrind/checkUdf.sim similarity index 91% rename from tests/script/tsim/query/udf.sim rename to tests/script/tsim/valgrind/checkUdf.sim index 5d69887c86..1026bad3d0 100644 --- a/tests/script/tsim/query/udf.sim +++ b/tests/script/tsim/valgrind/checkUdf.sim @@ -1,8 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c udf -v 1 - -print ========= start dnode1 as leader system sh/exec.sh -n dnode1 -s start sql connect @@ -149,4 +147,18 @@ if $rows != 0 then return -1 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 + diff --git a/tests/system-test/1-insert/create_retentions.py b/tests/system-test/1-insert/create_retentions.py index 2b611420c6..96f9ea51ef 100644 --- a/tests/system-test/1-insert/create_retentions.py +++ b/tests/system-test/1-insert/create_retentions.py @@ -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.sql import * from util.cases import * from util.dnodes import * +from util.common import * PRIMARY_COL = "ts" @@ -24,44 +24,24 @@ BINARY_COL = "c_binary" NCHAR_COL = "c_nchar" 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" -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] ## insert data args: TIME_STEP = 10000 -NOW = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) +NOW = int(datetime.timestamp(datetime.now()) * 1000) # init db/table DBNAME = "db" +DB1 = "db1" +DB2 = "db2" +DB3 = "db3" +DB4 = "db4" STBNAME = "stb1" CTBNAME = "ct1" 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: def init(self, conn, logSql): @@ -83,8 +63,8 @@ class TDTestCase: @property def create_databases_sql_current(self): return [ - "create database db1 retentions 1s:1d", - "create database db2 retentions 1s:1d,2m:2d,3h:3d", + f"create database {DB1} retentions 1s:1d", + f"create database {DB2} retentions 1s:1d,2m:2d,3h:3d", ] @property @@ -95,21 +75,22 @@ class TDTestCase: ] @property - def create_stable_sql_err(self): + def create_stable_sql_err(self, dbname=DB2): return [ - f"create stable 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 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 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 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 table 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 stable stb24 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) " , - f"create stable stb25 ({PRIMARY_COL} timestamp, {INT_COL} int) " , - f"create stable stb26 ({PRIMARY_COL} timestamp, {INT_COL} int, {BINARY_COL} nchar(16)) " , + f"create stable {dbname}.stb11 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(ceil) watermark 1s max_delay 1m", + f"create stable {dbname}.stb12 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(count) watermark 1min", + f"create stable {dbname}.stb13 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) max_delay -1s", + f"create stable {dbname}.stb14 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) rollup(min) watermark -1m", + f"create stable {dbname}.stb15 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) watermark 1m ", + f"create stable {dbname}.stb16 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) max_delay 1m ", + 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 {dbname}.stb22 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) tags (tag1 int) rollup(avg) max_delay 1m", + 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 table {dbname}.ntb_2 ({PRIMARY_COL} timestamp, {INT_COL} int) " , + f"create stable {dbname}.stb23 ({PRIMARY_COL} timestamp, {INT_COL} int, {NCHAR_COL} nchar(16)) tags (tag1 int) " , + f"create stable {dbname}.stb24 ({PRIMARY_COL} timestamp, {INT_COL} int) tags (tag1 int) " , + 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, ?] 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})", ] - def test_create_stb(self, db="db2"): + def test_create_stb(self, db=DB2): tdSql.execute(f"use {db}") for err_sql in self.create_stable_sql_err: tdSql.error(err_sql) @@ -146,7 +127,7 @@ class TDTestCase: 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.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): @@ -162,94 +143,83 @@ class TDTestCase: self.test_create_databases() 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") - create_stb_sql = f'''create table {stb}( - ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, - {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, - {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp, - {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned, - {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned - ) tags ({INT_TAG} int) - ''' - for i in range(ntbnum): - - create_ntb_sql = f'''create table nt{i+1}( + 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, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp, {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned, {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned - ) + ) tags ({INT_TAG} int) ''' - tdSql.execute(create_stb_sql) - tdSql.execute(create_ntb_sql) + tdSql.execute(create_stb_sql) + + 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, + {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, + {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp, + {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned, + {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned + ) + ''' + tdSql.execute(create_ntb_sql) 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): - data_set = DataSet() + def __insert_data(self, rows, ctb_num=20, dbname=DBNAME, rsma=False, rsma_type="sum"): + 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): - data_set.ts_data.append(NOW + 1 * (rows - i)) - data_set.int_data.append(rows - i) - 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)}') + if rsma: + if rsma_type.lower().strip() in ("last", "first"): + 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.utint_data[i]}, {data.usint_data[i]}, {data.uint_data[i]}, {data.ubint_data[i]}, '{data.vchar_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.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} )" ) - 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''' - {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.sint_un_data[i]}, {data.int_un_data[i]}, {data.bint_un_data[i]} - ''' - neg_row_data = f''' - {-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]}, - {data.bool_data[i]}, '{data.binary_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {1 * data.tint_un_data[i]}, - {1 * data.sint_un_data[i]}, {1 * data.int_un_data[i]}, {1 * data.bint_un_data[i]} - ''' - - 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} )" ) - tdSql.execute( f"insert into ct2 values ( {NOW - (self.rows + 1) * int(TIME_STEP * 0.6)}, {null_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} )" ) + for j in range(ctb_num): + tdSql.execute( f"insert into {dbname}.ct{j+1} values ( {NOW - i * TIME_STEP}, {row_data} )" ) def run(self): self.rows = 10 - tdSql.prepare() + tdSql.prepare(dbname=DBNAME) tdLog.printNoPrefix("==========step0:all check") self.all_test() @@ -257,26 +227,94 @@ class TDTestCase: tdLog.printNoPrefix("==========step1:create table in normal database") tdSql.prepare() self.__create_tb() - self.__insert_data() - # return + self.__insert_data(rows=self.rows) 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 ") - tdSql.execute("drop database if exists db2 ") + db3_ctb_num = 10 + 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") - self.test_create_stb(db="db3") - # self.__create_tb() - # self.__insert_data() - self.all_test() + # from ...pytest.util.sql import tdSql - tdSql.execute("drop database if exists db1 ") - tdSql.execute("drop database if exists db2 ") + tdLog.printNoPrefix("==========step2.1.1 : alter stb schemaL drop column") + 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 ") self.all_test() diff --git a/tests/system-test/2-query/csum.py b/tests/system-test/2-query/csum.py index 260528be04..f38a99d809 100644 --- a/tests/system-test/2-query/csum.py +++ b/tests/system-test/2-query/csum.py @@ -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=" + 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=", 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 - stb_join = { - "col": "stb1.c1", - "table_expr": "stb1, stb2", - "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 + #stb_join = { + # "col": "stb1.c1", + # "table_expr": "stb1, stb2", + # "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 interval_sql = { "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.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): tdSql.query(" select csum(1) from db.stb1 ") tdSql.checkRows(70) @@ -474,6 +487,7 @@ class TDTestCase: # tdSql.checkRows(4) + def run(self): import traceback try: diff --git a/tests/system-test/2-query/function_stateduration.py b/tests/system-test/2-query/function_stateduration.py index 3478b7fef9..9762b66ba7 100644 --- a/tests/system-test/2-query/function_stateduration.py +++ b/tests/system-test/2-query/function_stateduration.py @@ -104,8 +104,6 @@ class TDTestCase: "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) , 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: tdSql.error(error_sql) @@ -226,18 +224,24 @@ class TDTestCase: tdSql.query("select stateduration(c6,'GT',1,1s) from ct4") tdSql.checkRows(12) - tdSql.error("select stateduration(c6,'GT',1,1s),tbname from ct1") - tdSql.error("select stateduration(c6,'GT',1,1s),t1 from ct1") + tdSql.query("select stateduration(c6,'GT',1,1s),tbname from ct1") + tdSql.checkRows(13) + tdSql.query("select stateduration(c6,'GT',1,1s),t1 from ct1") + tdSql.checkRows(13) # unique with common col - tdSql.error("select stateduration(c6,'GT',1,1s) ,ts from ct1") - tdSql.error("select stateduration(c6,'GT',1,1s) ,c1 from ct1") + tdSql.query("select stateduration(c6,'GT',1,1s) ,ts from ct1") + tdSql.checkRows(13) + tdSql.query("select stateduration(c6,'GT',1,1s) ,c1 from ct1") + tdSql.checkRows(13) # unique with scalar function - tdSql.error("select stateduration(c6,'GT',1,1s) ,abs(c1) from ct1") - tdSql.error("select stateduration(c6,'GT',1,1s) , unique(c2) from ct1") - tdSql.error("select stateduration(c6,'GT',1,1s) , abs(c2)+2 from ct1") + tdSql.query("select stateduration(c6,'GT',1,1s) , abs(c1) from ct1") + tdSql.checkRows(13) + 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 tdSql.error("select stateduration(c6,'GT',1,1s) ,sum(c1) from ct1") diff --git a/tests/system-test/2-query/statecount.py b/tests/system-test/2-query/statecount.py index 91e2aa9e47..a88c4aef9f 100644 --- a/tests/system-test/2-query/statecount.py +++ b/tests/system-test/2-query/statecount.py @@ -105,8 +105,6 @@ class TDTestCase: "select statecount(c1 ,'GT',1) , min(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) , abs(c1) from t1", - "select statecount(c1 ,'GT',1) , c1 from t1", ] for error_sql in error_sql_lists: tdSql.error(error_sql) @@ -227,17 +225,56 @@ class TDTestCase: tdSql.query("select statecount(c6,'GT',1) from ct4") tdSql.checkRows(12) - tdSql.error("select statecount(c6,'GT',1),tbname from ct1") - tdSql.error("select statecount(c6,'GT',1),t1 from ct1") + tdSql.query("select statecount(c6,'GT',1),tbname from ct1") + tdSql.checkRows(13) + tdSql.query("select statecount(c6,'GT',1),t1 from ct1") + tdSql.checkRows(13) # unique with common col - tdSql.error("select statecount(c6,'GT',1) ,ts from ct1") - tdSql.error("select statecount(c6,'GT',1) ,c1 from ct1") + tdSql.query("select statecount(c6,'GT',1) ,ts 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 - 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) , 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 diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index 75e3664bbd..3fc38ac898 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -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/create_retentions.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 @@ -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/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/function_diff.py python3 ./test.py -f 2-query/unique.py @@ -189,9 +190,9 @@ python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 6 -M 3 -C 5 # python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 # python3 test.py -f 6-cluster/5dnode3mnodeStopConnect.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeRecreateMnode.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStopFollowerLeader.py -N 5 -M 3 +python3 ./test.py -f 6-cluster/5dnode3mnodeStop2Follower.py -N 5 -M 3 # vnode case # python3 test.py -f 6-cluster/vnode/4dnode1mnode_basic_createDb_replica1.py -N 4 -M 1 @@ -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/elapsed.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/function_diff.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/elapsed.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/function_diff.py -Q 3 python3 ./test.py -f 2-query/unique.py -Q 3 @@ -451,4 +452,4 @@ python3 ./test.py -f 2-query/count_partition.py -Q 3 python3 ./test.py -f 2-query/max_partition.py -Q 3 python3 ./test.py -f 2-query/last_row.py -Q 3 python3 ./test.py -f 2-query/tsbsQuery.py -Q 3 -python3 ./test.py -f 2-query/sml.py -Q 3 \ No newline at end of file +python3 ./test.py -f 2-query/sml.py -Q 3