提交 1a8ac1c1 编写于 作者: C Cary Xu

Merge branch 'develop' into hotfix/TS-854-D

...@@ -113,7 +113,7 @@ TDengine is a highly efficient platform to store, query, and analyze time-series ...@@ -113,7 +113,7 @@ TDengine is a highly efficient platform to store, query, and analyze time-series
- [System Connection and Task Query Management](/administrator#status): show the system connections, queries, streaming calculation and others - [System Connection and Task Query Management](/administrator#status): show the system connections, queries, streaming calculation and others
- [System Monitor](/administrator#monitoring): monitor TDengine cluster with log database and TDinsight. - [System Monitor](/administrator#monitoring): monitor TDengine cluster with log database and TDinsight.
- [File Directory Structure](/administrator#directories): directories where TDengine data files and configuration files located - [File Directory Structure](/administrator#directories): directories where TDengine data files and configuration files located
- [Parameter Limitss and Reserved Keywords](/administrator#keywords): TDengine’s list of parameter limits and reserved keywords - [Parameter Limits and Reserved Keywords](/administrator#keywords): TDengine’s list of parameter limits and reserved keywords
## Performance: TDengine vs Others ## Performance: TDengine vs Others
......
Since TDengine was open sourced in July 2019, it has gained a lot of popularity among time-series database developers with its innovative data modeling design, simple installation mehtod, easy programming interface, and powerful data insertion and query performance. The insertion and querying performance is often astonishing to users who are new to TDengine. In order to help users to experience the high performance and functions of TDengine in the shortest time, we developed an application called taosdemo for insertion and querying performance testing of TDengine. Then user can easily simulate the scenario of a large number of devices generating a very large amount of data. User can easily maniplate the number of columns, data types, disorder ratio, and number of concurrent threads with taosdemo customized parameters. Since TDengine was open sourced in July 2019, it has gained a lot of popularity among time-series database developers with its innovative data modeling design, simple installation method, easy programming interface, and powerful data insertion and query performance. The insertion and querying performance is often astonishing to users who are new to TDengine. In order to help users to experience the high performance and functions of TDengine in the shortest time, we developed an application called taosdemo for insertion and querying performance testing of TDengine. Then user can easily simulate the scenario of a large number of devices generating a very large amount of data. User can easily manipulate the number of columns, data types, disorder ratio, and number of concurrent threads with taosdemo customized parameters.
Running taosdemo is very simple. Just download the TDengine installation package (https://www.taosdata.com/cn/all-downloads/) or compiling the TDengine code yourself (https://github.com/taosdata/TDengine). It can be found and run in the installation directory or in the compiled results directory. Running taosdemo is very simple. Just download the TDengine installation package (https://www.taosdata.com/cn/all-downloads/) or compiling the TDengine code yourself (https://github.com/taosdata/TDengine). It can be found and run in the installation directory or in the compiled results directory.
...@@ -221,7 +221,7 @@ To reach TDengine performance limits, data insertion can be executed by using mu ...@@ -221,7 +221,7 @@ To reach TDengine performance limits, data insertion can be executed by using mu
``` ```
-t, --tables=NUMBER The number of tables. Default is 10000. -t, --tables=NUMBER The number of tables. Default is 10000.
-n, --records=NUMBER The number of records per table. Default is 10000. -n, --records=NUMBER The number of records per table. Default is 10000.
-M, --random The value of records generated are totally random. The default is to simulate power equipment senario. -M, --random The value of records generated are totally random. The default is to simulate power equipment scenario.
``` ```
As mentioned earlier, taosdemo creates 10,000 tables by default, and each table writes 10,000 records. taosdemo can set the number of tables and the number of records in each table by -t and -n. The data generated by default without parameters are simulated real scenarios, and the simulated data are current and voltage phase values with certain jitter, which can more realistically show TDengine's efficient data compression ability. If you need to simulate the generation of completely random data, you can pass the -M parameter. As mentioned earlier, taosdemo creates 10,000 tables by default, and each table writes 10,000 records. taosdemo can set the number of tables and the number of records in each table by -t and -n. The data generated by default without parameters are simulated real scenarios, and the simulated data are current and voltage phase values with certain jitter, which can more realistically show TDengine's efficient data compression ability. If you need to simulate the generation of completely random data, you can pass the -M parameter.
``` ```
......
...@@ -193,7 +193,7 @@ A complete TDengine system runs on one or more physical nodes. Logically, it inc ...@@ -193,7 +193,7 @@ A complete TDengine system runs on one or more physical nodes. Logically, it inc
**Redirection**: No matter about dnode or TAOSC, the connection to the mnode shall be initiated first, but the mnode is automatically created and maintained by the system, so the user does not know which dnode is running the mnode. TDengine only requires a connection to any working dnode in the system. Because any running dnode maintains the currently running mnode EP List, when receiving a connecting request from the newly started dnode or TAOSC, if it’s not a mnode by self, it will reply to the mnode EP List back. After receiving this list, TAOSC or the newly started dnode will try to establish the connection again. When the mnode EP List changes, each data node quickly obtains the latest list and notifies TAOSC through messaging interaction among nodes. **Redirection**: No matter about dnode or TAOSC, the connection to the mnode shall be initiated first, but the mnode is automatically created and maintained by the system, so the user does not know which dnode is running the mnode. TDengine only requires a connection to any working dnode in the system. Because any running dnode maintains the currently running mnode EP List, when receiving a connecting request from the newly started dnode or TAOSC, if it’s not a mnode by self, it will reply to the mnode EP List back. After receiving this list, TAOSC or the newly started dnode will try to establish the connection again. When the mnode EP List changes, each data node quickly obtains the latest list and notifies TAOSC through messaging interaction among nodes.
### A Typical Data Writinfg Process ### A Typical Data Writing Process
To explain the relationship between vnode, mnode, TAOSC and application and their respective roles, the following is an analysis of a typical data writing process. To explain the relationship between vnode, mnode, TAOSC and application and their respective roles, the following is an analysis of a typical data writing process.
...@@ -244,7 +244,7 @@ The meta data of each table (including schema, tags, etc.) is also stored in vno ...@@ -244,7 +244,7 @@ The meta data of each table (including schema, tags, etc.) is also stored in vno
### Data Partitioning ### Data Partitioning
In addition to vnode sharding, TDengine partitions the time-series data by time range. Each data file contains only one time range of time-series data, and the length of the time range is determined by DB's configuration parameter `“days”`. This method of partitioning by time rang is also convenient to efficiently implement the data retention policy. As long as the data file exceeds the specified number of days (system configuration parameter `“keep”`), it will be automatically deleted. Moreover, different time ranges can be stored in different paths and storage media, so as to facilitate the tiered-storage. Cold/hot data can be stored in different storage meida to reduce the storage cost. In addition to vnode sharding, TDengine partitions the time-series data by time range. Each data file contains only one time range of time-series data, and the length of the time range is determined by DB's configuration parameter `“days”`. This method of partitioning by time rang is also convenient to efficiently implement the data retention policy. As long as the data file exceeds the specified number of days (system configuration parameter `“keep”`), it will be automatically deleted. Moreover, different time ranges can be stored in different paths and storage media, so as to facilitate the tiered-storage. Cold/hot data can be stored in different storage media to reduce the storage cost.
In general, **TDengine splits big data by vnode and time range in two dimensions** to manage the data efficiently with horizontal scalability. In general, **TDengine splits big data by vnode and time range in two dimensions** to manage the data efficiently with horizontal scalability.
......
...@@ -182,7 +182,7 @@ In the output plugins section, add the [[outputs.http]] configuration: ...@@ -182,7 +182,7 @@ In the output plugins section, add the [[outputs.http]] configuration:
In agent section: In agent section:
- hostname: The machine name that distinguishes different collection devices, and it is necessary to ensure its uniqueness - hostname: The machine name that distinguishes different collection devices, and it is necessary to ensure its uniqueness
- metric_batch_size: 100, which is the max number of records per batch wriiten by Telegraf allowed. Increasing the number can reduce the request sending frequency of Telegraf. - metric_batch_size: 100, which is the max number of records per batch written by Telegraf allowed. Increasing the number can reduce the request sending frequency of Telegraf.
For information on how to use Telegraf to collect data and more about using Telegraf, please refer to the official [document](https://docs.influxdata.com/telegraf/v1.11/) of Telegraf. For information on how to use Telegraf to collect data and more about using Telegraf, please refer to the official [document](https://docs.influxdata.com/telegraf/v1.11/) of Telegraf.
......
...@@ -11,7 +11,7 @@ TDengine uses SQL as the query language. Applications can send SQL statements th ...@@ -11,7 +11,7 @@ TDengine uses SQL as the query language. Applications can send SQL statements th
- Time stamp aligned join query (implicit join) operations - Time stamp aligned join query (implicit join) operations
- Multiple aggregation/calculation functions: count, max, min, avg, sum, twa, stddev, leastsquares, top, bottom, first, last, percentile, apercentile, last_row, spread, diff, etc - Multiple aggregation/calculation functions: count, max, min, avg, sum, twa, stddev, leastsquares, top, bottom, first, last, percentile, apercentile, last_row, spread, diff, etc
For example, in TAOS shell, the records with vlotage > 215 are queried from table d1001, sorted in descending order by timestamps, and only two records are outputted. For example, in TAOS shell, the records with voltage > 215 are queried from table d1001, sorted in descending order by timestamps, and only two records are outputted.
```mysql ```mysql
taos> select * from d1001 where voltage > 215 order by ts desc limit 2; taos> select * from d1001 where voltage > 215 order by ts desc limit 2;
......
...@@ -110,10 +110,10 @@ First, use `taos_subscribe` to create a subscription: ...@@ -110,10 +110,10 @@ First, use `taos_subscribe` to create a subscription:
```c ```c
TAOS_SUB* tsub = NULL; TAOS_SUB* tsub = NULL;
if (async) { if (async) {
  // create an asynchronized subscription, the callback function will be called every 1s   // create an asynchronous subscription, the callback function will be called every 1s
  tsub = taos_subscribe(taos, restart, topic, sql, subscribe_callback, &blockFetch, 1000);   tsub = taos_subscribe(taos, restart, topic, sql, subscribe_callback, &blockFetch, 1000);
} else { } else {
  // create an synchronized subscription, need to call 'taos_consume' manually   // create an synchronous subscription, need to call 'taos_consume' manually
  tsub = taos_subscribe(taos, restart, topic, sql, NULL, NULL, 0);   tsub = taos_subscribe(taos, restart, topic, sql, NULL, NULL, 0);
} }
``` ```
...@@ -201,7 +201,7 @@ taos_unsubscribe(tsub, keep); ...@@ -201,7 +201,7 @@ taos_unsubscribe(tsub, keep);
Its second parameter is used to decide whether to keep the progress information of subscription on the client. If this parameter is **false** (zero), the subscription can only be restarted no matter what the `restart` parameter is when `taos_subscribe` is called next time. In addition, progress information is saved in the directory {DataDir}/subscribe/. Each subscription has a file with the same name as its `topic`. Deleting a file will also lead to a new start when the corresponding subscription is created next time. Its second parameter is used to decide whether to keep the progress information of subscription on the client. If this parameter is **false** (zero), the subscription can only be restarted no matter what the `restart` parameter is when `taos_subscribe` is called next time. In addition, progress information is saved in the directory {DataDir}/subscribe/. Each subscription has a file with the same name as its `topic`. Deleting a file will also lead to a new start when the corresponding subscription is created next time.
After introducing the code, let's take a look at the actual running effect. For exmaple: After introducing the code, let's take a look at the actual running effect. For example:
- Sample code has been downloaded locally - Sample code has been downloaded locally
- TDengine has been installed on the same machine - TDengine has been installed on the same machine
......
...@@ -54,33 +54,33 @@ INSERT INTO test.t1 USING test.weather (ts, temperature) TAGS('beijing') VALUES( ...@@ -54,33 +54,33 @@ INSERT INTO test.t1 USING test.weather (ts, temperature) TAGS('beijing') VALUES(
## JDBC driver version and supported TDengine and JDK versions ## JDBC driver version and supported TDengine and JDK versions
| taos-jdbcdriver | TDengine | JDK | | taos-jdbcdriver | TDengine | JDK |
| -------------------- | ----------------- | -------- | | --------------- | ------------------ | ----- |
| 2.0.33 - 2.0.34 | 2.0.3.0 and above | 1.8.x | | 2.0.33 - 2.0.34 | 2.0.3.0 and above | 1.8.x |
| 2.0.31 - 2.0.32 | 2.1.3.0 and above | 1.8.x | | 2.0.31 - 2.0.32 | 2.1.3.0 and above | 1.8.x |
| 2.0.22 - 2.0.30 | 2.0.18.0 - 2.1.2.x | 1.8.x | | 2.0.22 - 2.0.30 | 2.0.18.0 - 2.1.2.x | 1.8.x |
| 2.0.12 - 2.0.21 | 2.0.8.0 - 2.0.17.x | 1.8.x | | 2.0.12 - 2.0.21 | 2.0.8.0 - 2.0.17.x | 1.8.x |
| 2.0.4 - 2.0.11 | 2.0.0.0 - 2.0.7.x | 1.8.x | | 2.0.4 - 2.0.11 | 2.0.0.0 - 2.0.7.x | 1.8.x |
| 1.0.3 | 1.6.1.x and above | 1.8.x | | 1.0.3 | 1.6.1.x and above | 1.8.x |
| 1.0.2 | 1.6.1.x and above | 1.8.x | | 1.0.2 | 1.6.1.x and above | 1.8.x |
| 1.0.1 | 1.6.1.x and above | 1.8.x | | 1.0.1 | 1.6.1.x and above | 1.8.x |
## DataType in TDengine and Java connector ## DataType in TDengine and Java connector
The TDengine supports the following data types and Java data types: The TDengine supports the following data types and Java data types:
| TDengine DataType | JDBCType (driver version < 2.0.24) | JDBCType (driver version >= 2.0.24) | | TDengine DataType | JDBCType (driver version < 2.0.24) | JDBCType (driver version >= 2.0.24) |
| ----------------- | ------------------ | ------------------ | | ----------------- | ---------------------------------- | ----------------------------------- |
| TIMESTAMP | java.lang.Long | java.sql.Timestamp | | TIMESTAMP | java.lang.Long | java.sql.Timestamp |
| INT | java.lang.Integer | java.lang.Integer | | INT | java.lang.Integer | java.lang.Integer |
| BIGINT | java.lang.Long | java.lang.Long | | BIGINT | java.lang.Long | java.lang.Long |
| FLOAT | java.lang.Float | java.lang.Float | | FLOAT | java.lang.Float | java.lang.Float |
| DOUBLE | java.lang.Double | java.lang.Double | | DOUBLE | java.lang.Double | java.lang.Double |
| SMALLINT | java.lang.Short | java.lang.Short | | SMALLINT | java.lang.Short | java.lang.Short |
| TINYINT | java.lang.Byte | java.lang.Byte | | TINYINT | java.lang.Byte | java.lang.Byte |
| BOOL | java.lang.Boolean | java.lang.Boolean | | BOOL | java.lang.Boolean | java.lang.Boolean |
| BINARY | java.lang.String | byte array | | BINARY | java.lang.String | byte array |
| NCHAR | java.lang.String | java.lang.String | | NCHAR | java.lang.String | java.lang.String |
## Install Java connector ## Install Java connector
...@@ -448,7 +448,7 @@ public static void main(String[] args) throws SQLException { ...@@ -448,7 +448,7 @@ public static void main(String[] args) throws SQLException {
config.setMinimumIdle(10); //minimum number of idle connection config.setMinimumIdle(10); //minimum number of idle connection
config.setMaximumPoolSize(10); //maximum number of connection in the pool config.setMaximumPoolSize(10); //maximum number of connection in the pool
config.setConnectionTimeout(30000); //maximum wait milliseconds for get connection from pool config.setConnectionTimeout(30000); //maximum wait milliseconds for get connection from pool
config.setMaxLifetime(0); // maximum life time for each connection config.setMaxLifetime(0); // maximum lifetime for each connection
config.setIdleTimeout(0); // max idle time for recycle idle connection config.setIdleTimeout(0); // max idle time for recycle idle connection
config.setConnectionTestQuery("select server_status()"); //validation query config.setConnectionTestQuery("select server_status()"); //validation query
HikariDataSource ds = new HikariDataSource(config); //create datasource HikariDataSource ds = new HikariDataSource(config); //create datasource
...@@ -456,7 +456,7 @@ public static void main(String[] args) throws SQLException { ...@@ -456,7 +456,7 @@ public static void main(String[] args) throws SQLException {
Statement statement = connection.createStatement(); // get statement Statement statement = connection.createStatement(); // get statement
//query or insert //query or insert
// ... // ...
connection.close(); // put back to conneciton pool connection.close(); // put back to connection pool
} }
``` ```
...@@ -480,7 +480,7 @@ public static void main(String[] args) throws Exception { ...@@ -480,7 +480,7 @@ public static void main(String[] args) throws Exception {
Statement statement = connection.createStatement(); // get statement Statement statement = connection.createStatement(); // get statement
//query or insert //query or insert
// ... // ...
connection.close(); // put back to conneciton pool connection.close(); // put back to connection pool
} }
``` ```
......
...@@ -15,7 +15,7 @@ if you use the default features, it'll depend on: ...@@ -15,7 +15,7 @@ if you use the default features, it'll depend on:
- [TDengine Client](https://www.taosdata.com/cn/getting-started/#%E9%80%9A%E8%BF%87%E5%AE%89%E8%A3%85%E5%8C%85%E5%AE%89%E8%A3%85) library and headers. - [TDengine Client](https://www.taosdata.com/cn/getting-started/#%E9%80%9A%E8%BF%87%E5%AE%89%E8%A3%85%E5%8C%85%E5%AE%89%E8%A3%85) library and headers.
- clang because bindgen will requires the clang AST library. - clang because bindgen will requires the clang AST library.
## Fetures ## Features
In-design features: In-design features:
......
...@@ -884,7 +884,7 @@ dotnet new console ...@@ -884,7 +884,7 @@ dotnet new console
``` cmd ``` cmd
dotnet add package TDengine.Connector dotnet add package TDengine.Connector
``` ```
* inlucde the TDnengineDriver in you application's namespace * include the TDnengineDriver in you application's namespace
```C# ```C#
using TDengineDriver; using TDengineDriver;
``` ```
......
...@@ -228,7 +228,7 @@ Note: In 2.0.15.0 and later versions, STABLE reserved words are supported. That ...@@ -228,7 +228,7 @@ Note: In 2.0.15.0 and later versions, STABLE reserved words are supported. That
```mysql ```mysql
CREATE STABLE [IF NOT EXISTS] stb_name (timestamp_field_name TIMESTAMP, field1_name data_type1 [, field2_name data_type2 ...]) TAGS (tag1_name tag_type1, tag2_name tag_type2 [, tag3_name tag_type3]); CREATE STABLE [IF NOT EXISTS] stb_name (timestamp_field_name TIMESTAMP, field1_name data_type1 [, field2_name data_type2 ...]) TAGS (tag1_name tag_type1, tag2_name tag_type2 [, tag3_name tag_type3]);
``` ```
Similiar to a standard table creation SQL, but you need to specify name and type of TAGS field. Similar to a standard table creation SQL, but you need to specify name and type of TAGS field.
Note: Note:
...@@ -673,7 +673,7 @@ Query OK, 1 row(s) in set (0.001091s) ...@@ -673,7 +673,7 @@ Query OK, 1 row(s) in set (0.001091s)
SELECT * FROM tb1 WHERE ts >= NOW - 1h; SELECT * FROM tb1 WHERE ts >= NOW - 1h;
``` ```
- Look up table tb1 from 2018-06-01 08:00:00. 000 to 2018-06-02 08:00:00. 000, and col3 string is a record ending in'nny ', and the result is in descending order of timestamp: - Look up table tb1 from 2018-06-01 08:00:00. 000 to 2018-06-02 08:00:00. 000, and col3 string is a record ending in 'nny ', and the result is in descending order of timestamp:
```mysql ```mysql
SELECT * FROM tb1 WHERE ts > '2018-06-01 08:00:00.000' AND ts <= '2018-06-02 08:00:00.000' AND col3 LIKE '%nny' ORDER BY ts DESC; SELECT * FROM tb1 WHERE ts > '2018-06-01 08:00:00.000' AND ts <= '2018-06-02 08:00:00.000' AND col3 LIKE '%nny' ORDER BY ts DESC;
...@@ -782,7 +782,7 @@ TDengine supports aggregations over data, they are listed below: ...@@ -782,7 +782,7 @@ TDengine supports aggregations over data, they are listed below:
Function: return the sum of a statistics/STable. Function: return the sum of a statistics/STable.
Return Data Type: long integer INMT64 and Double. Return Data Type: INT64 and Double.
Applicable Fields: All types except timestamp, binary, nchar, bool. Applicable Fields: All types except timestamp, binary, nchar, bool.
...@@ -1196,7 +1196,7 @@ SELECT function_list FROM stb_name ...@@ -1196,7 +1196,7 @@ SELECT function_list FROM stb_name
- FILL statement specifies a filling mode when data missed in a certain interval. Applicable filling modes include the following: - FILL statement specifies a filling mode when data missed in a certain interval. Applicable filling modes include the following:
1. Do not fill: NONE (default filingl mode). 1. Do not fill: NONE (default filing mode).
2. VALUE filling: Fixed value filling, where the filled value needs to be specified. For example: fill (VALUE, 1.23). 2. VALUE filling: Fixed value filling, where the filled value needs to be specified. For example: fill (VALUE, 1.23).
3. NULL filling: Fill the data with NULL. For example: fill (NULL). 3. NULL filling: Fill the data with NULL. For example: fill (NULL).
4. PREV filling: Filling data with the previous non-NULL value. For example: fill (PREV). 4. PREV filling: Filling data with the previous non-NULL value. For example: fill (PREV).
......
...@@ -28,7 +28,7 @@ The overall system architecture of a typical DevOps application scenario is show ...@@ -28,7 +28,7 @@ The overall system architecture of a typical DevOps application scenario is show
In this application scenario, there are Agent tools deployed in the application environment to collect machine metrics, network metrics, and application metrics, data collectors to aggregate information collected by agents, systems for data persistence storage and management, and tools for monitoring data visualization (e.g., Grafana, etc.). In this application scenario, there are Agent tools deployed in the application environment to collect machine metrics, network metrics, and application metrics, data collectors to aggregate information collected by agents, systems for data persistence storage and management, and tools for monitoring data visualization (e.g., Grafana, etc.).
Among them, Agents deployed in application nodes are responsible for providing operational metrics from different sources to collectd/Statsd, and collectd/StatsD is responsible for pushing the aggregated data to the OpenTSDB cluster system and then visualizing the data using the visualization kanban board Grafana. Among them, Agents deployed in application nodes are responsible for providing operational metrics from different sources to collectd/Statsd, and collectd/StatsD is responsible for pushing the aggregated data to the OpenTSDB cluster system and then visualizing the data using the visualization board of Grafana.
### 2. Migration Service ### 2. Migration Service
...@@ -127,11 +127,11 @@ On the one hand, TDengine requires a strict schema definition for its incoming d ...@@ -127,11 +127,11 @@ On the one hand, TDengine requires a strict schema definition for its incoming d
Now let's assume a DevOps scenario where we use collectd to collect base metrics of devices, including memory, swap, disk, etc. The schema in OpenTSDB is as follows: Now let's assume a DevOps scenario where we use collectd to collect base metrics of devices, including memory, swap, disk, etc. The schema in OpenTSDB is as follows:
| No. | metric | value | type | tag1 | tag2 | tag3 | tag4 | tag5 | | No. | metric | value | type | tag1 | tag2 | tag3 | tag4 | tag5 |
| ---- | -------------- | ------ | ------ | ---- | ----------- | -------------------- | --------- | ------ | | --- | ------ | ----- | ------ | ---- | ----------- | -------------------- | --------- | ------ |
| 1 | memory | value | double | host | memory_type | memory_type_instance | source | | | 1 | memory | value | double | host | memory_type | memory_type_instance | source | |
| 2 | swap | value | double | host | swap_type | swap_type_instance | source | | | 2 | swap | value | double | host | swap_type | swap_type_instance | source | |
| 3 | disk | value | double | host | disk_point | disk_instance | disk_type | source | | 3 | disk | value | double | host | disk_point | disk_instance | disk_type | source |
......
...@@ -188,9 +188,6 @@ function update() { ...@@ -188,9 +188,6 @@ function update() {
install_log install_log
install_header install_header
install_lib install_lib
if [ "$pagMode" != "lite" ]; then
install_connector
fi
install_examples install_examples
install_bin install_bin
install_config install_config
...@@ -215,9 +212,6 @@ function install() { ...@@ -215,9 +212,6 @@ function install() {
install_log install_log
install_header install_header
install_lib install_lib
if [ "$pagMode" != "lite" ]; then
install_connector
fi
install_examples install_examples
install_bin install_bin
install_config install_config
......
...@@ -189,9 +189,6 @@ function update() { ...@@ -189,9 +189,6 @@ function update() {
install_log install_log
install_header install_header
install_lib install_lib
if [ "$pagMode" != "lite" ]; then
install_connector
fi
install_examples install_examples
install_bin install_bin
install_config install_config
...@@ -216,9 +213,6 @@ function install() { ...@@ -216,9 +213,6 @@ function install() {
install_log install_log
install_header install_header
install_lib install_lib
if [ "$pagMode" != "lite" ]; then
install_connector
fi
install_examples install_examples
install_bin install_bin
install_config install_config
......
...@@ -247,9 +247,6 @@ function update_PowerDB() { ...@@ -247,9 +247,6 @@ function update_PowerDB() {
install_log install_log
install_header install_header
install_lib install_lib
if [ "$pagMode" != "lite" ]; then
install_connector
fi
install_examples install_examples
install_bin install_bin
install_config install_config
...@@ -275,9 +272,6 @@ function install_PowerDB() { ...@@ -275,9 +272,6 @@ function install_PowerDB() {
install_header install_header
install_lib install_lib
install_jemalloc install_jemalloc
if [ "$pagMode" != "lite" ]; then
install_connector
fi
install_examples install_examples
install_bin install_bin
install_config install_config
......
...@@ -189,9 +189,6 @@ function update_prodb() { ...@@ -189,9 +189,6 @@ function update_prodb() {
install_log install_log
install_header install_header
install_lib install_lib
if [ "$pagMode" != "lite" ]; then
install_connector
fi
install_examples install_examples
install_bin install_bin
install_config install_config
...@@ -216,9 +213,6 @@ function install_prodb() { ...@@ -216,9 +213,6 @@ function install_prodb() {
install_log install_log
install_header install_header
install_lib install_lib
if [ "$pagMode" != "lite" ]; then
install_connector
fi
install_examples install_examples
install_bin install_bin
install_config install_config
......
...@@ -193,9 +193,6 @@ function update_tq() { ...@@ -193,9 +193,6 @@ function update_tq() {
install_log install_log
install_header install_header
install_lib install_lib
if [ "$pagMode" != "lite" ]; then
install_connector
fi
install_examples install_examples
install_bin install_bin
install_config install_config
...@@ -220,9 +217,6 @@ function install_tq() { ...@@ -220,9 +217,6 @@ function install_tq() {
install_log install_log
install_header install_header
install_lib install_lib
if [ "$pagMode" != "lite" ]; then
install_connector
fi
install_examples install_examples
install_bin install_bin
install_config install_config
......
...@@ -69,10 +69,10 @@ if [ "$osType" != "Darwin" ]; then ...@@ -69,10 +69,10 @@ if [ "$osType" != "Darwin" ]; then
if [ "$pagMode" == "lite" ]; then if [ "$pagMode" == "lite" ]; then
strip ${build_dir}/bin/taos strip ${build_dir}/bin/taos
cp ${build_dir}/bin/taos ${install_dir}/bin/jh_taos cp ${build_dir}/bin/taos ${install_dir}/bin/jh_taos
cp ${script_dir}/remove_jh.sh ${install_dir}/bin cp ${script_dir}/remove_client_jh.sh ${install_dir}/bin
else else
cp ${build_dir}/bin/taos ${install_dir}/bin/jh_taos cp ${build_dir}/bin/taos ${install_dir}/bin/jh_taos
cp ${script_dir}/remove_jh.sh ${install_dir}/bin cp ${script_dir}/remove_client_jh.sh ${install_dir}/bin
cp ${build_dir}/bin/taosdemo ${install_dir}/bin/jhdemo cp ${build_dir}/bin/taosdemo ${install_dir}/bin/jhdemo
cp ${build_dir}/bin/taosdump ${install_dir}/bin/jh_taosdump cp ${build_dir}/bin/taosdump ${install_dir}/bin/jh_taosdump
cp ${script_dir}/set_core.sh ${install_dir}/bin cp ${script_dir}/set_core.sh ${install_dir}/bin
......
...@@ -69,10 +69,10 @@ if [ "$osType" != "Darwin" ]; then ...@@ -69,10 +69,10 @@ if [ "$osType" != "Darwin" ]; then
if [ "$pagMode" == "lite" ]; then if [ "$pagMode" == "lite" ]; then
strip ${build_dir}/bin/taos strip ${build_dir}/bin/taos
cp ${build_dir}/bin/taos ${install_dir}/bin/khclient cp ${build_dir}/bin/taos ${install_dir}/bin/khclient
cp ${script_dir}/remove_kh.sh ${install_dir}/bin cp ${script_dir}/remove_client_kh.sh ${install_dir}/bin
else else
cp ${build_dir}/bin/taos ${install_dir}/bin/khclient cp ${build_dir}/bin/taos ${install_dir}/bin/khclient
cp ${script_dir}/remove_kh.sh ${install_dir}/bin cp ${script_dir}/remove_client_kh.sh ${install_dir}/bin
cp ${build_dir}/bin/taosdemo ${install_dir}/bin/khdemo cp ${build_dir}/bin/taosdemo ${install_dir}/bin/khdemo
cp ${build_dir}/bin/taosdump ${install_dir}/bin/khdump cp ${build_dir}/bin/taosdump ${install_dir}/bin/khdump
cp ${script_dir}/set_core.sh ${install_dir}/bin cp ${script_dir}/set_core.sh ${install_dir}/bin
......
...@@ -109,10 +109,10 @@ if [ "$osType" != "Darwin" ]; then ...@@ -109,10 +109,10 @@ if [ "$osType" != "Darwin" ]; then
if [ "$pagMode" == "lite" ]; then if [ "$pagMode" == "lite" ]; then
strip ${build_dir}/bin/taos strip ${build_dir}/bin/taos
cp ${build_dir}/bin/taos ${install_dir}/bin/power cp ${build_dir}/bin/taos ${install_dir}/bin/power
cp ${script_dir}/remove_power.sh ${install_dir}/bin cp ${script_dir}/remove_client_power.sh ${install_dir}/bin
else else
cp ${build_dir}/bin/taos ${install_dir}/bin/power cp ${build_dir}/bin/taos ${install_dir}/bin/power
cp ${script_dir}/remove_power.sh ${install_dir}/bin cp ${script_dir}/remove_client_power.sh ${install_dir}/bin
cp ${build_dir}/bin/taosdemo ${install_dir}/bin/powerdemo cp ${build_dir}/bin/taosdemo ${install_dir}/bin/powerdemo
cp ${build_dir}/bin/taosdump ${install_dir}/bin/powerdump cp ${build_dir}/bin/taosdump ${install_dir}/bin/powerdump
cp ${script_dir}/set_core.sh ${install_dir}/bin cp ${script_dir}/set_core.sh ${install_dir}/bin
......
...@@ -69,10 +69,10 @@ if [ "$osType" != "Darwin" ]; then ...@@ -69,10 +69,10 @@ if [ "$osType" != "Darwin" ]; then
if [ "$pagMode" == "lite" ]; then if [ "$pagMode" == "lite" ]; then
strip ${build_dir}/bin/taos strip ${build_dir}/bin/taos
cp ${build_dir}/bin/taos ${install_dir}/bin/prodbc cp ${build_dir}/bin/taos ${install_dir}/bin/prodbc
cp ${script_dir}/remove_pro.sh ${install_dir}/bin cp ${script_dir}/remove_client_pro.sh ${install_dir}/bin
else else
cp ${build_dir}/bin/taos ${install_dir}/bin/prodbc cp ${build_dir}/bin/taos ${install_dir}/bin/prodbc
cp ${script_dir}/remove_pro.sh ${install_dir}/bin cp ${script_dir}/remove_client_pro.sh ${install_dir}/bin
cp ${build_dir}/bin/taosdemo ${install_dir}/bin/prodemo cp ${build_dir}/bin/taosdemo ${install_dir}/bin/prodemo
cp ${build_dir}/bin/taosdump ${install_dir}/bin/prodump cp ${build_dir}/bin/taosdump ${install_dir}/bin/prodump
cp ${script_dir}/set_core.sh ${install_dir}/bin cp ${script_dir}/set_core.sh ${install_dir}/bin
......
...@@ -69,10 +69,10 @@ if [ "$osType" != "Darwin" ]; then ...@@ -69,10 +69,10 @@ if [ "$osType" != "Darwin" ]; then
if [ "$pagMode" == "lite" ]; then if [ "$pagMode" == "lite" ]; then
strip ${build_dir}/bin/taos strip ${build_dir}/bin/taos
cp ${build_dir}/bin/taos ${install_dir}/bin/tq cp ${build_dir}/bin/taos ${install_dir}/bin/tq
cp ${script_dir}/remove_tq.sh ${install_dir}/bin cp ${script_dir}/remove_client_tq.sh ${install_dir}/bin
else else
cp ${build_dir}/bin/taos ${install_dir}/bin/tq cp ${build_dir}/bin/taos ${install_dir}/bin/tq
cp ${script_dir}/remove_tq.sh ${install_dir}/bin cp ${script_dir}/remove_client_tq.sh ${install_dir}/bin
cp ${build_dir}/bin/taosdemo ${install_dir}/bin/tqdemo cp ${build_dir}/bin/taosdemo ${install_dir}/bin/tqdemo
cp ${build_dir}/bin/taosdump ${install_dir}/bin/tqdump cp ${build_dir}/bin/taosdump ${install_dir}/bin/tqdump
cp ${script_dir}/set_core.sh ${install_dir}/bin cp ${script_dir}/set_core.sh ${install_dir}/bin
......
Subproject commit 88346a2e4e2e9282d2ec8b8c5264ca1ec23698a1 Subproject commit f108f5240918d0eec90debd1ff469c98ff0f25ac
...@@ -137,7 +137,7 @@ do { \ ...@@ -137,7 +137,7 @@ do { \
uint64_t queryHandleId = 0; uint64_t queryHandleId = 0;
int32_t getMaximumIdleDurationSec() { int32_t getMaximumIdleDurationSec() {
return tsShellActivityTimer * 2; return tsShellActivityTimer * 10;
} }
int64_t genQueryId(void) { int64_t genQueryId(void) {
int64_t uid = 0; int64_t uid = 0;
......
...@@ -279,6 +279,7 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) { ...@@ -279,6 +279,7 @@ bool qTableQuery(qinfo_t qinfo, uint64_t *qId) {
if (isQueryKilled(pQInfo)) { if (isQueryKilled(pQInfo)) {
qDebug("QInfo:0x%"PRIx64" it is already killed, abort", pQInfo->qId); qDebug("QInfo:0x%"PRIx64" it is already killed, abort", pQInfo->qId);
pQInfo->runtimeEnv.outputBuf = NULL;
return doBuildResCheck(pQInfo); return doBuildResCheck(pQInfo);
} }
......
...@@ -20,9 +20,9 @@ from util.sql import * ...@@ -20,9 +20,9 @@ from util.sql import *
class TDTestCase: class TDTestCase:
def caseDescription(self): def caseDescription(self):
''' '''
insert 倒序插入 case1: insert 倒序插入
语法解析错误同时meta请求也发出去了导致callback中处理逻辑失效 case2: 语法解析错误同时meta请求也发出去了导致callback中处理逻辑失效
insert语句在values之间加入多个逗号 case3: [TD-XXXX]insert语句在values之间加入多个逗号
''' '''
return return
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import taos
import time
import os
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
class TDTestCase:
def caseDescription(self):
'''
case1:The escape char "`" can be used for both tag name and column name
case2:create stable(column&tag); insert data; show stable; show create table; add stable(column&tag);change stable(tag);drop stable(column&tag);modify stable(column&tag)(binary和nchar);drop stable;
case3:create stable_child; insert data; show stable_child; show create stable_child; drop stable_child;
case4:create regular_table(column); insert data; show regular_table; show create regular_table; add regular_table(column);drop regular_table(column);modify regular_table(column)(binary和nchar);drop regular_table;
'''
return
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
now = time.time()
self.ts = int(round(now * 1000))
def table1_checkall(self,sql):
tdLog.info(sql)
tdSql.query(sql)
tdSql.checkData(0,1,1)
tdSql.checkData(0,2,2)
tdSql.checkData(0,3,3)
tdSql.checkData(0,4,4)
tdSql.checkData(0,5,'True')
tdSql.checkData(0,6,6)
tdSql.checkData(0,7,7)
tdSql.checkData(0,8,8)
tdSql.checkData(0,9,9)
tdSql.checkData(0,10,'1970-01-01 08:00:00.010')
def table1_checkall_1(self,sql):
tdSql.query(sql)
tdSql.checkData(0,1,1)
def table1_checkall_2(self,sql):
self.table1_checkall_1(sql)
tdSql.checkData(0,2,2)
def table1_checkall_3(self,sql):
self.table1_checkall_2(sql)
tdSql.checkData(0,3,3)
def table1_checkall_4(self,sql):
self.table1_checkall_3(sql)
tdSql.checkData(0,4,4)
def table1_checkall_5(self,sql):
self.table1_checkall_4(sql)
tdSql.checkData(0,5,'True')
def table1_checkall_6(self,sql):
self.table1_checkall_5(sql)
tdSql.checkData(0,6,6)
def table1_checkall_7(self,sql):
self.table1_checkall_6(sql)
tdSql.checkData(0,7,7)
def table1_checkall_8(self,sql):
self.table1_checkall_7(sql)
tdSql.checkData(0,8,8)
def table1_checkall_9(self,sql):
self.table1_checkall_8(sql)
tdSql.checkData(0,9,9)
def table1_checkall_10(self,sql):
self.table1_checkall_9(sql)
tdSql.checkData(0,10,'1970-01-01 08:00:00.010')
def run(self):
testcaseFilename = os.path.split(__file__)[-1]
os.system("rm -rf 0-management/1-stable/%s.sql" % testcaseFilename )
tdSql.prepare()
print("==============step1")
print("prepare data")
# case for defect: https://jira.taosdata.com:18080/browse/TD-2693
tdSql.execute("create database db2")
tdSql.execute("use db2")
print("==============new version [escape character] for stable==============")
print("==============step1,#create db.stable,db.table; insert db.table; show db.table; select db.table; drop db.table;")
print("prepare data")
self.stb1 = "stable_1~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
self.tb1 = "table_1~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
self.col_base = "123~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
self.col_int = "stable_col_int%s" %self.col_base
print(self.col_int)
self.col_bigint = "stable_col_bigint%s" %self.col_base
self.col_smallint = "stable_col_smallint%s" %self.col_base
self.col_tinyint = "stable_col_tinyint%s" %self.col_base
self.col_bool = "stable_col_bool%s" %self.col_base
self.col_binary = "stable_col_binary%s" %self.col_base
self.col_nchar = "stable_col_nchar%s" %self.col_base
self.col_float = "stable_col_float%s" %self.col_base
self.col_double = "stable_col_double%s" %self.col_base
self.col_ts = "stable_col_ts%s" %self.col_base
self.tag_base = "abc~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
self.tag_int = "stable_tag_int%s" %self.tag_base
self.tag_bigint = "stable_tag_bigint%s" %self.tag_base
self.tag_smallint = "stable_tag_smallint%s" %self.tag_base
self.tag_tinyint = "stable_tag_tinyint%s" %self.tag_base
self.tag_bool = "stable_tag_bool%s" %self.tag_base
self.tag_binary = "stable_tag_binary%s" %self.tag_base
self.tag_nchar = "stable_tag_nchar%s" %self.tag_base
self.tag_float = "stable_tag_float%s" %self.tag_base
self.tag_double = "stable_tag_double%s" %self.tag_base
self.tag_ts = "stable_tag_ts%s" %self.tag_base
tdSql.execute('''create stable db.`%s` (ts timestamp, `%s` int , `%s` bigint , `%s` smallint , `%s` tinyint, `%s` bool ,
`%s` binary(20) , `%s` nchar(20) ,`%s` float , `%s` double , `%s` timestamp)
tags(loc nchar(20), `%s` int , `%s` bigint , `%s` smallint , `%s` tinyint, `%s` bool ,
`%s` binary(20) , `%s` nchar(20) ,`%s` float , `%s` double , `%s` timestamp);'''
%(self.stb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
self.tag_int, self.tag_bigint, self.tag_smallint, self.tag_tinyint, self.tag_bool,
self.tag_binary, self.tag_nchar, self.tag_float, self.tag_double, self.tag_ts))
tdSql.query("describe db.`%s` ; " %self.stb1)
tdSql.checkRows(22)
tdSql.query("select _block_dist() from db.`%s` ; " %self.stb1)
tdSql.checkRows(0)
tdSql.query("show create stable db.`%s` ; " %self.stb1)
tdSql.checkData(0, 0, self.stb1)
tdSql.checkData(0, 1, "create table `%s` (`ts` TIMESTAMP,`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(20),`%s` NCHAR(20),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)\
TAGS (`loc` NCHAR(20),`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(20),`%s` NCHAR(20),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)"
%(self.stb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,
self.tag_int, self.tag_bigint, self.tag_smallint, self.tag_tinyint, self.tag_bool,
self.tag_binary, self.tag_nchar, self.tag_float, self.tag_double, self.tag_ts))
tdSql.execute("create table db.`table!1` using db.`%s` tags('table_1' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')" %self.stb1)
tdSql.query("describe db.`table!1` ; ")
tdSql.checkRows(22)
time.sleep(10)
tdSql.query("show create table db.`table!1` ; ")
tdSql.checkData(0, 0, "table!1")
tdSql.checkData(0, 1, "CREATE TABLE `table!1` USING `%s` TAGS (\"table_1\",0,0,0,0,false,\"0\",\"0\",0.000000,0.000000,\"0\")" %self.stb1)
tdSql.execute("insert into db.`table!1` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)")
sql = " select * from db.`table!1`; "
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`table!1`; '''\
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
time.sleep(1)
tdSql.execute('''insert into db.`table!1`(ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''\
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts) )
sql = " select * from db.`table!1`; "
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
tdSql.query("select count(*) from db.`table!1`; ")
tdSql.checkData(0, 0, 2)
tdSql.query("select _block_dist() from db.`%s` ; " %self.stb1)
tdSql.checkRows(1)
tdSql.execute("create table db.`%s` using db.`%s` TAGS (\"table_2\",2,2,2,2,true,\"2\",\"2\",2.000000,2.000000,\"2\")" %(self.tb1,self.stb1))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.query("show create table db.`%s` ; " %self.tb1)
tdSql.checkData(0, 0, self.tb1)
tdSql.checkData(0, 1, "CREATE TABLE `%s` USING `%s` TAGS (\"table_2\",2,2,2,2,true,\"2\",\"2\",2.000000,2.000000,\"2\")" %(self.tb1,self.stb1))
tdSql.execute("insert into db.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %self.tb1)
sql = "select * from db.`%s` ; " %self.tb1
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s` ; '''\
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,\
self.tag_int, self.tag_bigint, self.tag_smallint, self.tag_tinyint, self.tag_bool, self.tag_binary, self.tag_nchar, self.tag_float, self.tag_double, self.tag_ts, self.tb1)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
time.sleep(1)
tdSql.execute('''insert into db.`%s`(ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''\
%(self.tb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts) )
sql = " select * from db.`%s` ; " %self.tb1
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
sql = " select * from db.`%s` where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10; " \
%(self.tb1, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
tdSql.query("select count(*) from db.`%s`; " %self.tb1)
tdSql.checkData(0, 0, 2)
sql = "select * from db.`%s` ; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.checkRows(4)
tdSql.query("select count(*) from db.`%s`; " %self.stb1)
tdSql.checkData(0, 0, 4)
sql = "select * from (select * from db.`%s`) ; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.checkRows(4)
tdSql.query("select count(*) from (select * from db.`%s`) ; " %self.stb1)
tdSql.checkData(0, 0, 4)
sql = "select * from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s`) ; " \
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.stb1)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(4)
sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s`) ; " \
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,\
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.stb1)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(4)
sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db.`%s`\
where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10 ) ; " \
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,\
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.stb1, \
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(4)
tdSql.query("show db.stables like 'stable_1%' ")
tdSql.checkRows(1)
tdSql.query("show db.tables like 'table%' ")
tdSql.checkRows(2)
self.cr_tb1 = "create_table_1~!@#$%^&*()-_+=[]{}':,<.>/?stST13579"
tdSql.execute("create table db.`%s` as select avg(`%s`) from db.`%s` where ts > now interval(1m) sliding(30s);" %(self.cr_tb1,self.col_bigint,self.stb1))
tdSql.query("show db.tables like 'create_table_%' ")
tdSql.checkRows(1)
print("==============drop\ add\ change\ modify column or tag")
print("==============drop==============")
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_ts))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(21)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_double))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(20)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_float))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(19)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_nchar))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(18)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_binary))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(17)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_bool))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(16)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_tinyint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(15)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_smallint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(14)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_bigint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(13)
tdSql.execute("ALTER TABLE db.`%s` DROP TAG `%s`; " %(self.stb1, self.tag_int))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(12)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_ts))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_9(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(11)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_double))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_8(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_float))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_7(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_nchar))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_6(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(8)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_binary))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_5(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(7)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_bool))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_4(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_tinyint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_3(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_smallint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_2(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_bigint))
sql = " select * from db.`%s`; " %self.stb1
datacheck = self.table1_checkall_1(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(3)
tdSql.error("ALTER TABLE db.`%s` DROP COLUMN `%s`; " %(self.stb1, self.col_int))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(3)
print("==============add==============")
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` bigint; " %(self.stb1, self.col_bigint))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` smallint; " %(self.stb1, self.col_smallint))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` tinyint; " %(self.stb1, self.col_tinyint))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` bool; " %(self.stb1, self.col_bool))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(7)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` binary(20); " %(self.stb1, self.col_binary))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(8)
tdSql.execute("insert into db.`%s` values(now, 1 , 2, 3, 4, 5, 6)" %self.tb1)
sql = "select * from db.`%s` order by ts desc; " %self.tb1
datacheck = self.table1_checkall_5(sql)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` nchar(20); " %(self.stb1, self.col_nchar))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` float; " %(self.stb1, self.col_float))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` double; " %(self.stb1, self.col_double))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(11)
tdSql.execute("ALTER TABLE db.`%s` ADD COLUMN `%s` timestamp; " %(self.stb1, self.col_ts))
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(12)
tdSql.execute("insert into db.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %self.tb1)
sql = "select * from db.`%s` order by ts desc; " %self.tb1
datacheck = self.table1_checkall(sql)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` int; " %(self.stb1, self.tag_int))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(13)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` bigint; " %(self.stb1, self.tag_bigint))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(14)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` smallint; " %(self.stb1, self.tag_smallint))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(15)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` tinyint; " %(self.stb1, self.tag_tinyint))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(16)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` bool; " %(self.stb1, self.tag_bool))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(17)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` binary(20); " %(self.stb1, self.tag_binary))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(18)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` nchar(20); " %(self.stb1, self.tag_nchar))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(19)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` float; " %(self.stb1, self.tag_float))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(20)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` double; " %(self.stb1, self.tag_double))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(21)
tdSql.execute("ALTER TABLE db.`%s` ADD TAG `%s` timestamp; " %(self.stb1, self.tag_ts))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
print("==============change==============")
self.tag_base_change = "abcdas"
self.tag_int_change = "stable_tag_int%s" %self.tag_base_change
self.tag_bigint_change = "stable_tag_bigint%s" %self.tag_base_change
self.tag_smallint_change = "stable_tag_smallint%s" %self.tag_base_change
self.tag_tinyint_change = "stable_tag_tinyint%s" %self.tag_base_change
self.tag_bool_change = "stable_tag_bool%s" %self.tag_base_change
self.tag_binary_change = "stable_tag_binary%s" %self.tag_base_change
self.tag_nchar_change = "stable_tag_nchar%s" %self.tag_base_change
self.tag_float_change = "stable_tag_float%s" %self.tag_base_change
self.tag_double_change = "stable_tag_double%s" %self.tag_base_change
self.tag_ts_change = "stable_tag_ts%s" %self.tag_base_change
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_int, self.tag_int_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_bigint, self.tag_bigint_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_smallint, self.tag_smallint_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_tinyint, self.tag_tinyint_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_bool, self.tag_bool_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_binary, self.tag_binary_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_nchar, self.tag_nchar_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_float, self.tag_float_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_double, self.tag_double_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER TABLE db.`%s` CHANGE TAG `%s` `%s`; " %(self.stb1, self.tag_ts, self.tag_ts_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
print("==============modify==============")
# TD-10810
tdSql.execute("ALTER STABLE db.`%s` MODIFY TAG `%s` binary(30); ; " %(self.stb1, self.tag_binary_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER STABLE db.`%s` MODIFY TAG `%s` nchar(30); ; " %(self.stb1, self.tag_nchar_change))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER STABLE db.`%s` MODIFY COLUMN `%s` binary(30); ; " %(self.stb1, self.col_binary))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
tdSql.execute("ALTER STABLE db.`%s` MODIFY COLUMN `%s` nchar(30); ; " %(self.stb1, self.col_nchar))
sql = " select * from db.`%s` order by ts desc; " %self.stb1
datacheck = self.table1_checkall(sql)
tdSql.query("describe db.`%s` ; " %self.tb1)
tdSql.checkRows(22)
print("==============drop table\stable")
try:
tdSql.execute("drop table db.`%s` " %self.tb1)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from db.`%s`" %self.tb1)
tdSql.query("show db.stables like 'stable_1%' ")
tdSql.checkRows(1)
try:
tdSql.execute("drop table db.`%s` " %self.stb1)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from db.`%s`" %self.tb1)
tdSql.error("select * from db.`%s`" %self.stb1)
print("==============step2,#create stable,table; insert table; show table; select table; drop table")
self.stb2 = "stable_2~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
self.tb2 = "table_2~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
tdSql.execute("create stable `%s` (ts timestamp, i int) tags(j int);" %self.stb2)
tdSql.query("describe `%s` ; "%self.stb2)
tdSql.checkRows(3)
tdSql.query("select _block_dist() from `%s` ; " %self.stb2)
tdSql.checkRows(0)
tdSql.query("show create stable `%s` ; " %self.stb2)
tdSql.checkData(0, 0, self.stb2)
tdSql.checkData(0, 1, "create table `%s` (`ts` TIMESTAMP,`i` INT) TAGS (`j` INT)" %self.stb2)
tdSql.execute("create table `table!2` using `%s` tags(1)" %self.stb2)
tdSql.query("describe `table!2` ; ")
tdSql.checkRows(3)
time.sleep(10)
tdSql.query("show create table `table!2` ; ")
tdSql.checkData(0, 0, "table!2")
tdSql.checkData(0, 1, "CREATE TABLE `table!2` USING `%s` TAGS (1)" %self.stb2)
tdSql.execute("insert into `table!2` values(now, 1)")
tdSql.query("select * from `table!2`; ")
tdSql.checkRows(1)
tdSql.query("select count(*) from `table!2`; ")
tdSql.checkData(0, 0, 1)
tdSql.query("select _block_dist() from `%s` ; " %self.stb2)
tdSql.checkRows(1)
tdSql.execute("create table `%s` using `%s` tags(1)" %(self.tb2,self.stb2))
tdSql.query("describe `%s` ; " %self.tb2)
tdSql.checkRows(3)
tdSql.query("show create table `%s` ; " %self.tb2)
tdSql.checkData(0, 0, self.tb2)
tdSql.checkData(0, 1, "CREATE TABLE `%s` USING `%s` TAGS (1)" %(self.tb2,self.stb2))
tdSql.execute("insert into `%s` values(now, 1)" %self.tb2)
tdSql.query("select * from `%s` ; " %self.tb2)
tdSql.checkRows(1)
tdSql.query("select count(*) from `%s`; " %self.tb2)
tdSql.checkData(0, 0, 1)
tdSql.query("select * from `%s` ; " %self.stb2)
tdSql.checkRows(2)
tdSql.query("select count(*) from `%s`; " %self.stb2)
tdSql.checkData(0, 0, 2)
tdSql.query("select * from (select * from `%s`) ; " %self.stb2)
tdSql.checkRows(2)
tdSql.query("select count(*) from (select * from `%s` ); " %self.stb2)
tdSql.checkData(0, 0, 2)
tdSql.query("show stables like 'stable_2%' ")
tdSql.checkRows(1)
tdSql.query("show tables like 'table%' ")
tdSql.checkRows(2)
#TD-10536
self.cr_tb2 = "create_table_2~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
tdSql.execute("create table `%s` as select * from `%s` ;" %(self.cr_tb2,self.stb2))
tdSql.query("show db.tables like 'create_table_%' ")
tdSql.checkRows(1)
print("==============drop table\stable")
try:
tdSql.execute("drop table `%s` " %self.tb2)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from `%s`" %self.tb2)
tdSql.query("show stables like 'stable_2%' ")
tdSql.checkRows(1)
try:
tdSql.execute("drop table `%s` " %self.stb2)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from `%s`" %self.tb2)
tdSql.error("select * from `%s`" %self.stb2)
print("==============step3,#create regular_table; insert regular_table; show regular_table; select regular_table; drop regular_table")
self.regular_table = "regular_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
self.regular_col_base = "123@#$%^&*()-_+=[]{};:,<.>/?~!$%^"
self.col_int = "regular_table_col_int%s" %self.regular_col_base
print(self.col_int)
self.col_bigint = "regular_table_col_bigint%s" %self.regular_col_base
self.col_smallint = "regular_table_col_smallint%s" %self.regular_col_base
self.col_tinyint = "regular_table_col_tinyint%s" %self.regular_col_base
self.col_bool = "regular_table_col_bool%s" %self.regular_col_base
self.col_binary = "regular_table_col_binary%s" %self.regular_col_base
self.col_nchar = "regular_table_col_nchar%s" %self.regular_col_base
self.col_float = "regular_table_col_float%s" %self.regular_col_base
self.col_double = "regular_table_col_double%s" %self.regular_col_base
self.col_ts = "regular_table_col_ts%s" %self.regular_col_base
tdSql.execute("create table `%s` (ts timestamp,`%s` int , `%s` bigint , `%s` smallint , `%s` tinyint, `%s` bool , \
`%s` binary(20) , `%s` nchar(20) ,`%s` float , `%s` double , `%s` timestamp) ;"\
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
tdSql.query("describe `%s` ; "%self.regular_table)
tdSql.checkRows(11)
tdSql.query("select _block_dist() from `%s` ; " %self.regular_table)
tdSql.checkRows(1)
tdSql.query("show create table `%s` ; " %self.regular_table)
tdSql.checkData(0, 0, self.regular_table)
tdSql.checkData(0, 1, "create table `%s` (`ts` TIMESTAMP,`%s` INT,`%s` BIGINT,`%s` SMALLINT,`%s` TINYINT,`%s` BOOL,`%s` BINARY(20),`%s` NCHAR(20),`%s` FLOAT,`%s` DOUBLE,`%s` TIMESTAMP)"
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool,
self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts))
tdSql.execute("insert into `%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %self.regular_table)
sql = "select * from `%s` ; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
sql = '''select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db2.`%s`; '''\
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.regular_table)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(1)
time.sleep(1)
tdSql.execute('''insert into db2.`%s` (ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`) values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)'''\
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts) )
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
sql = " select * from db2.`%s` where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10; " \
%(self.regular_table, self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
tdSql.query("select count(*) from `%s`; " %self.regular_table)
tdSql.checkData(0, 0, 2)
tdSql.query("select _block_dist() from `%s` ; " %self.regular_table)
tdSql.checkRows(1)
sql = "select * from (select * from `%s`) ; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
sql = "select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from (select ts ,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s`,`%s` from db2.`%s`\
where `%s`=1 and `%s`=2 and `%s`=3 and `%s`=4 and `%s`='True' and `%s`=6 and `%s`=7 and `%s`=8 and `%s`=9 and `%s`=10 ) ; " \
%(self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts,\
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts, self.regular_table, \
self.col_int, self.col_bigint, self.col_smallint, self.col_tinyint, self.col_bool, self.col_binary, self.col_nchar, self.col_float, self.col_double, self.col_ts)
datacheck = self.table1_checkall(sql)
tdSql.checkRows(2)
tdSql.query("select count(*) from (select * from `%s` ); " %self.regular_table)
tdSql.checkData(0, 0, 2)
tdSql.query("show tables like 'regular_table%' ")
tdSql.checkRows(1)
self.crr_tb = "create_r_table~!@#$%^&*()-_+=[]{}';:,<.>/?stST24680~!@#$%^&*()-_+=[]{}"
tdSql.execute("create table `%s` as select * from `%s` ;" %(self.crr_tb,self.regular_table))
tdSql.query("show db2.tables like 'create_r_table%' ")
tdSql.checkRows(1)
print("==============drop\ add\ change\ modify column ")
print("==============drop==============")
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_ts))
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall_9(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_double))
sql = " select * from `%s`; " %self.regular_table
datacheck = self.table1_checkall_8(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_float))
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall_7(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(8)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_nchar))
sql = " select * from `%s`; " %self.regular_table
datacheck = self.table1_checkall_6(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(7)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_binary))
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall_5(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_bool))
sql = " select * from `%s`; " %self.regular_table
datacheck = self.table1_checkall_4(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_tinyint))
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall_3(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE `%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_smallint))
sql = " select * from `%s`; " %self.regular_table
datacheck = self.table1_checkall_2(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(3)
tdSql.execute("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_bigint))
sql = " select * from db2.`%s`; " %self.regular_table
datacheck = self.table1_checkall_1(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(2)
tdSql.error("ALTER TABLE db2.`%s` DROP COLUMN `%s`; " %(self.regular_table, self.col_int))
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(2)
print("==============add==============")
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` bigint; " %(self.regular_table, self.col_bigint))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(3)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` smallint; " %(self.regular_table, self.col_smallint))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(4)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` tinyint; " %(self.regular_table, self.col_tinyint))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(5)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` bool; " %(self.regular_table, self.col_bool))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(6)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` binary(20); " %(self.regular_table, self.col_binary))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(7)
tdSql.execute("insert into db2.`%s` values(now, 1 , 2, 3, 4, 5, 6)" %self.regular_table)
sql = "select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall_5(sql)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` nchar(20); " %(self.regular_table, self.col_nchar))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(8)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` float; " %(self.regular_table, self.col_float))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(9)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` double; " %(self.regular_table, self.col_double))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(10)
tdSql.execute("ALTER TABLE db2.`%s` ADD COLUMN `%s` timestamp; " %(self.regular_table, self.col_ts))
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(11)
tdSql.execute("insert into db2.`%s` values(now, 1 , 2, 3, 4, 5, 6 ,7 ,8 ,9 ,10)" %self.regular_table)
sql = "select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
print("==============change, regular not support==============")
print("==============modify==============")
# TD-10810
tdSql.execute("ALTER TABLE db2.`%s` MODIFY COLUMN `%s` binary(30); ; " %(self.regular_table, self.col_binary))
sql = " select * from db2.`%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.query("describe db2.`%s` ; " %self.regular_table)
tdSql.checkRows(11)
tdSql.execute("ALTER TABLE `%s` MODIFY COLUMN `%s` nchar(30); ; " %(self.regular_table, self.col_nchar))
sql = " select * from `%s` order by ts desc; " %self.regular_table
datacheck = self.table1_checkall(sql)
tdSql.query("describe `%s` ; " %self.regular_table)
tdSql.checkRows(11)
print("==============drop table\stable")
try:
tdSql.execute("drop table `%s` " %self.regular_table)
except Exception as e:
tdLog.exit(e)
tdSql.error("select * from `%s`" %self.regular_table)
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
...@@ -20,9 +20,9 @@ from util.sql import * ...@@ -20,9 +20,9 @@ from util.sql import *
class TDTestCase: class TDTestCase:
def caseDescription(self): def caseDescription(self):
''' '''
insert 倒序插入 case1: insert 倒序插入
语法解析错误同时meta请求也发出去了导致callback中处理逻辑失效 case2: 语法解析错误同时meta请求也发出去了导致callback中处理逻辑失效
insert语句在values之间加入多个逗号 case3: [TD-XXXX]insert语句在values之间加入多个逗号
''' '''
return return
def init(self, conn, logSql): def init(self, conn, logSql):
......
python3 test.py -f 1-insert/0-sql/basic.py python3 test.py -f 1-insert/0-sql/basic.py
\ No newline at end of file python3 test.py -f 0-management/1-stable/create_col_tag.py
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册