diff --git a/cmake/cmake.define b/cmake/cmake.define
index a5f636c0fc..d808f02413 100644
--- a/cmake/cmake.define
+++ b/cmake/cmake.define
@@ -234,20 +234,20 @@ ELSE ()
IF ("${SIMD_SUPPORT}" MATCHES "true")
IF (COMPILER_SUPPORT_FMA)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfma")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma")
+ MESSAGE(STATUS "FMA instructions is ACTIVATED")
+ ENDIF()
+ IF (COMPILER_SUPPORT_AVX)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
+ MESSAGE(STATUS "AVX instructions is ACTIVATED")
+ ENDIF()
+ IF (COMPILER_SUPPORT_AVX2)
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
+ MESSAGE(STATUS "AVX2 instructions is ACTIVATED")
ENDIF()
- MESSAGE(STATUS "FMA instructions is ACTIVATED")
- ENDIF()
- IF (COMPILER_SUPPORT_AVX)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
- MESSAGE(STATUS "AVX instructions is ACTIVATED")
- ENDIF()
- IF (COMPILER_SUPPORT_AVX2)
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mavx2")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")
- MESSAGE(STATUS "AVX2 instructions is ACTIVATED")
ENDIF()
IF ("${SIMD_AVX512_SUPPORT}" MATCHES "true")
diff --git a/cmake/cmake.options b/cmake/cmake.options
index 2158157780..e3b5782d85 100644
--- a/cmake/cmake.options
+++ b/cmake/cmake.options
@@ -144,6 +144,12 @@ option(
OFF
)
+option(
+ BUILD_WITH_ANALYSIS
+ "If build with analysis"
+ ON
+)
+
ENDIF ()
IF(NOT TD_ENTERPRISE)
@@ -151,8 +157,15 @@ MESSAGE("switch s3 off with community version")
set(BUILD_S3 OFF)
set(BUILD_WITH_S3 OFF)
set(BUILD_WITH_COS OFF)
+set(BUILD_WITH_ANALYSIS OFF)
ENDIF ()
+IF(${BUILD_WITH_ANALYSIS})
+ message("build with analysis")
+ set(BUILD_S3 ON)
+ set(BUILD_WITH_S3 ON)
+ENDIF()
+
IF(${BUILD_S3})
IF(${BUILD_WITH_S3})
diff --git a/cmake/stub_CMakeLists.txt.in b/cmake/stub_CMakeLists.txt.in
index 4c7a2fb002..a3ded8bbaa 100644
--- a/cmake/stub_CMakeLists.txt.in
+++ b/cmake/stub_CMakeLists.txt.in
@@ -9,6 +9,5 @@ ExternalProject_Add(stub
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
- TEST_COMMAND ""
- GIT_SHALLOW true
+ TEST_COMMAND ""
)
diff --git a/docs/examples/JDBC/SpringJdbcTemplate/readme.md b/docs/examples/JDBC/SpringJdbcTemplate/readme.md
index f59bcdbeb5..0e9812385a 100644
--- a/docs/examples/JDBC/SpringJdbcTemplate/readme.md
+++ b/docs/examples/JDBC/SpringJdbcTemplate/readme.md
@@ -1,11 +1,11 @@
## TDengine Spring JDBC Template Demo
-`Spring JDBC Template` 简化了原生 JDBC Connection 获取释放等操作,使得操作数据库更加方便。
+`Spring JDBC Template` simplifies the operations of acquiring and releasing native JDBC Connections, making database operations more convenient.
-### 配置
+### Configuration
-修改 `src/main/resources/applicationContext.xml` 文件中 TDengine 的配置信息:
+Modify the TDengine configuration in the `src/main/resources/applicationContext.xml` file:
```xml
@@ -20,13 +20,15 @@
```
-### 打包运行
+### Package and run
+
+Navigate to the `TDengine/tests/examples/JDBC/SpringJdbcTemplate` directory and execute the following commands to generate an executable jar file.
-进入 `TDengine/tests/examples/JDBC/SpringJdbcTemplate` 目录下,执行以下命令可以生成可执行 jar 包。
```shell
mvn clean package
```
-打包成功之后,进入 `target/` 目录下,执行以下命令就可运行测试:
+After successfully packaging, navigate to the `target/` directory and execute the following commands to run the tests:
+
```shell
java -jar target/SpringJdbcTemplate-1.0-SNAPSHOT-jar-with-dependencies.jar
-```
\ No newline at end of file
+```
diff --git a/docs/examples/JDBC/connectionPools/src/main/resources/log4j.properties b/docs/examples/JDBC/connectionPools/src/main/resources/log4j.properties
index 1299357be3..a7f4d3d492 100644
--- a/docs/examples/JDBC/connectionPools/src/main/resources/log4j.properties
+++ b/docs/examples/JDBC/connectionPools/src/main/resources/log4j.properties
@@ -1,21 +1,21 @@
-### 设置###
+### Settings###
log4j.rootLogger=debug,stdout,DebugLog,ErrorLog
-### 输出信息到控制抬 ###
+### Output information to the console ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n
-### 输出DEBUG 级别以上的日志到=logs/debug.log
+### Output logs of DEBUG level and above to logs/debug.log
log4j.appender.DebugLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DebugLog.File=logs/debug.log
log4j.appender.DebugLog.Append=true
log4j.appender.DebugLog.Threshold=DEBUG
log4j.appender.DebugLog.layout=org.apache.log4j.PatternLayout
log4j.appender.DebugLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
-### 输出ERROR 级别以上的日志到=logs/error.log
+### Output logs of ERROR level and above to logs/error.log
log4j.appender.ErrorLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ErrorLog.File=logs/error.log
log4j.appender.ErrorLog.Append=true
log4j.appender.ErrorLog.Threshold=ERROR
log4j.appender.ErrorLog.layout=org.apache.log4j.PatternLayout
-log4j.appender.ErrorLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
\ No newline at end of file
+log4j.appender.ErrorLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
diff --git a/docs/examples/JDBC/connectionPools/src/main/resources/proxool.xml b/docs/examples/JDBC/connectionPools/src/main/resources/proxool.xml
index 0e2ac6368a..dcef51ffb5 100644
--- a/docs/examples/JDBC/connectionPools/src/main/resources/proxool.xml
+++ b/docs/examples/JDBC/connectionPools/src/main/resources/proxool.xml
@@ -1,27 +1,28 @@
+
ds
-
+
jdbc:TAOS-RS://127.0.0.1:6041/log
-
+
com.taosdata.jdbc.rs.RestfulDriver
-
+
-
+
100
-
+
100
-
+
1
-
+
5
-
+
30000
-
+
select server_version()
-
\ No newline at end of file
+
diff --git a/docs/examples/JDBC/consumer-demo/src/main/java/com/taosdata/Worker.java b/docs/examples/JDBC/consumer-demo/src/main/java/com/taosdata/Worker.java
index f6e21cd729..6823ca5b4d 100644
--- a/docs/examples/JDBC/consumer-demo/src/main/java/com/taosdata/Worker.java
+++ b/docs/examples/JDBC/consumer-demo/src/main/java/com/taosdata/Worker.java
@@ -35,17 +35,18 @@ public class Worker implements Runnable {
public void run() {
while (!Thread.interrupted()) {
try {
- // 控制请求频率
+ // Control request rate
if (semaphore.tryAcquire()) {
ConsumerRecords records = consumer.poll(Duration.ofMillis(sleepTime));
pool.submit(() -> {
RateLimiter limiter = RateLimiter.create(rate);
try {
for (ConsumerRecord record : records) {
- // 流量控制
+ // Traffic control
limiter.acquire();
- // 业务处理数据
- System.out.println("[" + LocalDateTime.now() + "] Thread id:" + Thread.currentThread().getId() + " -> " + record.value());
+ // Business data processing
+ System.out.println("[" + LocalDateTime.now() + "] Thread id:"
+ + Thread.currentThread().getId() + " -> " + record.value());
}
} finally {
semaphore.release();
diff --git a/docs/examples/JDBC/mybatisplus-demo/readme b/docs/examples/JDBC/mybatisplus-demo/readme
index b31b6c34bf..a4816d7631 100644
--- a/docs/examples/JDBC/mybatisplus-demo/readme
+++ b/docs/examples/JDBC/mybatisplus-demo/readme
@@ -1,14 +1,14 @@
-# 使用说明
+# Instructions
-## 创建使用db
+## Create and use the database
```shell
$ taos
> create database mp_test
```
-## 执行测试用例
+## Execute test cases
```shell
$ mvn clean test
-```
\ No newline at end of file
+```
diff --git a/docs/examples/JDBC/springbootdemo/readme.md b/docs/examples/JDBC/springbootdemo/readme.md
index 625d43e4ed..d11bb33c83 100644
--- a/docs/examples/JDBC/springbootdemo/readme.md
+++ b/docs/examples/JDBC/springbootdemo/readme.md
@@ -1,6 +1,6 @@
## TDengine SpringBoot + Mybatis Demo
-## 需要提前创建 test 数据库
+## Need to create a test database in advance
```
$ taos -s 'create database if not exists test'
@@ -8,7 +8,7 @@ $ taos -s 'create database if not exists test'
$ curl http://localhost:8080/weather/init
```
-### 配置 application.properties
+### Configure application.properties
```properties
# datasource config
spring.datasource.driver-class-name=com.taosdata.jdbc.TSDBDriver
@@ -38,9 +38,9 @@ mybatis.mapper-locations=classpath:mapper/*.xml
logging.level.com.taosdata.jdbc.springbootdemo.dao=debug
```
-### 主要功能
+### Main functions
-* 创建数据库和表
+* Create databases and tables
```xml
@@ -52,14 +52,14 @@ logging.level.com.taosdata.jdbc.springbootdemo.dao=debug
```
-* 插入单条记录
+* Insert a single record
```xml
insert into test.weather (ts, temperature, humidity) values (now, #{temperature,jdbcType=INTEGER}, #{humidity,jdbcType=FLOAT})
```
-* 插入多条记录
+* Insert multiple records
```xml
@@ -69,7 +69,7 @@ logging.level.com.taosdata.jdbc.springbootdemo.dao=debug
```
-* 分页查询
+* Pagination query
```xml
diff --git a/docs/examples/JDBC/taosdemo/readme.md b/docs/examples/JDBC/taosdemo/readme.md
index 986eef8a05..141391d1f6 100644
--- a/docs/examples/JDBC/taosdemo/readme.md
+++ b/docs/examples/JDBC/taosdemo/readme.md
@@ -1,11 +1,14 @@
```
cd tests/examples/JDBC/taosdemo
mvn clean package -Dmaven.test.skip=true
-# 先建表,再插入的
+# Create tables first, then insert data
java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host -database -doCreateTable true -superTableSQL "create table weather(ts timestamp, f1 int) tags(t1 nchar(4))" -numOfTables 1000 -numOfRowsPerTable 100000000 -numOfThreadsForInsert 10 -numOfTablesPerSQL 10 -numOfValuesPerSQL 100
-# 不建表,直接插入的
+# Insert data directly without creating tables
java -jar target/taosdemo-2.0.1-jar-with-dependencies.jar -host -database -doCreateTable false -superTableSQL "create table weather(ts timestamp, f1 int) tags(t1 nchar(4))" -numOfTables 1000 -numOfRowsPerTable 100000000 -numOfThreadsForInsert 10 -numOfTablesPerSQL 10 -numOfValuesPerSQL 100
```
如果发生错误 Exception in thread "main" java.lang.UnsatisfiedLinkError: no taos in java.library.path
请检查是否安装 TDengine 客户端安装包或编译 TDengine 安装。如果确定已经安装过还出现这个错误,可以在命令行 java 后加 -Djava.library.path=/usr/lib 来指定寻找共享库的路径。
+
+
+If you encounter the error Exception in thread "main" `java.lang.UnsatisfiedLinkError: no taos in java.library.path`, please check whether the TDengine client package is installed or TDengine is compiled and installed. If you are sure it is installed and still encounter this error, you can add `-Djava.library.path=/usr/lib` after the `java` command to specify the path to the shared library.
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java
index 6854054703..40d44475b8 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/TaosDemoApplication.java
@@ -24,14 +24,14 @@ public class TaosDemoApplication {
private static final Logger logger = LogManager.getLogger(TaosDemoApplication.class);
public static void main(String[] args) throws IOException {
- // 读配置参数
+ // Read configuration parameters
JdbcTaosdemoConfig config = new JdbcTaosdemoConfig(args);
boolean isHelp = Arrays.asList(args).contains("--help");
if (isHelp || config.host == null || config.host.isEmpty()) {
JdbcTaosdemoConfig.printHelp();
System.exit(0);
}
- // 初始化
+ //
final DataSource dataSource = DataSourceFactory.getInstance(config.host, config.port, config.user,
config.password);
if (config.executeSql != null && !config.executeSql.isEmpty()
@@ -50,7 +50,7 @@ public class TaosDemoApplication {
final SuperTableService superTableService = new SuperTableService(dataSource);
final SubTableService subTableService = new SubTableService(dataSource);
- // 创建数据库
+ // create database
long start = System.currentTimeMillis();
Map databaseParam = new HashMap<>();
databaseParam.put("database", config.database);
@@ -81,13 +81,13 @@ public class TaosDemoApplication {
config.prefixOfFields, config.numOfTags, config.prefixOfTags);
}
/**********************************************************************************/
- // 建表
+ // create table
start = System.currentTimeMillis();
if (config.doCreateTable) {
superTableService.drop(superTableMeta.getDatabase(), superTableMeta.getName());
superTableService.create(superTableMeta);
if (!config.autoCreateTable) {
- // 批量建子表
+ // create sub tables in batch
subTableService.createSubTable(superTableMeta, config.numOfTables, config.prefixOfTable,
config.numOfThreadsForCreate);
}
@@ -95,7 +95,7 @@ public class TaosDemoApplication {
end = System.currentTimeMillis();
logger.info(">>> create table time cost : " + (end - start) + " ms.");
/**********************************************************************************/
- // 插入
+ // insert data
long tableSize = config.numOfTables;
int threadSize = config.numOfThreadsForInsert;
long startTime = getProperStartTime(config.startTime, config.days);
@@ -111,10 +111,9 @@ public class TaosDemoApplication {
end = System.currentTimeMillis();
logger.info("insert " + affectedRows + " rows, time cost: " + (end - start) + " ms");
/**********************************************************************************/
- // 查询
/**********************************************************************************/
- // 删除表
+ // drop table
if (config.dropTable) {
superTableService.drop(config.database, config.superTable);
}
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapper.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapper.java
index e0ddd220c1..013d24eb87 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapper.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SubTableMapper.java
@@ -9,21 +9,22 @@ import java.util.List;
@Repository
public interface SubTableMapper {
- // 创建:子表
+ // Create: SubTable
void createUsingSuperTable(SubTableMeta subTableMeta);
- // 插入:一张子表多个values
+ // Insert: Multiple records into one SubTable
int insertOneTableMultiValues(SubTableValue subTableValue);
- // 插入:一张子表多个values, 自动建表
+ // Insert: Multiple records into one SubTable, auto create SubTables
int insertOneTableMultiValuesUsingSuperTable(SubTableValue subTableValue);
- // 插入:多张表多个values
+ // Insert: Multiple records into multiple SubTable
int insertMultiTableMultiValues(List tables);
- // 插入:多张表多个values,自动建表
+ // Insert: Multiple records into multiple SubTable, auto create SubTables
int insertMultiTableMultiValuesUsingSuperTable(List tables);
- //
+ //
-}
\ No newline at end of file
+}
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapper.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapper.java
index 9f8cec9e8f..15cafd04fb 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapper.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/SuperTableMapper.java
@@ -6,24 +6,26 @@ import org.springframework.stereotype.Repository;
@Repository
public interface SuperTableMapper {
- // 创建超级表 create table if not exists xxx.xxx (f1 type1, f2 type2, ... ) tags( t1 type1, t2 type2 ...)
+ // Create super table: create table if not exists xxx.xxx (f1 type1, f2 type2,
+ // ... ) tags( t1 type1, t2 type2 ...)
void createSuperTable(SuperTableMeta tableMetadata);
- // 删除超级表 drop table if exists xxx;
+ // Drop super table: drop table if exists xxx;
void dropSuperTable(String database, String name);
- //
+ //
- //
+ //
- //
+ //
- //
+ //
- //
+ //
- //
-
- //
+ //
+ //
}
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapper.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapper.java
index 32d1875e4d..c0f75d2204 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapper.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/dao/TableMapper.java
@@ -9,19 +9,18 @@ import java.util.List;
@Repository
public interface TableMapper {
- // 创建:普通表
+ // Create: Normal table
void create(TableMeta tableMeta);
- // 插入:一张表多个value
+ // Insert: Multiple records into one table
int insertOneTableMultiValues(TableValue values);
- // 插入: 一张表多个value,指定的列
+ // Insert: Multiple records into one table, specified columns
int insertOneTableMultiValuesWithColumns(TableValue values);
- // 插入:多个表多个value
+ // Insert: Multiple records into multiple tables
int insertMultiTableMultiValues(List tables);
- // 插入:多个表多个value, 指定的列
+ // Insert: Multiple records into multiple tables, specified columns
int insertMultiTableMultiValuesWithColumns(List tables);
-
-}
\ No newline at end of file
+}
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/DatabaseService.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/DatabaseService.java
index 3c8e962406..68ddd78323 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/DatabaseService.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/DatabaseService.java
@@ -14,12 +14,12 @@ public class DatabaseService {
this.databaseMapper = new DatabaseMapperImpl(dataSource);
}
- // 建库,指定 name
+ // Create database with specified name
public void createDatabase(String database) {
databaseMapper.createDatabase(database);
}
- // 建库,指定参数 keep,days,replica等
+ // Create database with specified parameters such as keep, days, replica, etc.
public void createDatabase(Map map) {
if (map.isEmpty())
return;
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SubTableService.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SubTableService.java
index b0a79dea78..690b02f065 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SubTableService.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SubTableService.java
@@ -27,7 +27,8 @@ public class SubTableService extends AbstractService {
this.mapper = new SubTableMapperImpl(datasource);
}
- public void createSubTable(SuperTableMeta superTableMeta, long numOfTables, String prefixOfTable, int numOfThreadsForCreate) {
+ public void createSubTable(SuperTableMeta superTableMeta, long numOfTables, String prefixOfTable,
+ int numOfThreadsForCreate) {
ExecutorService executor = Executors.newFixedThreadPool(numOfThreadsForCreate);
for (long i = 0; i < numOfTables; i++) {
long tableIndex = i;
@@ -35,54 +36,58 @@ public class SubTableService extends AbstractService {
}
executor.shutdown();
try {
- executor.awaitTermination(Long.MAX_VALUE,TimeUnit.NANOSECONDS);
+ executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void createSubTable(SuperTableMeta superTableMeta, String tableName) {
- // 构造数据
+ // Construct data
SubTableMeta meta = SubTableMetaGenerator.generate(superTableMeta, tableName);
createSubTable(meta);
}
- // 创建一张子表,可以指定database,supertable,tablename,tag值
+ // Create a sub-table, specifying database, super table, table name, and tag
+ // values
public void createSubTable(SubTableMeta subTableMeta) {
mapper.createUsingSuperTable(subTableMeta);
}
/*************************************************************************************************************************/
- // 插入:多线程,多表
+ // Insert: Multi-threaded, multiple tables
public int insert(List subTableValues, int threadSize, int frequency) {
ExecutorService executor = Executors.newFixedThreadPool(threadSize);
Future future = executor.submit(() -> insert(subTableValues));
executor.shutdown();
- //TODO:frequency
+ // TODO:frequency
return getAffectRows(future);
}
- // 插入:单表,insert into xxx values(),()...
+ // Insert: Single table, insert into xxx values(),()...
public int insert(SubTableValue subTableValue) {
return mapper.insertOneTableMultiValues(subTableValue);
}
- // 插入: 多表,insert into xxx values(),()... xxx values(),()...
+ // Insert: Multiple tables, insert into xxx values(),()... xxx values(),()...
public int insert(List subTableValues) {
return mapper.insertMultiTableMultiValues(subTableValues);
}
- // 插入:单表,自动建表, insert into xxx using xxx tags(...) values(),()...
+ // Insert: Single table, auto-create table, insert into xxx using xxx tags(...)
+ // values(),()...
public int insertAutoCreateTable(SubTableValue subTableValue) {
return mapper.insertOneTableMultiValuesUsingSuperTable(subTableValue);
}
- // 插入:多表,自动建表, insert into xxx using XXX tags(...) values(),()... xxx using XXX tags(...) values(),()...
+ // Insert: Multiple tables, auto-create tables, insert into xxx using XXX
+ // tags(...) values(),()... xxx using XXX tags(...) values(),()...
public int insertAutoCreateTable(List subTableValues) {
return mapper.insertMultiTableMultiValuesUsingSuperTable(subTableValues);
}
- public int insertMultiThreads(SuperTableMeta superTableMeta, int threadSize, long tableSize, long startTime, long gap, JdbcTaosdemoConfig config) {
+ public int insertMultiThreads(SuperTableMeta superTableMeta, int threadSize, long tableSize, long startTime,
+ long gap, JdbcTaosdemoConfig config) {
List taskList = new ArrayList<>();
List threads = IntStream.range(0, threadSize)
.mapToObj(i -> {
@@ -94,8 +99,7 @@ public class SubTableService extends AbstractService {
startTime, config.timeGap,
config.numOfRowsPerTable, config.numOfTablesPerSQL, config.numOfValuesPerSQL,
config.order, config.rate, config.range,
- config.prefixOfTable, config.autoCreateTable)
- );
+ config.prefixOfTable, config.autoCreateTable));
taskList.add(task);
return new Thread(task, "InsertThread-" + i);
}).collect(Collectors.toList());
@@ -126,7 +130,7 @@ public class SubTableService extends AbstractService {
private class InsertTask implements Callable {
private final long startTableInd; // included
- private final long endTableInd; // excluded
+ private final long endTableInd; // excluded
private final long startTime;
private final long timeGap;
private final long numOfRowsPerTable;
@@ -140,10 +144,10 @@ public class SubTableService extends AbstractService {
private final boolean autoCreateTable;
public InsertTask(SuperTableMeta superTableMeta, long startTableInd, long endTableInd,
- long startTime, long timeGap,
- long numOfRowsPerTable, long numOfTablesPerSQL, long numOfValuesPerSQL,
- int order, int rate, long range,
- String prefixOfTable, boolean autoCreateTable) {
+ long startTime, long timeGap,
+ long numOfRowsPerTable, long numOfTablesPerSQL, long numOfValuesPerSQL,
+ int order, int rate, long range,
+ String prefixOfTable, boolean autoCreateTable) {
this.superTableMeta = superTableMeta;
this.startTableInd = startTableInd;
this.endTableInd = endTableInd;
@@ -159,7 +163,6 @@ public class SubTableService extends AbstractService {
this.autoCreateTable = autoCreateTable;
}
-
@Override
public Integer call() {
@@ -171,23 +174,27 @@ public class SubTableService extends AbstractService {
int affectRows = 0;
// row
- for (long rowCnt = 0; rowCnt < numOfRowsPerTable; ) {
+ for (long rowCnt = 0; rowCnt < numOfRowsPerTable;) {
long rowSize = numOfValuesPerSQL;
if (rowCnt + rowSize > numOfRowsPerTable) {
rowSize = numOfRowsPerTable - rowCnt;
}
- //table
- for (long tableCnt = startTableInd; tableCnt < endTableInd; ) {
+ // table
+ for (long tableCnt = startTableInd; tableCnt < endTableInd;) {
long tableSize = numOfTablesPerSQL;
if (tableCnt + tableSize > endTableInd) {
tableSize = endTableInd - tableCnt;
}
long startTime = this.startTime + rowCnt * timeGap;
-// System.out.println(Thread.currentThread().getName() + " >>> " + "rowCnt: " + rowCnt + ", rowSize: " + rowSize + ", " + "tableCnt: " + tableCnt + ",tableSize: " + tableSize + ", " + "startTime: " + startTime + ",timeGap: " + timeGap + "");
+ // System.out.println(Thread.currentThread().getName() + " >>> " + "rowCnt: " +
+ // rowCnt + ", rowSize: " + rowSize + ", " + "tableCnt: " + tableCnt +
+ // ",tableSize: " + tableSize + ", " + "startTime: " + startTime + ",timeGap: "
+ // + timeGap + "");
/***********************************************/
- // 生成数据
- List data = SubTableValueGenerator.generate(superTableMeta, prefixOfTable, tableCnt, tableSize, rowSize, startTime, timeGap);
- // 乱序
+ // Construct data
+ List data = SubTableValueGenerator.generate(superTableMeta, prefixOfTable, tableCnt,
+ tableSize, rowSize, startTime, timeGap);
+ // disorder
if (order != 0)
SubTableValueGenerator.disrupt(data, rate, range);
// insert
@@ -205,5 +212,4 @@ public class SubTableService extends AbstractService {
}
}
-
}
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SuperTableService.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SuperTableService.java
index b91348e2d0..47798e0c4e 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SuperTableService.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/SuperTableService.java
@@ -14,7 +14,7 @@ public class SuperTableService {
this.superTableMapper = new SuperTableMapperImpl(dataSource);
}
- // 创建超级表,指定每个field的名称和类型,每个tag的名称和类型
+ // Create super table, specifying the name and type of each field and each tag
public void create(SuperTableMeta superTableMeta) {
superTableMapper.createSuperTable(superTableMeta);
}
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/TableService.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/TableService.java
index 2504fdb0b4..2bfb963b4a 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/TableService.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/TableService.java
@@ -11,15 +11,14 @@ public class TableService extends AbstractService {
private TableMapper tableMapper;
- //创建一张表
+ // Create a table
public void create(TableMeta tableMeta) {
tableMapper.create(tableMeta);
}
- //创建多张表
+ // Create multiple tables
public void create(List tables) {
tables.stream().forEach(this::create);
}
-
}
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/FieldValueGenerator.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/FieldValueGenerator.java
index 73cd981a46..b3ce35231c 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/FieldValueGenerator.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/FieldValueGenerator.java
@@ -11,7 +11,8 @@ public class FieldValueGenerator {
public static Random random = new Random(System.currentTimeMillis());
- // 生成start到end的时间序列,时间戳为顺序,不含有乱序,field的value为随机生成
+ // Generate a time series from start to end, timestamps are in order without
+ // disorder, field values are randomly generated
public static List generate(long start, long end, long timeGap, List fieldMetaList) {
List values = new ArrayList<>();
@@ -29,9 +30,12 @@ public class FieldValueGenerator {
return values;
}
- // 生成start到end的时间序列,时间戳为顺序,含有乱序,rate为乱序的比例,range为乱序前跳范围,field的value为随机生成
+ // Generate a time series from start to end, timestamps are in order but include
+ // disorder, rate is the proportion of disorder, range is the jump range before
+ // disorder, field values are randomly generated
public static List disrupt(List values, int rate, long range) {
- long timeGap = (long) (values.get(1).getFields().get(0).getValue()) - (long) (values.get(0).getFields().get(0).getValue());
+ long timeGap = (long) (values.get(1).getFields().get(0).getValue())
+ - (long) (values.get(0).getFields().get(0).getValue());
int bugSize = values.size() * rate / 100;
Set bugIndSet = new HashSet<>();
while (bugIndSet.size() < bugSize) {
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SubTableMetaGenerator.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SubTableMetaGenerator.java
index 88e3c0d26a..7bdd72ec3b 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SubTableMetaGenerator.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SubTableMetaGenerator.java
@@ -9,7 +9,7 @@ import java.util.List;
public class SubTableMetaGenerator {
- // 创建tableSize张子表,使用tablePrefix作为子表名的前缀,使用superTableMeta的元数据
+ // Create tableSize sub-tables, using tablePrefix as the prefix for sub-table names, and using the metadata from superTableMeta
// create table xxx using XXX tags(XXX)
public static List generate(SuperTableMeta superTableMeta, int tableSize, String tablePrefix) {
List subTableMetaList = new ArrayList<>();
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SuperTableMetaGenerator.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SuperTableMetaGenerator.java
index 05aefd01ac..383b492c5a 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SuperTableMetaGenerator.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/SuperTableMetaGenerator.java
@@ -10,10 +10,11 @@ import java.util.List;
public class SuperTableMetaGenerator {
- // 创建超级表,使用指定SQL语句
+ // Create super table using the specified SQL statement
public static SuperTableMeta generate(String superTableSQL) {
SuperTableMeta tableMeta = new SuperTableMeta();
- // for example : create table superTable (ts timestamp, temperature float, humidity int) tags(location nchar(64), groupId int)
+ // for example : create table superTable (ts timestamp, temperature float,
+ // humidity int) tags(location nchar(64), groupId int)
superTableSQL = superTableSQL.trim().toLowerCase();
if (!superTableSQL.startsWith("create"))
throw new RuntimeException("invalid create super table SQL");
@@ -54,8 +55,9 @@ public class SuperTableMetaGenerator {
return tableMeta;
}
- // 创建超级表,指定field和tag的个数
- public static SuperTableMeta generate(String database, String name, int fieldSize, String fieldPrefix, int tagSize, String tagPrefix) {
+ // Create super table with specified number of fields and tags
+ public static SuperTableMeta generate(String database, String name, int fieldSize, String fieldPrefix, int tagSize,
+ String tagPrefix) {
if (fieldSize < 2 || tagSize < 1) {
throw new RuntimeException("create super table but fieldSize less than 2 or tagSize less than 1");
}
@@ -66,7 +68,8 @@ public class SuperTableMetaGenerator {
List fields = new ArrayList<>();
fields.add(new FieldMeta("ts", "timestamp"));
for (int i = 1; i <= fieldSize; i++) {
- fields.add(new FieldMeta(fieldPrefix + "" + i, TaosConstants.DATA_TYPES[i % TaosConstants.DATA_TYPES.length]));
+ fields.add(
+ new FieldMeta(fieldPrefix + "" + i, TaosConstants.DATA_TYPES[i % TaosConstants.DATA_TYPES.length]));
}
tableMetadata.setFields(fields);
// tags
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/TagValueGenerator.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/TagValueGenerator.java
index b8024fea45..f7b18ca7cf 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/TagValueGenerator.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/service/data/TagValueGenerator.java
@@ -9,7 +9,7 @@ import java.util.List;
public class TagValueGenerator {
- // 创建标签值:使用tagMetas
+ // Create tag values using tagMetas
public static List generate(List tagMetas) {
List tagValues = new ArrayList<>();
for (int i = 0; i < tagMetas.size(); i++) {
diff --git a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/TimeStampUtil.java b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/TimeStampUtil.java
index 9cfce16d82..53748169ae 100644
--- a/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/TimeStampUtil.java
+++ b/docs/examples/JDBC/taosdemo/src/main/java/com/taosdata/taosdemo/utils/TimeStampUtil.java
@@ -41,17 +41,17 @@ public class TimeStampUtil {
if (start == 0)
start = now - size * timeGap;
- // 如果size小于1异常
+ // If size is less than 1, throw an exception
if (size < 1)
throw new IllegalArgumentException("size less than 1.");
- // 如果timeGap为1,已经超长,需要前移start
+ // If timeGap is 1 and it exceeds the limit, move start forward
if (start + size > now) {
start = now - size;
return new TimeTuple(start, now, 1);
}
long end = start + (long) (timeGap * size);
if (end > now) {
- //压缩timeGap
+ // Compress timeGap
end = now;
double gap = (end - start) / (size * 1.0f);
if (gap < 1.0f) {
diff --git a/docs/examples/JDBC/taosdemo/src/main/resources/log4j.properties b/docs/examples/JDBC/taosdemo/src/main/resources/log4j.properties
index 352545854d..40b1478a24 100644
--- a/docs/examples/JDBC/taosdemo/src/main/resources/log4j.properties
+++ b/docs/examples/JDBC/taosdemo/src/main/resources/log4j.properties
@@ -1,21 +1,21 @@
-### 设置###
+### Settings ###
log4j.rootLogger=info,stdout
-### 输出信息到控制抬 ###
+### Output information to the console ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} method:%l%n%m%n
-### 输出DEBUG 级别以上的日志到=logs/debug.log
+### Output logs of DEBUG level and above to logs/debug.log ###
log4j.appender.DebugLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.DebugLog.File=logs/debug.log
log4j.appender.DebugLog.Append=true
log4j.appender.DebugLog.Threshold=DEBUG
log4j.appender.DebugLog.layout=org.apache.log4j.PatternLayout
log4j.appender.DebugLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
-### 输出ERROR 级别以上的日志到=logs/error.log
+### Output logs of ERROR level and above to logs/error.log ###
log4j.appender.ErrorLog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ErrorLog.File=logs/error.log
log4j.appender.ErrorLog.Append=true
log4j.appender.ErrorLog.Threshold=ERROR
log4j.appender.ErrorLog.layout=org.apache.log4j.PatternLayout
-log4j.appender.ErrorLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
\ No newline at end of file
+log4j.appender.ErrorLog.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
diff --git a/docs/zh/01-index.md b/docs/zh/01-index.md
index df6c327866..32ea117fbb 100644
--- a/docs/zh/01-index.md
+++ b/docs/zh/01-index.md
@@ -6,7 +6,7 @@ slug: /
TDengine 是一款[开源](https://www.taosdata.com/tdengine/open_source_time-series_database)、[高性能](https://www.taosdata.com/fast)、[云原生](https://www.taosdata.com/tdengine/cloud_native_time-series_database)的时序数据库(Time Series Database, TSDB), 它专为物联网、车联网、工业互联网、金融、IT 运维等场景优化设计。同时它还带有内建的缓存、流式计算、数据订阅等系统功能,能大幅减少系统设计的复杂度,降低研发和运营成本,是一款极简的时序数据处理平台。本文档是 TDengine 的用户手册,主要是介绍 TDengine 的基本概念、安装、使用、功能、开发接口、运营维护、TDengine 内核设计等等,它主要是面向架构师、开发工程师与系统管理员的。如果你对时序数据的基本概念、价值以及其所能带来的业务价值尚不了解,请参考[时序数据基础](./concept)
-TDengine 充分利用了时序数据的特点,提出了“一个数据采集点一张表”与“超级表”的概念,设计了创新的存储引擎,让数据的写入、查询和存储效率都得到极大的提升。为正确理解并使用 TDengine,无论如何,请您仔细阅读[快速入门](./basic)一章。
+TDengine 充分利用了时序数据的特点,提出了“一个数据采集点一张表”与“超级表”的概念,设计了创新的存储引擎,让数据的写入、查询和存储效率都得到极大的提升。为正确理解并使用 TDengine,无论如何,请您仔细阅读[数据模型](./basic/model)一章。
如果你是开发工程师,请一定仔细阅读[开发指南](./develop)一章,该部分对数据库连接、建模、插入数据、查询、流式计算、缓存、数据订阅、用户自定义函数等功能都做了详细介绍,并配有各种编程语言的示例代码。大部分情况下,你只要复制粘贴示例代码,针对自己的应用稍作改动,就能跑起来。对 REST API、各种编程语言的连接器(Connector)想做更多详细了解的话,请看[连接器](./reference/connector)一章。
diff --git a/docs/zh/14-reference/01-components/07-explorer.md b/docs/zh/14-reference/01-components/07-explorer.md
index c63bc703e2..499fb3697c 100644
--- a/docs/zh/14-reference/01-components/07-explorer.md
+++ b/docs/zh/14-reference/01-components/07-explorer.md
@@ -4,11 +4,11 @@ sidebar_label: taosExplorer
toc_max_heading_level: 4
---
-taosExplorer 是一个为用户提供 TDengine 实例的可视化管理交互工具的 web 服务。本节主要讲述其安装和部署。它的各项功能都是基于简单易上手的图形界面,可以直接尝试,如果有需要也可以考高级功能和运维指南中的相关内容。为了确保访问 taosExplorer 的最佳体验,请使用 Chrome 79 及以上版本,或 Edge 79 及以上版本。
+taosExplorer 是一个为用户提供 TDengine 实例的可视化管理交互工具的 web 服务,虽然它没有开源,但随开源版安装包免费提供。本节主要讲述其安装和部署。它的各项功能都是基于简单易上手的图形界面,可以直接尝试,如果有需要也可以参考高级功能和运维指南中的相关内容。为了确保访问 taosExplorer 的最佳体验,请使用 Chrome 79 及以上版本,或 Edge 79 及以上版本。
## 安装
-taosEexplorer 无需单独安装,从 TDengine 3.3.0.0 版本开始,它随着 TDengine Enterprise Server 安装包一起发布,安装完成后,就可以看到 `taos-explorer` 服务。
+taosEexplorer 无需单独安装,从 TDengine 3.3.0.0 版本开始,它随着 TDengine 安装包一起发布,安装完成后,就可以看到 `taos-explorer` 服务。如果按照 GitHub 里步骤自己编译 TDengine 源代码生成的安装包不包含 taosExplorer。
## 配置
diff --git a/docs/zh/14-reference/02-tools/10-taosbenchmark.md b/docs/zh/14-reference/02-tools/10-taosbenchmark.md
index 3f15d6b8e3..3c43c58915 100644
--- a/docs/zh/14-reference/02-tools/10-taosbenchmark.md
+++ b/docs/zh/14-reference/02-tools/10-taosbenchmark.md
@@ -477,7 +477,9 @@ taosBenchmark -A INT,DOUBLE,NCHAR,BINARY\(16\)
| 13 | BOOL | bool
| 14 | NCHAR | nchar
| 15 | VARCHAR | varchar
-| 15 | JSON | json
+| 16 | VARBINARY | varbinary
+| 17 | GEOMETRY | geometry
+| 18 | JSON | json
注意:taosBenchmark 配置文件中数据类型必须小写方可识别
diff --git a/include/common/systable.h b/include/common/systable.h
index 65b3b36af8..0acafbfc30 100644
--- a/include/common/systable.h
+++ b/include/common/systable.h
@@ -29,6 +29,8 @@ extern "C" {
#define TSDB_INS_TABLE_QNODES "ins_qnodes"
#define TSDB_INS_TABLE_BNODES "ins_bnodes" // no longer used
#define TSDB_INS_TABLE_SNODES "ins_snodes"
+#define TSDB_INS_TABLE_ANODES "ins_anodes"
+#define TSDB_INS_TABLE_ANODES_FULL "ins_anodes_full"
#define TSDB_INS_TABLE_ARBGROUPS "ins_arbgroups"
#define TSDB_INS_TABLE_CLUSTER "ins_cluster"
#define TSDB_INS_TABLE_DATABASES "ins_databases"
diff --git a/include/common/tanal.h b/include/common/tanal.h
new file mode 100644
index 0000000000..69d110d161
--- /dev/null
+++ b/include/common/tanal.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _TD_UTIL_ANAL_H_
+#define _TD_UTIL_ANAL_H_
+
+#include "os.h"
+#include "tdef.h"
+#include "thash.h"
+#include "tjson.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ANAL_FORECAST_DEFAULT_ROWS 10
+#define ANAL_FORECAST_DEFAULT_CONF 95
+#define ANAL_FORECAST_DEFAULT_WNCHECK 1
+#define ANAL_FORECAST_MAX_ROWS 10000
+#define ANAL_ANOMALY_WINDOW_MAX_ROWS 10000
+
+typedef struct {
+ EAnalAlgoType type;
+ int32_t anode;
+ int32_t urlLen;
+ char *url;
+} SAnalUrl;
+
+typedef enum {
+ ANAL_BUF_TYPE_JSON = 0,
+ ANAL_BUF_TYPE_JSON_COL = 1,
+ ANAL_BUF_TYPE_OTHERS,
+} EAnalBufType;
+
+typedef enum {
+ ANAL_HTTP_TYPE_GET = 0,
+ ANAL_HTTP_TYPE_POST,
+} EAnalHttpType;
+
+typedef struct {
+ TdFilePtr filePtr;
+ char fileName[TSDB_FILENAME_LEN + 10];
+ int64_t numOfRows;
+} SAnalColBuf;
+
+typedef struct {
+ EAnalBufType bufType;
+ TdFilePtr filePtr;
+ char fileName[TSDB_FILENAME_LEN];
+ int32_t numOfCols;
+ SAnalColBuf *pCols;
+} SAnalBuf;
+
+int32_t taosAnalInit();
+void taosAnalCleanup();
+SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalBuf *pBuf);
+
+int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen);
+bool taosAnalGetOptStr(const char *option, const char *optName, char *optValue, int32_t optMaxLen);
+bool taosAnalGetOptInt(const char *option, const char *optName, int64_t *optValue);
+int64_t taosAnalGetVersion();
+void taosAnalUpdate(int64_t newVer, SHashObj *pHash);
+
+int32_t tsosAnalBufOpen(SAnalBuf *pBuf, int32_t numOfCols);
+int32_t taosAnalBufWriteOptStr(SAnalBuf *pBuf, const char *optName, const char *optVal);
+int32_t taosAnalBufWriteOptInt(SAnalBuf *pBuf, const char *optName, int64_t optVal);
+int32_t taosAnalBufWriteOptFloat(SAnalBuf *pBuf, const char *optName, float optVal);
+int32_t taosAnalBufWriteColMeta(SAnalBuf *pBuf, int32_t colIndex, int32_t colType, const char *colName);
+int32_t taosAnalBufWriteDataBegin(SAnalBuf *pBuf);
+int32_t taosAnalBufWriteColBegin(SAnalBuf *pBuf, int32_t colIndex);
+int32_t taosAnalBufWriteColData(SAnalBuf *pBuf, int32_t colIndex, int32_t colType, void *colValue);
+int32_t taosAnalBufWriteColEnd(SAnalBuf *pBuf, int32_t colIndex);
+int32_t taosAnalBufWriteDataEnd(SAnalBuf *pBuf);
+int32_t taosAnalBufClose(SAnalBuf *pBuf);
+void taosAnalBufDestroy(SAnalBuf *pBuf);
+
+const char *taosAnalAlgoStr(EAnalAlgoType algoType);
+EAnalAlgoType taosAnalAlgoInt(const char *algoName);
+const char *taosAnalAlgoUrlStr(EAnalAlgoType algoType);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /*_TD_UTIL_ANAL_H_*/
\ No newline at end of file
diff --git a/include/common/tglobal.h b/include/common/tglobal.h
index cf918c6e0d..41fb692e42 100644
--- a/include/common/tglobal.h
+++ b/include/common/tglobal.h
@@ -42,21 +42,21 @@ typedef enum {
} EEncryptScope;
// cluster
-extern char tsFirst[];
-extern char tsSecond[];
-extern char tsLocalFqdn[];
-extern char tsLocalEp[];
-extern char tsVersionName[];
-extern uint16_t tsServerPort;
-extern int32_t tsVersion;
-extern int32_t tsStatusInterval;
-extern int32_t tsNumOfSupportVnodes;
-extern char tsEncryptAlgorithm[];
-extern char tsEncryptScope[];
-extern EEncryptAlgor tsiEncryptAlgorithm;
-extern EEncryptScope tsiEncryptScope;
-//extern char tsAuthCode[];
-extern char tsEncryptKey[];
+extern char tsFirst[];
+extern char tsSecond[];
+extern char tsLocalFqdn[];
+extern char tsLocalEp[];
+extern char tsVersionName[];
+extern uint16_t tsServerPort;
+extern int32_t tsVersion;
+extern int32_t tsStatusInterval;
+extern int32_t tsNumOfSupportVnodes;
+extern char tsEncryptAlgorithm[];
+extern char tsEncryptScope[];
+extern EEncryptAlgor tsiEncryptAlgorithm;
+extern EEncryptScope tsiEncryptScope;
+// extern char tsAuthCode[];
+extern char tsEncryptKey[];
// common
extern int32_t tsMaxShellConns;
@@ -71,6 +71,8 @@ extern int32_t tsTagFilterResCacheSize;
// queue & threads
extern int32_t tsNumOfRpcThreads;
extern int32_t tsNumOfRpcSessions;
+extern int32_t tsShareConnLimit;
+extern int32_t tsReadTimeout;
extern int32_t tsTimeToGetAvailableConn;
extern int32_t tsKeepAliveIdle;
extern int32_t tsNumOfCommitThreads;
@@ -264,8 +266,8 @@ extern bool tsExperimental;
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc);
-int32_t taosReadDataFolder(const char *cfgDir, const char **envCmd,
- const char *envFile, char *apolloUrl, SArray *pArgs);
+int32_t taosReadDataFolder(const char *cfgDir, const char **envCmd, const char *envFile, char *apolloUrl,
+ SArray *pArgs);
int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile, char *apolloUrl, SArray *pArgs,
bool tsc);
void taosCleanupCfg();
diff --git a/include/common/tmsg.h b/include/common/tmsg.h
index 1a10f02c96..01808d4f2f 100644
--- a/include/common/tmsg.h
+++ b/include/common/tmsg.h
@@ -159,6 +159,8 @@ typedef enum _mgmt_table {
TSDB_MGMT_TABLE_ARBGROUP,
TSDB_MGMT_TABLE_ENCRYPTIONS,
TSDB_MGMT_TABLE_USER_FULL,
+ TSDB_MGMT_TABLE_ANODE,
+ TSDB_MGMT_TABLE_ANODE_FULL,
TSDB_MGMT_TABLE_MAX,
} EShowType;
@@ -260,6 +262,7 @@ typedef enum ENodeType {
QUERY_NODE_COUNT_WINDOW,
QUERY_NODE_COLUMN_OPTIONS,
QUERY_NODE_TSMA_OPTIONS,
+ QUERY_NODE_ANOMALY_WINDOW,
// Statement nodes are used in parser and planner module.
QUERY_NODE_SET_OPERATOR = 100,
@@ -345,6 +348,9 @@ typedef enum ENodeType {
QUERY_NODE_CREATE_VIEW_STMT,
QUERY_NODE_DROP_VIEW_STMT,
QUERY_NODE_CREATE_SUBTABLE_FROM_FILE_CLAUSE,
+ QUERY_NODE_CREATE_ANODE_STMT,
+ QUERY_NODE_DROP_ANODE_STMT,
+ QUERY_NODE_UPDATE_ANODE_STMT,
// show statement nodes
// see 'sysTableShowAdapter', 'SYSTABLE_SHOW_TYPE_OFFSET'
@@ -386,6 +392,8 @@ typedef enum ENodeType {
QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT,
QUERY_NODE_SHOW_ENCRYPTIONS_STMT,
QUERY_NODE_SHOW_TSMAS_STMT,
+ QUERY_NODE_SHOW_ANODES_STMT,
+ QUERY_NODE_SHOW_ANODES_FULL_STMT,
QUERY_NODE_CREATE_TSMA_STMT,
QUERY_NODE_SHOW_CREATE_TSMA_STMT,
QUERY_NODE_DROP_TSMA_STMT,
@@ -408,6 +416,7 @@ typedef enum ENodeType {
QUERY_NODE_LOGIC_PLAN,
QUERY_NODE_LOGIC_PLAN_GROUP_CACHE,
QUERY_NODE_LOGIC_PLAN_DYN_QUERY_CTRL,
+ QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC,
// physical plan node
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN = 1100,
@@ -458,6 +467,9 @@ typedef enum ENodeType {
QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT,
QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT,
QUERY_NODE_PHYSICAL_PLAN_STREAM_MID_INTERVAL,
+ QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY,
+ QUERY_NODE_PHYSICAL_PLAN_STREAM_ANOMALY,
+ QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC,
} ENodeType;
typedef struct {
@@ -971,6 +983,7 @@ typedef struct SEpSet {
SEp eps[TSDB_MAX_REPLICA];
} SEpSet;
+
int32_t tEncodeSEpSet(SEncoder* pEncoder, const SEpSet* pEp);
int32_t tDecodeSEpSet(SDecoder* pDecoder, SEpSet* pEp);
int32_t taosEncodeSEpSet(void** buf, const SEpSet* pEp);
@@ -1092,6 +1105,22 @@ typedef struct {
int32_t tSerializeRetrieveIpWhite(void* buf, int32_t bufLen, SRetrieveIpWhiteReq* pReq);
int32_t tDeserializeRetrieveIpWhite(void* buf, int32_t bufLen, SRetrieveIpWhiteReq* pReq);
+typedef struct {
+ int32_t dnodeId;
+ int64_t analVer;
+} SRetrieveAnalAlgoReq;
+
+typedef struct {
+ int64_t ver;
+ SHashObj* hash; // algoname:algotype -> SAnalUrl
+} SRetrieveAnalAlgoRsp;
+
+int32_t tSerializeRetrieveAnalAlgoReq(void* buf, int32_t bufLen, SRetrieveAnalAlgoReq* pReq);
+int32_t tDeserializeRetrieveAnalAlgoReq(void* buf, int32_t bufLen, SRetrieveAnalAlgoReq* pReq);
+int32_t tSerializeRetrieveAnalAlgoRsp(void* buf, int32_t bufLen, SRetrieveAnalAlgoRsp* pRsp);
+int32_t tDeserializeRetrieveAnalAlgoRsp(void* buf, int32_t bufLen, SRetrieveAnalAlgoRsp* pRsp);
+void tFreeRetrieveAnalAlgoRsp(SRetrieveAnalAlgoRsp* pRsp);
+
typedef struct {
int8_t alterType;
int8_t superUser;
@@ -1766,6 +1795,7 @@ typedef struct {
SArray* pVloads; // array of SVnodeLoad
int32_t statusSeq;
int64_t ipWhiteVer;
+ int64_t analVer;
} SStatusReq;
int32_t tSerializeSStatusReq(void* buf, int32_t bufLen, SStatusReq* pReq);
@@ -1831,6 +1861,7 @@ typedef struct {
SArray* pDnodeEps; // Array of SDnodeEp
int32_t statusSeq;
int64_t ipWhiteVer;
+ int64_t analVer;
} SStatusRsp;
int32_t tSerializeSStatusRsp(void* buf, int32_t bufLen, SStatusRsp* pRsp);
@@ -2377,6 +2408,30 @@ typedef struct {
int32_t tSerializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
int32_t tDeserializeSDCreateMnodeReq(void* buf, int32_t bufLen, SDCreateMnodeReq* pReq);
+typedef struct {
+ int32_t urlLen;
+ int32_t sqlLen;
+ char* url;
+ char* sql;
+} SMCreateAnodeReq;
+
+int32_t tSerializeSMCreateAnodeReq(void* buf, int32_t bufLen, SMCreateAnodeReq* pReq);
+int32_t tDeserializeSMCreateAnodeReq(void* buf, int32_t bufLen, SMCreateAnodeReq* pReq);
+void tFreeSMCreateAnodeReq(SMCreateAnodeReq* pReq);
+
+typedef struct {
+ int32_t anodeId;
+ int32_t sqlLen;
+ char* sql;
+} SMDropAnodeReq, SMUpdateAnodeReq;
+
+int32_t tSerializeSMDropAnodeReq(void* buf, int32_t bufLen, SMDropAnodeReq* pReq);
+int32_t tDeserializeSMDropAnodeReq(void* buf, int32_t bufLen, SMDropAnodeReq* pReq);
+void tFreeSMDropAnodeReq(SMDropAnodeReq* pReq);
+int32_t tSerializeSMUpdateAnodeReq(void* buf, int32_t bufLen, SMUpdateAnodeReq* pReq);
+int32_t tDeserializeSMUpdateAnodeReq(void* buf, int32_t bufLen, SMUpdateAnodeReq* pReq);
+void tFreeSMUpdateAnodeReq(SMUpdateAnodeReq* pReq);
+
typedef struct {
int32_t vgId;
int32_t hbSeq;
diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h
index 40464dc29a..2c797e39bf 100644
--- a/include/common/tmsgdef.h
+++ b/include/common/tmsgdef.h
@@ -125,6 +125,11 @@
TD_DEF_MSG_TYPE(TDMT_DND_ALTER_VNODE_TYPE, "dnode-alter-vnode-type", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_DND_CHECK_VNODE_LEARNER_CATCHUP, "dnode-check-vnode-learner-catchup", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_DND_CREATE_ENCRYPT_KEY, "create-encrypt-key", NULL, NULL)
+ // mnode msg overload
+ TD_DEF_MSG_TYPE(TDMT_MND_CREATE_ANODE, "create-anode", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_UPDATE_ANODE, "update-anode", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_DROP_ANODE, "drop-anode", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_MND_RETRIEVE_ANAL_ALGO, "retrieve-anal-algo", NULL, NULL)
TD_CLOSE_MSG_SEG(TDMT_DND_MSG)
TD_NEW_MSG_SEG(TDMT_MND_MSG) // 1<<8
@@ -324,6 +329,7 @@
TD_DEF_MSG_TYPE(TDMT_SCH_EXPLAIN, "explain", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SCH_LINK_BROKEN, "link-broken", NULL, NULL)
TD_DEF_MSG_TYPE(TDMT_SCH_TASK_NOTIFY, "task-notify", NULL, NULL)
+ TD_DEF_MSG_TYPE(TDMT_SCH_TASK_RELEASE, "task-release", NULL, NULL)
TD_CLOSE_MSG_SEG(TDMT_SCH_MSG)
diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h
index 005a5c49b1..b86830869c 100644
--- a/include/common/ttokendef.h
+++ b/include/common/ttokendef.h
@@ -69,335 +69,341 @@
#define TK_NK_DOT 51
#define TK_WITH 52
#define TK_ENCRYPT_KEY 53
-#define TK_DNODE 54
-#define TK_PORT 55
-#define TK_DNODES 56
-#define TK_RESTORE 57
-#define TK_NK_IPTOKEN 58
-#define TK_FORCE 59
-#define TK_UNSAFE 60
-#define TK_CLUSTER 61
-#define TK_LOCAL 62
-#define TK_QNODE 63
-#define TK_BNODE 64
-#define TK_SNODE 65
-#define TK_MNODE 66
-#define TK_VNODE 67
-#define TK_DATABASE 68
-#define TK_USE 69
-#define TK_FLUSH 70
-#define TK_TRIM 71
-#define TK_S3MIGRATE 72
-#define TK_COMPACT 73
-#define TK_IF 74
-#define TK_NOT 75
-#define TK_EXISTS 76
-#define TK_BUFFER 77
-#define TK_CACHEMODEL 78
-#define TK_CACHESIZE 79
-#define TK_COMP 80
-#define TK_DURATION 81
-#define TK_NK_VARIABLE 82
-#define TK_MAXROWS 83
-#define TK_MINROWS 84
-#define TK_KEEP 85
-#define TK_PAGES 86
-#define TK_PAGESIZE 87
-#define TK_TSDB_PAGESIZE 88
-#define TK_PRECISION 89
-#define TK_REPLICA 90
-#define TK_VGROUPS 91
-#define TK_SINGLE_STABLE 92
-#define TK_RETENTIONS 93
-#define TK_SCHEMALESS 94
-#define TK_WAL_LEVEL 95
-#define TK_WAL_FSYNC_PERIOD 96
-#define TK_WAL_RETENTION_PERIOD 97
-#define TK_WAL_RETENTION_SIZE 98
-#define TK_WAL_ROLL_PERIOD 99
-#define TK_WAL_SEGMENT_SIZE 100
-#define TK_STT_TRIGGER 101
-#define TK_TABLE_PREFIX 102
-#define TK_TABLE_SUFFIX 103
-#define TK_S3_CHUNKSIZE 104
-#define TK_S3_KEEPLOCAL 105
-#define TK_S3_COMPACT 106
-#define TK_KEEP_TIME_OFFSET 107
-#define TK_ENCRYPT_ALGORITHM 108
-#define TK_NK_COLON 109
-#define TK_BWLIMIT 110
-#define TK_START 111
-#define TK_TIMESTAMP 112
-#define TK_END 113
-#define TK_TABLE 114
-#define TK_NK_LP 115
-#define TK_NK_RP 116
-#define TK_USING 117
-#define TK_FILE 118
-#define TK_STABLE 119
-#define TK_COLUMN 120
-#define TK_MODIFY 121
-#define TK_RENAME 122
-#define TK_TAG 123
-#define TK_SET 124
-#define TK_NK_EQ 125
-#define TK_TAGS 126
-#define TK_BOOL 127
-#define TK_TINYINT 128
-#define TK_SMALLINT 129
-#define TK_INT 130
-#define TK_INTEGER 131
-#define TK_BIGINT 132
-#define TK_FLOAT 133
-#define TK_DOUBLE 134
-#define TK_BINARY 135
-#define TK_NCHAR 136
-#define TK_UNSIGNED 137
-#define TK_JSON 138
-#define TK_VARCHAR 139
-#define TK_MEDIUMBLOB 140
-#define TK_BLOB 141
-#define TK_VARBINARY 142
-#define TK_GEOMETRY 143
-#define TK_DECIMAL 144
-#define TK_COMMENT 145
-#define TK_MAX_DELAY 146
-#define TK_WATERMARK 147
-#define TK_ROLLUP 148
-#define TK_TTL 149
-#define TK_SMA 150
-#define TK_DELETE_MARK 151
-#define TK_FIRST 152
-#define TK_LAST 153
-#define TK_SHOW 154
-#define TK_FULL 155
-#define TK_PRIVILEGES 156
-#define TK_DATABASES 157
-#define TK_TABLES 158
-#define TK_STABLES 159
-#define TK_MNODES 160
-#define TK_QNODES 161
-#define TK_ARBGROUPS 162
-#define TK_FUNCTIONS 163
-#define TK_INDEXES 164
-#define TK_ACCOUNTS 165
-#define TK_APPS 166
-#define TK_CONNECTIONS 167
-#define TK_LICENCES 168
-#define TK_GRANTS 169
-#define TK_LOGS 170
-#define TK_MACHINES 171
-#define TK_ENCRYPTIONS 172
-#define TK_QUERIES 173
-#define TK_SCORES 174
-#define TK_TOPICS 175
-#define TK_VARIABLES 176
-#define TK_BNODES 177
-#define TK_SNODES 178
-#define TK_TRANSACTIONS 179
-#define TK_DISTRIBUTED 180
-#define TK_CONSUMERS 181
-#define TK_SUBSCRIPTIONS 182
-#define TK_VNODES 183
-#define TK_ALIVE 184
-#define TK_VIEWS 185
-#define TK_VIEW 186
-#define TK_COMPACTS 187
-#define TK_NORMAL 188
-#define TK_CHILD 189
-#define TK_LIKE 190
-#define TK_TBNAME 191
-#define TK_QTAGS 192
-#define TK_AS 193
-#define TK_SYSTEM 194
-#define TK_TSMA 195
-#define TK_INTERVAL 196
-#define TK_RECURSIVE 197
-#define TK_TSMAS 198
-#define TK_FUNCTION 199
-#define TK_INDEX 200
-#define TK_COUNT 201
-#define TK_LAST_ROW 202
-#define TK_META 203
-#define TK_ONLY 204
-#define TK_TOPIC 205
-#define TK_CONSUMER 206
-#define TK_GROUP 207
-#define TK_DESC 208
-#define TK_DESCRIBE 209
-#define TK_RESET 210
-#define TK_QUERY 211
-#define TK_CACHE 212
-#define TK_EXPLAIN 213
-#define TK_ANALYZE 214
-#define TK_VERBOSE 215
-#define TK_NK_BOOL 216
-#define TK_RATIO 217
-#define TK_NK_FLOAT 218
-#define TK_OUTPUTTYPE 219
-#define TK_AGGREGATE 220
-#define TK_BUFSIZE 221
-#define TK_LANGUAGE 222
-#define TK_REPLACE 223
-#define TK_STREAM 224
-#define TK_INTO 225
-#define TK_PAUSE 226
-#define TK_RESUME 227
-#define TK_PRIMARY 228
-#define TK_KEY 229
-#define TK_TRIGGER 230
-#define TK_AT_ONCE 231
-#define TK_WINDOW_CLOSE 232
-#define TK_IGNORE 233
-#define TK_EXPIRED 234
-#define TK_FILL_HISTORY 235
-#define TK_UPDATE 236
-#define TK_SUBTABLE 237
-#define TK_UNTREATED 238
-#define TK_KILL 239
-#define TK_CONNECTION 240
-#define TK_TRANSACTION 241
-#define TK_BALANCE 242
-#define TK_VGROUP 243
-#define TK_LEADER 244
-#define TK_MERGE 245
-#define TK_REDISTRIBUTE 246
-#define TK_SPLIT 247
-#define TK_DELETE 248
-#define TK_INSERT 249
-#define TK_NK_BIN 250
-#define TK_NK_HEX 251
-#define TK_NULL 252
-#define TK_NK_QUESTION 253
-#define TK_NK_ALIAS 254
-#define TK_NK_ARROW 255
-#define TK_ROWTS 256
-#define TK_QSTART 257
-#define TK_QEND 258
-#define TK_QDURATION 259
-#define TK_WSTART 260
-#define TK_WEND 261
-#define TK_WDURATION 262
-#define TK_IROWTS 263
-#define TK_ISFILLED 264
-#define TK_CAST 265
-#define TK_POSITION 266
-#define TK_IN 267
-#define TK_FOR 268
-#define TK_NOW 269
-#define TK_TODAY 270
-#define TK_RAND 271
-#define TK_SUBSTR 272
-#define TK_SUBSTRING 273
-#define TK_BOTH 274
-#define TK_TRAILING 275
-#define TK_LEADING 276
-#define TK_TIMEZONE 277
-#define TK_CLIENT_VERSION 278
-#define TK_SERVER_VERSION 279
-#define TK_SERVER_STATUS 280
-#define TK_CURRENT_USER 281
-#define TK_PI 282
-#define TK_CASE 283
-#define TK_WHEN 284
-#define TK_THEN 285
-#define TK_ELSE 286
-#define TK_BETWEEN 287
-#define TK_IS 288
-#define TK_NK_LT 289
-#define TK_NK_GT 290
-#define TK_NK_LE 291
-#define TK_NK_GE 292
-#define TK_NK_NE 293
-#define TK_MATCH 294
-#define TK_NMATCH 295
-#define TK_CONTAINS 296
-#define TK_JOIN 297
-#define TK_INNER 298
-#define TK_LEFT 299
-#define TK_RIGHT 300
-#define TK_OUTER 301
-#define TK_SEMI 302
-#define TK_ANTI 303
-#define TK_ASOF 304
-#define TK_WINDOW 305
-#define TK_WINDOW_OFFSET 306
-#define TK_JLIMIT 307
-#define TK_SELECT 308
-#define TK_NK_HINT 309
-#define TK_DISTINCT 310
-#define TK_WHERE 311
-#define TK_PARTITION 312
-#define TK_BY 313
-#define TK_SESSION 314
-#define TK_STATE_WINDOW 315
-#define TK_EVENT_WINDOW 316
-#define TK_COUNT_WINDOW 317
-#define TK_SLIDING 318
-#define TK_FILL 319
-#define TK_VALUE 320
-#define TK_VALUE_F 321
-#define TK_NONE 322
-#define TK_PREV 323
-#define TK_NULL_F 324
-#define TK_LINEAR 325
-#define TK_NEXT 326
-#define TK_HAVING 327
-#define TK_RANGE 328
-#define TK_EVERY 329
-#define TK_ORDER 330
-#define TK_SLIMIT 331
-#define TK_SOFFSET 332
-#define TK_LIMIT 333
-#define TK_OFFSET 334
-#define TK_ASC 335
-#define TK_NULLS 336
-#define TK_ABORT 337
-#define TK_AFTER 338
-#define TK_ATTACH 339
-#define TK_BEFORE 340
-#define TK_BEGIN 341
-#define TK_BITAND 342
-#define TK_BITNOT 343
-#define TK_BITOR 344
-#define TK_BLOCKS 345
-#define TK_CHANGE 346
-#define TK_COMMA 347
-#define TK_CONCAT 348
-#define TK_CONFLICT 349
-#define TK_COPY 350
-#define TK_DEFERRED 351
-#define TK_DELIMITERS 352
-#define TK_DETACH 353
-#define TK_DIVIDE 354
-#define TK_DOT 355
-#define TK_EACH 356
-#define TK_FAIL 357
-#define TK_GLOB 358
-#define TK_ID 359
-#define TK_IMMEDIATE 360
-#define TK_IMPORT 361
-#define TK_INITIALLY 362
-#define TK_INSTEAD 363
-#define TK_ISNULL 364
-#define TK_MODULES 365
-#define TK_NK_BITNOT 366
-#define TK_NK_SEMI 367
-#define TK_NOTNULL 368
-#define TK_OF 369
-#define TK_PLUS 370
-#define TK_PRIVILEGE 371
-#define TK_RAISE 372
-#define TK_RESTRICT 373
-#define TK_ROW 374
-#define TK_STAR 375
-#define TK_STATEMENT 376
-#define TK_STRICT 377
-#define TK_STRING 378
-#define TK_TIMES 379
-#define TK_VALUES 380
-#define TK_VARIABLE 381
-#define TK_WAL 382
+#define TK_ANODE 54
+#define TK_UPDATE 55
+#define TK_ANODES 56
+#define TK_DNODE 57
+#define TK_PORT 58
+#define TK_DNODES 59
+#define TK_RESTORE 60
+#define TK_NK_IPTOKEN 61
+#define TK_FORCE 62
+#define TK_UNSAFE 63
+#define TK_CLUSTER 64
+#define TK_LOCAL 65
+#define TK_QNODE 66
+#define TK_BNODE 67
+#define TK_SNODE 68
+#define TK_MNODE 69
+#define TK_VNODE 70
+#define TK_DATABASE 71
+#define TK_USE 72
+#define TK_FLUSH 73
+#define TK_TRIM 74
+#define TK_S3MIGRATE 75
+#define TK_COMPACT 76
+#define TK_IF 77
+#define TK_NOT 78
+#define TK_EXISTS 79
+#define TK_BUFFER 80
+#define TK_CACHEMODEL 81
+#define TK_CACHESIZE 82
+#define TK_COMP 83
+#define TK_DURATION 84
+#define TK_NK_VARIABLE 85
+#define TK_MAXROWS 86
+#define TK_MINROWS 87
+#define TK_KEEP 88
+#define TK_PAGES 89
+#define TK_PAGESIZE 90
+#define TK_TSDB_PAGESIZE 91
+#define TK_PRECISION 92
+#define TK_REPLICA 93
+#define TK_VGROUPS 94
+#define TK_SINGLE_STABLE 95
+#define TK_RETENTIONS 96
+#define TK_SCHEMALESS 97
+#define TK_WAL_LEVEL 98
+#define TK_WAL_FSYNC_PERIOD 99
+#define TK_WAL_RETENTION_PERIOD 100
+#define TK_WAL_RETENTION_SIZE 101
+#define TK_WAL_ROLL_PERIOD 102
+#define TK_WAL_SEGMENT_SIZE 103
+#define TK_STT_TRIGGER 104
+#define TK_TABLE_PREFIX 105
+#define TK_TABLE_SUFFIX 106
+#define TK_S3_CHUNKSIZE 107
+#define TK_S3_KEEPLOCAL 108
+#define TK_S3_COMPACT 109
+#define TK_KEEP_TIME_OFFSET 110
+#define TK_ENCRYPT_ALGORITHM 111
+#define TK_NK_COLON 112
+#define TK_BWLIMIT 113
+#define TK_START 114
+#define TK_TIMESTAMP 115
+#define TK_END 116
+#define TK_TABLE 117
+#define TK_NK_LP 118
+#define TK_NK_RP 119
+#define TK_USING 120
+#define TK_FILE 121
+#define TK_STABLE 122
+#define TK_COLUMN 123
+#define TK_MODIFY 124
+#define TK_RENAME 125
+#define TK_TAG 126
+#define TK_SET 127
+#define TK_NK_EQ 128
+#define TK_TAGS 129
+#define TK_BOOL 130
+#define TK_TINYINT 131
+#define TK_SMALLINT 132
+#define TK_INT 133
+#define TK_INTEGER 134
+#define TK_BIGINT 135
+#define TK_FLOAT 136
+#define TK_DOUBLE 137
+#define TK_BINARY 138
+#define TK_NCHAR 139
+#define TK_UNSIGNED 140
+#define TK_JSON 141
+#define TK_VARCHAR 142
+#define TK_MEDIUMBLOB 143
+#define TK_BLOB 144
+#define TK_VARBINARY 145
+#define TK_GEOMETRY 146
+#define TK_DECIMAL 147
+#define TK_COMMENT 148
+#define TK_MAX_DELAY 149
+#define TK_WATERMARK 150
+#define TK_ROLLUP 151
+#define TK_TTL 152
+#define TK_SMA 153
+#define TK_DELETE_MARK 154
+#define TK_FIRST 155
+#define TK_LAST 156
+#define TK_SHOW 157
+#define TK_FULL 158
+#define TK_PRIVILEGES 159
+#define TK_DATABASES 160
+#define TK_TABLES 161
+#define TK_STABLES 162
+#define TK_MNODES 163
+#define TK_QNODES 164
+#define TK_ARBGROUPS 165
+#define TK_FUNCTIONS 166
+#define TK_INDEXES 167
+#define TK_ACCOUNTS 168
+#define TK_APPS 169
+#define TK_CONNECTIONS 170
+#define TK_LICENCES 171
+#define TK_GRANTS 172
+#define TK_LOGS 173
+#define TK_MACHINES 174
+#define TK_ENCRYPTIONS 175
+#define TK_QUERIES 176
+#define TK_SCORES 177
+#define TK_TOPICS 178
+#define TK_VARIABLES 179
+#define TK_BNODES 180
+#define TK_SNODES 181
+#define TK_TRANSACTIONS 182
+#define TK_DISTRIBUTED 183
+#define TK_CONSUMERS 184
+#define TK_SUBSCRIPTIONS 185
+#define TK_VNODES 186
+#define TK_ALIVE 187
+#define TK_VIEWS 188
+#define TK_VIEW 189
+#define TK_COMPACTS 190
+#define TK_NORMAL 191
+#define TK_CHILD 192
+#define TK_LIKE 193
+#define TK_TBNAME 194
+#define TK_QTAGS 195
+#define TK_AS 196
+#define TK_SYSTEM 197
+#define TK_TSMA 198
+#define TK_INTERVAL 199
+#define TK_RECURSIVE 200
+#define TK_TSMAS 201
+#define TK_FUNCTION 202
+#define TK_INDEX 203
+#define TK_COUNT 204
+#define TK_LAST_ROW 205
+#define TK_META 206
+#define TK_ONLY 207
+#define TK_TOPIC 208
+#define TK_CONSUMER 209
+#define TK_GROUP 210
+#define TK_DESC 211
+#define TK_DESCRIBE 212
+#define TK_RESET 213
+#define TK_QUERY 214
+#define TK_CACHE 215
+#define TK_EXPLAIN 216
+#define TK_ANALYZE 217
+#define TK_VERBOSE 218
+#define TK_NK_BOOL 219
+#define TK_RATIO 220
+#define TK_NK_FLOAT 221
+#define TK_OUTPUTTYPE 222
+#define TK_AGGREGATE 223
+#define TK_BUFSIZE 224
+#define TK_LANGUAGE 225
+#define TK_REPLACE 226
+#define TK_STREAM 227
+#define TK_INTO 228
+#define TK_PAUSE 229
+#define TK_RESUME 230
+#define TK_PRIMARY 231
+#define TK_KEY 232
+#define TK_TRIGGER 233
+#define TK_AT_ONCE 234
+#define TK_WINDOW_CLOSE 235
+#define TK_IGNORE 236
+#define TK_EXPIRED 237
+#define TK_FILL_HISTORY 238
+#define TK_SUBTABLE 239
+#define TK_UNTREATED 240
+#define TK_KILL 241
+#define TK_CONNECTION 242
+#define TK_TRANSACTION 243
+#define TK_BALANCE 244
+#define TK_VGROUP 245
+#define TK_LEADER 246
+#define TK_MERGE 247
+#define TK_REDISTRIBUTE 248
+#define TK_SPLIT 249
+#define TK_DELETE 250
+#define TK_INSERT 251
+#define TK_NK_BIN 252
+#define TK_NK_HEX 253
+#define TK_NULL 254
+#define TK_NK_QUESTION 255
+#define TK_NK_ALIAS 256
+#define TK_NK_ARROW 257
+#define TK_ROWTS 258
+#define TK_QSTART 259
+#define TK_QEND 260
+#define TK_QDURATION 261
+#define TK_WSTART 262
+#define TK_WEND 263
+#define TK_WDURATION 264
+#define TK_IROWTS 265
+#define TK_ISFILLED 266
+#define TK_FLOW 267
+#define TK_FHIGH 268
+#define TK_FROWTS 269
+#define TK_CAST 270
+#define TK_POSITION 271
+#define TK_IN 272
+#define TK_FOR 273
+#define TK_NOW 274
+#define TK_TODAY 275
+#define TK_RAND 276
+#define TK_SUBSTR 277
+#define TK_SUBSTRING 278
+#define TK_BOTH 279
+#define TK_TRAILING 280
+#define TK_LEADING 281
+#define TK_TIMEZONE 282
+#define TK_CLIENT_VERSION 283
+#define TK_SERVER_VERSION 284
+#define TK_SERVER_STATUS 285
+#define TK_CURRENT_USER 286
+#define TK_PI 287
+#define TK_CASE 288
+#define TK_WHEN 289
+#define TK_THEN 290
+#define TK_ELSE 291
+#define TK_BETWEEN 292
+#define TK_IS 293
+#define TK_NK_LT 294
+#define TK_NK_GT 295
+#define TK_NK_LE 296
+#define TK_NK_GE 297
+#define TK_NK_NE 298
+#define TK_MATCH 299
+#define TK_NMATCH 300
+#define TK_CONTAINS 301
+#define TK_JOIN 302
+#define TK_INNER 303
+#define TK_LEFT 304
+#define TK_RIGHT 305
+#define TK_OUTER 306
+#define TK_SEMI 307
+#define TK_ANTI 308
+#define TK_ASOF 309
+#define TK_WINDOW 310
+#define TK_WINDOW_OFFSET 311
+#define TK_JLIMIT 312
+#define TK_SELECT 313
+#define TK_NK_HINT 314
+#define TK_DISTINCT 315
+#define TK_WHERE 316
+#define TK_PARTITION 317
+#define TK_BY 318
+#define TK_SESSION 319
+#define TK_STATE_WINDOW 320
+#define TK_EVENT_WINDOW 321
+#define TK_COUNT_WINDOW 322
+#define TK_ANOMALY_WINDOW 323
+#define TK_SLIDING 324
+#define TK_FILL 325
+#define TK_VALUE 326
+#define TK_VALUE_F 327
+#define TK_NONE 328
+#define TK_PREV 329
+#define TK_NULL_F 330
+#define TK_LINEAR 331
+#define TK_NEXT 332
+#define TK_HAVING 333
+#define TK_RANGE 334
+#define TK_EVERY 335
+#define TK_ORDER 336
+#define TK_SLIMIT 337
+#define TK_SOFFSET 338
+#define TK_LIMIT 339
+#define TK_OFFSET 340
+#define TK_ASC 341
+#define TK_NULLS 342
+#define TK_ABORT 343
+#define TK_AFTER 344
+#define TK_ATTACH 345
+#define TK_BEFORE 346
+#define TK_BEGIN 347
+#define TK_BITAND 348
+#define TK_BITNOT 349
+#define TK_BITOR 350
+#define TK_BLOCKS 351
+#define TK_CHANGE 352
+#define TK_COMMA 353
+#define TK_CONCAT 354
+#define TK_CONFLICT 355
+#define TK_COPY 356
+#define TK_DEFERRED 357
+#define TK_DELIMITERS 358
+#define TK_DETACH 359
+#define TK_DIVIDE 360
+#define TK_DOT 361
+#define TK_EACH 362
+#define TK_FAIL 363
+#define TK_GLOB 364
+#define TK_ID 365
+#define TK_IMMEDIATE 366
+#define TK_IMPORT 367
+#define TK_INITIALLY 368
+#define TK_INSTEAD 369
+#define TK_ISNULL 370
+#define TK_MODULES 371
+#define TK_NK_BITNOT 372
+#define TK_NK_SEMI 373
+#define TK_NOTNULL 374
+#define TK_OF 375
+#define TK_PLUS 376
+#define TK_PRIVILEGE 377
+#define TK_RAISE 378
+#define TK_RESTRICT 379
+#define TK_ROW 380
+#define TK_STAR 381
+#define TK_STATEMENT 382
+#define TK_STRICT 383
+#define TK_STRING 384
+#define TK_TIMES 385
+#define TK_VALUES 386
+#define TK_VARIABLE 387
+#define TK_WAL 388
#define TK_NK_SPACE 600
#define TK_NK_COMMENT 601
diff --git a/include/libs/function/function.h b/include/libs/function/function.h
index 7ca046762a..51d9e752a4 100644
--- a/include/libs/function/function.h
+++ b/include/libs/function/function.h
@@ -29,6 +29,7 @@ struct SqlFunctionCtx;
struct SResultRowEntryInfo;
struct SFunctionNode;
+struct SExprSupp;
typedef struct SScalarParam SScalarParam;
typedef struct SStreamState SStreamState;
@@ -43,6 +44,7 @@ typedef int32_t (*FExecProcess)(struct SqlFunctionCtx *pCtx);
typedef int32_t (*FExecFinalize)(struct SqlFunctionCtx *pCtx, SSDataBlock *pBlock);
typedef int32_t (*FScalarExecProcess)(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
typedef int32_t (*FExecCombine)(struct SqlFunctionCtx *pDestCtx, struct SqlFunctionCtx *pSourceCtx);
+typedef int32_t (*FExecDecode)(struct SqlFunctionCtx *pCtx, const char *buf, struct SResultRowEntryInfo *pResultCellInfo, int32_t version);
typedef int32_t (*processFuncByRow)(SArray* pCtx); // array of SqlFunctionCtx
typedef struct SScalarFuncExecFuncs {
@@ -57,6 +59,7 @@ typedef struct SFuncExecFuncs {
FExecFinalize finalize;
FExecCombine combine;
FExecCleanUp cleanup;
+ FExecDecode decode;
processFuncByRow processFuncByRow;
} SFuncExecFuncs;
@@ -65,6 +68,8 @@ typedef struct SFuncExecFuncs {
#define TOP_BOTTOM_QUERY_LIMIT 100
#define FUNCTIONS_NAME_MAX_LENGTH 32
+#define FUNCTION_RESULT_INFO_VERSION 1
+
typedef struct SResultRowEntryInfo {
bool initialized : 1; // output buffer has been initialized
bool complete : 1; // query has completed
@@ -165,6 +170,11 @@ typedef struct STdbState {
void *txn;
} STdbState;
+typedef struct SResultRowStore {
+ int32_t (*resultRowPut)(struct SExprSupp *pSup, const char* inBuf, size_t inBufSize, char **outBuf, size_t *outBufSize);
+ int32_t (*resultRowGet)(struct SExprSupp *pSup, const char* inBuf, size_t inBufSize, char **outBuf, size_t *outBufSize);
+} SResultRowStore;
+
struct SStreamState {
STdbState *pTdbState;
struct SStreamFileState *pFileState;
@@ -175,6 +185,8 @@ struct SStreamState {
int64_t streamBackendRid;
int8_t dump;
int32_t tsIndex;
+ SResultRowStore pResultRowStore;
+ struct SExprSupp *pExprSupp;
};
typedef struct SFunctionStateStore {
diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h
index 519207377b..e5bacf85b2 100644
--- a/include/libs/function/functionMgt.h
+++ b/include/libs/function/functionMgt.h
@@ -62,6 +62,7 @@ typedef enum EFunctionType {
FUNCTION_TYPE_UNIQUE,
FUNCTION_TYPE_STATE_COUNT,
FUNCTION_TYPE_STATE_DURATION,
+ FUNCTION_TYPE_FORECAST,
// math function
FUNCTION_TYPE_ABS = 1000,
@@ -149,6 +150,9 @@ typedef enum EFunctionType {
FUNCTION_TYPE_TBUID,
FUNCTION_TYPE_VGID,
FUNCTION_TYPE_VGVER,
+ FUNCTION_TYPE_FORECAST_LOW,
+ FUNCTION_TYPE_FORECAST_HIGH,
+ FUNCTION_TYPE_FORECAST_ROWTS,
// internal function
FUNCTION_TYPE_SELECT_VALUE = 3750,
@@ -263,6 +267,7 @@ bool fmIsForbidSysTableFunc(int32_t funcId);
bool fmIsIntervalInterpoFunc(int32_t funcId);
bool fmIsInterpFunc(int32_t funcId);
bool fmIsLastRowFunc(int32_t funcId);
+bool fmIsForecastFunc(int32_t funcId);
bool fmIsNotNullOutputFunc(int32_t funcId);
bool fmIsSelectValueFunc(int32_t funcId);
bool fmIsSystemInfoFunc(int32_t funcId);
@@ -272,6 +277,7 @@ bool fmIsMultiRowsFunc(int32_t funcId);
bool fmIsKeepOrderFunc(int32_t funcId);
bool fmIsCumulativeFunc(int32_t funcId);
bool fmIsInterpPseudoColumnFunc(int32_t funcId);
+bool fmIsForecastPseudoColumnFunc(int32_t funcId);
bool fmIsGroupKeyFunc(int32_t funcId);
bool fmIsBlockDistFunc(int32_t funcId);
bool fmIsIgnoreNullFunc(int32_t funcId);
diff --git a/include/libs/nodes/cmdnodes.h b/include/libs/nodes/cmdnodes.h
index 2a18e800b8..bbf2889289 100644
--- a/include/libs/nodes/cmdnodes.h
+++ b/include/libs/nodes/cmdnodes.h
@@ -318,6 +318,21 @@ typedef struct SAlterDnodeStmt {
char value[TSDB_DNODE_VALUE_LEN];
} SAlterDnodeStmt;
+typedef struct {
+ ENodeType type;
+ char url[TSDB_ANAL_ANODE_URL_LEN + 3];
+} SCreateAnodeStmt;
+
+typedef struct {
+ ENodeType type;
+ int32_t anodeId;
+} SDropAnodeStmt;
+
+typedef struct {
+ ENodeType type;
+ int32_t anodeId;
+} SUpdateAnodeStmt;
+
typedef struct SShowStmt {
ENodeType type;
SNode* pDbName; // SValueNode
diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h
index bfe9e9555b..8e4a3ea32b 100644
--- a/include/libs/nodes/plannodes.h
+++ b/include/libs/nodes/plannodes.h
@@ -204,6 +204,11 @@ typedef struct SInterpFuncLogicNode {
SNode* pTimeSeries; // SColumnNode
} SInterpFuncLogicNode;
+typedef struct SForecastFuncLogicNode {
+ SLogicNode node;
+ SNodeList* pFuncs;
+} SForecastFuncLogicNode;
+
typedef struct SGroupCacheLogicNode {
SLogicNode node;
bool grpColsMayBeNull;
@@ -275,6 +280,7 @@ typedef enum EWindowType {
WINDOW_TYPE_STATE,
WINDOW_TYPE_EVENT,
WINDOW_TYPE_COUNT,
+ WINDOW_TYPE_ANOMALY
} EWindowType;
typedef enum EWindowAlgorithm {
@@ -315,6 +321,8 @@ typedef struct SWindowLogicNode {
int64_t windowCount;
int64_t windowSliding;
SNodeList* pTsmaSubplans;
+ SNode* pAnomalyExpr;
+ char anomalyOpt[TSDB_ANAL_ALGO_OPTION_LEN];
} SWindowLogicNode;
typedef struct SFillLogicNode {
@@ -507,6 +515,12 @@ typedef struct SInterpFuncPhysiNode {
SNode* pTimeSeries; // SColumnNode
} SInterpFuncPhysiNode;
+typedef struct SForecastFuncPhysiNode {
+ SPhysiNode node;
+ SNodeList* pExprs;
+ SNodeList* pFuncs;
+} SForecastFuncPhysiNode;
+
typedef struct SSortMergeJoinPhysiNode {
SPhysiNode node;
EJoinType joinType;
@@ -704,6 +718,12 @@ typedef struct SCountWinodwPhysiNode {
typedef SCountWinodwPhysiNode SStreamCountWinodwPhysiNode;
+typedef struct SAnomalyWindowPhysiNode {
+ SWindowPhysiNode window;
+ SNode* pAnomalyKey;
+ char anomalyOpt[TSDB_ANAL_ALGO_OPTION_LEN];
+} SAnomalyWindowPhysiNode;
+
typedef struct SSortPhysiNode {
SPhysiNode node;
SNodeList* pExprs; // these are expression list of order_by_clause and parameter expression of aggregate function
diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h
index f5567c735e..4763077ed9 100644
--- a/include/libs/nodes/querynodes.h
+++ b/include/libs/nodes/querynodes.h
@@ -347,6 +347,13 @@ typedef struct SCountWindowNode {
int64_t windowSliding;
} SCountWindowNode;
+typedef struct SAnomalyWindowNode {
+ ENodeType type; // QUERY_NODE_ANOMALY_WINDOW
+ SNode* pCol; // timestamp primary key
+ SNode* pExpr;
+ char anomalyOpt[TSDB_ANAL_ALGO_OPTION_LEN];
+} SAnomalyWindowNode;
+
typedef enum EFillMode {
FILL_MODE_NONE = 1,
FILL_MODE_VALUE,
@@ -442,6 +449,8 @@ typedef struct SSelectStmt {
bool hasTailFunc;
bool hasInterpFunc;
bool hasInterpPseudoColFunc;
+ bool hasForecastFunc;
+ bool hasForecastPseudoColFunc;
bool hasLastRowFunc;
bool hasLastFunc;
bool hasTimeLineFunc;
diff --git a/include/libs/scalar/scalar.h b/include/libs/scalar/scalar.h
index b06b7c74c7..fd936dd087 100644
--- a/include/libs/scalar/scalar.h
+++ b/include/libs/scalar/scalar.h
@@ -139,6 +139,7 @@ int32_t mavgScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam
int32_t hllScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t csumScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t diffScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
+int32_t forecastScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t stateCountScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t stateDurationScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
int32_t histogramScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput);
diff --git a/include/libs/transport/trpc.h b/include/libs/transport/trpc.h
index 5b860cc23a..cfa3f44f7f 100644
--- a/include/libs/transport/trpc.h
+++ b/include/libs/transport/trpc.h
@@ -63,6 +63,10 @@ typedef struct SRpcHandleInfo {
int8_t forbiddenIp;
int8_t notFreeAhandle;
int8_t compressed;
+ int64_t seqNum; // msg seq
+ int64_t qId; // queryId Get from client, other req's qId = -1;
+ int32_t refIdMgt;
+ int32_t msgType;
} SRpcHandleInfo;
typedef struct SRpcMsg {
@@ -124,9 +128,13 @@ typedef struct SRpcInit {
int32_t connLimitLock;
int32_t timeToGetConn;
int8_t supportBatch; // 0: no batch, 1. batch
- int32_t batchSize;
- int8_t notWaitAvaliableConn; // 1: wait to get, 0: no wait
- void *parent;
+ int32_t shareConnLimit;
+ int8_t shareConn; // 0: no share, 1. share
+ int8_t notWaitAvaliableConn; // 1: wait to get, 0: no wait
+ int8_t startReadTimer;
+ int64_t readTimeout; // s
+
+ void *parent;
} SRpcInit;
typedef struct {
@@ -144,6 +152,7 @@ typedef struct {
SHashObj *args;
SRpcBrokenlinkVal brokenVal;
void (*freeFunc)(const void *arg);
+ int64_t st;
} SRpcCtx;
int32_t rpcInit();
diff --git a/include/os/osFile.h b/include/os/osFile.h
index a56c54b086..536dee268a 100644
--- a/include/os/osFile.h
+++ b/include/os/osFile.h
@@ -130,14 +130,15 @@ int taosSetAutoDelFile(char *path);
bool lastErrorIsFileNotExist();
#ifdef BUILD_WITH_RAND_ERR
-#define STUB_RAND_NETWORK_ERR(status) \
- do { \
- if (tsEnableRandErr && (tsRandErrScope & RAND_ERR_NETWORK)) { \
- uint32_t r = taosRand() % tsRandErrDivisor; \
- if ((r + 1) <= tsRandErrChance) { \
- status = TSDB_CODE_RPC_NETWORK_UNAVAIL; \
- } \
- } \
+#define STUB_RAND_NETWORK_ERR(ret) \
+ do { \
+ if (tsEnableRandErr && (tsRandErrScope & RAND_ERR_NETWORK)) { \
+ uint32_t r = taosRand() % tsRandErrDivisor; \
+ if ((r + 1) <= tsRandErrChance) { \
+ ret = TSDB_CODE_RPC_NETWORK_UNAVAIL; \
+ uError("random network error: %s, %s", tstrerror(ret), __func__); \
+ } \
+ } \
while (0)
#else
#define STUB_RAND_NETWORK_ERR(status)
diff --git a/include/os/osSocket.h b/include/os/osSocket.h
index 1cedfc4dcd..49acf285ee 100644
--- a/include/os/osSocket.h
+++ b/include/os/osSocket.h
@@ -137,6 +137,7 @@ int32_t taosShutDownSocketRDWR(TdSocketPtr pSocket);
int32_t taosShutDownSocketServerRDWR(TdSocketServerPtr pSocketServer);
int32_t taosSetNonblocking(TdSocketPtr pSocket, int32_t on);
int32_t taosSetSockOpt(TdSocketPtr pSocket, int32_t level, int32_t optname, void *optval, int32_t optlen);
+int32_t taosSetSockOpt2(int32_t fd);
int32_t taosGetSockOpt(TdSocketPtr pSocket, int32_t level, int32_t optname, void *optval, int32_t *optlen);
int32_t taosWriteMsg(TdSocketPtr pSocket, void *ptr, int32_t nbytes);
int32_t taosReadMsg(TdSocketPtr pSocket, void *ptr, int32_t nbytes);
@@ -159,7 +160,7 @@ TdSocketPtr taosAcceptTcpConnectSocket(TdSocketServerPtr pServerSocket, st
int32_t taosGetSocketName(TdSocketPtr pSocket, struct sockaddr *destAddr, int *addrLen);
int32_t taosBlockSIGPIPE();
-int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t* ip);
+int32_t taosGetIpv4FromFqdn(const char *fqdn, uint32_t *ip);
int32_t taosGetFqdn(char *);
void tinet_ntoa(char *ipstr, uint32_t ip);
uint32_t ip2uint(const char *const ip_addr);
diff --git a/include/os/osSystem.h b/include/os/osSystem.h
index 44910ba94d..fe181d291a 100644
--- a/include/os/osSystem.h
+++ b/include/os/osSystem.h
@@ -89,9 +89,9 @@ int32_t taosResetTerminalMode();
snprintf(array[size], STACKSIZE, "0x%lx : (%s+0x%lx) [0x%lx]\n", (long)pc, fname, (long)offset, (long)pc); \
} \
if (ignoreNum < size && size > 0) { \
- offset = snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? size - ignoreNum : size); \
+ offset = tsnprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? size - ignoreNum : size); \
for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \
- offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%d, %s\n", (ignoreNum > 0) ? i - ignoreNum : i, \
+ offset += tsnprintf(buf + offset, bufSize - 1 - offset, "frame:%d, %s\n", (ignoreNum > 0) ? i - ignoreNum : i, \
array[i]); \
} \
} \
@@ -140,9 +140,9 @@ int32_t taosResetTerminalMode();
char **strings = backtrace_symbols(array, size); \
int32_t offset = 0; \
if (strings != NULL) { \
- offset = snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? size - ignoreNum : size); \
+ offset = tsnprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? size - ignoreNum : size); \
for (int32_t i = (ignoreNum > 0) ? ignoreNum : 0; i < size; i++) { \
- offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%d, %s\n", (ignoreNum > 0) ? i - ignoreNum : i, \
+ offset += tsnprintf(buf + offset, bufSize - 1 - offset, "frame:%d, %s\n", (ignoreNum > 0) ? i - ignoreNum : i, \
strings[i]); \
} \
} \
@@ -193,7 +193,7 @@ int32_t taosResetTerminalMode();
snprintf(buf, bufSize - 1, "obtained %d stack frames\n", (ignoreNum > 0) ? frames - ignoreNum : frames); \
for (i = (ignoreNum > 0) ? ignoreNum : 0; i < frames; i++) { \
SymFromAddr(process, (DWORD64)(stack[i]), 0, symbol); \
- offset += snprintf(buf + offset, bufSize - 1 - offset, "frame:%i, %s - 0x%0X\n", \
+ offset += tsnprintf(buf + offset, bufSize - 1 - offset, "frame:%i, %s - 0x%0X\n", \
(ignoreNum > 0) ? i - ignoreNum : i, symbol->Name, symbol->Address); \
} \
} \
diff --git a/include/util/taoserror.h b/include/util/taoserror.h
index 2b116514e6..fd8970a50f 100644
--- a/include/util/taoserror.h
+++ b/include/util/taoserror.h
@@ -94,9 +94,9 @@ int32_t taosGetErrSize();
#define TSDB_CODE_HTTP_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0025)
#define TSDB_CODE_RPC_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0026)
#define TSDB_CODE_RPC_ASYNC_MODULE_QUIT TAOS_DEF_ERROR_CODE(0, 0x0027)
-
-
-
+#define TSDB_CODE_RPC_ASYNC_IN_PROCESS TAOS_DEF_ERROR_CODE(0, 0x0028)
+#define TSDB_CODE_RPC_NO_STATE TAOS_DEF_ERROR_CODE(0, 0x0029)
+#define TSDB_CODE_RPC_STATE_DROPED TAOS_DEF_ERROR_CODE(0, 0x002A)
//common & util
#define TSDB_CODE_OPS_NOT_SUPPORT TAOS_DEF_ERROR_CODE(0, 0x0100) //
@@ -476,6 +476,26 @@ int32_t taosGetErrSize();
#define TSDB_CODE_DNODE_INVALID_MONITOR_PARAS TAOS_DEF_ERROR_CODE(0, 0x0429)
#define TSDB_CODE_MNODE_STOPPED TAOS_DEF_ERROR_CODE(0, 0x042A)
+// anode
+#define TSDB_CODE_MND_ANODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0430)
+#define TSDB_CODE_MND_ANODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0431)
+#define TSDB_CODE_MND_ANODE_TOO_LONG_URL TAOS_DEF_ERROR_CODE(0, 0x0432)
+#define TSDB_CODE_MND_ANODE_INVALID_PROTOCOL TAOS_DEF_ERROR_CODE(0, 0x0433)
+#define TSDB_CODE_MND_ANODE_INVALID_VERSION TAOS_DEF_ERROR_CODE(0, 0x0434)
+#define TSDB_CODE_MND_ANODE_INVALID_ALGO_TYPE TAOS_DEF_ERROR_CODE(0, 0x0435)
+#define TSDB_CODE_MND_ANODE_TOO_MANY_ALGO TAOS_DEF_ERROR_CODE(0, 0x0436)
+#define TSDB_CODE_MND_ANODE_TOO_LONG_ALGO_NAME TAOS_DEF_ERROR_CODE(0, 0x0437)
+#define TSDB_CODE_MND_ANODE_TOO_MANY_ALGO_TYPE TAOS_DEF_ERROR_CODE(0, 0x0438)
+
+// analysis
+#define TSDB_CODE_ANAL_URL_RSP_IS_NULL TAOS_DEF_ERROR_CODE(0, 0x0440)
+#define TSDB_CODE_ANAL_URL_CANT_ACCESS TAOS_DEF_ERROR_CODE(0, 0x0441)
+#define TSDB_CODE_ANAL_ALGO_NOT_FOUND TAOS_DEF_ERROR_CODE(0, 0x0442)
+#define TSDB_CODE_ANAL_ALGO_NOT_LOAD TAOS_DEF_ERROR_CODE(0, 0x0443)
+#define TSDB_CODE_ANAL_BUF_INVALID_TYPE TAOS_DEF_ERROR_CODE(0, 0x0444)
+#define TSDB_CODE_ANAL_ANODE_RETURN_ERROR TAOS_DEF_ERROR_CODE(0, 0x0445)
+#define TSDB_CODE_ANAL_ANODE_TOO_MANY_ROWS TAOS_DEF_ERROR_CODE(0, 0x0446)
+
// mnode-sma
#define TSDB_CODE_MND_SMA_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0480)
#define TSDB_CODE_MND_SMA_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0481)
@@ -867,6 +887,10 @@ int32_t taosGetErrSize();
#define TSDB_CODE_PAR_TAG_NAME_DUPLICATED TAOS_DEF_ERROR_CODE(0, 0x267F)
#define TSDB_CODE_PAR_NOT_ALLOWED_DIFFERENT_BY_ROW_FUNC TAOS_DEF_ERROR_CODE(0, 0x2680)
#define TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR TAOS_DEF_ERROR_CODE(0, 0x2681)
+#define TSDB_CODE_PAR_INVALID_ANOMALY_WIN_TYPE TAOS_DEF_ERROR_CODE(0, 0x2682)
+#define TSDB_CODE_PAR_INVALID_ANOMALY_WIN_COL TAOS_DEF_ERROR_CODE(0, 0x2683)
+#define TSDB_CODE_PAR_INVALID_ANOMALY_WIN_OPT TAOS_DEF_ERROR_CODE(0, 0x2684)
+#define TSDB_CODE_PAR_INVALID_FORECAST_CLAUSE TAOS_DEF_ERROR_CODE(0, 0x2685)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
//planner
diff --git a/include/util/tdef.h b/include/util/tdef.h
index a2bc77d819..a0bfdc83f5 100644
--- a/include/util/tdef.h
+++ b/include/util/tdef.h
@@ -293,6 +293,12 @@ typedef enum ELogicConditionType {
#define TSDB_SLOW_QUERY_SQL_LEN 512
#define TSDB_SHOW_SUBQUERY_LEN 1000
#define TSDB_LOG_VAR_LEN 32
+#define TSDB_ANAL_ANODE_URL_LEN 128
+#define TSDB_ANAL_ALGO_NAME_LEN 64
+#define TSDB_ANAL_ALGO_TYPE_LEN 24
+#define TSDB_ANAL_ALGO_KEY_LEN (TSDB_ANAL_ALGO_NAME_LEN + 9)
+#define TSDB_ANAL_ALGO_URL_LEN (TSDB_ANAL_ANODE_URL_LEN + TSDB_ANAL_ALGO_TYPE_LEN + 1)
+#define TSDB_ANAL_ALGO_OPTION_LEN 256
#define TSDB_MAX_EP_NUM 10
@@ -500,7 +506,7 @@ typedef enum ELogicConditionType {
#ifdef WINDOWS
#define TSDB_MAX_RPC_THREADS 4 // windows pipe only support 4 connections.
#else
-#define TSDB_MAX_RPC_THREADS 50
+#define TSDB_MAX_RPC_THREADS 20
#endif
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
@@ -604,6 +610,12 @@ enum { RAND_ERR_MEMORY = 1, RAND_ERR_FILE = 2, RAND_ERR_NETWORK = 4 };
#define MONITOR_TAG_VALUE_LEN 300
#define MONITOR_METRIC_NAME_LEN 100
+typedef enum {
+ ANAL_ALGO_TYPE_ANOMALY_DETECT = 0,
+ ANAL_ALGO_TYPE_FORECAST = 1,
+ ANAL_ALGO_TYPE_END,
+} EAnalAlgoType;
+
#ifdef __cplusplus
}
#endif
diff --git a/include/util/tjson.h b/include/util/tjson.h
index b9ea72b4bb..88c2a1efb7 100644
--- a/include/util/tjson.h
+++ b/include/util/tjson.h
@@ -68,7 +68,10 @@ int32_t tjsonAddItemToArray(SJson* pJson, SJson* pItem);
SJson* tjsonGetObjectItem(const SJson* pJson, const char* pName);
int32_t tjsonGetObjectName(const SJson* pJson, char** pName);
int32_t tjsonGetObjectValueString(const SJson* pJson, char** pStringValue);
+void tjsonGetObjectValueBigInt(const SJson* pJson, int64_t* pVal);
+void tjsonGetObjectValueDouble(const SJson* pJson, double* pVal);
int32_t tjsonGetStringValue(const SJson* pJson, const char* pName, char* pVal);
+int32_t tjsonGetStringValue2(const SJson* pJson, const char* pName, char* pVal, int32_t maxLen);
int32_t tjsonDupStringValue(const SJson* pJson, const char* pName, char** pVal);
int32_t tjsonGetBigIntValue(const SJson* pJson, const char* pName, int64_t* pVal);
int32_t tjsonGetIntValue(const SJson* pJson, const char* pName, int32_t* pVal);
diff --git a/include/util/tlog.h b/include/util/tlog.h
index e80e94de32..6b0270523e 100644
--- a/include/util/tlog.h
+++ b/include/util/tlog.h
@@ -123,8 +123,8 @@ void taosReleaseCrashLogFile(TdFilePtr pFile, bool truncateFile);
#define uInfo(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLog("UTL ", DEBUG_INFO, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define uDebug(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLog("UTL ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }}
#define uTrace(...) { if (uDebugFlag & DEBUG_TRACE) { taosPrintLog("UTL ", DEBUG_TRACE, uDebugFlag, __VA_ARGS__); }}
-#define uDebugL(...) { if (uDebugFlag & DEBUG_DEBUG) { taosPrintLongString("UTL ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }}
-#define uInfoL(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLongString("UTL ", DEBUG_INFO, uDebugFlag, __VA_ARGS__); }}
+#define uDebugL(...){ if (uDebugFlag & DEBUG_DEBUG) { taosPrintLongString("UTL ", DEBUG_DEBUG, uDebugFlag, __VA_ARGS__); }}
+#define uInfoL(...) { if (uDebugFlag & DEBUG_INFO) { taosPrintLongString("UTL ", DEBUG_INFO, tsLogEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }}
#define pError(...) { taosPrintLog("APP ERROR ", DEBUG_ERROR, 255, __VA_ARGS__); }
#define pPrint(...) { taosPrintLog("APP ", DEBUG_INFO, 255, __VA_ARGS__); }
diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c
index 21f7c93036..f892575f0a 100644
--- a/source/client/src/clientEnv.c
+++ b/source/client/src/clientEnv.c
@@ -370,7 +370,10 @@ int32_t openTransporter(const char *user, const char *auth, int32_t numOfThread,
connLimitNum = TMAX(connLimitNum, 10);
connLimitNum = TMIN(connLimitNum, 1000);
rpcInit.connLimitNum = connLimitNum;
+ rpcInit.shareConnLimit = tsShareConnLimit;
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
+ rpcInit.startReadTimer = 1;
+ rpcInit.readTimeout = tsReadTimeout;
int32_t code = taosVersionStrToInt(version, &(rpcInit.compatibilityVer));
if (TSDB_CODE_SUCCESS != code) {
diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c
index 2c67cafdf5..9131d29f30 100644
--- a/source/client/src/clientImpl.c
+++ b/source/client/src/clientImpl.c
@@ -410,7 +410,6 @@ int32_t asyncExecDdlQuery(SRequestObj* pRequest, SQuery* pQuery) {
SAppInstInfo* pAppInfo = getAppInfo(pRequest);
SMsgSendInfo* pSendMsg = buildMsgInfoImpl(pRequest);
- // int64_t transporterId = 0;
int32_t code = asyncSendMsgToServer(pAppInfo->pTransporter, &pMsgInfo->epSet, NULL, pSendMsg);
if (code) {
doRequestCallback(pRequest, code);
@@ -1921,19 +1920,19 @@ TAOS* taos_connect_auth(const char* ip, const char* user, const char* auth, cons
return NULL;
}
-//TAOS* taos_connect_l(const char* ip, int ipLen, const char* user, int userLen, const char* pass, int passLen,
-// const char* db, int dbLen, uint16_t port) {
-// char ipStr[TSDB_EP_LEN] = {0};
-// char dbStr[TSDB_DB_NAME_LEN] = {0};
-// char userStr[TSDB_USER_LEN] = {0};
-// char passStr[TSDB_PASSWORD_LEN] = {0};
+// TAOS* taos_connect_l(const char* ip, int ipLen, const char* user, int userLen, const char* pass, int passLen,
+// const char* db, int dbLen, uint16_t port) {
+// char ipStr[TSDB_EP_LEN] = {0};
+// char dbStr[TSDB_DB_NAME_LEN] = {0};
+// char userStr[TSDB_USER_LEN] = {0};
+// char passStr[TSDB_PASSWORD_LEN] = {0};
//
-// tstrncpy(ipStr, ip, TMIN(TSDB_EP_LEN - 1, ipLen));
-// tstrncpy(userStr, user, TMIN(TSDB_USER_LEN - 1, userLen));
-// tstrncpy(passStr, pass, TMIN(TSDB_PASSWORD_LEN - 1, passLen));
-// tstrncpy(dbStr, db, TMIN(TSDB_DB_NAME_LEN - 1, dbLen));
-// return taos_connect(ipStr, userStr, passStr, dbStr, port);
-//}
+// tstrncpy(ipStr, ip, TMIN(TSDB_EP_LEN - 1, ipLen));
+// tstrncpy(userStr, user, TMIN(TSDB_USER_LEN - 1, userLen));
+// tstrncpy(passStr, pass, TMIN(TSDB_PASSWORD_LEN - 1, passLen));
+// tstrncpy(dbStr, db, TMIN(TSDB_DB_NAME_LEN - 1, dbLen));
+// return taos_connect(ipStr, userStr, passStr, dbStr, port);
+// }
void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
for (int32_t i = 0; i < pResultInfo->numOfCols; ++i) {
@@ -2301,7 +2300,8 @@ static int32_t doConvertJson(SReqResultInfo* pResultInfo, int32_t numOfCols, int
(void)snprintf(varDataVal(dst), TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE, "%.9lf", jsonVd);
varDataSetLen(dst, strlen(varDataVal(dst)));
} else if (jsonInnerType == TSDB_DATA_TYPE_BOOL) {
- (void)snprintf(varDataVal(dst), TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE, "%s", (*((char*)jsonInnerData) == 1) ? "true" : "false");
+ (void)snprintf(varDataVal(dst), TSDB_MAX_JSON_TAG_LEN - VARSTR_HEADER_SIZE, "%s",
+ (*((char*)jsonInnerData) == 1) ? "true" : "false");
varDataSetLen(dst, strlen(varDataVal(dst)));
} else {
tscError("doConvertJson error: invalid type:%d", jsonInnerType);
@@ -2570,6 +2570,7 @@ TSDB_SERVER_STATUS taos_check_server_status(const char* fqdn, int port, char* de
connLimitNum = TMIN(connLimitNum, 500);
rpcInit.connLimitNum = connLimitNum;
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
+ rpcInit.readTimeout = tsReadTimeout;
if (TSDB_CODE_SUCCESS != taosVersionStrToInt(version, &(rpcInit.compatibilityVer))) {
tscError("faild to convert taos version from str to int, errcode:%s", terrstr());
goto _OVER;
diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c
index 1a66266000..64631fd754 100644
--- a/source/client/src/clientMain.c
+++ b/source/client/src/clientMain.c
@@ -492,53 +492,53 @@ int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD
}
if (row[i] == NULL) {
- len += snprintf(str + len, size - len, "%s", TSDB_DATA_NULL_STR);
+ len += tsnprintf(str + len, size - len, "%s", TSDB_DATA_NULL_STR);
continue;
}
switch (fields[i].type) {
case TSDB_DATA_TYPE_TINYINT:
- len += snprintf(str + len, size - len, "%d", *((int8_t *)row[i]));
+ len += tsnprintf(str + len, size - len, "%d", *((int8_t *)row[i]));
break;
case TSDB_DATA_TYPE_UTINYINT:
- len += snprintf(str + len, size - len, "%u", *((uint8_t *)row[i]));
+ len += tsnprintf(str + len, size - len, "%u", *((uint8_t *)row[i]));
break;
case TSDB_DATA_TYPE_SMALLINT:
- len += snprintf(str + len, size - len, "%d", *((int16_t *)row[i]));
+ len += tsnprintf(str + len, size - len, "%d", *((int16_t *)row[i]));
break;
case TSDB_DATA_TYPE_USMALLINT:
- len += snprintf(str + len, size - len, "%u", *((uint16_t *)row[i]));
+ len += tsnprintf(str + len, size - len, "%u", *((uint16_t *)row[i]));
break;
case TSDB_DATA_TYPE_INT:
- len += snprintf(str + len, size - len, "%d", *((int32_t *)row[i]));
+ len += tsnprintf(str + len, size - len, "%d", *((int32_t *)row[i]));
break;
case TSDB_DATA_TYPE_UINT:
- len += snprintf(str + len, size - len, "%u", *((uint32_t *)row[i]));
+ len += tsnprintf(str + len, size - len, "%u", *((uint32_t *)row[i]));
break;
case TSDB_DATA_TYPE_BIGINT:
- len += snprintf(str + len, size - len, "%" PRId64, *((int64_t *)row[i]));
+ len += tsnprintf(str + len, size - len, "%" PRId64, *((int64_t *)row[i]));
break;
case TSDB_DATA_TYPE_UBIGINT:
- len += snprintf(str + len, size - len, "%" PRIu64, *((uint64_t *)row[i]));
+ len += tsnprintf(str + len, size - len, "%" PRIu64, *((uint64_t *)row[i]));
break;
case TSDB_DATA_TYPE_FLOAT: {
float fv = 0;
fv = GET_FLOAT_VAL(row[i]);
- len += snprintf(str + len, size - len, "%f", fv);
+ len += tsnprintf(str + len, size - len, "%f", fv);
} break;
case TSDB_DATA_TYPE_DOUBLE: {
double dv = 0;
dv = GET_DOUBLE_VAL(row[i]);
- len += snprintf(str + len, size - len, "%lf", dv);
+ len += tsnprintf(str + len, size - len, "%lf", dv);
} break;
case TSDB_DATA_TYPE_VARBINARY: {
@@ -576,11 +576,11 @@ int taos_print_row_with_size(char *str, uint32_t size, TAOS_ROW row, TAOS_FIELD
} break;
case TSDB_DATA_TYPE_TIMESTAMP:
- len += snprintf(str + len, size - len, "%" PRId64, *((int64_t *)row[i]));
+ len += tsnprintf(str + len, size - len, "%" PRId64, *((int64_t *)row[i]));
break;
case TSDB_DATA_TYPE_BOOL:
- len += snprintf(str + len, size - len, "%d", *((int8_t *)row[i]));
+ len += tsnprintf(str + len, size - len, "%d", *((int8_t *)row[i]));
default:
break;
}
diff --git a/source/common/src/systable.c b/source/common/src/systable.c
index 19df0f5a78..eef38bf18e 100644
--- a/source/common/src/systable.c
+++ b/source/common/src/systable.c
@@ -399,6 +399,20 @@ static const SSysDbTableSchema userCompactsDetailSchema[] = {
{.name = "start_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = false},
};
+static const SSysDbTableSchema anodesSchema[] = {
+ {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "url", .bytes = TSDB_ANAL_ANODE_URL_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "create_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
+ {.name = "update_time", .bytes = 8, .type = TSDB_DATA_TYPE_TIMESTAMP, .sysInfo = true},
+};
+
+static const SSysDbTableSchema anodesFullSchema[] = {
+ {.name = "id", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
+ {.name = "type", .bytes = TSDB_ANAL_ALGO_TYPE_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+ {.name = "algo", .bytes = TSDB_ANAL_ALGO_NAME_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
+};
+
static const SSysDbTableSchema tsmaSchema[] = {
{.name = "tsma_name", .bytes = SYSTABLE_SCH_TABLE_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
{.name = "db_name", .bytes = SYSTABLE_SCH_DB_NAME_LEN, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = false},
@@ -473,6 +487,8 @@ static const SSysTableMeta infosMeta[] = {
{TSDB_INS_TABLE_ARBGROUPS, arbGroupsSchema, tListLen(arbGroupsSchema), true},
{TSDB_INS_TABLE_ENCRYPTIONS, encryptionsSchema, tListLen(encryptionsSchema), true},
{TSDB_INS_TABLE_TSMAS, tsmaSchema, tListLen(tsmaSchema), false},
+ {TSDB_INS_TABLE_ANODES, anodesSchema, tListLen(anodesSchema), true},
+ {TSDB_INS_TABLE_ANODES_FULL, anodesFullSchema, tListLen(anodesFullSchema), true},
};
static const SSysDbTableSchema connectionsSchema[] = {
diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c
index 3c05294264..7cff5de008 100644
--- a/source/common/src/tglobal.c
+++ b/source/common/src/tglobal.c
@@ -56,6 +56,8 @@ int32_t tsShellActivityTimer = 3; // second
// queue & threads
int32_t tsNumOfRpcThreads = 1;
int32_t tsNumOfRpcSessions = 30000;
+int32_t tsShareConnLimit = 8;
+int32_t tsReadTimeout = 900;
int32_t tsTimeToGetAvailableConn = 500000;
int32_t tsKeepAliveIdle = 60;
@@ -179,12 +181,12 @@ int32_t tsRedirectFactor = 2;
int32_t tsRedirectMaxPeriod = 1000;
int32_t tsMaxRetryWaitTime = 10000;
bool tsUseAdapter = false;
-int32_t tsMetaCacheMaxSize = -1; // MB
-int32_t tsSlowLogThreshold = 10; // seconds
-int32_t tsSlowLogThresholdTest = INT32_MAX; // seconds
-char tsSlowLogExceptDb[TSDB_DB_NAME_LEN] = ""; // seconds
+int32_t tsMetaCacheMaxSize = -1; // MB
+int32_t tsSlowLogThreshold = 10; // seconds
+int32_t tsSlowLogThresholdTest = INT32_MAX; // seconds
+char tsSlowLogExceptDb[TSDB_DB_NAME_LEN] = ""; // seconds
int32_t tsSlowLogScope = SLOW_LOG_TYPE_QUERY;
-char* tsSlowLogScopeString = "query";
+char *tsSlowLogScopeString = "query";
int32_t tsSlowLogMaxLen = 4096;
int32_t tsTimeSeriesThreshold = 50;
bool tsMultiResultFunctionStarReturnTags = false;
@@ -322,7 +324,6 @@ int32_t tsMaxTsmaNum = 3;
int32_t tsMaxTsmaCalcDelay = 600;
int64_t tsmaDataDeleteMark = 1000 * 60 * 60 * 24; // in ms, default to 1d
-
#define TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, pName) \
if ((pItem = cfgGetItem(pCfg, pName)) == NULL) { \
TAOS_RETURN(TSDB_CODE_CFG_NOT_FOUND); \
@@ -361,7 +362,7 @@ static int32_t taosSplitS3Cfg(SConfig *pCfg, const char *name, char gVarible[TSD
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, name);
char *strDup = NULL;
- if ((strDup = taosStrdup(pItem->str))== NULL){
+ if ((strDup = taosStrdup(pItem->str)) == NULL) {
code = terrno;
goto _exit;
}
@@ -450,7 +451,9 @@ int32_t taosSetS3Cfg(SConfig *pCfg) {
TAOS_RETURN(TSDB_CODE_SUCCESS);
}
-struct SConfig *taosGetCfg() { return tsCfg; }
+struct SConfig *taosGetCfg() {
+ return tsCfg;
+}
static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *inputCfgDir, const char *envFile,
char *apolloUrl) {
@@ -572,7 +575,8 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
TAOS_CHECK_RETURN(
cfgAddInt32(pCfg, "compressMsgSize", tsCompressMsgSize, -1, 100000000, CFG_SCOPE_BOTH, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "queryPolicy", tsQueryPolicy, 1, 4, CFG_SCOPE_CLIENT, CFG_DYN_ENT_CLIENT));
- TAOS_CHECK_RETURN(cfgAddBool(pCfg, "queryTableNotExistAsEmpty", tsQueryTbNotExistAsEmpty, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT));
+ TAOS_CHECK_RETURN(
+ cfgAddBool(pCfg, "queryTableNotExistAsEmpty", tsQueryTbNotExistAsEmpty, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableQueryHb", tsEnableQueryHb, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(cfgAddBool(pCfg, "enableScience", tsEnableScience, CFG_SCOPE_CLIENT, CFG_DYN_NONE));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "querySmaOptimize", tsQuerySmaOptimize, 0, 1, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT));
@@ -600,16 +604,23 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
TAOS_CHECK_RETURN(
cfgAddInt32(pCfg, "metaCacheMaxSize", tsMetaCacheMaxSize, -1, INT32_MAX, CFG_SCOPE_CLIENT, CFG_DYN_CLIENT));
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "randErrorChance", tsRandErrChance, 0, 10000, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
- TAOS_CHECK_RETURN(cfgAddInt64(pCfg, "randErrorDivisor", tsRandErrDivisor, 1, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
+ TAOS_CHECK_RETURN(
+ cfgAddInt64(pCfg, "randErrorDivisor", tsRandErrDivisor, 1, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
TAOS_CHECK_RETURN(cfgAddInt64(pCfg, "randErrorScope", tsRandErrScope, 0, INT64_MAX, CFG_SCOPE_BOTH, CFG_DYN_BOTH));
tsNumOfRpcThreads = tsNumOfCores / 2;
- tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS);
+ tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 1, TSDB_MAX_RPC_THREADS);
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfRpcThreads", tsNumOfRpcThreads, 1, 1024, CFG_SCOPE_BOTH, CFG_DYN_NONE));
tsNumOfRpcSessions = TRANGE(tsNumOfRpcSessions, 100, 100000);
TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "numOfRpcSessions", tsNumOfRpcSessions, 1, 100000, CFG_SCOPE_BOTH, CFG_DYN_NONE));
+ tsShareConnLimit = TRANGE(tsShareConnLimit, 1, 512);
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "shareConnLimit", tsShareConnLimit, 1, 512, CFG_SCOPE_BOTH, CFG_DYN_NONE));
+
+ tsReadTimeout = TRANGE(tsReadTimeout, 64, 24 * 3600 * 7);
+ TAOS_CHECK_RETURN(cfgAddInt32(pCfg, "readTimeout", tsReadTimeout, 64, 24 * 3600 * 7, CFG_SCOPE_BOTH, CFG_DYN_NONE));
+
tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 10000000);
TAOS_CHECK_RETURN(
cfgAddInt32(pCfg, "timeToGetAvailableConn", tsTimeToGetAvailableConn, 20, 1000000, CFG_SCOPE_BOTH, CFG_DYN_NONE));
@@ -865,8 +876,7 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem = cfgGetItem(pCfg, "numOfRpcThreads");
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
- tsNumOfRpcThreads = numOfCores / 2;
- tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 2, TSDB_MAX_RPC_THREADS);
+ tsNumOfRpcThreads = TRANGE(tsNumOfRpcThreads, 1, TSDB_MAX_RPC_THREADS);
pItem->i32 = tsNumOfRpcThreads;
pItem->stype = stype;
}
@@ -878,6 +888,20 @@ static int32_t taosUpdateServerCfg(SConfig *pCfg) {
pItem->stype = stype;
}
+ pItem = cfgGetItem(pCfg, "shareConnLimit");
+ if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
+ tsShareConnLimit = TRANGE(tsShareConnLimit, 1, 512);
+ pItem->i32 = tsShareConnLimit;
+ pItem->stype = stype;
+ }
+
+ pItem = cfgGetItem(pCfg, "readTimeout");
+ if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
+ tsReadTimeout = TRANGE(tsReadTimeout, 64, 24 * 3600 * 7);
+ pItem->i32 = tsReadTimeout;
+ pItem->stype = stype;
+ }
+
pItem = cfgGetItem(pCfg, "timeToGetAvailableConn");
if (pItem != NULL && pItem->stype == CFG_STYPE_DEFAULT) {
tsTimeToGetAvailableConn = TRANGE(tsTimeToGetAvailableConn, 20, 1000000);
@@ -1083,9 +1107,9 @@ int32_t taosSetSlowLogScope(char *pScopeStr, int32_t *pScope) {
int32_t slowScope = 0;
- char* scope = NULL;
- char *tmp = NULL;
- while((scope = strsep(&pScopeStr, "|")) != NULL){
+ char *scope = NULL;
+ char *tmp = NULL;
+ while ((scope = strsep(&pScopeStr, "|")) != NULL) {
taosMemoryFreeClear(tmp);
tmp = taosStrdup(scope);
if (tmp == NULL) {
@@ -1142,13 +1166,13 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
(void)snprintf(defaultFirstEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort);
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "firstEp");
- SEp firstEp = {0};
+ SEp firstEp = {0};
TAOS_CHECK_RETURN(taosGetFqdnPortFromEp(strlen(pItem->str) == 0 ? defaultFirstEp : pItem->str, &firstEp));
(void)snprintf(tsFirst, sizeof(tsFirst), "%s:%u", firstEp.fqdn, firstEp.port);
TAOS_CHECK_RETURN(cfgSetItem(pCfg, "firstEp", tsFirst, pItem->stype, true));
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "secondEp");
- SEp secondEp = {0};
+ SEp secondEp = {0};
TAOS_CHECK_RETURN(taosGetFqdnPortFromEp(strlen(pItem->str) == 0 ? defaultFirstEp : pItem->str, &secondEp));
(void)snprintf(tsSecond, sizeof(tsSecond), "%s:%u", secondEp.fqdn, secondEp.port);
TAOS_CHECK_RETURN(cfgSetItem(pCfg, "secondEp", tsSecond, pItem->stype, true));
@@ -1252,6 +1276,12 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "numOfRpcSessions");
tsNumOfRpcSessions = pItem->i32;
+ TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "shareConnLimit");
+ tsShareConnLimit = pItem->i32;
+
+ TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "readTimeout");
+ tsReadTimeout = pItem->i32;
+
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "timeToGetAvailableConn");
tsTimeToGetAvailableConn = pItem->i32;
@@ -1353,6 +1383,12 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "numOfRpcSessions");
tsNumOfRpcSessions = pItem->i32;
+ TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "shareConnLimit");
+ tsShareConnLimit = pItem->i32;
+
+ TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "readTimeout");
+ tsReadTimeout = pItem->i32;
+
TAOS_CHECK_GET_CFG_ITEM(pCfg, pItem, "timeToGetAvailableConn");
tsTimeToGetAvailableConn = pItem->i32;
@@ -1651,8 +1687,8 @@ static int32_t taosSetAllDebugFlag(SConfig *pCfg, int32_t flag);
int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDir, const char **envCmd,
const char *envFile, char *apolloUrl, SArray *pArgs, bool tsc) {
- int32_t code = TSDB_CODE_SUCCESS;
- int32_t lino = 0;
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t lino = 0;
SConfig *pCfg = NULL;
if (tsCfg == NULL) {
@@ -1724,7 +1760,7 @@ int32_t taosReadDataFolder(const char *cfgDir, const char **envCmd, const char *
TAOS_CHECK_GOTO(cfgAddDir(pCfg, "dataDir", tsDataDir, CFG_SCOPE_SERVER, CFG_DYN_NONE), NULL, _exit);
TAOS_CHECK_GOTO(cfgAddInt32(pCfg, "debugFlag", dDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER), NULL, _exit);
- TAOS_CHECK_GOTO(cfgAddInt32(pCfg, "dDebugFlag", dDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER) ,NULL, _exit);
+ TAOS_CHECK_GOTO(cfgAddInt32(pCfg, "dDebugFlag", dDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER), NULL, _exit);
if ((code = taosLoadCfg(pCfg, envCmd, cfgDir, envFile, apolloUrl)) != 0) {
(void)printf("failed to load cfg since %s\n", tstrerror(code));
@@ -1753,7 +1789,7 @@ _exit:
static int32_t taosCheckGlobalCfg() {
uint32_t ipv4 = 0;
- int32_t code = taosGetIpv4FromFqdn(tsLocalFqdn, &ipv4);
+ int32_t code = taosGetIpv4FromFqdn(tsLocalFqdn, &ipv4);
if (code) {
uError("failed to get ip from fqdn:%s since %s, dnode can not be initialized", tsLocalFqdn, tstrerror(code));
TAOS_RETURN(TSDB_CODE_RPC_FQDN_ERROR);
@@ -1858,7 +1894,7 @@ typedef struct {
static int32_t taosCfgSetOption(OptionNameAndVar *pOptions, int32_t optionSize, SConfigItem *pItem, bool isDebugflag) {
int32_t code = TSDB_CODE_CFG_NOT_FOUND;
- char *name = pItem->name;
+ char *name = pItem->name;
for (int32_t d = 0; d < optionSize; ++d) {
const char *optName = pOptions[d].optionName;
if (strcasecmp(name, optName) != 0) continue;
@@ -2053,8 +2089,8 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
}
case 'f': {
if (strcasecmp("fqdn", name) == 0) {
- SConfigItem* pFqdnItem = cfgGetItem(pCfg, "fqdn");
- SConfigItem* pServerPortItem = cfgGetItem(pCfg, "serverPort");
+ SConfigItem *pFqdnItem = cfgGetItem(pCfg, "fqdn");
+ SConfigItem *pServerPortItem = cfgGetItem(pCfg, "serverPort");
SConfigItem *pFirstEpItem = cfgGetItem(pCfg, "firstEp");
if (pFqdnItem == NULL || pServerPortItem == NULL || pFirstEpItem == NULL) {
uError("failed to get fqdn or serverPort or firstEp from cfg");
@@ -2069,7 +2105,7 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
char defaultFirstEp[TSDB_EP_LEN] = {0};
(void)snprintf(defaultFirstEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort);
- SEp firstEp = {0};
+ SEp firstEp = {0};
TAOS_CHECK_GOTO(
taosGetFqdnPortFromEp(strlen(pFirstEpItem->str) == 0 ? defaultFirstEp : pFirstEpItem->str, &firstEp), &lino,
_out);
@@ -2109,8 +2145,8 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
}
case 'l': {
if (strcasecmp("locale", name) == 0) {
- SConfigItem* pLocaleItem = cfgGetItem(pCfg, "locale");
- SConfigItem* pCharsetItem = cfgGetItem(pCfg, "charset");
+ SConfigItem *pLocaleItem = cfgGetItem(pCfg, "locale");
+ SConfigItem *pCharsetItem = cfgGetItem(pCfg, "charset");
if (pLocaleItem == NULL || pCharsetItem == NULL) {
uError("failed to get locale or charset from cfg");
code = TSDB_CODE_CFG_NOT_FOUND;
@@ -2183,7 +2219,7 @@ static int32_t taosCfgDynamicOptionsForClient(SConfig *pCfg, const char *name) {
char defaultFirstEp[TSDB_EP_LEN] = {0};
(void)snprintf(defaultFirstEp, TSDB_EP_LEN, "%s:%u", tsLocalFqdn, tsServerPort);
- SEp firstEp = {0};
+ SEp firstEp = {0};
TAOS_CHECK_GOTO(
taosGetFqdnPortFromEp(strlen(pFirstEpItem->str) == 0 ? defaultFirstEp : pFirstEpItem->str, &firstEp), &lino,
_out);
@@ -2314,7 +2350,7 @@ int32_t taosSetGlobalDebugFlag(int32_t flag) { return taosSetAllDebugFlag(tsCfg,
// NOTE: set all command does not change the tmrDebugFlag
static int32_t taosSetAllDebugFlag(SConfig *pCfg, int32_t flag) {
if (flag < 0) TAOS_RETURN(TSDB_CODE_INVALID_PARA);
- if (flag == 0) TAOS_RETURN(TSDB_CODE_SUCCESS); // just ignore
+ if (flag == 0) TAOS_RETURN(TSDB_CODE_SUCCESS); // just ignore
SArray *noNeedToSetVars = NULL;
SConfigItem *pItem = NULL;
diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c
index 4c4b78278e..63fcf900bf 100644
--- a/source/common/src/tmsg.c
+++ b/source/common/src/tmsg.c
@@ -40,6 +40,7 @@
#define TD_MSG_RANGE_CODE_
#include "tmsgdef.h"
+#include "tanal.h"
#include "tcol.h"
#include "tlog.h"
@@ -1453,6 +1454,7 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
}
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->ipWhiteVer));
+ TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->analVer));
TAOS_CHECK_EXIT(tSerializeSMonitorParas(&encoder, &pReq->clusterCfg.monitorParas));
tEndEncode(&encoder);
@@ -1576,6 +1578,10 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->ipWhiteVer));
}
+ if (!tDecodeIsEnd(&decoder)) {
+ TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->analVer));
+ }
+
if (!tDecodeIsEnd(&decoder)) {
TAOS_CHECK_EXIT(tDeserializeSMonitorParas(&decoder, &pReq->clusterCfg.monitorParas));
}
@@ -1652,6 +1658,7 @@ int32_t tSerializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
TAOS_CHECK_EXIT(tEncodeI32(&encoder, pRsp->statusSeq));
TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->ipWhiteVer));
+ TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->analVer));
tEndEncode(&encoder);
_exit:
@@ -1704,6 +1711,10 @@ int32_t tDeserializeSStatusRsp(void *buf, int32_t bufLen, SStatusRsp *pRsp) {
TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->ipWhiteVer));
}
+ if (!tDecodeIsEnd(&decoder)) {
+ TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->analVer));
+ }
+
tEndDecode(&decoder);
_exit:
tDecoderClear(&decoder);
@@ -2045,6 +2056,156 @@ _exit:
return code;
}
+int32_t tSerializeRetrieveAnalAlgoReq(void *buf, int32_t bufLen, SRetrieveAnalAlgoReq *pReq) {
+ SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
+ tEncoderInit(&encoder, buf, bufLen);
+
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->dnodeId));
+ TAOS_CHECK_EXIT(tEncodeI64(&encoder, pReq->analVer));
+ tEndEncode(&encoder);
+
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
+ tEncoderClear(&encoder);
+ return tlen;
+}
+
+int32_t tDeserializeRetrieveAnalAlgoReq(void *buf, int32_t bufLen, SRetrieveAnalAlgoReq *pReq) {
+ SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
+ tDecoderInit(&decoder, buf, bufLen);
+
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->dnodeId));
+ TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pReq->analVer));
+ tEndDecode(&decoder);
+
+_exit:
+ tDecoderClear(&decoder);
+ return code;
+}
+
+int32_t tSerializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnalAlgoRsp *pRsp) {
+ SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
+ tEncoderInit(&encoder, buf, bufLen);
+
+ int32_t numOfAlgos = 0;
+ void *pIter = taosHashIterate(pRsp->hash, NULL);
+ while (pIter != NULL) {
+ SAnalUrl *pUrl = pIter;
+ size_t nameLen = 0;
+ const char *name = taosHashGetKey(pIter, &nameLen);
+ if (nameLen > 0 && nameLen <= TSDB_ANAL_ALGO_KEY_LEN && pUrl->urlLen > 0) {
+ numOfAlgos++;
+ }
+ pIter = taosHashIterate(pRsp->hash, pIter);
+ }
+
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeI64(&encoder, pRsp->ver));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, numOfAlgos));
+
+ pIter = taosHashIterate(pRsp->hash, NULL);
+ while (pIter != NULL) {
+ SAnalUrl *pUrl = pIter;
+ size_t nameLen = 0;
+ const char *name = taosHashGetKey(pIter, &nameLen);
+ if (nameLen > 0 && pUrl->urlLen > 0) {
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, nameLen));
+ TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t *)name, nameLen));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pUrl->anode));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pUrl->type));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pUrl->urlLen));
+ TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t *)pUrl->url, pUrl->urlLen));
+ }
+ pIter = taosHashIterate(pRsp->hash, pIter);
+ }
+
+ tEndEncode(&encoder);
+
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
+ tEncoderClear(&encoder);
+ return tlen;
+}
+
+int32_t tDeserializeRetrieveAnalAlgoRsp(void *buf, int32_t bufLen, SRetrieveAnalAlgoRsp *pRsp) {
+ if (pRsp->hash == NULL) {
+ pRsp->hash = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK);
+ if (pRsp->hash == NULL) {
+ terrno = TSDB_CODE_OUT_OF_BUFFER;
+ return terrno;
+ }
+ }
+
+ SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ tDecoderInit(&decoder, buf, bufLen);
+
+ int32_t numOfAlgos = 0;
+ int32_t nameLen;
+ int32_t type;
+ char name[TSDB_ANAL_ALGO_KEY_LEN];
+ SAnalUrl url = {0};
+
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeI64(&decoder, &pRsp->ver));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &numOfAlgos));
+
+ for (int32_t f = 0; f < numOfAlgos; ++f) {
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &nameLen));
+ if (nameLen > 0 && nameLen <= TSDB_ANAL_ALGO_NAME_LEN) {
+ TAOS_CHECK_EXIT(tDecodeCStrTo(&decoder, name));
+ }
+
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &url.anode));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &type));
+ url.type = (EAnalAlgoType)type;
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &url.urlLen));
+ if (url.urlLen > 0) {
+ TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&url.url, NULL) < 0);
+ }
+
+ TAOS_CHECK_EXIT(taosHashPut(pRsp->hash, name, nameLen, &url, sizeof(SAnalUrl)));
+ }
+
+ tEndDecode(&decoder);
+
+_exit:
+ tDecoderClear(&decoder);
+ return code;
+}
+
+void tFreeRetrieveAnalAlgoRsp(SRetrieveAnalAlgoRsp *pRsp) {
+ void *pIter = taosHashIterate(pRsp->hash, NULL);
+ while (pIter != NULL) {
+ SAnalUrl *pUrl = (SAnalUrl *)pIter;
+ taosMemoryFree(pUrl->url);
+ pIter = taosHashIterate(pRsp->hash, pIter);
+ }
+ taosHashCleanup(pRsp->hash);
+
+ pRsp->hash = NULL;
+}
+
void tFreeSCreateUserReq(SCreateUserReq *pReq) {
FREESQL();
taosMemoryFreeClear(pReq->pIpRanges);
@@ -2962,6 +3123,108 @@ _exit:
return code;
}
+int32_t tSerializeSMCreateAnodeReq(void *buf, int32_t bufLen, SMCreateAnodeReq *pReq) {
+ SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
+ tEncoderInit(&encoder, buf, bufLen);
+
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->urlLen));
+ if (pReq->urlLen > 0) {
+ TAOS_CHECK_EXIT(tEncodeBinary(&encoder, (const uint8_t *)pReq->url, pReq->urlLen));
+ }
+ ENCODESQL();
+ tEndEncode(&encoder);
+
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
+ tEncoderClear(&encoder);
+ return tlen;
+}
+
+int32_t tDeserializeSMCreateAnodeReq(void *buf, int32_t bufLen, SMCreateAnodeReq *pReq) {
+ SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
+ tDecoderInit(&decoder, buf, bufLen);
+
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->urlLen));
+ if (pReq->urlLen > 0) {
+ TAOS_CHECK_EXIT(tDecodeBinaryAlloc(&decoder, (void **)&pReq->url, NULL));
+ }
+
+ DECODESQL();
+ tEndDecode(&decoder);
+
+_exit:
+ tDecoderClear(&decoder);
+ return code;
+}
+
+void tFreeSMCreateAnodeReq(SMCreateAnodeReq *pReq) {
+ taosMemoryFreeClear(pReq->url);
+ FREESQL();
+}
+
+int32_t tSerializeSMDropAnodeReq(void *buf, int32_t bufLen, SMDropAnodeReq *pReq) {
+ SEncoder encoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+ int32_t tlen;
+ tEncoderInit(&encoder, buf, bufLen);
+
+ TAOS_CHECK_EXIT(tStartEncode(&encoder));
+ TAOS_CHECK_EXIT(tEncodeI32(&encoder, pReq->anodeId));
+ ENCODESQL();
+ tEndEncode(&encoder);
+
+_exit:
+ if (code) {
+ tlen = code;
+ } else {
+ tlen = encoder.pos;
+ }
+ tEncoderClear(&encoder);
+ return tlen;
+}
+
+int32_t tDeserializeSMDropAnodeReq(void *buf, int32_t bufLen, SMDropAnodeReq *pReq) {
+ SDecoder decoder = {0};
+ int32_t code = 0;
+ int32_t lino;
+
+ tDecoderInit(&decoder, buf, bufLen);
+
+ TAOS_CHECK_EXIT(tStartDecode(&decoder));
+ TAOS_CHECK_EXIT(tDecodeI32(&decoder, &pReq->anodeId));
+ DECODESQL();
+ tEndDecode(&decoder);
+
+_exit:
+ tDecoderClear(&decoder);
+ return code;
+}
+
+void tFreeSMDropAnodeReq(SMDropAnodeReq *pReq) { FREESQL(); }
+
+int32_t tSerializeSMUpdateAnodeReq(void *buf, int32_t bufLen, SMUpdateAnodeReq *pReq) {
+ return tSerializeSMDropAnodeReq(buf, bufLen, pReq);
+}
+
+int32_t tDeserializeSMUpdateAnodeReq(void *buf, int32_t bufLen, SMUpdateAnodeReq *pReq) {
+ return tDeserializeSMDropAnodeReq(buf, bufLen, pReq);
+}
+
+void tFreeSMUpdateAnodeReq(SMUpdateAnodeReq *pReq) { tFreeSMDropAnodeReq(pReq); }
+
int32_t tSerializeSCreateDnodeReq(void *buf, int32_t bufLen, SCreateDnodeReq *pReq) {
SEncoder encoder = {0};
int32_t code = 0;
diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c
index 1089b0eced..040eafbcf1 100644
--- a/source/dnode/mgmt/exe/dmMain.c
+++ b/source/dnode/mgmt/exe/dmMain.c
@@ -182,6 +182,7 @@ static void dmSetSignalHandle() {
}
#endif
}
+
extern bool generateNewMeta;
static int32_t dmParseArgs(int32_t argc, char const *argv[]) {
diff --git a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
index 18b3f66a60..cbf1959e75 100644
--- a/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
+++ b/source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
@@ -28,6 +28,7 @@ typedef struct SDnodeMgmt {
const char *path;
const char *name;
TdThread statusThread;
+ TdThread statusInfoThread;
TdThread notifyThread;
TdThread monitorThread;
TdThread auditThread;
@@ -49,6 +50,7 @@ typedef struct SDnodeMgmt {
// dmHandle.c
SArray *dmGetMsgHandles();
void dmSendStatusReq(SDnodeMgmt *pMgmt);
+void dmUpdateStatusInfo(SDnodeMgmt *pMgmt);
void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq);
int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t dmProcessAuthRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
@@ -62,7 +64,9 @@ int32_t dmProcessCreateEncryptKeyReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
// dmWorker.c
int32_t dmPutNodeMsgToMgmtQueue(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t dmStartStatusThread(SDnodeMgmt *pMgmt);
+int32_t dmStartStatusInfoThread(SDnodeMgmt *pMgmt);
void dmStopStatusThread(SDnodeMgmt *pMgmt);
+void dmStopStatusInfoThread(SDnodeMgmt *pMgmt);
int32_t dmStartNotifyThread(SDnodeMgmt *pMgmt);
void dmStopNotifyThread(SDnodeMgmt *pMgmt);
int32_t dmStartMonitorThread(SDnodeMgmt *pMgmt);
diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
index 87b1ae0efa..1446faab77 100644
--- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
@@ -18,10 +18,13 @@
#include "dmInt.h"
#include "monitor.h"
#include "systable.h"
+#include "tanal.h"
#include "tchecksum.h"
extern SConfig *tsCfg;
+SMonVloadInfo tsVinfo = {0};
+
static void dmUpdateDnodeCfg(SDnodeMgmt *pMgmt, SDnodeCfg *pCfg) {
int32_t code = 0;
if (pMgmt->pData->dnodeId == 0 || pMgmt->pData->clusterId == 0) {
@@ -71,7 +74,7 @@ static void dmMayShouldUpdateIpWhiteList(SDnodeMgmt *pMgmt, int64_t ver) {
SRpcMsg rpcMsg = {.pCont = pHead,
.contLen = contLen,
.msgType = TDMT_MND_RETRIEVE_IP_WHITE,
- .info.ahandle = (void *)0x9527,
+ .info.ahandle = 0,
.info.notFreeAhandle = 1,
.info.refId = 0,
.info.noResp = 0,
@@ -86,6 +89,46 @@ static void dmMayShouldUpdateIpWhiteList(SDnodeMgmt *pMgmt, int64_t ver) {
}
}
+static void dmMayShouldUpdateAnalFunc(SDnodeMgmt *pMgmt, int64_t newVer) {
+ int32_t code = 0;
+ int64_t oldVer = taosAnalGetVersion();
+ if (oldVer == newVer) return;
+ dDebug("analysis on dnode ver:%" PRId64 ", status ver:%" PRId64, oldVer, newVer);
+
+ SRetrieveAnalAlgoReq req = {.dnodeId = pMgmt->pData->dnodeId, .analVer = oldVer};
+ int32_t contLen = tSerializeRetrieveAnalAlgoReq(NULL, 0, &req);
+ if (contLen < 0) {
+ dError("failed to serialize analysis function ver request since %s", tstrerror(contLen));
+ return;
+ }
+
+ void *pHead = rpcMallocCont(contLen);
+ contLen = tSerializeRetrieveAnalAlgoReq(pHead, contLen, &req);
+ if (contLen < 0) {
+ rpcFreeCont(pHead);
+ dError("failed to serialize analysis function ver request since %s", tstrerror(contLen));
+ return;
+ }
+
+ SRpcMsg rpcMsg = {
+ .pCont = pHead,
+ .contLen = contLen,
+ .msgType = TDMT_MND_RETRIEVE_ANAL_ALGO,
+ .info.ahandle = (void *)0x9527,
+ .info.refId = 0,
+ .info.noResp = 0,
+ .info.handle = 0,
+ };
+ SEpSet epset = {0};
+
+ (void)dmGetMnodeEpSet(pMgmt->pData, &epset);
+
+ code = rpcSendRequest(pMgmt->msgCb.clientRpc, &epset, &rpcMsg, NULL);
+ if (code != 0) {
+ dError("failed to send retrieve analysis func ver request since %s", tstrerror(code));
+ }
+}
+
static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
const STraceId *trace = &pRsp->info.traceId;
dGTrace("status rsp received from mnode, statusSeq:%d code:0x%x", pMgmt->statusSeq, pRsp->code);
@@ -113,6 +156,7 @@ static void dmProcessStatusRsp(SDnodeMgmt *pMgmt, SRpcMsg *pRsp) {
dmUpdateEps(pMgmt->pData, statusRsp.pDnodeEps);
}
dmMayShouldUpdateIpWhiteList(pMgmt, statusRsp.ipWhiteVer);
+ dmMayShouldUpdateAnalFunc(pMgmt, statusRsp.analVer);
}
tFreeSStatusRsp(&statusRsp);
}
@@ -163,9 +207,16 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
(void)taosThreadRwlockUnlock(&pMgmt->pData->lock);
dDebug("send status req to mnode, statusSeq:%d, begin to get vnode loads", pMgmt->statusSeq);
- SMonVloadInfo vinfo = {0};
- (*pMgmt->getVnodeLoadsFp)(&vinfo);
- req.pVloads = vinfo.pVloads;
+ if (taosThreadMutexLock(&pMgmt->pData->statusInfolock) != 0) {
+ dError("failed to lock status info lock");
+ return;
+ }
+ req.pVloads = tsVinfo.pVloads;
+ tsVinfo.pVloads = NULL;
+ if (taosThreadMutexUnlock(&pMgmt->pData->statusInfolock) != 0) {
+ dError("failed to unlock status info lock");
+ return;
+ }
dDebug("send status req to mnode, statusSeq:%d, begin to get mnode loads", pMgmt->statusSeq);
SMonMloadInfo minfo = {0};
@@ -178,6 +229,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
pMgmt->statusSeq++;
req.statusSeq = pMgmt->statusSeq;
req.ipWhiteVer = pMgmt->pData->ipWhiteVer;
+ req.analVer = taosAnalGetVersion();
int32_t contLen = tSerializeSStatusReq(NULL, 0, &req);
if (contLen < 0) {
@@ -197,7 +249,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
SRpcMsg rpcMsg = {.pCont = pHead,
.contLen = contLen,
.msgType = TDMT_MND_STATUS,
- .info.ahandle = (void *)0x9527,
+ .info.ahandle = 0,
.info.notFreeAhandle = 1,
.info.refId = 0,
.info.noResp = 0,
@@ -231,6 +283,28 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
dmProcessStatusRsp(pMgmt, &rpcRsp);
}
+void dmUpdateStatusInfo(SDnodeMgmt *pMgmt) {
+ SMonVloadInfo vinfo = {0};
+ dDebug("begin to get vnode loads");
+ (*pMgmt->getVnodeLoadsFp)(&vinfo);
+ dDebug("begin to lock status info");
+ if (taosThreadMutexLock(&pMgmt->pData->statusInfolock) != 0) {
+ dError("failed to lock status info lock");
+ return;
+ }
+ if (tsVinfo.pVloads == NULL) {
+ tsVinfo.pVloads = vinfo.pVloads;
+ vinfo.pVloads = NULL;
+ } else {
+ taosArrayDestroy(vinfo.pVloads);
+ vinfo.pVloads = NULL;
+ }
+ if (taosThreadMutexUnlock(&pMgmt->pData->statusInfolock) != 0) {
+ dError("failed to unlock status info lock");
+ return;
+ }
+}
+
void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq) {
int32_t contLen = tSerializeSNotifyReq(NULL, 0, pReq);
if (contLen < 0) {
@@ -248,7 +322,7 @@ void dmSendNotifyReq(SDnodeMgmt *pMgmt, SNotifyReq *pReq) {
SRpcMsg rpcMsg = {.pCont = pHead,
.contLen = contLen,
.msgType = TDMT_MND_NOTIFY,
- .info.ahandle = (void *)0x9527,
+ .info.ahandle = 0,
.info.notFreeAhandle = 1,
.info.refId = 0,
.info.noResp = 1,
diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c
index 22c2b2f5b2..04b4e9101c 100644
--- a/source/dnode/mgmt/mgmt_dnode/src/dmInt.c
+++ b/source/dnode/mgmt/mgmt_dnode/src/dmInt.c
@@ -16,12 +16,16 @@
#define _DEFAULT_SOURCE
#include "dmInt.h"
#include "libs/function/tudf.h"
+#include "tanal.h"
static int32_t dmStartMgmt(SDnodeMgmt *pMgmt) {
int32_t code = 0;
if ((code = dmStartStatusThread(pMgmt)) != 0) {
return code;
}
+ if ((code = dmStartStatusInfoThread(pMgmt)) != 0) {
+ return code;
+ }
#if defined(TD_ENTERPRISE)
if ((code = dmStartNotifyThread(pMgmt)) != 0) {
return code;
@@ -44,6 +48,7 @@ static void dmStopMgmt(SDnodeMgmt *pMgmt) {
dmStopMonitorThread(pMgmt);
dmStopAuditThread(pMgmt);
dmStopStatusThread(pMgmt);
+ dmStopStatusInfoThread(pMgmt);
#if defined(TD_ENTERPRISE)
dmStopNotifyThread(pMgmt);
#endif
@@ -80,6 +85,10 @@ static int32_t dmOpenMgmt(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) {
dError("failed to start udfd since %s", tstrerror(code));
}
+ if ((code = taosAnalInit()) != 0) {
+ dError("failed to init analysis env since %s", tstrerror(code));
+ }
+
pOutput->pMgmt = pMgmt;
return 0;
}
diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
index 58b86b20b1..7fc9920816 100644
--- a/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+++ b/source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
@@ -47,6 +47,49 @@ static void *dmStatusThreadFp(void *param) {
return NULL;
}
+extern SMonVloadInfo tsVinfo;
+static void *dmStatusInfoThreadFp(void *param) {
+ SDnodeMgmt *pMgmt = param;
+ int64_t lastTime = taosGetTimestampMs();
+ setThreadName("dnode-status-info");
+
+ int32_t upTimeCount = 0;
+ int64_t upTime = 0;
+
+ while (1) {
+ taosMsleep(200);
+ if (pMgmt->pData->dropped || pMgmt->pData->stopped) break;
+
+ int64_t curTime = taosGetTimestampMs();
+ if (curTime < lastTime) lastTime = curTime;
+ float interval = (curTime - lastTime) / 1000.0f;
+ if (interval >= tsStatusInterval) {
+ dmUpdateStatusInfo(pMgmt);
+ lastTime = curTime;
+
+ if ((upTimeCount = ((upTimeCount + 1) & 63)) == 0) {
+ upTime = taosGetOsUptime() - tsDndStartOsUptime;
+ tsDndUpTime = TMAX(tsDndUpTime, upTime);
+ }
+ }
+ }
+ dDebug("begin to lock status info when thread exit");
+ if (taosThreadMutexLock(&pMgmt->pData->statusInfolock) != 0) {
+ dError("failed to lock status info lock");
+ return NULL;
+ }
+ if (tsVinfo.pVloads != NULL) {
+ taosArrayDestroy(tsVinfo.pVloads);
+ tsVinfo.pVloads = NULL;
+ }
+ if (taosThreadMutexUnlock(&pMgmt->pData->statusInfolock) != 0) {
+ dError("failed to unlock status info lock");
+ return NULL;
+ }
+
+ return NULL;
+}
+
SDmNotifyHandle dmNotifyHdl = {.state = 0};
#define TIMESERIES_STASH_NUM 5
static void *dmNotifyThreadFp(void *param) {
@@ -280,6 +323,22 @@ int32_t dmStartStatusThread(SDnodeMgmt *pMgmt) {
return 0;
}
+int32_t dmStartStatusInfoThread(SDnodeMgmt *pMgmt) {
+ int32_t code = 0;
+ TdThreadAttr thAttr;
+ (void)taosThreadAttrInit(&thAttr);
+ (void)taosThreadAttrSetDetachState(&thAttr, PTHREAD_CREATE_JOINABLE);
+ if (taosThreadCreate(&pMgmt->statusInfoThread, &thAttr, dmStatusInfoThreadFp, pMgmt) != 0) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ dError("failed to create status Info thread since %s", tstrerror(code));
+ return code;
+ }
+
+ (void)taosThreadAttrDestroy(&thAttr);
+ tmsgReportStartup("dnode-status-info", "initialized");
+ return 0;
+}
+
void dmStopStatusThread(SDnodeMgmt *pMgmt) {
if (taosCheckPthreadValid(pMgmt->statusThread)) {
(void)taosThreadJoin(pMgmt->statusThread, NULL);
@@ -287,6 +346,13 @@ void dmStopStatusThread(SDnodeMgmt *pMgmt) {
}
}
+void dmStopStatusInfoThread(SDnodeMgmt *pMgmt) {
+ if (taosCheckPthreadValid(pMgmt->statusInfoThread)) {
+ (void)taosThreadJoin(pMgmt->statusInfoThread, NULL);
+ taosThreadClear(&pMgmt->statusInfoThread);
+ }
+}
+
int32_t dmStartNotifyThread(SDnodeMgmt *pMgmt) {
int32_t code = 0;
TdThreadAttr thAttr;
diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
index 7204cde8f7..bc6c7e55ba 100644
--- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
@@ -141,6 +141,9 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_MND_DNODE_LIST, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_SNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_SNODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_ANODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_UPDATE_ANODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_ANODE, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_DB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_USE_DB, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
@@ -180,6 +183,7 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_VND_FETCH_TTL_EXPIRED_TBS_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_DROP_TABLE_RSP, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_RETRIEVE_ANAL_ALGO, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_RETRIEVE_IP_WHITE, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_USER_WHITELIST, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_GET_INDEX, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
@@ -208,7 +212,7 @@ SArray *mmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_VIEW, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_VIEW_META, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_STATIS, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_COMPACT, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_MND_KILL_COMPACT, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_CONFIG_CLUSTER, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_QUERY_COMPACT_PROGRESS_RSP, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_ENCRYPT_KEY, mmPutMsgToReadQueue, 0) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
index 70c873e0f5..7e950ef1be 100644
--- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
+++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c
@@ -415,14 +415,24 @@ int32_t vmProcessCreateVnodeReq(SVnodeMgmt *pMgmt, SRpcMsg *pMsg) {
goto _OVER;
}
- // taosThreadMutexLock(&pMgmt->createLock);
+ code = taosThreadMutexLock(&pMgmt->createLock);
+ if (code != 0) {
+ dError("vgId:%d, failed to lock since %s", req.vgId, tstrerror(code));
+ goto _OVER;
+ }
code = vmWriteVnodeListToFile(pMgmt);
if (code != 0) {
code = terrno != 0 ? terrno : code;
- // taosThreadMutexUnlock(&pMgmt->createLock);
+ int32_t ret = taosThreadMutexUnlock(&pMgmt->createLock);
+ if (ret != 0) {
+ dError("vgId:%d, failed to unlock since %s", req.vgId, tstrerror(ret));
+ }
goto _OVER;
}
- // taosThreadMutexUnlock(&pMgmt->createLock);
+ int32_t ret = taosThreadMutexUnlock(&pMgmt->createLock);
+ if (ret != 0) {
+ dError("vgId:%d, failed to unlock since %s", req.vgId, tstrerror(ret));
+ }
_OVER:
if (code != 0) {
@@ -1037,7 +1047,7 @@ SArray *vmGetMsgHandles() {
if (dmSetMgmtHandle(pArray, TDMT_VND_COMPACT, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_TRIM, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_VND_S3MIGRATE, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER;
- if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_VNODE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
+ if (dmSetMgmtHandle(pArray, TDMT_DND_CREATE_VNODE, vmPutMsgToMultiMgmtQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_DND_DROP_VNODE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_DND_ALTER_VNODE_TYPE, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
if (dmSetMgmtHandle(pArray, TDMT_DND_CHECK_VNODE_LEARNER_CATCHUP, vmPutMsgToMgmtQueue, 0) == NULL) goto _OVER;
diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c
index 2d0ad70adf..0c2bd2bc0f 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c
@@ -20,6 +20,7 @@
#include "libs/function/tudf.h"
#include "tgrant.h"
#include "tcompare.h"
+#include "tanal.h"
// clang-format on
#define DM_INIT_AUDIT() \
@@ -214,6 +215,7 @@ void dmCleanup() {
dError("failed to close udfc");
}
udfStopUdfd();
+ taosAnalCleanup();
taosStopCacheRefreshWorker();
(void)dmDiskClose();
DestroyRegexCache();
diff --git a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c
index 277dd2e02a..5e4f7163e7 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmMgmt.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmMgmt.c
@@ -214,6 +214,7 @@ int32_t dmInitVars(SDnode *pDnode) {
}
(void)taosThreadRwlockInit(&pData->lock, NULL);
+ (void)taosThreadMutexInit(&pData->statusInfolock, NULL);
(void)taosThreadMutexInit(&pDnode->mutex, NULL);
return 0;
}
diff --git a/source/dnode/mgmt/node_mgmt/src/dmTransport.c b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
index 3090903805..28d6113bba 100644
--- a/source/dnode/mgmt/node_mgmt/src/dmTransport.c
+++ b/source/dnode/mgmt/node_mgmt/src/dmTransport.c
@@ -17,6 +17,7 @@
#include "dmMgmt.h"
#include "qworker.h"
#include "tversion.h"
+#include "tanal.h"
static inline void dmSendRsp(SRpcMsg *pMsg) {
if (rpcSendResponse(pMsg) != 0) {
@@ -106,6 +107,16 @@ static bool dmIsForbiddenIp(int8_t forbidden, char *user, uint32_t clientIp) {
}
}
+static void dmUpdateAnalFunc(SDnodeData *pData, void *pTrans, SRpcMsg *pRpc) {
+ SRetrieveAnalAlgoRsp rsp = {0};
+ if (tDeserializeRetrieveAnalAlgoRsp(pRpc->pCont, pRpc->contLen, &rsp) == 0) {
+ taosAnalUpdate(rsp.ver, rsp.hash);
+ rsp.hash = NULL;
+ }
+ tFreeRetrieveAnalAlgoRsp(&rsp);
+ rpcFreeCont(pRpc->pCont);
+}
+
static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
SDnodeTrans *pTrans = &pDnode->trans;
int32_t code = -1;
@@ -154,6 +165,9 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
case TDMT_MND_RETRIEVE_IP_WHITE_RSP:
dmUpdateRpcIpWhite(&pDnode->data, pTrans->serverRpc, pRpc);
return;
+ case TDMT_MND_RETRIEVE_ANAL_ALGO_RSP:
+ dmUpdateAnalFunc(&pDnode->data, pTrans->serverRpc, pRpc);
+ return;
default:
break;
}
@@ -253,7 +267,7 @@ _OVER:
}
if (IsReq(pRpc)) {
- SRpcMsg rsp = {.code = code, .info = pRpc->info};
+ SRpcMsg rsp = {.code = code, .info = pRpc->info, .msgType = pRpc->msgType + 1};
if (code == TSDB_CODE_MNODE_NOT_FOUND) {
dmBuildMnodeRedirectRsp(pDnode, &rsp);
}
@@ -404,9 +418,12 @@ int32_t dmInitClient(SDnode *pDnode) {
rpcInit.connLimitNum = connLimitNum;
rpcInit.connLimitLock = 1;
rpcInit.supportBatch = 1;
- rpcInit.batchSize = 8 * 1024;
+ rpcInit.shareConnLimit = tsShareConnLimit * 2;
+ rpcInit.shareConn = 1;
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
rpcInit.notWaitAvaliableConn = 0;
+ rpcInit.startReadTimer = 1;
+ rpcInit.readTimeout = tsReadTimeout;
if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) {
dError("failed to convert version string:%s to int", version);
@@ -452,8 +469,10 @@ int32_t dmInitStatusClient(SDnode *pDnode) {
rpcInit.connLimitNum = connLimitNum;
rpcInit.connLimitLock = 1;
rpcInit.supportBatch = 1;
- rpcInit.batchSize = 8 * 1024;
+ rpcInit.shareConnLimit = tsShareConnLimit * 2;
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
+ rpcInit.startReadTimer = 0;
+ rpcInit.readTimeout = 0;
if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) {
dError("failed to convert version string:%s to int", version);
@@ -500,8 +519,11 @@ int32_t dmInitSyncClient(SDnode *pDnode) {
rpcInit.connLimitNum = connLimitNum;
rpcInit.connLimitLock = 1;
rpcInit.supportBatch = 1;
- rpcInit.batchSize = 8 * 1024;
+ rpcInit.shareConnLimit = tsShareConnLimit * 8;
rpcInit.timeToGetConn = tsTimeToGetAvailableConn;
+ rpcInit.startReadTimer = 1;
+ rpcInit.readTimeout = tsReadTimeout;
+
if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) {
dError("failed to convert version string:%s to int", version);
}
@@ -555,6 +577,7 @@ int32_t dmInitServer(SDnode *pDnode) {
rpcInit.idleTime = tsShellActivityTimer * 1000;
rpcInit.parent = pDnode;
rpcInit.compressSize = tsCompressMsgSize;
+ rpcInit.shareConnLimit = tsShareConnLimit * 16;
if (taosVersionStrToInt(version, &(rpcInit.compatibilityVer)) != 0) {
dError("failed to convert version string:%s to int", version);
diff --git a/source/dnode/mgmt/node_util/inc/dmUtil.h b/source/dnode/mgmt/node_util/inc/dmUtil.h
index b5842acbad..de20f807e9 100644
--- a/source/dnode/mgmt/node_util/inc/dmUtil.h
+++ b/source/dnode/mgmt/node_util/inc/dmUtil.h
@@ -144,6 +144,7 @@ typedef struct {
char machineId[TSDB_MACHINE_ID_LEN + 1];
EEncryptAlgor encryptAlgorigthm;
EEncryptScope encryptScope;
+ TdThreadMutex statusInfolock;
} SDnodeData;
typedef struct {
diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt
index cb148c1949..1a74b6fa9f 100644
--- a/source/dnode/mnode/impl/CMakeLists.txt
+++ b/source/dnode/mnode/impl/CMakeLists.txt
@@ -15,6 +15,9 @@ IF (TD_ENTERPRISE)
add_definitions(-DUSE_COS)
ENDIF()
+ IF(${BUILD_WITH_ANALYSIS})
+ add_definitions(-DUSE_ANAL)
+ ENDIF()
ENDIF ()
add_library(mnode STATIC ${MNODE_SRC})
diff --git a/source/dnode/mnode/impl/inc/mndAnode.h b/source/dnode/mnode/impl/inc/mndAnode.h
new file mode 100644
index 0000000000..63e8f9090e
--- /dev/null
+++ b/source/dnode/mnode/impl/inc/mndAnode.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _TD_MND_ANODE_H_
+#define _TD_MND_ANODE_H_
+
+#include "mndInt.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int32_t mndInitAnode(SMnode *pMnode);
+void mndCleanupAnode(SMnode *pMnode);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_TD_MND_ANODE_H_*/
\ No newline at end of file
diff --git a/source/dnode/mnode/impl/inc/mndDef.h b/source/dnode/mnode/impl/inc/mndDef.h
index 60b732f817..742db8f450 100644
--- a/source/dnode/mnode/impl/inc/mndDef.h
+++ b/source/dnode/mnode/impl/inc/mndDef.h
@@ -78,6 +78,9 @@ typedef enum {
MND_OPER_DROP_VIEW,
MND_OPER_CONFIG_CLUSTER,
MND_OPER_BALANCE_VGROUP_LEADER,
+ MND_OPER_CREATE_ANODE,
+ MND_OPER_UPDATE_ANODE,
+ MND_OPER_DROP_ANODE
} EOperType;
typedef enum {
@@ -232,6 +235,24 @@ typedef struct {
char machineId[TSDB_MACHINE_ID_LEN + 1];
} SDnodeObj;
+typedef struct {
+ int32_t nameLen;
+ char* name;
+} SAnodeAlgo;
+
+typedef struct {
+ int32_t id;
+ int64_t createdTime;
+ int64_t updateTime;
+ int32_t version;
+ int32_t urlLen;
+ int32_t numOfAlgos;
+ int32_t status;
+ SRWLatch lock;
+ char* url;
+ SArray** algos;
+} SAnodeObj;
+
typedef struct {
int32_t id;
int64_t createdTime;
diff --git a/source/dnode/mnode/impl/src/mndAnode.c b/source/dnode/mnode/impl/src/mndAnode.c
new file mode 100644
index 0000000000..17e3e84c81
--- /dev/null
+++ b/source/dnode/mnode/impl/src/mndAnode.c
@@ -0,0 +1,903 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#define _DEFAULT_SOURCE
+#include "mndAnode.h"
+#include "audit.h"
+#include "mndDnode.h"
+#include "mndPrivilege.h"
+#include "mndShow.h"
+#include "mndTrans.h"
+#include "mndUser.h"
+#include "tanal.h"
+#include "tjson.h"
+
+#ifdef USE_ANAL
+
+#define TSDB_ANODE_VER_NUMBER 1
+#define TSDB_ANODE_RESERVE_SIZE 64
+
+static SSdbRaw *mndAnodeActionEncode(SAnodeObj *pObj);
+static SSdbRow *mndAnodeActionDecode(SSdbRaw *pRaw);
+static int32_t mndAnodeActionInsert(SSdb *pSdb, SAnodeObj *pObj);
+static int32_t mndAnodeActionUpdate(SSdb *pSdb, SAnodeObj *pOld, SAnodeObj *pNew);
+static int32_t mndAnodeActionDelete(SSdb *pSdb, SAnodeObj *pObj);
+static int32_t mndProcessCreateAnodeReq(SRpcMsg *pReq);
+static int32_t mndProcessUpdateAnodeReq(SRpcMsg *pReq);
+static int32_t mndProcessDropAnodeReq(SRpcMsg *pReq);
+static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq);
+static int32_t mndRetrieveAnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
+static void mndCancelGetNextAnode(SMnode *pMnode, void *pIter);
+static int32_t mndRetrieveAnodesFull(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows);
+static void mndCancelGetNextAnodeFull(SMnode *pMnode, void *pIter);
+static int32_t mndGetAnodeAlgoList(const char *url, SAnodeObj *pObj);
+static int32_t mndGetAnodeStatus(SAnodeObj *pObj, char *status, int32_t statusLen);
+
+int32_t mndInitAnode(SMnode *pMnode) {
+ SSdbTable table = {
+ .sdbType = SDB_ANODE,
+ .keyType = SDB_KEY_INT32,
+ .encodeFp = (SdbEncodeFp)mndAnodeActionEncode,
+ .decodeFp = (SdbDecodeFp)mndAnodeActionDecode,
+ .insertFp = (SdbInsertFp)mndAnodeActionInsert,
+ .updateFp = (SdbUpdateFp)mndAnodeActionUpdate,
+ .deleteFp = (SdbDeleteFp)mndAnodeActionDelete,
+ };
+
+ mndSetMsgHandle(pMnode, TDMT_MND_CREATE_ANODE, mndProcessCreateAnodeReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_UPDATE_ANODE, mndProcessUpdateAnodeReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_DROP_ANODE, mndProcessDropAnodeReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_RETRIEVE_ANAL_ALGO, mndProcessAnalAlgoReq);
+
+ mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_ANODE, mndRetrieveAnodes);
+ mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_ANODE, mndCancelGetNextAnode);
+ mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_ANODE_FULL, mndRetrieveAnodesFull);
+ mndAddShowFreeIterHandle(pMnode, TSDB_MGMT_TABLE_ANODE_FULL, mndCancelGetNextAnodeFull);
+
+ return sdbSetTable(pMnode->pSdb, table);
+}
+
+void mndCleanupAnode(SMnode *pMnode) {}
+
+SAnodeObj *mndAcquireAnode(SMnode *pMnode, int32_t anodeId) {
+ SAnodeObj *pObj = sdbAcquire(pMnode->pSdb, SDB_ANODE, &anodeId);
+ if (pObj == NULL && terrno == TSDB_CODE_SDB_OBJ_NOT_THERE) {
+ terrno = TSDB_CODE_MND_ANODE_NOT_EXIST;
+ }
+ return pObj;
+}
+
+void mndReleaseAnode(SMnode *pMnode, SAnodeObj *pObj) {
+ SSdb *pSdb = pMnode->pSdb;
+ sdbRelease(pSdb, pObj);
+}
+
+static SSdbRaw *mndAnodeActionEncode(SAnodeObj *pObj) {
+ int32_t code = 0;
+ int32_t lino = 0;
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+
+ int32_t rawDataLen = sizeof(SAnodeObj) + TSDB_ANODE_RESERVE_SIZE + pObj->urlLen;
+ for (int32_t t = 0; t < pObj->numOfAlgos; ++t) {
+ SArray *algos = pObj->algos[t];
+ for (int32_t a = 0; a < (int32_t)taosArrayGetSize(algos); ++a) {
+ SAnodeAlgo *algo = taosArrayGet(algos, a);
+ rawDataLen += (2 * sizeof(int32_t) + algo->nameLen);
+ }
+ rawDataLen += sizeof(int32_t);
+ }
+
+ SSdbRaw *pRaw = sdbAllocRaw(SDB_ANODE, TSDB_ANODE_VER_NUMBER, rawDataLen);
+ if (pRaw == NULL) goto _OVER;
+
+ int32_t dataPos = 0;
+ SDB_SET_INT32(pRaw, dataPos, pObj->id, _OVER)
+ SDB_SET_INT64(pRaw, dataPos, pObj->createdTime, _OVER)
+ SDB_SET_INT64(pRaw, dataPos, pObj->updateTime, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, pObj->version, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, pObj->urlLen, _OVER)
+ SDB_SET_BINARY(pRaw, dataPos, pObj->url, pObj->urlLen, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, pObj->numOfAlgos, _OVER)
+ for (int32_t i = 0; i < pObj->numOfAlgos; ++i) {
+ SArray *algos = pObj->algos[i];
+ SDB_SET_INT32(pRaw, dataPos, (int32_t)taosArrayGetSize(algos), _OVER)
+ for (int32_t j = 0; j < (int32_t)taosArrayGetSize(algos); ++j) {
+ SAnodeAlgo *algo = taosArrayGet(algos, j);
+ SDB_SET_INT32(pRaw, dataPos, algo->nameLen, _OVER)
+ SDB_SET_BINARY(pRaw, dataPos, algo->name, algo->nameLen, _OVER)
+ SDB_SET_INT32(pRaw, dataPos, 0, _OVER) // reserved
+ }
+ }
+
+ SDB_SET_RESERVE(pRaw, dataPos, TSDB_ANODE_RESERVE_SIZE, _OVER)
+
+ terrno = 0;
+
+_OVER:
+ if (terrno != 0) {
+ mError("anode:%d, failed to encode to raw:%p since %s", pObj->id, pRaw, terrstr());
+ sdbFreeRaw(pRaw);
+ return NULL;
+ }
+
+ mTrace("anode:%d, encode to raw:%p, row:%p", pObj->id, pRaw, pObj);
+ return pRaw;
+}
+
+static SSdbRow *mndAnodeActionDecode(SSdbRaw *pRaw) {
+ int32_t code = 0;
+ int32_t lino = 0;
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ SSdbRow *pRow = NULL;
+ SAnodeObj *pObj = NULL;
+
+ int8_t sver = 0;
+ if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER;
+
+ if (sver != TSDB_ANODE_VER_NUMBER) {
+ terrno = TSDB_CODE_SDB_INVALID_DATA_VER;
+ goto _OVER;
+ }
+
+ pRow = sdbAllocRow(sizeof(SAnodeObj));
+ if (pRow == NULL) goto _OVER;
+
+ pObj = sdbGetRowObj(pRow);
+ if (pObj == NULL) goto _OVER;
+
+ int32_t dataPos = 0;
+ SDB_GET_INT32(pRaw, dataPos, &pObj->id, _OVER)
+ SDB_GET_INT64(pRaw, dataPos, &pObj->createdTime, _OVER)
+ SDB_GET_INT64(pRaw, dataPos, &pObj->updateTime, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &pObj->version, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &pObj->urlLen, _OVER)
+
+ if (pObj->urlLen > 0) {
+ pObj->url = taosMemoryCalloc(pObj->urlLen, 1);
+ if (pObj->url == NULL) goto _OVER;
+ SDB_GET_BINARY(pRaw, dataPos, pObj->url, pObj->urlLen, _OVER)
+ }
+
+ SDB_GET_INT32(pRaw, dataPos, &pObj->numOfAlgos, _OVER)
+ if (pObj->numOfAlgos > 0) {
+ pObj->algos = taosMemoryCalloc(pObj->numOfAlgos, sizeof(SArray *));
+ if (pObj->algos == NULL) {
+ goto _OVER;
+ }
+ }
+
+ for (int32_t i = 0; i < pObj->numOfAlgos; ++i) {
+ int32_t numOfAlgos = 0;
+ SDB_GET_INT32(pRaw, dataPos, &numOfAlgos, _OVER)
+
+ pObj->algos[i] = taosArrayInit(2, sizeof(SAnodeAlgo));
+ if (pObj->algos[i] == NULL) goto _OVER;
+
+ for (int32_t j = 0; j < numOfAlgos; ++j) {
+ SAnodeAlgo algoObj = {0};
+ int32_t reserved = 0;
+
+ SDB_GET_INT32(pRaw, dataPos, &algoObj.nameLen, _OVER)
+ if (algoObj.nameLen > 0) {
+ algoObj.name = taosMemoryCalloc(algoObj.nameLen, 1);
+ if (algoObj.name == NULL) goto _OVER;
+ }
+
+ SDB_GET_BINARY(pRaw, dataPos, algoObj.name, algoObj.nameLen, _OVER)
+ SDB_GET_INT32(pRaw, dataPos, &reserved, _OVER);
+
+ if (taosArrayPush(pObj->algos[i], &algoObj) == NULL) goto _OVER;
+ }
+ }
+
+ SDB_GET_RESERVE(pRaw, dataPos, TSDB_ANODE_RESERVE_SIZE, _OVER)
+
+ terrno = 0;
+
+_OVER:
+ if (terrno != 0) {
+ mError("anode:%d, failed to decode from raw:%p since %s", pObj == NULL ? 0 : pObj->id, pRaw, terrstr());
+ if (pObj != NULL) {
+ taosMemoryFreeClear(pObj->url);
+ }
+ taosMemoryFreeClear(pRow);
+ return NULL;
+ }
+
+ mTrace("anode:%d, decode from raw:%p, row:%p", pObj->id, pRaw, pObj);
+ return pRow;
+}
+
+static void mndFreeAnode(SAnodeObj *pObj) {
+ taosMemoryFreeClear(pObj->url);
+ for (int32_t i = 0; i < pObj->numOfAlgos; ++i) {
+ SArray *algos = pObj->algos[i];
+ for (int32_t j = 0; j < (int32_t)taosArrayGetSize(algos); ++j) {
+ SAnodeAlgo *algo = taosArrayGet(algos, j);
+ taosMemoryFreeClear(algo->name);
+ }
+ taosArrayDestroy(algos);
+ }
+ taosMemoryFreeClear(pObj->algos);
+}
+
+static int32_t mndAnodeActionInsert(SSdb *pSdb, SAnodeObj *pObj) {
+ mTrace("anode:%d, perform insert action, row:%p", pObj->id, pObj);
+ return 0;
+}
+
+static int32_t mndAnodeActionDelete(SSdb *pSdb, SAnodeObj *pObj) {
+ mTrace("anode:%d, perform delete action, row:%p", pObj->id, pObj);
+ mndFreeAnode(pObj);
+ return 0;
+}
+
+static int32_t mndAnodeActionUpdate(SSdb *pSdb, SAnodeObj *pOld, SAnodeObj *pNew) {
+ mTrace("anode:%d, perform update action, old row:%p new row:%p", pOld->id, pOld, pNew);
+
+ taosWLockLatch(&pOld->lock);
+ int32_t numOfAlgos = pNew->numOfAlgos;
+ void *algos = pNew->algos;
+ pNew->numOfAlgos = pOld->numOfAlgos;
+ pNew->algos = pOld->algos;
+ pOld->numOfAlgos = numOfAlgos;
+ pOld->algos = algos;
+ pOld->updateTime = pNew->updateTime;
+ pOld->version = pNew->version;
+ taosWUnLockLatch(&pOld->lock);
+ return 0;
+}
+
+static int32_t mndSetCreateAnodeRedoLogs(STrans *pTrans, SAnodeObj *pObj) {
+ int32_t code = 0;
+ SSdbRaw *pRedoRaw = mndAnodeActionEncode(pObj);
+ if (pRedoRaw == NULL) {
+ code = TSDB_CODE_MND_RETURN_VALUE_NULL;
+ if (terrno != 0) code = terrno;
+ TAOS_RETURN(code);
+ }
+ TAOS_CHECK_RETURN(mndTransAppendRedolog(pTrans, pRedoRaw));
+ TAOS_CHECK_RETURN(sdbSetRawStatus(pRedoRaw, SDB_STATUS_CREATING));
+ TAOS_RETURN(code);
+}
+
+static int32_t mndSetCreateAnodeUndoLogs(STrans *pTrans, SAnodeObj *pObj) {
+ int32_t code = 0;
+ SSdbRaw *pUndoRaw = mndAnodeActionEncode(pObj);
+ if (pUndoRaw == NULL) {
+ code = TSDB_CODE_MND_RETURN_VALUE_NULL;
+ if (terrno != 0) code = terrno;
+ TAOS_RETURN(code);
+ }
+ TAOS_CHECK_RETURN(mndTransAppendUndolog(pTrans, pUndoRaw));
+ TAOS_CHECK_RETURN(sdbSetRawStatus(pUndoRaw, SDB_STATUS_DROPPED));
+ TAOS_RETURN(code);
+}
+
+static int32_t mndSetCreateAnodeCommitLogs(STrans *pTrans, SAnodeObj *pObj) {
+ int32_t code = 0;
+ SSdbRaw *pCommitRaw = mndAnodeActionEncode(pObj);
+ if (pCommitRaw == NULL) {
+ code = TSDB_CODE_MND_RETURN_VALUE_NULL;
+ if (terrno != 0) code = terrno;
+ TAOS_RETURN(code);
+ }
+ TAOS_CHECK_RETURN(mndTransAppendCommitlog(pTrans, pCommitRaw));
+ TAOS_CHECK_RETURN(sdbSetRawStatus(pCommitRaw, SDB_STATUS_READY));
+ TAOS_RETURN(code);
+}
+
+static int32_t mndCreateAnode(SMnode *pMnode, SRpcMsg *pReq, SMCreateAnodeReq *pCreate) {
+ int32_t code = -1;
+ STrans *pTrans = NULL;
+
+ SAnodeObj anodeObj = {0};
+ anodeObj.id = sdbGetMaxId(pMnode->pSdb, SDB_ANODE);
+ anodeObj.createdTime = taosGetTimestampMs();
+ anodeObj.updateTime = anodeObj.createdTime;
+ anodeObj.version = 0;
+ anodeObj.urlLen = pCreate->urlLen;
+ if (anodeObj.urlLen > TSDB_ANAL_ANODE_URL_LEN) {
+ code = TSDB_CODE_MND_ANODE_TOO_LONG_URL;
+ goto _OVER;
+ }
+
+ anodeObj.url = taosMemoryCalloc(1, pCreate->urlLen);
+ if (anodeObj.url == NULL) goto _OVER;
+ (void)memcpy(anodeObj.url, pCreate->url, pCreate->urlLen);
+
+ code = mndGetAnodeAlgoList(anodeObj.url, &anodeObj);
+ if (code != 0) goto _OVER;
+
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "create-anode");
+ if (pTrans == NULL) {
+ code = TSDB_CODE_MND_RETURN_VALUE_NULL;
+ if (terrno != 0) code = terrno;
+ goto _OVER;
+ }
+ mndTransSetSerial(pTrans);
+
+ mInfo("trans:%d, used to create anode:%s as anode:%d", pTrans->id, pCreate->url, anodeObj.id);
+
+ TAOS_CHECK_GOTO(mndSetCreateAnodeRedoLogs(pTrans, &anodeObj), NULL, _OVER);
+ TAOS_CHECK_GOTO(mndSetCreateAnodeUndoLogs(pTrans, &anodeObj), NULL, _OVER);
+ TAOS_CHECK_GOTO(mndSetCreateAnodeCommitLogs(pTrans, &anodeObj), NULL, _OVER);
+ TAOS_CHECK_GOTO(mndTransPrepare(pMnode, pTrans), NULL, _OVER);
+
+ code = 0;
+
+_OVER:
+ mndFreeAnode(&anodeObj);
+ mndTransDrop(pTrans);
+ TAOS_RETURN(code);
+}
+
+static SAnodeObj *mndAcquireAnodeByURL(SMnode *pMnode, char *url) {
+ SSdb *pSdb = pMnode->pSdb;
+
+ void *pIter = NULL;
+ while (1) {
+ SAnodeObj *pAnode = NULL;
+ pIter = sdbFetch(pSdb, SDB_ANODE, pIter, (void **)&pAnode);
+ if (pIter == NULL) break;
+
+ if (strcasecmp(url, pAnode->url) == 0) {
+ sdbCancelFetch(pSdb, pIter);
+ return pAnode;
+ }
+
+ sdbRelease(pSdb, pAnode);
+ }
+
+ terrno = TSDB_CODE_MND_ANODE_NOT_EXIST;
+ return NULL;
+}
+
+static int32_t mndProcessCreateAnodeReq(SRpcMsg *pReq) {
+ SMnode *pMnode = pReq->info.node;
+ int32_t code = -1;
+ SAnodeObj *pObj = NULL;
+ SMCreateAnodeReq createReq = {0};
+
+ TAOS_CHECK_GOTO(tDeserializeSMCreateAnodeReq(pReq->pCont, pReq->contLen, &createReq), NULL, _OVER);
+
+ mInfo("anode:%s, start to create", createReq.url);
+ TAOS_CHECK_GOTO(mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_CREATE_ANODE), NULL, _OVER);
+
+ pObj = mndAcquireAnodeByURL(pMnode, createReq.url);
+ if (pObj != NULL) {
+ code = TSDB_CODE_MND_ANODE_ALREADY_EXIST;
+ goto _OVER;
+ }
+
+ code = mndCreateAnode(pMnode, pReq, &createReq);
+ if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
+
+_OVER:
+ if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
+ mError("anode:%s, failed to create since %s", createReq.url, tstrerror(code));
+ }
+
+ mndReleaseAnode(pMnode, pObj);
+ tFreeSMCreateAnodeReq(&createReq);
+ TAOS_RETURN(code);
+}
+
+static int32_t mndUpdateAnode(SMnode *pMnode, SAnodeObj *pAnode, SRpcMsg *pReq) {
+ mInfo("anode:%d, start to update", pAnode->id);
+ int32_t code = -1;
+ STrans *pTrans = NULL;
+ SAnodeObj anodeObj = {0};
+ anodeObj.id = pAnode->id;
+ anodeObj.updateTime = taosGetTimestampMs();
+
+ code = mndGetAnodeAlgoList(pAnode->url, &anodeObj);
+ if (code != 0) goto _OVER;
+
+ pTrans = mndTransCreate(pMnode, TRN_POLICY_ROLLBACK, TRN_CONFLICT_NOTHING, pReq, "update-anode");
+ if (pTrans == NULL) {
+ code = TSDB_CODE_MND_RETURN_VALUE_NULL;
+ if (terrno != 0) code = terrno;
+ goto _OVER;
+ }
+ mInfo("trans:%d, used to update anode:%d", pTrans->id, anodeObj.id);
+
+ TAOS_CHECK_GOTO(mndSetCreateAnodeCommitLogs(pTrans, &anodeObj), NULL, _OVER);
+ TAOS_CHECK_GOTO(mndTransPrepare(pMnode, pTrans), NULL, _OVER);
+ code = 0;
+
+_OVER:
+ mndFreeAnode(&anodeObj);
+ mndTransDrop(pTrans);
+ TAOS_RETURN(code);
+}
+
+static int32_t mndUpdateAllAnodes(SMnode *pMnode, SRpcMsg *pReq) {
+ mInfo("update all anodes");
+ SSdb *pSdb = pMnode->pSdb;
+ int32_t code = 0;
+ int32_t rows = 0;
+ int32_t numOfRows = sdbGetSize(pSdb, SDB_ANODE);
+
+ void *pIter = NULL;
+ while (1) {
+ SAnodeObj *pObj = NULL;
+ ESdbStatus objStatus = 0;
+ pIter = sdbFetchAll(pSdb, SDB_ANODE, pIter, (void **)&pObj, &objStatus, true);
+ if (pIter == NULL) break;
+
+ rows++;
+ void *transReq = NULL;
+ if (rows == numOfRows) transReq = pReq;
+ code = mndUpdateAnode(pMnode, pObj, transReq);
+ sdbRelease(pSdb, pObj);
+
+ if (code != 0) break;
+ }
+
+ if (code == 0 && rows == numOfRows) {
+ code = TSDB_CODE_ACTION_IN_PROGRESS;
+ }
+
+ return code;
+}
+
+static int32_t mndProcessUpdateAnodeReq(SRpcMsg *pReq) {
+ SMnode *pMnode = pReq->info.node;
+ int32_t code = -1;
+ SAnodeObj *pObj = NULL;
+ SMUpdateAnodeReq updateReq = {0};
+
+ TAOS_CHECK_GOTO(tDeserializeSMUpdateAnodeReq(pReq->pCont, pReq->contLen, &updateReq), NULL, _OVER);
+ TAOS_CHECK_GOTO(mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_UPDATE_ANODE), NULL, _OVER);
+
+ if (updateReq.anodeId == -1) {
+ code = mndUpdateAllAnodes(pMnode, pReq);
+ } else {
+ pObj = mndAcquireAnode(pMnode, updateReq.anodeId);
+ if (pObj == NULL) {
+ code = TSDB_CODE_MND_ANODE_NOT_EXIST;
+ goto _OVER;
+ }
+ code = mndUpdateAnode(pMnode, pObj, pReq);
+ if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
+ }
+
+_OVER:
+ if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
+ if (updateReq.anodeId != -1) {
+ mError("anode:%d, failed to update since %s", updateReq.anodeId, tstrerror(code));
+ }
+ }
+
+ mndReleaseAnode(pMnode, pObj);
+ tFreeSMUpdateAnodeReq(&updateReq);
+ TAOS_RETURN(code);
+}
+
+static int32_t mndSetDropAnodeRedoLogs(STrans *pTrans, SAnodeObj *pObj) {
+ int32_t code = 0;
+ SSdbRaw *pRedoRaw = mndAnodeActionEncode(pObj);
+ if (pRedoRaw == NULL) {
+ code = TSDB_CODE_MND_RETURN_VALUE_NULL;
+ if (terrno != 0) code = terrno;
+ TAOS_RETURN(code);
+ }
+ TAOS_CHECK_RETURN(mndTransAppendRedolog(pTrans, pRedoRaw));
+ TAOS_CHECK_RETURN(sdbSetRawStatus(pRedoRaw, SDB_STATUS_DROPPING));
+ TAOS_RETURN(code);
+}
+
+static int32_t mndSetDropAnodeCommitLogs(STrans *pTrans, SAnodeObj *pObj) {
+ int32_t code = 0;
+ SSdbRaw *pCommitRaw = mndAnodeActionEncode(pObj);
+ if (pCommitRaw == NULL) {
+ code = TSDB_CODE_MND_RETURN_VALUE_NULL;
+ if (terrno != 0) code = terrno;
+ TAOS_RETURN(code);
+ }
+ TAOS_CHECK_RETURN(mndTransAppendCommitlog(pTrans, pCommitRaw));
+ TAOS_CHECK_RETURN(sdbSetRawStatus(pCommitRaw, SDB_STATUS_DROPPED));
+ TAOS_RETURN(code);
+}
+
+static int32_t mndSetDropAnodeInfoToTrans(SMnode *pMnode, STrans *pTrans, SAnodeObj *pObj, bool force) {
+ if (pObj == NULL) return 0;
+ TAOS_CHECK_RETURN(mndSetDropAnodeRedoLogs(pTrans, pObj));
+ TAOS_CHECK_RETURN(mndSetDropAnodeCommitLogs(pTrans, pObj));
+ return 0;
+}
+
+static int32_t mndDropAnode(SMnode *pMnode, SRpcMsg *pReq, SAnodeObj *pObj) {
+ int32_t code = -1;
+
+ STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_CONFLICT_NOTHING, pReq, "drop-anode");
+ if (pTrans == NULL) {
+ code = TSDB_CODE_MND_RETURN_VALUE_NULL;
+ if (terrno != 0) code = terrno;
+ goto _OVER;
+ }
+ mndTransSetSerial(pTrans);
+
+ mInfo("trans:%d, used to drop anode:%d", pTrans->id, pObj->id);
+ TAOS_CHECK_GOTO(mndSetDropAnodeInfoToTrans(pMnode, pTrans, pObj, false), NULL, _OVER);
+ TAOS_CHECK_GOTO(mndTransPrepare(pMnode, pTrans), NULL, _OVER);
+
+ code = 0;
+
+_OVER:
+ mndTransDrop(pTrans);
+ TAOS_RETURN(code);
+}
+
+static int32_t mndProcessDropAnodeReq(SRpcMsg *pReq) {
+ SMnode *pMnode = pReq->info.node;
+ int32_t code = -1;
+ SAnodeObj *pObj = NULL;
+ SMDropAnodeReq dropReq = {0};
+
+ TAOS_CHECK_GOTO(tDeserializeSMDropAnodeReq(pReq->pCont, pReq->contLen, &dropReq), NULL, _OVER);
+
+ mInfo("anode:%d, start to drop", dropReq.anodeId);
+ TAOS_CHECK_GOTO(mndCheckOperPrivilege(pMnode, pReq->info.conn.user, MND_OPER_DROP_ANODE), NULL, _OVER);
+
+ if (dropReq.anodeId <= 0) {
+ code = TSDB_CODE_INVALID_MSG;
+ goto _OVER;
+ }
+
+ pObj = mndAcquireAnode(pMnode, dropReq.anodeId);
+ if (pObj == NULL) {
+ code = TSDB_CODE_MND_RETURN_VALUE_NULL;
+ if (terrno != 0) code = terrno;
+ goto _OVER;
+ }
+
+ code = mndDropAnode(pMnode, pReq, pObj);
+ if (code == 0) code = TSDB_CODE_ACTION_IN_PROGRESS;
+
+_OVER:
+ if (code != 0 && code != TSDB_CODE_ACTION_IN_PROGRESS) {
+ mError("anode:%d, failed to drop since %s", dropReq.anodeId, tstrerror(code));
+ }
+
+ mndReleaseAnode(pMnode, pObj);
+ tFreeSMDropAnodeReq(&dropReq);
+ TAOS_RETURN(code);
+}
+
+static int32_t mndRetrieveAnodes(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
+ SMnode *pMnode = pReq->info.node;
+ SSdb *pSdb = pMnode->pSdb;
+ int32_t numOfRows = 0;
+ int32_t cols = 0;
+ SAnodeObj *pObj = NULL;
+ char buf[TSDB_ANAL_ANODE_URL_LEN + VARSTR_HEADER_SIZE];
+ char status[64];
+ int32_t code = 0;
+
+ while (numOfRows < rows) {
+ pShow->pIter = sdbFetch(pSdb, SDB_ANODE, pShow->pIter, (void **)&pObj);
+ if (pShow->pIter == NULL) break;
+
+ cols = 0;
+ SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->id, false);
+ if (code != 0) goto _end;
+
+ STR_WITH_MAXSIZE_TO_VARSTR(buf, pObj->url, pShow->pMeta->pSchemas[cols].bytes);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ code = colDataSetVal(pColInfo, numOfRows, (const char *)buf, false);
+ if (code != 0) goto _end;
+
+ status[0] = 0;
+ if (mndGetAnodeStatus(pObj, status, 64) == 0) {
+ STR_TO_VARSTR(buf, status);
+ } else {
+ STR_TO_VARSTR(buf, "offline");
+ }
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ code = colDataSetVal(pColInfo, numOfRows, buf, false);
+ if (code != 0) goto _end;
+
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->createdTime, false);
+ if (code != 0) goto _end;
+
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->updateTime, false);
+ if (code != 0) goto _end;
+
+ numOfRows++;
+ sdbRelease(pSdb, pObj);
+ }
+
+_end:
+ if (code != 0) sdbRelease(pSdb, pObj);
+
+ pShow->numOfRows += numOfRows;
+ return numOfRows;
+}
+
+static void mndCancelGetNextAnode(SMnode *pMnode, void *pIter) {
+ SSdb *pSdb = pMnode->pSdb;
+ sdbCancelFetchByType(pSdb, pIter, SDB_ANODE);
+}
+
+static int32_t mndRetrieveAnodesFull(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
+ SMnode *pMnode = pReq->info.node;
+ SSdb *pSdb = pMnode->pSdb;
+ int32_t numOfRows = 0;
+ int32_t cols = 0;
+ SAnodeObj *pObj = NULL;
+ char buf[TSDB_ANAL_ALGO_NAME_LEN + VARSTR_HEADER_SIZE];
+ int32_t code = 0;
+
+ while (numOfRows < rows) {
+ pShow->pIter = sdbFetch(pSdb, SDB_ANODE, pShow->pIter, (void **)&pObj);
+ if (pShow->pIter == NULL) break;
+
+ for (int32_t t = 0; t < pObj->numOfAlgos; ++t) {
+ SArray *algos = pObj->algos[t];
+
+ for (int32_t a = 0; a < taosArrayGetSize(algos); ++a) {
+ SAnodeAlgo *algo = taosArrayGet(algos, a);
+
+ cols = 0;
+ SColumnInfoData *pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ code = colDataSetVal(pColInfo, numOfRows, (const char *)&pObj->id, false);
+ if (code != 0) goto _end;
+
+ STR_TO_VARSTR(buf, taosAnalAlgoStr(t));
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ code = colDataSetVal(pColInfo, numOfRows, buf, false);
+ if (code != 0) goto _end;
+
+ STR_TO_VARSTR(buf, algo->name);
+ pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
+ code = colDataSetVal(pColInfo, numOfRows, buf, false);
+ if (code != 0) goto _end;
+
+ numOfRows++;
+ }
+ }
+
+ sdbRelease(pSdb, pObj);
+ }
+
+_end:
+ if (code != 0) sdbRelease(pSdb, pObj);
+
+ pShow->numOfRows += numOfRows;
+ return numOfRows;
+}
+
+static void mndCancelGetNextAnodeFull(SMnode *pMnode, void *pIter) {
+ SSdb *pSdb = pMnode->pSdb;
+ sdbCancelFetchByType(pSdb, pIter, SDB_ANODE);
+}
+
+static int32_t mndDecodeAlgoList(SJson *pJson, SAnodeObj *pObj) {
+ int32_t code = 0;
+ int32_t protocol = 0;
+ double tmp = 0;
+ char buf[TSDB_ANAL_ALGO_NAME_LEN + 1] = {0};
+
+ code = tjsonGetDoubleValue(pJson, "protocol", &tmp);
+ if (code < 0) return TSDB_CODE_INVALID_JSON_FORMAT;
+ protocol = (int32_t)(tmp * 1000);
+ if (protocol != 100 && protocol != 1000) return TSDB_CODE_MND_ANODE_INVALID_PROTOCOL;
+
+ code = tjsonGetDoubleValue(pJson, "version", &tmp);
+ pObj->version = (int32_t)(tmp * 1000);
+#if 0
+ if (code < 0) return TSDB_CODE_INVALID_JSON_FORMAT;
+ if (pObj->version <= 0) return TSDB_CODE_MND_ANODE_INVALID_VERSION;
+#endif
+
+ SJson *details = tjsonGetObjectItem(pJson, "details");
+ if (details == NULL) return TSDB_CODE_INVALID_JSON_FORMAT;
+ int32_t numOfDetails = tjsonGetArraySize(details);
+
+ pObj->algos = taosMemoryCalloc(ANAL_ALGO_TYPE_END, sizeof(SArray *));
+ if (pObj->algos == NULL) return TSDB_CODE_OUT_OF_MEMORY;
+
+ pObj->numOfAlgos = ANAL_ALGO_TYPE_END;
+ for (int32_t i = 0; i < ANAL_ALGO_TYPE_END; ++i) {
+ pObj->algos[i] = taosArrayInit(4, sizeof(SAnodeAlgo));
+ if (pObj->algos[i] == NULL) return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ for (int32_t d = 0; d < numOfDetails; ++d) {
+ SJson *detail = tjsonGetArrayItem(details, d);
+ if (detail == NULL) return TSDB_CODE_INVALID_JSON_FORMAT;
+
+ code = tjsonGetStringValue2(detail, "type", buf, sizeof(buf));
+ if (code < 0) return TSDB_CODE_INVALID_JSON_FORMAT;
+ EAnalAlgoType type = taosAnalAlgoInt(buf);
+ if (type < 0 || type >= ANAL_ALGO_TYPE_END) return TSDB_CODE_MND_ANODE_INVALID_ALGO_TYPE;
+
+ SJson *algos = tjsonGetObjectItem(detail, "algo");
+ if (algos == NULL) return TSDB_CODE_INVALID_JSON_FORMAT;
+ int32_t numOfAlgos = tjsonGetArraySize(algos);
+ for (int32_t a = 0; a < numOfAlgos; ++a) {
+ SJson *algo = tjsonGetArrayItem(algos, a);
+ if (algo == NULL) return TSDB_CODE_INVALID_JSON_FORMAT;
+
+ code = tjsonGetStringValue2(algo, "name", buf, sizeof(buf));
+ if (code < 0) return TSDB_CODE_MND_ANODE_TOO_LONG_ALGO_NAME;
+
+ SAnodeAlgo algoObj = {0};
+ algoObj.nameLen = strlen(buf) + 1;
+ if (algoObj.nameLen <= 1) return TSDB_CODE_INVALID_JSON_FORMAT;
+ algoObj.name = taosMemoryCalloc(algoObj.nameLen, 1);
+ tstrncpy(algoObj.name, buf, algoObj.nameLen);
+
+ if (taosArrayPush(pObj->algos[type], &algoObj) == NULL) return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+
+ return 0;
+}
+
+static int32_t mndGetAnodeAlgoList(const char *url, SAnodeObj *pObj) {
+ char anodeUrl[TSDB_ANAL_ANODE_URL_LEN + 1] = {0};
+ snprintf(anodeUrl, TSDB_ANAL_ANODE_URL_LEN, "%s/%s", url, "list");
+
+ SJson *pJson = taosAnalSendReqRetJson(anodeUrl, ANAL_HTTP_TYPE_GET, NULL);
+ if (pJson == NULL) return terrno;
+
+ int32_t code = mndDecodeAlgoList(pJson, pObj);
+ if (pJson != NULL) tjsonDelete(pJson);
+
+ TAOS_RETURN(code);
+}
+
+static int32_t mndGetAnodeStatus(SAnodeObj *pObj, char *status, int32_t statusLen) {
+ int32_t code = 0;
+ int32_t protocol = 0;
+ double tmp = 0;
+ char anodeUrl[TSDB_ANAL_ANODE_URL_LEN + 1] = {0};
+ snprintf(anodeUrl, TSDB_ANAL_ANODE_URL_LEN, "%s/%s", pObj->url, "status");
+
+ SJson *pJson = taosAnalSendReqRetJson(anodeUrl, ANAL_HTTP_TYPE_GET, NULL);
+ if (pJson == NULL) return terrno;
+
+ code = tjsonGetDoubleValue(pJson, "protocol", &tmp);
+ if (code < 0) {
+ code = TSDB_CODE_INVALID_JSON_FORMAT;
+ goto _OVER;
+ }
+ protocol = (int32_t)(tmp * 1000);
+ if (protocol != 100 && protocol != 1000) {
+ code = TSDB_CODE_MND_ANODE_INVALID_PROTOCOL;
+ goto _OVER;
+ }
+
+ code = tjsonGetStringValue2(pJson, "status", status, statusLen);
+ if (code < 0) {
+ code = TSDB_CODE_INVALID_JSON_FORMAT;
+ goto _OVER;
+ }
+ if (strlen(status) == 0) {
+ code = TSDB_CODE_MND_ANODE_INVALID_PROTOCOL;
+ goto _OVER;
+ }
+
+_OVER:
+ if (pJson != NULL) tjsonDelete(pJson);
+ TAOS_RETURN(code);
+}
+
+static int32_t mndProcessAnalAlgoReq(SRpcMsg *pReq) {
+ SMnode *pMnode = pReq->info.node;
+ SSdb *pSdb = pMnode->pSdb;
+ int32_t code = -1;
+ SAnodeObj *pObj = NULL;
+ SAnalUrl url;
+ int32_t nameLen;
+ char name[TSDB_ANAL_ALGO_KEY_LEN];
+ SRetrieveAnalAlgoReq req = {0};
+ SRetrieveAnalAlgoRsp rsp = {0};
+
+ TAOS_CHECK_GOTO(tDeserializeRetrieveAnalAlgoReq(pReq->pCont, pReq->contLen, &req), NULL, _OVER);
+
+ rsp.ver = sdbGetTableVer(pSdb, SDB_ANODE);
+ if (req.analVer != rsp.ver) {
+ mInfo("dnode:%d, update analysis old ver:%" PRId64 " to new ver:%" PRId64, req.dnodeId, req.analVer, rsp.ver);
+ rsp.hash = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK);
+ if (rsp.hash == NULL) {
+ terrno = TSDB_CODE_OUT_OF_MEMORY;
+ goto _OVER;
+ }
+
+ void *pIter = NULL;
+ while (1) {
+ SAnodeObj *pAnode = NULL;
+ pIter = sdbFetch(pSdb, SDB_ANODE, pIter, (void **)&pAnode);
+ if (pIter == NULL) break;
+
+ url.anode = pAnode->id;
+ for (int32_t t = 0; t < pAnode->numOfAlgos; ++t) {
+ SArray *algos = pAnode->algos[t];
+ url.type = t;
+
+ for (int32_t a = 0; a < taosArrayGetSize(algos); ++a) {
+ SAnodeAlgo *algo = taosArrayGet(algos, a);
+ nameLen = 1 + tsnprintf(name, sizeof(name) - 1, "%d:%s", url.type, algo->name);
+
+ SAnalUrl *pOldUrl = taosHashAcquire(rsp.hash, name, nameLen);
+ if (pOldUrl == NULL || (pOldUrl != NULL && pOldUrl->anode < url.anode)) {
+ if (pOldUrl != NULL) {
+ taosMemoryFreeClear(pOldUrl->url);
+ if (taosHashRemove(rsp.hash, name, nameLen) != 0) {
+ sdbRelease(pSdb, pAnode);
+ goto _OVER;
+ }
+ }
+ url.url = taosMemoryMalloc(TSDB_ANAL_ANODE_URL_LEN + TSDB_ANAL_ALGO_TYPE_LEN + 1);
+ if (url.url == NULL) {
+ sdbRelease(pSdb, pAnode);
+ goto _OVER;
+ }
+
+ url.urlLen = 1 + tsnprintf(url.url, TSDB_ANAL_ANODE_URL_LEN + TSDB_ANAL_ALGO_TYPE_LEN, "%s/%s", pAnode->url,
+ taosAnalAlgoUrlStr(url.type));
+ if (taosHashPut(rsp.hash, name, nameLen, &url, sizeof(SAnalUrl)) != 0) {
+ taosMemoryFree(url.url);
+ sdbRelease(pSdb, pAnode);
+ goto _OVER;
+ }
+ }
+ }
+
+ sdbRelease(pSdb, pAnode);
+ }
+ }
+ }
+
+ int32_t contLen = tSerializeRetrieveAnalAlgoRsp(NULL, 0, &rsp);
+ void *pHead = rpcMallocCont(contLen);
+ (void)tSerializeRetrieveAnalAlgoRsp(pHead, contLen, &rsp);
+
+ pReq->info.rspLen = contLen;
+ pReq->info.rsp = pHead;
+
+_OVER:
+ tFreeRetrieveAnalAlgoRsp(&rsp);
+ TAOS_RETURN(code);
+}
+
+#else
+
+static int32_t mndProcessUnsupportReq(SRpcMsg *pReq) { return TSDB_CODE_OPS_NOT_SUPPORT; }
+static int32_t mndRetrieveUnsupport(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlock, int32_t rows) {
+ return TSDB_CODE_OPS_NOT_SUPPORT;
+}
+
+int32_t mndInitAnode(SMnode *pMnode) {
+ mndSetMsgHandle(pMnode, TDMT_MND_CREATE_ANODE, mndProcessUnsupportReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_UPDATE_ANODE, mndProcessUnsupportReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_DROP_ANODE, mndProcessUnsupportReq);
+ mndSetMsgHandle(pMnode, TDMT_MND_RETRIEVE_ANAL_ALGO, mndProcessUnsupportReq);
+
+ mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_ANODE, mndRetrieveUnsupport);
+ mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_ANODE_FULL, mndRetrieveUnsupport);
+ return 0;
+}
+
+void mndCleanupAnode(SMnode *pMnode) {}
+
+#endif
\ No newline at end of file
diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c
index 04041646eb..5e10583a0a 100644
--- a/source/dnode/mnode/impl/src/mndDnode.c
+++ b/source/dnode/mnode/impl/src/mndDnode.c
@@ -730,6 +730,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
pMnode->ipWhiteVer = mndGetIpWhiteVer(pMnode);
+ int64_t analVer = sdbGetTableVer(pMnode->pSdb, SDB_ANODE);
int64_t dnodeVer = sdbGetTableVer(pMnode->pSdb, SDB_DNODE) + sdbGetTableVer(pMnode->pSdb, SDB_MNODE);
int64_t curMs = taosGetTimestampMs();
bool online = mndIsDnodeOnline(pDnode, curMs);
@@ -738,7 +739,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
bool supportVnodesChanged = pDnode->numOfSupportVnodes != statusReq.numOfSupportVnodes;
bool encryptKeyChanged = pDnode->encryptionKeyChksum != statusReq.clusterCfg.encryptionKeyChksum;
bool enableWhiteListChanged = statusReq.clusterCfg.enableWhiteList != (tsEnableWhiteList ? 1 : 0);
- bool needCheck = !online || dnodeChanged || reboot || supportVnodesChanged ||
+ bool analVerChanged = (analVer != statusReq.analVer);
+ bool needCheck = !online || dnodeChanged || reboot || supportVnodesChanged || analVerChanged ||
pMnode->ipWhiteVer != statusReq.ipWhiteVer || encryptKeyChanged || enableWhiteListChanged;
const STraceId *trace = &pReq->info.traceId;
mGTrace("dnode:%d, status received, accessTimes:%d check:%d online:%d reboot:%d changed:%d statusSeq:%d", pDnode->id,
@@ -862,6 +864,7 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
SStatusRsp statusRsp = {0};
statusRsp.statusSeq++;
+ statusRsp.analVer = analVer;
statusRsp.dnodeVer = dnodeVer;
statusRsp.dnodeCfg.dnodeId = pDnode->id;
statusRsp.dnodeCfg.clusterId = pMnode->clusterId;
diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c
index 685ad2b7a5..08ebf52ec6 100644
--- a/source/dnode/mnode/impl/src/mndMain.c
+++ b/source/dnode/mnode/impl/src/mndMain.c
@@ -16,6 +16,7 @@
#define _DEFAULT_SOURCE
#include "mndAcct.h"
#include "mndArbGroup.h"
+#include "mndAnode.h"
#include "mndCluster.h"
#include "mndCompact.h"
#include "mndCompactDetail.h"
@@ -236,7 +237,7 @@ static void mndPullupGrant(SMnode *pMnode) {
.pCont = pReq,
.contLen = contLen,
.info.notFreeAhandle = 1,
- .info.ahandle = (void *)0x9527};
+ .info.ahandle = 0};
// TODO check return value
if (tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg) < 0) {
mError("failed to put into write-queue since %s, line:%d", terrstr(), __LINE__);
@@ -608,6 +609,7 @@ static int32_t mndInitSteps(SMnode *pMnode) {
TAOS_CHECK_RETURN(mndAllocStep(pMnode, "mnode-mnode", mndInitMnode, mndCleanupMnode));
TAOS_CHECK_RETURN(mndAllocStep(pMnode, "mnode-qnode", mndInitQnode, mndCleanupQnode));
TAOS_CHECK_RETURN(mndAllocStep(pMnode, "mnode-snode", mndInitSnode, mndCleanupSnode));
+ TAOS_CHECK_RETURN(mndAllocStep(pMnode, "mnode-anode", mndInitAnode, mndCleanupAnode));
TAOS_CHECK_RETURN(mndAllocStep(pMnode, "mnode-arbgroup", mndInitArbGroup, mndCleanupArbGroup));
TAOS_CHECK_RETURN(mndAllocStep(pMnode, "mnode-dnode", mndInitDnode, mndCleanupDnode));
TAOS_CHECK_RETURN(mndAllocStep(pMnode, "mnode-user", mndInitUser, mndCleanupUser));
diff --git a/source/dnode/mnode/impl/src/mndQuery.c b/source/dnode/mnode/impl/src/mndQuery.c
index 4816df6323..b19d0b8ad0 100644
--- a/source/dnode/mnode/impl/src/mndQuery.c
+++ b/source/dnode/mnode/impl/src/mndQuery.c
@@ -30,9 +30,9 @@ void mndPostProcessQueryMsg(SRpcMsg *pMsg) {
(void)qWorkerAbortPreprocessQueryMsg(pMnode->pQuery, pMsg);
}
-int32_t mndProcessQueryMsg(SRpcMsg *pMsg, SQueueInfo* pInfo) {
- int32_t code = -1;
- SMnode *pMnode = pMsg->info.node;
+int32_t mndProcessQueryMsg(SRpcMsg *pMsg, SQueueInfo *pInfo) {
+ int32_t code = -1;
+ SMnode *pMnode = pMsg->info.node;
SReadHandle handle = {.mnd = pMnode, .pMsgCb = &pMnode->msgCb, .pWorkerCb = pInfo->workerCb};
@@ -67,26 +67,25 @@ int32_t mndProcessQueryMsg(SRpcMsg *pMsg, SQueueInfo* pInfo) {
return code;
}
-
-static FORCE_INLINE void mnodeFreeSBatchRspMsg(void* p) {
+static FORCE_INLINE void mnodeFreeSBatchRspMsg(void *p) {
if (NULL == p) {
return;
}
- SBatchRspMsg* pRsp = (SBatchRspMsg*)p;
+ SBatchRspMsg *pRsp = (SBatchRspMsg *)p;
rpcFreeCont(pRsp->msg);
}
int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
- int32_t code = 0;
- int32_t rspSize = 0;
- SBatchReq batchReq = {0};
- SBatchMsg req = {0};
+ int32_t code = 0;
+ int32_t rspSize = 0;
+ SBatchReq batchReq = {0};
+ SBatchMsg req = {0};
SBatchRspMsg rsp = {0};
- SBatchRsp batchRsp = {0};
- SRpcMsg reqMsg = *pMsg;
- void *pRsp = NULL;
- SMnode *pMnode = pMsg->info.node;
+ SBatchRsp batchRsp = {0};
+ SRpcMsg reqMsg = *pMsg;
+ void *pRsp = NULL;
+ SMnode *pMnode = pMsg->info.node;
if ((code = tDeserializeSBatchReq(pMsg->pCont, pMsg->contLen, &batchReq)) != 0) {
code = TSDB_CODE_OUT_OF_MEMORY;
@@ -94,7 +93,7 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
goto _exit;
}
- int32_t msgNum = taosArrayGetSize(batchReq.pMsgs);
+ int32_t msgNum = taosArrayGetSize(batchReq.pMsgs);
if (msgNum >= MAX_META_MSG_IN_BATCH) {
code = TSDB_CODE_INVALID_MSG;
mError("too many msgs %d in mnode batch meta req", msgNum);
@@ -108,7 +107,7 @@ int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) {
}
for (int32_t i = 0; i < msgNum; ++i) {
- SBatchMsg* req = taosArrayGet(batchReq.pMsgs, i);
+ SBatchMsg *req = taosArrayGet(batchReq.pMsgs, i);
reqMsg.msgType = req->msgType;
reqMsg.pCont = req->msg;
diff --git a/source/dnode/mnode/impl/src/mndShow.c b/source/dnode/mnode/impl/src/mndShow.c
index 55687c00ba..264fea3476 100644
--- a/source/dnode/mnode/impl/src/mndShow.c
+++ b/source/dnode/mnode/impl/src/mndShow.c
@@ -68,6 +68,10 @@ static int32_t convertToRetrieveType(char *name, int32_t len) {
type = TSDB_MGMT_TABLE_QNODE;
} else if (strncasecmp(name, TSDB_INS_TABLE_SNODES, len) == 0) {
type = TSDB_MGMT_TABLE_SNODE;
+ } else if (strncasecmp(name, TSDB_INS_TABLE_ANODES, len) == 0) {
+ type = TSDB_MGMT_TABLE_ANODE;
+ } else if (strncasecmp(name, TSDB_INS_TABLE_ANODES_FULL, len) == 0) {
+ type = TSDB_MGMT_TABLE_ANODE_FULL;
} else if (strncasecmp(name, TSDB_INS_TABLE_ARBGROUPS, len) == 0) {
type = TSDB_MGMT_TABLE_ARBGROUP;
} else if (strncasecmp(name, TSDB_INS_TABLE_CLUSTER, len) == 0) {
diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c
index fa2538f245..a54c7f1b14 100644
--- a/source/dnode/mnode/impl/src/mndSma.c
+++ b/source/dnode/mnode/impl/src/mndSma.c
@@ -2252,7 +2252,7 @@ static int32_t mndRetrieveTSMA(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBlo
if (nodeType(pFunc) == QUERY_NODE_FUNCTION) {
SFunctionNode *pFuncNode = (SFunctionNode *)pFunc;
if (!fmIsTSMASupportedFunc(pFuncNode->funcId)) continue;
- len += snprintf(start, TSDB_MAX_SAVED_SQL_LEN - len, "%s%s", start != buf + VARSTR_HEADER_SIZE ? "," : "",
+ len += tsnprintf(start, TSDB_MAX_SAVED_SQL_LEN - len, "%s%s", start != buf + VARSTR_HEADER_SIZE ? "," : "",
((SExprNode *)pFunc)->userAlias);
if (len >= TSDB_MAX_SAVED_SQL_LEN) {
len = TSDB_MAX_SAVED_SQL_LEN;
diff --git a/source/dnode/mnode/impl/src/mndTrans.c b/source/dnode/mnode/impl/src/mndTrans.c
index 657601f5ae..4268d73746 100644
--- a/source/dnode/mnode/impl/src/mndTrans.c
+++ b/source/dnode/mnode/impl/src/mndTrans.c
@@ -474,6 +474,21 @@ static int32_t mndTransActionInsert(SSdb *pSdb, STrans *pTrans) {
// pTrans->startFunc = 0;
}
+ if (pTrans->stage == TRN_STAGE_COMMIT) {
+ pTrans->stage = TRN_STAGE_COMMIT_ACTION;
+ mInfo("trans:%d, stage from commit to commitAction since perform update action", pTrans->id);
+ }
+
+ if (pTrans->stage == TRN_STAGE_ROLLBACK) {
+ pTrans->stage = TRN_STAGE_UNDO_ACTION;
+ mInfo("trans:%d, stage from rollback to undoAction since perform update action", pTrans->id);
+ }
+
+ if (pTrans->stage == TRN_STAGE_PRE_FINISH) {
+ pTrans->stage = TRN_STAGE_FINISH;
+ mInfo("trans:%d, stage from pre-finish to finished since perform update action", pTrans->id);
+ }
+
return 0;
}
@@ -563,17 +578,17 @@ static int32_t mndTransActionUpdate(SSdb *pSdb, STrans *pOld, STrans *pNew) {
if (pOld->stage == TRN_STAGE_COMMIT) {
pOld->stage = TRN_STAGE_COMMIT_ACTION;
- mTrace("trans:%d, stage from commit to commitAction since perform update action", pNew->id);
+ mInfo("trans:%d, stage from commit to commitAction since perform update action", pNew->id);
}
if (pOld->stage == TRN_STAGE_ROLLBACK) {
pOld->stage = TRN_STAGE_UNDO_ACTION;
- mTrace("trans:%d, stage from rollback to undoAction since perform update action", pNew->id);
+ mInfo("trans:%d, stage from rollback to undoAction since perform update action", pNew->id);
}
if (pOld->stage == TRN_STAGE_PRE_FINISH) {
pOld->stage = TRN_STAGE_FINISH;
- mTrace("trans:%d, stage from pre-finish to finished since perform update action", pNew->id);
+ mInfo("trans:%d, stage from pre-finish to finished since perform update action", pNew->id);
}
return 0;
@@ -1295,7 +1310,7 @@ static void mndTransResetActions(SMnode *pMnode, STrans *pTrans, SArray *pArray)
}
}
-// execute at bottom half
+// execute in sync context
static int32_t mndTransWriteSingleLog(SMnode *pMnode, STrans *pTrans, STransAction *pAction, bool topHalf) {
if (pAction->rawWritten) return 0;
if (topHalf) {
@@ -1321,7 +1336,7 @@ static int32_t mndTransWriteSingleLog(SMnode *pMnode, STrans *pTrans, STransActi
TAOS_RETURN(code);
}
-// execute at top half
+// execute in trans context
static int32_t mndTransSendSingleMsg(SMnode *pMnode, STrans *pTrans, STransAction *pAction, bool topHalf) {
if (pAction->msgSent) return 0;
if (mndCannotExecuteTransAction(pMnode, topHalf)) {
@@ -1701,6 +1716,7 @@ static bool mndTransPerformRedoActionStage(SMnode *pMnode, STrans *pTrans, bool
return continueExec;
}
+// in trans context
static bool mndTransPerformCommitStage(SMnode *pMnode, STrans *pTrans, bool topHalf) {
if (mndCannotExecuteTransAction(pMnode, topHalf)) return false;
@@ -1775,6 +1791,7 @@ static bool mndTransPerformUndoActionStage(SMnode *pMnode, STrans *pTrans, bool
return continueExec;
}
+// in trans context
static bool mndTransPerformRollbackStage(SMnode *pMnode, STrans *pTrans, bool topHalf) {
if (mndCannotExecuteTransAction(pMnode, topHalf)) return false;
diff --git a/source/dnode/mnode/sdb/inc/sdb.h b/source/dnode/mnode/sdb/inc/sdb.h
index c33b1d4366..f6d1587bb2 100644
--- a/source/dnode/mnode/sdb/inc/sdb.h
+++ b/source/dnode/mnode/sdb/inc/sdb.h
@@ -161,7 +161,8 @@ typedef enum {
SDB_COMPACT_DETAIL = 25,
SDB_GRANT = 26, // grant log
SDB_ARBGROUP = 27,
- SDB_MAX = 28
+ SDB_ANODE = 28,
+ SDB_MAX = 29
} ESdbType;
typedef struct SSdbRaw {
diff --git a/source/dnode/mnode/sdb/src/sdbFile.c b/source/dnode/mnode/sdb/src/sdbFile.c
index 0a6dc45d51..227ff15da9 100644
--- a/source/dnode/mnode/sdb/src/sdbFile.c
+++ b/source/dnode/mnode/sdb/src/sdbFile.c
@@ -25,6 +25,9 @@
#define SDB_RESERVE_SIZE 512
#define SDB_FILE_VER 1
+#define SDB_TABLE_SIZE_EXTRA SDB_MAX
+#define SDB_RESERVE_SIZE_EXTRA (512 - (SDB_TABLE_SIZE_EXTRA - SDB_TABLE_SIZE) * 2 * sizeof(int64_t))
+
static int32_t sdbDeployData(SSdb *pSdb) {
int32_t code = 0;
mInfo("start to deploy sdb");
@@ -154,7 +157,38 @@ static int32_t sdbReadFileHead(SSdb *pSdb, TdFilePtr pFile) {
}
}
- char reserve[SDB_RESERVE_SIZE] = {0};
+ // for sdb compatibility
+ for (int32_t i = SDB_TABLE_SIZE; i < SDB_TABLE_SIZE_EXTRA; ++i) {
+ int64_t maxId = 0;
+ ret = taosReadFile(pFile, &maxId, sizeof(int64_t));
+ if (ret < 0) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ TAOS_RETURN(code);
+ }
+ if (ret != sizeof(int64_t)) {
+ code = TSDB_CODE_FILE_CORRUPTED;
+ TAOS_RETURN(code);
+ }
+ if (i < SDB_MAX) {
+ pSdb->maxId[i] = maxId;
+ }
+
+ int64_t ver = 0;
+ ret = taosReadFile(pFile, &ver, sizeof(int64_t));
+ if (ret < 0) {
+ code = TAOS_SYSTEM_ERROR(errno);
+ TAOS_RETURN(code);
+ }
+ if (ret != sizeof(int64_t)) {
+ code = TSDB_CODE_FILE_CORRUPTED;
+ TAOS_RETURN(code);
+ }
+ if (i < SDB_MAX) {
+ pSdb->tableVer[i] = ver;
+ }
+ }
+
+ char reserve[SDB_RESERVE_SIZE_EXTRA] = {0};
ret = taosReadFile(pFile, reserve, sizeof(reserve));
if (ret < 0) {
return terrno;
@@ -207,7 +241,26 @@ static int32_t sdbWriteFileHead(SSdb *pSdb, TdFilePtr pFile) {
}
}
- char reserve[SDB_RESERVE_SIZE] = {0};
+ // for sdb compatibility
+ for (int32_t i = SDB_TABLE_SIZE; i < SDB_TABLE_SIZE_EXTRA; ++i) {
+ int64_t maxId = 0;
+ if (i < SDB_MAX) {
+ maxId = pSdb->maxId[i];
+ }
+ if (taosWriteFile(pFile, &maxId, sizeof(int64_t)) != sizeof(int64_t)) {
+ return terrno;
+ }
+
+ int64_t ver = 0;
+ if (i < SDB_MAX) {
+ ver = pSdb->tableVer[i];
+ }
+ if (taosWriteFile(pFile, &ver, sizeof(int64_t)) != sizeof(int64_t)) {
+ return terrno;
+ }
+ }
+
+ char reserve[SDB_RESERVE_SIZE_EXTRA] = {0};
if (taosWriteFile(pFile, reserve, sizeof(reserve)) != sizeof(reserve)) {
return terrno;
}
diff --git a/source/dnode/mnode/sdb/src/sdbHash.c b/source/dnode/mnode/sdb/src/sdbHash.c
index ea44a7c549..3f85ccb087 100644
--- a/source/dnode/mnode/sdb/src/sdbHash.c
+++ b/source/dnode/mnode/sdb/src/sdbHash.c
@@ -74,6 +74,8 @@ const char *sdbTableName(ESdbType type) {
return "grant";
case SDB_ARBGROUP:
return "arb_group";
+ case SDB_ANODE:
+ return "anode";
default:
return "undefine";
}
diff --git a/source/libs/command/inc/commandInt.h b/source/libs/command/inc/commandInt.h
index e433d61860..feb1b3cc19 100644
--- a/source/libs/command/inc/commandInt.h
+++ b/source/libs/command/inc/commandInt.h
@@ -188,17 +188,17 @@ do { \
#define EXPLAIN_ROW_NEW(level, ...) \
do { \
if (isVerboseLine) { \
- tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s", (level) * 3 + 3, ""); \
+ tlen = tsnprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s", (level) * 3 + 3, ""); \
} else { \
- tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s%s", (level) * 3, "", "-> "); \
+ tlen = tsnprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, "%*s%s", (level) * 3, "", "-> "); \
} \
- tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE - tlen, __VA_ARGS__); \
+ tlen += tsnprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE - tlen, __VA_ARGS__); \
} while (0)
-#define EXPLAIN_ROW_APPEND(...) tlen += snprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE - tlen, __VA_ARGS__)
+#define EXPLAIN_ROW_APPEND(...) tlen += tsnprintf(tbuf + VARSTR_HEADER_SIZE + tlen, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE - tlen, __VA_ARGS__)
#define EXPLAIN_ROW_END() do { varDataSetLen(tbuf, tlen); tlen += VARSTR_HEADER_SIZE; isVerboseLine = true; } while (0)
-#define EXPLAIN_SUM_ROW_NEW(...) tlen = snprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, __VA_ARGS__)
+#define EXPLAIN_SUM_ROW_NEW(...) tlen = tsnprintf(tbuf + VARSTR_HEADER_SIZE, TSDB_EXPLAIN_RESULT_ROW_SIZE - VARSTR_HEADER_SIZE, __VA_ARGS__)
#define EXPLAIN_SUM_ROW_END() do { varDataSetLen(tbuf, tlen); tlen += VARSTR_HEADER_SIZE; } while (0)
#define EXPLAIN_ROW_APPEND_LIMIT_IMPL(_pLimit, sl) do { \
diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c
index 95c73763bf..b2417a8597 100644
--- a/source/libs/command/src/command.c
+++ b/source/libs/command/src/command.c
@@ -515,7 +515,7 @@ void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) {
TSDB_DATA_TYPE_GEOMETRY == pSchema->type) {
typeLen += tsnprintf(type + typeLen, LTYPE_LEN - typeLen, "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE));
} else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) {
- typeLen += snprintf(type + typeLen, LTYPE_LEN - typeLen, "(%d)",
+ typeLen += tsnprintf(type + typeLen, LTYPE_LEN - typeLen, "(%d)",
(int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE));
}
diff --git a/source/libs/executor/CMakeLists.txt b/source/libs/executor/CMakeLists.txt
index 8ba5f9a866..af2c3986aa 100644
--- a/source/libs/executor/CMakeLists.txt
+++ b/source/libs/executor/CMakeLists.txt
@@ -5,6 +5,10 @@ if(${TD_DARWIN})
target_compile_options(executor PRIVATE -Wno-error=deprecated-non-prototype)
endif(${TD_DARWIN})
+IF(${BUILD_WITH_ANALYSIS})
+ add_definitions(-DUSE_ANAL)
+ENDIF()
+
target_link_libraries(executor
PRIVATE os util common function parser planner qcom scalar nodes index wal tdb geometry
)
diff --git a/source/libs/executor/inc/executil.h b/source/libs/executor/inc/executil.h
index 95035dd96f..9e36a29476 100644
--- a/source/libs/executor/inc/executil.h
+++ b/source/libs/executor/inc/executil.h
@@ -48,6 +48,7 @@ typedef struct SGroupResInfo {
} SGroupResInfo;
typedef struct SResultRow {
+ int32_t version;
int32_t pageId; // pageId & rowId is the position of current result in disk-based output buffer
int32_t offset : 29; // row index in buffer page
bool startInterp; // the time window start timestamp has done the interpolation already.
@@ -152,6 +153,9 @@ static FORCE_INLINE SResultRow* getResultRowByPos(SDiskbasedBuf* pBuf, SResultRo
return pRow;
}
+int32_t getResultRowFromBuf(struct SExprSupp *pSup, const char* inBuf, size_t inBufSize, char **outBuf, size_t *outBufSize);
+int32_t putResultRowToBuf(struct SExprSupp *pSup, const char* inBuf, size_t inBufSize, char **outBuf, size_t *outBufSize);
+
int32_t initGroupedResultInfo(SGroupResInfo* pGroupResInfo, SSHashObj* pHashmap, int32_t order);
void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo);
diff --git a/source/libs/executor/inc/operator.h b/source/libs/executor/inc/operator.h
index fce0b05fde..7dfc7080d6 100644
--- a/source/libs/executor/inc/operator.h
+++ b/source/libs/executor/inc/operator.h
@@ -133,6 +133,8 @@ int32_t createStreamPartitionOperatorInfo(SOperatorInfo* downstream, SStreamPart
int32_t createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pInfo);
+int32_t createForecastOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pInfo);
+
int32_t createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SSortMergeJoinPhysiNode* pJoinNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pInfo);
int32_t createHashJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SHashJoinPhysiNode* pJoinNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pInfo);
@@ -159,6 +161,8 @@ int32_t createCountwindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* phy
int32_t createGroupCacheOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SGroupCachePhysiNode* pPhyciNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pInfo);
+int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pInfo);
+
int32_t createDynQueryCtrlOperatorInfo(SOperatorInfo** pDownstream, int32_t numOfDownstream, SDynQueryCtrlPhysiNode* pPhyciNode, SExecTaskInfo* pTaskInfo, SOperatorInfo** pInfo);
// clang-format on
diff --git a/source/libs/executor/src/anomalywindowoperator.c b/source/libs/executor/src/anomalywindowoperator.c
new file mode 100644
index 0000000000..7f3430b837
--- /dev/null
+++ b/source/libs/executor/src/anomalywindowoperator.c
@@ -0,0 +1,636 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#include "executorInt.h"
+#include "filter.h"
+#include "function.h"
+#include "functionMgt.h"
+#include "operator.h"
+#include "querytask.h"
+#include "tanal.h"
+#include "tcommon.h"
+#include "tcompare.h"
+#include "tdatablock.h"
+#include "tjson.h"
+#include "ttime.h"
+
+#ifdef USE_ANAL
+
+typedef struct {
+ SArray* blocks; // SSDataBlock*
+ SArray* windows; // STimeWindow
+ uint64_t groupId;
+ int64_t cachedRows;
+ int32_t curWinIndex;
+ STimeWindow curWin;
+ SResultRow* pResultRow;
+} SAnomalyWindowSupp;
+
+typedef struct {
+ SOptrBasicInfo binfo;
+ SAggSupporter aggSup;
+ SExprSupp scalarSup;
+ int32_t tsSlotId;
+ STimeWindowAggSupp twAggSup;
+ char algoName[TSDB_ANAL_ALGO_NAME_LEN];
+ char algoUrl[TSDB_ANAL_ALGO_URL_LEN];
+ char anomalyOpt[TSDB_ANAL_ALGO_OPTION_LEN];
+ SAnomalyWindowSupp anomalySup;
+ SWindowRowsSup anomalyWinRowSup;
+ SColumn anomalyCol;
+ SStateKeys anomalyKey;
+} SAnomalyWindowOperatorInfo;
+
+static void anomalyDestroyOperatorInfo(void* param);
+static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes);
+static void anomalyAggregateBlocks(SOperatorInfo* pOperator);
+static int32_t anomalyCacheBlock(SAnomalyWindowOperatorInfo* pInfo, SSDataBlock* pBlock);
+
+int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode, SExecTaskInfo* pTaskInfo,
+ SOperatorInfo** pOptrInfo) {
+ QRY_PARAM_CHECK(pOptrInfo);
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t lino = 0;
+ SAnomalyWindowOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SAnomalyWindowOperatorInfo));
+ SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
+ SAnomalyWindowPhysiNode* pAnomalyNode = (SAnomalyWindowPhysiNode*)physiNode;
+ SColumnNode* pColNode = (SColumnNode*)(pAnomalyNode->pAnomalyKey);
+ if (pInfo == NULL || pOperator == NULL) {
+ code = terrno;
+ goto _error;
+ }
+
+ if (!taosAnalGetOptStr(pAnomalyNode->anomalyOpt, "algo", pInfo->algoName, sizeof(pInfo->algoName))) {
+ qError("failed to get anomaly_window algorithm name from %s", pAnomalyNode->anomalyOpt);
+ code = TSDB_CODE_ANAL_ALGO_NOT_FOUND;
+ goto _error;
+ }
+ if (taosAnalGetAlgoUrl(pInfo->algoName, ANAL_ALGO_TYPE_ANOMALY_DETECT, pInfo->algoUrl, sizeof(pInfo->algoUrl)) != 0) {
+ qError("failed to get anomaly_window algorithm url from %s", pInfo->algoName);
+ code = TSDB_CODE_ANAL_ALGO_NOT_LOAD;
+ goto _error;
+ }
+
+ pOperator->exprSupp.hasWindowOrGroup = true;
+ pInfo->tsSlotId = ((SColumnNode*)pAnomalyNode->window.pTspk)->slotId;
+ strncpy(pInfo->anomalyOpt, pAnomalyNode->anomalyOpt, sizeof(pInfo->anomalyOpt));
+
+ if (pAnomalyNode->window.pExprs != NULL) {
+ int32_t numOfScalarExpr = 0;
+ SExprInfo* pScalarExprInfo = NULL;
+ code = createExprInfo(pAnomalyNode->window.pExprs, NULL, &pScalarExprInfo, &numOfScalarExpr);
+ QUERY_CHECK_CODE(code, lino, _error);
+ code = initExprSupp(&pInfo->scalarSup, pScalarExprInfo, numOfScalarExpr, &pTaskInfo->storageAPI.functionStore);
+ QUERY_CHECK_CODE(code, lino, _error);
+ }
+
+ size_t keyBufSize = 0;
+ int32_t num = 0;
+ SExprInfo* pExprInfo = NULL;
+ code = createExprInfo(pAnomalyNode->window.pFuncs, NULL, &pExprInfo, &num);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ initResultSizeInfo(&pOperator->resultInfo, 4096);
+
+ code = initAggSup(&pOperator->exprSupp, &pInfo->aggSup, pExprInfo, num, keyBufSize, pTaskInfo->id.str,
+ pTaskInfo->streamInfo.pState, &pTaskInfo->storageAPI.functionStore);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ SSDataBlock* pResBlock = createDataBlockFromDescNode(pAnomalyNode->window.node.pOutputDataBlockDesc);
+ QUERY_CHECK_NULL(pResBlock, code, lino, _error, terrno);
+ initBasicInfo(&pInfo->binfo, pResBlock);
+
+ code = blockDataEnsureCapacity(pResBlock, pOperator->resultInfo.capacity);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ initResultRowInfo(&pInfo->binfo.resultRowInfo);
+ pInfo->binfo.inputTsOrder = pAnomalyNode->window.node.inputTsOrder;
+ pInfo->binfo.outputTsOrder = pAnomalyNode->window.node.outputTsOrder;
+
+ pInfo->anomalyCol = extractColumnFromColumnNode(pColNode);
+ pInfo->anomalyKey.type = pInfo->anomalyCol.type;
+ pInfo->anomalyKey.bytes = pInfo->anomalyCol.bytes;
+ pInfo->anomalyKey.pData = taosMemoryCalloc(1, pInfo->anomalyCol.bytes);
+ if (pInfo->anomalyKey.pData == NULL) {
+ goto _error;
+ }
+
+ int32_t itemSize = sizeof(int32_t) + pInfo->aggSup.resultRowSize + pInfo->anomalyKey.bytes;
+ pInfo->anomalySup.pResultRow = taosMemoryCalloc(1, itemSize);
+ pInfo->anomalySup.blocks = taosArrayInit(16, sizeof(SSDataBlock*));
+ pInfo->anomalySup.windows = taosArrayInit(16, sizeof(STimeWindow));
+
+ if (pInfo->anomalySup.windows == NULL || pInfo->anomalySup.blocks == NULL || pInfo->anomalySup.pResultRow == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _error;
+ }
+
+ code = filterInitFromNode((SNode*)pAnomalyNode->window.node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ code = initExecTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pTaskInfo->window);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ setOperatorInfo(pOperator, "AnomalyWindowOperator", QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY, true, OP_NOT_OPENED,
+ pInfo, pTaskInfo);
+ pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, anomalyAggregateNext, NULL, anomalyDestroyOperatorInfo,
+ optrDefaultBufFn, NULL, optrDefaultGetNextExtFn, NULL);
+
+ code = appendDownstream(pOperator, &downstream, 1);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ *pOptrInfo = pOperator;
+
+ qDebug("anomaly_window operator is created, algo:%s url:%s opt:%s", pInfo->algoName, pInfo->algoUrl,
+ pInfo->anomalyOpt);
+ return TSDB_CODE_SUCCESS;
+
+_error:
+ if (pInfo != NULL) {
+ anomalyDestroyOperatorInfo(pInfo);
+ }
+
+ destroyOperatorAndDownstreams(pOperator, &downstream, 1);
+ pTaskInfo->code = code;
+ qError("failed to create anomaly_window operator, algo:%s code:0x%x", pInfo->algoName, code);
+ return code;
+}
+
+static int32_t anomalyAggregateNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t lino = 0;
+ SAnomalyWindowOperatorInfo* pInfo = pOperator->info;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SOptrBasicInfo* pBInfo = &pInfo->binfo;
+ SAnomalyWindowSupp* pSupp = &pInfo->anomalySup;
+ SSDataBlock* pRes = pInfo->binfo.pRes;
+ int64_t st = taosGetTimestampUs();
+ int32_t numOfBlocks = taosArrayGetSize(pSupp->blocks);
+
+ blockDataCleanup(pRes);
+
+ while (1) {
+ SSDataBlock* pBlock = getNextBlockFromDownstream(pOperator, 0);
+ if (pBlock == NULL) {
+ break;
+ }
+
+ if (pSupp->groupId == 0 || pSupp->groupId == pBlock->info.id.groupId) {
+ pSupp->groupId = pBlock->info.id.groupId;
+ numOfBlocks++;
+ pSupp->cachedRows += pBlock->info.rows;
+ qDebug("group:%" PRId64 ", blocks:%d, rows:%" PRId64 ", total rows:%" PRId64, pSupp->groupId, numOfBlocks,
+ pBlock->info.rows, pSupp->cachedRows);
+ code = anomalyCacheBlock(pInfo, pBlock);
+ QUERY_CHECK_CODE(code, lino, _end);
+ } else {
+ qDebug("group:%" PRId64 ", read finish for new group coming, blocks:%d", pSupp->groupId, numOfBlocks);
+ anomalyAggregateBlocks(pOperator);
+ pSupp->groupId = pBlock->info.id.groupId;
+ numOfBlocks = 1;
+ pSupp->cachedRows = pBlock->info.rows;
+ qDebug("group:%" PRId64 ", new group, rows:%" PRId64 ", total rows:%" PRId64, pSupp->groupId,
+ pBlock->info.rows, pSupp->cachedRows);
+ code = anomalyCacheBlock(pInfo, pBlock);
+ QUERY_CHECK_CODE(code, lino, _end);
+ }
+
+ if (pRes->info.rows > 0) {
+ (*ppRes) = pRes;
+ qDebug("group:%" PRId64 ", return to upstream, blocks:%d", pRes->info.id.groupId, numOfBlocks);
+ return code;
+ }
+ }
+
+ if (numOfBlocks > 0) {
+ qDebug("group:%" PRId64 ", read finish, blocks:%d", pInfo->anomalySup.groupId, numOfBlocks);
+ anomalyAggregateBlocks(pOperator);
+ }
+
+ int64_t cost = taosGetTimestampUs() - st;
+ qDebug("all groups finished, cost:%" PRId64 "us", cost);
+
+_end:
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
+ pTaskInfo->code = code;
+ T_LONG_JMP(pTaskInfo->env, code);
+ }
+ (*ppRes) = (pBInfo->pRes->info.rows == 0) ? NULL : pBInfo->pRes;
+ return code;
+}
+
+static void anomalyDestroyOperatorInfo(void* param) {
+ SAnomalyWindowOperatorInfo* pInfo = (SAnomalyWindowOperatorInfo*)param;
+ if (pInfo == NULL) return;
+
+ qDebug("anomaly_window operator is destroyed, algo:%s", pInfo->algoName);
+
+ cleanupBasicInfo(&pInfo->binfo);
+ cleanupAggSup(&pInfo->aggSup);
+ cleanupExprSupp(&pInfo->scalarSup);
+ colDataDestroy(&pInfo->twAggSup.timeWindowData);
+
+ for (int32_t i = 0; i < taosArrayGetSize(pInfo->anomalySup.blocks); ++i) {
+ SSDataBlock* pBlock = taosArrayGetP(pInfo->anomalySup.blocks, i);
+ blockDataDestroy(pBlock);
+ }
+ taosArrayDestroy(pInfo->anomalySup.blocks);
+ taosArrayDestroy(pInfo->anomalySup.windows);
+ taosMemoryFreeClear(pInfo->anomalySup.pResultRow);
+ taosMemoryFreeClear(pInfo->anomalyKey.pData);
+
+ taosMemoryFreeClear(param);
+}
+
+static int32_t anomalyCacheBlock(SAnomalyWindowOperatorInfo* pInfo, SSDataBlock* pSrc) {
+ if (pInfo->anomalySup.cachedRows > ANAL_ANOMALY_WINDOW_MAX_ROWS) {
+ return TSDB_CODE_ANAL_ANODE_TOO_MANY_ROWS;
+ }
+
+ SSDataBlock* pDst = NULL;
+ int32_t code = createOneDataBlock(pSrc, true, &pDst);
+
+ if (code != 0) return code;
+ if (pDst == NULL) return TSDB_CODE_OUT_OF_MEMORY;
+ if (taosArrayPush(pInfo->anomalySup.blocks, &pDst) == NULL) return TSDB_CODE_OUT_OF_MEMORY;
+
+ return 0;
+}
+
+static int32_t anomalyFindWindow(SAnomalyWindowSupp* pSupp, TSKEY key) {
+ for (int32_t i = pSupp->curWinIndex; i < taosArrayGetSize(pSupp->windows); ++i) {
+ STimeWindow* pWindow = taosArrayGet(pSupp->windows, i);
+ if (key >= pWindow->skey && key < pWindow->ekey) {
+ pSupp->curWin = *pWindow;
+ pSupp->curWinIndex = i;
+ return 0;
+ }
+ }
+ return -1;
+}
+
+static int32_t anomalyParseJson(SJson* pJson, SArray* pWindows) {
+ int32_t code = 0;
+ int32_t rows = 0;
+ STimeWindow win = {0};
+
+ taosArrayClear(pWindows);
+
+ tjsonGetInt32ValueFromDouble(pJson, "rows", rows, code);
+ if (code < 0) return TSDB_CODE_INVALID_JSON_FORMAT;
+ if (rows <= 0) return 0;
+
+ SJson* res = tjsonGetObjectItem(pJson, "res");
+ if (res == NULL) return TSDB_CODE_INVALID_JSON_FORMAT;
+
+ int32_t ressize = tjsonGetArraySize(res);
+ if (ressize != rows) return TSDB_CODE_INVALID_JSON_FORMAT;
+
+ for (int32_t i = 0; i < rows; ++i) {
+ SJson* row = tjsonGetArrayItem(res, i);
+ if (row == NULL) return TSDB_CODE_INVALID_JSON_FORMAT;
+
+ int32_t colsize = tjsonGetArraySize(row);
+ if (colsize != 2) return TSDB_CODE_INVALID_JSON_FORMAT;
+
+ SJson* start = tjsonGetArrayItem(row, 0);
+ SJson* end = tjsonGetArrayItem(row, 1);
+ if (start == NULL || end == NULL) return TSDB_CODE_INVALID_JSON_FORMAT;
+
+ tjsonGetObjectValueBigInt(start, &win.skey);
+ tjsonGetObjectValueBigInt(end, &win.ekey);
+
+ if (win.skey >= win.ekey) {
+ win.ekey = win.skey + 1;
+ }
+
+ if (taosArrayPush(pWindows, &win) == NULL) return TSDB_CODE_OUT_OF_BUFFER;
+ }
+
+ int32_t numOfWins = taosArrayGetSize(pWindows);
+ qDebug("anomaly window recevied, total:%d", numOfWins);
+ for (int32_t i = 0; i < numOfWins; ++i) {
+ STimeWindow* pWindow = taosArrayGet(pWindows, i);
+ qDebug("anomaly win:%d [%" PRId64 ", %" PRId64 ")", i, pWindow->skey, pWindow->ekey);
+ }
+
+ return 0;
+}
+
+static int32_t anomalyAnalysisWindow(SOperatorInfo* pOperator) {
+ SAnomalyWindowOperatorInfo* pInfo = pOperator->info;
+ SAnomalyWindowSupp* pSupp = &pInfo->anomalySup;
+ SJson* pJson = NULL;
+ SAnalBuf analBuf = {.bufType = ANAL_BUF_TYPE_JSON};
+ char dataBuf[64] = {0};
+ int32_t code = 0;
+
+ int64_t ts = 0;
+ // int64_t ts = taosGetTimestampMs();
+ snprintf(analBuf.fileName, sizeof(analBuf.fileName), "%s/tdengine-anomaly-%" PRId64 "-%" PRId64, tsTempDir, ts,
+ pSupp->groupId);
+ code = tsosAnalBufOpen(&analBuf, 2);
+ if (code != 0) goto _OVER;
+
+ const char* prec = TSDB_TIME_PRECISION_MILLI_STR;
+ if (pInfo->anomalyCol.precision == TSDB_TIME_PRECISION_MICRO) prec = TSDB_TIME_PRECISION_MICRO_STR;
+ if (pInfo->anomalyCol.precision == TSDB_TIME_PRECISION_NANO) prec = TSDB_TIME_PRECISION_NANO_STR;
+
+ code = taosAnalBufWriteColMeta(&analBuf, 0, TSDB_DATA_TYPE_TIMESTAMP, "ts");
+ if (code != 0) goto _OVER;
+
+ code = taosAnalBufWriteColMeta(&analBuf, 1, pInfo->anomalyCol.type, "val");
+ if (code != 0) goto _OVER;
+
+ code = taosAnalBufWriteDataBegin(&analBuf);
+ if (code != 0) goto _OVER;
+
+ int32_t numOfBlocks = (int32_t)taosArrayGetSize(pSupp->blocks);
+
+ // timestamp
+ code = taosAnalBufWriteColBegin(&analBuf, 0);
+ if (code != 0) goto _OVER;
+ for (int32_t i = 0; i < numOfBlocks; ++i) {
+ SSDataBlock* pBlock = taosArrayGetP(pSupp->blocks, i);
+ if (pBlock == NULL) break;
+ SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, pInfo->tsSlotId);
+ if (pTsCol == NULL) break;
+ for (int32_t j = 0; j < pBlock->info.rows; ++j) {
+ code = taosAnalBufWriteColData(&analBuf, 0, TSDB_DATA_TYPE_TIMESTAMP, &((TSKEY*)pTsCol->pData)[j]);
+ if (code != 0) goto _OVER;
+ }
+ }
+ code = taosAnalBufWriteColEnd(&analBuf, 0);
+ if (code != 0) goto _OVER;
+
+ // data
+ code = taosAnalBufWriteColBegin(&analBuf, 1);
+ if (code != 0) goto _OVER;
+ for (int32_t i = 0; i < numOfBlocks; ++i) {
+ SSDataBlock* pBlock = taosArrayGetP(pSupp->blocks, i);
+ if (pBlock == NULL) break;
+ SColumnInfoData* pValCol = taosArrayGet(pBlock->pDataBlock, pInfo->anomalyCol.slotId);
+ if (pValCol == NULL) break;
+
+ for (int32_t j = 0; j < pBlock->info.rows; ++j) {
+ code = taosAnalBufWriteColData(&analBuf, 1, pValCol->info.type, colDataGetData(pValCol, j));
+ if (code != 0) goto _OVER;
+ if (code != 0) goto _OVER;
+ }
+ }
+ code = taosAnalBufWriteColEnd(&analBuf, 1);
+ if (code != 0) goto _OVER;
+
+ code = taosAnalBufWriteDataEnd(&analBuf);
+ if (code != 0) goto _OVER;
+
+ code = taosAnalBufWriteOptStr(&analBuf, "option", pInfo->anomalyOpt);
+ if (code != 0) goto _OVER;
+
+ code = taosAnalBufWriteOptStr(&analBuf, "algo", pInfo->algoName);
+ if (code != 0) goto _OVER;
+
+ code = taosAnalBufWriteOptStr(&analBuf, "prec", prec);
+ if (code != 0) goto _OVER;
+
+ int64_t wncheck = ANAL_FORECAST_DEFAULT_WNCHECK;
+ bool hasWncheck = taosAnalGetOptInt(pInfo->anomalyOpt, "wncheck", &wncheck);
+ if (!hasWncheck) {
+ qDebug("anomaly_window wncheck not found from %s, use default:%" PRId64, pInfo->anomalyOpt, wncheck);
+ }
+ code = taosAnalBufWriteOptInt(&analBuf, "wncheck", wncheck);
+ if (code != 0) goto _OVER;
+
+ code = taosAnalBufClose(&analBuf);
+ if (code != 0) goto _OVER;
+
+ pJson = taosAnalSendReqRetJson(pInfo->algoUrl, ANAL_HTTP_TYPE_POST, &analBuf);
+ if (pJson == NULL) {
+ code = terrno;
+ goto _OVER;
+ }
+
+ code = anomalyParseJson(pJson, pSupp->windows);
+ if (code != 0) goto _OVER;
+
+_OVER:
+ if (code != 0) {
+ qError("failed to analysis window since %s", tstrerror(code));
+ }
+ taosAnalBufDestroy(&analBuf);
+ if (pJson != NULL) tjsonDelete(pJson);
+ return code;
+}
+
+static int32_t anomalyAggregateRows(SOperatorInfo* pOperator, SSDataBlock* pBlock) {
+ SAnomalyWindowOperatorInfo* pInfo = pOperator->info;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SExprSupp* pExprSup = &pOperator->exprSupp;
+ SAnomalyWindowSupp* pSupp = &pInfo->anomalySup;
+ SWindowRowsSup* pRowSup = &pInfo->anomalyWinRowSup;
+ SResultRow* pResRow = pSupp->pResultRow;
+ int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
+
+ int32_t code = setResultRowInitCtx(pResRow, pExprSup->pCtx, pExprSup->numOfExprs, pExprSup->rowEntryInfoOffset);
+ if (code == 0) {
+ updateTimeWindowInfo(&pInfo->twAggSup.timeWindowData, &pSupp->curWin, 0);
+ code = applyAggFunctionOnPartialTuples(pTaskInfo, pExprSup->pCtx, &pInfo->twAggSup.timeWindowData,
+ pRowSup->startRowIndex, pRowSup->numOfRows, pBlock->info.rows, numOfOutput);
+ }
+
+ return code;
+}
+
+static int32_t anomalyBuildResult(SOperatorInfo* pOperator) {
+ SAnomalyWindowOperatorInfo* pInfo = pOperator->info;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SExprSupp* pExprSup = &pOperator->exprSupp;
+ SSDataBlock* pRes = pInfo->binfo.pRes;
+ SResultRow* pResRow = pInfo->anomalySup.pResultRow;
+
+ doUpdateNumOfRows(pExprSup->pCtx, pResRow, pExprSup->numOfExprs, pExprSup->rowEntryInfoOffset);
+ int32_t code = copyResultrowToDataBlock(pExprSup->pExprInfo, pExprSup->numOfExprs, pResRow, pExprSup->pCtx, pRes,
+ pExprSup->rowEntryInfoOffset, pTaskInfo);
+ if (code == 0) {
+ pRes->info.rows += pResRow->numOfRows;
+ }
+
+ clearResultRowInitFlag(pExprSup->pCtx, pExprSup->numOfExprs);
+ return code;
+}
+
+static void anomalyAggregateBlocks(SOperatorInfo* pOperator) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t lino = 0;
+ SAnomalyWindowOperatorInfo* pInfo = pOperator->info;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SExprSupp* pExprSup = &pOperator->exprSupp;
+ SSDataBlock* pRes = pInfo->binfo.pRes;
+ SAnomalyWindowSupp* pSupp = &pInfo->anomalySup;
+ SWindowRowsSup* pRowSup = &pInfo->anomalyWinRowSup;
+ SResultRow* pResRow = pSupp->pResultRow;
+ int32_t numOfOutput = pOperator->exprSupp.numOfExprs;
+ int32_t rowsInWin = 0;
+ int32_t rowsInBlock = 0;
+ const int64_t gid = pSupp->groupId;
+ const int32_t order = pInfo->binfo.inputTsOrder;
+
+ int32_t numOfBlocks = (int32_t)taosArrayGetSize(pSupp->blocks);
+ if (numOfBlocks == 0) goto _OVER;
+
+ qDebug("group:%" PRId64 ", aggregate blocks, blocks:%d", pSupp->groupId, numOfBlocks);
+ pRes->info.id.groupId = pSupp->groupId;
+
+ code = anomalyAnalysisWindow(pOperator);
+ QUERY_CHECK_CODE(code, lino, _OVER);
+
+ int32_t numOfWins = taosArrayGetSize(pSupp->windows);
+ qDebug("group:%" PRId64 ", wins:%d, rows:%" PRId64, pSupp->groupId, numOfWins, pSupp->cachedRows);
+ for (int32_t w = 0; w < numOfWins; ++w) {
+ STimeWindow* pWindow = taosArrayGet(pSupp->windows, w);
+ if (w == 0) {
+ pSupp->curWin = *pWindow;
+ pRowSup->win.skey = pSupp->curWin.skey;
+ }
+ qDebug("group:%" PRId64 ", win:%d [%" PRId64 ", %" PRId64 ")", pSupp->groupId, w, pWindow->skey, pWindow->ekey);
+ }
+
+ if (numOfWins <= 0) goto _OVER;
+ if (numOfWins > pRes->info.capacity) {
+ code = blockDataEnsureCapacity(pRes, numOfWins);
+ QUERY_CHECK_CODE(code, lino, _OVER);
+ }
+
+ for (int32_t b = 0; b < numOfBlocks; ++b) {
+ SSDataBlock* pBlock = taosArrayGetP(pSupp->blocks, b);
+ if (pBlock == NULL) break;
+
+ pRes->info.scanFlag = pBlock->info.scanFlag;
+ code = setInputDataBlock(pExprSup, pBlock, order, MAIN_SCAN, true);
+ if (code != 0) break;
+
+ code = blockDataUpdateTsWindow(pBlock, pInfo->tsSlotId);
+ if (code != 0) break;
+
+ // there is an scalar expression that needs to be calculated right before apply the group aggregation.
+ if (pInfo->scalarSup.pExprInfo != NULL) {
+ code = projectApplyFunctions(pInfo->scalarSup.pExprInfo, pBlock, pBlock, pInfo->scalarSup.pCtx,
+ pInfo->scalarSup.numOfExprs, NULL);
+ if (code != 0) break;
+ }
+
+ SColumnInfoData* pValCol = taosArrayGet(pBlock->pDataBlock, pInfo->anomalyCol.slotId);
+ if (pValCol == NULL) break;
+ SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, pInfo->tsSlotId);
+ if (pTsCol == NULL) break;
+ TSKEY* tsList = (TSKEY*)pTsCol->pData;
+ bool lastBlock = (b == numOfBlocks - 1);
+
+ qTrace("group:%" PRId64 ", block:%d win:%d, riwin:%d riblock:%d, rows:%" PRId64, pSupp->groupId, b,
+ pSupp->curWinIndex, rowsInWin, rowsInBlock, pBlock->info.rows);
+
+ for (int32_t r = 0; r < pBlock->info.rows; ++r) {
+ TSKEY key = tsList[r];
+ bool keyInWin = (key >= pSupp->curWin.skey && key < pSupp->curWin.ekey);
+ bool lastRow = (r == pBlock->info.rows - 1);
+
+ if (keyInWin) {
+ if (r < 5) {
+ qTrace("group:%" PRId64 ", block:%d win:%d, row:%d ts:%" PRId64 ", riwin:%d riblock:%d", pSupp->groupId, b,
+ pSupp->curWinIndex, r, key, rowsInWin, rowsInBlock);
+ }
+ if (rowsInBlock == 0) {
+ doKeepNewWindowStartInfo(pRowSup, tsList, r, gid);
+ }
+ doKeepTuple(pRowSup, tsList[r], gid);
+ rowsInBlock++;
+ rowsInWin++;
+ } else {
+ if (rowsInBlock > 0) {
+ qTrace("group:%" PRId64 ", block:%d win:%d, row:%d ts:%" PRId64 ", riwin:%d riblock:%d, agg", pSupp->groupId,
+ b, pSupp->curWinIndex, r, key, rowsInWin, rowsInBlock);
+ code = anomalyAggregateRows(pOperator, pBlock);
+ QUERY_CHECK_CODE(code, lino, _OVER);
+ rowsInBlock = 0;
+ }
+ if (rowsInWin > 0) {
+ qTrace("group:%" PRId64 ", block:%d win:%d, row:%d ts:%" PRId64 ", riwin:%d riblock:%d, build result",
+ pSupp->groupId, b, pSupp->curWinIndex, r, key, rowsInWin, rowsInBlock);
+ code = anomalyBuildResult(pOperator);
+ QUERY_CHECK_CODE(code, lino, _OVER);
+ rowsInWin = 0;
+ }
+ if (anomalyFindWindow(pSupp, tsList[r]) == 0) {
+ qTrace("group:%" PRId64 ", block:%d win:%d, row:%d ts:%" PRId64 ", riwin:%d riblock:%d, new window detect",
+ pSupp->groupId, b, pSupp->curWinIndex, r, key, rowsInWin, rowsInBlock);
+ doKeepNewWindowStartInfo(pRowSup, tsList, r, gid);
+ doKeepTuple(pRowSup, tsList[r], gid);
+ rowsInBlock = 1;
+ rowsInWin = 1;
+ } else {
+ qTrace("group:%" PRId64 ", block:%d win:%d, row:%d ts:%" PRId64 ", riwin:%d riblock:%d, window not found",
+ pSupp->groupId, b, pSupp->curWinIndex, r, key, rowsInWin, rowsInBlock);
+ rowsInBlock = 0;
+ rowsInWin = 0;
+ }
+ }
+
+ if (lastRow && rowsInBlock > 0) {
+ qTrace("group:%" PRId64 ", block:%d win:%d, row:%d ts:%" PRId64 ", riwin:%d riblock:%d, agg since lastrow",
+ pSupp->groupId, b, pSupp->curWinIndex, r, key, rowsInWin, rowsInBlock);
+ code = anomalyAggregateRows(pOperator, pBlock);
+ QUERY_CHECK_CODE(code, lino, _OVER);
+ rowsInBlock = 0;
+ }
+ }
+
+ if (lastBlock && rowsInWin > 0) {
+ qTrace("group:%" PRId64 ", block:%d win:%d, riwin:%d riblock:%d, build result since lastblock", pSupp->groupId, b,
+ pSupp->curWinIndex, rowsInWin, rowsInBlock);
+ code = anomalyBuildResult(pOperator);
+ QUERY_CHECK_CODE(code, lino, _OVER);
+ rowsInWin = 0;
+ }
+ }
+
+ code = doFilter(pRes, pOperator->exprSupp.pFilterInfo, NULL);
+ QUERY_CHECK_CODE(code, lino, _OVER);
+
+_OVER:
+ for (int32_t i = 0; i < numOfBlocks; ++i) {
+ SSDataBlock* pBlock = taosArrayGetP(pSupp->blocks, i);
+ qDebug("%s, clear block, pBlock:%p pBlock->pDataBlock:%p", __func__, pBlock, pBlock->pDataBlock);
+ blockDataDestroy(pBlock);
+ }
+
+ taosArrayClear(pSupp->blocks);
+ taosArrayClear(pSupp->windows);
+ pSupp->cachedRows = 0;
+ pSupp->curWin.ekey = 0;
+ pSupp->curWin.skey = 0;
+ pSupp->curWinIndex = 0;
+}
+
+#else
+
+int32_t createAnomalywindowOperatorInfo(SOperatorInfo* downstream, SPhysiNode* physiNode, SExecTaskInfo* pTaskInfo,
+ SOperatorInfo** pOptrInfo) {
+ return TSDB_CODE_OPS_NOT_SUPPORT;
+}
+void destroyForecastInfo(void* param) {}
+
+#endif
\ No newline at end of file
diff --git a/source/libs/executor/src/exchangeoperator.c b/source/libs/executor/src/exchangeoperator.c
index 767796977c..60442c34ee 100644
--- a/source/libs/executor/src/exchangeoperator.c
+++ b/source/libs/executor/src/exchangeoperator.c
@@ -226,7 +226,7 @@ static SSDataBlock* doLoadRemoteDataImpl(SOperatorInfo* pOperator) {
concurrentlyLoadRemoteDataImpl(pOperator, pExchangeInfo, pTaskInfo);
}
if (TSDB_CODE_SUCCESS != pOperator->pTaskInfo->code) {
- qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(pOperator->pTaskInfo->code));
T_LONG_JMP(pTaskInfo->env, pOperator->pTaskInfo->code);
}
if (taosArrayGetSize(pExchangeInfo->pResultBlockList) == 0) {
@@ -530,6 +530,16 @@ int32_t loadRemoteDataCallback(void* param, SDataBuf* pMsg, int32_t code) {
int32_t index = pWrapper->sourceIndex;
SSourceDataInfo* pSourceDataInfo = taosArrayGet(pExchangeInfo->pSourceDataInfo, index);
+
+ int64_t* pRpcHandle = taosArrayGet(pExchangeInfo->pFetchRpcHandles, index);
+ if (pRpcHandle != NULL) {
+ int32_t ret = asyncFreeConnById(pExchangeInfo->pTransporter, *pRpcHandle);
+ if (ret != 0) {
+ qDebug("failed to free rpc handle, code:%s, %p", tstrerror(ret), pExchangeInfo);
+ }
+ *pRpcHandle = -1;
+ }
+
if (!pSourceDataInfo) {
return terrno;
}
diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c
index 0cadffbfdf..b15cc2ab45 100644
--- a/source/libs/executor/src/executil.c
+++ b/source/libs/executor/src/executil.c
@@ -88,11 +88,116 @@ size_t getResultRowSize(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
rowSize += pCtx[i].resDataInfo.interBufSize;
}
- rowSize += (numOfOutput * sizeof(bool));
- // expand rowSize to mark if col is null for top/bottom result(saveTupleData)
return rowSize;
}
+// Convert buf read from rocksdb to result row
+int32_t getResultRowFromBuf(SExprSupp *pSup, const char* inBuf, size_t inBufSize, char **outBuf, size_t *outBufSize) {
+ if (inBuf == NULL || pSup == NULL) {
+ qError("invalid input parameters, inBuf:%p, pSup:%p", inBuf, pSup);
+ return TSDB_CODE_INVALID_PARA;
+ }
+ SqlFunctionCtx *pCtx = pSup->pCtx;
+ int32_t *offset = pSup->rowEntryInfoOffset;
+ SResultRow *pResultRow = NULL;
+ size_t processedSize = 0;
+ int32_t code = TSDB_CODE_SUCCESS;
+
+ // calculate the size of output buffer
+ *outBufSize = getResultRowSize(pCtx, pSup->numOfExprs);
+ *outBuf = taosMemoryMalloc(*outBufSize);
+ if (*outBuf == NULL) {
+ qError("failed to allocate memory for output buffer, size:%zu", *outBufSize);
+ return terrno;
+ }
+ pResultRow = (SResultRow*)*outBuf;
+ (void)memcpy(pResultRow, inBuf, sizeof(SResultRow));
+ inBuf += sizeof(SResultRow);
+ processedSize += sizeof(SResultRow);
+
+ for (int32_t i = 0; i < pSup->numOfExprs; ++i) {
+ int32_t len = *(int32_t*)inBuf;
+ inBuf += sizeof(int32_t);
+ processedSize += sizeof(int32_t);
+ if (pResultRow->version != FUNCTION_RESULT_INFO_VERSION && pCtx->fpSet.decode) {
+ code = pCtx->fpSet.decode(&pCtx[i], inBuf, getResultEntryInfo(pResultRow, i, offset), pResultRow->version);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("failed to decode result row, code:%d", code);
+ return code;
+ }
+ } else {
+ (void)memcpy(getResultEntryInfo(pResultRow, i, offset), inBuf, len);
+ }
+ inBuf += len;
+ processedSize += len;
+ }
+
+ if (processedSize < inBufSize) {
+ // stream stores extra data after result row
+ size_t leftLen = inBufSize - processedSize;
+ TAOS_MEMORY_REALLOC(*outBuf, *outBufSize + leftLen);
+ if (*outBuf == NULL) {
+ qError("failed to reallocate memory for output buffer, size:%zu", *outBufSize + leftLen);
+ return terrno;
+ }
+ (void)memcpy(*outBuf + *outBufSize, inBuf, leftLen);
+ inBuf += leftLen;
+ processedSize += leftLen;
+ *outBufSize += leftLen;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+// Convert result row to buf for rocksdb
+int32_t putResultRowToBuf(SExprSupp *pSup, const char* inBuf, size_t inBufSize, char **outBuf, size_t *outBufSize) {
+ if (pSup == NULL || inBuf == NULL || outBuf == NULL || outBufSize == NULL) {
+ qError("invalid input parameters, inBuf:%p, pSup:%p, outBufSize:%p, outBuf:%p", inBuf, pSup, outBufSize, outBuf);
+ return TSDB_CODE_INVALID_PARA;
+ }
+
+ SqlFunctionCtx *pCtx = pSup->pCtx;
+ int32_t *offset = pSup->rowEntryInfoOffset;
+ SResultRow *pResultRow = (SResultRow*)inBuf;
+ size_t rowSize = getResultRowSize(pCtx, pSup->numOfExprs);
+
+ if (rowSize > inBufSize) {
+ qError("invalid input buffer size, rowSize:%zu, inBufSize:%zu", rowSize, inBufSize);
+ return TSDB_CODE_INVALID_PARA;
+ }
+
+ // calculate the size of output buffer
+ *outBufSize = rowSize + sizeof(int32_t) * pSup->numOfExprs;
+ if (rowSize < inBufSize) {
+ *outBufSize += inBufSize - rowSize;
+ }
+
+ *outBuf = taosMemoryMalloc(*outBufSize);
+ if (*outBuf == NULL) {
+ qError("failed to allocate memory for output buffer, size:%zu", *outBufSize);
+ return terrno;
+ }
+
+ char *pBuf = *outBuf;
+ pResultRow->version = FUNCTION_RESULT_INFO_VERSION;
+ (void)memcpy(pBuf, pResultRow, sizeof(SResultRow));
+ pBuf += sizeof(SResultRow);
+ for (int32_t i = 0; i < pSup->numOfExprs; ++i) {
+ size_t len = sizeof(SResultRowEntryInfo) + pCtx[i].resDataInfo.interBufSize;
+ *(int32_t *) pBuf = (int32_t)len;
+ pBuf += sizeof(int32_t);
+ (void)memcpy(pBuf, getResultEntryInfo(pResultRow, i, offset), len);
+ pBuf += len;
+ }
+
+ if (rowSize < inBufSize) {
+ // stream stores extra data after result row
+ size_t leftLen = inBufSize - rowSize;
+ (void)memcpy(pBuf, inBuf + rowSize, leftLen);
+ pBuf += leftLen;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static void freeEx(void* p) { taosMemoryFree(*(void**)p); }
void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo) {
diff --git a/source/libs/executor/src/forecastoperator.c b/source/libs/executor/src/forecastoperator.c
new file mode 100644
index 0000000000..0afa933ee8
--- /dev/null
+++ b/source/libs/executor/src/forecastoperator.c
@@ -0,0 +1,659 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+#include "executorInt.h"
+#include "filter.h"
+#include "function.h"
+#include "functionMgt.h"
+#include "operator.h"
+#include "querytask.h"
+#include "storageapi.h"
+#include "tanal.h"
+#include "tcommon.h"
+#include "tcompare.h"
+#include "tdatablock.h"
+#include "tfill.h"
+#include "ttime.h"
+
+#ifdef USE_ANAL
+
+typedef struct {
+ char algoName[TSDB_ANAL_ALGO_NAME_LEN];
+ char algoUrl[TSDB_ANAL_ALGO_URL_LEN];
+ char algoOpt[TSDB_ANAL_ALGO_OPTION_LEN];
+ int64_t maxTs;
+ int64_t minTs;
+ int64_t numOfRows;
+ uint64_t groupId;
+ int64_t optRows;
+ int64_t cachedRows;
+ int32_t numOfBlocks;
+ int16_t resTsSlot;
+ int16_t resValSlot;
+ int16_t resLowSlot;
+ int16_t resHighSlot;
+ int16_t inputTsSlot;
+ int16_t inputValSlot;
+ int8_t inputValType;
+ int8_t inputPrecision;
+ SAnalBuf analBuf;
+} SForecastSupp;
+
+typedef struct SForecastOperatorInfo {
+ SSDataBlock* pRes;
+ SExprSupp scalarSup; // scalar calculation
+ SForecastSupp forecastSupp;
+} SForecastOperatorInfo;
+
+static void destroyForecastInfo(void* param);
+
+static FORCE_INLINE int32_t forecastEnsureBlockCapacity(SSDataBlock* pBlock, int32_t newRowsNum) {
+ if (pBlock->info.rows < pBlock->info.capacity) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ int32_t code = blockDataEnsureCapacity(pBlock, newRowsNum);
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, __LINE__, tstrerror(code));
+ return code;
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t forecastCacheBlock(SForecastSupp* pSupp, SSDataBlock* pBlock) {
+ if (pSupp->cachedRows > ANAL_FORECAST_MAX_ROWS) {
+ return TSDB_CODE_ANAL_ANODE_TOO_MANY_ROWS;
+ }
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t lino = 0;
+ SAnalBuf* pBuf = &pSupp->analBuf;
+
+ qDebug("block:%d, %p rows:%" PRId64, pSupp->numOfBlocks, pBlock, pBlock->info.rows);
+ pSupp->numOfBlocks++;
+
+ for (int32_t j = 0; j < pBlock->info.rows; ++j) {
+ SColumnInfoData* pValCol = taosArrayGet(pBlock->pDataBlock, pSupp->inputValSlot);
+ SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, pSupp->inputTsSlot);
+ if (pTsCol == NULL || pValCol == NULL) break;
+
+ int64_t ts = ((TSKEY*)pTsCol->pData)[j];
+ char* val = colDataGetData(pValCol, j);
+ int16_t valType = pValCol->info.type;
+
+ pSupp->minTs = MIN(pSupp->minTs, ts);
+ pSupp->maxTs = MAX(pSupp->maxTs, ts);
+ pSupp->numOfRows++;
+
+ code = taosAnalBufWriteColData(pBuf, 0, TSDB_DATA_TYPE_TIMESTAMP, &ts);
+ if (TSDB_CODE_SUCCESS != code) return code;
+
+ code = taosAnalBufWriteColData(pBuf, 1, valType, val);
+ if (TSDB_CODE_SUCCESS != code) return code;
+ }
+
+ return 0;
+}
+
+static int32_t forecastCloseBuf(SForecastSupp* pSupp) {
+ SAnalBuf* pBuf = &pSupp->analBuf;
+ int32_t code = 0;
+
+ for (int32_t i = 0; i < 2; ++i) {
+ code = taosAnalBufWriteColEnd(pBuf, i);
+ if (code != 0) return code;
+ }
+
+ code = taosAnalBufWriteDataEnd(pBuf);
+ if (code != 0) return code;
+
+ code = taosAnalBufWriteOptStr(pBuf, "option", pSupp->algoOpt);
+ if (code != 0) return code;
+
+ code = taosAnalBufWriteOptStr(pBuf, "algo", pSupp->algoName);
+ if (code != 0) return code;
+
+ const char* prec = TSDB_TIME_PRECISION_MILLI_STR;
+ if (pSupp->inputPrecision == TSDB_TIME_PRECISION_MICRO) prec = TSDB_TIME_PRECISION_MICRO_STR;
+ if (pSupp->inputPrecision == TSDB_TIME_PRECISION_NANO) prec = TSDB_TIME_PRECISION_NANO_STR;
+ code = taosAnalBufWriteOptStr(pBuf, "prec", prec);
+ if (code != 0) return code;
+
+ int64_t wncheck = ANAL_FORECAST_DEFAULT_WNCHECK;
+ bool hasWncheck = taosAnalGetOptInt(pSupp->algoOpt, "wncheck", &wncheck);
+ if (!hasWncheck) {
+ qDebug("forecast wncheck not found from %s, use default:%" PRId64, pSupp->algoOpt, wncheck);
+ }
+ code = taosAnalBufWriteOptInt(pBuf, "wncheck", wncheck);
+ if (code != 0) return code;
+
+ bool noConf = (pSupp->resHighSlot == -1 && pSupp->resLowSlot == -1);
+ code = taosAnalBufWriteOptInt(pBuf, "return_conf", !noConf);
+ if (code != 0) return code;
+
+ pSupp->optRows = ANAL_FORECAST_DEFAULT_ROWS;
+ bool hasRows = taosAnalGetOptInt(pSupp->algoOpt, "rows", &pSupp->optRows);
+ if (!hasRows) {
+ qDebug("forecast rows not found from %s, use default:%" PRId64, pSupp->algoOpt, pSupp->optRows);
+ }
+ code = taosAnalBufWriteOptInt(pBuf, "forecast_rows", pSupp->optRows);
+ if (code != 0) return code;
+
+ int64_t conf = ANAL_FORECAST_DEFAULT_CONF;
+ bool hasConf = taosAnalGetOptInt(pSupp->algoOpt, "conf", &conf);
+ if (!hasConf) {
+ qDebug("forecast conf not found from %s, use default:%" PRId64, pSupp->algoOpt, conf);
+ }
+ code = taosAnalBufWriteOptInt(pBuf, "conf", conf);
+ if (code != 0) return code;
+
+ int32_t len = strlen(pSupp->algoOpt);
+ int64_t every = (pSupp->maxTs - pSupp->minTs) / (pSupp->numOfRows - 1);
+ int64_t start = pSupp->maxTs + every;
+ bool hasStart = taosAnalGetOptInt(pSupp->algoOpt, "start", &start);
+ if (!hasStart) {
+ qDebug("forecast start not found from %s, use %" PRId64, pSupp->algoOpt, start);
+ }
+ code = taosAnalBufWriteOptInt(pBuf, "start", start);
+ if (code != 0) return code;
+
+ bool hasEvery = taosAnalGetOptInt(pSupp->algoOpt, "every", &every);
+ if (!hasEvery) {
+ qDebug("forecast every not found from %s, use %" PRId64, pSupp->algoOpt, every);
+ }
+ code = taosAnalBufWriteOptInt(pBuf, "every", every);
+ if (code != 0) return code;
+
+ code = taosAnalBufClose(pBuf);
+ return code;
+}
+
+static int32_t forecastAnalysis(SForecastSupp* pSupp, SSDataBlock* pBlock) {
+ SAnalBuf* pBuf = &pSupp->analBuf;
+ int32_t resCurRow = pBlock->info.rows;
+ int8_t tmpI8;
+ int16_t tmpI16;
+ int32_t tmpI32;
+ int64_t tmpI64;
+ float tmpFloat;
+ double tmpDouble;
+ int32_t code = 0;
+
+ SColumnInfoData* pResValCol = taosArrayGet(pBlock->pDataBlock, pSupp->resValSlot);
+ if (NULL == pResValCol) return TSDB_CODE_OUT_OF_RANGE;
+
+ SColumnInfoData* pResTsCol = (pSupp->resTsSlot != -1 ? taosArrayGet(pBlock->pDataBlock, pSupp->resTsSlot) : NULL);
+ SColumnInfoData* pResLowCol = (pSupp->resLowSlot != -1 ? taosArrayGet(pBlock->pDataBlock, pSupp->resLowSlot) : NULL);
+ SColumnInfoData* pResHighCol =
+ (pSupp->resHighSlot != -1 ? taosArrayGet(pBlock->pDataBlock, pSupp->resHighSlot) : NULL);
+
+ SJson* pJson = taosAnalSendReqRetJson(pSupp->algoUrl, ANAL_HTTP_TYPE_POST, pBuf);
+ if (pJson == NULL) return terrno;
+
+ int32_t rows = 0;
+ tjsonGetInt32ValueFromDouble(pJson, "rows", rows, code);
+ if (code < 0) goto _OVER;
+ if (rows <= 0) goto _OVER;
+
+ SJson* res = tjsonGetObjectItem(pJson, "res");
+ if (res == NULL) goto _OVER;
+ int32_t ressize = tjsonGetArraySize(res);
+ bool returnConf = (pSupp->resHighSlot != -1 || pSupp->resLowSlot != -1);
+ if (returnConf) {
+ if (ressize != 4) goto _OVER;
+ } else if (ressize != 2) {
+ goto _OVER;
+ }
+
+ if (pResTsCol != NULL) {
+ resCurRow = pBlock->info.rows;
+ SJson* tsJsonArray = tjsonGetArrayItem(res, 0);
+ if (tsJsonArray == NULL) goto _OVER;
+ int32_t tsSize = tjsonGetArraySize(tsJsonArray);
+ if (tsSize != rows) goto _OVER;
+ for (int32_t i = 0; i < tsSize; ++i) {
+ SJson* tsJson = tjsonGetArrayItem(tsJsonArray, i);
+ tjsonGetObjectValueBigInt(tsJson, &tmpI64);
+ colDataSetInt64(pResTsCol, resCurRow, &tmpI64);
+ resCurRow++;
+ }
+ }
+
+ if (pResLowCol != NULL) {
+ resCurRow = pBlock->info.rows;
+ SJson* lowJsonArray = tjsonGetArrayItem(res, 2);
+ if (lowJsonArray == NULL) goto _OVER;
+ int32_t lowSize = tjsonGetArraySize(lowJsonArray);
+ if (lowSize != rows) goto _OVER;
+ for (int32_t i = 0; i < lowSize; ++i) {
+ SJson* lowJson = tjsonGetArrayItem(lowJsonArray, i);
+ tjsonGetObjectValueDouble(lowJson, &tmpDouble);
+ tmpFloat = (float)tmpDouble;
+ colDataSetFloat(pResLowCol, resCurRow, &tmpFloat);
+ resCurRow++;
+ }
+ }
+
+ if (pResHighCol != NULL) {
+ resCurRow = pBlock->info.rows;
+ SJson* highJsonArray = tjsonGetArrayItem(res, 3);
+ if (highJsonArray == NULL) goto _OVER;
+ int32_t highSize = tjsonGetArraySize(highJsonArray);
+ if (highSize != rows) goto _OVER;
+ for (int32_t i = 0; i < highSize; ++i) {
+ SJson* highJson = tjsonGetArrayItem(highJsonArray, i);
+ tjsonGetObjectValueDouble(highJson, &tmpDouble);
+ tmpFloat = (float)tmpDouble;
+ colDataSetFloat(pResHighCol, resCurRow, &tmpFloat);
+ resCurRow++;
+ }
+ }
+
+ resCurRow = pBlock->info.rows;
+ SJson* valJsonArray = tjsonGetArrayItem(res, 1);
+ if (valJsonArray == NULL) goto _OVER;
+ int32_t valSize = tjsonGetArraySize(valJsonArray);
+ if (valSize != rows) goto _OVER;
+ for (int32_t i = 0; i < valSize; ++i) {
+ SJson* valJson = tjsonGetArrayItem(valJsonArray, i);
+ tjsonGetObjectValueDouble(valJson, &tmpDouble);
+
+ switch (pSupp->inputValType) {
+ case TSDB_DATA_TYPE_BOOL:
+ case TSDB_DATA_TYPE_UTINYINT:
+ case TSDB_DATA_TYPE_TINYINT: {
+ tmpI8 = (int8_t)tmpDouble;
+ colDataSetInt8(pResValCol, resCurRow, &tmpI8);
+ break;
+ }
+ case TSDB_DATA_TYPE_USMALLINT:
+ case TSDB_DATA_TYPE_SMALLINT: {
+ tmpI16 = (int16_t)tmpDouble;
+ colDataSetInt16(pResValCol, resCurRow, &tmpI16);
+ break;
+ }
+ case TSDB_DATA_TYPE_INT:
+ case TSDB_DATA_TYPE_UINT: {
+ tmpI32 = (int32_t)tmpDouble;
+ colDataSetInt32(pResValCol, resCurRow, &tmpI32);
+ break;
+ }
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ case TSDB_DATA_TYPE_UBIGINT:
+ case TSDB_DATA_TYPE_BIGINT: {
+ tmpI64 = (int64_t)tmpDouble;
+ colDataSetInt64(pResValCol, resCurRow, &tmpI64);
+ break;
+ }
+ case TSDB_DATA_TYPE_FLOAT: {
+ tmpFloat = (float)tmpDouble;
+ colDataSetFloat(pResValCol, resCurRow, &tmpFloat);
+ break;
+ }
+ case TSDB_DATA_TYPE_DOUBLE: {
+ colDataSetDouble(pResValCol, resCurRow, &tmpDouble);
+ break;
+ }
+ default:
+ code = TSDB_CODE_FUNC_FUNTION_PARA_TYPE;
+ goto _OVER;
+ }
+ resCurRow++;
+ }
+
+ // for (int32_t i = rows; i < pSupp->optRows; ++i) {
+ // colDataSetNNULL(pResValCol, rows, (pSupp->optRows - rows));
+ // if (pResTsCol != NULL) {
+ // colDataSetNNULL(pResTsCol, rows, (pSupp->optRows - rows));
+ // }
+ // if (pResLowCol != NULL) {
+ // colDataSetNNULL(pResLowCol, rows, (pSupp->optRows - rows));
+ // }
+ // if (pResHighCol != NULL) {
+ // colDataSetNNULL(pResHighCol, rows, (pSupp->optRows - rows));
+ // }
+ // }
+
+ // if (rows == pSupp->optRows) {
+ // pResValCol->hasNull = false;
+ // }
+
+ pBlock->info.rows += rows;
+
+ if (pJson != NULL) tjsonDelete(pJson);
+ return 0;
+
+_OVER:
+ if (pJson != NULL) tjsonDelete(pJson);
+ if (code == 0) {
+ code = TSDB_CODE_INVALID_JSON_FORMAT;
+ }
+ qError("failed to perform forecast finalize since %s", tstrerror(code));
+ return TSDB_CODE_INVALID_JSON_FORMAT;
+}
+
+static int32_t forecastAggregateBlocks(SForecastSupp* pSupp, SSDataBlock* pResBlock) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t lino = 0;
+ SAnalBuf* pBuf = &pSupp->analBuf;
+
+ code = forecastCloseBuf(pSupp);
+ QUERY_CHECK_CODE(code, lino, _end);
+
+ code = forecastEnsureBlockCapacity(pResBlock, 1);
+ QUERY_CHECK_CODE(code, lino, _end);
+
+ code = forecastAnalysis(pSupp, pResBlock);
+ QUERY_CHECK_CODE(code, lino, _end);
+
+ uInfo("block:%d, forecast finalize", pSupp->numOfBlocks);
+
+_end:
+ pSupp->numOfBlocks = 0;
+ taosAnalBufDestroy(&pSupp->analBuf);
+ return code;
+}
+
+static int32_t forecastNext(SOperatorInfo* pOperator, SSDataBlock** ppRes) {
+ int32_t code = TSDB_CODE_SUCCESS;
+ int32_t lino = 0;
+ SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo;
+ SForecastOperatorInfo* pInfo = pOperator->info;
+ SSDataBlock* pResBlock = pInfo->pRes;
+ SForecastSupp* pSupp = &pInfo->forecastSupp;
+ SAnalBuf* pBuf = &pSupp->analBuf;
+ int64_t st = taosGetTimestampUs();
+ int32_t numOfBlocks = pSupp->numOfBlocks;
+
+ blockDataCleanup(pResBlock);
+
+ while (1) {
+ SSDataBlock* pBlock = getNextBlockFromDownstream(pOperator, 0);
+ if (pBlock == NULL) {
+ break;
+ }
+
+ if (pSupp->groupId == 0 || pSupp->groupId == pBlock->info.id.groupId) {
+ pSupp->groupId = pBlock->info.id.groupId;
+ numOfBlocks++;
+ pSupp->cachedRows += pBlock->info.rows;
+ qDebug("group:%" PRId64 ", blocks:%d, rows:%" PRId64 ", total rows:%" PRId64, pSupp->groupId, numOfBlocks,
+ pBlock->info.rows, pSupp->cachedRows);
+ code = forecastCacheBlock(pSupp, pBlock);
+ QUERY_CHECK_CODE(code, lino, _end);
+ } else {
+ qDebug("group:%" PRId64 ", read finish for new group coming, blocks:%d", pSupp->groupId, numOfBlocks);
+ code = forecastAggregateBlocks(pSupp, pResBlock);
+ QUERY_CHECK_CODE(code, lino, _end);
+ pSupp->groupId = pBlock->info.id.groupId;
+ numOfBlocks = 1;
+ pSupp->cachedRows = pBlock->info.rows;
+ qDebug("group:%" PRId64 ", new group, rows:%" PRId64 ", total rows:%" PRId64, pSupp->groupId, pBlock->info.rows,
+ pSupp->cachedRows);
+ code = forecastCacheBlock(pSupp, pBlock);
+ QUERY_CHECK_CODE(code, lino, _end);
+ }
+
+ if (pResBlock->info.rows > 0) {
+ (*ppRes) = pResBlock;
+ qDebug("group:%" PRId64 ", return to upstream, blocks:%d", pResBlock->info.id.groupId, numOfBlocks);
+ return code;
+ }
+ }
+
+ if (numOfBlocks > 0) {
+ qDebug("group:%" PRId64 ", read finish, blocks:%d", pSupp->groupId, numOfBlocks);
+ code = forecastAggregateBlocks(pSupp, pResBlock);
+ QUERY_CHECK_CODE(code, lino, _end);
+ }
+
+ int64_t cost = taosGetTimestampUs() - st;
+ qDebug("all groups finished, cost:%" PRId64 "us", cost);
+
+_end:
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
+ pTaskInfo->code = code;
+ T_LONG_JMP(pTaskInfo->env, code);
+ }
+ (*ppRes) = (pResBlock->info.rows == 0) ? NULL : pResBlock;
+ return code;
+}
+
+static int32_t forecastParseOutput(SForecastSupp* pSupp, SExprSupp* pExprSup) {
+ pSupp->resLowSlot = -1;
+ pSupp->resHighSlot = -1;
+ pSupp->resTsSlot = -1;
+ pSupp->resValSlot = -1;
+
+ for (int32_t j = 0; j < pExprSup->numOfExprs; ++j) {
+ SExprInfo* pExprInfo = &pExprSup->pExprInfo[j];
+ int32_t dstSlot = pExprInfo->base.resSchema.slotId;
+ if (pExprInfo->pExpr->_function.functionType == FUNCTION_TYPE_FORECAST) {
+ pSupp->resValSlot = dstSlot;
+ } else if (pExprInfo->pExpr->_function.functionType == FUNCTION_TYPE_FORECAST_ROWTS) {
+ pSupp->resTsSlot = dstSlot;
+ } else if (pExprInfo->pExpr->_function.functionType == FUNCTION_TYPE_FORECAST_LOW) {
+ pSupp->resLowSlot = dstSlot;
+ } else if (pExprInfo->pExpr->_function.functionType == FUNCTION_TYPE_FORECAST_HIGH) {
+ pSupp->resHighSlot = dstSlot;
+ } else {
+ }
+ }
+
+ return 0;
+}
+
+static int32_t forecastParseInput(SForecastSupp* pSupp, SNodeList* pFuncs) {
+ SNode* pNode = NULL;
+
+ pSupp->inputTsSlot = -1;
+ pSupp->inputValSlot = -1;
+ pSupp->inputValType = -1;
+ pSupp->inputPrecision = -1;
+
+ FOREACH(pNode, pFuncs) {
+ if ((nodeType(pNode) == QUERY_NODE_TARGET) && (nodeType(((STargetNode*)pNode)->pExpr) == QUERY_NODE_FUNCTION)) {
+ SFunctionNode* pFunc = (SFunctionNode*)((STargetNode*)pNode)->pExpr;
+ int32_t numOfParam = LIST_LENGTH(pFunc->pParameterList);
+
+ if (pFunc->funcType == FUNCTION_TYPE_FORECAST) {
+ if (numOfParam == 3) {
+ SNode* p1 = nodesListGetNode(pFunc->pParameterList, 0);
+ SNode* p2 = nodesListGetNode(pFunc->pParameterList, 1);
+ SNode* p3 = nodesListGetNode(pFunc->pParameterList, 2);
+ if (p1 == NULL || p2 == NULL || p3 == NULL) return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ if (p1->type != QUERY_NODE_COLUMN) return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ if (p2->type != QUERY_NODE_VALUE) return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ if (p3->type != QUERY_NODE_COLUMN) return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ SColumnNode* pValNode = (SColumnNode*)p1;
+ SValueNode* pOptNode = (SValueNode*)p2;
+ SColumnNode* pTsNode = (SColumnNode*)p3;
+ pSupp->inputTsSlot = pTsNode->slotId;
+ pSupp->inputPrecision = pTsNode->node.resType.precision;
+ pSupp->inputValSlot = pValNode->slotId;
+ pSupp->inputValType = pValNode->node.resType.type;
+ tstrncpy(pSupp->algoOpt, pOptNode->literal, sizeof(pSupp->algoOpt));
+ } else if (numOfParam == 2) {
+ SNode* p1 = nodesListGetNode(pFunc->pParameterList, 0);
+ SNode* p2 = nodesListGetNode(pFunc->pParameterList, 1);
+ if (p1 == NULL || p2 == NULL) return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ if (p1->type != QUERY_NODE_COLUMN) return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ if (p2->type != QUERY_NODE_COLUMN) return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ SColumnNode* pValNode = (SColumnNode*)p1;
+ SColumnNode* pTsNode = (SColumnNode*)p2;
+ pSupp->inputTsSlot = pTsNode->slotId;
+ pSupp->inputPrecision = pTsNode->node.resType.precision;
+ pSupp->inputValSlot = pValNode->slotId;
+ pSupp->inputValType = pValNode->node.resType.type;
+ tstrncpy(pSupp->algoOpt, "algo=arima", TSDB_ANAL_ALGO_OPTION_LEN);
+ } else {
+ return TSDB_CODE_PLAN_INTERNAL_ERROR;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+static int32_t forecastParseAlgo(SForecastSupp* pSupp) {
+ pSupp->maxTs = 0;
+ pSupp->minTs = INT64_MAX;
+ pSupp->numOfRows = 0;
+
+ if (!taosAnalGetOptStr(pSupp->algoOpt, "algo", pSupp->algoName, sizeof(pSupp->algoName))) {
+ qError("failed to get forecast algorithm name from %s", pSupp->algoOpt);
+ return TSDB_CODE_ANAL_ALGO_NOT_FOUND;
+ }
+
+ if (taosAnalGetAlgoUrl(pSupp->algoName, ANAL_ALGO_TYPE_FORECAST, pSupp->algoUrl, sizeof(pSupp->algoUrl)) != 0) {
+ qError("failed to get forecast algorithm url from %s", pSupp->algoName);
+ return TSDB_CODE_ANAL_ALGO_NOT_LOAD;
+ }
+
+ return 0;
+}
+
+static int32_t forecastCreateBuf(SForecastSupp* pSupp) {
+ SAnalBuf* pBuf = &pSupp->analBuf;
+ int64_t ts = 0; // taosGetTimestampMs();
+
+ pBuf->bufType = ANAL_BUF_TYPE_JSON_COL;
+ snprintf(pBuf->fileName, sizeof(pBuf->fileName), "%s/tdengine-forecast-%" PRId64, tsTempDir, ts);
+ int32_t code = tsosAnalBufOpen(pBuf, 2);
+ if (code != 0) goto _OVER;
+
+ code = taosAnalBufWriteColMeta(pBuf, 0, TSDB_DATA_TYPE_TIMESTAMP, "ts");
+ if (code != 0) goto _OVER;
+
+ code = taosAnalBufWriteColMeta(pBuf, 1, pSupp->inputValType, "val");
+ if (code != 0) goto _OVER;
+
+ code = taosAnalBufWriteDataBegin(pBuf);
+ if (code != 0) goto _OVER;
+
+ for (int32_t i = 0; i < 2; ++i) {
+ code = taosAnalBufWriteColBegin(pBuf, i);
+ if (code != 0) goto _OVER;
+ }
+
+_OVER:
+ if (code != 0) {
+ (void)taosAnalBufClose(pBuf);
+ taosAnalBufDestroy(pBuf);
+ }
+ return code;
+}
+
+int32_t createForecastOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo,
+ SOperatorInfo** pOptrInfo) {
+ QRY_PARAM_CHECK(pOptrInfo);
+
+ int32_t code = 0;
+ int32_t lino = 0;
+ SForecastOperatorInfo* pInfo = taosMemoryCalloc(1, sizeof(SForecastOperatorInfo));
+ SOperatorInfo* pOperator = taosMemoryCalloc(1, sizeof(SOperatorInfo));
+ if (pOperator == NULL || pInfo == NULL) {
+ code = terrno;
+ goto _error;
+ }
+
+ SForecastSupp* pSupp = &pInfo->forecastSupp;
+ SForecastFuncPhysiNode* pForecastPhyNode = (SForecastFuncPhysiNode*)pPhyNode;
+ SExprSupp* pExprSup = &pOperator->exprSupp;
+ int32_t numOfExprs = 0;
+ SExprInfo* pExprInfo = NULL;
+
+ code = createExprInfo(pForecastPhyNode->pFuncs, NULL, &pExprInfo, &numOfExprs);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ code = initExprSupp(pExprSup, pExprInfo, numOfExprs, &pTaskInfo->storageAPI.functionStore);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ if (pForecastPhyNode->pExprs != NULL) {
+ int32_t num = 0;
+ SExprInfo* pScalarExprInfo = NULL;
+ code = createExprInfo(pForecastPhyNode->pExprs, NULL, &pScalarExprInfo, &num);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ code = initExprSupp(&pInfo->scalarSup, pScalarExprInfo, num, &pTaskInfo->storageAPI.functionStore);
+ QUERY_CHECK_CODE(code, lino, _error);
+ }
+
+ code = filterInitFromNode((SNode*)pForecastPhyNode->node.pConditions, &pOperator->exprSupp.pFilterInfo, 0);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ code = forecastParseInput(pSupp, pForecastPhyNode->pFuncs);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ code = forecastParseOutput(pSupp, pExprSup);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ code = forecastParseAlgo(pSupp);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ code = forecastCreateBuf(pSupp);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ initResultSizeInfo(&pOperator->resultInfo, 4096);
+
+ pInfo->pRes = createDataBlockFromDescNode(pPhyNode->pOutputDataBlockDesc);
+ QUERY_CHECK_NULL(pInfo->pRes, code, lino, _error, terrno);
+
+ setOperatorInfo(pOperator, "ForecastOperator", QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC, false, OP_NOT_OPENED, pInfo,
+ pTaskInfo);
+ pOperator->fpSet = createOperatorFpSet(optrDummyOpenFn, forecastNext, NULL, destroyForecastInfo, optrDefaultBufFn,
+ NULL, optrDefaultGetNextExtFn, NULL);
+
+ code = blockDataEnsureCapacity(pInfo->pRes, pOperator->resultInfo.capacity);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ code = appendDownstream(pOperator, &downstream, 1);
+ QUERY_CHECK_CODE(code, lino, _error);
+
+ *pOptrInfo = pOperator;
+
+ qDebug("forecast env is initialized, option:%s", pSupp->algoOpt);
+ return TSDB_CODE_SUCCESS;
+
+_error:
+ if (code != TSDB_CODE_SUCCESS) {
+ qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
+ }
+ if (pInfo != NULL) destroyForecastInfo(pInfo);
+ destroyOperatorAndDownstreams(pOperator, &downstream, 1);
+ pTaskInfo->code = code;
+ return code;
+}
+
+static void destroyForecastInfo(void* param) {
+ SForecastOperatorInfo* pInfo = (SForecastOperatorInfo*)param;
+
+ blockDataDestroy(pInfo->pRes);
+ pInfo->pRes = NULL;
+ cleanupExprSupp(&pInfo->scalarSup);
+ taosAnalBufDestroy(&pInfo->forecastSupp.analBuf);
+ taosMemoryFreeClear(param);
+}
+
+#else
+
+int32_t createForecastOperatorInfo(SOperatorInfo* downstream, SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo,
+ SOperatorInfo** pOptrInfo) {
+ return TSDB_CODE_OPS_NOT_SUPPORT;
+}
+
+#endif
diff --git a/source/libs/executor/src/groupcacheoperator.c b/source/libs/executor/src/groupcacheoperator.c
index 648a2ea6d2..10b372319b 100644
--- a/source/libs/executor/src/groupcacheoperator.c
+++ b/source/libs/executor/src/groupcacheoperator.c
@@ -84,9 +84,9 @@ static void logGroupCacheExecInfo(SGroupCacheOperatorInfo* pGrpCacheOperator) {
if (NULL == buf) {
return;
}
- int32_t offset = snprintf(buf, bufSize, "groupCache exec info, downstreamBlkNum:");
+ int32_t offset = tsnprintf(buf, bufSize, "groupCache exec info, downstreamBlkNum:");
for (int32_t i = 0; i < pGrpCacheOperator->downstreamNum; ++i) {
- offset += snprintf(buf + offset, bufSize, " %" PRId64 , pGrpCacheOperator->execInfo.pDownstreamBlkNum[i]);
+ offset += tsnprintf(buf + offset, bufSize, " %" PRId64 , pGrpCacheOperator->execInfo.pDownstreamBlkNum[i]);
}
qDebug("%s", buf);
taosMemoryFree(buf);
diff --git a/source/libs/executor/src/operator.c b/source/libs/executor/src/operator.c
index 8daf4695db..7914f9f320 100644
--- a/source/libs/executor/src/operator.c
+++ b/source/libs/executor/src/operator.c
@@ -619,6 +619,8 @@ int32_t createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHand
code = createIndefinitOutputOperatorInfo(ops[0], pPhyNode, pTaskInfo, &pOptr);
} else if (QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC == type) {
code = createTimeSliceOperatorInfo(ops[0], pPhyNode, pTaskInfo, &pOptr);
+ } else if (QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC == type) {
+ code = createForecastOperatorInfo(ops[0], pPhyNode, pTaskInfo, &pOptr);
} else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_EVENT == type) {
code = createEventwindowOperatorInfo(ops[0], pPhyNode, pTaskInfo, &pOptr);
} else if (QUERY_NODE_PHYSICAL_PLAN_GROUP_CACHE == type) {
@@ -629,6 +631,8 @@ int32_t createOperator(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo, SReadHand
code = createStreamCountAggOperatorInfo(ops[0], pPhyNode, pTaskInfo, pHandle, &pOptr);
} else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT == type) {
code = createCountwindowOperatorInfo(ops[0], pPhyNode, pTaskInfo, &pOptr);
+ } else if (QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY == type) {
+ code = createAnomalywindowOperatorInfo(ops[0], pPhyNode, pTaskInfo, &pOptr);
} else {
code = TSDB_CODE_INVALID_PARA;
pTaskInfo->code = code;
diff --git a/source/libs/executor/src/streamtimewindowoperator.c b/source/libs/executor/src/streamtimewindowoperator.c
index be27f277c0..fc919dfe5f 100644
--- a/source/libs/executor/src/streamtimewindowoperator.c
+++ b/source/libs/executor/src/streamtimewindowoperator.c
@@ -2006,6 +2006,12 @@ int32_t createStreamFinalIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiN
pInfo->stateStore = pTaskInfo->storageAPI.stateStore;
int32_t funResSize = getMaxFunResSize(&pOperator->exprSupp, numOfCols);
pInfo->pState->pFileState = NULL;
+
+ // used for backward compatibility of function's result info
+ pInfo->pState->pResultRowStore.resultRowGet = getResultRowFromBuf;
+ pInfo->pState->pResultRowStore.resultRowPut = putResultRowToBuf;
+ pInfo->pState->pExprSupp = &pOperator->exprSupp;
+
code =
pAPI->stateStore.streamFileStateInit(tsStreamBufferSize, sizeof(SWinKey), pInfo->aggSup.resultRowSize, funResSize,
compareTs, pInfo->pState, pInfo->twAggSup.deleteMark, GET_TASKID(pTaskInfo),
@@ -2223,6 +2229,12 @@ int32_t initStreamAggSupporter(SStreamAggSupporter* pSup, SExprSupp* pExpSup, in
pSup->stateStore.streamStateSetNumber(pSup->pState, -1, tsIndex);
int32_t funResSize = getMaxFunResSize(pExpSup, numOfOutput);
pSup->pState->pFileState = NULL;
+
+ // used for backward compatibility of function's result info
+ pSup->pState->pResultRowStore.resultRowGet = getResultRowFromBuf;
+ pSup->pState->pResultRowStore.resultRowPut = putResultRowToBuf;
+ pSup->pState->pExprSupp = pExpSup;
+
code = pSup->stateStore.streamFileStateInit(tsStreamBufferSize, sizeof(SSessionKey), pSup->resultRowSize, funResSize,
sesionTs, pSup->pState, pTwAggSup->deleteMark, taskIdStr,
pHandle->checkpointId, STREAM_STATE_BUFF_SORT, &pSup->pState->pFileState);
@@ -5385,6 +5397,12 @@ int32_t createStreamIntervalOperatorInfo(SOperatorInfo* downstream, SPhysiNode*
pInfo->stateStore = pTaskInfo->storageAPI.stateStore;
pInfo->pState->pFileState = NULL;
+
+ // used for backward compatibility of function's result info
+ pInfo->pState->pResultRowStore.resultRowGet = getResultRowFromBuf;
+ pInfo->pState->pResultRowStore.resultRowPut = putResultRowToBuf;
+ pInfo->pState->pExprSupp = &pOperator->exprSupp;
+
code = pTaskInfo->storageAPI.stateStore.streamFileStateInit(
tsStreamBufferSize, sizeof(SWinKey), pInfo->aggSup.resultRowSize, funResSize, compareTs, pInfo->pState,
pInfo->twAggSup.deleteMark, GET_TASKID(pTaskInfo), pHandle->checkpointId, STREAM_STATE_BUFF_HASH,
diff --git a/source/libs/function/inc/builtinsimpl.h b/source/libs/function/inc/builtinsimpl.h
index 970bdc6305..36e53d0a80 100644
--- a/source/libs/function/inc/builtinsimpl.h
+++ b/source/libs/function/inc/builtinsimpl.h
@@ -116,6 +116,8 @@ int32_t diffFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo);
int32_t diffFunction(SqlFunctionCtx* pCtx);
int32_t diffFunctionByRow(SArray* pCtx);
+bool getForecastConfEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv);
+
bool getDerivativeFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv);
int32_t derivativeFuncSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo);
int32_t derivativeFunction(SqlFunctionCtx* pCtx);
diff --git a/source/libs/function/inc/functionMgtInt.h b/source/libs/function/inc/functionMgtInt.h
index a50562d78d..3112245de9 100644
--- a/source/libs/function/inc/functionMgtInt.h
+++ b/source/libs/function/inc/functionMgtInt.h
@@ -58,6 +58,7 @@ extern "C" {
#define FUNC_MGT_TSMA_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(29)
#define FUNC_MGT_COUNT_LIKE_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(30) // funcs that should also return 0 when no rows found
#define FUNC_MGT_PROCESS_BY_ROW FUNC_MGT_FUNC_CLASSIFICATION_MASK(31)
+#define FUNC_MGT_FORECAST_PC_FUNC FUNC_MGT_FUNC_CLASSIFICATION_MASK(32)
#define FUNC_MGT_TEST_MASK(val, mask) (((val) & (mask)) != 0)
diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c
index 48b8f0d9c8..1fd99125a0 100644
--- a/source/libs/function/src/builtins.c
+++ b/source/libs/function/src/builtins.c
@@ -19,6 +19,7 @@
#include "geomFunc.h"
#include "querynodes.h"
#include "scalar.h"
+#include "tanal.h"
#include "taoserror.h"
#include "ttime.h"
@@ -2078,6 +2079,47 @@ static int32_t translateMode(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
return translateUniqueMode(pFunc, pErrBuf, len, false);
}
+static int32_t translateForecast(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
+ int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList);
+ if (2 != numOfParams && 1 != numOfParams) {
+ return invaildFuncParaNumErrMsg(pErrBuf, len, "FORECAST require 1 or 2 parameters");
+ }
+
+ uint8_t valType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 0))->type;
+ if (!IS_MATHABLE_TYPE(valType)) {
+ return invaildFuncParaTypeErrMsg(pErrBuf, len, "FORECAST only support mathable column");
+ }
+
+ if (numOfParams == 2) {
+ uint8_t optionType = getSDataTypeFromNode(nodesListGetNode(pFunc->pParameterList, 1))->type;
+ if (TSDB_DATA_TYPE_BINARY != optionType) {
+ return invaildFuncParaTypeErrMsg(pErrBuf, len, "FORECAST option should be varchar");
+ }
+
+ SNode* pOption = nodesListGetNode(pFunc->pParameterList, 1);
+ if (QUERY_NODE_VALUE != nodeType(pOption)) {
+ return invaildFuncParaTypeErrMsg(pErrBuf, len, "FORECAST option should be value");
+ }
+
+ SValueNode* pValue = (SValueNode*)pOption;
+ if (!taosAnalGetOptStr(pValue->literal, "algo", NULL, 0) != 0) {
+ return invaildFuncParaValueErrMsg(pErrBuf, len, "FORECAST option should include algo field");
+ }
+
+ pValue->notReserved = true;
+ }
+
+ pFunc->node.resType = (SDataType){.bytes = tDataTypes[valType].bytes, .type = valType};
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t translateForecastConf(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
+ pFunc->node.resType = (SDataType){.bytes = tDataTypes[TSDB_DATA_TYPE_FLOAT].bytes, .type = TSDB_DATA_TYPE_FLOAT};
+ return TSDB_CODE_SUCCESS;
+}
+
+static EFuncReturnRows forecastEstReturnRows(SFunctionNode* pFunc) { return FUNC_RETURN_ROWS_N; }
+
static int32_t translateDiff(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
int32_t numOfParams = LIST_LENGTH(pFunc->pParameterList);
if (numOfParams > 2) {
@@ -4797,6 +4839,48 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.sprocessFunc = randFunction,
.finalizeFunc = NULL
},
+ {
+ .name = "forecast",
+ .type = FUNCTION_TYPE_FORECAST,
+ .classification = FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC |
+ FUNC_MGT_FORBID_STREAM_FUNC | FUNC_MGT_FORBID_SYSTABLE_FUNC | FUNC_MGT_KEEP_ORDER_FUNC | FUNC_MGT_PRIMARY_KEY_FUNC,
+ .translateFunc = translateForecast,
+ .getEnvFunc = getSelectivityFuncEnv,
+ .initFunc = functionSetup,
+ .processFunc = NULL,
+ .finalizeFunc = NULL,
+ .estimateReturnRowsFunc = forecastEstReturnRows,
+ },
+ {
+ .name = "_frowts",
+ .type = FUNCTION_TYPE_FORECAST_ROWTS,
+ .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_FORECAST_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC,
+ .translateFunc = translateTimePseudoColumn,
+ .getEnvFunc = getTimePseudoFuncEnv,
+ .initFunc = NULL,
+ .sprocessFunc = NULL,
+ .finalizeFunc = NULL
+ },
+ {
+ .name = "_flow",
+ .type = FUNCTION_TYPE_FORECAST_LOW,
+ .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_FORECAST_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC,
+ .translateFunc = translateForecastConf,
+ .getEnvFunc = getForecastConfEnv,
+ .initFunc = NULL,
+ .sprocessFunc = NULL,
+ .finalizeFunc = NULL
+ },
+ {
+ .name = "_fhigh",
+ .type = FUNCTION_TYPE_FORECAST_HIGH,
+ .classification = FUNC_MGT_PSEUDO_COLUMN_FUNC | FUNC_MGT_FORECAST_PC_FUNC | FUNC_MGT_KEEP_ORDER_FUNC,
+ .translateFunc = translateForecastConf,
+ .getEnvFunc = getForecastConfEnv,
+ .initFunc = NULL,
+ .sprocessFunc = NULL,
+ .finalizeFunc = NULL
+ },
};
// clang-format on
diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c
index 9f50e705ca..983fccac1e 100644
--- a/source/libs/function/src/builtinsimpl.c
+++ b/source/libs/function/src/builtinsimpl.c
@@ -19,6 +19,7 @@
#include "functionResInfoInt.h"
#include "query.h"
#include "querynodes.h"
+#include "tanal.h"
#include "tcompare.h"
#include "tdatablock.h"
#include "tdigest.h"
@@ -3342,6 +3343,11 @@ bool funcInputGetNextRowIndex(SInputColumnInfoData* pInput, int32_t from, bool f
}
}
+bool getForecastConfEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv) {
+ pEnv->calcMemSize = sizeof(float);
+ return true;
+}
+
int32_t diffResultIsNull(SqlFunctionCtx* pCtx, SFuncInputRow* pRow){
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
SDiffInfo* pDiffInfo = GET_ROWCELL_INTERBUF(pResInfo);
@@ -4734,10 +4740,10 @@ int32_t histogramFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t len;
char buf[512] = {0};
if (!pInfo->normalized) {
- len = snprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%" PRId64 "}",
+ len = tsnprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%" PRId64 "}",
pInfo->bins[i].lower, pInfo->bins[i].upper, pInfo->bins[i].count);
} else {
- len = snprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%lf}", pInfo->bins[i].lower,
+ len = tsnprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%lf}", pInfo->bins[i].lower,
pInfo->bins[i].upper, pInfo->bins[i].percentage);
}
varDataSetLen(buf, len);
@@ -6365,7 +6371,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
compRatio = pData->totalSize * 100 / (double)totalRawSize;
}
- int32_t len = snprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE,
+ int32_t len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE,
"Total_Blocks=[%d] Total_Size=[%.2f KiB] Average_size=[%.2f KiB] Compression_Ratio=[%.2f %c]",
pData->numOfBlocks, pData->totalSize / 1024.0, averageSize / 1024.0, compRatio, '%');
@@ -6380,7 +6386,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
avgRows = pData->totalRows / pData->numOfBlocks;
}
- len = snprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Block_Rows=[%" PRId64 "] MinRows=[%d] MaxRows=[%d] AvgRows=[%" PRId64 "]",
+ len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Block_Rows=[%" PRId64 "] MinRows=[%d] MaxRows=[%d] AvgRows=[%" PRId64 "]",
pData->totalRows, pData->minRows, pData->maxRows, avgRows);
varDataSetLen(st, len);
code = colDataSetVal(pColInfo, row++, st, false);
@@ -6388,14 +6394,14 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
return code;
}
- len = snprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Inmem_Rows=[%d] Stt_Rows=[%d] ", pData->numOfInmemRows, pData->numOfSttRows);
+ len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Inmem_Rows=[%d] Stt_Rows=[%d] ", pData->numOfInmemRows, pData->numOfSttRows);
varDataSetLen(st, len);
code = colDataSetVal(pColInfo, row++, st, false);
if (TSDB_CODE_SUCCESS != code) {
return code;
}
- len = snprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Total_Tables=[%d] Total_Filesets=[%d] Total_Vgroups=[%d]", pData->numOfTables,
+ len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "Total_Tables=[%d] Total_Filesets=[%d] Total_Vgroups=[%d]", pData->numOfTables,
pData->numOfFiles, pData->numOfVgroups);
varDataSetLen(st, len);
@@ -6404,7 +6410,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
return code;
}
- len = snprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE,
+ len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE,
"--------------------------------------------------------------------------------");
varDataSetLen(st, len);
code = colDataSetVal(pColInfo, row++, st, false);
@@ -6431,7 +6437,7 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t bucketRange = ceil(((double) (pData->defMaxRows - pData->defMinRows)) / numOfBuckets);
for (int32_t i = 0; i < tListLen(pData->blockRowsHisto); ++i) {
- len = snprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "%04d |", pData->defMinRows + bucketRange * (i + 1));
+ len = tsnprintf(varDataVal(st), sizeof(st) - VARSTR_HEADER_SIZE, "%04d |", pData->defMinRows + bucketRange * (i + 1));
int32_t num = 0;
if (pData->blockRowsHisto[i] > 0) {
@@ -6439,13 +6445,13 @@ int32_t blockDistFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
}
for (int32_t j = 0; j < num; ++j) {
- int32_t x = snprintf(varDataVal(st) + len, sizeof(st) - VARSTR_HEADER_SIZE - len, "%c", '|');
+ int32_t x = tsnprintf(varDataVal(st) + len, sizeof(st) - VARSTR_HEADER_SIZE - len, "%c", '|');
len += x;
}
if (pData->blockRowsHisto[i] > 0) {
double v = pData->blockRowsHisto[i] * 100.0 / pData->numOfBlocks;
- len += snprintf(varDataVal(st) + len, sizeof(st) - VARSTR_HEADER_SIZE - len, " %d (%.2f%c)", pData->blockRowsHisto[i], v, '%');
+ len += tsnprintf(varDataVal(st) + len, sizeof(st) - VARSTR_HEADER_SIZE - len, " %d (%.2f%c)", pData->blockRowsHisto[i], v, '%');
}
varDataSetLen(st, len);
diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c
index 6c67a888a2..aaa66441ee 100644
--- a/source/libs/function/src/functionMgt.c
+++ b/source/libs/function/src/functionMgt.c
@@ -232,6 +232,15 @@ bool fmIsInterpFunc(int32_t funcId) {
bool fmIsInterpPseudoColumnFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_INTERP_PC_FUNC); }
+bool fmIsForecastFunc(int32_t funcId) {
+ if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
+ return false;
+ }
+ return FUNCTION_TYPE_FORECAST == funcMgtBuiltins[funcId].type;
+}
+
+bool fmIsForecastPseudoColumnFunc(int32_t funcId) { return isSpecificClassifyFunc(funcId, FUNC_MGT_FORECAST_PC_FUNC); }
+
bool fmIsLastRowFunc(int32_t funcId) {
if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
return false;
diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c
index 5db8863311..b77ffb8d2c 100644
--- a/source/libs/nodes/src/nodesCloneFuncs.c
+++ b/source/libs/nodes/src/nodesCloneFuncs.c
@@ -368,6 +368,13 @@ static int32_t countWindowNodeCopy(const SCountWindowNode* pSrc, SCountWindowNod
return TSDB_CODE_SUCCESS;
}
+static int32_t anomalyWindowNodeCopy(const SAnomalyWindowNode* pSrc, SAnomalyWindowNode* pDst) {
+ CLONE_NODE_FIELD(pCol);
+ CLONE_NODE_FIELD(pExpr);
+ COPY_CHAR_ARRAY_FIELD(anomalyOpt);
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t sessionWindowNodeCopy(const SSessionWindowNode* pSrc, SSessionWindowNode* pDst) {
CLONE_NODE_FIELD_EX(pCol, SColumnNode*);
CLONE_NODE_FIELD_EX(pGap, SValueNode*);
@@ -622,6 +629,8 @@ static int32_t logicWindowCopy(const SWindowLogicNode* pSrc, SWindowLogicNode* p
COPY_SCALAR_FIELD(windowAlgo);
COPY_SCALAR_FIELD(windowCount);
COPY_SCALAR_FIELD(windowSliding);
+ CLONE_NODE_FIELD(pAnomalyExpr);
+ COPY_CHAR_ARRAY_FIELD(anomalyOpt);
return TSDB_CODE_SUCCESS;
}
@@ -674,6 +683,12 @@ static int32_t logicInterpFuncCopy(const SInterpFuncLogicNode* pSrc, SInterpFunc
return TSDB_CODE_SUCCESS;
}
+static int32_t logicForecastFuncCopy(const SForecastFuncLogicNode* pSrc, SForecastFuncLogicNode* pDst) {
+ COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
+ CLONE_NODE_LIST_FIELD(pFuncs);
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t logicGroupCacheCopy(const SGroupCacheLogicNode* pSrc, SGroupCacheLogicNode* pDst) {
COPY_BASE_OBJECT_FIELD(node, logicNodeCopy);
COPY_SCALAR_FIELD(grpColsMayBeNull);
@@ -937,6 +952,9 @@ int32_t nodesCloneNode(const SNode* pNode, SNode** ppNode) {
case QUERY_NODE_COUNT_WINDOW:
code = countWindowNodeCopy((const SCountWindowNode*)pNode, (SCountWindowNode*)pDst);
break;
+ case QUERY_NODE_ANOMALY_WINDOW:
+ code = anomalyWindowNodeCopy((const SAnomalyWindowNode*)pNode, (SAnomalyWindowNode*)pDst);
+ break;
case QUERY_NODE_SESSION_WINDOW:
code = sessionWindowNodeCopy((const SSessionWindowNode*)pNode, (SSessionWindowNode*)pDst);
break;
@@ -1021,6 +1039,9 @@ int32_t nodesCloneNode(const SNode* pNode, SNode** ppNode) {
case QUERY_NODE_LOGIC_PLAN_INTERP_FUNC:
code = logicInterpFuncCopy((const SInterpFuncLogicNode*)pNode, (SInterpFuncLogicNode*)pDst);
break;
+ case QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC:
+ code = logicForecastFuncCopy((const SForecastFuncLogicNode*)pNode, (SForecastFuncLogicNode*)pDst);
+ break;
case QUERY_NODE_LOGIC_PLAN_GROUP_CACHE:
code = logicGroupCacheCopy((const SGroupCacheLogicNode*)pNode, (SGroupCacheLogicNode*)pDst);
break;
diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c
index 4b3ca97bbf..0f67493094 100644
--- a/source/libs/nodes/src/nodesCodeFuncs.c
+++ b/source/libs/nodes/src/nodesCodeFuncs.c
@@ -97,6 +97,8 @@ const char* nodesNodeName(ENodeType type) {
return "WindowOffset";
case QUERY_NODE_COUNT_WINDOW:
return "CountWindow";
+ case QUERY_NODE_ANOMALY_WINDOW:
+ return "AnomalyWindow";
case QUERY_NODE_SET_OPERATOR:
return "SetOperator";
case QUERY_NODE_SELECT_STMT:
@@ -153,6 +155,12 @@ const char* nodesNodeName(ENodeType type) {
return "CreateQnodeStmt";
case QUERY_NODE_DROP_QNODE_STMT:
return "DropQnodeStmt";
+ case QUERY_NODE_CREATE_ANODE_STMT:
+ return "CreateAnodeStmt";
+ case QUERY_NODE_DROP_ANODE_STMT:
+ return "DropAnodeStmt";
+ case QUERY_NODE_UPDATE_ANODE_STMT:
+ return "UpdateAnodeStmt";
case QUERY_NODE_CREATE_SNODE_STMT:
return "CreateSnodeStmt";
case QUERY_NODE_DROP_SNODE_STMT:
@@ -213,6 +221,10 @@ const char* nodesNodeName(ENodeType type) {
return "ShowModulesStmt";
case QUERY_NODE_SHOW_QNODES_STMT:
return "ShowQnodesStmt";
+ case QUERY_NODE_SHOW_ANODES_STMT:
+ return "ShowAnodesStmt";
+ case QUERY_NODE_SHOW_ANODES_FULL_STMT:
+ return "ShowAnodesFullStmt";
case QUERY_NODE_SHOW_SNODES_STMT:
return "ShowSnodesStmt";
case QUERY_NODE_SHOW_BNODES_STMT:
@@ -328,6 +340,8 @@ const char* nodesNodeName(ENodeType type) {
return "LogicIndefRowsFunc";
case QUERY_NODE_LOGIC_PLAN_INTERP_FUNC:
return "LogicInterpFunc";
+ case QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC:
+ return "LogicForecastFunc";
case QUERY_NODE_LOGIC_PLAN_GROUP_CACHE:
return "LogicGroupCache";
case QUERY_NODE_LOGIC_PLAN_DYN_QUERY_CTRL:
@@ -362,6 +376,10 @@ const char* nodesNodeName(ENodeType type) {
return "PhysiMergeCountWindow";
case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
return "PhysiStreamCountWindow";
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY:
+ return "PhysiMergeAnomalyWindow";
+ case QUERY_NODE_PHYSICAL_PLAN_STREAM_ANOMALY:
+ return "PhysiStreamAnomalyWindow";
case QUERY_NODE_PHYSICAL_PLAN_PROJECT:
return "PhysiProject";
case QUERY_NODE_PHYSICAL_PLAN_MERGE_JOIN:
@@ -413,6 +431,8 @@ const char* nodesNodeName(ENodeType type) {
return "PhysiIndefRowsFunc";
case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC:
return "PhysiInterpFunc";
+ case QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC:
+ return "PhysiForecastFunc";
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
return "PhysiDispatch";
case QUERY_NODE_PHYSICAL_PLAN_INSERT:
@@ -1260,6 +1280,30 @@ static int32_t jsonToLogicInterpFuncNode(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkForecastFuncLogicPlanFuncs = "Funcs";
+
+static int32_t logicForecastFuncNodeToJson(const void* pObj, SJson* pJson) {
+ const SForecastFuncLogicNode* pNode = (const SForecastFuncLogicNode*)pObj;
+
+ int32_t code = logicPlanNodeToJson(pObj, pJson);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkForecastFuncLogicPlanFuncs, pNode->pFuncs);
+ }
+
+ return code;
+}
+
+static int32_t jsonToLogicForecastFuncNode(const SJson* pJson, void* pObj) {
+ SForecastFuncLogicNode* pNode = (SForecastFuncLogicNode*)pObj;
+
+ int32_t code = jsonToLogicPlanNode(pJson, pObj);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkForecastFuncLogicPlanFuncs, &pNode->pFuncs);
+ }
+
+ return code;
+}
+
static const char* jkGroupCacheLogicPlanGrpColsMayBeNull = "GroupColsMayBeNull";
static const char* jkGroupCacheLogicPlanGroupByUid = "GroupByUid";
static const char* jkGroupCacheLogicPlanGlobalGroup = "GlobalGroup";
@@ -3011,6 +3055,36 @@ static int32_t jsonToPhysiCountWindowNode(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkAnomalyWindowPhysiPlanAnomalyKey = "AnomalyKey";
+static const char* jkAnomalyWindowPhysiPlanAnomalyOption = "AnomalyOpt";
+
+static int32_t physiAnomalyWindowNodeToJson(const void* pObj, SJson* pJson) {
+ const SAnomalyWindowPhysiNode* pNode = (const SAnomalyWindowPhysiNode*)pObj;
+
+ int32_t code = physiWindowNodeToJson(pObj, pJson);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkAnomalyWindowPhysiPlanAnomalyKey, nodeToJson, pNode->pAnomalyKey);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkAnomalyWindowPhysiPlanAnomalyOption, pNode->anomalyOpt);
+ }
+ return code;
+}
+
+static int32_t jsonToPhysiAnomalyWindowNode(const SJson* pJson, void* pObj) {
+ SAnomalyWindowPhysiNode* pNode = (SAnomalyWindowPhysiNode*)pObj;
+
+ int32_t code = jsonToPhysiWindowNode(pJson, pObj);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkAnomalyWindowPhysiPlanAnomalyKey, &pNode->pAnomalyKey);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkAnomalyWindowPhysiPlanAnomalyOption, pNode->anomalyOpt);
+ }
+
+ return code;
+}
+
static const char* jkPartitionPhysiPlanExprs = "Exprs";
static const char* jkPartitionPhysiPlanPartitionKeys = "PartitionKeys";
static const char* jkPartitionPhysiPlanTargets = "Targets";
@@ -3198,6 +3272,37 @@ static int32_t jsonToPhysiInterpFuncNode(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkForecastFuncPhysiPlanExprs = "Exprs";
+static const char* jkForecastFuncPhysiPlanFuncs = "Funcs";
+
+static int32_t physiForecastFuncNodeToJson(const void* pObj, SJson* pJson) {
+ const SForecastFuncPhysiNode* pNode = (const SForecastFuncPhysiNode*)pObj;
+
+ int32_t code = physicPlanNodeToJson(pObj, pJson);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkForecastFuncPhysiPlanExprs, pNode->pExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = nodeListToJson(pJson, jkForecastFuncPhysiPlanFuncs, pNode->pFuncs);
+ }
+
+ return code;
+}
+
+static int32_t jsonToPhysiForecastFuncNode(const SJson* pJson, void* pObj) {
+ SForecastFuncPhysiNode* pNode = (SForecastFuncPhysiNode*)pObj;
+
+ int32_t code = jsonToPhysicPlanNode(pJson, pObj);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkForecastFuncPhysiPlanExprs, &pNode->pExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeList(pJson, jkForecastFuncPhysiPlanFuncs, &pNode->pFuncs);
+ }
+
+ return code;
+}
+
static const char* jkDataSinkInputDataBlockDesc = "InputDataBlockDesc";
static int32_t physicDataSinkNodeToJson(const void* pObj, SJson* pJson) {
@@ -4765,6 +4870,36 @@ static int32_t jsonToCountWindowNode(const SJson* pJson, void* pObj) {
return code;
}
+static const char* jkAnomalyWindowTsPrimaryKey = "AnomalyTsPrimaryKey";
+static const char* jkAnomalyWindowExpr = "AnomalyWindowExpr";
+static const char* jkAnomalyWindowOption = "AnomalyWindowOpt";
+
+static int32_t anomalyWindowNodeToJson(const void* pObj, SJson* pJson) {
+ const SAnomalyWindowNode* pNode = (const SAnomalyWindowNode*)pObj;
+
+ int32_t code = tjsonAddObject(pJson, jkAnomalyWindowTsPrimaryKey, nodeToJson, pNode->pCol);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddObject(pJson, jkAnomalyWindowExpr, nodeToJson, pNode->pExpr);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonAddStringToObject(pJson, jkAnomalyWindowOption, pNode->anomalyOpt);
+ }
+ return code;
+}
+
+static int32_t jsonToAnomalyWindowNode(const SJson* pJson, void* pObj) {
+ SAnomalyWindowNode* pNode = (SAnomalyWindowNode*)pObj;
+
+ int32_t code = jsonToNodeObject(pJson, jkAnomalyWindowTsPrimaryKey, &pNode->pCol);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = jsonToNodeObject(pJson, jkAnomalyWindowExpr, (SNode**)&pNode->pExpr);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tjsonGetStringValue(pJson, jkAnomalyWindowOption, pNode->anomalyOpt);
+ }
+ return code;
+}
+
static const char* jkIntervalWindowInterval = "Interval";
static const char* jkIntervalWindowOffset = "Offset";
static const char* jkIntervalWindowSliding = "Sliding";
@@ -6451,6 +6586,39 @@ static int32_t dropQnodeStmtToJson(const void* pObj, SJson* pJson) { return drop
static int32_t jsonToDropQnodeStmt(const SJson* pJson, void* pObj) { return jsonToDropComponentNodeStmt(pJson, pObj); }
+static const char* jkCreateAnodeStmtUrl = "Url";
+static const char* jkUpdateDropANodeStmtId = "AnodeId";
+
+static int32_t createAnodeStmtToJson(const void* pObj, SJson* pJson) {
+ const SCreateAnodeStmt* pNode = (const SCreateAnodeStmt*)pObj;
+ return tjsonAddStringToObject(pJson, jkCreateAnodeStmtUrl, pNode->url);
+}
+
+static int32_t jsonToCreateAnodeStmt(const SJson* pJson, void* pObj) {
+ SCreateAnodeStmt* pNode = (SCreateAnodeStmt*)pObj;
+ return tjsonGetStringValue(pJson, jkCreateAnodeStmtUrl, pNode->url);
+}
+
+static int32_t updateAnodeStmtToJson(const void* pObj, SJson* pJson) {
+ const SUpdateAnodeStmt* pNode = (const SUpdateAnodeStmt*)pObj;
+ return tjsonAddIntegerToObject(pJson, jkUpdateDropANodeStmtId, pNode->anodeId);
+}
+
+static int32_t jsonToUpdateAnodeStmt(const SJson* pJson, void* pObj) {
+ SUpdateAnodeStmt* pNode = (SUpdateAnodeStmt*)pObj;
+ return tjsonGetIntValue(pJson, jkUpdateDropANodeStmtId, &pNode->anodeId);
+}
+
+static int32_t dropAnodeStmtToJson(const void* pObj, SJson* pJson) {
+ const SDropAnodeStmt* pNode = (const SDropAnodeStmt*)pObj;
+ return tjsonAddIntegerToObject(pJson, jkUpdateDropANodeStmtId, pNode->anodeId);
+}
+
+static int32_t jsonToDropAnodeStmt(const SJson* pJson, void* pObj) {
+ SDropAnodeStmt* pNode = (SDropAnodeStmt*)pObj;
+ return tjsonGetIntValue(pJson, jkUpdateDropANodeStmtId, &pNode->anodeId);
+}
+
static int32_t createSnodeStmtToJson(const void* pObj, SJson* pJson) {
return createComponentNodeStmtToJson(pObj, pJson);
}
@@ -7016,6 +7184,14 @@ static int32_t showQnodesStmtToJson(const void* pObj, SJson* pJson) { return sho
static int32_t jsonToShowQnodesStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); }
+static int32_t showAnodesStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); }
+
+static int32_t jsonToShowAnodesStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); }
+
+static int32_t showAnodesFullStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); }
+
+static int32_t jsonToShowAnodesFullStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); }
+
static int32_t showArbGroupsStmtToJson(const void* pObj, SJson* pJson) { return showStmtToJson(pObj, pJson); }
static int32_t jsonToShowArbGroupsStmt(const SJson* pJson, void* pObj) { return jsonToShowStmt(pJson, pObj); }
@@ -7552,6 +7728,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return windowOffsetNodeToJson(pObj, pJson);
case QUERY_NODE_COUNT_WINDOW:
return countWindowNodeToJson(pObj, pJson);
+ case QUERY_NODE_ANOMALY_WINDOW:
+ return anomalyWindowNodeToJson(pObj, pJson);
case QUERY_NODE_SET_OPERATOR:
return setOperatorToJson(pObj, pJson);
case QUERY_NODE_SELECT_STMT:
@@ -7604,6 +7782,12 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return createQnodeStmtToJson(pObj, pJson);
case QUERY_NODE_DROP_QNODE_STMT:
return dropQnodeStmtToJson(pObj, pJson);
+ case QUERY_NODE_CREATE_ANODE_STMT:
+ return createAnodeStmtToJson(pObj, pJson);
+ case QUERY_NODE_DROP_ANODE_STMT:
+ return dropAnodeStmtToJson(pObj, pJson);
+ case QUERY_NODE_UPDATE_ANODE_STMT:
+ return updateAnodeStmtToJson(pObj, pJson);
case QUERY_NODE_CREATE_SNODE_STMT:
return createSnodeStmtToJson(pObj, pJson);
case QUERY_NODE_DROP_SNODE_STMT:
@@ -7654,6 +7838,10 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return showMnodesStmtToJson(pObj, pJson);
case QUERY_NODE_SHOW_QNODES_STMT:
return showQnodesStmtToJson(pObj, pJson);
+ case QUERY_NODE_SHOW_ANODES_STMT:
+ return showAnodesStmtToJson(pObj, pJson);
+ case QUERY_NODE_SHOW_ANODES_FULL_STMT:
+ return showAnodesFullStmtToJson(pObj, pJson);
case QUERY_NODE_SHOW_ARBGROUPS_STMT:
return showArbGroupsStmtToJson(pObj, pJson);
case QUERY_NODE_SHOW_CLUSTER_STMT:
@@ -7743,6 +7931,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return logicIndefRowsFuncNodeToJson(pObj, pJson);
case QUERY_NODE_LOGIC_PLAN_INTERP_FUNC:
return logicInterpFuncNodeToJson(pObj, pJson);
+ case QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC:
+ return logicForecastFuncNodeToJson(pObj, pJson);
case QUERY_NODE_LOGIC_PLAN_GROUP_CACHE:
return logicGroupCacheNodeToJson(pObj, pJson);
case QUERY_NODE_LOGIC_PLAN_DYN_QUERY_CTRL:
@@ -7803,6 +7993,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT:
case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
return physiCountWindowNodeToJson(pObj, pJson);
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY:
+ return physiAnomalyWindowNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
return physiPartitionNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION:
@@ -7811,6 +8003,8 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
return physiIndefRowsFuncNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC:
return physiInterpFuncNodeToJson(pObj, pJson);
+ case QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC:
+ return physiForecastFuncNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
return physiDispatchNodeToJson(pObj, pJson);
case QUERY_NODE_PHYSICAL_PLAN_INSERT:
@@ -7902,6 +8096,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToWindowOffsetNode(pJson, pObj);
case QUERY_NODE_COUNT_WINDOW:
return jsonToCountWindowNode(pJson, pObj);
+ case QUERY_NODE_ANOMALY_WINDOW:
+ return jsonToAnomalyWindowNode(pJson, pObj);
case QUERY_NODE_SET_OPERATOR:
return jsonToSetOperator(pJson, pObj);
case QUERY_NODE_SELECT_STMT:
@@ -8004,6 +8200,10 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToShowMnodesStmt(pJson, pObj);
case QUERY_NODE_SHOW_QNODES_STMT:
return jsonToShowQnodesStmt(pJson, pObj);
+ case QUERY_NODE_SHOW_ANODES_STMT:
+ return jsonToShowAnodesStmt(pJson, pObj);
+ case QUERY_NODE_SHOW_ANODES_FULL_STMT:
+ return jsonToShowAnodesFullStmt(pJson, pObj);
case QUERY_NODE_SHOW_ARBGROUPS_STMT:
return jsonToShowArbGroupsStmt(pJson, pObj);
case QUERY_NODE_SHOW_CLUSTER_STMT:
@@ -8101,6 +8301,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToLogicIndefRowsFuncNode(pJson, pObj);
case QUERY_NODE_LOGIC_PLAN_INTERP_FUNC:
return jsonToLogicInterpFuncNode(pJson, pObj);
+ case QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC:
+ return jsonToLogicForecastFuncNode(pJson, pObj);
case QUERY_NODE_LOGIC_PLAN_GROUP_CACHE:
return jsonToLogicGroupCacheNode(pJson, pObj);
case QUERY_NODE_LOGIC_PLAN_DYN_QUERY_CTRL:
@@ -8161,6 +8363,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT:
case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
return jsonToPhysiCountWindowNode(pJson, pObj);
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY:
+ return jsonToPhysiAnomalyWindowNode(pJson, pObj);
case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
return jsonToPhysiPartitionNode(pJson, pObj);
case QUERY_NODE_PHYSICAL_PLAN_STREAM_PARTITION:
@@ -8169,6 +8373,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return jsonToPhysiIndefRowsFuncNode(pJson, pObj);
case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC:
return jsonToPhysiInterpFuncNode(pJson, pObj);
+ case QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC:
+ return jsonToPhysiForecastFuncNode(pJson, pObj);
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
return jsonToPhysiDispatchNode(pJson, pObj);
case QUERY_NODE_PHYSICAL_PLAN_QUERY_INSERT:
diff --git a/source/libs/nodes/src/nodesMsgFuncs.c b/source/libs/nodes/src/nodesMsgFuncs.c
index 581c6222d2..3d8a57363b 100644
--- a/source/libs/nodes/src/nodesMsgFuncs.c
+++ b/source/libs/nodes/src/nodesMsgFuncs.c
@@ -3539,6 +3539,46 @@ static int32_t msgToPhysiCountWindowNode(STlvDecoder* pDecoder, void* pObj) {
return code;
}
+enum { PHY_ANOMALY_CODE_WINDOW = 1, PHY_ANOMALY_CODE_KEY, PHY_ANOMALY_CODE_WINDOW_OPTION };
+
+static int32_t physiAnomalyWindowNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SAnomalyWindowPhysiNode* pNode = (const SAnomalyWindowPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_ANOMALY_CODE_WINDOW, physiWindowNodeToMsg, &pNode->window);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_ANOMALY_CODE_KEY, nodeToMsg, pNode->pAnomalyKey);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeCStr(pEncoder, PHY_ANOMALY_CODE_WINDOW_OPTION, pNode->anomalyOpt);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiAnomalyWindowNode(STlvDecoder* pDecoder, void* pObj) {
+ SAnomalyWindowPhysiNode* pNode = (SAnomalyWindowPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_ANOMALY_CODE_WINDOW:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiWindowNode, &pNode->window);
+ break;
+ case PHY_ANOMALY_CODE_KEY:
+ code = msgToNodeFromTlv(pTlv, (void**)&pNode->pAnomalyKey);
+ break;
+ case PHY_ANOMALY_CODE_WINDOW_OPTION:
+ code = tlvDecodeCStr(pTlv, pNode->anomalyOpt, sizeof(pNode->anomalyOpt));
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
enum {
PHY_PARTITION_CODE_BASE_NODE = 1,
PHY_PARTITION_CODE_EXPR,
@@ -3770,6 +3810,50 @@ static int32_t msgToPhysiInterpFuncNode(STlvDecoder* pDecoder, void* pObj) {
return code;
}
+enum {
+ PHY_FORECAST_FUNC_CODE_BASE_NODE = 1,
+ PHY_FORECAST_FUNC_CODE_EXPR,
+ PHY_FORECAST_FUNC_CODE_FUNCS,
+};
+
+static int32_t physiForecastFuncNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
+ const SForecastFuncPhysiNode* pNode = (const SForecastFuncPhysiNode*)pObj;
+
+ int32_t code = tlvEncodeObj(pEncoder, PHY_FORECAST_FUNC_CODE_BASE_NODE, physiNodeToMsg, &pNode->node);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_FORECAST_FUNC_CODE_EXPR, nodeListToMsg, pNode->pExprs);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ code = tlvEncodeObj(pEncoder, PHY_FORECAST_FUNC_CODE_FUNCS, nodeListToMsg, pNode->pFuncs);
+ }
+
+ return code;
+}
+
+static int32_t msgToPhysiForecastFuncNode(STlvDecoder* pDecoder, void* pObj) {
+ SForecastFuncPhysiNode* pNode = (SForecastFuncPhysiNode*)pObj;
+
+ int32_t code = TSDB_CODE_SUCCESS;
+ STlv* pTlv = NULL;
+ tlvForEach(pDecoder, pTlv, code) {
+ switch (pTlv->type) {
+ case PHY_FORECAST_FUNC_CODE_BASE_NODE:
+ code = tlvDecodeObjFromTlv(pTlv, msgToPhysiNode, &pNode->node);
+ break;
+ case PHY_FORECAST_FUNC_CODE_EXPR:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pExprs);
+ break;
+ case PHY_FORECAST_FUNC_CODE_FUNCS:
+ code = msgToNodeListFromTlv(pTlv, (void**)&pNode->pFuncs);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return code;
+}
+
enum { PHY_DATA_SINK_CODE_INPUT_DESC = 1 };
static int32_t physicDataSinkNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
@@ -4536,6 +4620,9 @@ static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
code = physiCountWindowNodeToMsg(pObj, pEncoder);
break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY:
+ code = physiAnomalyWindowNodeToMsg(pObj, pEncoder);
+ break;
case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
code = physiPartitionNodeToMsg(pObj, pEncoder);
break;
@@ -4548,6 +4635,9 @@ static int32_t specificNodeToMsg(const void* pObj, STlvEncoder* pEncoder) {
case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC:
code = physiInterpFuncNodeToMsg(pObj, pEncoder);
break;
+ case QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC:
+ code = physiForecastFuncNodeToMsg(pObj, pEncoder);
+ break;
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
code = physiDispatchNodeToMsg(pObj, pEncoder);
break;
@@ -4698,6 +4788,9 @@ static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) {
case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
code = msgToPhysiCountWindowNode(pDecoder, pObj);
break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY:
+ code = msgToPhysiAnomalyWindowNode(pDecoder, pObj);
+ break;
case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
code = msgToPhysiPartitionNode(pDecoder, pObj);
break;
@@ -4710,6 +4803,9 @@ static int32_t msgToSpecificNode(STlvDecoder* pDecoder, void* pObj) {
case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC:
code = msgToPhysiInterpFuncNode(pDecoder, pObj);
break;
+ case QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC:
+ code = msgToPhysiForecastFuncNode(pDecoder, pObj);
+ break;
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
code = msgToPhysiDispatchNode(pDecoder, pObj);
break;
diff --git a/source/libs/nodes/src/nodesTraverseFuncs.c b/source/libs/nodes/src/nodesTraverseFuncs.c
index 4f30cb12b7..f3f7395a37 100644
--- a/source/libs/nodes/src/nodesTraverseFuncs.c
+++ b/source/libs/nodes/src/nodesTraverseFuncs.c
@@ -181,6 +181,14 @@ static EDealRes dispatchExpr(SNode* pNode, ETraversalOrder order, FNodeWalker wa
res = walkExpr(pEvent->pCol, order, walker, pContext);
break;
}
+ case QUERY_NODE_ANOMALY_WINDOW: {
+ SAnomalyWindowNode* pAnomaly = (SAnomalyWindowNode*)pNode;
+ res = walkExpr(pAnomaly->pExpr, order, walker, pContext);
+ if (DEAL_RES_ERROR != res && DEAL_RES_END != res) {
+ res = walkExpr(pAnomaly->pCol, order, walker, pContext);
+ }
+ break;
+ }
default:
break;
}
@@ -392,6 +400,14 @@ static EDealRes rewriteExpr(SNode** pRawNode, ETraversalOrder order, FNodeRewrit
res = rewriteExpr(&pEvent->pCol, order, rewriter, pContext);
break;
}
+ case QUERY_NODE_ANOMALY_WINDOW: {
+ SAnomalyWindowNode* pAnomaly = (SAnomalyWindowNode*)pNode;
+ res = rewriteExpr(&pAnomaly->pExpr, order, rewriter, pContext);
+ if (DEAL_RES_ERROR != res && DEAL_RES_END != res) {
+ res = rewriteExpr(&pAnomaly->pCol, order, rewriter, pContext);
+ }
+ break;
+ }
default:
break;
}
diff --git a/source/libs/nodes/src/nodesUtilFuncs.c b/source/libs/nodes/src/nodesUtilFuncs.c
index c7d21d6fde..31568149c9 100644
--- a/source/libs/nodes/src/nodesUtilFuncs.c
+++ b/source/libs/nodes/src/nodesUtilFuncs.c
@@ -419,6 +419,8 @@ int32_t nodesMakeNode(ENodeType type, SNode** ppNodeOut) {
code = makeNode(type, sizeof(SEventWindowNode), &pNode); break;
case QUERY_NODE_COUNT_WINDOW:
code = makeNode(type, sizeof(SCountWindowNode), &pNode); break;
+ case QUERY_NODE_ANOMALY_WINDOW:
+ code = makeNode(type, sizeof(SAnomalyWindowNode), &pNode); break;
case QUERY_NODE_HINT:
code = makeNode(type, sizeof(SHintNode), &pNode); break;
case QUERY_NODE_VIEW:
@@ -474,6 +476,12 @@ int32_t nodesMakeNode(ENodeType type, SNode** ppNodeOut) {
code = makeNode(type, sizeof(SDropDnodeStmt), &pNode); break;
case QUERY_NODE_ALTER_DNODE_STMT:
code = makeNode(type, sizeof(SAlterDnodeStmt), &pNode); break;
+ case QUERY_NODE_CREATE_ANODE_STMT:
+ code = makeNode(type, sizeof(SCreateAnodeStmt), &pNode); break;
+ case QUERY_NODE_DROP_ANODE_STMT:
+ code = makeNode(type, sizeof(SDropAnodeStmt), &pNode); break;
+ case QUERY_NODE_UPDATE_ANODE_STMT:
+ code = makeNode(type, sizeof(SUpdateAnodeStmt), &pNode); break;
case QUERY_NODE_CREATE_INDEX_STMT:
code = makeNode(type, sizeof(SCreateIndexStmt), &pNode); break;
case QUERY_NODE_DROP_INDEX_STMT:
@@ -540,6 +548,8 @@ int32_t nodesMakeNode(ENodeType type, SNode** ppNodeOut) {
case QUERY_NODE_SHOW_MNODES_STMT:
case QUERY_NODE_SHOW_MODULES_STMT:
case QUERY_NODE_SHOW_QNODES_STMT:
+ case QUERY_NODE_SHOW_ANODES_STMT:
+ case QUERY_NODE_SHOW_ANODES_FULL_STMT:
case QUERY_NODE_SHOW_SNODES_STMT:
case QUERY_NODE_SHOW_BNODES_STMT:
case QUERY_NODE_SHOW_ARBGROUPS_STMT:
@@ -647,6 +657,8 @@ int32_t nodesMakeNode(ENodeType type, SNode** ppNodeOut) {
code = makeNode(type, sizeof(SIndefRowsFuncLogicNode), &pNode); break;
case QUERY_NODE_LOGIC_PLAN_INTERP_FUNC:
code = makeNode(type, sizeof(SInterpFuncLogicNode), &pNode); break;
+ case QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC:
+ code = makeNode(type, sizeof(SForecastFuncLogicNode), &pNode); break;
case QUERY_NODE_LOGIC_PLAN_GROUP_CACHE:
code = makeNode(type, sizeof(SGroupCacheLogicNode), &pNode); break;
case QUERY_NODE_LOGIC_PLAN_DYN_QUERY_CTRL:
@@ -722,6 +734,8 @@ int32_t nodesMakeNode(ENodeType type, SNode** ppNodeOut) {
code = makeNode(type, sizeof(SStreamEventWinodwPhysiNode), &pNode); break;
case QUERY_NODE_PHYSICAL_PLAN_MERGE_COUNT:
code = makeNode(type, sizeof(SCountWinodwPhysiNode), &pNode); break;
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY:
+ code = makeNode(type, sizeof(SAnomalyWindowPhysiNode), &pNode); break;
case QUERY_NODE_PHYSICAL_PLAN_STREAM_COUNT:
code = makeNode(type, sizeof(SStreamCountWinodwPhysiNode), &pNode); break;
case QUERY_NODE_PHYSICAL_PLAN_PARTITION:
@@ -732,6 +746,8 @@ int32_t nodesMakeNode(ENodeType type, SNode** ppNodeOut) {
code = makeNode(type, sizeof(SIndefRowsFuncPhysiNode), &pNode); break;
case QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC:
code = makeNode(type, sizeof(SInterpFuncLogicNode), &pNode); break;
+ case QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC:
+ code = makeNode(type, sizeof(SForecastFuncLogicNode), &pNode); break;
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
code = makeNode(type, sizeof(SDataDispatcherNode), &pNode); break;
case QUERY_NODE_PHYSICAL_PLAN_INSERT:
@@ -1019,6 +1035,11 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode(pEvent->pCol);
break;
}
+ case QUERY_NODE_ANOMALY_WINDOW: {
+ SAnomalyWindowNode* pAnomaly = (SAnomalyWindowNode*)pNode;
+ nodesDestroyNode(pAnomaly->pCol);
+ break;
+ }
case QUERY_NODE_HINT: {
SHintNode* pHint = (SHintNode*)pNode;
destroyHintValue(pHint->option, pHint->value);
@@ -1167,6 +1188,9 @@ void nodesDestroyNode(SNode* pNode) {
case QUERY_NODE_CREATE_DNODE_STMT: // no pointer field
case QUERY_NODE_DROP_DNODE_STMT: // no pointer field
case QUERY_NODE_ALTER_DNODE_STMT: // no pointer field
+ case QUERY_NODE_CREATE_ANODE_STMT: // no pointer field
+ case QUERY_NODE_UPDATE_ANODE_STMT: // no pointer field
+ case QUERY_NODE_DROP_ANODE_STMT: // no pointer field
break;
case QUERY_NODE_CREATE_INDEX_STMT: {
SCreateIndexStmt* pStmt = (SCreateIndexStmt*)pNode;
@@ -1252,6 +1276,8 @@ void nodesDestroyNode(SNode* pNode) {
case QUERY_NODE_SHOW_MNODES_STMT:
case QUERY_NODE_SHOW_MODULES_STMT:
case QUERY_NODE_SHOW_QNODES_STMT:
+ case QUERY_NODE_SHOW_ANODES_STMT:
+ case QUERY_NODE_SHOW_ANODES_FULL_STMT:
case QUERY_NODE_SHOW_SNODES_STMT:
case QUERY_NODE_SHOW_BNODES_STMT:
case QUERY_NODE_SHOW_ARBGROUPS_STMT:
@@ -1500,6 +1526,12 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode(pLogicNode->pTimeSeries);
break;
}
+ case QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC: {
+ SForecastFuncLogicNode* pLogicNode = (SForecastFuncLogicNode*)pNode;
+ destroyLogicNode((SLogicNode*)pLogicNode);
+ nodesDestroyList(pLogicNode->pFuncs);
+ break;
+ }
case QUERY_NODE_LOGIC_PLAN_GROUP_CACHE: {
SGroupCacheLogicNode* pLogicNode = (SGroupCacheLogicNode*)pNode;
destroyLogicNode((SLogicNode*)pLogicNode);
@@ -1663,6 +1695,11 @@ void nodesDestroyNode(SNode* pNode) {
destroyWinodwPhysiNode((SWindowPhysiNode*)pPhyNode);
break;
}
+ case QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY: {
+ SAnomalyWindowPhysiNode* pPhyNode = (SAnomalyWindowPhysiNode*)pNode;
+ destroyWinodwPhysiNode((SWindowPhysiNode*)pPhyNode);
+ break;
+ }
case QUERY_NODE_PHYSICAL_PLAN_PARTITION: {
destroyPartitionPhysiNode((SPartitionPhysiNode*)pNode);
break;
@@ -1690,6 +1727,13 @@ void nodesDestroyNode(SNode* pNode) {
nodesDestroyNode(pPhyNode->pTimeSeries);
break;
}
+ case QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC: {
+ SForecastFuncPhysiNode* pPhyNode = (SForecastFuncPhysiNode*)pNode;
+ destroyPhysiNode((SPhysiNode*)pPhyNode);
+ nodesDestroyList(pPhyNode->pExprs);
+ nodesDestroyList(pPhyNode->pFuncs);
+ break;
+ }
case QUERY_NODE_PHYSICAL_PLAN_DISPATCH:
destroyDataSinkNode((SDataSinkNode*)pNode);
break;
diff --git a/source/libs/parser/inc/parAst.h b/source/libs/parser/inc/parAst.h
index a2aec77c2e..28e867965f 100644
--- a/source/libs/parser/inc/parAst.h
+++ b/source/libs/parser/inc/parAst.h
@@ -154,6 +154,7 @@ SNode* createSessionWindowNode(SAstCreateContext* pCxt, SNode* pCol, SNode*
SNode* createStateWindowNode(SAstCreateContext* pCxt, SNode* pExpr);
SNode* createEventWindowNode(SAstCreateContext* pCxt, SNode* pStartCond, SNode* pEndCond);
SNode* createCountWindowNode(SAstCreateContext* pCxt, const SToken* pCountToken, const SToken* pSlidingToken);
+SNode* createAnomalyWindowNode(SAstCreateContext* pCxt, SNode* pExpr, const SToken* pFuncOpt);
SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding,
SNode* pFill);
SNode* createWindowOffsetNode(SAstCreateContext* pCxt, SNode* pStartOffset, SNode* pEndOffset);
@@ -251,6 +252,9 @@ SNode* createDropUserStmt(SAstCreateContext* pCxt, SToken* pUserName);
SNode* createCreateDnodeStmt(SAstCreateContext* pCxt, const SToken* pFqdn, const SToken* pPort);
SNode* createDropDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, bool force, bool unsafe);
SNode* createAlterDnodeStmt(SAstCreateContext* pCxt, const SToken* pDnode, const SToken* pConfig, const SToken* pValue);
+SNode* createCreateAnodeStmt(SAstCreateContext* pCxt, const SToken* pUrl);
+SNode* createDropAnodeStmt(SAstCreateContext* pCxt, const SToken* pAnode);
+SNode* createUpdateAnodeStmt(SAstCreateContext* pCxt, const SToken* pAnode, bool updateAll);
SNode* createEncryptKeyStmt(SAstCreateContext* pCxt, const SToken* pValue);
SNode* createRealTableNodeForIndexName(SAstCreateContext* pCxt, SToken* pDbName, SToken* pIndexName);
SNode* createCreateIndexStmt(SAstCreateContext* pCxt, EIndexType type, bool ignoreExists, SNode* pIndexName,
diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y
index ae908f0826..99f301445a 100644
--- a/source/libs/parser/inc/sql.y
+++ b/source/libs/parser/inc/sql.y
@@ -157,6 +157,12 @@ with_clause_opt(A) ::= WITH search_condition(B).
/************************************************ create encrypt_key *********************************************/
cmd ::= CREATE ENCRYPT_KEY NK_STRING(A). { pCxt->pRootNode = createEncryptKeyStmt(pCxt, &A); }
+/************************************************ create drop update anode ***************************************/
+cmd ::= CREATE ANODE NK_STRING(A). { pCxt->pRootNode = createCreateAnodeStmt(pCxt, &A); }
+cmd ::= UPDATE ANODE NK_INTEGER(A). { pCxt->pRootNode = createUpdateAnodeStmt(pCxt, &A, false); }
+cmd ::= UPDATE ALL ANODES. { pCxt->pRootNode = createUpdateAnodeStmt(pCxt, NULL, true); }
+cmd ::= DROP ANODE NK_INTEGER(A). { pCxt->pRootNode = createDropAnodeStmt(pCxt, &A); }
+
/************************************************ create/drop/alter/restore dnode *********************************************/
cmd ::= CREATE DNODE dnode_endpoint(A). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, NULL); }
cmd ::= CREATE DNODE dnode_endpoint(A) PORT NK_INTEGER(B). { pCxt->pRootNode = createCreateDnodeStmt(pCxt, &A, &B); }
@@ -524,6 +530,8 @@ cmd ::= SHOW db_name_cond_opt(A) VGROUPS.
cmd ::= SHOW MNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
//cmd ::= SHOW MODULES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MODULES_STMT); }
cmd ::= SHOW QNODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); }
+cmd ::= SHOW ANODES. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_STMT); }
+cmd ::= SHOW ANODES FULL. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_FULL_STMT); }
cmd ::= SHOW ARBGROUPS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); }
cmd ::= SHOW FUNCTIONS. { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
cmd ::= SHOW INDEXES FROM table_name_cond(A) from_db_opt(B). { pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, B, A, OP_TYPE_EQUAL); }
@@ -1187,6 +1195,9 @@ pseudo_column(A) ::= WDURATION(B).
pseudo_column(A) ::= IROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= ISFILLED(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
pseudo_column(A) ::= QTAGS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
+pseudo_column(A) ::= FLOW(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
+pseudo_column(A) ::= FHIGH(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
+pseudo_column(A) ::= FROWTS(B). { A = createRawExprNode(pCxt, &B, createFunctionNode(pCxt, &B, NULL)); }
function_expression(A) ::= function_name(B) NK_LP expression_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
function_expression(A) ::= star_func(B) NK_LP star_func_para_list(C) NK_RP(D). { A = createRawExprNodeExt(pCxt, &B, &D, createFunctionNode(pCxt, &B, C)); }
@@ -1505,6 +1516,10 @@ twindow_clause_opt(A) ::=
COUNT_WINDOW NK_LP NK_INTEGER(B) NK_RP. { A = createCountWindowNode(pCxt, &B, &B); }
twindow_clause_opt(A) ::=
COUNT_WINDOW NK_LP NK_INTEGER(B) NK_COMMA NK_INTEGER(C) NK_RP. { A = createCountWindowNode(pCxt, &B, &C); }
+twindow_clause_opt(A) ::=
+ ANOMALY_WINDOW NK_LP expr_or_subquery(B) NK_RP. { A = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, B), NULL); }
+twindow_clause_opt(A) ::=
+ ANOMALY_WINDOW NK_LP expr_or_subquery(B) NK_COMMA NK_STRING(C) NK_RP. { A = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, B), &C); }
sliding_opt(A) ::= . { A = NULL; }
sliding_opt(A) ::= SLIDING NK_LP interval_sliding_duration_literal(B) NK_RP. { A = releaseRawExprNode(pCxt, B); }
diff --git a/source/libs/parser/src/parAstCreater.c b/source/libs/parser/src/parAstCreater.c
index 3bb9e15182..e031ee0fe1 100644
--- a/source/libs/parser/src/parAstCreater.c
+++ b/source/libs/parser/src/parAstCreater.c
@@ -1368,6 +1368,25 @@ _err:
return NULL;
}
+SNode* createAnomalyWindowNode(SAstCreateContext* pCxt, SNode* pExpr, const SToken* pFuncOpt) {
+ SAnomalyWindowNode* pAnomaly = NULL;
+ CHECK_PARSER_STATUS(pCxt);
+ pCxt->errCode = nodesMakeNode(QUERY_NODE_ANOMALY_WINDOW, (SNode**)&pAnomaly);
+ CHECK_MAKE_NODE(pAnomaly);
+ pAnomaly->pCol = createPrimaryKeyCol(pCxt, NULL);
+ CHECK_MAKE_NODE(pAnomaly->pCol);
+ pAnomaly->pExpr = pExpr;
+ if (pFuncOpt == NULL) {
+ tstrncpy(pAnomaly->anomalyOpt, "algo=iqr", TSDB_ANAL_ALGO_OPTION_LEN);
+ } else {
+ (void)trimString(pFuncOpt->z, pFuncOpt->n, pAnomaly->anomalyOpt, sizeof(pAnomaly->anomalyOpt));
+ }
+ return (SNode*)pAnomaly;
+_err:
+ nodesDestroyNode((SNode*)pAnomaly);
+ return NULL;
+}
+
SNode* createIntervalWindowNode(SAstCreateContext* pCxt, SNode* pInterval, SNode* pOffset, SNode* pSliding,
SNode* pFill) {
SIntervalWindowNode* interval = NULL;
@@ -2998,6 +3017,47 @@ _err:
return NULL;
}
+SNode* createCreateAnodeStmt(SAstCreateContext* pCxt, const SToken* pUrl) {
+ CHECK_PARSER_STATUS(pCxt);
+ SCreateAnodeStmt* pStmt = NULL;
+ pCxt->errCode = nodesMakeNode(QUERY_NODE_CREATE_ANODE_STMT, (SNode**)&pStmt);
+ CHECK_MAKE_NODE(pStmt);
+ (void)trimString(pUrl->z, pUrl->n, pStmt->url, sizeof(pStmt->url));
+ return (SNode*)pStmt;
+_err:
+ return NULL;
+}
+
+SNode* createDropAnodeStmt(SAstCreateContext* pCxt, const SToken* pAnode) {
+ CHECK_PARSER_STATUS(pCxt);
+ SUpdateAnodeStmt* pStmt = NULL;
+ pCxt->errCode = nodesMakeNode(QUERY_NODE_DROP_ANODE_STMT, (SNode**)&pStmt);
+ CHECK_MAKE_NODE(pStmt);
+ if (NULL != pAnode) {
+ pStmt->anodeId = taosStr2Int32(pAnode->z, NULL, 10);
+ } else {
+ pStmt->anodeId = -1;
+ }
+ return (SNode*)pStmt;
+_err:
+ return NULL;
+}
+
+SNode* createUpdateAnodeStmt(SAstCreateContext* pCxt, const SToken* pAnode, bool updateAll) {
+ CHECK_PARSER_STATUS(pCxt);
+ SUpdateAnodeStmt* pStmt = NULL;
+ pCxt->errCode = nodesMakeNode(QUERY_NODE_UPDATE_ANODE_STMT, (SNode**)&pStmt);
+ CHECK_MAKE_NODE(pStmt);
+ if (NULL != pAnode) {
+ pStmt->anodeId = taosStr2Int32(pAnode->z, NULL, 10);
+ } else {
+ pStmt->anodeId = -1;
+ }
+ return (SNode*)pStmt;
+_err:
+ return NULL;
+}
+
SNode* createEncryptKeyStmt(SAstCreateContext* pCxt, const SToken* pValue) {
SToken config;
config.type = TK_NK_STRING;
diff --git a/source/libs/parser/src/parAstParser.c b/source/libs/parser/src/parAstParser.c
index 10d9b19e7f..eecc04658b 100644
--- a/source/libs/parser/src/parAstParser.c
+++ b/source/libs/parser/src/parAstParser.c
@@ -555,6 +555,22 @@ static int32_t collectMetaKeyFromShowSnodes(SCollectMetaKeyCxt* pCxt, SShowStmt*
return TSDB_CODE_SUCCESS;
}
+static int32_t collectMetaKeyFromShowAnodes(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
+ if (pCxt->pParseCxt->enableSysInfo) {
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_ANODES,
+ pCxt->pMetaCache);
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t collectMetaKeyFromShowAnodesFull(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
+ if (pCxt->pParseCxt->enableSysInfo) {
+ return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_ANODES_FULL,
+ pCxt->pMetaCache);
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t collectMetaKeyFromShowBnodes(SCollectMetaKeyCxt* pCxt, SShowStmt* pStmt) {
if (pCxt->pParseCxt->enableSysInfo) {
return reserveTableMetaInCache(pCxt->pParseCxt->acctId, TSDB_INFORMATION_SCHEMA_DB, TSDB_INS_TABLE_BNODES,
@@ -983,6 +999,10 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return collectMetaKeyFromShowQnodes(pCxt, (SShowStmt*)pStmt);
case QUERY_NODE_SHOW_SNODES_STMT:
return collectMetaKeyFromShowSnodes(pCxt, (SShowStmt*)pStmt);
+ case QUERY_NODE_SHOW_ANODES_STMT:
+ return collectMetaKeyFromShowAnodes(pCxt, (SShowStmt*)pStmt);
+ case QUERY_NODE_SHOW_ANODES_FULL_STMT:
+ return collectMetaKeyFromShowAnodesFull(pCxt, (SShowStmt*)pStmt);
case QUERY_NODE_SHOW_BNODES_STMT:
return collectMetaKeyFromShowBnodes(pCxt, (SShowStmt*)pStmt);
case QUERY_NODE_SHOW_ARBGROUPS_STMT:
diff --git a/source/libs/parser/src/parAuthenticator.c b/source/libs/parser/src/parAuthenticator.c
index 0eb07d8143..5ae17a7647 100644
--- a/source/libs/parser/src/parAuthenticator.c
+++ b/source/libs/parser/src/parAuthenticator.c
@@ -358,6 +358,8 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
case QUERY_NODE_SHOW_MNODES_STMT:
case QUERY_NODE_SHOW_MODULES_STMT:
case QUERY_NODE_SHOW_QNODES_STMT:
+ case QUERY_NODE_SHOW_ANODES_STMT:
+ case QUERY_NODE_SHOW_ANODES_FULL_STMT:
case QUERY_NODE_SHOW_SNODES_STMT:
case QUERY_NODE_SHOW_BNODES_STMT:
case QUERY_NODE_SHOW_CLUSTER_STMT:
diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c
index 5857093cec..63121ec044 100644
--- a/source/libs/parser/src/parTokenizer.c
+++ b/source/libs/parser/src/parTokenizer.c
@@ -38,6 +38,9 @@ static SKeyword keywordTable[] = {
{"ANALYZE", TK_ANALYZE},
{"AND", TK_AND},
{"ANTI", TK_ANTI},
+ {"ANODE", TK_ANODE},
+ {"ANODES", TK_ANODES},
+ {"ANOMALY_WINDOW", TK_ANOMALY_WINDOW},
// {"ANY", TK_ANY},
{"APPS", TK_APPS},
{"AS", TK_AS},
@@ -332,6 +335,9 @@ static SKeyword keywordTable[] = {
{"_WDURATION", TK_WDURATION},
{"_WEND", TK_WEND},
{"_WSTART", TK_WSTART},
+ {"_FLOW", TK_FLOW},
+ {"_FHIGH", TK_FHIGH},
+ {"_FROWTS", TK_FROWTS},
{"ALIVE", TK_ALIVE},
{"VARBINARY", TK_VARBINARY},
{"S3_CHUNKSIZE", TK_S3_CHUNKSIZE},
diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c
index 4c9c559457..752525fe7f 100755
--- a/source/libs/parser/src/parTranslater.c
+++ b/source/libs/parser/src/parTranslater.c
@@ -24,6 +24,7 @@
#include "parUtil.h"
#include "scalar.h"
#include "systable.h"
+#include "tanal.h"
#include "tcol.h"
#include "tglobal.h"
#include "ttime.h"
@@ -348,6 +349,20 @@ static const SSysTableShowAdapter sysTableShowAdapter[] = {
.numOfShowCols = 1,
.pShowCols = {"*"}
},
+ {
+ .showType = QUERY_NODE_SHOW_ANODES_STMT,
+ .pDbName = TSDB_INFORMATION_SCHEMA_DB,
+ .pTableName = TSDB_INS_TABLE_ANODES,
+ .numOfShowCols = 1,
+ .pShowCols = {"*"}
+ },
+ {
+ .showType = QUERY_NODE_SHOW_ANODES_FULL_STMT,
+ .pDbName = TSDB_INFORMATION_SCHEMA_DB,
+ .pTableName = TSDB_INS_TABLE_ANODES_FULL,
+ .numOfShowCols = 1,
+ .pShowCols = {"*"}
+ },
};
// clang-format on
@@ -1035,6 +1050,14 @@ static bool isInterpPseudoColumnFunc(const SNode* pNode) {
return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsInterpPseudoColumnFunc(((SFunctionNode*)pNode)->funcId));
}
+static bool isForecastFunc(const SNode* pNode) {
+ return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsForecastFunc(((SFunctionNode*)pNode)->funcId));
+}
+
+static bool isForecastPseudoColumnFunc(const SNode* pNode) {
+ return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsForecastPseudoColumnFunc(((SFunctionNode*)pNode)->funcId));
+}
+
#ifdef BUILD_NO_CALL
static bool isTimelineFunc(const SNode* pNode) {
return (QUERY_NODE_FUNCTION == nodeType(pNode) && fmIsTimelineFunc(((SFunctionNode*)pNode)->funcId));
@@ -1237,7 +1260,7 @@ bool isPrimaryKeyImpl(SNode* pExpr) {
FUNCTION_TYPE_LAST_ROW == pFunc->funcType || FUNCTION_TYPE_TIMETRUNCATE == pFunc->funcType) {
return isPrimaryKeyImpl(nodesListGetNode(pFunc->pParameterList, 0));
} else if (FUNCTION_TYPE_WSTART == pFunc->funcType || FUNCTION_TYPE_WEND == pFunc->funcType ||
- FUNCTION_TYPE_IROWTS == pFunc->funcType) {
+ FUNCTION_TYPE_IROWTS == pFunc->funcType || FUNCTION_TYPE_FORECAST_ROWTS == pFunc->funcType) {
return true;
}
} else if (QUERY_NODE_OPERATOR == nodeType(pExpr)) {
@@ -2250,7 +2273,7 @@ static EDealRes translateOperator(STranslateContext* pCxt, SOperatorNode* pOp) {
static EDealRes haveVectorFunction(SNode* pNode, void* pContext) {
if (isAggFunc(pNode) || isIndefiniteRowsFunc(pNode) || isWindowPseudoColumnFunc(pNode) ||
- isInterpPseudoColumnFunc(pNode)) {
+ isInterpPseudoColumnFunc(pNode) || isForecastPseudoColumnFunc(pNode)) {
*((bool*)pContext) = true;
return DEAL_RES_END;
}
@@ -2553,6 +2576,72 @@ static int32_t translateInterpPseudoColumnFunc(STranslateContext* pCxt, SNode**
return TSDB_CODE_SUCCESS;
}
+static int32_t translateForecastFunc(STranslateContext* pCxt, SFunctionNode* pFunc) {
+ if (!fmIsForecastFunc(pFunc->funcId)) {
+ return TSDB_CODE_SUCCESS;
+ }
+ if (!isSelectStmt(pCxt->pCurrStmt) || SQL_CLAUSE_SELECT != pCxt->currClause) {
+ return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC);
+ }
+ SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt;
+ SNode* pTable = pSelect->pFromTable;
+
+ if (pSelect->hasAggFuncs || pSelect->hasMultiRowsFunc || pSelect->hasIndefiniteRowsFunc) {
+ return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC);
+ }
+
+ if (pSelect->hasForecastFunc &&
+ (FUNC_RETURN_ROWS_INDEFINITE == pSelect->returnRows || pSelect->returnRows != fmGetFuncReturnRows(pFunc))) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
+ "%s ignoring null value options cannot be used when applying to multiple columns",
+ pFunc->functionName);
+ }
+
+ if (NULL != pSelect->pWindow || NULL != pSelect->pGroupByList) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
+ "%s function is not supported in window query or group query", pFunc->functionName);
+ }
+ if (hasInvalidFuncNesting(pFunc->pParameterList)) {
+ return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_AGG_FUNC_NESTING);
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t translateForecastPseudoColumnFunc(STranslateContext* pCxt, SNode** ppNode, bool* pRewriteToColumn) {
+ SFunctionNode* pFunc = (SFunctionNode*)(*ppNode);
+ if (!fmIsForecastPseudoColumnFunc(pFunc->funcId)) {
+ return TSDB_CODE_SUCCESS;
+ }
+ if (!isSelectStmt(pCxt->pCurrStmt)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
+ "%s must be used in select statements", pFunc->functionName);
+ }
+ if (pCxt->currClause == SQL_CLAUSE_WHERE) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_INTERP_CLAUSE,
+ "%s is not allowed in where clause", pFunc->functionName);
+ }
+
+ SSelectStmt* pSelect = (SSelectStmt*)pCxt->pCurrStmt;
+ SNode* pNode = NULL;
+ bool bFound = false;
+ FOREACH(pNode, pSelect->pProjectionList) {
+ if (nodeType(pNode) == QUERY_NODE_FUNCTION && strcasecmp(((SFunctionNode*)pNode)->functionName, "forecast") == 0) {
+ bFound = true;
+ break;
+ }
+ }
+ if (!bFound) {
+ *pRewriteToColumn = true;
+ int32_t code = replacePsedudoColumnFuncWithColumn(pCxt, ppNode);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+ (void)translateColumn(pCxt, (SColumnNode**)ppNode);
+ return pCxt->errCode;
+ }
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t translateTimelineFunc(STranslateContext* pCxt, SFunctionNode* pFunc) {
if (!fmIsTimelineFunc(pFunc->funcId)) {
return TSDB_CODE_SUCCESS;
@@ -2738,7 +2827,9 @@ static void setFuncClassification(STranslateContext* pCxt, SFunctionNode* pFunc)
pSelect->returnRows = fmGetFuncReturnRows(pFunc);
} else if (fmIsInterpFunc(pFunc->funcId)) {
pSelect->returnRows = fmGetFuncReturnRows(pFunc);
- }
+ } else if (fmIsForecastFunc(pFunc->funcId)) {
+ pSelect->returnRows = fmGetFuncReturnRows(pFunc);
+ }
if (fmIsProcessByRowFunc(pFunc->funcId)) {
pSelect->lastProcessByRowFuncId = pFunc->funcId;
}
@@ -2755,6 +2846,9 @@ static void setFuncClassification(STranslateContext* pCxt, SFunctionNode* pFunc)
pSelect->hasInterpFunc = pSelect->hasInterpFunc ? true : (FUNCTION_TYPE_INTERP == pFunc->funcType);
pSelect->hasInterpPseudoColFunc =
pSelect->hasInterpPseudoColFunc ? true : fmIsInterpPseudoColumnFunc(pFunc->funcId);
+ pSelect->hasForecastFunc = pSelect->hasForecastFunc ? true : (FUNCTION_TYPE_FORECAST == pFunc->funcType);
+ pSelect->hasForecastPseudoColFunc =
+ pSelect->hasForecastPseudoColFunc ? true : fmIsForecastPseudoColumnFunc(pFunc->funcId);
pSelect->hasLastRowFunc = pSelect->hasLastRowFunc ? true : (FUNCTION_TYPE_LAST_ROW == pFunc->funcType);
pSelect->hasLastFunc = pSelect->hasLastFunc ? true : (FUNCTION_TYPE_LAST == pFunc->funcType);
pSelect->hasTimeLineFunc = pSelect->hasTimeLineFunc ? true : fmIsTimelineFunc(pFunc->funcId);
@@ -2946,6 +3040,9 @@ static int32_t translateScanPseudoColumnFunc(STranslateContext* pCxt, SNode** pp
return TSDB_CODE_SUCCESS;
}
if (0 == LIST_LENGTH(pFunc->pParameterList)) {
+ if (pFunc->funcType == FUNCTION_TYPE_FORECAST_LOW || pFunc->funcType == FUNCTION_TYPE_FORECAST_HIGH) {
+ return TSDB_CODE_SUCCESS;
+ }
if (!isSelectStmt(pCxt->pCurrStmt) || NULL == ((SSelectStmt*)pCxt->pCurrStmt)->pFromTable) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TBNAME);
}
@@ -3016,6 +3113,16 @@ static int32_t translateNormalFunction(STranslateContext* pCxt, SNode** ppNode)
return code;
}
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = translateForecastFunc(pCxt, pFunc);
+ }
+ if (TSDB_CODE_SUCCESS == code) {
+ bool bRewriteToColumn = false;
+ code = translateForecastPseudoColumnFunc(pCxt, ppNode, &bRewriteToColumn);
+ if (bRewriteToColumn) {
+ return code;
+ }
+ }
if (TSDB_CODE_SUCCESS == code) {
code = translateTimelineFunc(pCxt, pFunc);
}
@@ -3759,7 +3866,8 @@ static int32_t resetSelectFuncNumWithoutDup(SSelectStmt* pSelect) {
static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect) {
if (NULL != pSelect->pGroupByList || NULL != pSelect->pWindow || isWindowJoinStmt(pSelect) ||
- (!pSelect->hasAggFuncs && !pSelect->hasIndefiniteRowsFunc && !pSelect->hasInterpFunc)) {
+ (!pSelect->hasAggFuncs && !pSelect->hasIndefiniteRowsFunc && !pSelect->hasInterpFunc &&
+ !pSelect->hasForecastFunc)) {
return TSDB_CODE_SUCCESS;
}
if (!pSelect->onlyHasKeepOrderFunc) {
@@ -3782,7 +3890,7 @@ static int32_t checkAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect)
static int32_t checkWinJoinAggColCoexist(STranslateContext* pCxt, SSelectStmt* pSelect) {
if (!isWindowJoinStmt(pSelect) || (!pSelect->hasAggFuncs && !pSelect->hasIndefiniteRowsFunc &&
- !pSelect->hasInterpFunc)) {
+ !pSelect->hasInterpFunc && !pSelect->hasForecastFunc)) {
return TSDB_CODE_SUCCESS;
}
if (!pSelect->onlyHasKeepOrderFunc) {
@@ -5795,6 +5903,40 @@ static int32_t translateCountWindow(STranslateContext* pCxt, SSelectStmt* pSelec
return TSDB_CODE_SUCCESS;
}
+static int32_t checkAnomalyExpr(STranslateContext* pCxt, SNode* pNode) {
+ int32_t type = ((SExprNode*)pNode)->resType.type;
+ if (!IS_MATHABLE_TYPE(type)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ANOMALY_WIN_TYPE,
+ "ANOMALY_WINDOW only support mathable column");
+ }
+
+ if (QUERY_NODE_COLUMN == nodeType(pNode) && COLUMN_TYPE_TAG == ((SColumnNode*)pNode)->colType) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ANOMALY_WIN_COL,
+ "ANOMALY_WINDOW not support on tag column");
+ }
+
+ return TSDB_CODE_SUCCESS;
+}
+
+static int32_t translateAnomalyWindow(STranslateContext* pCxt, SSelectStmt* pSelect) {
+ if (QUERY_NODE_TEMP_TABLE == nodeType(pSelect->pFromTable) &&
+ !isGlobalTimeLineQuery(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TIMELINE_QUERY,
+ "ANOMALY_WINDOW requires valid time series input");
+ }
+
+ SAnomalyWindowNode* pAnomaly = (SAnomalyWindowNode*)pSelect->pWindow;
+ int32_t code = checkAnomalyExpr(pCxt, pAnomaly->pExpr);
+ if (TSDB_CODE_SUCCESS == code) {
+ if (!taosAnalGetOptStr(pAnomaly->anomalyOpt, "algo", NULL, 0) != 0) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_ANOMALY_WIN_OPT,
+ "ANOMALY_WINDOW option should include algo field");
+ }
+ }
+
+ return code;
+}
+
static int32_t translateSpecificWindow(STranslateContext* pCxt, SSelectStmt* pSelect) {
switch (nodeType(pSelect->pWindow)) {
case QUERY_NODE_STATE_WINDOW:
@@ -5807,6 +5949,8 @@ static int32_t translateSpecificWindow(STranslateContext* pCxt, SSelectStmt* pSe
return translateEventWindow(pCxt, pSelect);
case QUERY_NODE_COUNT_WINDOW:
return translateCountWindow(pCxt, pSelect);
+ case QUERY_NODE_ANOMALY_WINDOW:
+ return translateAnomalyWindow(pCxt, pSelect);
default:
break;
}
@@ -6043,6 +6187,26 @@ static int32_t translateInterp(STranslateContext* pCxt, SSelectStmt* pSelect) {
return code;
}
+static int32_t translateForecast(STranslateContext* pCxt, SSelectStmt* pSelect) {
+ if (!pSelect->hasForecastFunc) {
+ if (pSelect->hasForecastPseudoColFunc) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
+ "Has Forecast pseudo column(s) but missing forcast function");
+ }
+ return TSDB_CODE_SUCCESS;
+ }
+
+ if ((NULL != pSelect->pFromTable) && (QUERY_NODE_JOIN_TABLE == nodeType(pSelect->pFromTable))) {
+ SJoinTableNode* pJoinTable = (SJoinTableNode*)pSelect->pFromTable;
+ if (IS_WINDOW_JOIN(pJoinTable->subType)) {
+ return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_FORECAST_CLAUSE,
+ "Forecast not supported to be used in WINDOW join");
+ }
+ }
+
+ return 0;
+}
+
static int32_t removeConstantValueFromList(SNodeList** pList) {
SNode* pNode = NULL;
WHERE_EACH(pNode, *pList) {
@@ -6884,6 +7048,9 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect
if (TSDB_CODE_SUCCESS == code) {
code = translateInterp(pCxt, pSelect);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = translateForecast(pCxt, pSelect);
+ }
if (TSDB_CODE_SUCCESS == code) {
code = appendTsForImplicitTsFunc(pCxt, pSelect);
}
@@ -7895,6 +8062,19 @@ static int32_t fillCmdSql(STranslateContext* pCxt, int16_t msgType, void* pReq)
break;
}
+ case TDMT_MND_CREATE_ANODE: {
+ FILL_CMD_SQL(sql, sqlLen, pCmdReq, SMCreateAnodeReq, pReq);
+ break;
+ }
+ case TDMT_MND_DROP_ANODE: {
+ FILL_CMD_SQL(sql, sqlLen, pCmdReq, SMDropAnodeReq, pReq);
+ break;
+ }
+ case TDMT_MND_UPDATE_ANODE: {
+ FILL_CMD_SQL(sql, sqlLen, pCmdReq, SMUpdateAnodeReq, pReq);
+ break;
+ }
+
case TDMT_MND_CREATE_MNODE: {
FILL_CMD_SQL(sql, sqlLen, pCmdReq, SMCreateMnodeReq, pReq);
break;
@@ -9398,6 +9578,43 @@ static int32_t translateDropUser(STranslateContext* pCxt, SDropUserStmt* pStmt)
return code;
}
+static int32_t translateCreateAnode(STranslateContext* pCxt, SCreateAnodeStmt* pStmt) {
+ SMCreateAnodeReq createReq = {0};
+ createReq.urlLen = strlen(pStmt->url) + 1;
+ if (createReq.urlLen > TSDB_ANAL_ANODE_URL_LEN) {
+ return TSDB_CODE_MND_ANODE_TOO_LONG_URL;
+ }
+
+ createReq.url = taosMemoryCalloc(createReq.urlLen, 1);
+ if (createReq.url == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ tstrncpy(createReq.url, pStmt->url, createReq.urlLen);
+
+ int32_t code = buildCmdMsg(pCxt, TDMT_MND_CREATE_ANODE, (FSerializeFunc)tSerializeSMCreateAnodeReq, &createReq);
+ tFreeSMCreateAnodeReq(&createReq);
+ return code;
+}
+
+static int32_t translateDropAnode(STranslateContext* pCxt, SDropAnodeStmt* pStmt) {
+ SMDropAnodeReq dropReq = {0};
+ dropReq.anodeId = pStmt->anodeId;
+
+ int32_t code = buildCmdMsg(pCxt, TDMT_MND_DROP_ANODE, (FSerializeFunc)tSerializeSMDropAnodeReq, &dropReq);
+ tFreeSMDropAnodeReq(&dropReq);
+ return code;
+}
+
+static int32_t translateUpdateAnode(STranslateContext* pCxt, SUpdateAnodeStmt* pStmt) {
+ SMUpdateAnodeReq updateReq = {0};
+ updateReq.anodeId = pStmt->anodeId;
+
+ int32_t code = buildCmdMsg(pCxt, TDMT_MND_UPDATE_ANODE, (FSerializeFunc)tSerializeSMUpdateAnodeReq, &updateReq);
+ tFreeSMUpdateAnodeReq(&updateReq);
+ return code;
+}
+
static int32_t translateCreateDnode(STranslateContext* pCxt, SCreateDnodeStmt* pStmt) {
SCreateDnodeReq createReq = {0};
strcpy(createReq.fqdn, pStmt->fqdn);
@@ -9820,7 +10037,7 @@ static int32_t translateDropComponentNode(STranslateContext* pCxt, SDropComponen
}
static int32_t checkTopicQuery(STranslateContext* pCxt, SSelectStmt* pSelect) {
- if (pSelect->hasAggFuncs || pSelect->hasInterpFunc || pSelect->hasIndefiniteRowsFunc) {
+ if (pSelect->hasAggFuncs || pSelect->hasForecastFunc || pSelect->hasInterpFunc || pSelect->hasIndefiniteRowsFunc) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_TOPIC_QUERY);
}
return TSDB_CODE_SUCCESS;
@@ -10186,7 +10403,7 @@ static int32_t translateKillTransaction(STranslateContext* pCxt, SKillStmt* pStm
static bool crossTableWithoutAggOper(SSelectStmt* pSelect) {
return NULL == pSelect->pWindow && !pSelect->hasAggFuncs && !pSelect->hasIndefiniteRowsFunc &&
- !pSelect->hasInterpFunc &&
+ !pSelect->hasInterpFunc && !pSelect->hasForecastFunc &&
TSDB_SUPER_TABLE == ((SRealTableNode*)pSelect->pFromTable)->pMeta->tableType &&
!hasTbnameFunction(pSelect->pPartitionByList);
}
@@ -12408,6 +12625,15 @@ static int32_t translateQuery(STranslateContext* pCxt, SNode* pNode) {
case QUERY_NODE_ALTER_DNODE_STMT:
code = translateAlterDnode(pCxt, (SAlterDnodeStmt*)pNode);
break;
+ case QUERY_NODE_CREATE_ANODE_STMT:
+ code = translateCreateAnode(pCxt, (SCreateAnodeStmt*)pNode);
+ break;
+ case QUERY_NODE_DROP_ANODE_STMT:
+ code = translateDropAnode(pCxt, (SDropAnodeStmt*)pNode);
+ break;
+ case QUERY_NODE_UPDATE_ANODE_STMT:
+ code = translateUpdateAnode(pCxt, (SUpdateAnodeStmt*)pNode);
+ break;
case QUERY_NODE_CREATE_INDEX_STMT:
code = translateCreateIndex(pCxt, (SCreateIndexStmt*)pNode);
break;
@@ -15768,6 +15994,8 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
case QUERY_NODE_SHOW_MNODES_STMT:
case QUERY_NODE_SHOW_MODULES_STMT:
case QUERY_NODE_SHOW_QNODES_STMT:
+ case QUERY_NODE_SHOW_ANODES_STMT:
+ case QUERY_NODE_SHOW_ANODES_FULL_STMT:
case QUERY_NODE_SHOW_FUNCTIONS_STMT:
case QUERY_NODE_SHOW_INDEXES_STMT:
case QUERY_NODE_SHOW_STREAMS_STMT:
diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c
index 9c2977d289..e35eea9e72 100644
--- a/source/libs/parser/src/parUtil.c
+++ b/source/libs/parser/src/parUtil.c
@@ -185,6 +185,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return "%s is not supported in system table query";
case TSDB_CODE_PAR_INVALID_INTERP_CLAUSE:
return "Invalid usage of RANGE clause, EVERY clause or FILL clause";
+ case TSDB_CODE_PAR_INVALID_FORECAST_CLAUSE:
+ return "Invalid usage of forecast clause";
case TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN:
return "No valid function in window query";
case TSDB_CODE_PAR_INVALID_OPTR_USAGE:
diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c
index 2c7f473d9a..5849977a3a 100644
--- a/source/libs/parser/src/sql.c
+++ b/source/libs/parser/src/sql.c
@@ -104,31 +104,31 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 567
+#define YYNOCODE 573
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SToken
typedef union {
int yyinit;
ParseTOKENTYPE yy0;
- EFillMode yy18;
- EJoinType yy36;
- ENullOrder yy109;
- bool yy173;
- SNodeList* yy334;
- SAlterOption yy389;
- STokenPair yy399;
- EOperatorType yy506;
- SToken yy533;
- EShowKind yy537;
- SNode* yy560;
- int64_t yy585;
- EJoinSubType yy648;
- ETrimType yy672;
- SShowTablesOption yy709;
- int8_t yy719;
- int32_t yy802;
- SDataType yy952;
- EOrder yy974;
+ EFillMode yy102;
+ EOperatorType yy140;
+ ETrimType yy300;
+ ENullOrder yy307;
+ EOrder yy410;
+ SDataType yy424;
+ int64_t yy483;
+ SToken yy557;
+ bool yy569;
+ SShowTablesOption yy595;
+ SAlterOption yy683;
+ STokenPair yy723;
+ EShowKind yy741;
+ EJoinSubType yy744;
+ EJoinType yy792;
+ int8_t yy815;
+ int32_t yy904;
+ SNodeList* yy946;
+ SNode* yy974;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -144,18 +144,18 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 1009
-#define YYNRULE 773
-#define YYNRULE_WITH_ACTION 773
-#define YYNTOKEN 383
-#define YY_MAX_SHIFT 1008
-#define YY_MIN_SHIFTREDUCE 1495
-#define YY_MAX_SHIFTREDUCE 2267
-#define YY_ERROR_ACTION 2268
-#define YY_ACCEPT_ACTION 2269
-#define YY_NO_ACTION 2270
-#define YY_MIN_REDUCE 2271
-#define YY_MAX_REDUCE 3043
+#define YYNSTATE 1025
+#define YYNRULE 784
+#define YYNRULE_WITH_ACTION 784
+#define YYNTOKEN 389
+#define YY_MAX_SHIFT 1024
+#define YY_MIN_SHIFTREDUCE 1516
+#define YY_MAX_SHIFTREDUCE 2299
+#define YY_ERROR_ACTION 2300
+#define YY_ACCEPT_ACTION 2301
+#define YY_NO_ACTION 2302
+#define YY_MIN_REDUCE 2303
+#define YY_MAX_REDUCE 3086
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
@@ -222,1181 +222,1204 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (4386)
+#define YY_ACTTAB_COUNT (4475)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 44, 354, 464, 2712, 570, 586, 2605, 2269, 219, 569,
- /* 10 */ 2689, 506, 59, 57, 136, 674, 2721, 219, 675, 2319,
- /* 20 */ 502, 2272, 1989, 522, 2483, 52, 51, 2014, 679, 58,
- /* 30 */ 56, 55, 54, 53, 676, 2609, 1987, 2578, 2094, 2363,
- /* 40 */ 2803, 2331, 150, 873, 2609, 149, 148, 147, 146, 145,
- /* 50 */ 144, 143, 142, 141, 872, 840, 2636, 542, 52, 51,
- /* 60 */ 246, 791, 58, 56, 55, 54, 53, 78, 2089, 3011,
- /* 70 */ 494, 870, 307, 791, 483, 2683, 2633, 887, 196, 837,
- /* 80 */ 169, 3011, 1995, 34, 1670, 2821, 2412, 3017, 230, 529,
- /* 90 */ 528, 682, 3012, 826, 675, 2319, 994, 535, 1669, 3017,
- /* 100 */ 230, 2768, 534, 882, 3012, 826, 2761, 473, 471, 519,
- /* 110 */ 2722, 900, 1005, 1996, 815, 60, 976, 975, 974, 973,
- /* 120 */ 532, 2928, 972, 971, 174, 966, 965, 964, 963, 962,
- /* 130 */ 961, 960, 173, 954, 953, 952, 531, 530, 949, 948,
- /* 140 */ 947, 210, 209, 946, 527, 945, 944, 943, 2802, 814,
- /* 150 */ 2925, 2850, 2097, 2098, 791, 133, 2804, 886, 2806, 2807,
- /* 160 */ 881, 125, 3011, 869, 2851, 905, 2231, 791, 223, 508,
- /* 170 */ 212, 774, 2913, 250, 644, 3011, 496, 2909, 74, 2821,
- /* 180 */ 3017, 230, 2803, 905, 2528, 3012, 826, 470, 468, 2472,
- /* 190 */ 722, 2050, 2060, 3017, 230, 2541, 231, 840, 3012, 826,
- /* 200 */ 9, 2096, 2099, 492, 2960, 206, 2921, 836, 614, 161,
- /* 210 */ 835, 724, 2015, 613, 2539, 723, 1990, 3011, 1988, 106,
- /* 220 */ 900, 612, 96, 868, 105, 52, 51, 2821, 761, 58,
- /* 230 */ 56, 55, 54, 53, 402, 824, 230, 2018, 2518, 172,
- /* 240 */ 3012, 826, 775, 2768, 755, 882, 759, 757, 302, 301,
- /* 250 */ 2471, 813, 1993, 1994, 2047, 2183, 2049, 2052, 2053, 2054,
- /* 260 */ 2055, 2056, 2057, 2058, 2059, 878, 871, 901, 2481, 903,
- /* 270 */ 902, 867, 2081, 2082, 2083, 2084, 2085, 2088, 2090, 2091,
- /* 280 */ 2092, 2093, 2095, 2, 59, 57, 2186, 160, 2803, 900,
- /* 290 */ 2802, 104, 502, 2850, 1989, 1999, 720, 133, 2804, 886,
- /* 300 */ 2806, 2807, 881, 880, 1658, 869, 2851, 905, 1987, 2636,
- /* 310 */ 2094, 2161, 212, 2485, 2913, 62, 52, 51, 496, 2909,
- /* 320 */ 58, 56, 55, 54, 53, 684, 2675, 2803, 577, 2634,
- /* 330 */ 887, 52, 51, 2821, 74, 58, 56, 55, 54, 53,
- /* 340 */ 2089, 690, 883, 870, 1761, 1762, 2961, 19, 2047, 2768,
- /* 350 */ 1660, 882, 837, 169, 1995, 150, 901, 2481, 149, 148,
- /* 360 */ 147, 146, 145, 144, 143, 142, 141, 59, 57, 693,
- /* 370 */ 3016, 338, 2821, 2161, 771, 502, 526, 1989, 3011, 639,
- /* 380 */ 637, 2541, 439, 456, 1005, 244, 126, 15, 2768, 507,
- /* 390 */ 882, 1987, 2126, 2094, 2463, 469, 2802, 3015, 2014, 2850,
- /* 400 */ 2539, 3012, 3014, 434, 2804, 886, 2806, 2807, 881, 879,
- /* 410 */ 226, 869, 2851, 905, 860, 2878, 940, 186, 185, 937,
- /* 420 */ 936, 935, 183, 2089, 2097, 2098, 870, 1567, 2470, 1566,
- /* 430 */ 19, 592, 2605, 2124, 568, 2802, 567, 1995, 2850, 2071,
- /* 440 */ 2535, 2536, 198, 2804, 886, 2806, 2807, 881, 514, 2161,
- /* 450 */ 869, 2851, 905, 2933, 2158, 2159, 2160, 2933, 2933, 2933,
- /* 460 */ 2933, 2933, 74, 2050, 2060, 1568, 2453, 1005, 566, 2131,
- /* 470 */ 15, 2019, 549, 2096, 2099, 2190, 697, 839, 199, 2921,
- /* 480 */ 2922, 2014, 167, 2926, 901, 2481, 248, 517, 1990, 41,
- /* 490 */ 1988, 508, 792, 2971, 2219, 868, 237, 671, 2125, 2163,
- /* 500 */ 2164, 2165, 2166, 2167, 160, 905, 669, 2097, 2098, 665,
- /* 510 */ 661, 2015, 204, 725, 331, 2933, 2158, 2159, 2160, 2933,
- /* 520 */ 2933, 2933, 2933, 2933, 1993, 1994, 2047, 338, 2049, 2052,
- /* 530 */ 2053, 2054, 2055, 2056, 2057, 2058, 2059, 878, 871, 810,
- /* 540 */ 942, 903, 902, 867, 2081, 2082, 2050, 2060, 942, 2088,
- /* 550 */ 2090, 2091, 2092, 2093, 2095, 2, 2096, 2099, 2271, 900,
- /* 560 */ 2636, 2182, 807, 806, 2217, 2218, 2220, 2221, 2222, 1835,
- /* 570 */ 1836, 1990, 63, 1988, 504, 2130, 1570, 1571, 868, 219,
- /* 580 */ 2633, 887, 159, 158, 157, 156, 155, 154, 153, 152,
- /* 590 */ 151, 45, 2158, 2159, 2160, 43, 498, 2119, 2120, 2121,
- /* 600 */ 2122, 2123, 2127, 2128, 2129, 3016, 2610, 1993, 1994, 2047,
- /* 610 */ 772, 2049, 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059,
- /* 620 */ 878, 871, 2017, 2017, 903, 902, 867, 2081, 2082, 1567,
- /* 630 */ 1958, 1566, 2088, 2090, 2091, 2092, 2093, 2095, 2, 12,
- /* 640 */ 59, 57, 724, 1862, 1863, 165, 723, 691, 502, 554,
- /* 650 */ 1989, 12, 2051, 2803, 62, 338, 1722, 816, 811, 804,
- /* 660 */ 800, 2778, 513, 512, 1987, 2014, 2094, 1568, 883, 1957,
- /* 670 */ 2329, 1713, 932, 931, 930, 1717, 929, 1719, 1720, 928,
- /* 680 */ 925, 2541, 1728, 922, 1730, 1731, 919, 916, 913, 2803,
- /* 690 */ 1995, 2782, 1861, 1864, 2014, 197, 2089, 2283, 2821, 870,
- /* 700 */ 844, 516, 515, 19, 883, 58, 56, 55, 54, 53,
- /* 710 */ 1995, 2541, 692, 2629, 2768, 2048, 882, 388, 2254, 462,
- /* 720 */ 12, 2778, 10, 59, 57, 2100, 694, 825, 901, 2481,
- /* 730 */ 2539, 502, 266, 1989, 2821, 3011, 677, 2541, 2327, 2105,
- /* 740 */ 1005, 2784, 2787, 15, 861, 2014, 2885, 1987, 235, 2094,
- /* 750 */ 2768, 2782, 882, 824, 230, 905, 852, 933, 3012, 826,
- /* 760 */ 74, 2802, 305, 193, 2850, 338, 304, 3016, 133, 2804,
- /* 770 */ 886, 2806, 2807, 881, 2487, 3011, 869, 2851, 905, 2089,
- /* 780 */ 2097, 2098, 870, 3031, 829, 2913, 2623, 558, 695, 496,
- /* 790 */ 2909, 901, 2481, 1995, 3015, 336, 336, 2802, 3012, 3013,
- /* 800 */ 2850, 2784, 2786, 497, 201, 2804, 886, 2806, 2807, 881,
- /* 810 */ 825, 67, 869, 2851, 905, 905, 560, 556, 3011, 2050,
- /* 820 */ 2060, 524, 2456, 1005, 2534, 2536, 60, 52, 51, 2096,
- /* 830 */ 2099, 58, 56, 55, 54, 53, 824, 230, 345, 346,
- /* 840 */ 115, 3012, 826, 344, 1990, 451, 1988, 338, 481, 775,
- /* 850 */ 763, 868, 505, 52, 51, 175, 2294, 58, 56, 55,
- /* 860 */ 54, 53, 193, 2097, 2098, 2051, 827, 3032, 2762, 1674,
- /* 870 */ 52, 51, 790, 2486, 58, 56, 55, 54, 53, 2468,
- /* 880 */ 1993, 1994, 2047, 1673, 2049, 2052, 2053, 2054, 2055, 2056,
- /* 890 */ 2057, 2058, 2059, 878, 871, 901, 2481, 903, 902, 867,
- /* 900 */ 2081, 2082, 2050, 2060, 2466, 2088, 2090, 2091, 2092, 2093,
- /* 910 */ 2095, 2, 2096, 2099, 2588, 574, 2051, 2768, 52, 51,
- /* 920 */ 1722, 2018, 58, 56, 55, 54, 53, 1990, 2048, 1988,
- /* 930 */ 306, 508, 777, 2675, 868, 1713, 932, 931, 930, 1717,
- /* 940 */ 929, 1719, 1720, 877, 876, 905, 1728, 875, 1730, 1731,
- /* 950 */ 874, 916, 913, 338, 837, 169, 268, 47, 584, 646,
- /* 960 */ 677, 2230, 2327, 1993, 1994, 2047, 1540, 2049, 2052, 2053,
- /* 970 */ 2054, 2055, 2056, 2057, 2058, 2059, 878, 871, 2202, 2048,
- /* 980 */ 903, 902, 867, 2081, 2082, 1547, 901, 2481, 2088, 2090,
- /* 990 */ 2091, 2092, 2093, 2095, 2, 59, 57, 863, 633, 2885,
- /* 1000 */ 1989, 395, 2293, 502, 317, 1989, 575, 1547, 2803, 2292,
- /* 1010 */ 1542, 1545, 1546, 72, 1987, 1916, 1917, 623, 2605, 1987,
- /* 1020 */ 394, 2094, 194, 883, 788, 2968, 2066, 2261, 741, 740,
- /* 1030 */ 739, 522, 2483, 1545, 1546, 731, 166, 735, 55, 54,
- /* 1040 */ 53, 734, 2455, 3015, 901, 2481, 733, 738, 476, 475,
- /* 1050 */ 2291, 2089, 732, 2821, 870, 117, 474, 728, 727, 726,
- /* 1060 */ 1995, 482, 2683, 2768, 594, 1995, 255, 901, 2481, 2768,
- /* 1070 */ 2768, 882, 253, 901, 2481, 313, 901, 2481, 59, 57,
- /* 1080 */ 139, 2921, 2922, 830, 167, 2926, 502, 608, 1989, 112,
- /* 1090 */ 1005, 632, 254, 609, 225, 1005, 610, 395, 60, 2079,
- /* 1100 */ 901, 2481, 1987, 2211, 2094, 630, 2290, 748, 467, 901,
- /* 1110 */ 2481, 2768, 2289, 38, 956, 224, 2802, 2212, 2474, 2850,
- /* 1120 */ 696, 2288, 762, 133, 2804, 886, 2806, 2807, 881, 2476,
- /* 1130 */ 401, 869, 2851, 905, 2089, 2097, 2098, 870, 3031, 2018,
- /* 1140 */ 2913, 303, 901, 2481, 496, 2909, 901, 2481, 1995, 901,
- /* 1150 */ 2481, 2561, 901, 2481, 2260, 2019, 2485, 751, 2684, 901,
- /* 1160 */ 2481, 2708, 308, 2210, 745, 743, 316, 2768, 2287, 843,
- /* 1170 */ 194, 300, 349, 2768, 2050, 2060, 525, 2286, 1005, 857,
- /* 1180 */ 2484, 60, 2768, 958, 2096, 2099, 193, 940, 186, 185,
- /* 1190 */ 937, 936, 935, 183, 1990, 959, 1988, 2486, 2438, 1990,
- /* 1200 */ 729, 1988, 2366, 52, 51, 2018, 868, 58, 56, 55,
- /* 1210 */ 54, 53, 901, 2481, 901, 2481, 2543, 84, 2097, 2098,
- /* 1220 */ 52, 51, 83, 1651, 58, 56, 55, 54, 53, 2768,
- /* 1230 */ 1993, 1994, 356, 2413, 894, 1993, 1994, 2047, 2768, 2049,
- /* 1240 */ 2052, 2053, 2054, 2055, 2056, 2057, 2058, 2059, 878, 871,
- /* 1250 */ 14, 13, 903, 902, 867, 2081, 2082, 2050, 2060, 39,
- /* 1260 */ 2088, 2090, 2091, 2092, 2093, 2095, 2, 2096, 2099, 52,
- /* 1270 */ 51, 901, 2481, 58, 56, 55, 54, 53, 2284, 741,
- /* 1280 */ 740, 739, 1990, 2014, 1988, 112, 731, 166, 735, 868,
- /* 1290 */ 3, 895, 734, 901, 2481, 901, 2481, 733, 738, 476,
- /* 1300 */ 475, 716, 715, 732, 65, 2285, 616, 474, 728, 727,
- /* 1310 */ 726, 2067, 233, 899, 2475, 384, 718, 717, 1993, 1994,
- /* 1320 */ 2047, 615, 2049, 2052, 2053, 2054, 2055, 2056, 2057, 2058,
- /* 1330 */ 2059, 878, 871, 2541, 2974, 903, 902, 867, 2081, 2082,
- /* 1340 */ 2928, 523, 2282, 2088, 2090, 2091, 2092, 2093, 2095, 2,
- /* 1350 */ 59, 57, 2539, 737, 736, 970, 968, 116, 502, 288,
- /* 1360 */ 1989, 934, 204, 2803, 2532, 2138, 2768, 2281, 2928, 2924,
- /* 1370 */ 828, 642, 768, 2019, 1987, 205, 2094, 2069, 883, 170,
- /* 1380 */ 2981, 2280, 2884, 2279, 714, 710, 706, 702, 40, 287,
- /* 1390 */ 2278, 1890, 1653, 2277, 52, 51, 819, 2923, 58, 56,
- /* 1400 */ 55, 54, 53, 2768, 42, 221, 2089, 162, 2821, 870,
- /* 1410 */ 52, 51, 2276, 2541, 58, 56, 55, 54, 53, 1549,
- /* 1420 */ 1995, 102, 837, 169, 2768, 2013, 882, 908, 2768, 791,
- /* 1430 */ 2299, 998, 2540, 59, 57, 285, 2275, 3011, 1654, 2019,
- /* 1440 */ 284, 502, 2768, 1989, 2768, 2274, 938, 332, 184, 2532,
- /* 1450 */ 1005, 2768, 832, 60, 2768, 3017, 230, 1987, 776, 2094,
- /* 1460 */ 3012, 826, 52, 51, 866, 2172, 58, 56, 55, 54,
- /* 1470 */ 53, 2802, 939, 2768, 2850, 2532, 176, 176, 133, 2804,
- /* 1480 */ 886, 2806, 2807, 881, 90, 798, 869, 2851, 905, 2089,
- /* 1490 */ 2097, 2098, 870, 3031, 765, 2913, 764, 2768, 293, 496,
- /* 1500 */ 2909, 291, 730, 1995, 52, 51, 2768, 271, 58, 56,
- /* 1510 */ 55, 54, 53, 2263, 2264, 791, 282, 2048, 1631, 295,
- /* 1520 */ 273, 280, 294, 3011, 808, 1649, 278, 688, 164, 2050,
- /* 1530 */ 2060, 66, 297, 1005, 299, 296, 15, 298, 103, 2096,
- /* 1540 */ 2099, 3017, 230, 46, 2350, 270, 3012, 826, 200, 2921,
- /* 1550 */ 2922, 61, 167, 2926, 1990, 61, 1988, 213, 950, 1906,
- /* 1560 */ 1914, 868, 14, 13, 1632, 184, 742, 2348, 2206, 838,
- /* 1570 */ 2072, 2822, 343, 2097, 2098, 89, 61, 1998, 2789, 52,
- /* 1580 */ 51, 1623, 76, 58, 56, 55, 54, 53, 2452, 744,
- /* 1590 */ 1993, 1994, 2047, 61, 2049, 2052, 2053, 2054, 2055, 2056,
- /* 1600 */ 2057, 2058, 2059, 878, 871, 2339, 61, 903, 902, 867,
- /* 1610 */ 2081, 2082, 2050, 2060, 2337, 2088, 2090, 2091, 2092, 2093,
- /* 1620 */ 2095, 2, 2096, 2099, 52, 51, 1997, 746, 58, 56,
- /* 1630 */ 55, 54, 53, 61, 2216, 909, 749, 1990, 2215, 1988,
- /* 1640 */ 322, 2116, 2791, 61, 868, 89, 52, 51, 842, 324,
- /* 1650 */ 58, 56, 55, 54, 53, 347, 52, 51, 849, 2070,
- /* 1660 */ 58, 56, 55, 54, 53, 2132, 363, 362, 2405, 181,
- /* 1670 */ 365, 364, 162, 1993, 1994, 2047, 2080, 2049, 2052, 2053,
- /* 1680 */ 2054, 2055, 2056, 2057, 2058, 2059, 878, 871, 184, 2073,
- /* 1690 */ 903, 902, 867, 2081, 2082, 367, 366, 951, 2088, 2090,
- /* 1700 */ 2091, 2092, 2093, 2095, 2, 443, 2803, 2012, 369, 368,
- /* 1710 */ 86, 371, 370, 911, 621, 841, 2061, 466, 373, 372,
- /* 1720 */ 1621, 883, 195, 182, 184, 641, 1859, 408, 1849, 375,
- /* 1730 */ 374, 2404, 2068, 940, 186, 185, 937, 936, 935, 183,
- /* 1740 */ 131, 600, 128, 643, 163, 181, 406, 88, 444, 602,
- /* 1750 */ 87, 2821, 359, 833, 2065, 898, 377, 376, 2320, 2001,
- /* 1760 */ 580, 445, 379, 378, 137, 381, 380, 2768, 2964, 882,
- /* 1770 */ 1604, 1704, 791, 264, 656, 654, 651, 649, 383, 382,
- /* 1780 */ 3011, 805, 488, 812, 484, 846, 2614, 551, 533, 2326,
- /* 1790 */ 2529, 784, 2965, 400, 2975, 820, 1735, 334, 3017, 230,
- /* 1800 */ 329, 465, 821, 3012, 826, 2615, 1743, 1750, 2000, 337,
- /* 1810 */ 2439, 5, 541, 588, 2802, 536, 1605, 2850, 460, 74,
- /* 1820 */ 2012, 133, 2804, 886, 2806, 2807, 881, 1748, 187, 869,
- /* 1830 */ 2851, 905, 550, 2022, 171, 562, 180, 2884, 2913, 561,
- /* 1840 */ 239, 238, 496, 2909, 2616, 2595, 241, 629, 628, 627,
- /* 1850 */ 626, 625, 620, 619, 618, 617, 448, 564, 75, 607,
- /* 1860 */ 606, 605, 604, 603, 597, 596, 595, 1883, 590, 589,
- /* 1870 */ 463, 393, 578, 2803, 581, 1823, 1824, 2013, 585, 252,
- /* 1880 */ 587, 1842, 591, 593, 635, 611, 598, 622, 883, 647,
- /* 1890 */ 802, 2607, 624, 631, 634, 636, 648, 645, 258, 650,
- /* 1900 */ 257, 652, 261, 653, 655, 657, 2020, 672, 4, 673,
- /* 1910 */ 680, 683, 100, 99, 573, 48, 681, 243, 2821, 269,
- /* 1920 */ 108, 2015, 685, 2021, 272, 686, 2023, 689, 687, 275,
- /* 1930 */ 565, 563, 2024, 2630, 2768, 277, 882, 109, 2025, 2624,
- /* 1940 */ 110, 2803, 111, 442, 1702, 286, 552, 698, 283, 548,
- /* 1950 */ 544, 540, 537, 566, 752, 719, 883, 113, 3004, 138,
- /* 1960 */ 721, 753, 437, 2698, 767, 2469, 290, 769, 2465, 292,
- /* 1970 */ 114, 189, 2016, 309, 779, 396, 778, 135, 2676, 2803,
- /* 1980 */ 177, 2802, 2467, 2462, 2850, 190, 2821, 191, 133, 2804,
- /* 1990 */ 886, 2806, 2807, 881, 883, 2695, 869, 2851, 905, 314,
- /* 2000 */ 2694, 786, 2768, 3031, 882, 2913, 2803, 783, 809, 496,
- /* 2010 */ 2909, 795, 338, 847, 2980, 2979, 818, 793, 323, 8,
- /* 2020 */ 2952, 883, 203, 2945, 2821, 325, 796, 327, 794, 823,
- /* 2030 */ 822, 3034, 780, 2932, 489, 319, 330, 785, 312, 326,
- /* 2040 */ 2768, 321, 882, 834, 328, 831, 168, 2017, 2180, 2802,
- /* 2050 */ 1, 2821, 2850, 216, 2178, 845, 133, 2804, 886, 2806,
- /* 2060 */ 2807, 881, 529, 528, 869, 2851, 905, 2768, 3010, 882,
- /* 2070 */ 339, 3031, 2003, 2913, 2803, 178, 2929, 496, 2909, 2644,
- /* 2080 */ 397, 2643, 2642, 850, 398, 851, 1996, 2802, 2094, 883,
- /* 2090 */ 2850, 493, 179, 855, 133, 2804, 886, 2806, 2807, 881,
- /* 2100 */ 858, 73, 869, 2851, 905, 2894, 890, 888, 352, 2888,
- /* 2110 */ 892, 2913, 2803, 2760, 2802, 496, 2909, 2850, 2089, 2821,
- /* 2120 */ 232, 133, 2804, 886, 2806, 2807, 881, 883, 357, 869,
- /* 2130 */ 2851, 905, 1995, 893, 333, 2768, 3031, 882, 2913, 447,
- /* 2140 */ 446, 399, 496, 2909, 124, 127, 1519, 2482, 403, 509,
- /* 2150 */ 2759, 1000, 907, 1001, 2755, 2754, 2803, 2821, 386, 188,
- /* 2160 */ 2746, 389, 865, 518, 1004, 2094, 2745, 2737, 1002, 997,
- /* 2170 */ 2736, 883, 2752, 2768, 390, 882, 2751, 2743, 2742, 2731,
- /* 2180 */ 2730, 405, 2802, 2749, 2720, 2850, 2748, 2740, 2739, 133,
- /* 2190 */ 2804, 886, 2806, 2807, 881, 2089, 2728, 869, 2851, 905,
- /* 2200 */ 472, 2821, 771, 2727, 2886, 64, 2913, 2725, 2724, 2533,
- /* 2210 */ 496, 2909, 425, 436, 520, 452, 426, 2768, 407, 882,
- /* 2220 */ 2802, 438, 453, 2850, 2719, 2718, 97, 133, 2804, 886,
- /* 2230 */ 2806, 2807, 881, 2713, 538, 869, 2851, 905, 2803, 539,
- /* 2240 */ 1940, 1941, 862, 236, 2913, 543, 2711, 545, 496, 2909,
- /* 2250 */ 546, 547, 1939, 883, 2710, 2709, 461, 2707, 553, 2706,
- /* 2260 */ 2705, 557, 555, 2704, 2802, 559, 2004, 2850, 1999, 1927,
- /* 2270 */ 2680, 134, 2804, 886, 2806, 2807, 881, 240, 2679, 869,
- /* 2280 */ 2851, 905, 242, 2821, 98, 1886, 1885, 2657, 2913, 571,
- /* 2290 */ 572, 2654, 2912, 2909, 2656, 2655, 2653, 2597, 576, 2768,
- /* 2300 */ 1822, 882, 2007, 2009, 2594, 579, 2593, 2587, 582, 2584,
- /* 2310 */ 583, 2583, 245, 101, 2582, 2581, 2586, 2585, 247, 903,
- /* 2320 */ 902, 2803, 2580, 2579, 2577, 2576, 2575, 2088, 2090, 2091,
- /* 2330 */ 2092, 2093, 2095, 249, 599, 2574, 883, 601, 2572, 2571,
- /* 2340 */ 2570, 2569, 2568, 1980, 2592, 1956, 2802, 2567, 2566, 2850,
- /* 2350 */ 2565, 2590, 2573, 134, 2804, 886, 2806, 2807, 881, 2564,
- /* 2360 */ 2563, 869, 2851, 905, 2562, 2560, 2821, 2559, 2558, 2557,
- /* 2370 */ 2913, 2556, 2555, 2554, 864, 2909, 2553, 511, 510, 1981,
- /* 2380 */ 251, 107, 2768, 2552, 882, 2551, 2550, 2622, 2591, 2589,
- /* 2390 */ 2549, 2548, 1828, 2547, 256, 2546, 903, 902, 638, 2545,
- /* 2400 */ 640, 2544, 2542, 1671, 2088, 2090, 2091, 2092, 2093, 2095,
- /* 2410 */ 2803, 2370, 2369, 449, 1675, 450, 1667, 259, 2368, 2367,
- /* 2420 */ 2365, 260, 2362, 262, 263, 883, 660, 2361, 659, 884,
- /* 2430 */ 658, 773, 2850, 662, 2354, 2341, 134, 2804, 886, 2806,
- /* 2440 */ 2807, 881, 664, 666, 869, 2851, 905, 2803, 668, 1008,
- /* 2450 */ 663, 670, 2315, 2913, 667, 2821, 265, 455, 2909, 211,
- /* 2460 */ 93, 2788, 883, 1548, 222, 678, 2314, 94, 392, 267,
- /* 2470 */ 2678, 2768, 2674, 882, 2664, 2803, 2652, 274, 276, 2651,
- /* 2480 */ 279, 2628, 281, 996, 220, 2621, 2457, 2364, 2360, 699,
- /* 2490 */ 883, 700, 2821, 992, 988, 984, 980, 1597, 387, 701,
- /* 2500 */ 2358, 703, 704, 705, 2356, 707, 709, 2353, 2768, 711,
- /* 2510 */ 882, 708, 712, 2336, 2334, 713, 2335, 2333, 2802, 2311,
- /* 2520 */ 2821, 2850, 2459, 2458, 1754, 134, 2804, 886, 2806, 2807,
- /* 2530 */ 881, 85, 1657, 869, 2851, 905, 2768, 1755, 882, 1656,
- /* 2540 */ 289, 1655, 2913, 2351, 132, 1652, 2349, 2910, 1650, 360,
- /* 2550 */ 1639, 1648, 477, 478, 1647, 2802, 1646, 967, 2850, 969,
- /* 2560 */ 499, 1645, 411, 2804, 886, 2806, 2807, 881, 1644, 32,
- /* 2570 */ 869, 2851, 905, 1641, 1640, 1638, 2340, 479, 2338, 480,
- /* 2580 */ 853, 2803, 2310, 2802, 750, 747, 2850, 2309, 2308, 754,
- /* 2590 */ 435, 2804, 886, 2806, 2807, 881, 883, 2307, 869, 2851,
- /* 2600 */ 905, 756, 2306, 758, 2305, 760, 2803, 1921, 1923, 140,
- /* 2610 */ 1920, 1925, 33, 2677, 79, 311, 2673, 1892, 68, 2663,
- /* 2620 */ 1894, 883, 781, 2650, 2649, 358, 2821, 859, 3016, 69,
- /* 2630 */ 341, 1896, 1911, 770, 782, 340, 1871, 315, 1870, 22,
- /* 2640 */ 17, 797, 2768, 787, 882, 789, 485, 192, 35, 25,
- /* 2650 */ 2233, 2821, 2207, 6, 310, 318, 799, 801, 803, 7,
- /* 2660 */ 23, 320, 24, 215, 37, 2214, 202, 2768, 2201, 882,
- /* 2670 */ 2171, 214, 227, 36, 95, 2803, 2173, 2789, 228, 2175,
- /* 2680 */ 77, 229, 26, 2248, 2253, 2254, 2247, 490, 2252, 2802,
- /* 2690 */ 883, 486, 2850, 2251, 491, 2155, 198, 2804, 886, 2806,
- /* 2700 */ 2807, 881, 2154, 71, 869, 2851, 905, 335, 2648, 2627,
- /* 2710 */ 207, 118, 119, 2626, 2802, 342, 120, 2850, 2803, 2209,
- /* 2720 */ 2821, 435, 2804, 886, 2806, 2807, 881, 217, 2620, 869,
- /* 2730 */ 2851, 905, 348, 883, 854, 81, 2768, 351, 882, 121,
- /* 2740 */ 2803, 70, 350, 27, 13, 18, 848, 2972, 2107, 11,
- /* 2750 */ 2106, 2005, 2064, 21, 28, 883, 856, 353, 2117, 29,
- /* 2760 */ 487, 2803, 2063, 2821, 2062, 208, 218, 2040, 20, 49,
- /* 2770 */ 2619, 891, 2454, 896, 122, 918, 880, 921, 924, 2768,
- /* 2780 */ 927, 882, 50, 2802, 16, 2821, 2850, 2032, 30, 31,
- /* 2790 */ 435, 2804, 886, 2806, 2807, 881, 82, 355, 869, 2851,
- /* 2800 */ 905, 2768, 889, 882, 123, 128, 2821, 91, 897, 361,
- /* 2810 */ 2076, 2863, 2862, 904, 80, 2267, 885, 906, 1736, 2266,
- /* 2820 */ 910, 521, 2768, 1733, 882, 914, 2802, 912, 917, 2850,
- /* 2830 */ 920, 915, 923, 428, 2804, 886, 2806, 2807, 881, 1732,
- /* 2840 */ 1729, 869, 2851, 905, 926, 385, 1749, 1723, 2802, 1721,
- /* 2850 */ 129, 2850, 130, 92, 1727, 201, 2804, 886, 2806, 2807,
- /* 2860 */ 881, 1745, 1726, 869, 2851, 905, 1595, 1635, 1634, 2802,
- /* 2870 */ 941, 1725, 2850, 1724, 1633, 955, 434, 2804, 886, 2806,
- /* 2880 */ 2807, 881, 2803, 1630, 869, 2851, 905, 817, 2879, 1627,
- /* 2890 */ 1626, 1625, 1624, 1622, 1620, 1619, 1618, 883, 1665, 1664,
- /* 2900 */ 957, 234, 1616, 1615, 1613, 1614, 1612, 2803, 1611, 1661,
- /* 2910 */ 1610, 1659, 1607, 1606, 1603, 1602, 1601, 1600, 3033, 2359,
- /* 2920 */ 977, 2357, 883, 981, 979, 978, 2355, 2821, 985, 983,
- /* 2930 */ 2352, 989, 987, 991, 2332, 993, 2330, 982, 995, 1537,
- /* 2940 */ 986, 2304, 1520, 2768, 990, 882, 999, 1525, 1527, 2803,
- /* 2950 */ 391, 1991, 2821, 1003, 2270, 404, 1006, 1007, 2270, 2270,
- /* 2960 */ 2270, 2270, 2270, 2270, 883, 2270, 2270, 500, 2768, 2270,
- /* 2970 */ 882, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 2980 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 2990 */ 2802, 2270, 495, 2850, 2821, 2270, 2270, 435, 2804, 886,
- /* 3000 */ 2806, 2807, 881, 2270, 2270, 869, 2851, 905, 2270, 2270,
- /* 3010 */ 2768, 2270, 882, 2270, 2803, 2802, 2270, 2270, 2850, 2270,
- /* 3020 */ 2270, 2270, 420, 2804, 886, 2806, 2807, 881, 2270, 883,
- /* 3030 */ 869, 2851, 905, 2270, 501, 2270, 2270, 2270, 2270, 2270,
- /* 3040 */ 2270, 2803, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3050 */ 2270, 2270, 2270, 2270, 2270, 2270, 883, 2802, 2270, 2821,
- /* 3060 */ 2850, 2270, 2270, 2270, 435, 2804, 886, 2806, 2807, 881,
- /* 3070 */ 2270, 2270, 869, 2851, 905, 2768, 2270, 882, 2270, 2803,
- /* 3080 */ 2270, 2270, 2270, 2270, 2270, 2270, 2821, 2270, 2270, 2270,
- /* 3090 */ 2270, 2270, 2270, 2270, 883, 2270, 2270, 2270, 2270, 503,
- /* 3100 */ 2270, 2270, 2768, 2270, 882, 2270, 2270, 2270, 2803, 2270,
- /* 3110 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3120 */ 2270, 2270, 2802, 883, 2821, 2850, 2270, 2270, 2270, 435,
- /* 3130 */ 2804, 886, 2806, 2807, 881, 2270, 2270, 869, 2851, 905,
- /* 3140 */ 2768, 2270, 882, 2270, 2270, 2270, 2270, 2803, 2270, 2802,
- /* 3150 */ 2270, 2270, 2850, 2821, 2270, 2270, 416, 2804, 886, 2806,
- /* 3160 */ 2807, 881, 883, 2270, 869, 2851, 905, 2270, 2270, 2768,
- /* 3170 */ 2270, 882, 2270, 2803, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3180 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 766, 883, 2270,
- /* 3190 */ 2850, 2270, 2821, 2270, 430, 2804, 886, 2806, 2807, 881,
- /* 3200 */ 2270, 2270, 869, 2851, 905, 2270, 2270, 2270, 2768, 2270,
- /* 3210 */ 882, 2270, 2270, 2270, 2270, 2270, 2802, 2270, 2821, 2850,
- /* 3220 */ 2270, 2270, 2270, 412, 2804, 886, 2806, 2807, 881, 2270,
- /* 3230 */ 2270, 869, 2851, 905, 2768, 2270, 882, 2270, 2803, 2270,
- /* 3240 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3250 */ 2270, 2270, 2270, 883, 2270, 2802, 2270, 2270, 2850, 2803,
- /* 3260 */ 2270, 2270, 409, 2804, 886, 2806, 2807, 881, 2270, 2270,
- /* 3270 */ 869, 2851, 905, 2270, 883, 2270, 2270, 2270, 2270, 2270,
- /* 3280 */ 2270, 2802, 2270, 2821, 2850, 2270, 2270, 2270, 413, 2804,
- /* 3290 */ 886, 2806, 2807, 881, 2270, 2270, 869, 2851, 905, 2768,
- /* 3300 */ 2270, 882, 2270, 2270, 2821, 2270, 2270, 2270, 2270, 2270,
- /* 3310 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3320 */ 2768, 2270, 882, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3330 */ 2270, 2270, 2270, 2270, 2270, 2270, 2803, 2270, 2270, 2270,
- /* 3340 */ 2270, 2270, 2270, 2270, 2270, 2270, 2802, 2270, 2270, 2850,
- /* 3350 */ 2270, 883, 2270, 427, 2804, 886, 2806, 2807, 881, 2270,
- /* 3360 */ 2270, 869, 2851, 905, 2270, 2270, 2270, 2802, 2270, 2270,
- /* 3370 */ 2850, 2270, 2270, 2270, 414, 2804, 886, 2806, 2807, 881,
- /* 3380 */ 2803, 2821, 869, 2851, 905, 2270, 2270, 2270, 2270, 2270,
- /* 3390 */ 2270, 2270, 2270, 2270, 2270, 883, 2270, 2768, 2270, 882,
- /* 3400 */ 2270, 2803, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3410 */ 2270, 2270, 2270, 2270, 2270, 2270, 883, 2270, 2270, 2270,
- /* 3420 */ 2270, 2803, 2270, 2270, 2270, 2821, 2270, 2270, 2270, 2270,
- /* 3430 */ 2270, 2270, 2270, 2270, 2270, 2270, 883, 2270, 2270, 2270,
- /* 3440 */ 2270, 2768, 2270, 882, 2802, 2270, 2821, 2850, 2270, 2270,
- /* 3450 */ 2270, 415, 2804, 886, 2806, 2807, 881, 2270, 2270, 869,
- /* 3460 */ 2851, 905, 2768, 2270, 882, 2270, 2821, 2270, 2270, 2270,
- /* 3470 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3480 */ 2270, 2270, 2768, 2270, 882, 2270, 2803, 2270, 2802, 2270,
- /* 3490 */ 2270, 2850, 2270, 2270, 2270, 431, 2804, 886, 2806, 2807,
- /* 3500 */ 881, 883, 2270, 869, 2851, 905, 2270, 2270, 2270, 2802,
- /* 3510 */ 2270, 2270, 2850, 2270, 2270, 2270, 417, 2804, 886, 2806,
- /* 3520 */ 2807, 881, 2270, 2270, 869, 2851, 905, 2803, 2270, 2802,
- /* 3530 */ 2270, 2821, 2850, 2270, 2270, 2270, 432, 2804, 886, 2806,
- /* 3540 */ 2807, 881, 883, 2270, 869, 2851, 905, 2768, 2270, 882,
- /* 3550 */ 2270, 2803, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3560 */ 2270, 2270, 2270, 2270, 2270, 2270, 883, 2270, 2270, 2270,
- /* 3570 */ 2270, 2270, 2821, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3580 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2768, 2270,
- /* 3590 */ 882, 2270, 2270, 2270, 2802, 2270, 2821, 2850, 2270, 2270,
- /* 3600 */ 2270, 418, 2804, 886, 2806, 2807, 881, 2270, 2270, 869,
- /* 3610 */ 2851, 905, 2768, 2270, 882, 2270, 2270, 2270, 2803, 2270,
- /* 3620 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3630 */ 2270, 2270, 2270, 883, 2270, 2802, 2270, 2270, 2850, 2270,
- /* 3640 */ 2803, 2270, 433, 2804, 886, 2806, 2807, 881, 2270, 2270,
- /* 3650 */ 869, 2851, 905, 2270, 2270, 883, 2270, 2270, 2270, 2802,
- /* 3660 */ 2270, 2270, 2850, 2821, 2270, 2270, 419, 2804, 886, 2806,
- /* 3670 */ 2807, 881, 2270, 2270, 869, 2851, 905, 2270, 2270, 2768,
- /* 3680 */ 2270, 882, 2270, 2803, 2270, 2821, 2270, 2270, 2270, 2270,
- /* 3690 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 883, 2270,
- /* 3700 */ 2270, 2768, 2270, 882, 2270, 2270, 2270, 2803, 2270, 2270,
- /* 3710 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3720 */ 2270, 2270, 883, 2270, 2270, 2270, 2802, 2270, 2821, 2850,
- /* 3730 */ 2270, 2270, 2270, 410, 2804, 886, 2806, 2807, 881, 2270,
- /* 3740 */ 2270, 869, 2851, 905, 2768, 2270, 882, 2270, 2802, 2270,
- /* 3750 */ 2270, 2850, 2821, 2270, 2270, 421, 2804, 886, 2806, 2807,
- /* 3760 */ 881, 2270, 2270, 869, 2851, 905, 2270, 2270, 2768, 2270,
- /* 3770 */ 882, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3780 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3790 */ 2270, 2802, 2270, 2270, 2850, 2270, 2270, 2270, 422, 2804,
- /* 3800 */ 886, 2806, 2807, 881, 2270, 2270, 869, 2851, 905, 2270,
- /* 3810 */ 2270, 2270, 2270, 2270, 2270, 2802, 2270, 2270, 2850, 2270,
- /* 3820 */ 2270, 2270, 423, 2804, 886, 2806, 2807, 881, 2803, 2270,
- /* 3830 */ 869, 2851, 905, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3840 */ 2270, 2270, 2270, 883, 2270, 2270, 2270, 2803, 2270, 2270,
- /* 3850 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3860 */ 2270, 2270, 883, 2270, 2270, 2270, 2270, 2270, 2270, 2803,
- /* 3870 */ 2270, 2270, 2270, 2821, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3880 */ 2270, 2270, 2270, 2270, 883, 2270, 2270, 2270, 2270, 2768,
- /* 3890 */ 2270, 882, 2821, 2270, 2270, 2270, 2803, 2270, 2270, 2270,
- /* 3900 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2768, 2270,
- /* 3910 */ 882, 883, 2270, 2270, 2821, 2270, 2270, 2270, 2270, 2270,
- /* 3920 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 3930 */ 2768, 2270, 882, 2270, 2803, 2270, 2802, 2270, 2270, 2850,
- /* 3940 */ 2270, 2821, 2270, 424, 2804, 886, 2806, 2807, 881, 883,
- /* 3950 */ 2270, 869, 2851, 905, 2270, 2802, 2270, 2768, 2850, 882,
- /* 3960 */ 2270, 2270, 440, 2804, 886, 2806, 2807, 881, 2270, 2270,
- /* 3970 */ 869, 2851, 905, 2270, 2270, 2270, 2270, 2802, 2270, 2821,
- /* 3980 */ 2850, 2270, 2270, 2803, 441, 2804, 886, 2806, 2807, 881,
- /* 3990 */ 2270, 2270, 869, 2851, 905, 2768, 2270, 882, 883, 2270,
- /* 4000 */ 2270, 2270, 2270, 2270, 2802, 2270, 2270, 2850, 2270, 2270,
- /* 4010 */ 2270, 2815, 2804, 886, 2806, 2807, 881, 2270, 2270, 869,
- /* 4020 */ 2851, 905, 2803, 2270, 2270, 2270, 2270, 2270, 2821, 2270,
- /* 4030 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 883, 2270, 2270,
- /* 4040 */ 2270, 2270, 2802, 2270, 2768, 2850, 882, 2270, 2270, 2814,
- /* 4050 */ 2804, 886, 2806, 2807, 881, 2270, 2270, 869, 2851, 905,
- /* 4060 */ 2270, 2270, 2270, 2270, 2270, 2270, 2803, 2821, 2270, 2270,
- /* 4070 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4080 */ 2270, 883, 2270, 2768, 2270, 882, 2270, 2270, 2270, 2270,
- /* 4090 */ 2803, 2802, 2270, 2270, 2850, 2270, 2270, 2270, 2813, 2804,
- /* 4100 */ 886, 2806, 2807, 881, 2270, 883, 869, 2851, 905, 2803,
- /* 4110 */ 2270, 2821, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4120 */ 2270, 2270, 2270, 2270, 883, 2270, 2270, 2768, 2270, 882,
- /* 4130 */ 2802, 2270, 2270, 2850, 2270, 2821, 2270, 457, 2804, 886,
- /* 4140 */ 2806, 2807, 881, 2270, 2270, 869, 2851, 905, 2270, 2270,
- /* 4150 */ 2270, 2768, 2270, 882, 2821, 2270, 2270, 2270, 2270, 2270,
- /* 4160 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4170 */ 2768, 2270, 882, 2270, 2802, 2270, 2270, 2850, 2803, 2270,
- /* 4180 */ 2270, 458, 2804, 886, 2806, 2807, 881, 2270, 2270, 869,
- /* 4190 */ 2851, 905, 2270, 883, 2270, 2270, 2270, 2270, 2802, 2270,
- /* 4200 */ 2270, 2850, 2270, 2270, 2270, 454, 2804, 886, 2806, 2807,
- /* 4210 */ 881, 2270, 2270, 869, 2851, 905, 2270, 2802, 2270, 2270,
- /* 4220 */ 2850, 2270, 2270, 2821, 459, 2804, 886, 2806, 2807, 881,
- /* 4230 */ 2270, 2270, 869, 2851, 905, 2270, 2270, 2270, 2270, 2768,
- /* 4240 */ 2270, 882, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4250 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4260 */ 2803, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4270 */ 2270, 2270, 2270, 2270, 2270, 883, 2270, 2270, 2270, 2270,
- /* 4280 */ 2270, 2270, 2270, 2270, 2270, 2270, 884, 2270, 2270, 2850,
- /* 4290 */ 2270, 2270, 2270, 430, 2804, 886, 2806, 2807, 881, 2270,
- /* 4300 */ 2270, 869, 2851, 905, 2270, 2821, 2270, 2270, 2270, 2270,
- /* 4310 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4320 */ 2270, 2768, 2270, 882, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4330 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4340 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4350 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270,
- /* 4360 */ 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2270, 2802, 2270,
- /* 4370 */ 2270, 2850, 2270, 2270, 2270, 429, 2804, 886, 2806, 2807,
- /* 4380 */ 881, 2270, 2270, 869, 2851, 905,
+ /* 0 */ 839, 683, 3059, 691, 684, 2351, 684, 2351, 3054, 2577,
+ /* 10 */ 3054, 2816, 60, 58, 678, 59, 57, 56, 55, 54,
+ /* 20 */ 506, 2304, 2016, 2521, 915, 2517, 838, 231, 858, 3058,
+ /* 30 */ 2816, 3055, 840, 3055, 3057, 205, 2014, 332, 2124, 2399,
+ /* 40 */ 2041, 2820, 151, 2841, 530, 150, 149, 148, 147, 146,
+ /* 50 */ 145, 144, 143, 142, 914, 851, 170, 466, 854, 389,
+ /* 60 */ 2820, 53, 52, 220, 680, 59, 57, 56, 55, 54,
+ /* 70 */ 2303, 2119, 151, 2045, 884, 150, 149, 148, 147, 146,
+ /* 80 */ 145, 144, 143, 142, 782, 2022, 2041, 2674, 2859, 829,
+ /* 90 */ 2647, 2822, 2824, 501, 160, 159, 158, 157, 156, 155,
+ /* 100 */ 154, 153, 152, 688, 2806, 919, 896, 2672, 901, 685,
+ /* 110 */ 2822, 2825, 1592, 2759, 1591, 1021, 851, 170, 61, 990,
+ /* 120 */ 989, 988, 987, 536, 919, 986, 985, 175, 980, 979,
+ /* 130 */ 978, 977, 976, 975, 974, 174, 968, 967, 966, 535,
+ /* 140 */ 534, 963, 962, 961, 211, 210, 960, 531, 959, 958,
+ /* 150 */ 957, 2840, 63, 1593, 2891, 2127, 2128, 197, 134, 2842,
+ /* 160 */ 900, 2844, 2845, 895, 75, 2448, 883, 2892, 919, 2041,
+ /* 170 */ 802, 772, 1592, 213, 1591, 2954, 2042, 251, 3054, 500,
+ /* 180 */ 2950, 207, 2962, 850, 75, 162, 849, 766, 166, 770,
+ /* 190 */ 768, 303, 302, 3054, 2077, 2087, 3060, 231, 198, 232,
+ /* 200 */ 2315, 3055, 840, 3059, 2126, 2129, 528, 3001, 509, 2570,
+ /* 210 */ 2572, 838, 231, 1593, 1862, 1863, 3055, 840, 195, 2017,
+ /* 220 */ 2044, 2015, 824, 107, 914, 9, 882, 2220, 106, 2522,
+ /* 230 */ 53, 52, 914, 2041, 59, 57, 56, 55, 54, 676,
+ /* 240 */ 64, 853, 200, 2962, 2963, 2213, 168, 2967, 674, 227,
+ /* 250 */ 318, 670, 666, 581, 2020, 2021, 2074, 2841, 2076, 2079,
+ /* 260 */ 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2088, 2089, 2090,
+ /* 270 */ 892, 885, 894, 914, 917, 916, 881, 2111, 2112, 2113,
+ /* 280 */ 2114, 2115, 2118, 2120, 2121, 2122, 2123, 2125, 2, 60,
+ /* 290 */ 58, 2216, 700, 2841, 445, 105, 2039, 506, 75, 2016,
+ /* 300 */ 458, 118, 2859, 625, 644, 642, 469, 441, 897, 2046,
+ /* 310 */ 245, 1889, 1890, 2014, 646, 2124, 915, 2517, 2806, 2286,
+ /* 320 */ 896, 2616, 53, 52, 127, 2074, 59, 57, 56, 55,
+ /* 330 */ 54, 510, 468, 604, 2599, 648, 236, 220, 2859, 2191,
+ /* 340 */ 446, 606, 830, 825, 818, 814, 810, 339, 2119, 2674,
+ /* 350 */ 2154, 884, 584, 785, 2806, 19, 896, 701, 2667, 339,
+ /* 360 */ 1888, 1891, 2022, 498, 2647, 2840, 2042, 2326, 2891, 2671,
+ /* 370 */ 901, 63, 436, 2842, 900, 2844, 2845, 895, 893, 339,
+ /* 380 */ 883, 2892, 919, 874, 2919, 954, 187, 186, 951, 950,
+ /* 390 */ 949, 184, 1021, 467, 973, 15, 337, 2474, 572, 2044,
+ /* 400 */ 571, 2840, 2251, 887, 2891, 592, 2674, 2078, 134, 2842,
+ /* 410 */ 900, 2844, 2845, 895, 886, 2155, 883, 2892, 919, 922,
+ /* 420 */ 508, 172, 224, 181, 2925, 2954, 2671, 901, 2806, 500,
+ /* 430 */ 2950, 570, 2127, 2128, 801, 339, 2654, 2633, 2564, 634,
+ /* 440 */ 633, 631, 630, 629, 624, 623, 622, 621, 450, 590,
+ /* 450 */ 2643, 611, 610, 609, 608, 607, 601, 600, 599, 267,
+ /* 460 */ 594, 593, 465, 686, 699, 2359, 585, 1850, 1851, 2075,
+ /* 470 */ 220, 2077, 2087, 1869, 821, 820, 2249, 2250, 2252, 2253,
+ /* 480 */ 2254, 2126, 2129, 2974, 2188, 2189, 2190, 2974, 2974, 2974,
+ /* 490 */ 2974, 2974, 620, 339, 2160, 618, 2017, 2648, 2015, 41,
+ /* 500 */ 617, 1786, 1787, 882, 247, 53, 52, 619, 616, 59,
+ /* 510 */ 57, 56, 55, 54, 44, 502, 2149, 2150, 2151, 2152,
+ /* 520 */ 2153, 2157, 2158, 2159, 79, 2293, 2193, 2194, 2195, 2196,
+ /* 530 */ 2197, 2020, 2021, 2074, 2841, 2076, 2079, 2080, 2081, 2082,
+ /* 540 */ 2083, 2084, 2085, 2086, 2088, 2089, 2090, 892, 885, 854,
+ /* 550 */ 3059, 917, 916, 881, 2111, 2112, 2212, 786, 3054, 2118,
+ /* 560 */ 2120, 2121, 2122, 2123, 2125, 2, 60, 58, 2841, 2191,
+ /* 570 */ 2016, 828, 533, 532, 506, 337, 2016, 3058, 73, 2859,
+ /* 580 */ 2577, 3055, 3056, 897, 2014, 2135, 45, 355, 1747, 799,
+ /* 590 */ 2014, 2041, 2124, 702, 269, 2806, 2023, 896, 686, 866,
+ /* 600 */ 2359, 2859, 1561, 1738, 946, 945, 944, 1742, 943, 1744,
+ /* 610 */ 1745, 942, 939, 2859, 1753, 936, 1755, 1756, 933, 930,
+ /* 620 */ 927, 1568, 2499, 473, 786, 2119, 195, 2969, 884, 2806,
+ /* 630 */ 923, 896, 19, 2022, 137, 596, 2643, 2523, 75, 2022,
+ /* 640 */ 693, 2713, 2840, 526, 2519, 2891, 1563, 1566, 1567, 134,
+ /* 650 */ 2842, 900, 2844, 2845, 895, 2292, 2966, 883, 2892, 919,
+ /* 660 */ 915, 2517, 706, 1021, 213, 196, 2954, 725, 724, 1021,
+ /* 670 */ 500, 2950, 15, 827, 526, 2519, 2840, 915, 2517, 2891,
+ /* 680 */ 161, 2841, 2045, 135, 2842, 900, 2844, 2845, 895, 731,
+ /* 690 */ 249, 883, 2892, 919, 487, 2721, 897, 161, 3002, 2489,
+ /* 700 */ 2954, 56, 55, 54, 2953, 2950, 736, 788, 2713, 2127,
+ /* 710 */ 2128, 627, 2643, 2974, 2188, 2189, 2190, 2974, 2974, 2974,
+ /* 720 */ 2974, 2974, 518, 53, 52, 956, 2859, 59, 57, 56,
+ /* 730 */ 55, 54, 752, 751, 750, 851, 170, 14, 13, 742,
+ /* 740 */ 167, 746, 2806, 783, 896, 745, 1683, 521, 2077, 2087,
+ /* 750 */ 744, 749, 480, 479, 2191, 12, 743, 558, 2126, 2129,
+ /* 760 */ 478, 739, 738, 737, 2969, 2078, 254, 2017, 2022, 2015,
+ /* 770 */ 2571, 2572, 43, 2017, 1695, 2015, 956, 2045, 53, 52,
+ /* 780 */ 882, 2026, 59, 57, 56, 55, 54, 2799, 1694, 2840,
+ /* 790 */ 523, 703, 2891, 2965, 2041, 1685, 199, 2842, 900, 2844,
+ /* 800 */ 2845, 895, 2020, 2021, 883, 2892, 919, 2301, 2020, 2021,
+ /* 810 */ 2074, 2841, 2076, 2079, 2080, 2081, 2082, 2083, 2084, 2085,
+ /* 820 */ 2086, 2088, 2089, 2090, 892, 885, 897, 2075, 917, 916,
+ /* 830 */ 881, 2111, 2112, 339, 2262, 2325, 2118, 2120, 2121, 2122,
+ /* 840 */ 2123, 2125, 2, 12, 60, 58, 803, 3012, 851, 170,
+ /* 850 */ 512, 2661, 506, 704, 2016, 2168, 2859, 947, 226, 1699,
+ /* 860 */ 1747, 140, 2962, 2963, 919, 168, 2967, 649, 2014, 2969,
+ /* 870 */ 2124, 117, 2806, 1698, 896, 1738, 946, 945, 944, 1742,
+ /* 880 */ 943, 1744, 1745, 891, 890, 2577, 1753, 889, 1755, 1756,
+ /* 890 */ 888, 930, 927, 464, 2324, 562, 2806, 539, 2964, 2188,
+ /* 900 */ 2189, 2190, 538, 2119, 2575, 1917, 884, 1985, 113, 396,
+ /* 910 */ 19, 1595, 1596, 915, 2517, 1568, 307, 2022, 2046, 2840,
+ /* 920 */ 2506, 126, 2891, 564, 560, 638, 135, 2842, 900, 2844,
+ /* 930 */ 2845, 895, 1984, 68, 883, 2892, 919, 2511, 517, 516,
+ /* 940 */ 553, 1566, 1567, 2954, 2841, 915, 2517, 1021, 2951, 2508,
+ /* 950 */ 15, 2800, 651, 234, 802, 2806, 225, 915, 2517, 897,
+ /* 960 */ 2760, 2361, 3054, 520, 519, 578, 190, 238, 2078, 486,
+ /* 970 */ 2721, 409, 533, 532, 201, 2962, 2963, 579, 168, 2967,
+ /* 980 */ 3060, 231, 2030, 512, 839, 3055, 840, 2127, 2128, 2859,
+ /* 990 */ 407, 89, 3054, 256, 88, 2323, 2023, 919, 2124, 727,
+ /* 1000 */ 726, 1943, 1944, 470, 2491, 2806, 2504, 896, 447, 2322,
+ /* 1010 */ 838, 231, 2502, 2046, 512, 3055, 840, 802, 637, 255,
+ /* 1020 */ 265, 661, 659, 656, 654, 3054, 2077, 2087, 919, 97,
+ /* 1030 */ 2075, 2119, 635, 3, 53, 52, 2126, 2129, 59, 57,
+ /* 1040 */ 56, 55, 54, 3060, 231, 2022, 173, 66, 3055, 840,
+ /* 1050 */ 2321, 2017, 2840, 2015, 113, 2891, 2806, 2507, 882, 134,
+ /* 1060 */ 2842, 900, 2844, 2845, 895, 2243, 75, 883, 2892, 919,
+ /* 1070 */ 2806, 748, 747, 471, 3074, 879, 2954, 346, 347, 2244,
+ /* 1080 */ 500, 2950, 345, 2510, 574, 3058, 2020, 2021, 2074, 573,
+ /* 1090 */ 2076, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2088,
+ /* 1100 */ 2089, 2090, 892, 885, 970, 76, 917, 916, 881, 2111,
+ /* 1110 */ 2112, 2806, 984, 982, 2118, 2120, 2121, 2122, 2123, 2125,
+ /* 1120 */ 2, 60, 58, 2130, 915, 2517, 2320, 2319, 2242, 506,
+ /* 1130 */ 2318, 2016, 53, 52, 2331, 1014, 59, 57, 56, 55,
+ /* 1140 */ 54, 802, 306, 2577, 598, 2014, 305, 2124, 2449, 3054,
+ /* 1150 */ 759, 496, 954, 187, 186, 951, 950, 949, 184, 101,
+ /* 1160 */ 100, 577, 2575, 846, 244, 773, 2577, 3060, 231, 2488,
+ /* 1170 */ 2317, 40, 3055, 840, 511, 395, 972, 569, 567, 2031,
+ /* 1180 */ 2119, 2026, 403, 884, 304, 2575, 2554, 2806, 2806, 444,
+ /* 1190 */ 2402, 2806, 556, 314, 2022, 552, 548, 544, 541, 570,
+ /* 1200 */ 2727, 53, 52, 762, 402, 59, 57, 56, 55, 54,
+ /* 1210 */ 756, 754, 915, 2517, 2034, 2036, 12, 301, 10, 2314,
+ /* 1220 */ 116, 2841, 2521, 196, 1021, 453, 34, 61, 485, 2577,
+ /* 1230 */ 774, 2806, 612, 2520, 917, 916, 897, 527, 3009, 185,
+ /* 1240 */ 915, 2517, 2118, 2120, 2121, 2122, 2123, 2125, 2575, 915,
+ /* 1250 */ 2517, 53, 52, 915, 2517, 59, 57, 56, 55, 54,
+ /* 1260 */ 613, 339, 308, 85, 2127, 2128, 2859, 2045, 84, 614,
+ /* 1270 */ 752, 751, 750, 705, 2041, 2746, 809, 742, 167, 746,
+ /* 1280 */ 2806, 396, 2806, 745, 896, 915, 2517, 2313, 744, 749,
+ /* 1290 */ 480, 479, 333, 2312, 743, 915, 2517, 2577, 478, 739,
+ /* 1300 */ 738, 737, 2386, 2077, 2087, 2512, 915, 2517, 875, 877,
+ /* 1310 */ 2926, 2926, 2263, 2126, 2129, 309, 2576, 954, 187, 186,
+ /* 1320 */ 951, 950, 949, 184, 753, 67, 317, 2311, 2017, 2840,
+ /* 1330 */ 2015, 2156, 2891, 833, 843, 882, 134, 2842, 900, 2844,
+ /* 1340 */ 2845, 895, 2722, 2316, 883, 2892, 919, 948, 2806, 952,
+ /* 1350 */ 2568, 3074, 2568, 2954, 2806, 2310, 735, 500, 2950, 2309,
+ /* 1360 */ 734, 205, 2238, 2020, 2021, 2074, 2841, 2076, 2079, 2080,
+ /* 1370 */ 2081, 2082, 2083, 2084, 2085, 2086, 2088, 2089, 2090, 892,
+ /* 1380 */ 885, 897, 2626, 917, 916, 881, 2111, 2112, 2806, 915,
+ /* 1390 */ 2517, 2118, 2120, 2121, 2122, 2123, 2125, 2, 60, 58,
+ /* 1400 */ 2841, 915, 2517, 915, 2517, 2202, 506, 2750, 2016, 857,
+ /* 1410 */ 2161, 2859, 915, 2517, 2308, 897, 2806, 3022, 842, 2307,
+ /* 1420 */ 2806, 350, 2014, 871, 2124, 171, 588, 2806, 2925, 896,
+ /* 1430 */ 42, 2306, 357, 53, 52, 915, 2517, 59, 57, 56,
+ /* 1440 */ 55, 54, 53, 52, 529, 2859, 59, 57, 56, 55,
+ /* 1450 */ 54, 775, 915, 2517, 195, 908, 1570, 2119, 915, 2517,
+ /* 1460 */ 884, 2806, 2040, 896, 546, 2522, 953, 915, 2517, 2568,
+ /* 1470 */ 847, 2022, 909, 2588, 2840, 2806, 3015, 2891, 913, 163,
+ /* 1480 */ 2806, 413, 2842, 900, 2844, 2845, 895, 385, 32, 883,
+ /* 1490 */ 2892, 919, 2806, 103, 91, 2492, 294, 296, 2841, 292,
+ /* 1500 */ 295, 1021, 177, 2046, 61, 2109, 2295, 2296, 2840, 2579,
+ /* 1510 */ 2075, 2891, 740, 897, 1678, 134, 2842, 900, 2844, 2845,
+ /* 1520 */ 895, 222, 177, 883, 2892, 919, 298, 2384, 176, 297,
+ /* 1530 */ 3074, 300, 2954, 812, 299, 1676, 500, 2950, 2375, 741,
+ /* 1540 */ 185, 2127, 2128, 2859, 2101, 2373, 62, 822, 104, 755,
+ /* 1550 */ 53, 52, 62, 2232, 59, 57, 56, 55, 54, 2806,
+ /* 1560 */ 757, 896, 1674, 1679, 14, 13, 880, 760, 53, 52,
+ /* 1570 */ 364, 363, 59, 57, 56, 55, 54, 2025, 53, 52,
+ /* 1580 */ 2077, 2087, 59, 57, 56, 55, 54, 325, 1933, 47,
+ /* 1590 */ 2126, 2129, 53, 52, 214, 344, 59, 57, 56, 55,
+ /* 1600 */ 54, 90, 62, 366, 365, 2017, 2840, 2015, 1941, 2891,
+ /* 1610 */ 77, 852, 882, 134, 2842, 900, 2844, 2845, 895, 2236,
+ /* 1620 */ 62, 883, 2892, 919, 2827, 2024, 856, 165, 2929, 2860,
+ /* 1630 */ 2954, 632, 2248, 776, 500, 2950, 368, 367, 2247, 844,
+ /* 1640 */ 2020, 2021, 2074, 62, 2076, 2079, 2080, 2081, 2082, 2083,
+ /* 1650 */ 2084, 2085, 2086, 2088, 2089, 2090, 892, 885, 62, 2441,
+ /* 1660 */ 917, 916, 881, 2111, 2112, 62, 90, 647, 2118, 2120,
+ /* 1670 */ 2121, 2122, 2123, 2125, 2, 60, 58, 2841, 182, 2097,
+ /* 1680 */ 323, 348, 779, 506, 2440, 2016, 163, 863, 2100, 2099,
+ /* 1690 */ 185, 2829, 897, 132, 816, 129, 2162, 2352, 46, 2014,
+ /* 1700 */ 87, 2124, 2367, 2102, 370, 369, 2110, 53, 52, 3005,
+ /* 1710 */ 39, 59, 57, 56, 55, 54, 372, 371, 1656, 53,
+ /* 1720 */ 52, 819, 2859, 59, 57, 56, 55, 54, 2841, 2103,
+ /* 1730 */ 374, 373, 376, 375, 2119, 378, 377, 884, 2806, 802,
+ /* 1740 */ 896, 925, 2146, 897, 1886, 380, 379, 3054, 2022, 382,
+ /* 1750 */ 381, 2091, 1876, 384, 383, 1629, 964, 965, 48, 492,
+ /* 1760 */ 1008, 826, 2028, 183, 360, 3060, 231, 1657, 185, 164,
+ /* 1770 */ 3055, 840, 912, 2859, 488, 182, 1729, 860, 1021, 1648,
+ /* 1780 */ 1646, 61, 2652, 555, 2565, 2840, 401, 537, 2891, 2806,
+ /* 1790 */ 2358, 896, 134, 2842, 900, 2844, 2845, 895, 795, 3006,
+ /* 1800 */ 883, 2892, 919, 3016, 1630, 834, 835, 3074, 330, 2954,
+ /* 1810 */ 2027, 338, 335, 500, 2950, 2653, 53, 52, 2127, 2128,
+ /* 1820 */ 59, 57, 56, 55, 54, 2475, 5, 1760, 540, 545,
+ /* 1830 */ 2096, 462, 2039, 554, 2049, 566, 2840, 565, 239, 2891,
+ /* 1840 */ 568, 240, 394, 135, 2842, 900, 2844, 2845, 895, 1768,
+ /* 1850 */ 242, 883, 2892, 919, 1775, 1773, 1910, 2077, 2087, 582,
+ /* 1860 */ 2954, 188, 2040, 589, 878, 2950, 253, 2126, 2129, 53,
+ /* 1870 */ 52, 591, 595, 59, 57, 56, 55, 54, 597, 640,
+ /* 1880 */ 602, 615, 2017, 626, 2015, 2645, 53, 52, 636, 882,
+ /* 1890 */ 59, 57, 56, 55, 54, 628, 639, 641, 652, 477,
+ /* 1900 */ 475, 653, 650, 259, 258, 657, 2047, 655, 658, 262,
+ /* 1910 */ 660, 662, 4, 681, 682, 689, 2042, 2020, 2021, 2074,
+ /* 1920 */ 690, 2076, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086,
+ /* 1930 */ 2088, 2089, 2090, 892, 885, 692, 270, 917, 916, 881,
+ /* 1940 */ 2111, 2112, 694, 787, 109, 2118, 2120, 2121, 2122, 2123,
+ /* 1950 */ 2125, 2, 60, 58, 273, 2048, 695, 2050, 696, 276,
+ /* 1960 */ 506, 698, 2016, 2051, 855, 278, 2668, 110, 2052, 111,
+ /* 1970 */ 112, 49, 2662, 1727, 2841, 730, 2014, 707, 2124, 284,
+ /* 1980 */ 2098, 287, 474, 472, 114, 733, 732, 763, 764, 897,
+ /* 1990 */ 2736, 3047, 139, 2505, 291, 439, 2501, 2095, 778, 115,
+ /* 2000 */ 802, 293, 191, 780, 138, 2841, 735, 310, 3054, 136,
+ /* 2010 */ 734, 2119, 2043, 178, 884, 2503, 2498, 192, 193, 2859,
+ /* 2020 */ 897, 802, 397, 2714, 790, 2022, 3060, 231, 791, 3054,
+ /* 2030 */ 789, 3055, 840, 315, 313, 2806, 2733, 896, 2732, 823,
+ /* 2040 */ 797, 861, 3021, 794, 3020, 8, 832, 3060, 231, 326,
+ /* 2050 */ 2859, 806, 3055, 840, 796, 1021, 2841, 2993, 61, 807,
+ /* 2060 */ 805, 837, 804, 320, 204, 2973, 2806, 328, 896, 324,
+ /* 2070 */ 322, 897, 327, 2986, 836, 329, 331, 845, 848, 169,
+ /* 2080 */ 493, 2044, 2840, 2210, 2208, 2891, 217, 340, 179, 134,
+ /* 2090 */ 2842, 900, 2844, 2845, 895, 2127, 2128, 883, 2892, 919,
+ /* 2100 */ 3077, 2859, 3053, 398, 3074, 2970, 2954, 859, 334, 2682,
+ /* 2110 */ 500, 2950, 2681, 898, 1, 2680, 2891, 2806, 497, 896,
+ /* 2120 */ 135, 2842, 900, 2844, 2845, 895, 864, 872, 883, 2892,
+ /* 2130 */ 919, 399, 869, 74, 2077, 2087, 865, 2954, 180, 2935,
+ /* 2140 */ 353, 457, 2950, 904, 2126, 2129, 902, 233, 906, 907,
+ /* 2150 */ 2798, 2797, 128, 400, 2793, 2518, 2792, 404, 2784, 2017,
+ /* 2160 */ 358, 2015, 2783, 125, 2840, 387, 882, 2891, 2775, 2774,
+ /* 2170 */ 921, 134, 2842, 900, 2844, 2845, 895, 1540, 1016, 883,
+ /* 2180 */ 2892, 919, 2790, 1017, 2789, 2781, 3074, 2780, 2954, 1018,
+ /* 2190 */ 189, 1013, 500, 2950, 2020, 2021, 2074, 391, 2076, 2079,
+ /* 2200 */ 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2088, 2089, 2090,
+ /* 2210 */ 892, 885, 1020, 2769, 917, 916, 881, 2111, 2112, 2768,
+ /* 2220 */ 2787, 2786, 2118, 2120, 2121, 2122, 2123, 2125, 2, 60,
+ /* 2230 */ 58, 2778, 2777, 2766, 2765, 390, 2763, 506, 2762, 2016,
+ /* 2240 */ 2569, 65, 476, 454, 427, 782, 440, 455, 524, 438,
+ /* 2250 */ 428, 2841, 406, 2014, 408, 2124, 2758, 2757, 2756, 98,
+ /* 2260 */ 2751, 542, 543, 1967, 1968, 547, 897, 237, 2749, 549,
+ /* 2270 */ 550, 551, 1966, 2748, 2747, 463, 2745, 557, 2744, 559,
+ /* 2280 */ 2743, 561, 2742, 563, 1954, 2718, 241, 2717, 2119, 243,
+ /* 2290 */ 1913, 884, 99, 1912, 2695, 2694, 2859, 2693, 575, 576,
+ /* 2300 */ 2692, 2691, 2022, 2635, 580, 1849, 2632, 583, 2631, 2625,
+ /* 2310 */ 2622, 586, 2806, 246, 896, 248, 102, 2620, 587, 2621,
+ /* 2320 */ 2619, 2624, 2623, 2618, 2617, 2615, 2614, 449, 448, 2613,
+ /* 2330 */ 2612, 2610, 1021, 2841, 603, 15, 250, 513, 605, 2609,
+ /* 2340 */ 2608, 2607, 2606, 2630, 2605, 2604, 2603, 2628, 897, 2611,
+ /* 2350 */ 2602, 522, 2601, 2124, 2600, 2598, 2597, 2596, 2595, 2840,
+ /* 2360 */ 2594, 2593, 2891, 252, 2592, 108, 134, 2842, 900, 2844,
+ /* 2370 */ 2845, 895, 2127, 2128, 883, 2892, 919, 2591, 2859, 257,
+ /* 2380 */ 2582, 2927, 2590, 2954, 2589, 2587, 2119, 500, 2950, 2586,
+ /* 2390 */ 2660, 2629, 2627, 2585, 2806, 2584, 896, 1855, 2583, 643,
+ /* 2400 */ 2581, 645, 2580, 2578, 2406, 1696, 260, 2405, 1700, 261,
+ /* 2410 */ 1692, 2077, 2087, 2404, 451, 452, 2403, 2401, 2398, 263,
+ /* 2420 */ 665, 2126, 2129, 663, 264, 664, 2397, 668, 2390, 672,
+ /* 2430 */ 667, 2377, 669, 671, 2365, 675, 2017, 677, 2015, 2364,
+ /* 2440 */ 673, 2840, 679, 882, 2891, 2347, 1569, 212, 134, 2842,
+ /* 2450 */ 900, 2844, 2845, 895, 94, 266, 883, 2892, 919, 2346,
+ /* 2460 */ 2826, 2716, 223, 876, 268, 2954, 687, 95, 2712, 500,
+ /* 2470 */ 2950, 2020, 2021, 2074, 2702, 2076, 2079, 2080, 2081, 2082,
+ /* 2480 */ 2083, 2084, 2085, 2086, 2088, 2089, 2090, 892, 885, 784,
+ /* 2490 */ 2690, 917, 916, 881, 2111, 2112, 275, 2689, 277, 2118,
+ /* 2500 */ 2120, 2121, 2122, 2123, 2125, 2, 280, 1024, 2666, 282,
+ /* 2510 */ 2659, 2493, 1622, 2400, 2396, 2841, 708, 709, 2394, 710,
+ /* 2520 */ 712, 713, 714, 2392, 717, 716, 393, 718, 2389, 720,
+ /* 2530 */ 897, 722, 2372, 721, 2007, 2370, 1983, 2371, 2369, 2366,
+ /* 2540 */ 728, 1012, 1010, 2343, 2495, 221, 1779, 290, 86, 2494,
+ /* 2550 */ 2387, 1780, 1682, 1681, 1006, 1002, 998, 994, 1680, 388,
+ /* 2560 */ 2859, 1677, 1675, 1673, 981, 1672, 983, 515, 514, 2008,
+ /* 2570 */ 1671, 2385, 1670, 481, 1664, 482, 2806, 1669, 896, 2376,
+ /* 2580 */ 483, 1666, 1665, 1663, 2374, 484, 2342, 2341, 2340, 917,
+ /* 2590 */ 916, 761, 765, 2339, 2338, 767, 769, 2118, 2120, 2121,
+ /* 2600 */ 2122, 2123, 2125, 2337, 771, 133, 1948, 758, 1950, 141,
+ /* 2610 */ 361, 1947, 2715, 1952, 33, 312, 80, 2711, 69, 1919,
+ /* 2620 */ 1921, 2841, 2701, 2840, 792, 70, 2891, 1923, 2688, 316,
+ /* 2630 */ 202, 2842, 900, 2844, 2845, 895, 897, 1938, 883, 2892,
+ /* 2640 */ 919, 867, 793, 2687, 2841, 1898, 798, 194, 800, 1897,
+ /* 2650 */ 3059, 22, 17, 808, 25, 781, 811, 489, 35, 897,
+ /* 2660 */ 6, 2265, 7, 23, 228, 24, 2859, 216, 38, 229,
+ /* 2670 */ 2827, 78, 319, 2205, 26, 2280, 2239, 18, 2279, 36,
+ /* 2680 */ 817, 2237, 2806, 813, 896, 815, 359, 494, 873, 2859,
+ /* 2690 */ 2203, 342, 841, 3075, 2284, 321, 341, 2246, 203, 215,
+ /* 2700 */ 2283, 495, 72, 37, 336, 2806, 503, 896, 208, 2231,
+ /* 2710 */ 96, 2686, 2665, 2664, 2201, 311, 2285, 230, 120, 2286,
+ /* 2720 */ 2841, 121, 351, 2185, 2658, 2184, 343, 119, 122, 2840,
+ /* 2730 */ 2241, 27, 2891, 218, 349, 897, 437, 2842, 900, 2844,
+ /* 2740 */ 2845, 895, 82, 71, 883, 2892, 919, 11, 868, 13,
+ /* 2750 */ 2032, 209, 2840, 2147, 219, 2891, 352, 2067, 21, 199,
+ /* 2760 */ 2842, 900, 2844, 2845, 895, 2859, 862, 883, 2892, 919,
+ /* 2770 */ 2137, 2841, 870, 28, 29, 354, 2657, 2136, 2094, 2490,
+ /* 2780 */ 20, 2806, 2093, 896, 50, 932, 897, 123, 935, 938,
+ /* 2790 */ 941, 51, 910, 362, 2092, 2059, 16, 30, 31, 83,
+ /* 2800 */ 905, 903, 2106, 356, 2841, 490, 124, 129, 2299, 92,
+ /* 2810 */ 3013, 911, 2904, 2903, 918, 81, 2859, 924, 920, 897,
+ /* 2820 */ 1761, 525, 926, 386, 1758, 928, 929, 931, 2840, 1757,
+ /* 2830 */ 934, 2891, 2806, 1754, 896, 437, 2842, 900, 2844, 2845,
+ /* 2840 */ 895, 1748, 937, 883, 2892, 919, 2298, 940, 899, 2859,
+ /* 2850 */ 1746, 130, 131, 1774, 93, 1752, 491, 1751, 1750, 1749,
+ /* 2860 */ 1770, 1620, 955, 1660, 1659, 2806, 1658, 896, 1655, 2841,
+ /* 2870 */ 1652, 1651, 1650, 1649, 969, 1647, 1645, 1690, 1644, 2840,
+ /* 2880 */ 1643, 1689, 2891, 971, 897, 235, 437, 2842, 900, 2844,
+ /* 2890 */ 2845, 895, 2841, 1641, 883, 2892, 919, 1640, 1639, 1638,
+ /* 2900 */ 1637, 1636, 1635, 1686, 1684, 1632, 1631, 894, 1628, 1627,
+ /* 2910 */ 1626, 1625, 2840, 992, 2859, 2891, 2395, 991, 993, 430,
+ /* 2920 */ 2842, 900, 2844, 2845, 895, 2393, 995, 883, 2892, 919,
+ /* 2930 */ 2806, 997, 896, 996, 2391, 999, 1000, 2859, 1001, 2388,
+ /* 2940 */ 1003, 1004, 1005, 2368, 1007, 2363, 1009, 2362, 1011, 2336,
+ /* 2950 */ 1558, 1541, 1015, 2806, 1546, 896, 1548, 392, 1019, 1022,
+ /* 2960 */ 2841, 2302, 2018, 405, 1023, 2302, 2302, 2302, 2302, 2302,
+ /* 2970 */ 2302, 2302, 2302, 831, 2302, 897, 2302, 2840, 2302, 2302,
+ /* 2980 */ 2891, 2302, 2302, 2302, 202, 2842, 900, 2844, 2845, 895,
+ /* 2990 */ 2302, 2302, 883, 2892, 919, 2302, 2302, 2302, 2302, 2302,
+ /* 3000 */ 2840, 2302, 2302, 2891, 2302, 2859, 2302, 436, 2842, 900,
+ /* 3010 */ 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2920,
+ /* 3020 */ 2302, 2806, 2302, 896, 2302, 2841, 2302, 289, 2302, 2302,
+ /* 3030 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3040 */ 897, 2302, 2302, 729, 2302, 504, 206, 3076, 2302, 2302,
+ /* 3050 */ 2302, 2302, 2841, 2302, 2302, 723, 719, 715, 711, 2302,
+ /* 3060 */ 288, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2840, 2302,
+ /* 3070 */ 2859, 2891, 2302, 2302, 2302, 437, 2842, 900, 2844, 2845,
+ /* 3080 */ 895, 2302, 2302, 883, 2892, 919, 2806, 2302, 896, 2302,
+ /* 3090 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2859, 2302, 2302,
+ /* 3100 */ 2302, 2302, 2302, 2302, 2302, 2302, 286, 2302, 2302, 2302,
+ /* 3110 */ 499, 285, 2302, 2806, 2302, 896, 2302, 2302, 2302, 2302,
+ /* 3120 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3130 */ 2302, 2302, 2302, 2840, 2302, 2302, 2891, 505, 2841, 2302,
+ /* 3140 */ 422, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892,
+ /* 3150 */ 919, 2302, 2302, 897, 2302, 2302, 2302, 2302, 2841, 2302,
+ /* 3160 */ 2840, 2302, 2302, 2891, 2302, 2302, 2302, 437, 2842, 900,
+ /* 3170 */ 2844, 2845, 895, 897, 2302, 883, 2892, 919, 272, 2841,
+ /* 3180 */ 2302, 2302, 2302, 2859, 2302, 2302, 2302, 283, 2302, 2302,
+ /* 3190 */ 2302, 274, 281, 2302, 897, 2302, 2302, 279, 697, 2806,
+ /* 3200 */ 2302, 896, 2302, 2859, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3210 */ 2302, 2302, 2302, 2302, 2302, 2302, 271, 2302, 2302, 2806,
+ /* 3220 */ 2302, 896, 2302, 507, 2859, 2302, 2302, 2302, 2302, 2302,
+ /* 3230 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3240 */ 2806, 2302, 896, 2302, 2302, 2302, 2840, 2302, 2302, 2891,
+ /* 3250 */ 2302, 2302, 2302, 437, 2842, 900, 2844, 2845, 895, 2302,
+ /* 3260 */ 2302, 883, 2892, 919, 2302, 2302, 2840, 2302, 2302, 2891,
+ /* 3270 */ 2302, 2302, 2302, 418, 2842, 900, 2844, 2845, 895, 2302,
+ /* 3280 */ 2302, 883, 2892, 919, 2302, 2841, 2302, 777, 2302, 2302,
+ /* 3290 */ 2891, 2302, 2302, 2302, 432, 2842, 900, 2844, 2845, 895,
+ /* 3300 */ 897, 2302, 883, 2892, 919, 2841, 2302, 2302, 2302, 2302,
+ /* 3310 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3320 */ 897, 2302, 2302, 2302, 2302, 2841, 2302, 2302, 2302, 2302,
+ /* 3330 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3340 */ 897, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302,
+ /* 3350 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3360 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302,
+ /* 3370 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3380 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302,
+ /* 3390 */ 2302, 2302, 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302,
+ /* 3400 */ 414, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892,
+ /* 3410 */ 919, 2302, 2841, 2840, 2302, 2302, 2891, 2302, 2302, 2302,
+ /* 3420 */ 410, 2842, 900, 2844, 2845, 895, 2302, 897, 883, 2892,
+ /* 3430 */ 919, 2302, 2302, 2840, 2302, 2302, 2891, 2302, 2841, 2302,
+ /* 3440 */ 411, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892,
+ /* 3450 */ 919, 2302, 2302, 897, 2302, 2302, 2302, 2859, 2302, 2302,
+ /* 3460 */ 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3470 */ 2302, 2302, 2302, 2806, 2302, 896, 897, 2302, 2302, 2302,
+ /* 3480 */ 2302, 2841, 2302, 2859, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3490 */ 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, 2302, 2806,
+ /* 3500 */ 2302, 896, 2302, 2841, 2302, 2302, 2859, 2302, 2302, 2302,
+ /* 3510 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302,
+ /* 3520 */ 2840, 2302, 2806, 2891, 896, 2302, 2859, 415, 2842, 900,
+ /* 3530 */ 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2302,
+ /* 3540 */ 2302, 2302, 2806, 2302, 896, 2302, 2840, 2302, 2859, 2891,
+ /* 3550 */ 2302, 2302, 2302, 429, 2842, 900, 2844, 2845, 895, 2302,
+ /* 3560 */ 2302, 883, 2892, 919, 2806, 2302, 896, 2302, 2841, 2840,
+ /* 3570 */ 2302, 2302, 2891, 2302, 2302, 2302, 416, 2842, 900, 2844,
+ /* 3580 */ 2845, 895, 2302, 897, 883, 2892, 919, 2841, 2302, 2840,
+ /* 3590 */ 2302, 2302, 2891, 2302, 2302, 2302, 417, 2842, 900, 2844,
+ /* 3600 */ 2845, 895, 897, 2302, 883, 2892, 919, 2302, 2302, 2841,
+ /* 3610 */ 2302, 2840, 2302, 2859, 2891, 2302, 2302, 2302, 433, 2842,
+ /* 3620 */ 900, 2844, 2845, 895, 897, 2302, 883, 2892, 919, 2806,
+ /* 3630 */ 2302, 896, 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3640 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302,
+ /* 3650 */ 896, 2302, 2302, 2302, 2859, 2302, 2302, 2302, 2302, 2302,
+ /* 3660 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3670 */ 2806, 2302, 896, 2302, 2841, 2302, 2840, 2302, 2302, 2891,
+ /* 3680 */ 2302, 2302, 2302, 419, 2842, 900, 2844, 2845, 895, 897,
+ /* 3690 */ 2302, 883, 2892, 919, 2302, 2840, 2302, 2302, 2891, 2302,
+ /* 3700 */ 2302, 2302, 434, 2842, 900, 2844, 2845, 895, 2302, 2302,
+ /* 3710 */ 883, 2892, 919, 2302, 2302, 2302, 2302, 2840, 2302, 2859,
+ /* 3720 */ 2891, 2302, 2302, 2841, 420, 2842, 900, 2844, 2845, 895,
+ /* 3730 */ 2302, 2302, 883, 2892, 919, 2806, 2302, 896, 897, 2302,
+ /* 3740 */ 2302, 2302, 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3750 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302,
+ /* 3760 */ 2302, 2302, 2302, 2841, 2302, 2302, 2302, 2302, 2859, 2302,
+ /* 3770 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302,
+ /* 3780 */ 2302, 2302, 2840, 2302, 2806, 2891, 896, 2302, 2859, 435,
+ /* 3790 */ 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892, 919,
+ /* 3800 */ 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, 2859, 2302,
+ /* 3810 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3820 */ 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, 2302, 2302,
+ /* 3830 */ 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 421, 2842,
+ /* 3840 */ 900, 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302,
+ /* 3850 */ 2841, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 412, 2842,
+ /* 3860 */ 900, 2844, 2845, 895, 2302, 897, 883, 2892, 919, 2841,
+ /* 3870 */ 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 423, 2842,
+ /* 3880 */ 900, 2844, 2845, 895, 897, 2302, 883, 2892, 919, 2841,
+ /* 3890 */ 2302, 2302, 2302, 2302, 2302, 2859, 2302, 2302, 2302, 2302,
+ /* 3900 */ 2302, 2302, 2302, 2302, 897, 2302, 2302, 2302, 2302, 2302,
+ /* 3910 */ 2302, 2806, 2302, 896, 2859, 2302, 2302, 2302, 2302, 2302,
+ /* 3920 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3930 */ 2806, 2302, 896, 2302, 2859, 2302, 2302, 2302, 2302, 2302,
+ /* 3940 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 3950 */ 2806, 2302, 896, 2302, 2302, 2302, 2841, 2302, 2840, 2302,
+ /* 3960 */ 2302, 2891, 2302, 2302, 2302, 424, 2842, 900, 2844, 2845,
+ /* 3970 */ 895, 897, 2302, 883, 2892, 919, 2841, 2840, 2302, 2302,
+ /* 3980 */ 2891, 2302, 2302, 2302, 425, 2842, 900, 2844, 2845, 895,
+ /* 3990 */ 2302, 897, 883, 2892, 919, 2841, 2302, 2840, 2302, 2302,
+ /* 4000 */ 2891, 2859, 2302, 2302, 426, 2842, 900, 2844, 2845, 895,
+ /* 4010 */ 897, 2302, 883, 2892, 919, 2302, 2302, 2806, 2302, 896,
+ /* 4020 */ 2302, 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4030 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896,
+ /* 4040 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4050 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302,
+ /* 4060 */ 2302, 2302, 2302, 2841, 2840, 2302, 2302, 2891, 2302, 2302,
+ /* 4070 */ 2302, 442, 2842, 900, 2844, 2845, 895, 2302, 897, 883,
+ /* 4080 */ 2892, 919, 2841, 2302, 2840, 2302, 2302, 2891, 2302, 2302,
+ /* 4090 */ 2302, 443, 2842, 900, 2844, 2845, 895, 897, 2302, 883,
+ /* 4100 */ 2892, 919, 2302, 2840, 2302, 2302, 2891, 2302, 2859, 2302,
+ /* 4110 */ 2853, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892,
+ /* 4120 */ 919, 2302, 2302, 2302, 2806, 2302, 896, 2859, 2302, 2302,
+ /* 4130 */ 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4140 */ 2302, 2302, 2302, 2806, 2302, 896, 897, 2302, 2302, 2302,
+ /* 4150 */ 2302, 2841, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4160 */ 2302, 2302, 2302, 2302, 2302, 2302, 897, 2302, 2302, 2302,
+ /* 4170 */ 2302, 2840, 2302, 2302, 2891, 2302, 2859, 2302, 2852, 2842,
+ /* 4180 */ 900, 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302,
+ /* 4190 */ 2840, 2302, 2806, 2891, 896, 2302, 2859, 2851, 2842, 900,
+ /* 4200 */ 2844, 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2302,
+ /* 4210 */ 2302, 2302, 2806, 2302, 896, 2302, 2302, 2302, 2302, 2841,
+ /* 4220 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4230 */ 2302, 2302, 2302, 2302, 897, 2302, 2302, 2302, 2302, 2840,
+ /* 4240 */ 2302, 2302, 2891, 2841, 2302, 2302, 459, 2842, 900, 2844,
+ /* 4250 */ 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 897, 2840,
+ /* 4260 */ 2302, 2302, 2891, 2302, 2859, 2302, 460, 2842, 900, 2844,
+ /* 4270 */ 2845, 895, 2302, 2302, 883, 2892, 919, 2302, 2302, 2302,
+ /* 4280 */ 2806, 2302, 896, 2302, 2302, 2302, 2302, 2302, 2859, 2302,
+ /* 4290 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4300 */ 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302, 2302, 2302,
+ /* 4310 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4320 */ 2302, 2302, 2302, 2302, 2302, 2841, 2302, 2840, 2302, 2302,
+ /* 4330 */ 2891, 2302, 2302, 2302, 456, 2842, 900, 2844, 2845, 895,
+ /* 4340 */ 897, 2302, 883, 2892, 919, 2302, 2302, 2302, 2302, 2841,
+ /* 4350 */ 2302, 2840, 2302, 2302, 2891, 2302, 2302, 2302, 461, 2842,
+ /* 4360 */ 900, 2844, 2845, 895, 897, 2302, 883, 2892, 919, 2302,
+ /* 4370 */ 2859, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4380 */ 2302, 2302, 2302, 2302, 2302, 2302, 2806, 2302, 896, 2302,
+ /* 4390 */ 2302, 2302, 2302, 2302, 2859, 2302, 2302, 2302, 2302, 2302,
+ /* 4400 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4410 */ 2806, 2302, 896, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4420 */ 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302, 2302,
+ /* 4430 */ 2302, 2302, 2302, 898, 2302, 2302, 2891, 2302, 2302, 2302,
+ /* 4440 */ 432, 2842, 900, 2844, 2845, 895, 2302, 2302, 883, 2892,
+ /* 4450 */ 919, 2302, 2302, 2302, 2302, 2302, 2302, 2840, 2302, 2302,
+ /* 4460 */ 2891, 2302, 2302, 2302, 431, 2842, 900, 2844, 2845, 895,
+ /* 4470 */ 2302, 2302, 883, 2892, 919,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 519, 520, 425, 0, 473, 400, 401, 383, 431, 478,
- /* 10 */ 426, 425, 12, 13, 431, 395, 473, 431, 398, 399,
- /* 20 */ 20, 0, 22, 440, 441, 8, 9, 20, 14, 12,
- /* 30 */ 13, 14, 15, 16, 20, 458, 36, 0, 38, 0,
- /* 40 */ 386, 0, 21, 432, 458, 24, 25, 26, 27, 28,
- /* 50 */ 29, 30, 31, 32, 443, 401, 449, 54, 8, 9,
- /* 60 */ 455, 530, 12, 13, 14, 15, 16, 4, 68, 538,
- /* 70 */ 463, 71, 488, 530, 491, 492, 469, 470, 410, 400,
- /* 80 */ 401, 538, 82, 33, 22, 431, 418, 556, 557, 12,
- /* 90 */ 13, 395, 561, 562, 398, 399, 55, 473, 36, 556,
- /* 100 */ 557, 447, 478, 449, 561, 562, 434, 41, 42, 437,
- /* 110 */ 473, 20, 112, 36, 20, 115, 77, 78, 79, 80,
- /* 120 */ 81, 500, 83, 84, 85, 86, 87, 88, 89, 90,
+ /* 0 */ 536, 401, 536, 401, 404, 405, 404, 405, 544, 437,
+ /* 10 */ 544, 423, 12, 13, 4, 12, 13, 14, 15, 16,
+ /* 20 */ 20, 0, 22, 438, 406, 407, 562, 563, 456, 563,
+ /* 30 */ 423, 567, 568, 567, 568, 538, 36, 540, 38, 0,
+ /* 40 */ 20, 453, 21, 392, 426, 24, 25, 26, 27, 28,
+ /* 50 */ 29, 30, 31, 32, 20, 406, 407, 431, 407, 34,
+ /* 60 */ 453, 8, 9, 437, 54, 12, 13, 14, 15, 16,
+ /* 70 */ 0, 71, 21, 20, 74, 24, 25, 26, 27, 28,
+ /* 80 */ 29, 30, 31, 32, 499, 85, 20, 455, 437, 20,
+ /* 90 */ 464, 503, 504, 505, 24, 25, 26, 27, 28, 29,
+ /* 100 */ 30, 31, 32, 14, 453, 517, 455, 475, 476, 20,
+ /* 110 */ 503, 504, 20, 479, 22, 115, 406, 407, 118, 80,
+ /* 120 */ 81, 82, 83, 84, 517, 86, 87, 88, 89, 90,
/* 130 */ 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
- /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 494, 401,
- /* 150 */ 529, 497, 152, 153, 530, 501, 502, 503, 504, 505,
- /* 160 */ 506, 407, 538, 509, 510, 511, 116, 530, 430, 497,
- /* 170 */ 516, 20, 518, 68, 112, 538, 522, 523, 115, 431,
- /* 180 */ 556, 557, 386, 511, 446, 561, 562, 121, 122, 435,
- /* 190 */ 124, 191, 192, 556, 557, 431, 542, 401, 561, 562,
- /* 200 */ 44, 201, 202, 439, 550, 526, 527, 528, 171, 530,
- /* 210 */ 531, 145, 20, 176, 450, 149, 216, 538, 218, 114,
- /* 220 */ 20, 184, 407, 223, 119, 8, 9, 431, 21, 12,
- /* 230 */ 13, 14, 15, 16, 422, 556, 557, 20, 426, 424,
- /* 240 */ 561, 562, 400, 447, 37, 449, 39, 40, 41, 42,
- /* 250 */ 435, 503, 252, 253, 254, 4, 256, 257, 258, 259,
- /* 260 */ 260, 261, 262, 263, 264, 265, 266, 400, 401, 269,
- /* 270 */ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
- /* 280 */ 280, 281, 282, 283, 12, 13, 14, 420, 386, 20,
- /* 290 */ 494, 186, 20, 497, 22, 218, 429, 501, 502, 503,
- /* 300 */ 504, 505, 506, 401, 36, 509, 510, 511, 36, 449,
- /* 310 */ 38, 155, 516, 432, 518, 115, 8, 9, 522, 523,
- /* 320 */ 12, 13, 14, 15, 16, 483, 484, 386, 400, 469,
- /* 330 */ 470, 8, 9, 431, 115, 12, 13, 14, 15, 16,
- /* 340 */ 68, 20, 401, 71, 152, 153, 550, 75, 254, 447,
- /* 350 */ 82, 449, 400, 401, 82, 21, 400, 401, 24, 25,
- /* 360 */ 26, 27, 28, 29, 30, 31, 32, 12, 13, 20,
- /* 370 */ 530, 308, 431, 155, 493, 20, 420, 22, 538, 451,
- /* 380 */ 452, 431, 454, 75, 112, 457, 117, 115, 447, 439,
- /* 390 */ 449, 36, 190, 38, 432, 433, 494, 557, 20, 497,
- /* 400 */ 450, 561, 562, 501, 502, 503, 504, 505, 506, 507,
- /* 410 */ 193, 509, 510, 511, 512, 513, 145, 146, 147, 148,
- /* 420 */ 149, 150, 151, 68, 152, 153, 71, 20, 434, 22,
- /* 430 */ 75, 400, 401, 125, 215, 494, 217, 82, 497, 116,
- /* 440 */ 448, 449, 501, 502, 503, 504, 505, 506, 36, 155,
- /* 450 */ 509, 510, 511, 297, 298, 299, 300, 301, 302, 303,
- /* 460 */ 304, 305, 115, 191, 192, 58, 0, 112, 249, 267,
- /* 470 */ 115, 254, 44, 201, 202, 14, 74, 525, 526, 527,
- /* 480 */ 528, 20, 530, 531, 400, 401, 455, 36, 216, 287,
- /* 490 */ 218, 497, 551, 552, 252, 223, 68, 54, 190, 301,
- /* 500 */ 302, 303, 304, 305, 420, 511, 63, 152, 153, 66,
- /* 510 */ 67, 20, 532, 429, 534, 297, 298, 299, 300, 301,
- /* 520 */ 302, 303, 304, 305, 252, 253, 254, 308, 256, 257,
- /* 530 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 196,
- /* 540 */ 74, 269, 270, 271, 272, 273, 191, 192, 74, 277,
- /* 550 */ 278, 279, 280, 281, 282, 283, 201, 202, 0, 20,
- /* 560 */ 449, 310, 320, 321, 322, 323, 324, 325, 326, 191,
- /* 570 */ 192, 216, 115, 218, 463, 267, 59, 60, 223, 431,
- /* 580 */ 469, 470, 24, 25, 26, 27, 28, 29, 30, 31,
- /* 590 */ 32, 268, 298, 299, 300, 287, 288, 289, 290, 291,
- /* 600 */ 292, 293, 294, 295, 296, 3, 458, 252, 253, 254,
- /* 610 */ 126, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- /* 620 */ 265, 266, 20, 20, 269, 270, 271, 272, 273, 20,
- /* 630 */ 218, 22, 277, 278, 279, 280, 281, 282, 283, 284,
- /* 640 */ 12, 13, 145, 152, 153, 36, 149, 400, 20, 73,
- /* 650 */ 22, 284, 191, 386, 115, 308, 112, 314, 315, 316,
- /* 660 */ 317, 417, 250, 251, 36, 20, 38, 58, 401, 218,
- /* 670 */ 403, 127, 128, 129, 130, 131, 132, 133, 134, 135,
- /* 680 */ 136, 431, 138, 139, 140, 141, 142, 143, 144, 386,
- /* 690 */ 82, 447, 201, 202, 20, 385, 68, 387, 431, 71,
- /* 700 */ 450, 250, 251, 75, 401, 12, 13, 14, 15, 16,
- /* 710 */ 82, 431, 465, 466, 447, 254, 449, 34, 116, 439,
- /* 720 */ 284, 417, 286, 12, 13, 14, 400, 530, 400, 401,
- /* 730 */ 450, 20, 396, 22, 431, 538, 400, 431, 402, 14,
- /* 740 */ 112, 497, 498, 115, 515, 20, 517, 36, 420, 38,
- /* 750 */ 447, 447, 449, 556, 557, 511, 450, 126, 561, 562,
- /* 760 */ 115, 494, 147, 431, 497, 308, 151, 530, 501, 502,
- /* 770 */ 503, 504, 505, 506, 442, 538, 509, 510, 511, 68,
- /* 780 */ 152, 153, 71, 516, 33, 518, 460, 211, 462, 522,
- /* 790 */ 523, 400, 401, 82, 557, 193, 193, 494, 561, 562,
- /* 800 */ 497, 497, 498, 499, 501, 502, 503, 504, 505, 506,
- /* 810 */ 530, 420, 509, 510, 511, 511, 240, 241, 538, 191,
- /* 820 */ 192, 445, 0, 112, 448, 449, 115, 8, 9, 201,
- /* 830 */ 202, 12, 13, 14, 15, 16, 556, 557, 146, 147,
- /* 840 */ 225, 561, 562, 151, 216, 230, 218, 308, 233, 400,
- /* 850 */ 235, 223, 421, 8, 9, 33, 386, 12, 13, 14,
- /* 860 */ 15, 16, 431, 152, 153, 191, 563, 564, 434, 22,
- /* 870 */ 8, 9, 52, 442, 12, 13, 14, 15, 16, 432,
- /* 880 */ 252, 253, 254, 36, 256, 257, 258, 259, 260, 261,
- /* 890 */ 262, 263, 264, 265, 266, 400, 401, 269, 270, 271,
- /* 900 */ 272, 273, 191, 192, 432, 277, 278, 279, 280, 281,
- /* 910 */ 282, 283, 201, 202, 0, 420, 191, 447, 8, 9,
- /* 920 */ 112, 20, 12, 13, 14, 15, 16, 216, 254, 218,
- /* 930 */ 146, 497, 483, 484, 223, 127, 128, 129, 130, 131,
- /* 940 */ 132, 133, 134, 135, 136, 511, 138, 139, 140, 141,
- /* 950 */ 142, 143, 144, 308, 400, 401, 396, 47, 44, 112,
- /* 960 */ 400, 116, 402, 252, 253, 254, 4, 256, 257, 258,
- /* 970 */ 259, 260, 261, 262, 263, 264, 265, 266, 116, 254,
- /* 980 */ 269, 270, 271, 272, 273, 23, 400, 401, 277, 278,
- /* 990 */ 279, 280, 281, 282, 283, 12, 13, 515, 91, 517,
- /* 1000 */ 22, 431, 386, 20, 68, 22, 420, 23, 386, 386,
- /* 1010 */ 48, 49, 50, 193, 36, 231, 232, 400, 401, 36,
- /* 1020 */ 432, 38, 431, 401, 204, 403, 116, 208, 77, 78,
- /* 1030 */ 79, 440, 441, 49, 50, 84, 85, 86, 14, 15,
- /* 1040 */ 16, 90, 0, 3, 400, 401, 95, 96, 97, 98,
- /* 1050 */ 386, 68, 101, 431, 71, 119, 105, 106, 107, 108,
- /* 1060 */ 82, 491, 492, 447, 420, 82, 159, 400, 401, 447,
- /* 1070 */ 447, 449, 455, 400, 401, 432, 400, 401, 12, 13,
- /* 1080 */ 526, 527, 528, 332, 530, 531, 20, 420, 22, 409,
- /* 1090 */ 112, 184, 185, 420, 193, 112, 420, 431, 115, 116,
- /* 1100 */ 400, 401, 36, 22, 38, 198, 386, 4, 428, 400,
- /* 1110 */ 401, 447, 386, 47, 13, 479, 494, 36, 438, 497,
- /* 1120 */ 420, 386, 19, 501, 502, 503, 504, 505, 506, 420,
- /* 1130 */ 432, 509, 510, 511, 68, 152, 153, 71, 516, 20,
- /* 1140 */ 518, 38, 400, 401, 522, 523, 400, 401, 82, 400,
- /* 1150 */ 401, 0, 400, 401, 335, 254, 432, 54, 492, 400,
- /* 1160 */ 401, 0, 420, 82, 61, 62, 420, 447, 386, 420,
- /* 1170 */ 431, 68, 420, 447, 191, 192, 421, 386, 112, 420,
- /* 1180 */ 441, 115, 447, 82, 201, 202, 431, 145, 146, 147,
- /* 1190 */ 148, 149, 150, 151, 216, 416, 218, 442, 419, 216,
- /* 1200 */ 13, 218, 0, 8, 9, 20, 223, 12, 13, 14,
- /* 1210 */ 15, 16, 400, 401, 400, 401, 0, 114, 152, 153,
- /* 1220 */ 8, 9, 119, 36, 12, 13, 14, 15, 16, 447,
- /* 1230 */ 252, 253, 420, 418, 420, 252, 253, 254, 447, 256,
- /* 1240 */ 257, 258, 259, 260, 261, 262, 263, 264, 265, 266,
- /* 1250 */ 1, 2, 269, 270, 271, 272, 273, 191, 192, 47,
- /* 1260 */ 277, 278, 279, 280, 281, 282, 283, 201, 202, 8,
- /* 1270 */ 9, 400, 401, 12, 13, 14, 15, 16, 387, 77,
- /* 1280 */ 78, 79, 216, 20, 218, 409, 84, 85, 86, 223,
- /* 1290 */ 33, 420, 90, 400, 401, 400, 401, 95, 96, 97,
- /* 1300 */ 98, 405, 406, 101, 47, 386, 155, 105, 106, 107,
- /* 1310 */ 108, 116, 193, 420, 438, 420, 405, 406, 252, 253,
- /* 1320 */ 254, 170, 256, 257, 258, 259, 260, 261, 262, 263,
- /* 1330 */ 264, 265, 266, 431, 459, 269, 270, 271, 272, 273,
- /* 1340 */ 500, 439, 386, 277, 278, 279, 280, 281, 282, 283,
- /* 1350 */ 12, 13, 450, 414, 415, 414, 415, 186, 20, 38,
- /* 1360 */ 22, 444, 532, 386, 447, 116, 447, 386, 500, 529,
- /* 1370 */ 330, 155, 473, 254, 36, 54, 38, 116, 401, 514,
- /* 1380 */ 403, 386, 517, 386, 63, 64, 65, 66, 2, 68,
- /* 1390 */ 386, 220, 36, 386, 8, 9, 13, 529, 12, 13,
- /* 1400 */ 14, 15, 16, 447, 2, 244, 68, 33, 431, 71,
- /* 1410 */ 8, 9, 386, 431, 12, 13, 14, 15, 16, 14,
- /* 1420 */ 82, 47, 400, 401, 447, 20, 449, 20, 447, 530,
- /* 1430 */ 389, 390, 450, 12, 13, 114, 386, 538, 82, 254,
- /* 1440 */ 119, 20, 447, 22, 447, 386, 444, 565, 33, 447,
- /* 1450 */ 112, 447, 33, 115, 447, 556, 557, 36, 473, 38,
- /* 1460 */ 561, 562, 8, 9, 75, 82, 12, 13, 14, 15,
- /* 1470 */ 16, 494, 444, 447, 497, 447, 33, 33, 501, 502,
- /* 1480 */ 503, 504, 505, 506, 126, 33, 509, 510, 511, 68,
- /* 1490 */ 152, 153, 71, 516, 234, 518, 236, 447, 120, 522,
- /* 1500 */ 523, 123, 13, 82, 8, 9, 447, 186, 12, 13,
- /* 1510 */ 14, 15, 16, 152, 153, 530, 195, 254, 36, 120,
- /* 1520 */ 199, 200, 123, 538, 554, 36, 205, 206, 404, 191,
- /* 1530 */ 192, 116, 120, 112, 120, 123, 115, 123, 180, 201,
- /* 1540 */ 202, 556, 557, 47, 0, 224, 561, 562, 526, 527,
- /* 1550 */ 528, 33, 530, 531, 216, 33, 218, 33, 13, 116,
- /* 1560 */ 116, 223, 1, 2, 82, 33, 22, 0, 116, 533,
- /* 1570 */ 116, 431, 33, 152, 153, 33, 33, 36, 51, 8,
- /* 1580 */ 9, 36, 33, 12, 13, 14, 15, 16, 0, 22,
- /* 1590 */ 252, 253, 254, 33, 256, 257, 258, 259, 260, 261,
- /* 1600 */ 262, 263, 264, 265, 266, 0, 33, 269, 270, 271,
- /* 1610 */ 272, 273, 191, 192, 0, 277, 278, 279, 280, 281,
- /* 1620 */ 282, 283, 201, 202, 8, 9, 36, 22, 12, 13,
- /* 1630 */ 14, 15, 16, 33, 116, 228, 22, 216, 116, 218,
- /* 1640 */ 116, 252, 115, 33, 223, 33, 8, 9, 116, 547,
- /* 1650 */ 12, 13, 14, 15, 16, 116, 8, 9, 116, 116,
- /* 1660 */ 12, 13, 14, 15, 16, 116, 12, 13, 417, 33,
- /* 1670 */ 12, 13, 33, 252, 253, 254, 116, 256, 257, 258,
- /* 1680 */ 259, 260, 261, 262, 263, 264, 265, 266, 33, 116,
- /* 1690 */ 269, 270, 271, 272, 273, 12, 13, 13, 277, 278,
- /* 1700 */ 279, 280, 281, 282, 283, 18, 386, 20, 12, 13,
- /* 1710 */ 33, 12, 13, 33, 27, 473, 116, 30, 12, 13,
- /* 1720 */ 36, 401, 18, 33, 33, 38, 116, 23, 116, 12,
- /* 1730 */ 13, 417, 116, 145, 146, 147, 148, 149, 150, 151,
- /* 1740 */ 115, 54, 117, 56, 33, 33, 42, 43, 61, 62,
- /* 1750 */ 46, 431, 116, 334, 116, 116, 12, 13, 399, 218,
- /* 1760 */ 73, 57, 12, 13, 193, 12, 13, 447, 459, 449,
- /* 1770 */ 36, 116, 530, 69, 70, 71, 72, 73, 12, 13,
- /* 1780 */ 538, 553, 553, 553, 472, 553, 459, 495, 404, 401,
- /* 1790 */ 446, 480, 459, 116, 459, 537, 116, 558, 556, 557,
- /* 1800 */ 524, 114, 537, 561, 562, 459, 116, 116, 218, 540,
- /* 1810 */ 419, 311, 54, 126, 494, 474, 82, 497, 496, 115,
- /* 1820 */ 20, 501, 502, 503, 504, 505, 506, 116, 116, 509,
- /* 1830 */ 510, 511, 400, 20, 514, 485, 516, 517, 518, 233,
- /* 1840 */ 409, 490, 522, 523, 157, 158, 409, 160, 161, 162,
- /* 1850 */ 163, 164, 165, 166, 167, 168, 169, 485, 154, 172,
- /* 1860 */ 173, 174, 175, 176, 177, 178, 179, 214, 181, 182,
- /* 1870 */ 183, 476, 400, 386, 187, 188, 189, 20, 401, 47,
- /* 1880 */ 456, 194, 401, 456, 190, 400, 453, 401, 401, 113,
- /* 1890 */ 403, 400, 456, 453, 453, 453, 413, 111, 400, 400,
- /* 1900 */ 412, 110, 400, 411, 400, 400, 20, 393, 52, 397,
- /* 1910 */ 393, 485, 208, 209, 210, 267, 397, 213, 431, 409,
- /* 1920 */ 409, 20, 449, 20, 409, 402, 20, 402, 475, 409,
- /* 1930 */ 226, 227, 20, 466, 447, 409, 449, 409, 20, 460,
- /* 1940 */ 409, 386, 409, 239, 52, 409, 242, 400, 427, 245,
- /* 1950 */ 246, 247, 248, 249, 389, 393, 401, 427, 403, 400,
- /* 1960 */ 431, 389, 393, 447, 237, 431, 431, 489, 431, 431,
- /* 1970 */ 115, 431, 20, 407, 222, 485, 221, 431, 484, 386,
- /* 1980 */ 487, 494, 431, 431, 497, 431, 431, 431, 501, 502,
- /* 1990 */ 503, 504, 505, 506, 401, 447, 509, 510, 511, 407,
- /* 2000 */ 447, 400, 447, 516, 449, 518, 386, 449, 319, 522,
- /* 2010 */ 523, 447, 308, 318, 546, 546, 207, 312, 548, 327,
- /* 2020 */ 549, 401, 546, 403, 431, 545, 329, 543, 328, 307,
- /* 2030 */ 306, 566, 482, 536, 336, 467, 535, 474, 481, 544,
- /* 2040 */ 447, 467, 449, 333, 474, 331, 401, 20, 126, 494,
- /* 2050 */ 541, 431, 497, 402, 309, 447, 501, 502, 503, 504,
- /* 2060 */ 505, 506, 12, 13, 509, 510, 511, 447, 560, 449,
- /* 2070 */ 407, 516, 22, 518, 386, 407, 500, 522, 523, 447,
- /* 2080 */ 467, 447, 447, 199, 467, 464, 36, 494, 38, 401,
- /* 2090 */ 497, 447, 407, 447, 501, 502, 503, 504, 505, 506,
- /* 2100 */ 460, 115, 509, 510, 511, 521, 447, 199, 407, 516,
- /* 2110 */ 461, 518, 386, 447, 494, 522, 523, 497, 68, 431,
- /* 2120 */ 539, 501, 502, 503, 504, 505, 506, 401, 407, 509,
- /* 2130 */ 510, 511, 82, 460, 559, 447, 516, 449, 518, 12,
- /* 2140 */ 13, 426, 522, 523, 407, 115, 22, 401, 400, 22,
- /* 2150 */ 447, 388, 436, 35, 447, 447, 386, 431, 407, 391,
- /* 2160 */ 447, 392, 112, 36, 393, 38, 447, 447, 37, 40,
- /* 2170 */ 447, 401, 447, 447, 394, 449, 447, 447, 447, 447,
- /* 2180 */ 447, 408, 494, 447, 0, 497, 447, 447, 447, 501,
- /* 2190 */ 502, 503, 504, 505, 506, 68, 447, 509, 510, 511,
- /* 2200 */ 433, 431, 493, 447, 516, 477, 518, 447, 447, 447,
- /* 2210 */ 522, 523, 423, 423, 433, 468, 423, 447, 384, 449,
- /* 2220 */ 494, 486, 468, 497, 0, 0, 47, 501, 502, 503,
- /* 2230 */ 504, 505, 506, 0, 36, 509, 510, 511, 386, 243,
- /* 2240 */ 36, 36, 516, 36, 518, 243, 0, 36, 522, 523,
- /* 2250 */ 36, 243, 36, 401, 0, 0, 243, 0, 36, 0,
- /* 2260 */ 0, 22, 36, 0, 494, 36, 216, 497, 218, 238,
- /* 2270 */ 0, 501, 502, 503, 504, 505, 506, 224, 0, 509,
- /* 2280 */ 510, 511, 224, 431, 225, 218, 216, 0, 518, 212,
- /* 2290 */ 211, 0, 522, 523, 0, 0, 0, 158, 51, 447,
- /* 2300 */ 51, 449, 252, 253, 0, 36, 0, 0, 36, 0,
- /* 2310 */ 54, 0, 51, 47, 0, 0, 0, 0, 51, 269,
- /* 2320 */ 270, 386, 0, 0, 0, 0, 0, 277, 278, 279,
- /* 2330 */ 280, 281, 282, 176, 36, 0, 401, 176, 0, 0,
- /* 2340 */ 0, 0, 0, 216, 0, 218, 494, 0, 0, 497,
- /* 2350 */ 0, 0, 0, 501, 502, 503, 504, 505, 506, 0,
- /* 2360 */ 0, 509, 510, 511, 0, 0, 431, 0, 0, 0,
- /* 2370 */ 518, 0, 0, 0, 522, 523, 0, 250, 251, 252,
- /* 2380 */ 51, 47, 447, 0, 449, 0, 0, 0, 0, 0,
- /* 2390 */ 0, 0, 22, 0, 158, 0, 269, 270, 157, 0,
- /* 2400 */ 156, 0, 0, 22, 277, 278, 279, 280, 281, 282,
- /* 2410 */ 386, 0, 0, 52, 22, 52, 36, 68, 0, 0,
- /* 2420 */ 0, 68, 0, 68, 68, 401, 44, 0, 54, 494,
- /* 2430 */ 36, 1, 497, 36, 0, 0, 501, 502, 503, 504,
- /* 2440 */ 505, 506, 44, 36, 509, 510, 511, 386, 44, 19,
- /* 2450 */ 54, 36, 0, 518, 54, 431, 47, 522, 523, 33,
- /* 2460 */ 44, 51, 401, 14, 51, 51, 0, 44, 38, 45,
- /* 2470 */ 0, 447, 0, 449, 0, 386, 0, 44, 207, 0,
- /* 2480 */ 51, 0, 51, 53, 54, 0, 0, 0, 0, 36,
- /* 2490 */ 401, 54, 431, 63, 64, 65, 66, 76, 68, 44,
- /* 2500 */ 0, 36, 54, 44, 0, 36, 44, 0, 447, 36,
- /* 2510 */ 449, 54, 54, 0, 0, 44, 0, 0, 494, 0,
- /* 2520 */ 431, 497, 0, 0, 22, 501, 502, 503, 504, 505,
- /* 2530 */ 506, 125, 22, 509, 510, 511, 447, 36, 449, 36,
- /* 2540 */ 123, 36, 518, 0, 114, 36, 0, 523, 36, 119,
- /* 2550 */ 22, 36, 22, 22, 36, 494, 36, 33, 497, 33,
- /* 2560 */ 471, 36, 501, 502, 503, 504, 505, 506, 36, 508,
- /* 2570 */ 509, 510, 511, 36, 36, 36, 0, 22, 0, 22,
- /* 2580 */ 150, 386, 0, 494, 36, 56, 497, 0, 0, 36,
- /* 2590 */ 501, 502, 503, 504, 505, 506, 401, 0, 509, 510,
- /* 2600 */ 511, 36, 0, 36, 0, 22, 386, 36, 36, 20,
- /* 2610 */ 36, 116, 115, 0, 115, 51, 0, 36, 193, 0,
- /* 2620 */ 22, 401, 22, 0, 0, 195, 431, 197, 3, 193,
- /* 2630 */ 200, 223, 229, 228, 193, 205, 193, 199, 193, 33,
- /* 2640 */ 313, 36, 447, 203, 449, 203, 36, 219, 115, 313,
- /* 2650 */ 116, 431, 116, 52, 224, 115, 115, 113, 111, 52,
- /* 2660 */ 33, 116, 33, 33, 33, 116, 115, 447, 116, 449,
- /* 2670 */ 116, 115, 51, 115, 115, 386, 82, 51, 33, 36,
- /* 2680 */ 3, 115, 33, 36, 116, 116, 36, 36, 36, 494,
- /* 2690 */ 401, 471, 497, 36, 36, 116, 501, 502, 503, 504,
- /* 2700 */ 505, 506, 116, 33, 509, 510, 511, 51, 0, 0,
- /* 2710 */ 51, 115, 44, 0, 494, 116, 44, 497, 386, 116,
- /* 2720 */ 431, 501, 502, 503, 504, 505, 506, 115, 0, 509,
- /* 2730 */ 510, 511, 115, 401, 116, 115, 447, 115, 449, 44,
- /* 2740 */ 386, 297, 200, 33, 2, 313, 196, 552, 113, 285,
- /* 2750 */ 113, 22, 116, 115, 115, 401, 196, 195, 252, 115,
- /* 2760 */ 471, 386, 116, 431, 116, 51, 51, 22, 115, 115,
- /* 2770 */ 0, 196, 0, 22, 44, 115, 401, 115, 115, 447,
- /* 2780 */ 115, 449, 115, 494, 115, 431, 497, 116, 115, 115,
- /* 2790 */ 501, 502, 503, 504, 505, 506, 115, 115, 509, 510,
- /* 2800 */ 511, 447, 116, 449, 115, 117, 431, 115, 118, 51,
- /* 2810 */ 116, 115, 115, 115, 115, 22, 255, 126, 116, 229,
- /* 2820 */ 36, 36, 447, 116, 449, 36, 494, 115, 36, 497,
- /* 2830 */ 36, 115, 36, 501, 502, 503, 504, 505, 506, 116,
- /* 2840 */ 116, 509, 510, 511, 36, 33, 36, 116, 494, 116,
- /* 2850 */ 115, 497, 115, 115, 137, 501, 502, 503, 504, 505,
- /* 2860 */ 506, 22, 137, 509, 510, 511, 76, 22, 36, 494,
- /* 2870 */ 75, 137, 497, 137, 36, 109, 501, 502, 503, 504,
- /* 2880 */ 505, 506, 386, 36, 509, 510, 511, 555, 513, 36,
- /* 2890 */ 36, 36, 36, 36, 36, 36, 36, 401, 82, 82,
- /* 2900 */ 109, 33, 36, 36, 22, 36, 36, 386, 36, 82,
- /* 2910 */ 36, 36, 36, 36, 36, 36, 22, 36, 564, 0,
- /* 2920 */ 36, 0, 401, 36, 44, 54, 0, 431, 36, 44,
- /* 2930 */ 0, 36, 44, 44, 0, 36, 0, 54, 22, 36,
- /* 2940 */ 54, 0, 22, 447, 54, 449, 33, 36, 36, 386,
- /* 2950 */ 22, 22, 431, 21, 567, 22, 21, 20, 567, 567,
- /* 2960 */ 567, 567, 567, 567, 401, 567, 567, 471, 447, 567,
- /* 2970 */ 449, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 2980 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 2990 */ 494, 567, 471, 497, 431, 567, 567, 501, 502, 503,
- /* 3000 */ 504, 505, 506, 567, 567, 509, 510, 511, 567, 567,
- /* 3010 */ 447, 567, 449, 567, 386, 494, 567, 567, 497, 567,
- /* 3020 */ 567, 567, 501, 502, 503, 504, 505, 506, 567, 401,
- /* 3030 */ 509, 510, 511, 567, 471, 567, 567, 567, 567, 567,
- /* 3040 */ 567, 386, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3050 */ 567, 567, 567, 567, 567, 567, 401, 494, 567, 431,
- /* 3060 */ 497, 567, 567, 567, 501, 502, 503, 504, 505, 506,
- /* 3070 */ 567, 567, 509, 510, 511, 447, 567, 449, 567, 386,
- /* 3080 */ 567, 567, 567, 567, 567, 567, 431, 567, 567, 567,
- /* 3090 */ 567, 567, 567, 567, 401, 567, 567, 567, 567, 471,
- /* 3100 */ 567, 567, 447, 567, 449, 567, 567, 567, 386, 567,
- /* 3110 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3120 */ 567, 567, 494, 401, 431, 497, 567, 567, 567, 501,
- /* 3130 */ 502, 503, 504, 505, 506, 567, 567, 509, 510, 511,
- /* 3140 */ 447, 567, 449, 567, 567, 567, 567, 386, 567, 494,
- /* 3150 */ 567, 567, 497, 431, 567, 567, 501, 502, 503, 504,
- /* 3160 */ 505, 506, 401, 567, 509, 510, 511, 567, 567, 447,
- /* 3170 */ 567, 449, 567, 386, 567, 567, 567, 567, 567, 567,
- /* 3180 */ 567, 567, 567, 567, 567, 567, 567, 494, 401, 567,
- /* 3190 */ 497, 567, 431, 567, 501, 502, 503, 504, 505, 506,
- /* 3200 */ 567, 567, 509, 510, 511, 567, 567, 567, 447, 567,
- /* 3210 */ 449, 567, 567, 567, 567, 567, 494, 567, 431, 497,
- /* 3220 */ 567, 567, 567, 501, 502, 503, 504, 505, 506, 567,
- /* 3230 */ 567, 509, 510, 511, 447, 567, 449, 567, 386, 567,
- /* 3240 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3250 */ 567, 567, 567, 401, 567, 494, 567, 567, 497, 386,
- /* 3260 */ 567, 567, 501, 502, 503, 504, 505, 506, 567, 567,
- /* 3270 */ 509, 510, 511, 567, 401, 567, 567, 567, 567, 567,
- /* 3280 */ 567, 494, 567, 431, 497, 567, 567, 567, 501, 502,
- /* 3290 */ 503, 504, 505, 506, 567, 567, 509, 510, 511, 447,
- /* 3300 */ 567, 449, 567, 567, 431, 567, 567, 567, 567, 567,
- /* 3310 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3320 */ 447, 567, 449, 567, 567, 567, 567, 567, 567, 567,
- /* 3330 */ 567, 567, 567, 567, 567, 567, 386, 567, 567, 567,
- /* 3340 */ 567, 567, 567, 567, 567, 567, 494, 567, 567, 497,
- /* 3350 */ 567, 401, 567, 501, 502, 503, 504, 505, 506, 567,
- /* 3360 */ 567, 509, 510, 511, 567, 567, 567, 494, 567, 567,
- /* 3370 */ 497, 567, 567, 567, 501, 502, 503, 504, 505, 506,
- /* 3380 */ 386, 431, 509, 510, 511, 567, 567, 567, 567, 567,
- /* 3390 */ 567, 567, 567, 567, 567, 401, 567, 447, 567, 449,
- /* 3400 */ 567, 386, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3410 */ 567, 567, 567, 567, 567, 567, 401, 567, 567, 567,
- /* 3420 */ 567, 386, 567, 567, 567, 431, 567, 567, 567, 567,
- /* 3430 */ 567, 567, 567, 567, 567, 567, 401, 567, 567, 567,
- /* 3440 */ 567, 447, 567, 449, 494, 567, 431, 497, 567, 567,
- /* 3450 */ 567, 501, 502, 503, 504, 505, 506, 567, 567, 509,
- /* 3460 */ 510, 511, 447, 567, 449, 567, 431, 567, 567, 567,
- /* 3470 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3480 */ 567, 567, 447, 567, 449, 567, 386, 567, 494, 567,
- /* 3490 */ 567, 497, 567, 567, 567, 501, 502, 503, 504, 505,
- /* 3500 */ 506, 401, 567, 509, 510, 511, 567, 567, 567, 494,
- /* 3510 */ 567, 567, 497, 567, 567, 567, 501, 502, 503, 504,
- /* 3520 */ 505, 506, 567, 567, 509, 510, 511, 386, 567, 494,
- /* 3530 */ 567, 431, 497, 567, 567, 567, 501, 502, 503, 504,
- /* 3540 */ 505, 506, 401, 567, 509, 510, 511, 447, 567, 449,
- /* 3550 */ 567, 386, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3560 */ 567, 567, 567, 567, 567, 567, 401, 567, 567, 567,
- /* 3570 */ 567, 567, 431, 567, 567, 567, 567, 567, 567, 567,
- /* 3580 */ 567, 567, 567, 567, 567, 567, 567, 567, 447, 567,
- /* 3590 */ 449, 567, 567, 567, 494, 567, 431, 497, 567, 567,
- /* 3600 */ 567, 501, 502, 503, 504, 505, 506, 567, 567, 509,
- /* 3610 */ 510, 511, 447, 567, 449, 567, 567, 567, 386, 567,
- /* 3620 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3630 */ 567, 567, 567, 401, 567, 494, 567, 567, 497, 567,
- /* 3640 */ 386, 567, 501, 502, 503, 504, 505, 506, 567, 567,
- /* 3650 */ 509, 510, 511, 567, 567, 401, 567, 567, 567, 494,
- /* 3660 */ 567, 567, 497, 431, 567, 567, 501, 502, 503, 504,
- /* 3670 */ 505, 506, 567, 567, 509, 510, 511, 567, 567, 447,
- /* 3680 */ 567, 449, 567, 386, 567, 431, 567, 567, 567, 567,
- /* 3690 */ 567, 567, 567, 567, 567, 567, 567, 567, 401, 567,
- /* 3700 */ 567, 447, 567, 449, 567, 567, 567, 386, 567, 567,
- /* 3710 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3720 */ 567, 567, 401, 567, 567, 567, 494, 567, 431, 497,
- /* 3730 */ 567, 567, 567, 501, 502, 503, 504, 505, 506, 567,
- /* 3740 */ 567, 509, 510, 511, 447, 567, 449, 567, 494, 567,
- /* 3750 */ 567, 497, 431, 567, 567, 501, 502, 503, 504, 505,
- /* 3760 */ 506, 567, 567, 509, 510, 511, 567, 567, 447, 567,
- /* 3770 */ 449, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3780 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3790 */ 567, 494, 567, 567, 497, 567, 567, 567, 501, 502,
- /* 3800 */ 503, 504, 505, 506, 567, 567, 509, 510, 511, 567,
- /* 3810 */ 567, 567, 567, 567, 567, 494, 567, 567, 497, 567,
- /* 3820 */ 567, 567, 501, 502, 503, 504, 505, 506, 386, 567,
- /* 3830 */ 509, 510, 511, 567, 567, 567, 567, 567, 567, 567,
- /* 3840 */ 567, 567, 567, 401, 567, 567, 567, 386, 567, 567,
- /* 3850 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3860 */ 567, 567, 401, 567, 567, 567, 567, 567, 567, 386,
- /* 3870 */ 567, 567, 567, 431, 567, 567, 567, 567, 567, 567,
- /* 3880 */ 567, 567, 567, 567, 401, 567, 567, 567, 567, 447,
- /* 3890 */ 567, 449, 431, 567, 567, 567, 386, 567, 567, 567,
- /* 3900 */ 567, 567, 567, 567, 567, 567, 567, 567, 447, 567,
- /* 3910 */ 449, 401, 567, 567, 431, 567, 567, 567, 567, 567,
- /* 3920 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 3930 */ 447, 567, 449, 567, 386, 567, 494, 567, 567, 497,
- /* 3940 */ 567, 431, 567, 501, 502, 503, 504, 505, 506, 401,
- /* 3950 */ 567, 509, 510, 511, 567, 494, 567, 447, 497, 449,
- /* 3960 */ 567, 567, 501, 502, 503, 504, 505, 506, 567, 567,
- /* 3970 */ 509, 510, 511, 567, 567, 567, 567, 494, 567, 431,
- /* 3980 */ 497, 567, 567, 386, 501, 502, 503, 504, 505, 506,
- /* 3990 */ 567, 567, 509, 510, 511, 447, 567, 449, 401, 567,
- /* 4000 */ 567, 567, 567, 567, 494, 567, 567, 497, 567, 567,
- /* 4010 */ 567, 501, 502, 503, 504, 505, 506, 567, 567, 509,
- /* 4020 */ 510, 511, 386, 567, 567, 567, 567, 567, 431, 567,
- /* 4030 */ 567, 567, 567, 567, 567, 567, 567, 401, 567, 567,
- /* 4040 */ 567, 567, 494, 567, 447, 497, 449, 567, 567, 501,
- /* 4050 */ 502, 503, 504, 505, 506, 567, 567, 509, 510, 511,
- /* 4060 */ 567, 567, 567, 567, 567, 567, 386, 431, 567, 567,
- /* 4070 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 4080 */ 567, 401, 567, 447, 567, 449, 567, 567, 567, 567,
- /* 4090 */ 386, 494, 567, 567, 497, 567, 567, 567, 501, 502,
- /* 4100 */ 503, 504, 505, 506, 567, 401, 509, 510, 511, 386,
- /* 4110 */ 567, 431, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 4120 */ 567, 567, 567, 567, 401, 567, 567, 447, 567, 449,
- /* 4130 */ 494, 567, 567, 497, 567, 431, 567, 501, 502, 503,
- /* 4140 */ 504, 505, 506, 567, 567, 509, 510, 511, 567, 567,
- /* 4150 */ 567, 447, 567, 449, 431, 567, 567, 567, 567, 567,
- /* 4160 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 4170 */ 447, 567, 449, 567, 494, 567, 567, 497, 386, 567,
- /* 4180 */ 567, 501, 502, 503, 504, 505, 506, 567, 567, 509,
- /* 4190 */ 510, 511, 567, 401, 567, 567, 567, 567, 494, 567,
- /* 4200 */ 567, 497, 567, 567, 567, 501, 502, 503, 504, 505,
- /* 4210 */ 506, 567, 567, 509, 510, 511, 567, 494, 567, 567,
- /* 4220 */ 497, 567, 567, 431, 501, 502, 503, 504, 505, 506,
- /* 4230 */ 567, 567, 509, 510, 511, 567, 567, 567, 567, 447,
- /* 4240 */ 567, 449, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 4250 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 4260 */ 386, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 4270 */ 567, 567, 567, 567, 567, 401, 567, 567, 567, 567,
- /* 4280 */ 567, 567, 567, 567, 567, 567, 494, 567, 567, 497,
- /* 4290 */ 567, 567, 567, 501, 502, 503, 504, 505, 506, 567,
- /* 4300 */ 567, 509, 510, 511, 567, 431, 567, 567, 567, 567,
- /* 4310 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 4320 */ 567, 447, 567, 449, 567, 567, 567, 567, 567, 567,
- /* 4330 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 4340 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 4350 */ 567, 567, 567, 567, 567, 567, 567, 567, 567, 567,
- /* 4360 */ 567, 567, 567, 567, 567, 567, 567, 567, 494, 567,
- /* 4370 */ 567, 497, 567, 567, 567, 501, 502, 503, 504, 505,
- /* 4380 */ 506, 567, 567, 509, 510, 511, 383, 383, 383, 383,
- /* 4390 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4400 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4410 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4420 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4430 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4440 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4450 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4460 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4470 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4480 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4490 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4500 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4510 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4520 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4530 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4540 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4550 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4560 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4570 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4580 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4590 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4600 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4610 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4620 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4630 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4640 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4650 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4660 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4670 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4680 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4690 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4700 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4710 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4720 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4730 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4740 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4750 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
- /* 4760 */ 383, 383, 383, 383, 383, 383, 383, 383, 383,
+ /* 140 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+ /* 150 */ 111, 500, 118, 61, 503, 155, 156, 416, 507, 508,
+ /* 160 */ 509, 510, 511, 512, 118, 424, 515, 516, 517, 20,
+ /* 170 */ 536, 21, 20, 522, 22, 524, 20, 71, 544, 528,
+ /* 180 */ 529, 532, 533, 534, 118, 536, 537, 37, 36, 39,
+ /* 190 */ 40, 41, 42, 544, 194, 195, 562, 563, 391, 548,
+ /* 200 */ 393, 567, 568, 3, 204, 205, 451, 556, 427, 454,
+ /* 210 */ 455, 562, 563, 61, 194, 195, 567, 568, 437, 219,
+ /* 220 */ 20, 221, 199, 117, 20, 44, 226, 14, 122, 448,
+ /* 230 */ 8, 9, 20, 20, 12, 13, 14, 15, 16, 57,
+ /* 240 */ 118, 531, 532, 533, 534, 4, 536, 537, 66, 196,
+ /* 250 */ 71, 69, 70, 406, 254, 255, 256, 392, 258, 259,
+ /* 260 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
+ /* 270 */ 270, 271, 407, 20, 274, 275, 276, 277, 278, 279,
+ /* 280 */ 280, 281, 282, 283, 284, 285, 286, 287, 288, 12,
+ /* 290 */ 13, 14, 406, 392, 18, 189, 20, 20, 118, 22,
+ /* 300 */ 78, 122, 437, 27, 457, 458, 30, 460, 407, 256,
+ /* 310 */ 463, 155, 156, 36, 38, 38, 406, 407, 453, 119,
+ /* 320 */ 455, 0, 8, 9, 120, 256, 12, 13, 14, 15,
+ /* 330 */ 16, 431, 56, 57, 0, 59, 426, 437, 437, 158,
+ /* 340 */ 64, 65, 319, 320, 321, 322, 323, 313, 71, 455,
+ /* 350 */ 128, 74, 76, 20, 453, 78, 455, 471, 472, 313,
+ /* 360 */ 204, 205, 85, 469, 464, 500, 20, 392, 503, 475,
+ /* 370 */ 476, 118, 507, 508, 509, 510, 511, 512, 513, 313,
+ /* 380 */ 515, 516, 517, 518, 519, 148, 149, 150, 151, 152,
+ /* 390 */ 153, 154, 115, 117, 422, 118, 196, 425, 218, 20,
+ /* 400 */ 220, 500, 254, 438, 503, 129, 455, 194, 507, 508,
+ /* 410 */ 509, 510, 511, 512, 449, 193, 515, 516, 517, 20,
+ /* 420 */ 469, 520, 436, 522, 523, 524, 475, 476, 453, 528,
+ /* 430 */ 529, 251, 155, 156, 52, 313, 160, 161, 452, 163,
+ /* 440 */ 164, 165, 166, 167, 168, 169, 170, 171, 172, 406,
+ /* 450 */ 407, 175, 176, 177, 178, 179, 180, 181, 182, 402,
+ /* 460 */ 184, 185, 186, 406, 20, 408, 190, 191, 192, 256,
+ /* 470 */ 437, 194, 195, 197, 326, 327, 328, 329, 330, 331,
+ /* 480 */ 332, 204, 205, 302, 303, 304, 305, 306, 307, 308,
+ /* 490 */ 309, 310, 158, 313, 272, 174, 219, 464, 221, 2,
+ /* 500 */ 179, 155, 156, 226, 461, 8, 9, 173, 187, 12,
+ /* 510 */ 13, 14, 15, 16, 292, 293, 294, 295, 296, 297,
+ /* 520 */ 298, 299, 300, 301, 4, 211, 306, 307, 308, 309,
+ /* 530 */ 310, 254, 255, 256, 392, 258, 259, 260, 261, 262,
+ /* 540 */ 263, 264, 265, 266, 267, 268, 269, 270, 271, 407,
+ /* 550 */ 536, 274, 275, 276, 277, 278, 315, 406, 544, 282,
+ /* 560 */ 283, 284, 285, 286, 287, 288, 12, 13, 392, 158,
+ /* 570 */ 22, 407, 12, 13, 20, 196, 22, 563, 196, 437,
+ /* 580 */ 437, 567, 568, 407, 36, 14, 525, 526, 115, 207,
+ /* 590 */ 36, 20, 38, 20, 402, 453, 36, 455, 406, 456,
+ /* 600 */ 408, 437, 4, 130, 131, 132, 133, 134, 135, 136,
+ /* 610 */ 137, 138, 139, 437, 141, 142, 143, 144, 145, 146,
+ /* 620 */ 147, 23, 438, 439, 406, 71, 437, 506, 74, 453,
+ /* 630 */ 231, 455, 78, 85, 437, 406, 407, 448, 118, 85,
+ /* 640 */ 489, 490, 500, 446, 447, 503, 48, 49, 50, 507,
+ /* 650 */ 508, 509, 510, 511, 512, 341, 535, 515, 516, 517,
+ /* 660 */ 406, 407, 77, 115, 522, 437, 524, 411, 412, 115,
+ /* 670 */ 528, 529, 118, 509, 446, 447, 500, 406, 407, 503,
+ /* 680 */ 426, 392, 20, 507, 508, 509, 510, 511, 512, 435,
+ /* 690 */ 461, 515, 516, 517, 497, 498, 407, 426, 556, 0,
+ /* 700 */ 524, 14, 15, 16, 528, 529, 435, 489, 490, 155,
+ /* 710 */ 156, 406, 407, 302, 303, 304, 305, 306, 307, 308,
+ /* 720 */ 309, 310, 36, 8, 9, 77, 437, 12, 13, 14,
+ /* 730 */ 15, 16, 80, 81, 82, 406, 407, 1, 2, 87,
+ /* 740 */ 88, 89, 453, 129, 455, 93, 36, 36, 194, 195,
+ /* 750 */ 98, 99, 100, 101, 158, 289, 104, 76, 204, 205,
+ /* 760 */ 108, 109, 110, 111, 506, 194, 461, 219, 85, 221,
+ /* 770 */ 454, 455, 2, 219, 22, 221, 77, 20, 8, 9,
+ /* 780 */ 226, 221, 12, 13, 14, 15, 16, 440, 36, 500,
+ /* 790 */ 443, 406, 503, 535, 20, 85, 507, 508, 509, 510,
+ /* 800 */ 511, 512, 254, 255, 515, 516, 517, 389, 254, 255,
+ /* 810 */ 256, 392, 258, 259, 260, 261, 262, 263, 264, 265,
+ /* 820 */ 266, 267, 268, 269, 270, 271, 407, 256, 274, 275,
+ /* 830 */ 276, 277, 278, 313, 119, 392, 282, 283, 284, 285,
+ /* 840 */ 286, 287, 288, 289, 12, 13, 557, 558, 406, 407,
+ /* 850 */ 503, 466, 20, 468, 22, 119, 437, 129, 196, 22,
+ /* 860 */ 115, 532, 533, 534, 517, 536, 537, 115, 36, 506,
+ /* 870 */ 38, 189, 453, 36, 455, 130, 131, 132, 133, 134,
+ /* 880 */ 135, 136, 137, 138, 139, 437, 141, 142, 143, 144,
+ /* 890 */ 145, 146, 147, 445, 392, 214, 453, 479, 535, 303,
+ /* 900 */ 304, 305, 484, 71, 456, 223, 74, 221, 415, 437,
+ /* 910 */ 78, 62, 63, 406, 407, 23, 149, 85, 256, 500,
+ /* 920 */ 440, 413, 503, 242, 243, 94, 507, 508, 509, 510,
+ /* 930 */ 511, 512, 221, 426, 515, 516, 517, 444, 252, 253,
+ /* 940 */ 44, 49, 50, 524, 392, 406, 407, 115, 529, 441,
+ /* 950 */ 118, 440, 115, 196, 536, 453, 485, 406, 407, 407,
+ /* 960 */ 479, 409, 544, 252, 253, 426, 18, 71, 194, 497,
+ /* 970 */ 498, 23, 12, 13, 532, 533, 534, 426, 536, 537,
+ /* 980 */ 562, 563, 22, 503, 536, 567, 568, 155, 156, 437,
+ /* 990 */ 42, 43, 544, 162, 46, 392, 36, 517, 38, 411,
+ /* 1000 */ 412, 234, 235, 55, 0, 453, 438, 455, 60, 392,
+ /* 1010 */ 562, 563, 438, 256, 503, 567, 568, 536, 187, 188,
+ /* 1020 */ 72, 73, 74, 75, 76, 544, 194, 195, 517, 413,
+ /* 1030 */ 256, 71, 201, 33, 8, 9, 204, 205, 12, 13,
+ /* 1040 */ 14, 15, 16, 562, 563, 85, 430, 47, 567, 568,
+ /* 1050 */ 392, 219, 500, 221, 415, 503, 453, 441, 226, 507,
+ /* 1060 */ 508, 509, 510, 511, 512, 22, 118, 515, 516, 517,
+ /* 1070 */ 453, 420, 421, 434, 522, 115, 524, 149, 150, 36,
+ /* 1080 */ 528, 529, 154, 444, 479, 3, 254, 255, 256, 484,
+ /* 1090 */ 258, 259, 260, 261, 262, 263, 264, 265, 266, 267,
+ /* 1100 */ 268, 269, 270, 271, 13, 157, 274, 275, 276, 277,
+ /* 1110 */ 278, 453, 420, 421, 282, 283, 284, 285, 286, 287,
+ /* 1120 */ 288, 12, 13, 14, 406, 407, 392, 392, 85, 20,
+ /* 1130 */ 392, 22, 8, 9, 395, 396, 12, 13, 14, 15,
+ /* 1140 */ 16, 536, 150, 437, 426, 36, 154, 38, 424, 544,
+ /* 1150 */ 4, 445, 148, 149, 150, 151, 152, 153, 154, 211,
+ /* 1160 */ 212, 213, 456, 33, 216, 19, 437, 562, 563, 0,
+ /* 1170 */ 392, 47, 567, 568, 445, 438, 85, 229, 230, 219,
+ /* 1180 */ 71, 221, 428, 74, 38, 456, 432, 453, 453, 241,
+ /* 1190 */ 0, 453, 244, 438, 85, 247, 248, 249, 250, 251,
+ /* 1200 */ 432, 8, 9, 57, 438, 12, 13, 14, 15, 16,
+ /* 1210 */ 64, 65, 406, 407, 254, 255, 289, 71, 291, 392,
+ /* 1220 */ 228, 392, 438, 437, 115, 233, 33, 118, 236, 437,
+ /* 1230 */ 238, 453, 426, 447, 274, 275, 407, 445, 409, 33,
+ /* 1240 */ 406, 407, 282, 283, 284, 285, 286, 287, 456, 406,
+ /* 1250 */ 407, 8, 9, 406, 407, 12, 13, 14, 15, 16,
+ /* 1260 */ 426, 313, 494, 117, 155, 156, 437, 20, 122, 426,
+ /* 1270 */ 80, 81, 82, 426, 20, 0, 33, 87, 88, 89,
+ /* 1280 */ 453, 437, 453, 93, 455, 406, 407, 392, 98, 99,
+ /* 1290 */ 100, 101, 571, 392, 104, 406, 407, 437, 108, 109,
+ /* 1300 */ 110, 111, 0, 194, 195, 426, 406, 407, 521, 521,
+ /* 1310 */ 523, 523, 119, 204, 205, 426, 456, 148, 149, 150,
+ /* 1320 */ 151, 152, 153, 154, 22, 119, 426, 392, 219, 500,
+ /* 1330 */ 221, 193, 503, 13, 33, 226, 507, 508, 509, 510,
+ /* 1340 */ 511, 512, 498, 393, 515, 516, 517, 450, 453, 450,
+ /* 1350 */ 453, 522, 453, 524, 453, 392, 148, 528, 529, 392,
+ /* 1360 */ 152, 538, 119, 254, 255, 256, 392, 258, 259, 260,
+ /* 1370 */ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
+ /* 1380 */ 271, 407, 0, 274, 275, 276, 277, 278, 453, 406,
+ /* 1390 */ 407, 282, 283, 284, 285, 286, 287, 288, 12, 13,
+ /* 1400 */ 392, 406, 407, 406, 407, 85, 20, 0, 22, 426,
+ /* 1410 */ 272, 437, 406, 407, 392, 407, 453, 409, 336, 392,
+ /* 1420 */ 453, 426, 36, 426, 38, 520, 44, 453, 523, 455,
+ /* 1430 */ 292, 392, 426, 8, 9, 406, 407, 12, 13, 14,
+ /* 1440 */ 15, 16, 8, 9, 427, 437, 12, 13, 14, 15,
+ /* 1450 */ 16, 55, 406, 407, 437, 426, 14, 71, 406, 407,
+ /* 1460 */ 74, 453, 20, 455, 57, 448, 450, 406, 407, 453,
+ /* 1470 */ 340, 85, 426, 0, 500, 453, 465, 503, 426, 33,
+ /* 1480 */ 453, 507, 508, 509, 510, 511, 512, 426, 514, 515,
+ /* 1490 */ 516, 517, 453, 47, 129, 0, 123, 123, 392, 126,
+ /* 1500 */ 126, 115, 33, 256, 118, 119, 155, 156, 500, 0,
+ /* 1510 */ 256, 503, 13, 407, 36, 507, 508, 509, 510, 511,
+ /* 1520 */ 512, 246, 33, 515, 516, 517, 123, 0, 33, 126,
+ /* 1530 */ 522, 123, 524, 33, 126, 36, 528, 529, 0, 13,
+ /* 1540 */ 33, 155, 156, 437, 119, 0, 33, 560, 183, 22,
+ /* 1550 */ 8, 9, 33, 119, 12, 13, 14, 15, 16, 453,
+ /* 1560 */ 22, 455, 36, 85, 1, 2, 78, 22, 8, 9,
+ /* 1570 */ 12, 13, 12, 13, 14, 15, 16, 36, 8, 9,
+ /* 1580 */ 194, 195, 12, 13, 14, 15, 16, 553, 119, 47,
+ /* 1590 */ 204, 205, 8, 9, 33, 33, 12, 13, 14, 15,
+ /* 1600 */ 16, 33, 33, 12, 13, 219, 500, 221, 119, 503,
+ /* 1610 */ 33, 539, 226, 507, 508, 509, 510, 511, 512, 119,
+ /* 1620 */ 33, 515, 516, 517, 51, 36, 119, 410, 522, 437,
+ /* 1630 */ 524, 158, 119, 237, 528, 529, 12, 13, 119, 338,
+ /* 1640 */ 254, 255, 256, 33, 258, 259, 260, 261, 262, 263,
+ /* 1650 */ 264, 265, 266, 267, 268, 269, 270, 271, 33, 423,
+ /* 1660 */ 274, 275, 276, 277, 278, 33, 33, 158, 282, 283,
+ /* 1670 */ 284, 285, 286, 287, 288, 12, 13, 392, 33, 119,
+ /* 1680 */ 119, 119, 479, 20, 423, 22, 33, 119, 119, 119,
+ /* 1690 */ 33, 118, 407, 118, 409, 120, 119, 405, 273, 36,
+ /* 1700 */ 33, 38, 0, 119, 12, 13, 119, 8, 9, 465,
+ /* 1710 */ 47, 12, 13, 14, 15, 16, 12, 13, 36, 8,
+ /* 1720 */ 9, 559, 437, 12, 13, 14, 15, 16, 392, 119,
+ /* 1730 */ 12, 13, 12, 13, 71, 12, 13, 74, 453, 536,
+ /* 1740 */ 455, 33, 254, 407, 119, 12, 13, 544, 85, 12,
+ /* 1750 */ 13, 119, 119, 12, 13, 36, 13, 13, 47, 559,
+ /* 1760 */ 58, 559, 221, 33, 119, 562, 563, 85, 33, 33,
+ /* 1770 */ 567, 568, 119, 437, 478, 33, 119, 559, 115, 36,
+ /* 1780 */ 36, 118, 465, 501, 452, 500, 119, 410, 503, 453,
+ /* 1790 */ 407, 455, 507, 508, 509, 510, 511, 512, 486, 465,
+ /* 1800 */ 515, 516, 517, 465, 85, 543, 543, 522, 530, 524,
+ /* 1810 */ 221, 546, 564, 528, 529, 465, 8, 9, 155, 156,
+ /* 1820 */ 12, 13, 14, 15, 16, 425, 316, 119, 480, 57,
+ /* 1830 */ 119, 502, 20, 406, 20, 491, 500, 236, 496, 503,
+ /* 1840 */ 491, 415, 482, 507, 508, 509, 510, 511, 512, 119,
+ /* 1850 */ 415, 515, 516, 517, 119, 119, 217, 194, 195, 406,
+ /* 1860 */ 524, 119, 20, 407, 528, 529, 47, 204, 205, 8,
+ /* 1870 */ 9, 462, 407, 12, 13, 14, 15, 16, 462, 193,
+ /* 1880 */ 459, 406, 219, 407, 221, 406, 8, 9, 459, 226,
+ /* 1890 */ 12, 13, 14, 15, 16, 462, 459, 459, 116, 41,
+ /* 1900 */ 42, 419, 114, 406, 418, 113, 20, 406, 417, 406,
+ /* 1910 */ 406, 406, 52, 399, 403, 399, 20, 254, 255, 256,
+ /* 1920 */ 403, 258, 259, 260, 261, 262, 263, 264, 265, 266,
+ /* 1930 */ 267, 268, 269, 270, 271, 491, 415, 274, 275, 276,
+ /* 1940 */ 277, 278, 455, 479, 415, 282, 283, 284, 285, 286,
+ /* 1950 */ 287, 288, 12, 13, 415, 20, 408, 20, 481, 415,
+ /* 1960 */ 20, 408, 22, 20, 479, 415, 472, 415, 20, 415,
+ /* 1970 */ 415, 272, 466, 52, 392, 399, 36, 406, 38, 433,
+ /* 1980 */ 119, 415, 124, 125, 433, 127, 437, 395, 395, 407,
+ /* 1990 */ 453, 409, 406, 437, 437, 399, 437, 119, 239, 118,
+ /* 2000 */ 536, 437, 437, 495, 196, 392, 148, 413, 544, 437,
+ /* 2010 */ 152, 71, 20, 493, 74, 437, 437, 437, 437, 437,
+ /* 2020 */ 407, 536, 491, 490, 225, 85, 562, 563, 488, 544,
+ /* 2030 */ 224, 567, 568, 413, 487, 453, 453, 455, 453, 325,
+ /* 2040 */ 406, 324, 552, 455, 552, 333, 210, 562, 563, 551,
+ /* 2050 */ 437, 453, 567, 568, 480, 115, 392, 555, 118, 335,
+ /* 2060 */ 334, 312, 317, 473, 552, 542, 453, 549, 455, 554,
+ /* 2070 */ 473, 407, 550, 409, 311, 480, 541, 337, 339, 407,
+ /* 2080 */ 342, 20, 500, 129, 314, 503, 408, 413, 413, 507,
+ /* 2090 */ 508, 509, 510, 511, 512, 155, 156, 515, 516, 517,
+ /* 2100 */ 572, 437, 566, 473, 522, 506, 524, 453, 565, 453,
+ /* 2110 */ 528, 529, 453, 500, 547, 453, 503, 453, 453, 455,
+ /* 2120 */ 507, 508, 509, 510, 511, 512, 202, 466, 515, 516,
+ /* 2130 */ 517, 473, 453, 118, 194, 195, 470, 524, 413, 527,
+ /* 2140 */ 413, 528, 529, 453, 204, 205, 202, 545, 467, 466,
+ /* 2150 */ 453, 453, 118, 432, 453, 407, 453, 406, 453, 219,
+ /* 2160 */ 413, 221, 453, 413, 500, 413, 226, 503, 453, 453,
+ /* 2170 */ 442, 507, 508, 509, 510, 511, 512, 22, 394, 515,
+ /* 2180 */ 516, 517, 453, 35, 453, 453, 522, 453, 524, 37,
+ /* 2190 */ 397, 40, 528, 529, 254, 255, 256, 400, 258, 259,
+ /* 2200 */ 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
+ /* 2210 */ 270, 271, 399, 453, 274, 275, 276, 277, 278, 453,
+ /* 2220 */ 453, 453, 282, 283, 284, 285, 286, 287, 288, 12,
+ /* 2230 */ 13, 453, 453, 453, 453, 398, 453, 20, 453, 22,
+ /* 2240 */ 453, 483, 439, 474, 429, 499, 492, 474, 439, 429,
+ /* 2250 */ 429, 392, 414, 36, 390, 38, 0, 0, 0, 47,
+ /* 2260 */ 0, 36, 245, 36, 36, 245, 407, 36, 0, 36,
+ /* 2270 */ 36, 245, 36, 0, 0, 245, 0, 36, 0, 36,
+ /* 2280 */ 0, 22, 0, 36, 240, 0, 227, 0, 71, 227,
+ /* 2290 */ 221, 74, 228, 219, 0, 0, 437, 0, 215, 214,
+ /* 2300 */ 0, 0, 85, 161, 51, 51, 0, 36, 0, 0,
+ /* 2310 */ 0, 36, 453, 51, 455, 51, 47, 0, 57, 0,
+ /* 2320 */ 0, 0, 0, 0, 0, 0, 0, 12, 13, 0,
+ /* 2330 */ 0, 0, 115, 392, 36, 118, 179, 22, 179, 0,
+ /* 2340 */ 0, 0, 0, 0, 0, 0, 0, 0, 407, 0,
+ /* 2350 */ 0, 36, 0, 38, 0, 0, 0, 0, 0, 500,
+ /* 2360 */ 0, 0, 503, 51, 0, 47, 507, 508, 509, 510,
+ /* 2370 */ 511, 512, 155, 156, 515, 516, 517, 0, 437, 161,
+ /* 2380 */ 0, 522, 0, 524, 0, 0, 71, 528, 529, 0,
+ /* 2390 */ 0, 0, 0, 0, 453, 0, 455, 22, 0, 160,
+ /* 2400 */ 0, 159, 0, 0, 0, 22, 71, 0, 22, 71,
+ /* 2410 */ 36, 194, 195, 0, 52, 52, 0, 0, 0, 71,
+ /* 2420 */ 44, 204, 205, 36, 71, 57, 0, 57, 0, 57,
+ /* 2430 */ 36, 0, 44, 36, 0, 36, 219, 56, 221, 0,
+ /* 2440 */ 44, 500, 36, 226, 503, 0, 14, 33, 507, 508,
+ /* 2450 */ 509, 510, 511, 512, 44, 47, 515, 516, 517, 0,
+ /* 2460 */ 51, 0, 51, 522, 45, 524, 51, 44, 0, 528,
+ /* 2470 */ 529, 254, 255, 256, 0, 258, 259, 260, 261, 262,
+ /* 2480 */ 263, 264, 265, 266, 267, 268, 269, 270, 271, 1,
+ /* 2490 */ 0, 274, 275, 276, 277, 278, 44, 0, 210, 282,
+ /* 2500 */ 283, 284, 285, 286, 287, 288, 51, 19, 0, 51,
+ /* 2510 */ 0, 0, 79, 0, 0, 392, 36, 57, 0, 44,
+ /* 2520 */ 36, 57, 44, 0, 57, 36, 38, 44, 0, 36,
+ /* 2530 */ 407, 44, 0, 57, 219, 0, 221, 0, 0, 0,
+ /* 2540 */ 36, 53, 54, 0, 0, 57, 22, 126, 128, 0,
+ /* 2550 */ 0, 36, 22, 36, 66, 67, 68, 69, 36, 71,
+ /* 2560 */ 437, 36, 36, 36, 33, 36, 33, 252, 253, 254,
+ /* 2570 */ 36, 0, 36, 22, 22, 22, 453, 36, 455, 0,
+ /* 2580 */ 22, 36, 36, 36, 0, 22, 0, 0, 0, 274,
+ /* 2590 */ 275, 36, 36, 0, 0, 36, 36, 282, 283, 284,
+ /* 2600 */ 285, 286, 287, 0, 22, 117, 36, 59, 36, 20,
+ /* 2610 */ 122, 36, 0, 119, 118, 51, 118, 0, 196, 36,
+ /* 2620 */ 22, 392, 0, 500, 22, 196, 503, 226, 0, 202,
+ /* 2630 */ 507, 508, 509, 510, 511, 512, 407, 232, 515, 516,
+ /* 2640 */ 517, 153, 196, 0, 392, 196, 206, 222, 206, 196,
+ /* 2650 */ 3, 33, 318, 22, 318, 231, 36, 36, 118, 407,
+ /* 2660 */ 52, 119, 52, 33, 51, 33, 437, 33, 33, 33,
+ /* 2670 */ 51, 3, 118, 36, 33, 36, 119, 318, 36, 118,
+ /* 2680 */ 114, 119, 453, 118, 455, 116, 198, 36, 200, 437,
+ /* 2690 */ 85, 203, 569, 570, 36, 119, 208, 119, 118, 118,
+ /* 2700 */ 36, 36, 33, 118, 51, 453, 477, 455, 51, 119,
+ /* 2710 */ 118, 0, 0, 0, 119, 227, 119, 118, 44, 119,
+ /* 2720 */ 392, 44, 203, 119, 0, 119, 119, 118, 44, 500,
+ /* 2730 */ 119, 33, 503, 118, 118, 407, 507, 508, 509, 510,
+ /* 2740 */ 511, 512, 118, 302, 515, 516, 517, 290, 119, 2,
+ /* 2750 */ 22, 51, 500, 254, 51, 503, 118, 22, 118, 507,
+ /* 2760 */ 508, 509, 510, 511, 512, 437, 199, 515, 516, 517,
+ /* 2770 */ 116, 392, 199, 118, 118, 198, 0, 116, 119, 0,
+ /* 2780 */ 118, 453, 119, 455, 118, 118, 407, 44, 118, 118,
+ /* 2790 */ 118, 118, 22, 51, 119, 119, 118, 118, 118, 118,
+ /* 2800 */ 199, 119, 119, 118, 392, 477, 118, 120, 22, 118,
+ /* 2810 */ 558, 121, 118, 118, 118, 118, 437, 36, 129, 407,
+ /* 2820 */ 119, 36, 118, 33, 119, 36, 118, 36, 500, 119,
+ /* 2830 */ 36, 503, 453, 119, 455, 507, 508, 509, 510, 511,
+ /* 2840 */ 512, 119, 36, 515, 516, 517, 232, 36, 257, 437,
+ /* 2850 */ 119, 118, 118, 36, 118, 140, 477, 140, 140, 140,
+ /* 2860 */ 22, 79, 78, 22, 36, 453, 36, 455, 36, 392,
+ /* 2870 */ 36, 36, 36, 36, 112, 36, 36, 85, 36, 500,
+ /* 2880 */ 36, 85, 503, 112, 407, 33, 507, 508, 509, 510,
+ /* 2890 */ 511, 512, 392, 36, 515, 516, 517, 36, 36, 22,
+ /* 2900 */ 36, 36, 36, 85, 36, 36, 36, 407, 36, 36,
+ /* 2910 */ 22, 36, 500, 57, 437, 503, 0, 36, 44, 507,
+ /* 2920 */ 508, 509, 510, 511, 512, 0, 36, 515, 516, 517,
+ /* 2930 */ 453, 44, 455, 57, 0, 36, 57, 437, 44, 0,
+ /* 2940 */ 36, 57, 44, 0, 36, 0, 22, 0, 22, 0,
+ /* 2950 */ 36, 22, 33, 453, 36, 455, 36, 22, 21, 21,
+ /* 2960 */ 392, 573, 22, 22, 20, 573, 573, 573, 573, 573,
+ /* 2970 */ 573, 573, 573, 561, 573, 407, 573, 500, 573, 573,
+ /* 2980 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512,
+ /* 2990 */ 573, 573, 515, 516, 517, 573, 573, 573, 573, 573,
+ /* 3000 */ 500, 573, 573, 503, 573, 437, 573, 507, 508, 509,
+ /* 3010 */ 510, 511, 512, 573, 573, 515, 516, 517, 573, 519,
+ /* 3020 */ 573, 453, 573, 455, 573, 392, 573, 38, 573, 573,
+ /* 3030 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3040 */ 407, 573, 573, 54, 573, 477, 57, 570, 573, 573,
+ /* 3050 */ 573, 573, 392, 573, 573, 66, 67, 68, 69, 573,
+ /* 3060 */ 71, 573, 573, 573, 573, 573, 573, 407, 500, 573,
+ /* 3070 */ 437, 503, 573, 573, 573, 507, 508, 509, 510, 511,
+ /* 3080 */ 512, 573, 573, 515, 516, 517, 453, 573, 455, 573,
+ /* 3090 */ 573, 573, 573, 573, 573, 573, 573, 437, 573, 573,
+ /* 3100 */ 573, 573, 573, 573, 573, 573, 117, 573, 573, 573,
+ /* 3110 */ 477, 122, 573, 453, 573, 455, 573, 573, 573, 573,
+ /* 3120 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3130 */ 573, 573, 573, 500, 573, 573, 503, 477, 392, 573,
+ /* 3140 */ 507, 508, 509, 510, 511, 512, 573, 573, 515, 516,
+ /* 3150 */ 517, 573, 573, 407, 573, 573, 573, 573, 392, 573,
+ /* 3160 */ 500, 573, 573, 503, 573, 573, 573, 507, 508, 509,
+ /* 3170 */ 510, 511, 512, 407, 573, 515, 516, 517, 189, 392,
+ /* 3180 */ 573, 573, 573, 437, 573, 573, 573, 198, 573, 573,
+ /* 3190 */ 573, 202, 203, 573, 407, 573, 573, 208, 209, 453,
+ /* 3200 */ 573, 455, 573, 437, 573, 573, 573, 573, 573, 573,
+ /* 3210 */ 573, 573, 573, 573, 573, 573, 227, 573, 573, 453,
+ /* 3220 */ 573, 455, 573, 477, 437, 573, 573, 573, 573, 573,
+ /* 3230 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3240 */ 453, 573, 455, 573, 573, 573, 500, 573, 573, 503,
+ /* 3250 */ 573, 573, 573, 507, 508, 509, 510, 511, 512, 573,
+ /* 3260 */ 573, 515, 516, 517, 573, 573, 500, 573, 573, 503,
+ /* 3270 */ 573, 573, 573, 507, 508, 509, 510, 511, 512, 573,
+ /* 3280 */ 573, 515, 516, 517, 573, 392, 573, 500, 573, 573,
+ /* 3290 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512,
+ /* 3300 */ 407, 573, 515, 516, 517, 392, 573, 573, 573, 573,
+ /* 3310 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3320 */ 407, 573, 573, 573, 573, 392, 573, 573, 573, 573,
+ /* 3330 */ 437, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3340 */ 407, 573, 573, 573, 573, 573, 453, 573, 455, 573,
+ /* 3350 */ 437, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3360 */ 573, 573, 573, 573, 573, 573, 453, 573, 455, 573,
+ /* 3370 */ 437, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3380 */ 573, 573, 573, 573, 573, 573, 453, 573, 455, 573,
+ /* 3390 */ 573, 573, 573, 500, 573, 573, 503, 573, 573, 573,
+ /* 3400 */ 507, 508, 509, 510, 511, 512, 573, 573, 515, 516,
+ /* 3410 */ 517, 573, 392, 500, 573, 573, 503, 573, 573, 573,
+ /* 3420 */ 507, 508, 509, 510, 511, 512, 573, 407, 515, 516,
+ /* 3430 */ 517, 573, 573, 500, 573, 573, 503, 573, 392, 573,
+ /* 3440 */ 507, 508, 509, 510, 511, 512, 573, 573, 515, 516,
+ /* 3450 */ 517, 573, 573, 407, 573, 573, 573, 437, 573, 573,
+ /* 3460 */ 573, 392, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3470 */ 573, 573, 573, 453, 573, 455, 407, 573, 573, 573,
+ /* 3480 */ 573, 392, 573, 437, 573, 573, 573, 573, 573, 573,
+ /* 3490 */ 573, 573, 573, 573, 573, 573, 407, 573, 573, 453,
+ /* 3500 */ 573, 455, 573, 392, 573, 573, 437, 573, 573, 573,
+ /* 3510 */ 573, 573, 573, 573, 573, 573, 573, 573, 407, 573,
+ /* 3520 */ 500, 573, 453, 503, 455, 573, 437, 507, 508, 509,
+ /* 3530 */ 510, 511, 512, 573, 573, 515, 516, 517, 573, 573,
+ /* 3540 */ 573, 573, 453, 573, 455, 573, 500, 573, 437, 503,
+ /* 3550 */ 573, 573, 573, 507, 508, 509, 510, 511, 512, 573,
+ /* 3560 */ 573, 515, 516, 517, 453, 573, 455, 573, 392, 500,
+ /* 3570 */ 573, 573, 503, 573, 573, 573, 507, 508, 509, 510,
+ /* 3580 */ 511, 512, 573, 407, 515, 516, 517, 392, 573, 500,
+ /* 3590 */ 573, 573, 503, 573, 573, 573, 507, 508, 509, 510,
+ /* 3600 */ 511, 512, 407, 573, 515, 516, 517, 573, 573, 392,
+ /* 3610 */ 573, 500, 573, 437, 503, 573, 573, 573, 507, 508,
+ /* 3620 */ 509, 510, 511, 512, 407, 573, 515, 516, 517, 453,
+ /* 3630 */ 573, 455, 437, 573, 573, 573, 573, 573, 573, 573,
+ /* 3640 */ 573, 573, 573, 573, 573, 573, 573, 573, 453, 573,
+ /* 3650 */ 455, 573, 573, 573, 437, 573, 573, 573, 573, 573,
+ /* 3660 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3670 */ 453, 573, 455, 573, 392, 573, 500, 573, 573, 503,
+ /* 3680 */ 573, 573, 573, 507, 508, 509, 510, 511, 512, 407,
+ /* 3690 */ 573, 515, 516, 517, 573, 500, 573, 573, 503, 573,
+ /* 3700 */ 573, 573, 507, 508, 509, 510, 511, 512, 573, 573,
+ /* 3710 */ 515, 516, 517, 573, 573, 573, 573, 500, 573, 437,
+ /* 3720 */ 503, 573, 573, 392, 507, 508, 509, 510, 511, 512,
+ /* 3730 */ 573, 573, 515, 516, 517, 453, 573, 455, 407, 573,
+ /* 3740 */ 573, 573, 573, 392, 573, 573, 573, 573, 573, 573,
+ /* 3750 */ 573, 573, 573, 573, 573, 573, 573, 573, 407, 573,
+ /* 3760 */ 573, 573, 573, 392, 573, 573, 573, 573, 437, 573,
+ /* 3770 */ 573, 573, 573, 573, 573, 573, 573, 573, 407, 573,
+ /* 3780 */ 573, 573, 500, 573, 453, 503, 455, 573, 437, 507,
+ /* 3790 */ 508, 509, 510, 511, 512, 573, 573, 515, 516, 517,
+ /* 3800 */ 573, 573, 573, 573, 453, 573, 455, 573, 437, 573,
+ /* 3810 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3820 */ 573, 573, 573, 573, 453, 573, 455, 573, 573, 573,
+ /* 3830 */ 573, 500, 573, 573, 503, 573, 573, 573, 507, 508,
+ /* 3840 */ 509, 510, 511, 512, 573, 573, 515, 516, 517, 573,
+ /* 3850 */ 392, 500, 573, 573, 503, 573, 573, 573, 507, 508,
+ /* 3860 */ 509, 510, 511, 512, 573, 407, 515, 516, 517, 392,
+ /* 3870 */ 573, 500, 573, 573, 503, 573, 573, 573, 507, 508,
+ /* 3880 */ 509, 510, 511, 512, 407, 573, 515, 516, 517, 392,
+ /* 3890 */ 573, 573, 573, 573, 573, 437, 573, 573, 573, 573,
+ /* 3900 */ 573, 573, 573, 573, 407, 573, 573, 573, 573, 573,
+ /* 3910 */ 573, 453, 573, 455, 437, 573, 573, 573, 573, 573,
+ /* 3920 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3930 */ 453, 573, 455, 573, 437, 573, 573, 573, 573, 573,
+ /* 3940 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 3950 */ 453, 573, 455, 573, 573, 573, 392, 573, 500, 573,
+ /* 3960 */ 573, 503, 573, 573, 573, 507, 508, 509, 510, 511,
+ /* 3970 */ 512, 407, 573, 515, 516, 517, 392, 500, 573, 573,
+ /* 3980 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512,
+ /* 3990 */ 573, 407, 515, 516, 517, 392, 573, 500, 573, 573,
+ /* 4000 */ 503, 437, 573, 573, 507, 508, 509, 510, 511, 512,
+ /* 4010 */ 407, 573, 515, 516, 517, 573, 573, 453, 573, 455,
+ /* 4020 */ 573, 437, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 4030 */ 573, 573, 573, 573, 573, 573, 573, 453, 573, 455,
+ /* 4040 */ 437, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 4050 */ 573, 573, 573, 573, 573, 573, 453, 573, 455, 573,
+ /* 4060 */ 573, 573, 573, 392, 500, 573, 573, 503, 573, 573,
+ /* 4070 */ 573, 507, 508, 509, 510, 511, 512, 573, 407, 515,
+ /* 4080 */ 516, 517, 392, 573, 500, 573, 573, 503, 573, 573,
+ /* 4090 */ 573, 507, 508, 509, 510, 511, 512, 407, 573, 515,
+ /* 4100 */ 516, 517, 573, 500, 573, 573, 503, 573, 437, 573,
+ /* 4110 */ 507, 508, 509, 510, 511, 512, 573, 573, 515, 516,
+ /* 4120 */ 517, 573, 573, 573, 453, 573, 455, 437, 573, 573,
+ /* 4130 */ 573, 392, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 4140 */ 573, 573, 573, 453, 573, 455, 407, 573, 573, 573,
+ /* 4150 */ 573, 392, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 4160 */ 573, 573, 573, 573, 573, 573, 407, 573, 573, 573,
+ /* 4170 */ 573, 500, 573, 573, 503, 573, 437, 573, 507, 508,
+ /* 4180 */ 509, 510, 511, 512, 573, 573, 515, 516, 517, 573,
+ /* 4190 */ 500, 573, 453, 503, 455, 573, 437, 507, 508, 509,
+ /* 4200 */ 510, 511, 512, 573, 573, 515, 516, 517, 573, 573,
+ /* 4210 */ 573, 573, 453, 573, 455, 573, 573, 573, 573, 392,
+ /* 4220 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 4230 */ 573, 573, 573, 573, 407, 573, 573, 573, 573, 500,
+ /* 4240 */ 573, 573, 503, 392, 573, 573, 507, 508, 509, 510,
+ /* 4250 */ 511, 512, 573, 573, 515, 516, 517, 573, 407, 500,
+ /* 4260 */ 573, 573, 503, 573, 437, 573, 507, 508, 509, 510,
+ /* 4270 */ 511, 512, 573, 573, 515, 516, 517, 573, 573, 573,
+ /* 4280 */ 453, 573, 455, 573, 573, 573, 573, 573, 437, 573,
+ /* 4290 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 4300 */ 573, 573, 573, 573, 453, 573, 455, 573, 573, 573,
+ /* 4310 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 4320 */ 573, 573, 573, 573, 573, 392, 573, 500, 573, 573,
+ /* 4330 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512,
+ /* 4340 */ 407, 573, 515, 516, 517, 573, 573, 573, 573, 392,
+ /* 4350 */ 573, 500, 573, 573, 503, 573, 573, 573, 507, 508,
+ /* 4360 */ 509, 510, 511, 512, 407, 573, 515, 516, 517, 573,
+ /* 4370 */ 437, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 4380 */ 573, 573, 573, 573, 573, 573, 453, 573, 455, 573,
+ /* 4390 */ 573, 573, 573, 573, 437, 573, 573, 573, 573, 573,
+ /* 4400 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 4410 */ 453, 573, 455, 573, 573, 573, 573, 573, 573, 573,
+ /* 4420 */ 573, 573, 573, 573, 573, 573, 573, 573, 573, 573,
+ /* 4430 */ 573, 573, 573, 500, 573, 573, 503, 573, 573, 573,
+ /* 4440 */ 507, 508, 509, 510, 511, 512, 573, 573, 515, 516,
+ /* 4450 */ 517, 573, 573, 573, 573, 573, 573, 500, 573, 573,
+ /* 4460 */ 503, 573, 573, 573, 507, 508, 509, 510, 511, 512,
+ /* 4470 */ 573, 573, 515, 516, 517, 389, 389, 389, 389, 389,
+ /* 4480 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4490 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4500 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4510 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4520 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4530 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4540 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4550 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4560 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4570 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4580 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4590 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4600 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4610 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4620 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4630 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4640 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4650 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4660 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4670 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4680 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4690 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4700 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4710 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4720 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4730 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4740 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4750 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4760 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4770 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4780 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4790 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4800 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4810 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4820 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4830 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4840 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4850 */ 389, 389, 389, 389, 389, 389, 389, 389, 389, 389,
+ /* 4860 */ 389, 389, 389, 389,
};
-#define YY_SHIFT_COUNT (1008)
+#define YY_SHIFT_COUNT (1024)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (2941)
+#define YY_SHIFT_MAX (2989)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 1704, 272, 355, 272, 628, 628, 628, 628, 628, 628,
- /* 10 */ 628, 628, 628, 628, 628, 628, 711, 1338, 1338, 1421,
- /* 20 */ 0, 983, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
- /* 30 */ 1338, 1338, 1066, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
- /* 40 */ 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
- /* 50 */ 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338, 1338,
- /* 60 */ 1338, 1338, 539, 645, 219, 200, 347, 457, 347, 347,
- /* 70 */ 200, 200, 347, 2050, 347, 1687, 2050, 63, 347, 7,
- /* 80 */ 2127, 491, 491, 91, 91, 2127, 2127, 962, 962, 491,
- /* 90 */ 378, 378, 192, 14, 14, 94, 269, 91, 91, 91,
- /* 100 */ 91, 91, 91, 91, 91, 91, 91, 91, 151, 321,
- /* 110 */ 349, 91, 91, 402, 7, 91, 151, 91, 7, 91,
- /* 120 */ 91, 91, 91, 7, 91, 91, 91, 7, 91, 7,
- /* 130 */ 7, 7, 474, 308, 308, 544, 544, 808, 951, 156,
- /* 140 */ 334, 978, 978, 978, 978, 978, 978, 978, 978, 978,
- /* 150 */ 978, 978, 978, 978, 978, 978, 978, 978, 978, 978,
- /* 160 */ 66, 602, 378, 192, 517, 517, 268, 603, 603, 603,
- /* 170 */ 436, 436, 466, 1101, 268, 402, 7, 484, 7, 7,
- /* 180 */ 367, 7, 7, 608, 7, 608, 608, 631, 683, 544,
- /* 190 */ 544, 544, 544, 544, 544, 2430, 1202, 21, 217, 218,
- /* 200 */ 218, 819, 242, 343, 198, 609, 294, 461, 725, 77,
- /* 210 */ 77, 984, 901, 1081, 1081, 1081, 820, 1081, 674, 1119,
- /* 220 */ 407, 428, 1405, 497, 1171, 1185, 1185, 1263, 1383, 1383,
- /* 230 */ 1040, 1257, 251, 1185, 1101, 1500, 1758, 1800, 1813, 1606,
- /* 240 */ 402, 1813, 402, 1653, 1800, 1857, 1832, 1857, 1832, 1694,
- /* 250 */ 1800, 1857, 1800, 1832, 1694, 1694, 1694, 1776, 1786, 1800,
- /* 260 */ 1800, 1791, 1800, 1800, 1800, 1886, 1856, 1886, 1856, 1813,
- /* 270 */ 402, 402, 1901, 402, 1903, 1906, 402, 1903, 402, 1912,
- /* 280 */ 402, 1918, 402, 402, 1892, 1892, 1800, 402, 1886, 7,
- /* 290 */ 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
- /* 300 */ 1800, 683, 683, 1886, 608, 608, 608, 1727, 1855, 1813,
- /* 310 */ 474, 1952, 1752, 1755, 1901, 474, 1500, 1800, 608, 1689,
- /* 320 */ 1695, 1689, 1695, 1692, 1809, 1689, 1697, 1700, 1705, 1500,
- /* 330 */ 1722, 1724, 1698, 1710, 1714, 1857, 2027, 1922, 1745, 1903,
- /* 340 */ 474, 474, 1695, 608, 608, 608, 608, 1695, 608, 1884,
- /* 350 */ 474, 608, 1918, 474, 1986, 608, 1908, 1918, 474, 631,
- /* 360 */ 474, 1857, 608, 608, 608, 608, 608, 608, 608, 608,
- /* 370 */ 608, 608, 608, 608, 608, 608, 608, 608, 608, 608,
- /* 380 */ 608, 608, 608, 608, 2030, 608, 1800, 474, 2124, 2118,
- /* 390 */ 2131, 2129, 1886, 4386, 4386, 4386, 4386, 4386, 4386, 4386,
- /* 400 */ 4386, 4386, 4386, 4386, 4386, 39, 1321, 558, 1103, 50,
- /* 410 */ 323, 910, 845, 862, 1195, 1261, 1212, 1386, 1402, 1454,
- /* 420 */ 1496, 1616, 1638, 1648, 1571, 1042, 1588, 17, 17, 17,
- /* 430 */ 17, 17, 17, 17, 17, 17, 271, 207, 615, 907,
- /* 440 */ 693, 693, 576, 105, 37, 443, 412, 451, 1151, 62,
- /* 450 */ 847, 784, 692, 692, 1024, 1249, 202, 1024, 1024, 1024,
- /* 460 */ 3, 1161, 1415, 914, 1374, 1358, 1216, 822, 1378, 1407,
- /* 470 */ 1399, 1412, 1407, 1414, 1356, 1187, 1489, 1544, 1567, 1605,
- /* 480 */ 1614, 1260, 1443, 1444, 936, 1452, 1518, 1522, 1524, 1361,
- /* 490 */ 751, 1419, 1532, 1539, 1542, 1543, 1561, 1549, 1389, 1560,
- /* 500 */ 1573, 1600, 1527, 1610, 1612, 1636, 1639, 1655, 1654, 1658,
- /* 510 */ 1683, 1696, 1699, 1706, 1717, 1744, 1750, 1753, 1766, 1677,
- /* 520 */ 1407, 1680, 1690, 1691, 1711, 1712, 1625, 1482, 1541, 1590,
- /* 530 */ 1545, 1684, 1734, 41, 2184, 2224, 2225, 2179, 2233, 2198,
- /* 540 */ 1996, 2204, 2205, 2207, 2002, 2246, 2211, 2214, 2008, 2216,
- /* 550 */ 2254, 2255, 2013, 2257, 2222, 2259, 2226, 2260, 2239, 2263,
- /* 560 */ 2229, 2031, 2270, 2053, 2278, 2058, 2059, 2067, 2070, 2287,
- /* 570 */ 2294, 2295, 2077, 2079, 2291, 2296, 2139, 2247, 2249, 2304,
- /* 580 */ 2269, 2306, 2307, 2272, 2256, 2309, 2261, 2311, 2266, 2314,
- /* 590 */ 2315, 2316, 2267, 2317, 2322, 2323, 2324, 2325, 2326, 2157,
- /* 600 */ 2298, 2335, 2161, 2338, 2339, 2340, 2341, 2342, 2344, 2347,
- /* 610 */ 2348, 2350, 2351, 2352, 2359, 2360, 2364, 2365, 2367, 2368,
- /* 620 */ 2369, 2371, 2372, 2329, 2373, 2334, 2376, 2383, 2385, 2386,
- /* 630 */ 2387, 2388, 2389, 2390, 2391, 2370, 2393, 2236, 2395, 2241,
- /* 640 */ 2399, 2244, 2401, 2402, 2381, 2361, 2392, 2363, 2411, 2349,
- /* 650 */ 2412, 2353, 2380, 2418, 2355, 2419, 2356, 2420, 2422, 2394,
- /* 660 */ 2374, 2382, 2427, 2397, 2396, 2398, 2434, 2407, 2400, 2404,
- /* 670 */ 2435, 2415, 2452, 2409, 2416, 2426, 2410, 2413, 2449, 2414,
- /* 680 */ 2466, 2424, 2423, 2470, 2472, 2474, 2476, 2433, 2271, 2479,
- /* 690 */ 2410, 2429, 2481, 2410, 2431, 2485, 2486, 2421, 2487, 2488,
- /* 700 */ 2453, 2437, 2455, 2500, 2465, 2448, 2459, 2504, 2469, 2457,
- /* 710 */ 2462, 2507, 2473, 2458, 2471, 2513, 2514, 2516, 2517, 2519,
- /* 720 */ 2522, 2406, 2417, 2501, 2502, 2523, 2510, 2503, 2505, 2509,
- /* 730 */ 2512, 2515, 2518, 2520, 2525, 2532, 2524, 2526, 2537, 2538,
- /* 740 */ 2528, 2539, 2543, 2530, 2546, 2531, 2576, 2555, 2529, 2578,
- /* 750 */ 2557, 2548, 2582, 2587, 2588, 2553, 2597, 2565, 2602, 2567,
- /* 760 */ 2604, 2583, 2589, 2571, 2572, 2574, 2495, 2497, 2613, 2425,
- /* 770 */ 2403, 2405, 2499, 2408, 2410, 2564, 2616, 2436, 2581, 2598,
- /* 780 */ 2619, 2428, 2600, 2441, 2438, 2623, 2624, 2443, 2440, 2445,
- /* 790 */ 2442, 2625, 2606, 2327, 2533, 2534, 2540, 2536, 2605, 2610,
- /* 800 */ 2541, 2601, 2544, 2607, 2547, 2545, 2627, 2629, 2549, 2551,
- /* 810 */ 2556, 2558, 2552, 2630, 2621, 2626, 2559, 2631, 2336, 2594,
- /* 820 */ 2554, 2645, 2566, 2643, 2568, 2569, 2677, 2649, 2432, 2647,
- /* 830 */ 2650, 2651, 2652, 2657, 2658, 2579, 2586, 2656, 2444, 2670,
- /* 840 */ 2659, 2708, 2709, 2596, 2668, 2599, 2603, 2612, 2617, 2550,
- /* 850 */ 2620, 2713, 2672, 2542, 2728, 2618, 2622, 2560, 2695, 2562,
- /* 860 */ 2710, 2635, 2464, 2637, 2742, 2729, 2506, 2638, 2639, 2644,
- /* 870 */ 2653, 2654, 2636, 2646, 2660, 2662, 2663, 2665, 2667, 2648,
- /* 880 */ 2714, 2669, 2673, 2715, 2671, 2745, 2561, 2674, 2681, 2770,
- /* 890 */ 2686, 2682, 2575, 2730, 2689, 2688, 2772, 2751, 2690, 2692,
- /* 900 */ 2410, 2758, 2696, 2697, 2694, 2698, 2699, 2691, 2793, 2590,
- /* 910 */ 2702, 2784, 2785, 2712, 2707, 2789, 2716, 2723, 2792, 2660,
- /* 920 */ 2724, 2794, 2662, 2731, 2796, 2663, 2733, 2808, 2665, 2717,
- /* 930 */ 2725, 2734, 2736, 2735, 2812, 2737, 2810, 2738, 2812, 2812,
- /* 940 */ 2839, 2790, 2795, 2845, 2832, 2838, 2847, 2853, 2854, 2855,
- /* 950 */ 2856, 2857, 2858, 2859, 2860, 2816, 2766, 2817, 2791, 2868,
- /* 960 */ 2866, 2867, 2869, 2882, 2870, 2872, 2874, 2827, 2524, 2875,
- /* 970 */ 2526, 2876, 2877, 2878, 2879, 2894, 2881, 2919, 2884, 2871,
- /* 980 */ 2880, 2921, 2887, 2883, 2885, 2926, 2892, 2886, 2888, 2930,
- /* 990 */ 2895, 2890, 2889, 2934, 2899, 2936, 2916, 2903, 2941, 2920,
- /* 1000 */ 2913, 2911, 2912, 2928, 2932, 2929, 2933, 2935, 2937,
+ /* 0 */ 948, 277, 554, 277, 832, 832, 832, 832, 832, 832,
+ /* 10 */ 832, 832, 832, 832, 832, 832, 1109, 1940, 1940, 2217,
+ /* 20 */ 0, 1386, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940,
+ /* 30 */ 1940, 1940, 1663, 1940, 1940, 1940, 1940, 1940, 1940, 1940,
+ /* 40 */ 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940,
+ /* 50 */ 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940,
+ /* 60 */ 1940, 1940, 1940, 34, 66, 180, 253, 46, 122, 46,
+ /* 70 */ 46, 253, 253, 46, 960, 46, 276, 960, 520, 46,
+ /* 80 */ 149, 2315, 156, 156, 212, 212, 2315, 2315, 598, 598,
+ /* 90 */ 156, 20, 20, 346, 89, 89, 69, 204, 212, 212,
+ /* 100 */ 212, 212, 212, 212, 212, 212, 212, 212, 212, 333,
+ /* 110 */ 444, 573, 212, 212, 585, 149, 212, 333, 212, 149,
+ /* 120 */ 212, 212, 212, 212, 149, 212, 212, 212, 149, 212,
+ /* 130 */ 149, 149, 149, 648, 222, 222, 473, 473, 745, 652,
+ /* 140 */ 181, 51, 548, 548, 548, 548, 548, 548, 548, 548,
+ /* 150 */ 548, 548, 548, 548, 548, 548, 548, 548, 548, 548,
+ /* 160 */ 548, 1858, 200, 20, 346, 849, 849, 710, 379, 379,
+ /* 170 */ 379, 927, 927, 699, 1091, 710, 585, 149, 614, 149,
+ /* 180 */ 149, 466, 149, 149, 683, 149, 683, 683, 728, 25,
+ /* 190 */ 2488, 473, 473, 473, 473, 473, 473, 1190, 21, 53,
+ /* 200 */ 411, 411, 314, 148, 23, 220, 152, 596, 213, 571,
+ /* 210 */ 560, 560, 892, 662, 1043, 1043, 1043, 382, 1043, 774,
+ /* 220 */ 757, 92, 896, 1442, 1208, 682, 1247, 1247, 1254, 1320,
+ /* 230 */ 1320, 1082, 1000, 241, 1247, 1091, 1510, 1772, 1812, 1814,
+ /* 240 */ 1601, 585, 1814, 585, 1639, 1812, 1842, 1819, 1842, 1819,
+ /* 250 */ 1686, 1812, 1842, 1812, 1819, 1686, 1686, 1686, 1782, 1788,
+ /* 260 */ 1812, 1812, 1792, 1812, 1812, 1812, 1886, 1860, 1886, 1860,
+ /* 270 */ 1814, 585, 585, 1896, 585, 1935, 1937, 585, 1935, 585,
+ /* 280 */ 1943, 585, 1948, 585, 585, 1921, 1921, 1812, 585, 1886,
+ /* 290 */ 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
+ /* 300 */ 149, 1812, 25, 25, 1886, 683, 683, 683, 1759, 1881,
+ /* 310 */ 1814, 648, 1992, 1799, 1806, 1896, 648, 1510, 1812, 683,
+ /* 320 */ 1714, 1717, 1714, 1717, 1712, 1836, 1714, 1724, 1726, 1745,
+ /* 330 */ 1510, 1749, 1763, 1738, 1739, 1740, 1842, 2061, 1954, 1770,
+ /* 340 */ 1935, 648, 648, 1717, 683, 683, 683, 683, 1717, 683,
+ /* 350 */ 1924, 648, 683, 1948, 648, 2015, 683, 1944, 1948, 648,
+ /* 360 */ 728, 648, 1842, 683, 683, 683, 683, 683, 683, 683,
+ /* 370 */ 683, 683, 683, 683, 683, 683, 683, 683, 683, 683,
+ /* 380 */ 683, 683, 683, 683, 683, 2034, 683, 1812, 648, 2155,
+ /* 390 */ 2148, 2152, 2151, 1886, 4475, 4475, 4475, 4475, 4475, 4475,
+ /* 400 */ 4475, 4475, 4475, 4475, 4475, 4475, 39, 2989, 70, 1146,
+ /* 410 */ 1193, 1243, 1425, 1711, 715, 1434, 1560, 1570, 1124, 497,
+ /* 420 */ 770, 1584, 1542, 1861, 1878, 1699, 1808, 1004, 1169, 1026,
+ /* 430 */ 1026, 1026, 1026, 1026, 1026, 1026, 1026, 1026, 237, 150,
+ /* 440 */ 992, 831, 3, 3, 681, 106, 321, 182, 686, 711,
+ /* 450 */ 334, 752, 837, 767, 928, 928, 687, 736, 1138, 687,
+ /* 460 */ 687, 687, 1407, 1275, 1206, 1382, 1446, 1365, 1473, 1509,
+ /* 470 */ 10, 1495, 1373, 399, 1374, 1403, 399, 1408, 1478, 1499,
+ /* 480 */ 1526, 1302, 1527, 1538, 1545, 1396, 1469, 1489, 179, 1500,
+ /* 490 */ 1513, 1519, 1561, 1351, 1301, 1130, 1507, 1562, 1568, 1569,
+ /* 500 */ 1563, 1577, 1488, 1587, 1610, 1632, 1573, 1625, 1633, 1645,
+ /* 510 */ 1653, 1657, 1558, 1591, 1624, 1692, 1704, 1718, 1720, 1723,
+ /* 520 */ 1733, 1737, 1741, 1667, 399, 1708, 1730, 1735, 1736, 1742,
+ /* 530 */ 1575, 1682, 1541, 1589, 1743, 1744, 1719, 1702, 2256, 2257,
+ /* 540 */ 2258, 2212, 2260, 2225, 2017, 2227, 2228, 2231, 2020, 2268,
+ /* 550 */ 2233, 2234, 2026, 2236, 2273, 2274, 2030, 2276, 2241, 2278,
+ /* 560 */ 2243, 2280, 2259, 2282, 2247, 2044, 2285, 2059, 2287, 2062,
+ /* 570 */ 2064, 2069, 2074, 2294, 2295, 2297, 2083, 2085, 2300, 2301,
+ /* 580 */ 2142, 2253, 2254, 2306, 2271, 2308, 2309, 2275, 2261, 2310,
+ /* 590 */ 2262, 2319, 2269, 2317, 2320, 2321, 2264, 2322, 2323, 2324,
+ /* 600 */ 2325, 2326, 2329, 2157, 2298, 2330, 2159, 2331, 2339, 2340,
+ /* 610 */ 2341, 2342, 2343, 2344, 2345, 2346, 2347, 2349, 2350, 2352,
+ /* 620 */ 2354, 2355, 2356, 2357, 2358, 2360, 2361, 2312, 2364, 2318,
+ /* 630 */ 2377, 2382, 2384, 2385, 2389, 2390, 2391, 2392, 2393, 2395,
+ /* 640 */ 2375, 2398, 2218, 2380, 2239, 2400, 2242, 2402, 2403, 2383,
+ /* 650 */ 2362, 2386, 2363, 2404, 2335, 2407, 2338, 2374, 2413, 2348,
+ /* 660 */ 2416, 2353, 2417, 2418, 2387, 2368, 2376, 2426, 2394, 2370,
+ /* 670 */ 2388, 2428, 2397, 2372, 2396, 2431, 2399, 2434, 2381, 2439,
+ /* 680 */ 2406, 2445, 2408, 2410, 2414, 2409, 2411, 2432, 2415, 2459,
+ /* 690 */ 2419, 2423, 2461, 2468, 2474, 2490, 2452, 2288, 2497, 2409,
+ /* 700 */ 2455, 2508, 2409, 2458, 2510, 2511, 2433, 2513, 2514, 2480,
+ /* 710 */ 2460, 2475, 2518, 2484, 2464, 2478, 2523, 2489, 2467, 2483,
+ /* 720 */ 2528, 2493, 2476, 2487, 2532, 2535, 2537, 2538, 2539, 2504,
+ /* 730 */ 2543, 2544, 2420, 2421, 2515, 2524, 2549, 2530, 2517, 2522,
+ /* 740 */ 2525, 2526, 2527, 2529, 2534, 2536, 2541, 2531, 2533, 2545,
+ /* 750 */ 2546, 2552, 2547, 2550, 2551, 2571, 2553, 2579, 2558, 2548,
+ /* 760 */ 2584, 2563, 2555, 2586, 2587, 2588, 2556, 2593, 2559, 2594,
+ /* 770 */ 2560, 2603, 2582, 2589, 2570, 2572, 2575, 2494, 2496, 2612,
+ /* 780 */ 2422, 2405, 2424, 2498, 2401, 2409, 2564, 2617, 2429, 2583,
+ /* 790 */ 2598, 2622, 2425, 2602, 2446, 2427, 2628, 2643, 2449, 2440,
+ /* 800 */ 2453, 2442, 2647, 2618, 2334, 2540, 2542, 2554, 2557, 2631,
+ /* 810 */ 2561, 2562, 2620, 2621, 2565, 2608, 2569, 2610, 2566, 2576,
+ /* 820 */ 2630, 2632, 2578, 2580, 2581, 2585, 2590, 2634, 2613, 2619,
+ /* 830 */ 2592, 2635, 2336, 2605, 2595, 2636, 2599, 2637, 2597, 2600,
+ /* 840 */ 2668, 2641, 2359, 2639, 2642, 2651, 2658, 2664, 2665, 2604,
+ /* 850 */ 2606, 2653, 2441, 2669, 2657, 2711, 2712, 2609, 2674, 2607,
+ /* 860 */ 2611, 2615, 2616, 2567, 2624, 2713, 2677, 2519, 2724, 2629,
+ /* 870 */ 2638, 2573, 2684, 2577, 2698, 2654, 2457, 2661, 2747, 2728,
+ /* 880 */ 2499, 2640, 2655, 2656, 2662, 2666, 2659, 2663, 2667, 2670,
+ /* 890 */ 2671, 2672, 2673, 2675, 2700, 2678, 2679, 2703, 2676, 2735,
+ /* 900 */ 2591, 2680, 2681, 2776, 2682, 2685, 2601, 2743, 2688, 2687,
+ /* 910 */ 2779, 2770, 2690, 2691, 2409, 2742, 2694, 2695, 2683, 2696,
+ /* 920 */ 2697, 2689, 2786, 2614, 2701, 2781, 2785, 2704, 2705, 2789,
+ /* 930 */ 2708, 2710, 2791, 2667, 2714, 2794, 2670, 2722, 2806, 2671,
+ /* 940 */ 2731, 2811, 2672, 2715, 2717, 2718, 2719, 2733, 2790, 2734,
+ /* 950 */ 2817, 2736, 2790, 2790, 2838, 2782, 2784, 2841, 2828, 2830,
+ /* 960 */ 2832, 2834, 2835, 2836, 2837, 2839, 2840, 2842, 2844, 2792,
+ /* 970 */ 2762, 2796, 2771, 2852, 2857, 2861, 2862, 2877, 2864, 2865,
+ /* 980 */ 2866, 2818, 2531, 2868, 2533, 2869, 2870, 2872, 2873, 2888,
+ /* 990 */ 2875, 2916, 2881, 2856, 2874, 2925, 2890, 2876, 2887, 2934,
+ /* 1000 */ 2899, 2879, 2894, 2939, 2904, 2884, 2898, 2943, 2908, 2945,
+ /* 1010 */ 2924, 2947, 2926, 2914, 2949, 2929, 2919, 2918, 2920, 2935,
+ /* 1020 */ 2937, 2940, 2941, 2938, 2944,
};
-#define YY_REDUCE_COUNT (404)
-#define YY_REDUCE_MIN (-519)
-#define YY_REDUCE_MAX (3874)
+#define YY_REDUCE_COUNT (405)
+#define YY_REDUCE_MIN (-536)
+#define YY_REDUCE_MAX (3957)
static const short yy_reduce_ofst[] = {
- /* 0 */ -376, -346, 1320, -204, 267, 622, 977, 1487, 1555, 1620,
- /* 10 */ 1593, 1688, 1726, 1770, 1852, 1935, -98, -59, 303, 2024,
- /* 20 */ 2061, 2089, 2195, 2220, 2289, 2332, 2354, 2375, 2496, 2521,
- /* 30 */ 2563, 2628, 2655, 2693, 2722, 2761, 2787, 2852, 2873, 2950,
- /* 40 */ 2994, 3015, 3035, 3100, 3141, 3165, 3232, 3254, 3297, 3321,
- /* 50 */ 3442, 3461, 3483, 3510, 3548, 3597, 3636, 3680, 3704, 3723,
- /* 60 */ 3792, 3874, -321, 280, -469, -48, -457, -363, 899, 985,
- /* 70 */ 554, 1022, 1242, 304, 197, -72, 244, -160, 237, -417,
- /* 80 */ -328, -393, 111, -133, 84, -6, 434, -380, -304, -140,
- /* 90 */ -423, -414, 376, 336, 560, -252, -44, 328, 391, 495,
- /* 100 */ 586, -395, 31, 644, 667, 673, 676, 617, -158, 247,
- /* 110 */ 326, 700, 709, 680, 570, 742, 449, 746, -236, 749,
- /* 120 */ 752, 759, 812, 431, 814, 871, 893, -50, 895, 591,
- /* 130 */ 902, 755, -185, -519, -519, -38, -119, -389, -332, -20,
- /* 140 */ 310, 470, 616, 623, 664, 720, 726, 735, 782, 791,
- /* 150 */ 919, 956, 981, 995, 997, 1004, 1007, 1026, 1050, 1059,
- /* 160 */ -262, -379, 148, -8, 896, 911, 939, -379, 840, 868,
- /* 170 */ 229, 482, -246, 779, 941, 876, 666, -416, 250, 306,
- /* 180 */ 865, 332, 739, 917, 982, 1002, 1028, -188, 1041, 447,
- /* 190 */ 472, 588, 643, 698, 724, 636, 815, 891, 875, 830,
- /* 200 */ 830, 882, 970, 1102, 1036, 1124, 830, 1140, 1140, 1251,
- /* 210 */ 1314, 1359, 1309, 1228, 1229, 1230, 1312, 1232, 1140, 1327,
- /* 220 */ 1384, 1292, 1388, 1344, 1311, 1333, 1335, 1140, 1258, 1265,
- /* 230 */ 1239, 1276, 1269, 1346, 1391, 1341, 1322, 1432, 1350, 1351,
- /* 240 */ 1431, 1372, 1437, 1395, 1472, 1477, 1424, 1481, 1427, 1433,
- /* 250 */ 1485, 1486, 1491, 1436, 1440, 1441, 1442, 1483, 1488, 1498,
- /* 260 */ 1499, 1492, 1502, 1504, 1505, 1514, 1512, 1517, 1519, 1426,
- /* 270 */ 1510, 1511, 1473, 1515, 1523, 1453, 1520, 1525, 1526, 1467,
- /* 280 */ 1528, 1479, 1531, 1533, 1521, 1530, 1547, 1536, 1562, 1529,
- /* 290 */ 1534, 1535, 1537, 1538, 1540, 1546, 1551, 1552, 1554, 1556,
- /* 300 */ 1559, 1565, 1572, 1569, 1516, 1548, 1553, 1478, 1493, 1490,
- /* 310 */ 1566, 1494, 1550, 1557, 1558, 1592, 1563, 1601, 1564, 1468,
- /* 320 */ 1568, 1469, 1574, 1471, 1470, 1476, 1480, 1495, 1484, 1570,
- /* 330 */ 1497, 1501, 1465, 1508, 1575, 1645, 1576, 1509, 1581, 1651,
- /* 340 */ 1663, 1668, 1613, 1608, 1632, 1634, 1635, 1617, 1644, 1621,
- /* 350 */ 1685, 1646, 1640, 1701, 1584, 1659, 1649, 1673, 1721, 1715,
- /* 360 */ 1737, 1746, 1666, 1703, 1707, 1708, 1713, 1719, 1720, 1723,
- /* 370 */ 1725, 1729, 1730, 1731, 1732, 1733, 1736, 1739, 1740, 1741,
- /* 380 */ 1749, 1756, 1760, 1761, 1716, 1762, 1748, 1751, 1763, 1768,
- /* 390 */ 1769, 1780, 1771, 1728, 1767, 1709, 1735, 1747, 1754, 1789,
- /* 400 */ 1790, 1781, 1793, 1773, 1834,
+ /* 0 */ 418, -349, -99, 142, 552, 829, 1008, 1285, 1582, 1664,
+ /* 10 */ 1106, 1859, 1941, 176, 1336, 1613, -135, 289, 2123, 419,
+ /* 20 */ 974, 2229, 2252, 2328, 2379, 2412, 2477, 2500, 2568, 2633,
+ /* 30 */ 2660, 2746, 2766, 2787, 2893, 2913, 2933, 3020, 3046, 3069,
+ /* 40 */ 3089, 3111, 3176, 3195, 3217, 3282, 3331, 3351, 3371, 3458,
+ /* 50 */ 3477, 3497, 3564, 3584, 3603, 3671, 3690, 3739, 3759, 3827,
+ /* 60 */ 3851, 3933, 3957, -351, 448, 605, -290, -366, 481, 1203,
+ /* 70 */ 1464, 329, 442, 1485, -412, -536, -153, -393, -534, 14,
+ /* 80 */ 197, 347, -106, -49, 254, 271, 480, 511, -400, -398,
+ /* 90 */ -368, -374, -100, -245, 57, 192, 164, -382, -90, 507,
+ /* 100 */ 539, 551, 43, 229, 718, 806, 834, 843, 305, 151,
+ /* 110 */ -114, 385, 847, 879, 639, 472, 889, 218, 900, 706,
+ /* 120 */ 983, 995, 997, 1006, -219, 1029, 1046, 1052, 729, 1061,
+ /* 130 */ 228, 792, 1017, 616, 61, 61, 184, -415, -35, -259,
+ /* 140 */ -503, -193, -25, 443, 502, 603, 617, 658, 734, 735,
+ /* 150 */ 738, 778, 827, 895, 901, 935, 963, 967, 1022, 1027,
+ /* 160 */ 1039, -14, 121, 33, 316, 256, 588, 651, 121, 258,
+ /* 170 */ 363, 787, 788, 508, -28, 692, 493, 844, 768, -428,
+ /* 180 */ 143, 905, 189, 786, 897, 860, 899, 1016, 754, 739,
+ /* 190 */ 471, 568, 574, 737, 755, 766, 784, 724, 950, 1011,
+ /* 200 */ 823, 823, 721, 987, 1034, 1072, 1217, 823, 1192, 1192,
+ /* 210 */ 1236, 1261, 1292, 1244, 1162, 1200, 1202, 1296, 1218, 1192,
+ /* 220 */ 1317, 1377, 1282, 1383, 1332, 1312, 1334, 1338, 1192, 1262,
+ /* 230 */ 1263, 1248, 1278, 1265, 1350, 1400, 1348, 1329, 1427, 1344,
+ /* 240 */ 1342, 1426, 1349, 1435, 1360, 1453, 1456, 1409, 1465, 1416,
+ /* 250 */ 1421, 1475, 1476, 1479, 1433, 1429, 1437, 1438, 1482, 1486,
+ /* 260 */ 1497, 1501, 1491, 1503, 1504, 1505, 1514, 1511, 1516, 1517,
+ /* 270 */ 1444, 1521, 1529, 1487, 1539, 1548, 1477, 1544, 1553, 1550,
+ /* 280 */ 1494, 1552, 1506, 1554, 1555, 1546, 1551, 1571, 1566, 1576,
+ /* 290 */ 1549, 1556, 1557, 1559, 1564, 1565, 1572, 1578, 1579, 1580,
+ /* 300 */ 1581, 1586, 1592, 1593, 1596, 1537, 1583, 1585, 1508, 1520,
+ /* 310 */ 1531, 1594, 1533, 1540, 1547, 1588, 1620, 1574, 1634, 1598,
+ /* 320 */ 1490, 1590, 1492, 1597, 1502, 1515, 1512, 1498, 1522, 1518,
+ /* 330 */ 1595, 1523, 1535, 1528, 1536, 1543, 1672, 1599, 1567, 1602,
+ /* 340 */ 1678, 1674, 1675, 1630, 1654, 1656, 1659, 1662, 1658, 1665,
+ /* 350 */ 1666, 1725, 1679, 1661, 1727, 1612, 1690, 1681, 1683, 1747,
+ /* 360 */ 1721, 1750, 1748, 1697, 1698, 1701, 1703, 1705, 1709, 1715,
+ /* 370 */ 1716, 1729, 1731, 1732, 1734, 1760, 1766, 1767, 1768, 1778,
+ /* 380 */ 1779, 1780, 1781, 1783, 1785, 1728, 1787, 1751, 1752, 1784,
+ /* 390 */ 1793, 1837, 1797, 1813, 1758, 1803, 1746, 1754, 1769, 1773,
+ /* 400 */ 1815, 1820, 1809, 1821, 1838, 1864,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 10 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 20 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 30 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 40 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 50 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 60 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 70 */ 2268, 2268, 2645, 2268, 2268, 2601, 2268, 2268, 2268, 2268,
- /* 80 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 90 */ 2608, 2608, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 100 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 110 */ 2268, 2268, 2268, 2374, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 120 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 130 */ 2268, 2268, 2372, 2915, 2268, 3041, 2686, 2268, 2268, 2944,
- /* 140 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 150 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 160 */ 2268, 2927, 2268, 2268, 2345, 2345, 2268, 2927, 2927, 2927,
- /* 170 */ 2887, 2887, 2372, 2268, 2268, 2374, 2268, 2688, 2268, 2268,
- /* 180 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2517, 2298, 2268,
- /* 190 */ 2268, 2268, 2268, 2268, 2268, 2671, 2268, 2268, 2973, 2919,
- /* 200 */ 2920, 3035, 2268, 2976, 2938, 2268, 2933, 2268, 2268, 2268,
- /* 210 */ 2268, 2268, 2963, 2268, 2268, 2268, 2268, 2268, 2268, 2613,
- /* 220 */ 2268, 2714, 2268, 2460, 2665, 2268, 2268, 2268, 2268, 2268,
- /* 230 */ 3019, 2917, 2957, 2268, 2268, 2967, 2268, 2268, 2268, 2702,
- /* 240 */ 2374, 2268, 2374, 2658, 2596, 2268, 2606, 2268, 2606, 2603,
- /* 250 */ 2268, 2268, 2268, 2606, 2603, 2603, 2603, 2448, 2444, 2268,
- /* 260 */ 2268, 2442, 2268, 2268, 2268, 2268, 2328, 2268, 2328, 2268,
- /* 270 */ 2374, 2374, 2268, 2374, 2268, 2268, 2374, 2268, 2374, 2268,
- /* 280 */ 2374, 2268, 2374, 2374, 2477, 2477, 2268, 2374, 2268, 2268,
- /* 290 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 300 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2700, 2681, 2268,
- /* 310 */ 2372, 2268, 2669, 2667, 2268, 2372, 2967, 2268, 2268, 2989,
- /* 320 */ 2984, 2989, 2984, 3003, 2999, 2989, 3008, 3005, 2969, 2967,
- /* 330 */ 2950, 2946, 3038, 3025, 3021, 2268, 2268, 2955, 2953, 2268,
- /* 340 */ 2372, 2372, 2984, 2268, 2268, 2268, 2268, 2984, 2268, 2268,
- /* 350 */ 2372, 2268, 2268, 2372, 2268, 2268, 2268, 2268, 2372, 2268,
- /* 360 */ 2372, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 370 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 380 */ 2268, 2268, 2268, 2268, 2479, 2268, 2268, 2372, 2268, 2300,
- /* 390 */ 2302, 2312, 2268, 2660, 3041, 2686, 2691, 2641, 2641, 2520,
- /* 400 */ 2520, 3041, 2520, 2375, 2273, 2268, 2268, 2268, 2268, 2268,
- /* 410 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 420 */ 2819, 2268, 2268, 2268, 2268, 2268, 2268, 3002, 3001, 2820,
- /* 430 */ 2268, 2891, 2890, 2889, 2880, 2819, 2473, 2268, 2268, 2268,
- /* 440 */ 2818, 2817, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 450 */ 2268, 2268, 2632, 2631, 2811, 2268, 2268, 2812, 2810, 2809,
- /* 460 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2464,
- /* 470 */ 2268, 2268, 2461, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 480 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 490 */ 3022, 3026, 2268, 2268, 2268, 2268, 2916, 2268, 2268, 2268,
- /* 500 */ 2268, 2268, 2790, 2268, 2268, 2268, 2268, 2268, 2758, 2753,
- /* 510 */ 2744, 2735, 2750, 2741, 2729, 2747, 2738, 2726, 2723, 2268,
- /* 520 */ 2488, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 530 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 540 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 550 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 560 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 570 */ 2268, 2268, 2268, 2268, 2268, 2268, 2602, 2268, 2268, 2268,
- /* 580 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 590 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 600 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 610 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 620 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 630 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 640 */ 2268, 2617, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 650 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 660 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 670 */ 2268, 2268, 2268, 2268, 2268, 2317, 2797, 2268, 2268, 2268,
- /* 680 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 690 */ 2800, 2268, 2268, 2801, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 700 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 710 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 720 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 730 */ 2268, 2268, 2268, 2268, 2268, 2268, 2419, 2418, 2268, 2268,
- /* 740 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 750 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 760 */ 2268, 2268, 2268, 2268, 2268, 2268, 2802, 2268, 2268, 2268,
- /* 770 */ 2268, 2685, 2268, 2268, 2792, 2268, 2268, 2268, 2268, 2268,
- /* 780 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 790 */ 2268, 3018, 2970, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 800 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 810 */ 2268, 2268, 2268, 2268, 2268, 2790, 2268, 3000, 2268, 2268,
- /* 820 */ 2268, 2268, 2268, 2268, 2268, 3016, 2268, 3020, 2268, 2268,
- /* 830 */ 2268, 2268, 2268, 2268, 2268, 2926, 2922, 2268, 2268, 2918,
- /* 840 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 850 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 860 */ 2877, 2268, 2268, 2268, 2911, 2268, 2268, 2268, 2268, 2268,
- /* 870 */ 2268, 2268, 2268, 2268, 2516, 2515, 2514, 2513, 2268, 2268,
- /* 880 */ 2268, 2268, 2268, 2268, 2802, 2268, 2805, 2268, 2268, 2268,
- /* 890 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 900 */ 2789, 2268, 2854, 2853, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 910 */ 2268, 2268, 2268, 2510, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 920 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2494,
- /* 930 */ 2492, 2491, 2490, 2268, 2527, 2268, 2268, 2268, 2523, 2522,
- /* 940 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 950 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2393,
- /* 960 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2385, 2268,
- /* 970 */ 2384, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 980 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 990 */ 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
- /* 1000 */ 2297, 2268, 2268, 2268, 2268, 2268, 2268, 2268, 2268,
+ /* 0 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 10 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 20 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 30 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 40 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 50 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 60 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 70 */ 2300, 2300, 2300, 2683, 2300, 2300, 2639, 2300, 2300, 2300,
+ /* 80 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 90 */ 2300, 2646, 2646, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 100 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 110 */ 2300, 2300, 2300, 2300, 2410, 2300, 2300, 2300, 2300, 2300,
+ /* 120 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 130 */ 2300, 2300, 2300, 2408, 2956, 2300, 3084, 2724, 2300, 2300,
+ /* 140 */ 2985, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 150 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 160 */ 2300, 2300, 2968, 2300, 2300, 2381, 2381, 2300, 2968, 2968,
+ /* 170 */ 2968, 2928, 2928, 2408, 2300, 2300, 2410, 2300, 2726, 2300,
+ /* 180 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2553, 2330,
+ /* 190 */ 2709, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 3014,
+ /* 200 */ 2960, 2961, 3078, 2300, 3017, 2979, 2300, 2974, 2300, 2300,
+ /* 210 */ 2300, 2300, 2300, 3004, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 220 */ 2651, 2300, 2752, 2300, 2496, 2703, 2300, 2300, 2300, 2300,
+ /* 230 */ 2300, 3062, 2958, 2998, 2300, 2300, 3008, 2300, 2300, 2300,
+ /* 240 */ 2740, 2410, 2300, 2410, 2696, 2634, 2300, 2644, 2300, 2644,
+ /* 250 */ 2641, 2300, 2300, 2300, 2644, 2641, 2641, 2641, 2484, 2480,
+ /* 260 */ 2300, 2300, 2478, 2300, 2300, 2300, 2300, 2360, 2300, 2360,
+ /* 270 */ 2300, 2410, 2410, 2300, 2410, 2300, 2300, 2410, 2300, 2410,
+ /* 280 */ 2300, 2410, 2300, 2410, 2410, 2513, 2513, 2300, 2410, 2300,
+ /* 290 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 300 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2738, 2719,
+ /* 310 */ 2300, 2408, 2300, 2707, 2705, 2300, 2408, 3008, 2300, 2300,
+ /* 320 */ 3032, 3027, 3032, 3027, 3046, 3042, 3032, 3051, 3048, 3010,
+ /* 330 */ 3008, 2991, 2987, 3081, 3068, 3064, 2300, 2300, 2996, 2994,
+ /* 340 */ 2300, 2408, 2408, 3027, 2300, 2300, 2300, 2300, 3027, 2300,
+ /* 350 */ 2300, 2408, 2300, 2300, 2408, 2300, 2300, 2300, 2300, 2408,
+ /* 360 */ 2300, 2408, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 370 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 380 */ 2300, 2300, 2300, 2300, 2300, 2515, 2300, 2300, 2408, 2300,
+ /* 390 */ 2332, 2334, 2344, 2300, 2698, 3084, 2724, 2729, 2679, 2679,
+ /* 400 */ 2556, 2556, 3084, 2556, 2411, 2305, 2300, 2300, 2300, 2300,
+ /* 410 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 420 */ 2300, 2300, 2857, 2300, 2300, 2300, 2300, 2300, 2300, 3045,
+ /* 430 */ 3044, 2858, 2300, 2932, 2931, 2930, 2921, 2857, 2509, 2300,
+ /* 440 */ 2300, 2300, 2856, 2855, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 450 */ 2300, 2300, 2300, 2300, 2670, 2669, 2849, 2300, 2300, 2850,
+ /* 460 */ 2848, 2847, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 470 */ 2300, 2300, 2300, 2500, 2300, 2300, 2497, 2300, 2300, 2300,
+ /* 480 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 490 */ 2300, 2300, 2300, 2300, 3065, 3069, 2300, 2300, 2300, 2300,
+ /* 500 */ 2957, 2300, 2300, 2300, 2300, 2300, 2828, 2300, 2300, 2300,
+ /* 510 */ 2300, 2300, 2796, 2791, 2782, 2773, 2788, 2779, 2767, 2785,
+ /* 520 */ 2776, 2764, 2761, 2300, 2524, 2300, 2300, 2300, 2300, 2300,
+ /* 530 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 540 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 550 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 560 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 570 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 580 */ 2640, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 590 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 600 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 610 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 620 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 630 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 640 */ 2300, 2300, 2300, 2300, 2300, 2300, 2655, 2300, 2300, 2300,
+ /* 650 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 660 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 670 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 680 */ 2300, 2300, 2300, 2300, 2349, 2835, 2300, 2300, 2300, 2300,
+ /* 690 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2838,
+ /* 700 */ 2300, 2300, 2839, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 710 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 720 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 730 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 740 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2455, 2454, 2300,
+ /* 750 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 760 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 770 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2840, 2300, 2300,
+ /* 780 */ 2300, 2300, 2723, 2300, 2300, 2830, 2300, 2300, 2300, 2300,
+ /* 790 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 800 */ 2300, 2300, 3061, 3011, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 810 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 820 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2828,
+ /* 830 */ 2300, 3043, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 3059,
+ /* 840 */ 2300, 3063, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2967,
+ /* 850 */ 2963, 2300, 2300, 2959, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 860 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 870 */ 2300, 2300, 2300, 2300, 2918, 2300, 2300, 2300, 2952, 2300,
+ /* 880 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2552, 2551,
+ /* 890 */ 2550, 2549, 2300, 2300, 2300, 2300, 2300, 2300, 2840, 2300,
+ /* 900 */ 2843, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 910 */ 2300, 2300, 2300, 2300, 2827, 2300, 2895, 2894, 2300, 2300,
+ /* 920 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2546, 2300, 2300,
+ /* 930 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 940 */ 2300, 2300, 2300, 2530, 2528, 2527, 2526, 2300, 2563, 2300,
+ /* 950 */ 2300, 2300, 2559, 2558, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 960 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 970 */ 2300, 2300, 2300, 2429, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 980 */ 2300, 2300, 2421, 2300, 2420, 2300, 2300, 2300, 2300, 2300,
+ /* 990 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 1000 */ 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300, 2300,
+ /* 1010 */ 2300, 2300, 2300, 2300, 2300, 2300, 2329, 2300, 2300, 2300,
+ /* 1020 */ 2300, 2300, 2300, 2300, 2300,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -1470,6 +1493,9 @@ static const YYCODETYPE yyFallback[] = {
0, /* NK_DOT => nothing */
0, /* WITH => nothing */
0, /* ENCRYPT_KEY => nothing */
+ 0, /* ANODE => nothing */
+ 0, /* UPDATE => nothing */
+ 0, /* ANODES => nothing */
0, /* DNODE => nothing */
0, /* PORT => nothing */
0, /* DNODES => nothing */
@@ -1529,12 +1555,12 @@ static const YYCODETYPE yyFallback[] = {
0, /* BWLIMIT => nothing */
0, /* START => nothing */
0, /* TIMESTAMP => nothing */
- 337, /* END => ABORT */
+ 343, /* END => ABORT */
0, /* TABLE => nothing */
0, /* NK_LP => nothing */
0, /* NK_RP => nothing */
0, /* USING => nothing */
- 337, /* FILE => ABORT */
+ 343, /* FILE => ABORT */
0, /* STABLE => nothing */
0, /* COLUMN => nothing */
0, /* MODIFY => nothing */
@@ -1602,7 +1628,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* VNODES => nothing */
0, /* ALIVE => nothing */
0, /* VIEWS => nothing */
- 337, /* VIEW => ABORT */
+ 343, /* VIEW => ABORT */
0, /* COMPACTS => nothing */
0, /* NORMAL => nothing */
0, /* CHILD => nothing */
@@ -1645,14 +1671,13 @@ static const YYCODETYPE yyFallback[] = {
0, /* PAUSE => nothing */
0, /* RESUME => nothing */
0, /* PRIMARY => nothing */
- 337, /* KEY => ABORT */
+ 343, /* KEY => ABORT */
0, /* TRIGGER => nothing */
0, /* AT_ONCE => nothing */
0, /* WINDOW_CLOSE => nothing */
0, /* IGNORE => nothing */
0, /* EXPIRED => nothing */
0, /* FILL_HISTORY => nothing */
- 0, /* UPDATE => nothing */
0, /* SUBTABLE => nothing */
0, /* UNTREATED => nothing */
0, /* KILL => nothing */
@@ -1681,10 +1706,13 @@ static const YYCODETYPE yyFallback[] = {
0, /* WDURATION => nothing */
0, /* IROWTS => nothing */
0, /* ISFILLED => nothing */
+ 0, /* FLOW => nothing */
+ 0, /* FHIGH => nothing */
+ 0, /* FROWTS => nothing */
0, /* CAST => nothing */
0, /* POSITION => nothing */
0, /* IN => nothing */
- 337, /* FOR => ABORT */
+ 343, /* FOR => ABORT */
0, /* NOW => nothing */
0, /* TODAY => nothing */
0, /* RAND => nothing */
@@ -1718,7 +1746,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* LEFT => nothing */
0, /* RIGHT => nothing */
0, /* OUTER => nothing */
- 337, /* SEMI => ABORT */
+ 343, /* SEMI => ABORT */
0, /* ANTI => nothing */
0, /* ASOF => nothing */
0, /* WINDOW => nothing */
@@ -1734,6 +1762,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* STATE_WINDOW => nothing */
0, /* EVENT_WINDOW => nothing */
0, /* COUNT_WINDOW => nothing */
+ 0, /* ANOMALY_WINDOW => nothing */
0, /* SLIDING => nothing */
0, /* FILL => nothing */
0, /* VALUE => nothing */
@@ -1754,51 +1783,51 @@ static const YYCODETYPE yyFallback[] = {
0, /* ASC => nothing */
0, /* NULLS => nothing */
0, /* ABORT => nothing */
- 337, /* AFTER => ABORT */
- 337, /* ATTACH => ABORT */
- 337, /* BEFORE => ABORT */
- 337, /* BEGIN => ABORT */
- 337, /* BITAND => ABORT */
- 337, /* BITNOT => ABORT */
- 337, /* BITOR => ABORT */
- 337, /* BLOCKS => ABORT */
- 337, /* CHANGE => ABORT */
- 337, /* COMMA => ABORT */
- 337, /* CONCAT => ABORT */
- 337, /* CONFLICT => ABORT */
- 337, /* COPY => ABORT */
- 337, /* DEFERRED => ABORT */
- 337, /* DELIMITERS => ABORT */
- 337, /* DETACH => ABORT */
- 337, /* DIVIDE => ABORT */
- 337, /* DOT => ABORT */
- 337, /* EACH => ABORT */
- 337, /* FAIL => ABORT */
- 337, /* GLOB => ABORT */
- 337, /* ID => ABORT */
- 337, /* IMMEDIATE => ABORT */
- 337, /* IMPORT => ABORT */
- 337, /* INITIALLY => ABORT */
- 337, /* INSTEAD => ABORT */
- 337, /* ISNULL => ABORT */
- 337, /* MODULES => ABORT */
- 337, /* NK_BITNOT => ABORT */
- 337, /* NK_SEMI => ABORT */
- 337, /* NOTNULL => ABORT */
- 337, /* OF => ABORT */
- 337, /* PLUS => ABORT */
- 337, /* PRIVILEGE => ABORT */
- 337, /* RAISE => ABORT */
- 337, /* RESTRICT => ABORT */
- 337, /* ROW => ABORT */
- 337, /* STAR => ABORT */
- 337, /* STATEMENT => ABORT */
- 337, /* STRICT => ABORT */
- 337, /* STRING => ABORT */
- 337, /* TIMES => ABORT */
- 337, /* VALUES => ABORT */
- 337, /* VARIABLE => ABORT */
- 337, /* WAL => ABORT */
+ 343, /* AFTER => ABORT */
+ 343, /* ATTACH => ABORT */
+ 343, /* BEFORE => ABORT */
+ 343, /* BEGIN => ABORT */
+ 343, /* BITAND => ABORT */
+ 343, /* BITNOT => ABORT */
+ 343, /* BITOR => ABORT */
+ 343, /* BLOCKS => ABORT */
+ 343, /* CHANGE => ABORT */
+ 343, /* COMMA => ABORT */
+ 343, /* CONCAT => ABORT */
+ 343, /* CONFLICT => ABORT */
+ 343, /* COPY => ABORT */
+ 343, /* DEFERRED => ABORT */
+ 343, /* DELIMITERS => ABORT */
+ 343, /* DETACH => ABORT */
+ 343, /* DIVIDE => ABORT */
+ 343, /* DOT => ABORT */
+ 343, /* EACH => ABORT */
+ 343, /* FAIL => ABORT */
+ 343, /* GLOB => ABORT */
+ 343, /* ID => ABORT */
+ 343, /* IMMEDIATE => ABORT */
+ 343, /* IMPORT => ABORT */
+ 343, /* INITIALLY => ABORT */
+ 343, /* INSTEAD => ABORT */
+ 343, /* ISNULL => ABORT */
+ 343, /* MODULES => ABORT */
+ 343, /* NK_BITNOT => ABORT */
+ 343, /* NK_SEMI => ABORT */
+ 343, /* NOTNULL => ABORT */
+ 343, /* OF => ABORT */
+ 343, /* PLUS => ABORT */
+ 343, /* PRIVILEGE => ABORT */
+ 343, /* RAISE => ABORT */
+ 343, /* RESTRICT => ABORT */
+ 343, /* ROW => ABORT */
+ 343, /* STAR => ABORT */
+ 343, /* STATEMENT => ABORT */
+ 343, /* STRICT => ABORT */
+ 343, /* STRING => ABORT */
+ 343, /* TIMES => ABORT */
+ 343, /* VALUES => ABORT */
+ 343, /* VARIABLE => ABORT */
+ 343, /* WAL => ABORT */
};
#endif /* YYFALLBACK */
@@ -1940,519 +1969,525 @@ static const char *const yyTokenName[] = {
/* 51 */ "NK_DOT",
/* 52 */ "WITH",
/* 53 */ "ENCRYPT_KEY",
- /* 54 */ "DNODE",
- /* 55 */ "PORT",
- /* 56 */ "DNODES",
- /* 57 */ "RESTORE",
- /* 58 */ "NK_IPTOKEN",
- /* 59 */ "FORCE",
- /* 60 */ "UNSAFE",
- /* 61 */ "CLUSTER",
- /* 62 */ "LOCAL",
- /* 63 */ "QNODE",
- /* 64 */ "BNODE",
- /* 65 */ "SNODE",
- /* 66 */ "MNODE",
- /* 67 */ "VNODE",
- /* 68 */ "DATABASE",
- /* 69 */ "USE",
- /* 70 */ "FLUSH",
- /* 71 */ "TRIM",
- /* 72 */ "S3MIGRATE",
- /* 73 */ "COMPACT",
- /* 74 */ "IF",
- /* 75 */ "NOT",
- /* 76 */ "EXISTS",
- /* 77 */ "BUFFER",
- /* 78 */ "CACHEMODEL",
- /* 79 */ "CACHESIZE",
- /* 80 */ "COMP",
- /* 81 */ "DURATION",
- /* 82 */ "NK_VARIABLE",
- /* 83 */ "MAXROWS",
- /* 84 */ "MINROWS",
- /* 85 */ "KEEP",
- /* 86 */ "PAGES",
- /* 87 */ "PAGESIZE",
- /* 88 */ "TSDB_PAGESIZE",
- /* 89 */ "PRECISION",
- /* 90 */ "REPLICA",
- /* 91 */ "VGROUPS",
- /* 92 */ "SINGLE_STABLE",
- /* 93 */ "RETENTIONS",
- /* 94 */ "SCHEMALESS",
- /* 95 */ "WAL_LEVEL",
- /* 96 */ "WAL_FSYNC_PERIOD",
- /* 97 */ "WAL_RETENTION_PERIOD",
- /* 98 */ "WAL_RETENTION_SIZE",
- /* 99 */ "WAL_ROLL_PERIOD",
- /* 100 */ "WAL_SEGMENT_SIZE",
- /* 101 */ "STT_TRIGGER",
- /* 102 */ "TABLE_PREFIX",
- /* 103 */ "TABLE_SUFFIX",
- /* 104 */ "S3_CHUNKSIZE",
- /* 105 */ "S3_KEEPLOCAL",
- /* 106 */ "S3_COMPACT",
- /* 107 */ "KEEP_TIME_OFFSET",
- /* 108 */ "ENCRYPT_ALGORITHM",
- /* 109 */ "NK_COLON",
- /* 110 */ "BWLIMIT",
- /* 111 */ "START",
- /* 112 */ "TIMESTAMP",
- /* 113 */ "END",
- /* 114 */ "TABLE",
- /* 115 */ "NK_LP",
- /* 116 */ "NK_RP",
- /* 117 */ "USING",
- /* 118 */ "FILE",
- /* 119 */ "STABLE",
- /* 120 */ "COLUMN",
- /* 121 */ "MODIFY",
- /* 122 */ "RENAME",
- /* 123 */ "TAG",
- /* 124 */ "SET",
- /* 125 */ "NK_EQ",
- /* 126 */ "TAGS",
- /* 127 */ "BOOL",
- /* 128 */ "TINYINT",
- /* 129 */ "SMALLINT",
- /* 130 */ "INT",
- /* 131 */ "INTEGER",
- /* 132 */ "BIGINT",
- /* 133 */ "FLOAT",
- /* 134 */ "DOUBLE",
- /* 135 */ "BINARY",
- /* 136 */ "NCHAR",
- /* 137 */ "UNSIGNED",
- /* 138 */ "JSON",
- /* 139 */ "VARCHAR",
- /* 140 */ "MEDIUMBLOB",
- /* 141 */ "BLOB",
- /* 142 */ "VARBINARY",
- /* 143 */ "GEOMETRY",
- /* 144 */ "DECIMAL",
- /* 145 */ "COMMENT",
- /* 146 */ "MAX_DELAY",
- /* 147 */ "WATERMARK",
- /* 148 */ "ROLLUP",
- /* 149 */ "TTL",
- /* 150 */ "SMA",
- /* 151 */ "DELETE_MARK",
- /* 152 */ "FIRST",
- /* 153 */ "LAST",
- /* 154 */ "SHOW",
- /* 155 */ "FULL",
- /* 156 */ "PRIVILEGES",
- /* 157 */ "DATABASES",
- /* 158 */ "TABLES",
- /* 159 */ "STABLES",
- /* 160 */ "MNODES",
- /* 161 */ "QNODES",
- /* 162 */ "ARBGROUPS",
- /* 163 */ "FUNCTIONS",
- /* 164 */ "INDEXES",
- /* 165 */ "ACCOUNTS",
- /* 166 */ "APPS",
- /* 167 */ "CONNECTIONS",
- /* 168 */ "LICENCES",
- /* 169 */ "GRANTS",
- /* 170 */ "LOGS",
- /* 171 */ "MACHINES",
- /* 172 */ "ENCRYPTIONS",
- /* 173 */ "QUERIES",
- /* 174 */ "SCORES",
- /* 175 */ "TOPICS",
- /* 176 */ "VARIABLES",
- /* 177 */ "BNODES",
- /* 178 */ "SNODES",
- /* 179 */ "TRANSACTIONS",
- /* 180 */ "DISTRIBUTED",
- /* 181 */ "CONSUMERS",
- /* 182 */ "SUBSCRIPTIONS",
- /* 183 */ "VNODES",
- /* 184 */ "ALIVE",
- /* 185 */ "VIEWS",
- /* 186 */ "VIEW",
- /* 187 */ "COMPACTS",
- /* 188 */ "NORMAL",
- /* 189 */ "CHILD",
- /* 190 */ "LIKE",
- /* 191 */ "TBNAME",
- /* 192 */ "QTAGS",
- /* 193 */ "AS",
- /* 194 */ "SYSTEM",
- /* 195 */ "TSMA",
- /* 196 */ "INTERVAL",
- /* 197 */ "RECURSIVE",
- /* 198 */ "TSMAS",
- /* 199 */ "FUNCTION",
- /* 200 */ "INDEX",
- /* 201 */ "COUNT",
- /* 202 */ "LAST_ROW",
- /* 203 */ "META",
- /* 204 */ "ONLY",
- /* 205 */ "TOPIC",
- /* 206 */ "CONSUMER",
- /* 207 */ "GROUP",
- /* 208 */ "DESC",
- /* 209 */ "DESCRIBE",
- /* 210 */ "RESET",
- /* 211 */ "QUERY",
- /* 212 */ "CACHE",
- /* 213 */ "EXPLAIN",
- /* 214 */ "ANALYZE",
- /* 215 */ "VERBOSE",
- /* 216 */ "NK_BOOL",
- /* 217 */ "RATIO",
- /* 218 */ "NK_FLOAT",
- /* 219 */ "OUTPUTTYPE",
- /* 220 */ "AGGREGATE",
- /* 221 */ "BUFSIZE",
- /* 222 */ "LANGUAGE",
- /* 223 */ "REPLACE",
- /* 224 */ "STREAM",
- /* 225 */ "INTO",
- /* 226 */ "PAUSE",
- /* 227 */ "RESUME",
- /* 228 */ "PRIMARY",
- /* 229 */ "KEY",
- /* 230 */ "TRIGGER",
- /* 231 */ "AT_ONCE",
- /* 232 */ "WINDOW_CLOSE",
- /* 233 */ "IGNORE",
- /* 234 */ "EXPIRED",
- /* 235 */ "FILL_HISTORY",
- /* 236 */ "UPDATE",
- /* 237 */ "SUBTABLE",
- /* 238 */ "UNTREATED",
- /* 239 */ "KILL",
- /* 240 */ "CONNECTION",
- /* 241 */ "TRANSACTION",
- /* 242 */ "BALANCE",
- /* 243 */ "VGROUP",
- /* 244 */ "LEADER",
- /* 245 */ "MERGE",
- /* 246 */ "REDISTRIBUTE",
- /* 247 */ "SPLIT",
- /* 248 */ "DELETE",
- /* 249 */ "INSERT",
- /* 250 */ "NK_BIN",
- /* 251 */ "NK_HEX",
- /* 252 */ "NULL",
- /* 253 */ "NK_QUESTION",
- /* 254 */ "NK_ALIAS",
- /* 255 */ "NK_ARROW",
- /* 256 */ "ROWTS",
- /* 257 */ "QSTART",
- /* 258 */ "QEND",
- /* 259 */ "QDURATION",
- /* 260 */ "WSTART",
- /* 261 */ "WEND",
- /* 262 */ "WDURATION",
- /* 263 */ "IROWTS",
- /* 264 */ "ISFILLED",
- /* 265 */ "CAST",
- /* 266 */ "POSITION",
- /* 267 */ "IN",
- /* 268 */ "FOR",
- /* 269 */ "NOW",
- /* 270 */ "TODAY",
- /* 271 */ "RAND",
- /* 272 */ "SUBSTR",
- /* 273 */ "SUBSTRING",
- /* 274 */ "BOTH",
- /* 275 */ "TRAILING",
- /* 276 */ "LEADING",
- /* 277 */ "TIMEZONE",
- /* 278 */ "CLIENT_VERSION",
- /* 279 */ "SERVER_VERSION",
- /* 280 */ "SERVER_STATUS",
- /* 281 */ "CURRENT_USER",
- /* 282 */ "PI",
- /* 283 */ "CASE",
- /* 284 */ "WHEN",
- /* 285 */ "THEN",
- /* 286 */ "ELSE",
- /* 287 */ "BETWEEN",
- /* 288 */ "IS",
- /* 289 */ "NK_LT",
- /* 290 */ "NK_GT",
- /* 291 */ "NK_LE",
- /* 292 */ "NK_GE",
- /* 293 */ "NK_NE",
- /* 294 */ "MATCH",
- /* 295 */ "NMATCH",
- /* 296 */ "CONTAINS",
- /* 297 */ "JOIN",
- /* 298 */ "INNER",
- /* 299 */ "LEFT",
- /* 300 */ "RIGHT",
- /* 301 */ "OUTER",
- /* 302 */ "SEMI",
- /* 303 */ "ANTI",
- /* 304 */ "ASOF",
- /* 305 */ "WINDOW",
- /* 306 */ "WINDOW_OFFSET",
- /* 307 */ "JLIMIT",
- /* 308 */ "SELECT",
- /* 309 */ "NK_HINT",
- /* 310 */ "DISTINCT",
- /* 311 */ "WHERE",
- /* 312 */ "PARTITION",
- /* 313 */ "BY",
- /* 314 */ "SESSION",
- /* 315 */ "STATE_WINDOW",
- /* 316 */ "EVENT_WINDOW",
- /* 317 */ "COUNT_WINDOW",
- /* 318 */ "SLIDING",
- /* 319 */ "FILL",
- /* 320 */ "VALUE",
- /* 321 */ "VALUE_F",
- /* 322 */ "NONE",
- /* 323 */ "PREV",
- /* 324 */ "NULL_F",
- /* 325 */ "LINEAR",
- /* 326 */ "NEXT",
- /* 327 */ "HAVING",
- /* 328 */ "RANGE",
- /* 329 */ "EVERY",
- /* 330 */ "ORDER",
- /* 331 */ "SLIMIT",
- /* 332 */ "SOFFSET",
- /* 333 */ "LIMIT",
- /* 334 */ "OFFSET",
- /* 335 */ "ASC",
- /* 336 */ "NULLS",
- /* 337 */ "ABORT",
- /* 338 */ "AFTER",
- /* 339 */ "ATTACH",
- /* 340 */ "BEFORE",
- /* 341 */ "BEGIN",
- /* 342 */ "BITAND",
- /* 343 */ "BITNOT",
- /* 344 */ "BITOR",
- /* 345 */ "BLOCKS",
- /* 346 */ "CHANGE",
- /* 347 */ "COMMA",
- /* 348 */ "CONCAT",
- /* 349 */ "CONFLICT",
- /* 350 */ "COPY",
- /* 351 */ "DEFERRED",
- /* 352 */ "DELIMITERS",
- /* 353 */ "DETACH",
- /* 354 */ "DIVIDE",
- /* 355 */ "DOT",
- /* 356 */ "EACH",
- /* 357 */ "FAIL",
- /* 358 */ "GLOB",
- /* 359 */ "ID",
- /* 360 */ "IMMEDIATE",
- /* 361 */ "IMPORT",
- /* 362 */ "INITIALLY",
- /* 363 */ "INSTEAD",
- /* 364 */ "ISNULL",
- /* 365 */ "MODULES",
- /* 366 */ "NK_BITNOT",
- /* 367 */ "NK_SEMI",
- /* 368 */ "NOTNULL",
- /* 369 */ "OF",
- /* 370 */ "PLUS",
- /* 371 */ "PRIVILEGE",
- /* 372 */ "RAISE",
- /* 373 */ "RESTRICT",
- /* 374 */ "ROW",
- /* 375 */ "STAR",
- /* 376 */ "STATEMENT",
- /* 377 */ "STRICT",
- /* 378 */ "STRING",
- /* 379 */ "TIMES",
- /* 380 */ "VALUES",
- /* 381 */ "VARIABLE",
- /* 382 */ "WAL",
- /* 383 */ "cmd",
- /* 384 */ "account_options",
- /* 385 */ "alter_account_options",
- /* 386 */ "literal",
- /* 387 */ "alter_account_option",
- /* 388 */ "ip_range_list",
- /* 389 */ "white_list",
- /* 390 */ "white_list_opt",
- /* 391 */ "is_import_opt",
- /* 392 */ "is_createdb_opt",
- /* 393 */ "user_name",
- /* 394 */ "sysinfo_opt",
- /* 395 */ "privileges",
- /* 396 */ "priv_level",
- /* 397 */ "with_clause_opt",
- /* 398 */ "priv_type_list",
- /* 399 */ "priv_type",
- /* 400 */ "db_name",
- /* 401 */ "table_name",
- /* 402 */ "topic_name",
- /* 403 */ "search_condition",
- /* 404 */ "dnode_endpoint",
- /* 405 */ "force_opt",
- /* 406 */ "unsafe_opt",
- /* 407 */ "not_exists_opt",
- /* 408 */ "db_options",
- /* 409 */ "exists_opt",
- /* 410 */ "alter_db_options",
- /* 411 */ "speed_opt",
- /* 412 */ "start_opt",
- /* 413 */ "end_opt",
- /* 414 */ "integer_list",
- /* 415 */ "variable_list",
- /* 416 */ "retention_list",
- /* 417 */ "signed",
- /* 418 */ "alter_db_option",
- /* 419 */ "retention",
- /* 420 */ "full_table_name",
- /* 421 */ "column_def_list",
- /* 422 */ "tags_def_opt",
- /* 423 */ "table_options",
- /* 424 */ "multi_create_clause",
- /* 425 */ "tag_list_opt",
- /* 426 */ "tags_def",
- /* 427 */ "with_opt",
- /* 428 */ "multi_drop_clause",
- /* 429 */ "alter_table_clause",
- /* 430 */ "alter_table_options",
- /* 431 */ "column_name",
- /* 432 */ "type_name",
- /* 433 */ "column_options",
- /* 434 */ "tags_literal",
- /* 435 */ "create_subtable_clause",
- /* 436 */ "specific_cols_opt",
- /* 437 */ "tags_literal_list",
- /* 438 */ "drop_table_clause",
- /* 439 */ "col_name_list",
- /* 440 */ "tag_def_list",
- /* 441 */ "tag_def",
- /* 442 */ "column_def",
- /* 443 */ "type_name_default_len",
- /* 444 */ "duration_list",
- /* 445 */ "rollup_func_list",
- /* 446 */ "alter_table_option",
- /* 447 */ "duration_literal",
- /* 448 */ "rollup_func_name",
- /* 449 */ "function_name",
- /* 450 */ "col_name",
- /* 451 */ "db_kind_opt",
- /* 452 */ "table_kind_db_name_cond_opt",
- /* 453 */ "like_pattern_opt",
- /* 454 */ "db_name_cond_opt",
- /* 455 */ "table_name_cond",
- /* 456 */ "from_db_opt",
- /* 457 */ "table_kind",
- /* 458 */ "tag_item",
- /* 459 */ "column_alias",
- /* 460 */ "tsma_name",
- /* 461 */ "tsma_func_list",
- /* 462 */ "full_tsma_name",
- /* 463 */ "func_list",
- /* 464 */ "index_options",
- /* 465 */ "full_index_name",
- /* 466 */ "index_name",
- /* 467 */ "sliding_opt",
- /* 468 */ "sma_stream_opt",
- /* 469 */ "func",
- /* 470 */ "sma_func_name",
- /* 471 */ "expression_list",
- /* 472 */ "with_meta",
- /* 473 */ "query_or_subquery",
- /* 474 */ "where_clause_opt",
- /* 475 */ "cgroup_name",
- /* 476 */ "analyze_opt",
- /* 477 */ "explain_options",
- /* 478 */ "insert_query",
- /* 479 */ "or_replace_opt",
- /* 480 */ "agg_func_opt",
- /* 481 */ "bufsize_opt",
- /* 482 */ "language_opt",
- /* 483 */ "full_view_name",
- /* 484 */ "view_name",
- /* 485 */ "stream_name",
- /* 486 */ "stream_options",
- /* 487 */ "col_list_opt",
- /* 488 */ "tag_def_or_ref_opt",
- /* 489 */ "subtable_opt",
- /* 490 */ "ignore_opt",
- /* 491 */ "column_stream_def_list",
- /* 492 */ "column_stream_def",
- /* 493 */ "stream_col_options",
- /* 494 */ "expression",
- /* 495 */ "on_vgroup_id",
- /* 496 */ "dnode_list",
- /* 497 */ "literal_func",
- /* 498 */ "signed_literal",
- /* 499 */ "literal_list",
- /* 500 */ "table_alias",
- /* 501 */ "expr_or_subquery",
- /* 502 */ "pseudo_column",
- /* 503 */ "column_reference",
- /* 504 */ "function_expression",
- /* 505 */ "case_when_expression",
- /* 506 */ "star_func",
- /* 507 */ "star_func_para_list",
- /* 508 */ "trim_specification_type",
- /* 509 */ "substr_func",
- /* 510 */ "rand_func",
- /* 511 */ "noarg_func",
- /* 512 */ "other_para_list",
- /* 513 */ "star_func_para",
- /* 514 */ "when_then_list",
- /* 515 */ "case_when_else_opt",
- /* 516 */ "common_expression",
- /* 517 */ "when_then_expr",
- /* 518 */ "predicate",
- /* 519 */ "compare_op",
- /* 520 */ "in_op",
- /* 521 */ "in_predicate_value",
- /* 522 */ "boolean_value_expression",
- /* 523 */ "boolean_primary",
- /* 524 */ "from_clause_opt",
- /* 525 */ "table_reference_list",
- /* 526 */ "table_reference",
- /* 527 */ "table_primary",
- /* 528 */ "joined_table",
- /* 529 */ "alias_opt",
- /* 530 */ "subquery",
- /* 531 */ "parenthesized_joined_table",
- /* 532 */ "join_type",
- /* 533 */ "join_subtype",
- /* 534 */ "join_on_clause_opt",
- /* 535 */ "window_offset_clause_opt",
- /* 536 */ "jlimit_clause_opt",
- /* 537 */ "window_offset_literal",
- /* 538 */ "query_specification",
- /* 539 */ "hint_list",
- /* 540 */ "set_quantifier_opt",
- /* 541 */ "tag_mode_opt",
- /* 542 */ "select_list",
- /* 543 */ "partition_by_clause_opt",
- /* 544 */ "range_opt",
- /* 545 */ "every_opt",
- /* 546 */ "fill_opt",
- /* 547 */ "twindow_clause_opt",
- /* 548 */ "group_by_clause_opt",
- /* 549 */ "having_clause_opt",
- /* 550 */ "select_item",
- /* 551 */ "partition_list",
- /* 552 */ "partition_item",
- /* 553 */ "interval_sliding_duration_literal",
- /* 554 */ "fill_mode",
- /* 555 */ "group_by_list",
- /* 556 */ "query_expression",
- /* 557 */ "query_simple",
- /* 558 */ "order_by_clause_opt",
- /* 559 */ "slimit_clause_opt",
- /* 560 */ "limit_clause_opt",
- /* 561 */ "union_query_expression",
- /* 562 */ "query_simple_or_subquery",
- /* 563 */ "sort_specification_list",
- /* 564 */ "sort_specification",
- /* 565 */ "ordering_specification_opt",
- /* 566 */ "null_ordering_opt",
+ /* 54 */ "ANODE",
+ /* 55 */ "UPDATE",
+ /* 56 */ "ANODES",
+ /* 57 */ "DNODE",
+ /* 58 */ "PORT",
+ /* 59 */ "DNODES",
+ /* 60 */ "RESTORE",
+ /* 61 */ "NK_IPTOKEN",
+ /* 62 */ "FORCE",
+ /* 63 */ "UNSAFE",
+ /* 64 */ "CLUSTER",
+ /* 65 */ "LOCAL",
+ /* 66 */ "QNODE",
+ /* 67 */ "BNODE",
+ /* 68 */ "SNODE",
+ /* 69 */ "MNODE",
+ /* 70 */ "VNODE",
+ /* 71 */ "DATABASE",
+ /* 72 */ "USE",
+ /* 73 */ "FLUSH",
+ /* 74 */ "TRIM",
+ /* 75 */ "S3MIGRATE",
+ /* 76 */ "COMPACT",
+ /* 77 */ "IF",
+ /* 78 */ "NOT",
+ /* 79 */ "EXISTS",
+ /* 80 */ "BUFFER",
+ /* 81 */ "CACHEMODEL",
+ /* 82 */ "CACHESIZE",
+ /* 83 */ "COMP",
+ /* 84 */ "DURATION",
+ /* 85 */ "NK_VARIABLE",
+ /* 86 */ "MAXROWS",
+ /* 87 */ "MINROWS",
+ /* 88 */ "KEEP",
+ /* 89 */ "PAGES",
+ /* 90 */ "PAGESIZE",
+ /* 91 */ "TSDB_PAGESIZE",
+ /* 92 */ "PRECISION",
+ /* 93 */ "REPLICA",
+ /* 94 */ "VGROUPS",
+ /* 95 */ "SINGLE_STABLE",
+ /* 96 */ "RETENTIONS",
+ /* 97 */ "SCHEMALESS",
+ /* 98 */ "WAL_LEVEL",
+ /* 99 */ "WAL_FSYNC_PERIOD",
+ /* 100 */ "WAL_RETENTION_PERIOD",
+ /* 101 */ "WAL_RETENTION_SIZE",
+ /* 102 */ "WAL_ROLL_PERIOD",
+ /* 103 */ "WAL_SEGMENT_SIZE",
+ /* 104 */ "STT_TRIGGER",
+ /* 105 */ "TABLE_PREFIX",
+ /* 106 */ "TABLE_SUFFIX",
+ /* 107 */ "S3_CHUNKSIZE",
+ /* 108 */ "S3_KEEPLOCAL",
+ /* 109 */ "S3_COMPACT",
+ /* 110 */ "KEEP_TIME_OFFSET",
+ /* 111 */ "ENCRYPT_ALGORITHM",
+ /* 112 */ "NK_COLON",
+ /* 113 */ "BWLIMIT",
+ /* 114 */ "START",
+ /* 115 */ "TIMESTAMP",
+ /* 116 */ "END",
+ /* 117 */ "TABLE",
+ /* 118 */ "NK_LP",
+ /* 119 */ "NK_RP",
+ /* 120 */ "USING",
+ /* 121 */ "FILE",
+ /* 122 */ "STABLE",
+ /* 123 */ "COLUMN",
+ /* 124 */ "MODIFY",
+ /* 125 */ "RENAME",
+ /* 126 */ "TAG",
+ /* 127 */ "SET",
+ /* 128 */ "NK_EQ",
+ /* 129 */ "TAGS",
+ /* 130 */ "BOOL",
+ /* 131 */ "TINYINT",
+ /* 132 */ "SMALLINT",
+ /* 133 */ "INT",
+ /* 134 */ "INTEGER",
+ /* 135 */ "BIGINT",
+ /* 136 */ "FLOAT",
+ /* 137 */ "DOUBLE",
+ /* 138 */ "BINARY",
+ /* 139 */ "NCHAR",
+ /* 140 */ "UNSIGNED",
+ /* 141 */ "JSON",
+ /* 142 */ "VARCHAR",
+ /* 143 */ "MEDIUMBLOB",
+ /* 144 */ "BLOB",
+ /* 145 */ "VARBINARY",
+ /* 146 */ "GEOMETRY",
+ /* 147 */ "DECIMAL",
+ /* 148 */ "COMMENT",
+ /* 149 */ "MAX_DELAY",
+ /* 150 */ "WATERMARK",
+ /* 151 */ "ROLLUP",
+ /* 152 */ "TTL",
+ /* 153 */ "SMA",
+ /* 154 */ "DELETE_MARK",
+ /* 155 */ "FIRST",
+ /* 156 */ "LAST",
+ /* 157 */ "SHOW",
+ /* 158 */ "FULL",
+ /* 159 */ "PRIVILEGES",
+ /* 160 */ "DATABASES",
+ /* 161 */ "TABLES",
+ /* 162 */ "STABLES",
+ /* 163 */ "MNODES",
+ /* 164 */ "QNODES",
+ /* 165 */ "ARBGROUPS",
+ /* 166 */ "FUNCTIONS",
+ /* 167 */ "INDEXES",
+ /* 168 */ "ACCOUNTS",
+ /* 169 */ "APPS",
+ /* 170 */ "CONNECTIONS",
+ /* 171 */ "LICENCES",
+ /* 172 */ "GRANTS",
+ /* 173 */ "LOGS",
+ /* 174 */ "MACHINES",
+ /* 175 */ "ENCRYPTIONS",
+ /* 176 */ "QUERIES",
+ /* 177 */ "SCORES",
+ /* 178 */ "TOPICS",
+ /* 179 */ "VARIABLES",
+ /* 180 */ "BNODES",
+ /* 181 */ "SNODES",
+ /* 182 */ "TRANSACTIONS",
+ /* 183 */ "DISTRIBUTED",
+ /* 184 */ "CONSUMERS",
+ /* 185 */ "SUBSCRIPTIONS",
+ /* 186 */ "VNODES",
+ /* 187 */ "ALIVE",
+ /* 188 */ "VIEWS",
+ /* 189 */ "VIEW",
+ /* 190 */ "COMPACTS",
+ /* 191 */ "NORMAL",
+ /* 192 */ "CHILD",
+ /* 193 */ "LIKE",
+ /* 194 */ "TBNAME",
+ /* 195 */ "QTAGS",
+ /* 196 */ "AS",
+ /* 197 */ "SYSTEM",
+ /* 198 */ "TSMA",
+ /* 199 */ "INTERVAL",
+ /* 200 */ "RECURSIVE",
+ /* 201 */ "TSMAS",
+ /* 202 */ "FUNCTION",
+ /* 203 */ "INDEX",
+ /* 204 */ "COUNT",
+ /* 205 */ "LAST_ROW",
+ /* 206 */ "META",
+ /* 207 */ "ONLY",
+ /* 208 */ "TOPIC",
+ /* 209 */ "CONSUMER",
+ /* 210 */ "GROUP",
+ /* 211 */ "DESC",
+ /* 212 */ "DESCRIBE",
+ /* 213 */ "RESET",
+ /* 214 */ "QUERY",
+ /* 215 */ "CACHE",
+ /* 216 */ "EXPLAIN",
+ /* 217 */ "ANALYZE",
+ /* 218 */ "VERBOSE",
+ /* 219 */ "NK_BOOL",
+ /* 220 */ "RATIO",
+ /* 221 */ "NK_FLOAT",
+ /* 222 */ "OUTPUTTYPE",
+ /* 223 */ "AGGREGATE",
+ /* 224 */ "BUFSIZE",
+ /* 225 */ "LANGUAGE",
+ /* 226 */ "REPLACE",
+ /* 227 */ "STREAM",
+ /* 228 */ "INTO",
+ /* 229 */ "PAUSE",
+ /* 230 */ "RESUME",
+ /* 231 */ "PRIMARY",
+ /* 232 */ "KEY",
+ /* 233 */ "TRIGGER",
+ /* 234 */ "AT_ONCE",
+ /* 235 */ "WINDOW_CLOSE",
+ /* 236 */ "IGNORE",
+ /* 237 */ "EXPIRED",
+ /* 238 */ "FILL_HISTORY",
+ /* 239 */ "SUBTABLE",
+ /* 240 */ "UNTREATED",
+ /* 241 */ "KILL",
+ /* 242 */ "CONNECTION",
+ /* 243 */ "TRANSACTION",
+ /* 244 */ "BALANCE",
+ /* 245 */ "VGROUP",
+ /* 246 */ "LEADER",
+ /* 247 */ "MERGE",
+ /* 248 */ "REDISTRIBUTE",
+ /* 249 */ "SPLIT",
+ /* 250 */ "DELETE",
+ /* 251 */ "INSERT",
+ /* 252 */ "NK_BIN",
+ /* 253 */ "NK_HEX",
+ /* 254 */ "NULL",
+ /* 255 */ "NK_QUESTION",
+ /* 256 */ "NK_ALIAS",
+ /* 257 */ "NK_ARROW",
+ /* 258 */ "ROWTS",
+ /* 259 */ "QSTART",
+ /* 260 */ "QEND",
+ /* 261 */ "QDURATION",
+ /* 262 */ "WSTART",
+ /* 263 */ "WEND",
+ /* 264 */ "WDURATION",
+ /* 265 */ "IROWTS",
+ /* 266 */ "ISFILLED",
+ /* 267 */ "FLOW",
+ /* 268 */ "FHIGH",
+ /* 269 */ "FROWTS",
+ /* 270 */ "CAST",
+ /* 271 */ "POSITION",
+ /* 272 */ "IN",
+ /* 273 */ "FOR",
+ /* 274 */ "NOW",
+ /* 275 */ "TODAY",
+ /* 276 */ "RAND",
+ /* 277 */ "SUBSTR",
+ /* 278 */ "SUBSTRING",
+ /* 279 */ "BOTH",
+ /* 280 */ "TRAILING",
+ /* 281 */ "LEADING",
+ /* 282 */ "TIMEZONE",
+ /* 283 */ "CLIENT_VERSION",
+ /* 284 */ "SERVER_VERSION",
+ /* 285 */ "SERVER_STATUS",
+ /* 286 */ "CURRENT_USER",
+ /* 287 */ "PI",
+ /* 288 */ "CASE",
+ /* 289 */ "WHEN",
+ /* 290 */ "THEN",
+ /* 291 */ "ELSE",
+ /* 292 */ "BETWEEN",
+ /* 293 */ "IS",
+ /* 294 */ "NK_LT",
+ /* 295 */ "NK_GT",
+ /* 296 */ "NK_LE",
+ /* 297 */ "NK_GE",
+ /* 298 */ "NK_NE",
+ /* 299 */ "MATCH",
+ /* 300 */ "NMATCH",
+ /* 301 */ "CONTAINS",
+ /* 302 */ "JOIN",
+ /* 303 */ "INNER",
+ /* 304 */ "LEFT",
+ /* 305 */ "RIGHT",
+ /* 306 */ "OUTER",
+ /* 307 */ "SEMI",
+ /* 308 */ "ANTI",
+ /* 309 */ "ASOF",
+ /* 310 */ "WINDOW",
+ /* 311 */ "WINDOW_OFFSET",
+ /* 312 */ "JLIMIT",
+ /* 313 */ "SELECT",
+ /* 314 */ "NK_HINT",
+ /* 315 */ "DISTINCT",
+ /* 316 */ "WHERE",
+ /* 317 */ "PARTITION",
+ /* 318 */ "BY",
+ /* 319 */ "SESSION",
+ /* 320 */ "STATE_WINDOW",
+ /* 321 */ "EVENT_WINDOW",
+ /* 322 */ "COUNT_WINDOW",
+ /* 323 */ "ANOMALY_WINDOW",
+ /* 324 */ "SLIDING",
+ /* 325 */ "FILL",
+ /* 326 */ "VALUE",
+ /* 327 */ "VALUE_F",
+ /* 328 */ "NONE",
+ /* 329 */ "PREV",
+ /* 330 */ "NULL_F",
+ /* 331 */ "LINEAR",
+ /* 332 */ "NEXT",
+ /* 333 */ "HAVING",
+ /* 334 */ "RANGE",
+ /* 335 */ "EVERY",
+ /* 336 */ "ORDER",
+ /* 337 */ "SLIMIT",
+ /* 338 */ "SOFFSET",
+ /* 339 */ "LIMIT",
+ /* 340 */ "OFFSET",
+ /* 341 */ "ASC",
+ /* 342 */ "NULLS",
+ /* 343 */ "ABORT",
+ /* 344 */ "AFTER",
+ /* 345 */ "ATTACH",
+ /* 346 */ "BEFORE",
+ /* 347 */ "BEGIN",
+ /* 348 */ "BITAND",
+ /* 349 */ "BITNOT",
+ /* 350 */ "BITOR",
+ /* 351 */ "BLOCKS",
+ /* 352 */ "CHANGE",
+ /* 353 */ "COMMA",
+ /* 354 */ "CONCAT",
+ /* 355 */ "CONFLICT",
+ /* 356 */ "COPY",
+ /* 357 */ "DEFERRED",
+ /* 358 */ "DELIMITERS",
+ /* 359 */ "DETACH",
+ /* 360 */ "DIVIDE",
+ /* 361 */ "DOT",
+ /* 362 */ "EACH",
+ /* 363 */ "FAIL",
+ /* 364 */ "GLOB",
+ /* 365 */ "ID",
+ /* 366 */ "IMMEDIATE",
+ /* 367 */ "IMPORT",
+ /* 368 */ "INITIALLY",
+ /* 369 */ "INSTEAD",
+ /* 370 */ "ISNULL",
+ /* 371 */ "MODULES",
+ /* 372 */ "NK_BITNOT",
+ /* 373 */ "NK_SEMI",
+ /* 374 */ "NOTNULL",
+ /* 375 */ "OF",
+ /* 376 */ "PLUS",
+ /* 377 */ "PRIVILEGE",
+ /* 378 */ "RAISE",
+ /* 379 */ "RESTRICT",
+ /* 380 */ "ROW",
+ /* 381 */ "STAR",
+ /* 382 */ "STATEMENT",
+ /* 383 */ "STRICT",
+ /* 384 */ "STRING",
+ /* 385 */ "TIMES",
+ /* 386 */ "VALUES",
+ /* 387 */ "VARIABLE",
+ /* 388 */ "WAL",
+ /* 389 */ "cmd",
+ /* 390 */ "account_options",
+ /* 391 */ "alter_account_options",
+ /* 392 */ "literal",
+ /* 393 */ "alter_account_option",
+ /* 394 */ "ip_range_list",
+ /* 395 */ "white_list",
+ /* 396 */ "white_list_opt",
+ /* 397 */ "is_import_opt",
+ /* 398 */ "is_createdb_opt",
+ /* 399 */ "user_name",
+ /* 400 */ "sysinfo_opt",
+ /* 401 */ "privileges",
+ /* 402 */ "priv_level",
+ /* 403 */ "with_clause_opt",
+ /* 404 */ "priv_type_list",
+ /* 405 */ "priv_type",
+ /* 406 */ "db_name",
+ /* 407 */ "table_name",
+ /* 408 */ "topic_name",
+ /* 409 */ "search_condition",
+ /* 410 */ "dnode_endpoint",
+ /* 411 */ "force_opt",
+ /* 412 */ "unsafe_opt",
+ /* 413 */ "not_exists_opt",
+ /* 414 */ "db_options",
+ /* 415 */ "exists_opt",
+ /* 416 */ "alter_db_options",
+ /* 417 */ "speed_opt",
+ /* 418 */ "start_opt",
+ /* 419 */ "end_opt",
+ /* 420 */ "integer_list",
+ /* 421 */ "variable_list",
+ /* 422 */ "retention_list",
+ /* 423 */ "signed",
+ /* 424 */ "alter_db_option",
+ /* 425 */ "retention",
+ /* 426 */ "full_table_name",
+ /* 427 */ "column_def_list",
+ /* 428 */ "tags_def_opt",
+ /* 429 */ "table_options",
+ /* 430 */ "multi_create_clause",
+ /* 431 */ "tag_list_opt",
+ /* 432 */ "tags_def",
+ /* 433 */ "with_opt",
+ /* 434 */ "multi_drop_clause",
+ /* 435 */ "alter_table_clause",
+ /* 436 */ "alter_table_options",
+ /* 437 */ "column_name",
+ /* 438 */ "type_name",
+ /* 439 */ "column_options",
+ /* 440 */ "tags_literal",
+ /* 441 */ "create_subtable_clause",
+ /* 442 */ "specific_cols_opt",
+ /* 443 */ "tags_literal_list",
+ /* 444 */ "drop_table_clause",
+ /* 445 */ "col_name_list",
+ /* 446 */ "tag_def_list",
+ /* 447 */ "tag_def",
+ /* 448 */ "column_def",
+ /* 449 */ "type_name_default_len",
+ /* 450 */ "duration_list",
+ /* 451 */ "rollup_func_list",
+ /* 452 */ "alter_table_option",
+ /* 453 */ "duration_literal",
+ /* 454 */ "rollup_func_name",
+ /* 455 */ "function_name",
+ /* 456 */ "col_name",
+ /* 457 */ "db_kind_opt",
+ /* 458 */ "table_kind_db_name_cond_opt",
+ /* 459 */ "like_pattern_opt",
+ /* 460 */ "db_name_cond_opt",
+ /* 461 */ "table_name_cond",
+ /* 462 */ "from_db_opt",
+ /* 463 */ "table_kind",
+ /* 464 */ "tag_item",
+ /* 465 */ "column_alias",
+ /* 466 */ "tsma_name",
+ /* 467 */ "tsma_func_list",
+ /* 468 */ "full_tsma_name",
+ /* 469 */ "func_list",
+ /* 470 */ "index_options",
+ /* 471 */ "full_index_name",
+ /* 472 */ "index_name",
+ /* 473 */ "sliding_opt",
+ /* 474 */ "sma_stream_opt",
+ /* 475 */ "func",
+ /* 476 */ "sma_func_name",
+ /* 477 */ "expression_list",
+ /* 478 */ "with_meta",
+ /* 479 */ "query_or_subquery",
+ /* 480 */ "where_clause_opt",
+ /* 481 */ "cgroup_name",
+ /* 482 */ "analyze_opt",
+ /* 483 */ "explain_options",
+ /* 484 */ "insert_query",
+ /* 485 */ "or_replace_opt",
+ /* 486 */ "agg_func_opt",
+ /* 487 */ "bufsize_opt",
+ /* 488 */ "language_opt",
+ /* 489 */ "full_view_name",
+ /* 490 */ "view_name",
+ /* 491 */ "stream_name",
+ /* 492 */ "stream_options",
+ /* 493 */ "col_list_opt",
+ /* 494 */ "tag_def_or_ref_opt",
+ /* 495 */ "subtable_opt",
+ /* 496 */ "ignore_opt",
+ /* 497 */ "column_stream_def_list",
+ /* 498 */ "column_stream_def",
+ /* 499 */ "stream_col_options",
+ /* 500 */ "expression",
+ /* 501 */ "on_vgroup_id",
+ /* 502 */ "dnode_list",
+ /* 503 */ "literal_func",
+ /* 504 */ "signed_literal",
+ /* 505 */ "literal_list",
+ /* 506 */ "table_alias",
+ /* 507 */ "expr_or_subquery",
+ /* 508 */ "pseudo_column",
+ /* 509 */ "column_reference",
+ /* 510 */ "function_expression",
+ /* 511 */ "case_when_expression",
+ /* 512 */ "star_func",
+ /* 513 */ "star_func_para_list",
+ /* 514 */ "trim_specification_type",
+ /* 515 */ "substr_func",
+ /* 516 */ "rand_func",
+ /* 517 */ "noarg_func",
+ /* 518 */ "other_para_list",
+ /* 519 */ "star_func_para",
+ /* 520 */ "when_then_list",
+ /* 521 */ "case_when_else_opt",
+ /* 522 */ "common_expression",
+ /* 523 */ "when_then_expr",
+ /* 524 */ "predicate",
+ /* 525 */ "compare_op",
+ /* 526 */ "in_op",
+ /* 527 */ "in_predicate_value",
+ /* 528 */ "boolean_value_expression",
+ /* 529 */ "boolean_primary",
+ /* 530 */ "from_clause_opt",
+ /* 531 */ "table_reference_list",
+ /* 532 */ "table_reference",
+ /* 533 */ "table_primary",
+ /* 534 */ "joined_table",
+ /* 535 */ "alias_opt",
+ /* 536 */ "subquery",
+ /* 537 */ "parenthesized_joined_table",
+ /* 538 */ "join_type",
+ /* 539 */ "join_subtype",
+ /* 540 */ "join_on_clause_opt",
+ /* 541 */ "window_offset_clause_opt",
+ /* 542 */ "jlimit_clause_opt",
+ /* 543 */ "window_offset_literal",
+ /* 544 */ "query_specification",
+ /* 545 */ "hint_list",
+ /* 546 */ "set_quantifier_opt",
+ /* 547 */ "tag_mode_opt",
+ /* 548 */ "select_list",
+ /* 549 */ "partition_by_clause_opt",
+ /* 550 */ "range_opt",
+ /* 551 */ "every_opt",
+ /* 552 */ "fill_opt",
+ /* 553 */ "twindow_clause_opt",
+ /* 554 */ "group_by_clause_opt",
+ /* 555 */ "having_clause_opt",
+ /* 556 */ "select_item",
+ /* 557 */ "partition_list",
+ /* 558 */ "partition_item",
+ /* 559 */ "interval_sliding_duration_literal",
+ /* 560 */ "fill_mode",
+ /* 561 */ "group_by_list",
+ /* 562 */ "query_expression",
+ /* 563 */ "query_simple",
+ /* 564 */ "order_by_clause_opt",
+ /* 565 */ "slimit_clause_opt",
+ /* 566 */ "limit_clause_opt",
+ /* 567 */ "union_query_expression",
+ /* 568 */ "query_simple_or_subquery",
+ /* 569 */ "sort_specification_list",
+ /* 570 */ "sort_specification",
+ /* 571 */ "ordering_specification_opt",
+ /* 572 */ "null_ordering_opt",
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -2520,719 +2555,730 @@ static const char *const yyRuleName[] = {
/* 57 */ "with_clause_opt ::=",
/* 58 */ "with_clause_opt ::= WITH search_condition",
/* 59 */ "cmd ::= CREATE ENCRYPT_KEY NK_STRING",
- /* 60 */ "cmd ::= CREATE DNODE dnode_endpoint",
- /* 61 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER",
- /* 62 */ "cmd ::= DROP DNODE NK_INTEGER force_opt",
- /* 63 */ "cmd ::= DROP DNODE dnode_endpoint force_opt",
- /* 64 */ "cmd ::= DROP DNODE NK_INTEGER unsafe_opt",
- /* 65 */ "cmd ::= DROP DNODE dnode_endpoint unsafe_opt",
- /* 66 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING",
- /* 67 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING",
- /* 68 */ "cmd ::= ALTER ALL DNODES NK_STRING",
- /* 69 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING",
- /* 70 */ "cmd ::= RESTORE DNODE NK_INTEGER",
- /* 71 */ "dnode_endpoint ::= NK_STRING",
- /* 72 */ "dnode_endpoint ::= NK_ID",
- /* 73 */ "dnode_endpoint ::= NK_IPTOKEN",
- /* 74 */ "force_opt ::=",
- /* 75 */ "force_opt ::= FORCE",
- /* 76 */ "unsafe_opt ::= UNSAFE",
- /* 77 */ "cmd ::= ALTER CLUSTER NK_STRING",
- /* 78 */ "cmd ::= ALTER CLUSTER NK_STRING NK_STRING",
- /* 79 */ "cmd ::= ALTER LOCAL NK_STRING",
- /* 80 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING",
- /* 81 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER",
- /* 82 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER",
- /* 83 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER",
- /* 84 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER",
- /* 85 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER",
- /* 86 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER",
- /* 87 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER",
- /* 88 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER",
- /* 89 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER",
- /* 90 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER",
- /* 91 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER",
- /* 92 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options",
- /* 93 */ "cmd ::= DROP DATABASE exists_opt db_name",
- /* 94 */ "cmd ::= USE db_name",
- /* 95 */ "cmd ::= ALTER DATABASE db_name alter_db_options",
- /* 96 */ "cmd ::= FLUSH DATABASE db_name",
- /* 97 */ "cmd ::= TRIM DATABASE db_name speed_opt",
- /* 98 */ "cmd ::= S3MIGRATE DATABASE db_name",
- /* 99 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt",
- /* 100 */ "not_exists_opt ::= IF NOT EXISTS",
- /* 101 */ "not_exists_opt ::=",
- /* 102 */ "exists_opt ::= IF EXISTS",
- /* 103 */ "exists_opt ::=",
- /* 104 */ "db_options ::=",
- /* 105 */ "db_options ::= db_options BUFFER NK_INTEGER",
- /* 106 */ "db_options ::= db_options CACHEMODEL NK_STRING",
- /* 107 */ "db_options ::= db_options CACHESIZE NK_INTEGER",
- /* 108 */ "db_options ::= db_options COMP NK_INTEGER",
- /* 109 */ "db_options ::= db_options DURATION NK_INTEGER",
- /* 110 */ "db_options ::= db_options DURATION NK_VARIABLE",
- /* 111 */ "db_options ::= db_options MAXROWS NK_INTEGER",
- /* 112 */ "db_options ::= db_options MINROWS NK_INTEGER",
- /* 113 */ "db_options ::= db_options KEEP integer_list",
- /* 114 */ "db_options ::= db_options KEEP variable_list",
- /* 115 */ "db_options ::= db_options PAGES NK_INTEGER",
- /* 116 */ "db_options ::= db_options PAGESIZE NK_INTEGER",
- /* 117 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER",
- /* 118 */ "db_options ::= db_options PRECISION NK_STRING",
- /* 119 */ "db_options ::= db_options REPLICA NK_INTEGER",
- /* 120 */ "db_options ::= db_options VGROUPS NK_INTEGER",
- /* 121 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
- /* 122 */ "db_options ::= db_options RETENTIONS retention_list",
- /* 123 */ "db_options ::= db_options SCHEMALESS NK_INTEGER",
- /* 124 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER",
- /* 125 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER",
- /* 126 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER",
- /* 127 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
- /* 128 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER",
- /* 129 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
- /* 130 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER",
- /* 131 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER",
- /* 132 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER",
- /* 133 */ "db_options ::= db_options TABLE_PREFIX signed",
- /* 134 */ "db_options ::= db_options TABLE_SUFFIX signed",
- /* 135 */ "db_options ::= db_options S3_CHUNKSIZE NK_INTEGER",
- /* 136 */ "db_options ::= db_options S3_KEEPLOCAL NK_INTEGER",
- /* 137 */ "db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE",
- /* 138 */ "db_options ::= db_options S3_COMPACT NK_INTEGER",
- /* 139 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER",
- /* 140 */ "db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING",
- /* 141 */ "alter_db_options ::= alter_db_option",
- /* 142 */ "alter_db_options ::= alter_db_options alter_db_option",
- /* 143 */ "alter_db_option ::= BUFFER NK_INTEGER",
- /* 144 */ "alter_db_option ::= CACHEMODEL NK_STRING",
- /* 145 */ "alter_db_option ::= CACHESIZE NK_INTEGER",
- /* 146 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER",
- /* 147 */ "alter_db_option ::= KEEP integer_list",
- /* 148 */ "alter_db_option ::= KEEP variable_list",
- /* 149 */ "alter_db_option ::= PAGES NK_INTEGER",
- /* 150 */ "alter_db_option ::= REPLICA NK_INTEGER",
- /* 151 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER",
- /* 152 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER",
- /* 153 */ "alter_db_option ::= MINROWS NK_INTEGER",
- /* 154 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER",
- /* 155 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
- /* 156 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER",
- /* 157 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
- /* 158 */ "alter_db_option ::= S3_KEEPLOCAL NK_INTEGER",
- /* 159 */ "alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE",
- /* 160 */ "alter_db_option ::= S3_COMPACT NK_INTEGER",
- /* 161 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER",
- /* 162 */ "alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING",
- /* 163 */ "integer_list ::= NK_INTEGER",
- /* 164 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER",
- /* 165 */ "variable_list ::= NK_VARIABLE",
- /* 166 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE",
- /* 167 */ "retention_list ::= retention",
- /* 168 */ "retention_list ::= retention_list NK_COMMA retention",
- /* 169 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE",
- /* 170 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE",
- /* 171 */ "speed_opt ::=",
- /* 172 */ "speed_opt ::= BWLIMIT NK_INTEGER",
- /* 173 */ "start_opt ::=",
- /* 174 */ "start_opt ::= START WITH NK_INTEGER",
- /* 175 */ "start_opt ::= START WITH NK_STRING",
- /* 176 */ "start_opt ::= START WITH TIMESTAMP NK_STRING",
- /* 177 */ "end_opt ::=",
- /* 178 */ "end_opt ::= END WITH NK_INTEGER",
- /* 179 */ "end_opt ::= END WITH NK_STRING",
- /* 180 */ "end_opt ::= END WITH TIMESTAMP NK_STRING",
- /* 181 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
- /* 182 */ "cmd ::= CREATE TABLE multi_create_clause",
- /* 183 */ "cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING",
- /* 184 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
- /* 185 */ "cmd ::= DROP TABLE with_opt multi_drop_clause",
- /* 186 */ "cmd ::= DROP STABLE with_opt exists_opt full_table_name",
- /* 187 */ "cmd ::= ALTER TABLE alter_table_clause",
- /* 188 */ "cmd ::= ALTER STABLE alter_table_clause",
- /* 189 */ "alter_table_clause ::= full_table_name alter_table_options",
- /* 190 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options",
- /* 191 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
- /* 192 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
- /* 193 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options",
- /* 194 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
- /* 195 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
- /* 196 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
- /* 197 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
- /* 198 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
- /* 199 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal",
- /* 200 */ "multi_create_clause ::= create_subtable_clause",
- /* 201 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
- /* 202 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options",
- /* 203 */ "multi_drop_clause ::= drop_table_clause",
- /* 204 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause",
- /* 205 */ "drop_table_clause ::= exists_opt full_table_name",
- /* 206 */ "with_opt ::=",
- /* 207 */ "with_opt ::= WITH",
- /* 208 */ "specific_cols_opt ::=",
- /* 209 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
- /* 210 */ "full_table_name ::= table_name",
- /* 211 */ "full_table_name ::= db_name NK_DOT table_name",
- /* 212 */ "tag_def_list ::= tag_def",
- /* 213 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def",
- /* 214 */ "tag_def ::= column_name type_name",
- /* 215 */ "column_def_list ::= column_def",
- /* 216 */ "column_def_list ::= column_def_list NK_COMMA column_def",
- /* 217 */ "column_def ::= column_name type_name column_options",
- /* 218 */ "type_name ::= BOOL",
- /* 219 */ "type_name ::= TINYINT",
- /* 220 */ "type_name ::= SMALLINT",
- /* 221 */ "type_name ::= INT",
- /* 222 */ "type_name ::= INTEGER",
- /* 223 */ "type_name ::= BIGINT",
- /* 224 */ "type_name ::= FLOAT",
- /* 225 */ "type_name ::= DOUBLE",
- /* 226 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
- /* 227 */ "type_name ::= TIMESTAMP",
- /* 228 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
- /* 229 */ "type_name ::= TINYINT UNSIGNED",
- /* 230 */ "type_name ::= SMALLINT UNSIGNED",
- /* 231 */ "type_name ::= INT UNSIGNED",
- /* 232 */ "type_name ::= BIGINT UNSIGNED",
- /* 233 */ "type_name ::= JSON",
- /* 234 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
- /* 235 */ "type_name ::= MEDIUMBLOB",
- /* 236 */ "type_name ::= BLOB",
- /* 237 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
- /* 238 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP",
- /* 239 */ "type_name ::= DECIMAL",
- /* 240 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
- /* 241 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
- /* 242 */ "type_name_default_len ::= BINARY",
- /* 243 */ "type_name_default_len ::= NCHAR",
- /* 244 */ "type_name_default_len ::= VARCHAR",
- /* 245 */ "type_name_default_len ::= VARBINARY",
- /* 246 */ "tags_def_opt ::=",
- /* 247 */ "tags_def_opt ::= tags_def",
- /* 248 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP",
- /* 249 */ "table_options ::=",
- /* 250 */ "table_options ::= table_options COMMENT NK_STRING",
- /* 251 */ "table_options ::= table_options MAX_DELAY duration_list",
- /* 252 */ "table_options ::= table_options WATERMARK duration_list",
- /* 253 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
- /* 254 */ "table_options ::= table_options TTL NK_INTEGER",
- /* 255 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
- /* 256 */ "table_options ::= table_options DELETE_MARK duration_list",
- /* 257 */ "alter_table_options ::= alter_table_option",
- /* 258 */ "alter_table_options ::= alter_table_options alter_table_option",
- /* 259 */ "alter_table_option ::= COMMENT NK_STRING",
- /* 260 */ "alter_table_option ::= TTL NK_INTEGER",
- /* 261 */ "duration_list ::= duration_literal",
- /* 262 */ "duration_list ::= duration_list NK_COMMA duration_literal",
- /* 263 */ "rollup_func_list ::= rollup_func_name",
- /* 264 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
- /* 265 */ "rollup_func_name ::= function_name",
- /* 266 */ "rollup_func_name ::= FIRST",
- /* 267 */ "rollup_func_name ::= LAST",
- /* 268 */ "col_name_list ::= col_name",
- /* 269 */ "col_name_list ::= col_name_list NK_COMMA col_name",
- /* 270 */ "col_name ::= column_name",
- /* 271 */ "cmd ::= SHOW DNODES",
- /* 272 */ "cmd ::= SHOW USERS",
- /* 273 */ "cmd ::= SHOW USERS FULL",
- /* 274 */ "cmd ::= SHOW USER PRIVILEGES",
- /* 275 */ "cmd ::= SHOW db_kind_opt DATABASES",
- /* 276 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt",
- /* 277 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
- /* 278 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
- /* 279 */ "cmd ::= SHOW MNODES",
- /* 280 */ "cmd ::= SHOW QNODES",
- /* 281 */ "cmd ::= SHOW ARBGROUPS",
- /* 282 */ "cmd ::= SHOW FUNCTIONS",
- /* 283 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
- /* 284 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name",
- /* 285 */ "cmd ::= SHOW STREAMS",
- /* 286 */ "cmd ::= SHOW ACCOUNTS",
- /* 287 */ "cmd ::= SHOW APPS",
- /* 288 */ "cmd ::= SHOW CONNECTIONS",
- /* 289 */ "cmd ::= SHOW LICENCES",
- /* 290 */ "cmd ::= SHOW GRANTS",
- /* 291 */ "cmd ::= SHOW GRANTS FULL",
- /* 292 */ "cmd ::= SHOW GRANTS LOGS",
- /* 293 */ "cmd ::= SHOW CLUSTER MACHINES",
- /* 294 */ "cmd ::= SHOW CREATE DATABASE db_name",
- /* 295 */ "cmd ::= SHOW CREATE TABLE full_table_name",
- /* 296 */ "cmd ::= SHOW CREATE STABLE full_table_name",
- /* 297 */ "cmd ::= SHOW ENCRYPTIONS",
- /* 298 */ "cmd ::= SHOW QUERIES",
- /* 299 */ "cmd ::= SHOW SCORES",
- /* 300 */ "cmd ::= SHOW TOPICS",
- /* 301 */ "cmd ::= SHOW VARIABLES",
- /* 302 */ "cmd ::= SHOW CLUSTER VARIABLES",
- /* 303 */ "cmd ::= SHOW LOCAL VARIABLES",
- /* 304 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt",
- /* 305 */ "cmd ::= SHOW BNODES",
- /* 306 */ "cmd ::= SHOW SNODES",
- /* 307 */ "cmd ::= SHOW CLUSTER",
- /* 308 */ "cmd ::= SHOW TRANSACTIONS",
- /* 309 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
- /* 310 */ "cmd ::= SHOW CONSUMERS",
- /* 311 */ "cmd ::= SHOW SUBSCRIPTIONS",
- /* 312 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
- /* 313 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name",
- /* 314 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt",
- /* 315 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name",
- /* 316 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER",
- /* 317 */ "cmd ::= SHOW VNODES",
- /* 318 */ "cmd ::= SHOW db_name_cond_opt ALIVE",
- /* 319 */ "cmd ::= SHOW CLUSTER ALIVE",
- /* 320 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt",
- /* 321 */ "cmd ::= SHOW CREATE VIEW full_table_name",
- /* 322 */ "cmd ::= SHOW COMPACTS",
- /* 323 */ "cmd ::= SHOW COMPACT NK_INTEGER",
- /* 324 */ "table_kind_db_name_cond_opt ::=",
- /* 325 */ "table_kind_db_name_cond_opt ::= table_kind",
- /* 326 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT",
- /* 327 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT",
- /* 328 */ "table_kind ::= NORMAL",
- /* 329 */ "table_kind ::= CHILD",
- /* 330 */ "db_name_cond_opt ::=",
- /* 331 */ "db_name_cond_opt ::= db_name NK_DOT",
- /* 332 */ "like_pattern_opt ::=",
- /* 333 */ "like_pattern_opt ::= LIKE NK_STRING",
- /* 334 */ "table_name_cond ::= table_name",
- /* 335 */ "from_db_opt ::=",
- /* 336 */ "from_db_opt ::= FROM db_name",
- /* 337 */ "tag_list_opt ::=",
- /* 338 */ "tag_list_opt ::= tag_item",
- /* 339 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item",
- /* 340 */ "tag_item ::= TBNAME",
- /* 341 */ "tag_item ::= QTAGS",
- /* 342 */ "tag_item ::= column_name",
- /* 343 */ "tag_item ::= column_name column_alias",
- /* 344 */ "tag_item ::= column_name AS column_alias",
- /* 345 */ "db_kind_opt ::=",
- /* 346 */ "db_kind_opt ::= USER",
- /* 347 */ "db_kind_opt ::= SYSTEM",
- /* 348 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP",
- /* 349 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP",
- /* 350 */ "cmd ::= DROP TSMA exists_opt full_tsma_name",
- /* 351 */ "cmd ::= SHOW db_name_cond_opt TSMAS",
- /* 352 */ "full_tsma_name ::= tsma_name",
- /* 353 */ "full_tsma_name ::= db_name NK_DOT tsma_name",
- /* 354 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP",
- /* 355 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options",
- /* 356 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP",
- /* 357 */ "cmd ::= DROP INDEX exists_opt full_index_name",
- /* 358 */ "full_index_name ::= index_name",
- /* 359 */ "full_index_name ::= db_name NK_DOT index_name",
- /* 360 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
- /* 361 */ "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",
- /* 362 */ "func_list ::= func",
- /* 363 */ "func_list ::= func_list NK_COMMA func",
- /* 364 */ "func ::= sma_func_name NK_LP expression_list NK_RP",
- /* 365 */ "sma_func_name ::= function_name",
- /* 366 */ "sma_func_name ::= COUNT",
- /* 367 */ "sma_func_name ::= FIRST",
- /* 368 */ "sma_func_name ::= LAST",
- /* 369 */ "sma_func_name ::= LAST_ROW",
- /* 370 */ "sma_stream_opt ::=",
- /* 371 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal",
- /* 372 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal",
- /* 373 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal",
- /* 374 */ "with_meta ::= AS",
- /* 375 */ "with_meta ::= WITH META AS",
- /* 376 */ "with_meta ::= ONLY META AS",
- /* 377 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery",
- /* 378 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name",
- /* 379 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt",
- /* 380 */ "cmd ::= DROP TOPIC exists_opt topic_name",
- /* 381 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
- /* 382 */ "cmd ::= DESC full_table_name",
- /* 383 */ "cmd ::= DESCRIBE full_table_name",
- /* 384 */ "cmd ::= RESET QUERY CACHE",
- /* 385 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
- /* 386 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query",
- /* 387 */ "analyze_opt ::=",
- /* 388 */ "analyze_opt ::= ANALYZE",
- /* 389 */ "explain_options ::=",
- /* 390 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
- /* 391 */ "explain_options ::= explain_options RATIO NK_FLOAT",
- /* 392 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt",
- /* 393 */ "cmd ::= DROP FUNCTION exists_opt function_name",
- /* 394 */ "agg_func_opt ::=",
- /* 395 */ "agg_func_opt ::= AGGREGATE",
- /* 396 */ "bufsize_opt ::=",
- /* 397 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
- /* 398 */ "language_opt ::=",
- /* 399 */ "language_opt ::= LANGUAGE NK_STRING",
- /* 400 */ "or_replace_opt ::=",
- /* 401 */ "or_replace_opt ::= OR REPLACE",
- /* 402 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery",
- /* 403 */ "cmd ::= DROP VIEW exists_opt full_view_name",
- /* 404 */ "full_view_name ::= view_name",
- /* 405 */ "full_view_name ::= db_name NK_DOT view_name",
- /* 406 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery",
- /* 407 */ "cmd ::= DROP STREAM exists_opt stream_name",
- /* 408 */ "cmd ::= PAUSE STREAM exists_opt stream_name",
- /* 409 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name",
- /* 410 */ "col_list_opt ::=",
- /* 411 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP",
- /* 412 */ "column_stream_def_list ::= column_stream_def",
- /* 413 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def",
- /* 414 */ "column_stream_def ::= column_name stream_col_options",
- /* 415 */ "stream_col_options ::=",
- /* 416 */ "stream_col_options ::= stream_col_options PRIMARY KEY",
- /* 417 */ "tag_def_or_ref_opt ::=",
- /* 418 */ "tag_def_or_ref_opt ::= tags_def",
- /* 419 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP",
- /* 420 */ "stream_options ::=",
- /* 421 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
- /* 422 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
- /* 423 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
- /* 424 */ "stream_options ::= stream_options WATERMARK duration_literal",
- /* 425 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
- /* 426 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
- /* 427 */ "stream_options ::= stream_options DELETE_MARK duration_literal",
- /* 428 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER",
- /* 429 */ "subtable_opt ::=",
- /* 430 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
- /* 431 */ "ignore_opt ::=",
- /* 432 */ "ignore_opt ::= IGNORE UNTREATED",
- /* 433 */ "cmd ::= KILL CONNECTION NK_INTEGER",
- /* 434 */ "cmd ::= KILL QUERY NK_STRING",
- /* 435 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
- /* 436 */ "cmd ::= KILL COMPACT NK_INTEGER",
- /* 437 */ "cmd ::= BALANCE VGROUP",
- /* 438 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id",
- /* 439 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name",
- /* 440 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
- /* 441 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
- /* 442 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
- /* 443 */ "on_vgroup_id ::=",
- /* 444 */ "on_vgroup_id ::= ON NK_INTEGER",
- /* 445 */ "dnode_list ::= DNODE NK_INTEGER",
- /* 446 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
- /* 447 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
- /* 448 */ "cmd ::= query_or_subquery",
- /* 449 */ "cmd ::= insert_query",
- /* 450 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
- /* 451 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery",
- /* 452 */ "tags_literal ::= NK_INTEGER",
- /* 453 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal",
- /* 454 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal",
- /* 455 */ "tags_literal ::= NK_PLUS NK_INTEGER",
- /* 456 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal",
- /* 457 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal",
- /* 458 */ "tags_literal ::= NK_MINUS NK_INTEGER",
- /* 459 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal",
- /* 460 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal",
- /* 461 */ "tags_literal ::= NK_FLOAT",
- /* 462 */ "tags_literal ::= NK_PLUS NK_FLOAT",
- /* 463 */ "tags_literal ::= NK_MINUS NK_FLOAT",
- /* 464 */ "tags_literal ::= NK_BIN",
- /* 465 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal",
- /* 466 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal",
- /* 467 */ "tags_literal ::= NK_PLUS NK_BIN",
- /* 468 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal",
- /* 469 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal",
- /* 470 */ "tags_literal ::= NK_MINUS NK_BIN",
- /* 471 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal",
- /* 472 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal",
- /* 473 */ "tags_literal ::= NK_HEX",
- /* 474 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal",
- /* 475 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal",
- /* 476 */ "tags_literal ::= NK_PLUS NK_HEX",
- /* 477 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal",
- /* 478 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal",
- /* 479 */ "tags_literal ::= NK_MINUS NK_HEX",
- /* 480 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal",
- /* 481 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal",
- /* 482 */ "tags_literal ::= NK_STRING",
- /* 483 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal",
- /* 484 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal",
- /* 485 */ "tags_literal ::= NK_BOOL",
- /* 486 */ "tags_literal ::= NULL",
- /* 487 */ "tags_literal ::= literal_func",
- /* 488 */ "tags_literal ::= literal_func NK_PLUS duration_literal",
- /* 489 */ "tags_literal ::= literal_func NK_MINUS duration_literal",
- /* 490 */ "tags_literal_list ::= tags_literal",
- /* 491 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal",
- /* 492 */ "literal ::= NK_INTEGER",
- /* 493 */ "literal ::= NK_FLOAT",
- /* 494 */ "literal ::= NK_STRING",
- /* 495 */ "literal ::= NK_BOOL",
- /* 496 */ "literal ::= TIMESTAMP NK_STRING",
- /* 497 */ "literal ::= duration_literal",
- /* 498 */ "literal ::= NULL",
- /* 499 */ "literal ::= NK_QUESTION",
- /* 500 */ "duration_literal ::= NK_VARIABLE",
- /* 501 */ "signed ::= NK_INTEGER",
- /* 502 */ "signed ::= NK_PLUS NK_INTEGER",
- /* 503 */ "signed ::= NK_MINUS NK_INTEGER",
- /* 504 */ "signed ::= NK_FLOAT",
- /* 505 */ "signed ::= NK_PLUS NK_FLOAT",
- /* 506 */ "signed ::= NK_MINUS NK_FLOAT",
- /* 507 */ "signed_literal ::= signed",
- /* 508 */ "signed_literal ::= NK_STRING",
- /* 509 */ "signed_literal ::= NK_BOOL",
- /* 510 */ "signed_literal ::= TIMESTAMP NK_STRING",
- /* 511 */ "signed_literal ::= duration_literal",
- /* 512 */ "signed_literal ::= NULL",
- /* 513 */ "signed_literal ::= literal_func",
- /* 514 */ "signed_literal ::= NK_QUESTION",
- /* 515 */ "literal_list ::= signed_literal",
- /* 516 */ "literal_list ::= literal_list NK_COMMA signed_literal",
- /* 517 */ "db_name ::= NK_ID",
- /* 518 */ "table_name ::= NK_ID",
- /* 519 */ "column_name ::= NK_ID",
- /* 520 */ "function_name ::= NK_ID",
- /* 521 */ "view_name ::= NK_ID",
- /* 522 */ "table_alias ::= NK_ID",
- /* 523 */ "column_alias ::= NK_ID",
- /* 524 */ "column_alias ::= NK_ALIAS",
- /* 525 */ "user_name ::= NK_ID",
- /* 526 */ "topic_name ::= NK_ID",
- /* 527 */ "stream_name ::= NK_ID",
- /* 528 */ "cgroup_name ::= NK_ID",
- /* 529 */ "index_name ::= NK_ID",
- /* 530 */ "tsma_name ::= NK_ID",
- /* 531 */ "expr_or_subquery ::= expression",
- /* 532 */ "expression ::= literal",
- /* 533 */ "expression ::= pseudo_column",
- /* 534 */ "expression ::= column_reference",
- /* 535 */ "expression ::= function_expression",
- /* 536 */ "expression ::= case_when_expression",
- /* 537 */ "expression ::= NK_LP expression NK_RP",
- /* 538 */ "expression ::= NK_PLUS expr_or_subquery",
- /* 539 */ "expression ::= NK_MINUS expr_or_subquery",
- /* 540 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
- /* 541 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
- /* 542 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
- /* 543 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
- /* 544 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
- /* 545 */ "expression ::= column_reference NK_ARROW NK_STRING",
- /* 546 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
- /* 547 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
- /* 548 */ "expression_list ::= expr_or_subquery",
- /* 549 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
- /* 550 */ "column_reference ::= column_name",
- /* 551 */ "column_reference ::= table_name NK_DOT column_name",
- /* 552 */ "column_reference ::= NK_ALIAS",
- /* 553 */ "column_reference ::= table_name NK_DOT NK_ALIAS",
- /* 554 */ "pseudo_column ::= ROWTS",
- /* 555 */ "pseudo_column ::= TBNAME",
- /* 556 */ "pseudo_column ::= table_name NK_DOT TBNAME",
- /* 557 */ "pseudo_column ::= QSTART",
- /* 558 */ "pseudo_column ::= QEND",
- /* 559 */ "pseudo_column ::= QDURATION",
- /* 560 */ "pseudo_column ::= WSTART",
- /* 561 */ "pseudo_column ::= WEND",
- /* 562 */ "pseudo_column ::= WDURATION",
- /* 563 */ "pseudo_column ::= IROWTS",
- /* 564 */ "pseudo_column ::= ISFILLED",
- /* 565 */ "pseudo_column ::= QTAGS",
- /* 566 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
- /* 567 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
- /* 568 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
- /* 569 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP",
- /* 570 */ "function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP",
- /* 571 */ "function_expression ::= TRIM NK_LP expr_or_subquery NK_RP",
- /* 572 */ "function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP",
- /* 573 */ "function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP",
- /* 574 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP",
- /* 575 */ "function_expression ::= substr_func NK_LP expression_list NK_RP",
- /* 576 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP",
- /* 577 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP",
- /* 578 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP",
- /* 579 */ "function_expression ::= literal_func",
- /* 580 */ "function_expression ::= rand_func",
- /* 581 */ "literal_func ::= noarg_func NK_LP NK_RP",
- /* 582 */ "literal_func ::= NOW",
- /* 583 */ "literal_func ::= TODAY",
- /* 584 */ "rand_func ::= RAND NK_LP NK_RP",
- /* 585 */ "rand_func ::= RAND NK_LP expression_list NK_RP",
- /* 586 */ "substr_func ::= SUBSTR",
- /* 587 */ "substr_func ::= SUBSTRING",
- /* 588 */ "trim_specification_type ::= BOTH",
- /* 589 */ "trim_specification_type ::= TRAILING",
- /* 590 */ "trim_specification_type ::= LEADING",
- /* 591 */ "noarg_func ::= NOW",
- /* 592 */ "noarg_func ::= TODAY",
- /* 593 */ "noarg_func ::= TIMEZONE",
- /* 594 */ "noarg_func ::= DATABASE",
- /* 595 */ "noarg_func ::= CLIENT_VERSION",
- /* 596 */ "noarg_func ::= SERVER_VERSION",
- /* 597 */ "noarg_func ::= SERVER_STATUS",
- /* 598 */ "noarg_func ::= CURRENT_USER",
- /* 599 */ "noarg_func ::= USER",
- /* 600 */ "noarg_func ::= PI",
- /* 601 */ "star_func ::= COUNT",
- /* 602 */ "star_func ::= FIRST",
- /* 603 */ "star_func ::= LAST",
- /* 604 */ "star_func ::= LAST_ROW",
- /* 605 */ "star_func_para_list ::= NK_STAR",
- /* 606 */ "star_func_para_list ::= other_para_list",
- /* 607 */ "other_para_list ::= star_func_para",
- /* 608 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
- /* 609 */ "star_func_para ::= expr_or_subquery",
- /* 610 */ "star_func_para ::= table_name NK_DOT NK_STAR",
- /* 611 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
- /* 612 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
- /* 613 */ "when_then_list ::= when_then_expr",
- /* 614 */ "when_then_list ::= when_then_list when_then_expr",
- /* 615 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
- /* 616 */ "case_when_else_opt ::=",
- /* 617 */ "case_when_else_opt ::= ELSE common_expression",
- /* 618 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
- /* 619 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 620 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
- /* 621 */ "predicate ::= expr_or_subquery IS NULL",
- /* 622 */ "predicate ::= expr_or_subquery IS NOT NULL",
- /* 623 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
- /* 624 */ "compare_op ::= NK_LT",
- /* 625 */ "compare_op ::= NK_GT",
- /* 626 */ "compare_op ::= NK_LE",
- /* 627 */ "compare_op ::= NK_GE",
- /* 628 */ "compare_op ::= NK_NE",
- /* 629 */ "compare_op ::= NK_EQ",
- /* 630 */ "compare_op ::= LIKE",
- /* 631 */ "compare_op ::= NOT LIKE",
- /* 632 */ "compare_op ::= MATCH",
- /* 633 */ "compare_op ::= NMATCH",
- /* 634 */ "compare_op ::= CONTAINS",
- /* 635 */ "in_op ::= IN",
- /* 636 */ "in_op ::= NOT IN",
- /* 637 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
- /* 638 */ "boolean_value_expression ::= boolean_primary",
- /* 639 */ "boolean_value_expression ::= NOT boolean_primary",
- /* 640 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
- /* 641 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
- /* 642 */ "boolean_primary ::= predicate",
- /* 643 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
- /* 644 */ "common_expression ::= expr_or_subquery",
- /* 645 */ "common_expression ::= boolean_value_expression",
- /* 646 */ "from_clause_opt ::=",
- /* 647 */ "from_clause_opt ::= FROM table_reference_list",
- /* 648 */ "table_reference_list ::= table_reference",
- /* 649 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
- /* 650 */ "table_reference ::= table_primary",
- /* 651 */ "table_reference ::= joined_table",
- /* 652 */ "table_primary ::= table_name alias_opt",
- /* 653 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
- /* 654 */ "table_primary ::= subquery alias_opt",
- /* 655 */ "table_primary ::= parenthesized_joined_table",
- /* 656 */ "alias_opt ::=",
- /* 657 */ "alias_opt ::= table_alias",
- /* 658 */ "alias_opt ::= AS table_alias",
- /* 659 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
- /* 660 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
- /* 661 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt",
- /* 662 */ "join_type ::=",
- /* 663 */ "join_type ::= INNER",
- /* 664 */ "join_type ::= LEFT",
- /* 665 */ "join_type ::= RIGHT",
- /* 666 */ "join_type ::= FULL",
- /* 667 */ "join_subtype ::=",
- /* 668 */ "join_subtype ::= OUTER",
- /* 669 */ "join_subtype ::= SEMI",
- /* 670 */ "join_subtype ::= ANTI",
- /* 671 */ "join_subtype ::= ASOF",
- /* 672 */ "join_subtype ::= WINDOW",
- /* 673 */ "join_on_clause_opt ::=",
- /* 674 */ "join_on_clause_opt ::= ON search_condition",
- /* 675 */ "window_offset_clause_opt ::=",
- /* 676 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP",
- /* 677 */ "window_offset_literal ::= NK_VARIABLE",
- /* 678 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE",
- /* 679 */ "jlimit_clause_opt ::=",
- /* 680 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER",
- /* 681 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
- /* 682 */ "hint_list ::=",
- /* 683 */ "hint_list ::= NK_HINT",
- /* 684 */ "tag_mode_opt ::=",
- /* 685 */ "tag_mode_opt ::= TAGS",
- /* 686 */ "set_quantifier_opt ::=",
- /* 687 */ "set_quantifier_opt ::= DISTINCT",
- /* 688 */ "set_quantifier_opt ::= ALL",
- /* 689 */ "select_list ::= select_item",
- /* 690 */ "select_list ::= select_list NK_COMMA select_item",
- /* 691 */ "select_item ::= NK_STAR",
- /* 692 */ "select_item ::= common_expression",
- /* 693 */ "select_item ::= common_expression column_alias",
- /* 694 */ "select_item ::= common_expression AS column_alias",
- /* 695 */ "select_item ::= table_name NK_DOT NK_STAR",
- /* 696 */ "where_clause_opt ::=",
- /* 697 */ "where_clause_opt ::= WHERE search_condition",
- /* 698 */ "partition_by_clause_opt ::=",
- /* 699 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
- /* 700 */ "partition_list ::= partition_item",
- /* 701 */ "partition_list ::= partition_list NK_COMMA partition_item",
- /* 702 */ "partition_item ::= expr_or_subquery",
- /* 703 */ "partition_item ::= expr_or_subquery column_alias",
- /* 704 */ "partition_item ::= expr_or_subquery AS column_alias",
- /* 705 */ "twindow_clause_opt ::=",
- /* 706 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP",
- /* 707 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
- /* 708 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
- /* 709 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
- /* 710 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
- /* 711 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP",
- /* 712 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
- /* 713 */ "sliding_opt ::=",
- /* 714 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP",
- /* 715 */ "interval_sliding_duration_literal ::= NK_VARIABLE",
- /* 716 */ "interval_sliding_duration_literal ::= NK_STRING",
- /* 717 */ "interval_sliding_duration_literal ::= NK_INTEGER",
- /* 718 */ "fill_opt ::=",
- /* 719 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
- /* 720 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP",
- /* 721 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP",
- /* 722 */ "fill_mode ::= NONE",
- /* 723 */ "fill_mode ::= PREV",
- /* 724 */ "fill_mode ::= NULL",
- /* 725 */ "fill_mode ::= NULL_F",
- /* 726 */ "fill_mode ::= LINEAR",
- /* 727 */ "fill_mode ::= NEXT",
- /* 728 */ "group_by_clause_opt ::=",
- /* 729 */ "group_by_clause_opt ::= GROUP BY group_by_list",
- /* 730 */ "group_by_list ::= expr_or_subquery",
- /* 731 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
- /* 732 */ "having_clause_opt ::=",
- /* 733 */ "having_clause_opt ::= HAVING search_condition",
- /* 734 */ "range_opt ::=",
- /* 735 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
- /* 736 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP",
- /* 737 */ "every_opt ::=",
- /* 738 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
- /* 739 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
- /* 740 */ "query_simple ::= query_specification",
- /* 741 */ "query_simple ::= union_query_expression",
- /* 742 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
- /* 743 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
- /* 744 */ "query_simple_or_subquery ::= query_simple",
- /* 745 */ "query_simple_or_subquery ::= subquery",
- /* 746 */ "query_or_subquery ::= query_expression",
- /* 747 */ "query_or_subquery ::= subquery",
- /* 748 */ "order_by_clause_opt ::=",
- /* 749 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
- /* 750 */ "slimit_clause_opt ::=",
- /* 751 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
- /* 752 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
- /* 753 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 754 */ "limit_clause_opt ::=",
- /* 755 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
- /* 756 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
- /* 757 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
- /* 758 */ "subquery ::= NK_LP query_expression NK_RP",
- /* 759 */ "subquery ::= NK_LP subquery NK_RP",
- /* 760 */ "search_condition ::= common_expression",
- /* 761 */ "sort_specification_list ::= sort_specification",
- /* 762 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
- /* 763 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
- /* 764 */ "ordering_specification_opt ::=",
- /* 765 */ "ordering_specification_opt ::= ASC",
- /* 766 */ "ordering_specification_opt ::= DESC",
- /* 767 */ "null_ordering_opt ::=",
- /* 768 */ "null_ordering_opt ::= NULLS FIRST",
- /* 769 */ "null_ordering_opt ::= NULLS LAST",
- /* 770 */ "column_options ::=",
- /* 771 */ "column_options ::= column_options PRIMARY KEY",
- /* 772 */ "column_options ::= column_options NK_ID NK_STRING",
+ /* 60 */ "cmd ::= CREATE ANODE NK_STRING",
+ /* 61 */ "cmd ::= UPDATE ANODE NK_INTEGER",
+ /* 62 */ "cmd ::= UPDATE ALL ANODES",
+ /* 63 */ "cmd ::= DROP ANODE NK_INTEGER",
+ /* 64 */ "cmd ::= CREATE DNODE dnode_endpoint",
+ /* 65 */ "cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER",
+ /* 66 */ "cmd ::= DROP DNODE NK_INTEGER force_opt",
+ /* 67 */ "cmd ::= DROP DNODE dnode_endpoint force_opt",
+ /* 68 */ "cmd ::= DROP DNODE NK_INTEGER unsafe_opt",
+ /* 69 */ "cmd ::= DROP DNODE dnode_endpoint unsafe_opt",
+ /* 70 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING",
+ /* 71 */ "cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING",
+ /* 72 */ "cmd ::= ALTER ALL DNODES NK_STRING",
+ /* 73 */ "cmd ::= ALTER ALL DNODES NK_STRING NK_STRING",
+ /* 74 */ "cmd ::= RESTORE DNODE NK_INTEGER",
+ /* 75 */ "dnode_endpoint ::= NK_STRING",
+ /* 76 */ "dnode_endpoint ::= NK_ID",
+ /* 77 */ "dnode_endpoint ::= NK_IPTOKEN",
+ /* 78 */ "force_opt ::=",
+ /* 79 */ "force_opt ::= FORCE",
+ /* 80 */ "unsafe_opt ::= UNSAFE",
+ /* 81 */ "cmd ::= ALTER CLUSTER NK_STRING",
+ /* 82 */ "cmd ::= ALTER CLUSTER NK_STRING NK_STRING",
+ /* 83 */ "cmd ::= ALTER LOCAL NK_STRING",
+ /* 84 */ "cmd ::= ALTER LOCAL NK_STRING NK_STRING",
+ /* 85 */ "cmd ::= CREATE QNODE ON DNODE NK_INTEGER",
+ /* 86 */ "cmd ::= DROP QNODE ON DNODE NK_INTEGER",
+ /* 87 */ "cmd ::= RESTORE QNODE ON DNODE NK_INTEGER",
+ /* 88 */ "cmd ::= CREATE BNODE ON DNODE NK_INTEGER",
+ /* 89 */ "cmd ::= DROP BNODE ON DNODE NK_INTEGER",
+ /* 90 */ "cmd ::= CREATE SNODE ON DNODE NK_INTEGER",
+ /* 91 */ "cmd ::= DROP SNODE ON DNODE NK_INTEGER",
+ /* 92 */ "cmd ::= CREATE MNODE ON DNODE NK_INTEGER",
+ /* 93 */ "cmd ::= DROP MNODE ON DNODE NK_INTEGER",
+ /* 94 */ "cmd ::= RESTORE MNODE ON DNODE NK_INTEGER",
+ /* 95 */ "cmd ::= RESTORE VNODE ON DNODE NK_INTEGER",
+ /* 96 */ "cmd ::= CREATE DATABASE not_exists_opt db_name db_options",
+ /* 97 */ "cmd ::= DROP DATABASE exists_opt db_name",
+ /* 98 */ "cmd ::= USE db_name",
+ /* 99 */ "cmd ::= ALTER DATABASE db_name alter_db_options",
+ /* 100 */ "cmd ::= FLUSH DATABASE db_name",
+ /* 101 */ "cmd ::= TRIM DATABASE db_name speed_opt",
+ /* 102 */ "cmd ::= S3MIGRATE DATABASE db_name",
+ /* 103 */ "cmd ::= COMPACT DATABASE db_name start_opt end_opt",
+ /* 104 */ "not_exists_opt ::= IF NOT EXISTS",
+ /* 105 */ "not_exists_opt ::=",
+ /* 106 */ "exists_opt ::= IF EXISTS",
+ /* 107 */ "exists_opt ::=",
+ /* 108 */ "db_options ::=",
+ /* 109 */ "db_options ::= db_options BUFFER NK_INTEGER",
+ /* 110 */ "db_options ::= db_options CACHEMODEL NK_STRING",
+ /* 111 */ "db_options ::= db_options CACHESIZE NK_INTEGER",
+ /* 112 */ "db_options ::= db_options COMP NK_INTEGER",
+ /* 113 */ "db_options ::= db_options DURATION NK_INTEGER",
+ /* 114 */ "db_options ::= db_options DURATION NK_VARIABLE",
+ /* 115 */ "db_options ::= db_options MAXROWS NK_INTEGER",
+ /* 116 */ "db_options ::= db_options MINROWS NK_INTEGER",
+ /* 117 */ "db_options ::= db_options KEEP integer_list",
+ /* 118 */ "db_options ::= db_options KEEP variable_list",
+ /* 119 */ "db_options ::= db_options PAGES NK_INTEGER",
+ /* 120 */ "db_options ::= db_options PAGESIZE NK_INTEGER",
+ /* 121 */ "db_options ::= db_options TSDB_PAGESIZE NK_INTEGER",
+ /* 122 */ "db_options ::= db_options PRECISION NK_STRING",
+ /* 123 */ "db_options ::= db_options REPLICA NK_INTEGER",
+ /* 124 */ "db_options ::= db_options VGROUPS NK_INTEGER",
+ /* 125 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER",
+ /* 126 */ "db_options ::= db_options RETENTIONS retention_list",
+ /* 127 */ "db_options ::= db_options SCHEMALESS NK_INTEGER",
+ /* 128 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER",
+ /* 129 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER",
+ /* 130 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER",
+ /* 131 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
+ /* 132 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER",
+ /* 133 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
+ /* 134 */ "db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER",
+ /* 135 */ "db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER",
+ /* 136 */ "db_options ::= db_options STT_TRIGGER NK_INTEGER",
+ /* 137 */ "db_options ::= db_options TABLE_PREFIX signed",
+ /* 138 */ "db_options ::= db_options TABLE_SUFFIX signed",
+ /* 139 */ "db_options ::= db_options S3_CHUNKSIZE NK_INTEGER",
+ /* 140 */ "db_options ::= db_options S3_KEEPLOCAL NK_INTEGER",
+ /* 141 */ "db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE",
+ /* 142 */ "db_options ::= db_options S3_COMPACT NK_INTEGER",
+ /* 143 */ "db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER",
+ /* 144 */ "db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING",
+ /* 145 */ "alter_db_options ::= alter_db_option",
+ /* 146 */ "alter_db_options ::= alter_db_options alter_db_option",
+ /* 147 */ "alter_db_option ::= BUFFER NK_INTEGER",
+ /* 148 */ "alter_db_option ::= CACHEMODEL NK_STRING",
+ /* 149 */ "alter_db_option ::= CACHESIZE NK_INTEGER",
+ /* 150 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER",
+ /* 151 */ "alter_db_option ::= KEEP integer_list",
+ /* 152 */ "alter_db_option ::= KEEP variable_list",
+ /* 153 */ "alter_db_option ::= PAGES NK_INTEGER",
+ /* 154 */ "alter_db_option ::= REPLICA NK_INTEGER",
+ /* 155 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER",
+ /* 156 */ "alter_db_option ::= STT_TRIGGER NK_INTEGER",
+ /* 157 */ "alter_db_option ::= MINROWS NK_INTEGER",
+ /* 158 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER",
+ /* 159 */ "alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER",
+ /* 160 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER",
+ /* 161 */ "alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER",
+ /* 162 */ "alter_db_option ::= S3_KEEPLOCAL NK_INTEGER",
+ /* 163 */ "alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE",
+ /* 164 */ "alter_db_option ::= S3_COMPACT NK_INTEGER",
+ /* 165 */ "alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER",
+ /* 166 */ "alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING",
+ /* 167 */ "integer_list ::= NK_INTEGER",
+ /* 168 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER",
+ /* 169 */ "variable_list ::= NK_VARIABLE",
+ /* 170 */ "variable_list ::= variable_list NK_COMMA NK_VARIABLE",
+ /* 171 */ "retention_list ::= retention",
+ /* 172 */ "retention_list ::= retention_list NK_COMMA retention",
+ /* 173 */ "retention ::= NK_VARIABLE NK_COLON NK_VARIABLE",
+ /* 174 */ "retention ::= NK_MINUS NK_COLON NK_VARIABLE",
+ /* 175 */ "speed_opt ::=",
+ /* 176 */ "speed_opt ::= BWLIMIT NK_INTEGER",
+ /* 177 */ "start_opt ::=",
+ /* 178 */ "start_opt ::= START WITH NK_INTEGER",
+ /* 179 */ "start_opt ::= START WITH NK_STRING",
+ /* 180 */ "start_opt ::= START WITH TIMESTAMP NK_STRING",
+ /* 181 */ "end_opt ::=",
+ /* 182 */ "end_opt ::= END WITH NK_INTEGER",
+ /* 183 */ "end_opt ::= END WITH NK_STRING",
+ /* 184 */ "end_opt ::= END WITH TIMESTAMP NK_STRING",
+ /* 185 */ "cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options",
+ /* 186 */ "cmd ::= CREATE TABLE multi_create_clause",
+ /* 187 */ "cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING",
+ /* 188 */ "cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options",
+ /* 189 */ "cmd ::= DROP TABLE with_opt multi_drop_clause",
+ /* 190 */ "cmd ::= DROP STABLE with_opt exists_opt full_table_name",
+ /* 191 */ "cmd ::= ALTER TABLE alter_table_clause",
+ /* 192 */ "cmd ::= ALTER STABLE alter_table_clause",
+ /* 193 */ "alter_table_clause ::= full_table_name alter_table_options",
+ /* 194 */ "alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options",
+ /* 195 */ "alter_table_clause ::= full_table_name DROP COLUMN column_name",
+ /* 196 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name",
+ /* 197 */ "alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options",
+ /* 198 */ "alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name",
+ /* 199 */ "alter_table_clause ::= full_table_name ADD TAG column_name type_name",
+ /* 200 */ "alter_table_clause ::= full_table_name DROP TAG column_name",
+ /* 201 */ "alter_table_clause ::= full_table_name MODIFY TAG column_name type_name",
+ /* 202 */ "alter_table_clause ::= full_table_name RENAME TAG column_name column_name",
+ /* 203 */ "alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal",
+ /* 204 */ "multi_create_clause ::= create_subtable_clause",
+ /* 205 */ "multi_create_clause ::= multi_create_clause create_subtable_clause",
+ /* 206 */ "create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options",
+ /* 207 */ "multi_drop_clause ::= drop_table_clause",
+ /* 208 */ "multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause",
+ /* 209 */ "drop_table_clause ::= exists_opt full_table_name",
+ /* 210 */ "with_opt ::=",
+ /* 211 */ "with_opt ::= WITH",
+ /* 212 */ "specific_cols_opt ::=",
+ /* 213 */ "specific_cols_opt ::= NK_LP col_name_list NK_RP",
+ /* 214 */ "full_table_name ::= table_name",
+ /* 215 */ "full_table_name ::= db_name NK_DOT table_name",
+ /* 216 */ "tag_def_list ::= tag_def",
+ /* 217 */ "tag_def_list ::= tag_def_list NK_COMMA tag_def",
+ /* 218 */ "tag_def ::= column_name type_name",
+ /* 219 */ "column_def_list ::= column_def",
+ /* 220 */ "column_def_list ::= column_def_list NK_COMMA column_def",
+ /* 221 */ "column_def ::= column_name type_name column_options",
+ /* 222 */ "type_name ::= BOOL",
+ /* 223 */ "type_name ::= TINYINT",
+ /* 224 */ "type_name ::= SMALLINT",
+ /* 225 */ "type_name ::= INT",
+ /* 226 */ "type_name ::= INTEGER",
+ /* 227 */ "type_name ::= BIGINT",
+ /* 228 */ "type_name ::= FLOAT",
+ /* 229 */ "type_name ::= DOUBLE",
+ /* 230 */ "type_name ::= BINARY NK_LP NK_INTEGER NK_RP",
+ /* 231 */ "type_name ::= TIMESTAMP",
+ /* 232 */ "type_name ::= NCHAR NK_LP NK_INTEGER NK_RP",
+ /* 233 */ "type_name ::= TINYINT UNSIGNED",
+ /* 234 */ "type_name ::= SMALLINT UNSIGNED",
+ /* 235 */ "type_name ::= INT UNSIGNED",
+ /* 236 */ "type_name ::= BIGINT UNSIGNED",
+ /* 237 */ "type_name ::= JSON",
+ /* 238 */ "type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP",
+ /* 239 */ "type_name ::= MEDIUMBLOB",
+ /* 240 */ "type_name ::= BLOB",
+ /* 241 */ "type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP",
+ /* 242 */ "type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP",
+ /* 243 */ "type_name ::= DECIMAL",
+ /* 244 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP",
+ /* 245 */ "type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
+ /* 246 */ "type_name_default_len ::= BINARY",
+ /* 247 */ "type_name_default_len ::= NCHAR",
+ /* 248 */ "type_name_default_len ::= VARCHAR",
+ /* 249 */ "type_name_default_len ::= VARBINARY",
+ /* 250 */ "tags_def_opt ::=",
+ /* 251 */ "tags_def_opt ::= tags_def",
+ /* 252 */ "tags_def ::= TAGS NK_LP tag_def_list NK_RP",
+ /* 253 */ "table_options ::=",
+ /* 254 */ "table_options ::= table_options COMMENT NK_STRING",
+ /* 255 */ "table_options ::= table_options MAX_DELAY duration_list",
+ /* 256 */ "table_options ::= table_options WATERMARK duration_list",
+ /* 257 */ "table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP",
+ /* 258 */ "table_options ::= table_options TTL NK_INTEGER",
+ /* 259 */ "table_options ::= table_options SMA NK_LP col_name_list NK_RP",
+ /* 260 */ "table_options ::= table_options DELETE_MARK duration_list",
+ /* 261 */ "alter_table_options ::= alter_table_option",
+ /* 262 */ "alter_table_options ::= alter_table_options alter_table_option",
+ /* 263 */ "alter_table_option ::= COMMENT NK_STRING",
+ /* 264 */ "alter_table_option ::= TTL NK_INTEGER",
+ /* 265 */ "duration_list ::= duration_literal",
+ /* 266 */ "duration_list ::= duration_list NK_COMMA duration_literal",
+ /* 267 */ "rollup_func_list ::= rollup_func_name",
+ /* 268 */ "rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name",
+ /* 269 */ "rollup_func_name ::= function_name",
+ /* 270 */ "rollup_func_name ::= FIRST",
+ /* 271 */ "rollup_func_name ::= LAST",
+ /* 272 */ "col_name_list ::= col_name",
+ /* 273 */ "col_name_list ::= col_name_list NK_COMMA col_name",
+ /* 274 */ "col_name ::= column_name",
+ /* 275 */ "cmd ::= SHOW DNODES",
+ /* 276 */ "cmd ::= SHOW USERS",
+ /* 277 */ "cmd ::= SHOW USERS FULL",
+ /* 278 */ "cmd ::= SHOW USER PRIVILEGES",
+ /* 279 */ "cmd ::= SHOW db_kind_opt DATABASES",
+ /* 280 */ "cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt",
+ /* 281 */ "cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt",
+ /* 282 */ "cmd ::= SHOW db_name_cond_opt VGROUPS",
+ /* 283 */ "cmd ::= SHOW MNODES",
+ /* 284 */ "cmd ::= SHOW QNODES",
+ /* 285 */ "cmd ::= SHOW ANODES",
+ /* 286 */ "cmd ::= SHOW ANODES FULL",
+ /* 287 */ "cmd ::= SHOW ARBGROUPS",
+ /* 288 */ "cmd ::= SHOW FUNCTIONS",
+ /* 289 */ "cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt",
+ /* 290 */ "cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name",
+ /* 291 */ "cmd ::= SHOW STREAMS",
+ /* 292 */ "cmd ::= SHOW ACCOUNTS",
+ /* 293 */ "cmd ::= SHOW APPS",
+ /* 294 */ "cmd ::= SHOW CONNECTIONS",
+ /* 295 */ "cmd ::= SHOW LICENCES",
+ /* 296 */ "cmd ::= SHOW GRANTS",
+ /* 297 */ "cmd ::= SHOW GRANTS FULL",
+ /* 298 */ "cmd ::= SHOW GRANTS LOGS",
+ /* 299 */ "cmd ::= SHOW CLUSTER MACHINES",
+ /* 300 */ "cmd ::= SHOW CREATE DATABASE db_name",
+ /* 301 */ "cmd ::= SHOW CREATE TABLE full_table_name",
+ /* 302 */ "cmd ::= SHOW CREATE STABLE full_table_name",
+ /* 303 */ "cmd ::= SHOW ENCRYPTIONS",
+ /* 304 */ "cmd ::= SHOW QUERIES",
+ /* 305 */ "cmd ::= SHOW SCORES",
+ /* 306 */ "cmd ::= SHOW TOPICS",
+ /* 307 */ "cmd ::= SHOW VARIABLES",
+ /* 308 */ "cmd ::= SHOW CLUSTER VARIABLES",
+ /* 309 */ "cmd ::= SHOW LOCAL VARIABLES",
+ /* 310 */ "cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt",
+ /* 311 */ "cmd ::= SHOW BNODES",
+ /* 312 */ "cmd ::= SHOW SNODES",
+ /* 313 */ "cmd ::= SHOW CLUSTER",
+ /* 314 */ "cmd ::= SHOW TRANSACTIONS",
+ /* 315 */ "cmd ::= SHOW TABLE DISTRIBUTED full_table_name",
+ /* 316 */ "cmd ::= SHOW CONSUMERS",
+ /* 317 */ "cmd ::= SHOW SUBSCRIPTIONS",
+ /* 318 */ "cmd ::= SHOW TAGS FROM table_name_cond from_db_opt",
+ /* 319 */ "cmd ::= SHOW TAGS FROM db_name NK_DOT table_name",
+ /* 320 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt",
+ /* 321 */ "cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name",
+ /* 322 */ "cmd ::= SHOW VNODES ON DNODE NK_INTEGER",
+ /* 323 */ "cmd ::= SHOW VNODES",
+ /* 324 */ "cmd ::= SHOW db_name_cond_opt ALIVE",
+ /* 325 */ "cmd ::= SHOW CLUSTER ALIVE",
+ /* 326 */ "cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt",
+ /* 327 */ "cmd ::= SHOW CREATE VIEW full_table_name",
+ /* 328 */ "cmd ::= SHOW COMPACTS",
+ /* 329 */ "cmd ::= SHOW COMPACT NK_INTEGER",
+ /* 330 */ "table_kind_db_name_cond_opt ::=",
+ /* 331 */ "table_kind_db_name_cond_opt ::= table_kind",
+ /* 332 */ "table_kind_db_name_cond_opt ::= db_name NK_DOT",
+ /* 333 */ "table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT",
+ /* 334 */ "table_kind ::= NORMAL",
+ /* 335 */ "table_kind ::= CHILD",
+ /* 336 */ "db_name_cond_opt ::=",
+ /* 337 */ "db_name_cond_opt ::= db_name NK_DOT",
+ /* 338 */ "like_pattern_opt ::=",
+ /* 339 */ "like_pattern_opt ::= LIKE NK_STRING",
+ /* 340 */ "table_name_cond ::= table_name",
+ /* 341 */ "from_db_opt ::=",
+ /* 342 */ "from_db_opt ::= FROM db_name",
+ /* 343 */ "tag_list_opt ::=",
+ /* 344 */ "tag_list_opt ::= tag_item",
+ /* 345 */ "tag_list_opt ::= tag_list_opt NK_COMMA tag_item",
+ /* 346 */ "tag_item ::= TBNAME",
+ /* 347 */ "tag_item ::= QTAGS",
+ /* 348 */ "tag_item ::= column_name",
+ /* 349 */ "tag_item ::= column_name column_alias",
+ /* 350 */ "tag_item ::= column_name AS column_alias",
+ /* 351 */ "db_kind_opt ::=",
+ /* 352 */ "db_kind_opt ::= USER",
+ /* 353 */ "db_kind_opt ::= SYSTEM",
+ /* 354 */ "cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP",
+ /* 355 */ "cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP",
+ /* 356 */ "cmd ::= DROP TSMA exists_opt full_tsma_name",
+ /* 357 */ "cmd ::= SHOW db_name_cond_opt TSMAS",
+ /* 358 */ "full_tsma_name ::= tsma_name",
+ /* 359 */ "full_tsma_name ::= db_name NK_DOT tsma_name",
+ /* 360 */ "tsma_func_list ::= FUNCTION NK_LP func_list NK_RP",
+ /* 361 */ "cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options",
+ /* 362 */ "cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP",
+ /* 363 */ "cmd ::= DROP INDEX exists_opt full_index_name",
+ /* 364 */ "full_index_name ::= index_name",
+ /* 365 */ "full_index_name ::= db_name NK_DOT index_name",
+ /* 366 */ "index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt",
+ /* 367 */ "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",
+ /* 368 */ "func_list ::= func",
+ /* 369 */ "func_list ::= func_list NK_COMMA func",
+ /* 370 */ "func ::= sma_func_name NK_LP expression_list NK_RP",
+ /* 371 */ "sma_func_name ::= function_name",
+ /* 372 */ "sma_func_name ::= COUNT",
+ /* 373 */ "sma_func_name ::= FIRST",
+ /* 374 */ "sma_func_name ::= LAST",
+ /* 375 */ "sma_func_name ::= LAST_ROW",
+ /* 376 */ "sma_stream_opt ::=",
+ /* 377 */ "sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal",
+ /* 378 */ "sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal",
+ /* 379 */ "sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal",
+ /* 380 */ "with_meta ::= AS",
+ /* 381 */ "with_meta ::= WITH META AS",
+ /* 382 */ "with_meta ::= ONLY META AS",
+ /* 383 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery",
+ /* 384 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name",
+ /* 385 */ "cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt",
+ /* 386 */ "cmd ::= DROP TOPIC exists_opt topic_name",
+ /* 387 */ "cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name",
+ /* 388 */ "cmd ::= DESC full_table_name",
+ /* 389 */ "cmd ::= DESCRIBE full_table_name",
+ /* 390 */ "cmd ::= RESET QUERY CACHE",
+ /* 391 */ "cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery",
+ /* 392 */ "cmd ::= EXPLAIN analyze_opt explain_options insert_query",
+ /* 393 */ "analyze_opt ::=",
+ /* 394 */ "analyze_opt ::= ANALYZE",
+ /* 395 */ "explain_options ::=",
+ /* 396 */ "explain_options ::= explain_options VERBOSE NK_BOOL",
+ /* 397 */ "explain_options ::= explain_options RATIO NK_FLOAT",
+ /* 398 */ "cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt",
+ /* 399 */ "cmd ::= DROP FUNCTION exists_opt function_name",
+ /* 400 */ "agg_func_opt ::=",
+ /* 401 */ "agg_func_opt ::= AGGREGATE",
+ /* 402 */ "bufsize_opt ::=",
+ /* 403 */ "bufsize_opt ::= BUFSIZE NK_INTEGER",
+ /* 404 */ "language_opt ::=",
+ /* 405 */ "language_opt ::= LANGUAGE NK_STRING",
+ /* 406 */ "or_replace_opt ::=",
+ /* 407 */ "or_replace_opt ::= OR REPLACE",
+ /* 408 */ "cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery",
+ /* 409 */ "cmd ::= DROP VIEW exists_opt full_view_name",
+ /* 410 */ "full_view_name ::= view_name",
+ /* 411 */ "full_view_name ::= db_name NK_DOT view_name",
+ /* 412 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery",
+ /* 413 */ "cmd ::= DROP STREAM exists_opt stream_name",
+ /* 414 */ "cmd ::= PAUSE STREAM exists_opt stream_name",
+ /* 415 */ "cmd ::= RESUME STREAM exists_opt ignore_opt stream_name",
+ /* 416 */ "col_list_opt ::=",
+ /* 417 */ "col_list_opt ::= NK_LP column_stream_def_list NK_RP",
+ /* 418 */ "column_stream_def_list ::= column_stream_def",
+ /* 419 */ "column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def",
+ /* 420 */ "column_stream_def ::= column_name stream_col_options",
+ /* 421 */ "stream_col_options ::=",
+ /* 422 */ "stream_col_options ::= stream_col_options PRIMARY KEY",
+ /* 423 */ "tag_def_or_ref_opt ::=",
+ /* 424 */ "tag_def_or_ref_opt ::= tags_def",
+ /* 425 */ "tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP",
+ /* 426 */ "stream_options ::=",
+ /* 427 */ "stream_options ::= stream_options TRIGGER AT_ONCE",
+ /* 428 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE",
+ /* 429 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal",
+ /* 430 */ "stream_options ::= stream_options WATERMARK duration_literal",
+ /* 431 */ "stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER",
+ /* 432 */ "stream_options ::= stream_options FILL_HISTORY NK_INTEGER",
+ /* 433 */ "stream_options ::= stream_options DELETE_MARK duration_literal",
+ /* 434 */ "stream_options ::= stream_options IGNORE UPDATE NK_INTEGER",
+ /* 435 */ "subtable_opt ::=",
+ /* 436 */ "subtable_opt ::= SUBTABLE NK_LP expression NK_RP",
+ /* 437 */ "ignore_opt ::=",
+ /* 438 */ "ignore_opt ::= IGNORE UNTREATED",
+ /* 439 */ "cmd ::= KILL CONNECTION NK_INTEGER",
+ /* 440 */ "cmd ::= KILL QUERY NK_STRING",
+ /* 441 */ "cmd ::= KILL TRANSACTION NK_INTEGER",
+ /* 442 */ "cmd ::= KILL COMPACT NK_INTEGER",
+ /* 443 */ "cmd ::= BALANCE VGROUP",
+ /* 444 */ "cmd ::= BALANCE VGROUP LEADER on_vgroup_id",
+ /* 445 */ "cmd ::= BALANCE VGROUP LEADER DATABASE db_name",
+ /* 446 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER",
+ /* 447 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list",
+ /* 448 */ "cmd ::= SPLIT VGROUP NK_INTEGER",
+ /* 449 */ "on_vgroup_id ::=",
+ /* 450 */ "on_vgroup_id ::= ON NK_INTEGER",
+ /* 451 */ "dnode_list ::= DNODE NK_INTEGER",
+ /* 452 */ "dnode_list ::= dnode_list DNODE NK_INTEGER",
+ /* 453 */ "cmd ::= DELETE FROM full_table_name where_clause_opt",
+ /* 454 */ "cmd ::= query_or_subquery",
+ /* 455 */ "cmd ::= insert_query",
+ /* 456 */ "insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery",
+ /* 457 */ "insert_query ::= INSERT INTO full_table_name query_or_subquery",
+ /* 458 */ "tags_literal ::= NK_INTEGER",
+ /* 459 */ "tags_literal ::= NK_INTEGER NK_PLUS duration_literal",
+ /* 460 */ "tags_literal ::= NK_INTEGER NK_MINUS duration_literal",
+ /* 461 */ "tags_literal ::= NK_PLUS NK_INTEGER",
+ /* 462 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal",
+ /* 463 */ "tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal",
+ /* 464 */ "tags_literal ::= NK_MINUS NK_INTEGER",
+ /* 465 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal",
+ /* 466 */ "tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal",
+ /* 467 */ "tags_literal ::= NK_FLOAT",
+ /* 468 */ "tags_literal ::= NK_PLUS NK_FLOAT",
+ /* 469 */ "tags_literal ::= NK_MINUS NK_FLOAT",
+ /* 470 */ "tags_literal ::= NK_BIN",
+ /* 471 */ "tags_literal ::= NK_BIN NK_PLUS duration_literal",
+ /* 472 */ "tags_literal ::= NK_BIN NK_MINUS duration_literal",
+ /* 473 */ "tags_literal ::= NK_PLUS NK_BIN",
+ /* 474 */ "tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal",
+ /* 475 */ "tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal",
+ /* 476 */ "tags_literal ::= NK_MINUS NK_BIN",
+ /* 477 */ "tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal",
+ /* 478 */ "tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal",
+ /* 479 */ "tags_literal ::= NK_HEX",
+ /* 480 */ "tags_literal ::= NK_HEX NK_PLUS duration_literal",
+ /* 481 */ "tags_literal ::= NK_HEX NK_MINUS duration_literal",
+ /* 482 */ "tags_literal ::= NK_PLUS NK_HEX",
+ /* 483 */ "tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal",
+ /* 484 */ "tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal",
+ /* 485 */ "tags_literal ::= NK_MINUS NK_HEX",
+ /* 486 */ "tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal",
+ /* 487 */ "tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal",
+ /* 488 */ "tags_literal ::= NK_STRING",
+ /* 489 */ "tags_literal ::= NK_STRING NK_PLUS duration_literal",
+ /* 490 */ "tags_literal ::= NK_STRING NK_MINUS duration_literal",
+ /* 491 */ "tags_literal ::= NK_BOOL",
+ /* 492 */ "tags_literal ::= NULL",
+ /* 493 */ "tags_literal ::= literal_func",
+ /* 494 */ "tags_literal ::= literal_func NK_PLUS duration_literal",
+ /* 495 */ "tags_literal ::= literal_func NK_MINUS duration_literal",
+ /* 496 */ "tags_literal_list ::= tags_literal",
+ /* 497 */ "tags_literal_list ::= tags_literal_list NK_COMMA tags_literal",
+ /* 498 */ "literal ::= NK_INTEGER",
+ /* 499 */ "literal ::= NK_FLOAT",
+ /* 500 */ "literal ::= NK_STRING",
+ /* 501 */ "literal ::= NK_BOOL",
+ /* 502 */ "literal ::= TIMESTAMP NK_STRING",
+ /* 503 */ "literal ::= duration_literal",
+ /* 504 */ "literal ::= NULL",
+ /* 505 */ "literal ::= NK_QUESTION",
+ /* 506 */ "duration_literal ::= NK_VARIABLE",
+ /* 507 */ "signed ::= NK_INTEGER",
+ /* 508 */ "signed ::= NK_PLUS NK_INTEGER",
+ /* 509 */ "signed ::= NK_MINUS NK_INTEGER",
+ /* 510 */ "signed ::= NK_FLOAT",
+ /* 511 */ "signed ::= NK_PLUS NK_FLOAT",
+ /* 512 */ "signed ::= NK_MINUS NK_FLOAT",
+ /* 513 */ "signed_literal ::= signed",
+ /* 514 */ "signed_literal ::= NK_STRING",
+ /* 515 */ "signed_literal ::= NK_BOOL",
+ /* 516 */ "signed_literal ::= TIMESTAMP NK_STRING",
+ /* 517 */ "signed_literal ::= duration_literal",
+ /* 518 */ "signed_literal ::= NULL",
+ /* 519 */ "signed_literal ::= literal_func",
+ /* 520 */ "signed_literal ::= NK_QUESTION",
+ /* 521 */ "literal_list ::= signed_literal",
+ /* 522 */ "literal_list ::= literal_list NK_COMMA signed_literal",
+ /* 523 */ "db_name ::= NK_ID",
+ /* 524 */ "table_name ::= NK_ID",
+ /* 525 */ "column_name ::= NK_ID",
+ /* 526 */ "function_name ::= NK_ID",
+ /* 527 */ "view_name ::= NK_ID",
+ /* 528 */ "table_alias ::= NK_ID",
+ /* 529 */ "column_alias ::= NK_ID",
+ /* 530 */ "column_alias ::= NK_ALIAS",
+ /* 531 */ "user_name ::= NK_ID",
+ /* 532 */ "topic_name ::= NK_ID",
+ /* 533 */ "stream_name ::= NK_ID",
+ /* 534 */ "cgroup_name ::= NK_ID",
+ /* 535 */ "index_name ::= NK_ID",
+ /* 536 */ "tsma_name ::= NK_ID",
+ /* 537 */ "expr_or_subquery ::= expression",
+ /* 538 */ "expression ::= literal",
+ /* 539 */ "expression ::= pseudo_column",
+ /* 540 */ "expression ::= column_reference",
+ /* 541 */ "expression ::= function_expression",
+ /* 542 */ "expression ::= case_when_expression",
+ /* 543 */ "expression ::= NK_LP expression NK_RP",
+ /* 544 */ "expression ::= NK_PLUS expr_or_subquery",
+ /* 545 */ "expression ::= NK_MINUS expr_or_subquery",
+ /* 546 */ "expression ::= expr_or_subquery NK_PLUS expr_or_subquery",
+ /* 547 */ "expression ::= expr_or_subquery NK_MINUS expr_or_subquery",
+ /* 548 */ "expression ::= expr_or_subquery NK_STAR expr_or_subquery",
+ /* 549 */ "expression ::= expr_or_subquery NK_SLASH expr_or_subquery",
+ /* 550 */ "expression ::= expr_or_subquery NK_REM expr_or_subquery",
+ /* 551 */ "expression ::= column_reference NK_ARROW NK_STRING",
+ /* 552 */ "expression ::= expr_or_subquery NK_BITAND expr_or_subquery",
+ /* 553 */ "expression ::= expr_or_subquery NK_BITOR expr_or_subquery",
+ /* 554 */ "expression_list ::= expr_or_subquery",
+ /* 555 */ "expression_list ::= expression_list NK_COMMA expr_or_subquery",
+ /* 556 */ "column_reference ::= column_name",
+ /* 557 */ "column_reference ::= table_name NK_DOT column_name",
+ /* 558 */ "column_reference ::= NK_ALIAS",
+ /* 559 */ "column_reference ::= table_name NK_DOT NK_ALIAS",
+ /* 560 */ "pseudo_column ::= ROWTS",
+ /* 561 */ "pseudo_column ::= TBNAME",
+ /* 562 */ "pseudo_column ::= table_name NK_DOT TBNAME",
+ /* 563 */ "pseudo_column ::= QSTART",
+ /* 564 */ "pseudo_column ::= QEND",
+ /* 565 */ "pseudo_column ::= QDURATION",
+ /* 566 */ "pseudo_column ::= WSTART",
+ /* 567 */ "pseudo_column ::= WEND",
+ /* 568 */ "pseudo_column ::= WDURATION",
+ /* 569 */ "pseudo_column ::= IROWTS",
+ /* 570 */ "pseudo_column ::= ISFILLED",
+ /* 571 */ "pseudo_column ::= QTAGS",
+ /* 572 */ "pseudo_column ::= FLOW",
+ /* 573 */ "pseudo_column ::= FHIGH",
+ /* 574 */ "pseudo_column ::= FROWTS",
+ /* 575 */ "function_expression ::= function_name NK_LP expression_list NK_RP",
+ /* 576 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP",
+ /* 577 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP",
+ /* 578 */ "function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP",
+ /* 579 */ "function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP",
+ /* 580 */ "function_expression ::= TRIM NK_LP expr_or_subquery NK_RP",
+ /* 581 */ "function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP",
+ /* 582 */ "function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP",
+ /* 583 */ "function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP",
+ /* 584 */ "function_expression ::= substr_func NK_LP expression_list NK_RP",
+ /* 585 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP",
+ /* 586 */ "function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP",
+ /* 587 */ "function_expression ::= REPLACE NK_LP expression_list NK_RP",
+ /* 588 */ "function_expression ::= literal_func",
+ /* 589 */ "function_expression ::= rand_func",
+ /* 590 */ "literal_func ::= noarg_func NK_LP NK_RP",
+ /* 591 */ "literal_func ::= NOW",
+ /* 592 */ "literal_func ::= TODAY",
+ /* 593 */ "rand_func ::= RAND NK_LP NK_RP",
+ /* 594 */ "rand_func ::= RAND NK_LP expression_list NK_RP",
+ /* 595 */ "substr_func ::= SUBSTR",
+ /* 596 */ "substr_func ::= SUBSTRING",
+ /* 597 */ "trim_specification_type ::= BOTH",
+ /* 598 */ "trim_specification_type ::= TRAILING",
+ /* 599 */ "trim_specification_type ::= LEADING",
+ /* 600 */ "noarg_func ::= NOW",
+ /* 601 */ "noarg_func ::= TODAY",
+ /* 602 */ "noarg_func ::= TIMEZONE",
+ /* 603 */ "noarg_func ::= DATABASE",
+ /* 604 */ "noarg_func ::= CLIENT_VERSION",
+ /* 605 */ "noarg_func ::= SERVER_VERSION",
+ /* 606 */ "noarg_func ::= SERVER_STATUS",
+ /* 607 */ "noarg_func ::= CURRENT_USER",
+ /* 608 */ "noarg_func ::= USER",
+ /* 609 */ "noarg_func ::= PI",
+ /* 610 */ "star_func ::= COUNT",
+ /* 611 */ "star_func ::= FIRST",
+ /* 612 */ "star_func ::= LAST",
+ /* 613 */ "star_func ::= LAST_ROW",
+ /* 614 */ "star_func_para_list ::= NK_STAR",
+ /* 615 */ "star_func_para_list ::= other_para_list",
+ /* 616 */ "other_para_list ::= star_func_para",
+ /* 617 */ "other_para_list ::= other_para_list NK_COMMA star_func_para",
+ /* 618 */ "star_func_para ::= expr_or_subquery",
+ /* 619 */ "star_func_para ::= table_name NK_DOT NK_STAR",
+ /* 620 */ "case_when_expression ::= CASE when_then_list case_when_else_opt END",
+ /* 621 */ "case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END",
+ /* 622 */ "when_then_list ::= when_then_expr",
+ /* 623 */ "when_then_list ::= when_then_list when_then_expr",
+ /* 624 */ "when_then_expr ::= WHEN common_expression THEN common_expression",
+ /* 625 */ "case_when_else_opt ::=",
+ /* 626 */ "case_when_else_opt ::= ELSE common_expression",
+ /* 627 */ "predicate ::= expr_or_subquery compare_op expr_or_subquery",
+ /* 628 */ "predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 629 */ "predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery",
+ /* 630 */ "predicate ::= expr_or_subquery IS NULL",
+ /* 631 */ "predicate ::= expr_or_subquery IS NOT NULL",
+ /* 632 */ "predicate ::= expr_or_subquery in_op in_predicate_value",
+ /* 633 */ "compare_op ::= NK_LT",
+ /* 634 */ "compare_op ::= NK_GT",
+ /* 635 */ "compare_op ::= NK_LE",
+ /* 636 */ "compare_op ::= NK_GE",
+ /* 637 */ "compare_op ::= NK_NE",
+ /* 638 */ "compare_op ::= NK_EQ",
+ /* 639 */ "compare_op ::= LIKE",
+ /* 640 */ "compare_op ::= NOT LIKE",
+ /* 641 */ "compare_op ::= MATCH",
+ /* 642 */ "compare_op ::= NMATCH",
+ /* 643 */ "compare_op ::= CONTAINS",
+ /* 644 */ "in_op ::= IN",
+ /* 645 */ "in_op ::= NOT IN",
+ /* 646 */ "in_predicate_value ::= NK_LP literal_list NK_RP",
+ /* 647 */ "boolean_value_expression ::= boolean_primary",
+ /* 648 */ "boolean_value_expression ::= NOT boolean_primary",
+ /* 649 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression",
+ /* 650 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression",
+ /* 651 */ "boolean_primary ::= predicate",
+ /* 652 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP",
+ /* 653 */ "common_expression ::= expr_or_subquery",
+ /* 654 */ "common_expression ::= boolean_value_expression",
+ /* 655 */ "from_clause_opt ::=",
+ /* 656 */ "from_clause_opt ::= FROM table_reference_list",
+ /* 657 */ "table_reference_list ::= table_reference",
+ /* 658 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference",
+ /* 659 */ "table_reference ::= table_primary",
+ /* 660 */ "table_reference ::= joined_table",
+ /* 661 */ "table_primary ::= table_name alias_opt",
+ /* 662 */ "table_primary ::= db_name NK_DOT table_name alias_opt",
+ /* 663 */ "table_primary ::= subquery alias_opt",
+ /* 664 */ "table_primary ::= parenthesized_joined_table",
+ /* 665 */ "alias_opt ::=",
+ /* 666 */ "alias_opt ::= table_alias",
+ /* 667 */ "alias_opt ::= AS table_alias",
+ /* 668 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP",
+ /* 669 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP",
+ /* 670 */ "joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt",
+ /* 671 */ "join_type ::=",
+ /* 672 */ "join_type ::= INNER",
+ /* 673 */ "join_type ::= LEFT",
+ /* 674 */ "join_type ::= RIGHT",
+ /* 675 */ "join_type ::= FULL",
+ /* 676 */ "join_subtype ::=",
+ /* 677 */ "join_subtype ::= OUTER",
+ /* 678 */ "join_subtype ::= SEMI",
+ /* 679 */ "join_subtype ::= ANTI",
+ /* 680 */ "join_subtype ::= ASOF",
+ /* 681 */ "join_subtype ::= WINDOW",
+ /* 682 */ "join_on_clause_opt ::=",
+ /* 683 */ "join_on_clause_opt ::= ON search_condition",
+ /* 684 */ "window_offset_clause_opt ::=",
+ /* 685 */ "window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP",
+ /* 686 */ "window_offset_literal ::= NK_VARIABLE",
+ /* 687 */ "window_offset_literal ::= NK_MINUS NK_VARIABLE",
+ /* 688 */ "jlimit_clause_opt ::=",
+ /* 689 */ "jlimit_clause_opt ::= JLIMIT NK_INTEGER",
+ /* 690 */ "query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt",
+ /* 691 */ "hint_list ::=",
+ /* 692 */ "hint_list ::= NK_HINT",
+ /* 693 */ "tag_mode_opt ::=",
+ /* 694 */ "tag_mode_opt ::= TAGS",
+ /* 695 */ "set_quantifier_opt ::=",
+ /* 696 */ "set_quantifier_opt ::= DISTINCT",
+ /* 697 */ "set_quantifier_opt ::= ALL",
+ /* 698 */ "select_list ::= select_item",
+ /* 699 */ "select_list ::= select_list NK_COMMA select_item",
+ /* 700 */ "select_item ::= NK_STAR",
+ /* 701 */ "select_item ::= common_expression",
+ /* 702 */ "select_item ::= common_expression column_alias",
+ /* 703 */ "select_item ::= common_expression AS column_alias",
+ /* 704 */ "select_item ::= table_name NK_DOT NK_STAR",
+ /* 705 */ "where_clause_opt ::=",
+ /* 706 */ "where_clause_opt ::= WHERE search_condition",
+ /* 707 */ "partition_by_clause_opt ::=",
+ /* 708 */ "partition_by_clause_opt ::= PARTITION BY partition_list",
+ /* 709 */ "partition_list ::= partition_item",
+ /* 710 */ "partition_list ::= partition_list NK_COMMA partition_item",
+ /* 711 */ "partition_item ::= expr_or_subquery",
+ /* 712 */ "partition_item ::= expr_or_subquery column_alias",
+ /* 713 */ "partition_item ::= expr_or_subquery AS column_alias",
+ /* 714 */ "twindow_clause_opt ::=",
+ /* 715 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP",
+ /* 716 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP",
+ /* 717 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
+ /* 718 */ "twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt",
+ /* 719 */ "twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition",
+ /* 720 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP",
+ /* 721 */ "twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP",
+ /* 722 */ "twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP",
+ /* 723 */ "twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP",
+ /* 724 */ "sliding_opt ::=",
+ /* 725 */ "sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP",
+ /* 726 */ "interval_sliding_duration_literal ::= NK_VARIABLE",
+ /* 727 */ "interval_sliding_duration_literal ::= NK_STRING",
+ /* 728 */ "interval_sliding_duration_literal ::= NK_INTEGER",
+ /* 729 */ "fill_opt ::=",
+ /* 730 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP",
+ /* 731 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP",
+ /* 732 */ "fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP",
+ /* 733 */ "fill_mode ::= NONE",
+ /* 734 */ "fill_mode ::= PREV",
+ /* 735 */ "fill_mode ::= NULL",
+ /* 736 */ "fill_mode ::= NULL_F",
+ /* 737 */ "fill_mode ::= LINEAR",
+ /* 738 */ "fill_mode ::= NEXT",
+ /* 739 */ "group_by_clause_opt ::=",
+ /* 740 */ "group_by_clause_opt ::= GROUP BY group_by_list",
+ /* 741 */ "group_by_list ::= expr_or_subquery",
+ /* 742 */ "group_by_list ::= group_by_list NK_COMMA expr_or_subquery",
+ /* 743 */ "having_clause_opt ::=",
+ /* 744 */ "having_clause_opt ::= HAVING search_condition",
+ /* 745 */ "range_opt ::=",
+ /* 746 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP",
+ /* 747 */ "range_opt ::= RANGE NK_LP expr_or_subquery NK_RP",
+ /* 748 */ "every_opt ::=",
+ /* 749 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP",
+ /* 750 */ "query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt",
+ /* 751 */ "query_simple ::= query_specification",
+ /* 752 */ "query_simple ::= union_query_expression",
+ /* 753 */ "union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery",
+ /* 754 */ "union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery",
+ /* 755 */ "query_simple_or_subquery ::= query_simple",
+ /* 756 */ "query_simple_or_subquery ::= subquery",
+ /* 757 */ "query_or_subquery ::= query_expression",
+ /* 758 */ "query_or_subquery ::= subquery",
+ /* 759 */ "order_by_clause_opt ::=",
+ /* 760 */ "order_by_clause_opt ::= ORDER BY sort_specification_list",
+ /* 761 */ "slimit_clause_opt ::=",
+ /* 762 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER",
+ /* 763 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER",
+ /* 764 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 765 */ "limit_clause_opt ::=",
+ /* 766 */ "limit_clause_opt ::= LIMIT NK_INTEGER",
+ /* 767 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER",
+ /* 768 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER",
+ /* 769 */ "subquery ::= NK_LP query_expression NK_RP",
+ /* 770 */ "subquery ::= NK_LP subquery NK_RP",
+ /* 771 */ "search_condition ::= common_expression",
+ /* 772 */ "sort_specification_list ::= sort_specification",
+ /* 773 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification",
+ /* 774 */ "sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt",
+ /* 775 */ "ordering_specification_opt ::=",
+ /* 776 */ "ordering_specification_opt ::= ASC",
+ /* 777 */ "ordering_specification_opt ::= DESC",
+ /* 778 */ "null_ordering_opt ::=",
+ /* 779 */ "null_ordering_opt ::= NULLS FIRST",
+ /* 780 */ "null_ordering_opt ::= NULLS LAST",
+ /* 781 */ "column_options ::=",
+ /* 782 */ "column_options ::= column_options PRIMARY KEY",
+ /* 783 */ "column_options ::= column_options NK_ID NK_STRING",
};
#endif /* NDEBUG */
@@ -3359,266 +3405,266 @@ static void yy_destructor(
*/
/********* Begin destructor definitions ***************************************/
/* Default NON-TERMINAL Destructor */
- case 383: /* cmd */
- case 386: /* literal */
- case 397: /* with_clause_opt */
- case 403: /* search_condition */
- case 408: /* db_options */
- case 410: /* alter_db_options */
- case 412: /* start_opt */
- case 413: /* end_opt */
- case 417: /* signed */
- case 419: /* retention */
- case 420: /* full_table_name */
- case 423: /* table_options */
- case 429: /* alter_table_clause */
- case 430: /* alter_table_options */
- case 433: /* column_options */
- case 434: /* tags_literal */
- case 435: /* create_subtable_clause */
- case 438: /* drop_table_clause */
- case 441: /* tag_def */
- case 442: /* column_def */
- case 447: /* duration_literal */
- case 448: /* rollup_func_name */
- case 450: /* col_name */
- case 453: /* like_pattern_opt */
- case 454: /* db_name_cond_opt */
- case 455: /* table_name_cond */
- case 456: /* from_db_opt */
- case 458: /* tag_item */
- case 462: /* full_tsma_name */
- case 464: /* index_options */
- case 465: /* full_index_name */
- case 467: /* sliding_opt */
- case 468: /* sma_stream_opt */
- case 469: /* func */
- case 473: /* query_or_subquery */
- case 474: /* where_clause_opt */
- case 477: /* explain_options */
- case 478: /* insert_query */
- case 483: /* full_view_name */
- case 486: /* stream_options */
- case 489: /* subtable_opt */
- case 492: /* column_stream_def */
- case 493: /* stream_col_options */
- case 494: /* expression */
- case 497: /* literal_func */
- case 498: /* signed_literal */
- case 501: /* expr_or_subquery */
- case 502: /* pseudo_column */
- case 503: /* column_reference */
- case 504: /* function_expression */
- case 505: /* case_when_expression */
- case 510: /* rand_func */
- case 513: /* star_func_para */
- case 515: /* case_when_else_opt */
- case 516: /* common_expression */
- case 517: /* when_then_expr */
- case 518: /* predicate */
- case 521: /* in_predicate_value */
- case 522: /* boolean_value_expression */
- case 523: /* boolean_primary */
- case 524: /* from_clause_opt */
- case 525: /* table_reference_list */
- case 526: /* table_reference */
- case 527: /* table_primary */
- case 528: /* joined_table */
- case 530: /* subquery */
- case 531: /* parenthesized_joined_table */
- case 534: /* join_on_clause_opt */
- case 535: /* window_offset_clause_opt */
- case 536: /* jlimit_clause_opt */
- case 537: /* window_offset_literal */
- case 538: /* query_specification */
- case 544: /* range_opt */
- case 545: /* every_opt */
- case 546: /* fill_opt */
- case 547: /* twindow_clause_opt */
- case 549: /* having_clause_opt */
- case 550: /* select_item */
- case 552: /* partition_item */
- case 553: /* interval_sliding_duration_literal */
- case 556: /* query_expression */
- case 557: /* query_simple */
- case 559: /* slimit_clause_opt */
- case 560: /* limit_clause_opt */
- case 561: /* union_query_expression */
- case 562: /* query_simple_or_subquery */
- case 564: /* sort_specification */
+ case 389: /* cmd */
+ case 392: /* literal */
+ case 403: /* with_clause_opt */
+ case 409: /* search_condition */
+ case 414: /* db_options */
+ case 416: /* alter_db_options */
+ case 418: /* start_opt */
+ case 419: /* end_opt */
+ case 423: /* signed */
+ case 425: /* retention */
+ case 426: /* full_table_name */
+ case 429: /* table_options */
+ case 435: /* alter_table_clause */
+ case 436: /* alter_table_options */
+ case 439: /* column_options */
+ case 440: /* tags_literal */
+ case 441: /* create_subtable_clause */
+ case 444: /* drop_table_clause */
+ case 447: /* tag_def */
+ case 448: /* column_def */
+ case 453: /* duration_literal */
+ case 454: /* rollup_func_name */
+ case 456: /* col_name */
+ case 459: /* like_pattern_opt */
+ case 460: /* db_name_cond_opt */
+ case 461: /* table_name_cond */
+ case 462: /* from_db_opt */
+ case 464: /* tag_item */
+ case 468: /* full_tsma_name */
+ case 470: /* index_options */
+ case 471: /* full_index_name */
+ case 473: /* sliding_opt */
+ case 474: /* sma_stream_opt */
+ case 475: /* func */
+ case 479: /* query_or_subquery */
+ case 480: /* where_clause_opt */
+ case 483: /* explain_options */
+ case 484: /* insert_query */
+ case 489: /* full_view_name */
+ case 492: /* stream_options */
+ case 495: /* subtable_opt */
+ case 498: /* column_stream_def */
+ case 499: /* stream_col_options */
+ case 500: /* expression */
+ case 503: /* literal_func */
+ case 504: /* signed_literal */
+ case 507: /* expr_or_subquery */
+ case 508: /* pseudo_column */
+ case 509: /* column_reference */
+ case 510: /* function_expression */
+ case 511: /* case_when_expression */
+ case 516: /* rand_func */
+ case 519: /* star_func_para */
+ case 521: /* case_when_else_opt */
+ case 522: /* common_expression */
+ case 523: /* when_then_expr */
+ case 524: /* predicate */
+ case 527: /* in_predicate_value */
+ case 528: /* boolean_value_expression */
+ case 529: /* boolean_primary */
+ case 530: /* from_clause_opt */
+ case 531: /* table_reference_list */
+ case 532: /* table_reference */
+ case 533: /* table_primary */
+ case 534: /* joined_table */
+ case 536: /* subquery */
+ case 537: /* parenthesized_joined_table */
+ case 540: /* join_on_clause_opt */
+ case 541: /* window_offset_clause_opt */
+ case 542: /* jlimit_clause_opt */
+ case 543: /* window_offset_literal */
+ case 544: /* query_specification */
+ case 550: /* range_opt */
+ case 551: /* every_opt */
+ case 552: /* fill_opt */
+ case 553: /* twindow_clause_opt */
+ case 555: /* having_clause_opt */
+ case 556: /* select_item */
+ case 558: /* partition_item */
+ case 559: /* interval_sliding_duration_literal */
+ case 562: /* query_expression */
+ case 563: /* query_simple */
+ case 565: /* slimit_clause_opt */
+ case 566: /* limit_clause_opt */
+ case 567: /* union_query_expression */
+ case 568: /* query_simple_or_subquery */
+ case 570: /* sort_specification */
{
- nodesDestroyNode((yypminor->yy560));
+ nodesDestroyNode((yypminor->yy974));
}
break;
- case 384: /* account_options */
- case 385: /* alter_account_options */
- case 387: /* alter_account_option */
- case 411: /* speed_opt */
- case 472: /* with_meta */
- case 481: /* bufsize_opt */
+ case 390: /* account_options */
+ case 391: /* alter_account_options */
+ case 393: /* alter_account_option */
+ case 417: /* speed_opt */
+ case 478: /* with_meta */
+ case 487: /* bufsize_opt */
{
}
break;
- case 388: /* ip_range_list */
- case 389: /* white_list */
- case 390: /* white_list_opt */
- case 414: /* integer_list */
- case 415: /* variable_list */
- case 416: /* retention_list */
- case 421: /* column_def_list */
- case 422: /* tags_def_opt */
- case 424: /* multi_create_clause */
- case 425: /* tag_list_opt */
- case 426: /* tags_def */
- case 428: /* multi_drop_clause */
- case 436: /* specific_cols_opt */
- case 437: /* tags_literal_list */
- case 439: /* col_name_list */
- case 440: /* tag_def_list */
- case 444: /* duration_list */
- case 445: /* rollup_func_list */
- case 463: /* func_list */
- case 471: /* expression_list */
- case 487: /* col_list_opt */
- case 488: /* tag_def_or_ref_opt */
- case 491: /* column_stream_def_list */
- case 496: /* dnode_list */
- case 499: /* literal_list */
- case 507: /* star_func_para_list */
- case 512: /* other_para_list */
- case 514: /* when_then_list */
- case 539: /* hint_list */
- case 542: /* select_list */
- case 543: /* partition_by_clause_opt */
- case 548: /* group_by_clause_opt */
- case 551: /* partition_list */
- case 555: /* group_by_list */
- case 558: /* order_by_clause_opt */
- case 563: /* sort_specification_list */
+ case 394: /* ip_range_list */
+ case 395: /* white_list */
+ case 396: /* white_list_opt */
+ case 420: /* integer_list */
+ case 421: /* variable_list */
+ case 422: /* retention_list */
+ case 427: /* column_def_list */
+ case 428: /* tags_def_opt */
+ case 430: /* multi_create_clause */
+ case 431: /* tag_list_opt */
+ case 432: /* tags_def */
+ case 434: /* multi_drop_clause */
+ case 442: /* specific_cols_opt */
+ case 443: /* tags_literal_list */
+ case 445: /* col_name_list */
+ case 446: /* tag_def_list */
+ case 450: /* duration_list */
+ case 451: /* rollup_func_list */
+ case 469: /* func_list */
+ case 477: /* expression_list */
+ case 493: /* col_list_opt */
+ case 494: /* tag_def_or_ref_opt */
+ case 497: /* column_stream_def_list */
+ case 502: /* dnode_list */
+ case 505: /* literal_list */
+ case 513: /* star_func_para_list */
+ case 518: /* other_para_list */
+ case 520: /* when_then_list */
+ case 545: /* hint_list */
+ case 548: /* select_list */
+ case 549: /* partition_by_clause_opt */
+ case 554: /* group_by_clause_opt */
+ case 557: /* partition_list */
+ case 561: /* group_by_list */
+ case 564: /* order_by_clause_opt */
+ case 569: /* sort_specification_list */
{
- nodesDestroyList((yypminor->yy334));
+ nodesDestroyList((yypminor->yy946));
}
break;
- case 391: /* is_import_opt */
- case 392: /* is_createdb_opt */
- case 394: /* sysinfo_opt */
+ case 397: /* is_import_opt */
+ case 398: /* is_createdb_opt */
+ case 400: /* sysinfo_opt */
{
}
break;
- case 393: /* user_name */
- case 400: /* db_name */
- case 401: /* table_name */
- case 402: /* topic_name */
- case 404: /* dnode_endpoint */
- case 431: /* column_name */
- case 449: /* function_name */
- case 459: /* column_alias */
- case 460: /* tsma_name */
- case 466: /* index_name */
- case 470: /* sma_func_name */
- case 475: /* cgroup_name */
- case 482: /* language_opt */
- case 484: /* view_name */
- case 485: /* stream_name */
- case 495: /* on_vgroup_id */
- case 500: /* table_alias */
- case 506: /* star_func */
- case 509: /* substr_func */
- case 511: /* noarg_func */
- case 529: /* alias_opt */
+ case 399: /* user_name */
+ case 406: /* db_name */
+ case 407: /* table_name */
+ case 408: /* topic_name */
+ case 410: /* dnode_endpoint */
+ case 437: /* column_name */
+ case 455: /* function_name */
+ case 465: /* column_alias */
+ case 466: /* tsma_name */
+ case 472: /* index_name */
+ case 476: /* sma_func_name */
+ case 481: /* cgroup_name */
+ case 488: /* language_opt */
+ case 490: /* view_name */
+ case 491: /* stream_name */
+ case 501: /* on_vgroup_id */
+ case 506: /* table_alias */
+ case 512: /* star_func */
+ case 515: /* substr_func */
+ case 517: /* noarg_func */
+ case 535: /* alias_opt */
{
}
break;
- case 395: /* privileges */
- case 398: /* priv_type_list */
- case 399: /* priv_type */
+ case 401: /* privileges */
+ case 404: /* priv_type_list */
+ case 405: /* priv_type */
{
}
break;
- case 396: /* priv_level */
+ case 402: /* priv_level */
{
}
break;
- case 405: /* force_opt */
- case 406: /* unsafe_opt */
- case 407: /* not_exists_opt */
- case 409: /* exists_opt */
- case 427: /* with_opt */
- case 476: /* analyze_opt */
- case 479: /* or_replace_opt */
- case 480: /* agg_func_opt */
- case 490: /* ignore_opt */
- case 540: /* set_quantifier_opt */
- case 541: /* tag_mode_opt */
+ case 411: /* force_opt */
+ case 412: /* unsafe_opt */
+ case 413: /* not_exists_opt */
+ case 415: /* exists_opt */
+ case 433: /* with_opt */
+ case 482: /* analyze_opt */
+ case 485: /* or_replace_opt */
+ case 486: /* agg_func_opt */
+ case 496: /* ignore_opt */
+ case 546: /* set_quantifier_opt */
+ case 547: /* tag_mode_opt */
{
}
break;
- case 418: /* alter_db_option */
- case 446: /* alter_table_option */
+ case 424: /* alter_db_option */
+ case 452: /* alter_table_option */
{
}
break;
- case 432: /* type_name */
- case 443: /* type_name_default_len */
+ case 438: /* type_name */
+ case 449: /* type_name_default_len */
{
}
break;
- case 451: /* db_kind_opt */
- case 457: /* table_kind */
+ case 457: /* db_kind_opt */
+ case 463: /* table_kind */
{
}
break;
- case 452: /* table_kind_db_name_cond_opt */
+ case 458: /* table_kind_db_name_cond_opt */
{
}
break;
- case 461: /* tsma_func_list */
+ case 467: /* tsma_func_list */
{
- nodesDestroyNode((yypminor->yy560));
+ nodesDestroyNode((yypminor->yy974));
}
break;
- case 508: /* trim_specification_type */
+ case 514: /* trim_specification_type */
{
}
break;
- case 519: /* compare_op */
- case 520: /* in_op */
+ case 525: /* compare_op */
+ case 526: /* in_op */
{
}
break;
- case 532: /* join_type */
+ case 538: /* join_type */
{
}
break;
- case 533: /* join_subtype */
+ case 539: /* join_subtype */
{
}
break;
- case 554: /* fill_mode */
+ case 560: /* fill_mode */
{
}
break;
- case 565: /* ordering_specification_opt */
+ case 571: /* ordering_specification_opt */
{
}
break;
- case 566: /* null_ordering_opt */
+ case 572: /* null_ordering_opt */
{
}
@@ -3909,779 +3955,790 @@ static void yy_shift(
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
** of that rule */
static const YYCODETYPE yyRuleInfoLhs[] = {
- 383, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
- 383, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
- 384, /* (2) account_options ::= */
- 384, /* (3) account_options ::= account_options PPS literal */
- 384, /* (4) account_options ::= account_options TSERIES literal */
- 384, /* (5) account_options ::= account_options STORAGE literal */
- 384, /* (6) account_options ::= account_options STREAMS literal */
- 384, /* (7) account_options ::= account_options QTIME literal */
- 384, /* (8) account_options ::= account_options DBS literal */
- 384, /* (9) account_options ::= account_options USERS literal */
- 384, /* (10) account_options ::= account_options CONNS literal */
- 384, /* (11) account_options ::= account_options STATE literal */
- 385, /* (12) alter_account_options ::= alter_account_option */
- 385, /* (13) alter_account_options ::= alter_account_options alter_account_option */
- 387, /* (14) alter_account_option ::= PASS literal */
- 387, /* (15) alter_account_option ::= PPS literal */
- 387, /* (16) alter_account_option ::= TSERIES literal */
- 387, /* (17) alter_account_option ::= STORAGE literal */
- 387, /* (18) alter_account_option ::= STREAMS literal */
- 387, /* (19) alter_account_option ::= QTIME literal */
- 387, /* (20) alter_account_option ::= DBS literal */
- 387, /* (21) alter_account_option ::= USERS literal */
- 387, /* (22) alter_account_option ::= CONNS literal */
- 387, /* (23) alter_account_option ::= STATE literal */
- 388, /* (24) ip_range_list ::= NK_STRING */
- 388, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
- 389, /* (26) white_list ::= HOST ip_range_list */
- 390, /* (27) white_list_opt ::= */
- 390, /* (28) white_list_opt ::= white_list */
- 391, /* (29) is_import_opt ::= */
- 391, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */
- 392, /* (31) is_createdb_opt ::= */
- 392, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */
- 383, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */
- 383, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */
- 383, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
- 383, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
- 383, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */
- 383, /* (38) cmd ::= ALTER USER user_name ADD white_list */
- 383, /* (39) cmd ::= ALTER USER user_name DROP white_list */
- 383, /* (40) cmd ::= DROP USER user_name */
- 394, /* (41) sysinfo_opt ::= */
- 394, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */
- 383, /* (43) cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */
- 383, /* (44) cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */
- 395, /* (45) privileges ::= ALL */
- 395, /* (46) privileges ::= priv_type_list */
- 395, /* (47) privileges ::= SUBSCRIBE */
- 398, /* (48) priv_type_list ::= priv_type */
- 398, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */
- 399, /* (50) priv_type ::= READ */
- 399, /* (51) priv_type ::= WRITE */
- 399, /* (52) priv_type ::= ALTER */
- 396, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */
- 396, /* (54) priv_level ::= db_name NK_DOT NK_STAR */
- 396, /* (55) priv_level ::= db_name NK_DOT table_name */
- 396, /* (56) priv_level ::= topic_name */
- 397, /* (57) with_clause_opt ::= */
- 397, /* (58) with_clause_opt ::= WITH search_condition */
- 383, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */
- 383, /* (60) cmd ::= CREATE DNODE dnode_endpoint */
- 383, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
- 383, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */
- 383, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */
- 383, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
- 383, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
- 383, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
- 383, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
- 383, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */
- 383, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
- 383, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */
- 404, /* (71) dnode_endpoint ::= NK_STRING */
- 404, /* (72) dnode_endpoint ::= NK_ID */
- 404, /* (73) dnode_endpoint ::= NK_IPTOKEN */
- 405, /* (74) force_opt ::= */
- 405, /* (75) force_opt ::= FORCE */
- 406, /* (76) unsafe_opt ::= UNSAFE */
- 383, /* (77) cmd ::= ALTER CLUSTER NK_STRING */
- 383, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
- 383, /* (79) cmd ::= ALTER LOCAL NK_STRING */
- 383, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
- 383, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
- 383, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
- 383, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
- 383, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
- 383, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
- 383, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
- 383, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
- 383, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
- 383, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
- 383, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
- 383, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
- 383, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- 383, /* (93) cmd ::= DROP DATABASE exists_opt db_name */
- 383, /* (94) cmd ::= USE db_name */
- 383, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */
- 383, /* (96) cmd ::= FLUSH DATABASE db_name */
- 383, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */
- 383, /* (98) cmd ::= S3MIGRATE DATABASE db_name */
- 383, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
- 407, /* (100) not_exists_opt ::= IF NOT EXISTS */
- 407, /* (101) not_exists_opt ::= */
- 409, /* (102) exists_opt ::= IF EXISTS */
- 409, /* (103) exists_opt ::= */
- 408, /* (104) db_options ::= */
- 408, /* (105) db_options ::= db_options BUFFER NK_INTEGER */
- 408, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */
- 408, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */
- 408, /* (108) db_options ::= db_options COMP NK_INTEGER */
- 408, /* (109) db_options ::= db_options DURATION NK_INTEGER */
- 408, /* (110) db_options ::= db_options DURATION NK_VARIABLE */
- 408, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */
- 408, /* (112) db_options ::= db_options MINROWS NK_INTEGER */
- 408, /* (113) db_options ::= db_options KEEP integer_list */
- 408, /* (114) db_options ::= db_options KEEP variable_list */
- 408, /* (115) db_options ::= db_options PAGES NK_INTEGER */
- 408, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */
- 408, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
- 408, /* (118) db_options ::= db_options PRECISION NK_STRING */
- 408, /* (119) db_options ::= db_options REPLICA NK_INTEGER */
- 408, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */
- 408, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- 408, /* (122) db_options ::= db_options RETENTIONS retention_list */
- 408, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */
- 408, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */
- 408, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
- 408, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
- 408, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- 408, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
- 408, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- 408, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
- 408, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
- 408, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */
- 408, /* (133) db_options ::= db_options TABLE_PREFIX signed */
- 408, /* (134) db_options ::= db_options TABLE_SUFFIX signed */
- 408, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */
- 408, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */
- 408, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */
- 408, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */
- 408, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
- 408, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */
- 410, /* (141) alter_db_options ::= alter_db_option */
- 410, /* (142) alter_db_options ::= alter_db_options alter_db_option */
- 418, /* (143) alter_db_option ::= BUFFER NK_INTEGER */
- 418, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */
- 418, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */
- 418, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
- 418, /* (147) alter_db_option ::= KEEP integer_list */
- 418, /* (148) alter_db_option ::= KEEP variable_list */
- 418, /* (149) alter_db_option ::= PAGES NK_INTEGER */
- 418, /* (150) alter_db_option ::= REPLICA NK_INTEGER */
- 418, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */
- 418, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */
- 418, /* (153) alter_db_option ::= MINROWS NK_INTEGER */
- 418, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
- 418, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- 418, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
- 418, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- 418, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */
- 418, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */
- 418, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */
- 418, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
- 418, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */
- 414, /* (163) integer_list ::= NK_INTEGER */
- 414, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */
- 415, /* (165) variable_list ::= NK_VARIABLE */
- 415, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- 416, /* (167) retention_list ::= retention */
- 416, /* (168) retention_list ::= retention_list NK_COMMA retention */
- 419, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- 419, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */
- 411, /* (171) speed_opt ::= */
- 411, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */
- 412, /* (173) start_opt ::= */
- 412, /* (174) start_opt ::= START WITH NK_INTEGER */
- 412, /* (175) start_opt ::= START WITH NK_STRING */
- 412, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */
- 413, /* (177) end_opt ::= */
- 413, /* (178) end_opt ::= END WITH NK_INTEGER */
- 413, /* (179) end_opt ::= END WITH NK_STRING */
- 413, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */
- 383, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- 383, /* (182) cmd ::= CREATE TABLE multi_create_clause */
- 383, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */
- 383, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
- 383, /* (185) cmd ::= DROP TABLE with_opt multi_drop_clause */
- 383, /* (186) cmd ::= DROP STABLE with_opt exists_opt full_table_name */
- 383, /* (187) cmd ::= ALTER TABLE alter_table_clause */
- 383, /* (188) cmd ::= ALTER STABLE alter_table_clause */
- 429, /* (189) alter_table_clause ::= full_table_name alter_table_options */
- 429, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */
- 429, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */
- 429, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- 429, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
- 429, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- 429, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- 429, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */
- 429, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- 429, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- 429, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */
- 424, /* (200) multi_create_clause ::= create_subtable_clause */
- 424, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */
- 435, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */
- 428, /* (203) multi_drop_clause ::= drop_table_clause */
- 428, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
- 438, /* (205) drop_table_clause ::= exists_opt full_table_name */
- 427, /* (206) with_opt ::= */
- 427, /* (207) with_opt ::= WITH */
- 436, /* (208) specific_cols_opt ::= */
- 436, /* (209) specific_cols_opt ::= NK_LP col_name_list NK_RP */
- 420, /* (210) full_table_name ::= table_name */
- 420, /* (211) full_table_name ::= db_name NK_DOT table_name */
- 440, /* (212) tag_def_list ::= tag_def */
- 440, /* (213) tag_def_list ::= tag_def_list NK_COMMA tag_def */
- 441, /* (214) tag_def ::= column_name type_name */
- 421, /* (215) column_def_list ::= column_def */
- 421, /* (216) column_def_list ::= column_def_list NK_COMMA column_def */
- 442, /* (217) column_def ::= column_name type_name column_options */
- 432, /* (218) type_name ::= BOOL */
- 432, /* (219) type_name ::= TINYINT */
- 432, /* (220) type_name ::= SMALLINT */
- 432, /* (221) type_name ::= INT */
- 432, /* (222) type_name ::= INTEGER */
- 432, /* (223) type_name ::= BIGINT */
- 432, /* (224) type_name ::= FLOAT */
- 432, /* (225) type_name ::= DOUBLE */
- 432, /* (226) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- 432, /* (227) type_name ::= TIMESTAMP */
- 432, /* (228) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- 432, /* (229) type_name ::= TINYINT UNSIGNED */
- 432, /* (230) type_name ::= SMALLINT UNSIGNED */
- 432, /* (231) type_name ::= INT UNSIGNED */
- 432, /* (232) type_name ::= BIGINT UNSIGNED */
- 432, /* (233) type_name ::= JSON */
- 432, /* (234) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- 432, /* (235) type_name ::= MEDIUMBLOB */
- 432, /* (236) type_name ::= BLOB */
- 432, /* (237) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- 432, /* (238) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
- 432, /* (239) type_name ::= DECIMAL */
- 432, /* (240) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- 432, /* (241) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- 443, /* (242) type_name_default_len ::= BINARY */
- 443, /* (243) type_name_default_len ::= NCHAR */
- 443, /* (244) type_name_default_len ::= VARCHAR */
- 443, /* (245) type_name_default_len ::= VARBINARY */
- 422, /* (246) tags_def_opt ::= */
- 422, /* (247) tags_def_opt ::= tags_def */
- 426, /* (248) tags_def ::= TAGS NK_LP tag_def_list NK_RP */
- 423, /* (249) table_options ::= */
- 423, /* (250) table_options ::= table_options COMMENT NK_STRING */
- 423, /* (251) table_options ::= table_options MAX_DELAY duration_list */
- 423, /* (252) table_options ::= table_options WATERMARK duration_list */
- 423, /* (253) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- 423, /* (254) table_options ::= table_options TTL NK_INTEGER */
- 423, /* (255) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- 423, /* (256) table_options ::= table_options DELETE_MARK duration_list */
- 430, /* (257) alter_table_options ::= alter_table_option */
- 430, /* (258) alter_table_options ::= alter_table_options alter_table_option */
- 446, /* (259) alter_table_option ::= COMMENT NK_STRING */
- 446, /* (260) alter_table_option ::= TTL NK_INTEGER */
- 444, /* (261) duration_list ::= duration_literal */
- 444, /* (262) duration_list ::= duration_list NK_COMMA duration_literal */
- 445, /* (263) rollup_func_list ::= rollup_func_name */
- 445, /* (264) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
- 448, /* (265) rollup_func_name ::= function_name */
- 448, /* (266) rollup_func_name ::= FIRST */
- 448, /* (267) rollup_func_name ::= LAST */
- 439, /* (268) col_name_list ::= col_name */
- 439, /* (269) col_name_list ::= col_name_list NK_COMMA col_name */
- 450, /* (270) col_name ::= column_name */
- 383, /* (271) cmd ::= SHOW DNODES */
- 383, /* (272) cmd ::= SHOW USERS */
- 383, /* (273) cmd ::= SHOW USERS FULL */
- 383, /* (274) cmd ::= SHOW USER PRIVILEGES */
- 383, /* (275) cmd ::= SHOW db_kind_opt DATABASES */
- 383, /* (276) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
- 383, /* (277) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- 383, /* (278) cmd ::= SHOW db_name_cond_opt VGROUPS */
- 383, /* (279) cmd ::= SHOW MNODES */
- 383, /* (280) cmd ::= SHOW QNODES */
- 383, /* (281) cmd ::= SHOW ARBGROUPS */
- 383, /* (282) cmd ::= SHOW FUNCTIONS */
- 383, /* (283) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- 383, /* (284) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
- 383, /* (285) cmd ::= SHOW STREAMS */
- 383, /* (286) cmd ::= SHOW ACCOUNTS */
- 383, /* (287) cmd ::= SHOW APPS */
- 383, /* (288) cmd ::= SHOW CONNECTIONS */
- 383, /* (289) cmd ::= SHOW LICENCES */
- 383, /* (290) cmd ::= SHOW GRANTS */
- 383, /* (291) cmd ::= SHOW GRANTS FULL */
- 383, /* (292) cmd ::= SHOW GRANTS LOGS */
- 383, /* (293) cmd ::= SHOW CLUSTER MACHINES */
- 383, /* (294) cmd ::= SHOW CREATE DATABASE db_name */
- 383, /* (295) cmd ::= SHOW CREATE TABLE full_table_name */
- 383, /* (296) cmd ::= SHOW CREATE STABLE full_table_name */
- 383, /* (297) cmd ::= SHOW ENCRYPTIONS */
- 383, /* (298) cmd ::= SHOW QUERIES */
- 383, /* (299) cmd ::= SHOW SCORES */
- 383, /* (300) cmd ::= SHOW TOPICS */
- 383, /* (301) cmd ::= SHOW VARIABLES */
- 383, /* (302) cmd ::= SHOW CLUSTER VARIABLES */
- 383, /* (303) cmd ::= SHOW LOCAL VARIABLES */
- 383, /* (304) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
- 383, /* (305) cmd ::= SHOW BNODES */
- 383, /* (306) cmd ::= SHOW SNODES */
- 383, /* (307) cmd ::= SHOW CLUSTER */
- 383, /* (308) cmd ::= SHOW TRANSACTIONS */
- 383, /* (309) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- 383, /* (310) cmd ::= SHOW CONSUMERS */
- 383, /* (311) cmd ::= SHOW SUBSCRIPTIONS */
- 383, /* (312) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- 383, /* (313) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
- 383, /* (314) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
- 383, /* (315) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
- 383, /* (316) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
- 383, /* (317) cmd ::= SHOW VNODES */
- 383, /* (318) cmd ::= SHOW db_name_cond_opt ALIVE */
- 383, /* (319) cmd ::= SHOW CLUSTER ALIVE */
- 383, /* (320) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
- 383, /* (321) cmd ::= SHOW CREATE VIEW full_table_name */
- 383, /* (322) cmd ::= SHOW COMPACTS */
- 383, /* (323) cmd ::= SHOW COMPACT NK_INTEGER */
- 452, /* (324) table_kind_db_name_cond_opt ::= */
- 452, /* (325) table_kind_db_name_cond_opt ::= table_kind */
- 452, /* (326) table_kind_db_name_cond_opt ::= db_name NK_DOT */
- 452, /* (327) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
- 457, /* (328) table_kind ::= NORMAL */
- 457, /* (329) table_kind ::= CHILD */
- 454, /* (330) db_name_cond_opt ::= */
- 454, /* (331) db_name_cond_opt ::= db_name NK_DOT */
- 453, /* (332) like_pattern_opt ::= */
- 453, /* (333) like_pattern_opt ::= LIKE NK_STRING */
- 455, /* (334) table_name_cond ::= table_name */
- 456, /* (335) from_db_opt ::= */
- 456, /* (336) from_db_opt ::= FROM db_name */
- 425, /* (337) tag_list_opt ::= */
- 425, /* (338) tag_list_opt ::= tag_item */
- 425, /* (339) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
- 458, /* (340) tag_item ::= TBNAME */
- 458, /* (341) tag_item ::= QTAGS */
- 458, /* (342) tag_item ::= column_name */
- 458, /* (343) tag_item ::= column_name column_alias */
- 458, /* (344) tag_item ::= column_name AS column_alias */
- 451, /* (345) db_kind_opt ::= */
- 451, /* (346) db_kind_opt ::= USER */
- 451, /* (347) db_kind_opt ::= SYSTEM */
- 383, /* (348) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */
- 383, /* (349) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */
- 383, /* (350) cmd ::= DROP TSMA exists_opt full_tsma_name */
- 383, /* (351) cmd ::= SHOW db_name_cond_opt TSMAS */
- 462, /* (352) full_tsma_name ::= tsma_name */
- 462, /* (353) full_tsma_name ::= db_name NK_DOT tsma_name */
- 461, /* (354) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */
- 383, /* (355) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
- 383, /* (356) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
- 383, /* (357) cmd ::= DROP INDEX exists_opt full_index_name */
- 465, /* (358) full_index_name ::= index_name */
- 465, /* (359) full_index_name ::= db_name NK_DOT index_name */
- 464, /* (360) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- 464, /* (361) 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 */
- 463, /* (362) func_list ::= func */
- 463, /* (363) func_list ::= func_list NK_COMMA func */
- 469, /* (364) func ::= sma_func_name NK_LP expression_list NK_RP */
- 470, /* (365) sma_func_name ::= function_name */
- 470, /* (366) sma_func_name ::= COUNT */
- 470, /* (367) sma_func_name ::= FIRST */
- 470, /* (368) sma_func_name ::= LAST */
- 470, /* (369) sma_func_name ::= LAST_ROW */
- 468, /* (370) sma_stream_opt ::= */
- 468, /* (371) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
- 468, /* (372) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
- 468, /* (373) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
- 472, /* (374) with_meta ::= AS */
- 472, /* (375) with_meta ::= WITH META AS */
- 472, /* (376) with_meta ::= ONLY META AS */
- 383, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
- 383, /* (378) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
- 383, /* (379) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
- 383, /* (380) cmd ::= DROP TOPIC exists_opt topic_name */
- 383, /* (381) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- 383, /* (382) cmd ::= DESC full_table_name */
- 383, /* (383) cmd ::= DESCRIBE full_table_name */
- 383, /* (384) cmd ::= RESET QUERY CACHE */
- 383, /* (385) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- 383, /* (386) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
- 476, /* (387) analyze_opt ::= */
- 476, /* (388) analyze_opt ::= ANALYZE */
- 477, /* (389) explain_options ::= */
- 477, /* (390) explain_options ::= explain_options VERBOSE NK_BOOL */
- 477, /* (391) explain_options ::= explain_options RATIO NK_FLOAT */
- 383, /* (392) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
- 383, /* (393) cmd ::= DROP FUNCTION exists_opt function_name */
- 480, /* (394) agg_func_opt ::= */
- 480, /* (395) agg_func_opt ::= AGGREGATE */
- 481, /* (396) bufsize_opt ::= */
- 481, /* (397) bufsize_opt ::= BUFSIZE NK_INTEGER */
- 482, /* (398) language_opt ::= */
- 482, /* (399) language_opt ::= LANGUAGE NK_STRING */
- 479, /* (400) or_replace_opt ::= */
- 479, /* (401) or_replace_opt ::= OR REPLACE */
- 383, /* (402) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
- 383, /* (403) cmd ::= DROP VIEW exists_opt full_view_name */
- 483, /* (404) full_view_name ::= view_name */
- 483, /* (405) full_view_name ::= db_name NK_DOT view_name */
- 383, /* (406) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
- 383, /* (407) cmd ::= DROP STREAM exists_opt stream_name */
- 383, /* (408) cmd ::= PAUSE STREAM exists_opt stream_name */
- 383, /* (409) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
- 487, /* (410) col_list_opt ::= */
- 487, /* (411) col_list_opt ::= NK_LP column_stream_def_list NK_RP */
- 491, /* (412) column_stream_def_list ::= column_stream_def */
- 491, /* (413) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */
- 492, /* (414) column_stream_def ::= column_name stream_col_options */
- 493, /* (415) stream_col_options ::= */
- 493, /* (416) stream_col_options ::= stream_col_options PRIMARY KEY */
- 488, /* (417) tag_def_or_ref_opt ::= */
- 488, /* (418) tag_def_or_ref_opt ::= tags_def */
- 488, /* (419) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */
- 486, /* (420) stream_options ::= */
- 486, /* (421) stream_options ::= stream_options TRIGGER AT_ONCE */
- 486, /* (422) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- 486, /* (423) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- 486, /* (424) stream_options ::= stream_options WATERMARK duration_literal */
- 486, /* (425) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- 486, /* (426) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
- 486, /* (427) stream_options ::= stream_options DELETE_MARK duration_literal */
- 486, /* (428) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
- 489, /* (429) subtable_opt ::= */
- 489, /* (430) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- 490, /* (431) ignore_opt ::= */
- 490, /* (432) ignore_opt ::= IGNORE UNTREATED */
- 383, /* (433) cmd ::= KILL CONNECTION NK_INTEGER */
- 383, /* (434) cmd ::= KILL QUERY NK_STRING */
- 383, /* (435) cmd ::= KILL TRANSACTION NK_INTEGER */
- 383, /* (436) cmd ::= KILL COMPACT NK_INTEGER */
- 383, /* (437) cmd ::= BALANCE VGROUP */
- 383, /* (438) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
- 383, /* (439) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */
- 383, /* (440) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- 383, /* (441) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- 383, /* (442) cmd ::= SPLIT VGROUP NK_INTEGER */
- 495, /* (443) on_vgroup_id ::= */
- 495, /* (444) on_vgroup_id ::= ON NK_INTEGER */
- 496, /* (445) dnode_list ::= DNODE NK_INTEGER */
- 496, /* (446) dnode_list ::= dnode_list DNODE NK_INTEGER */
- 383, /* (447) cmd ::= DELETE FROM full_table_name where_clause_opt */
- 383, /* (448) cmd ::= query_or_subquery */
- 383, /* (449) cmd ::= insert_query */
- 478, /* (450) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- 478, /* (451) insert_query ::= INSERT INTO full_table_name query_or_subquery */
- 434, /* (452) tags_literal ::= NK_INTEGER */
- 434, /* (453) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */
- 434, /* (454) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */
- 434, /* (455) tags_literal ::= NK_PLUS NK_INTEGER */
- 434, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */
- 434, /* (457) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */
- 434, /* (458) tags_literal ::= NK_MINUS NK_INTEGER */
- 434, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */
- 434, /* (460) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */
- 434, /* (461) tags_literal ::= NK_FLOAT */
- 434, /* (462) tags_literal ::= NK_PLUS NK_FLOAT */
- 434, /* (463) tags_literal ::= NK_MINUS NK_FLOAT */
- 434, /* (464) tags_literal ::= NK_BIN */
- 434, /* (465) tags_literal ::= NK_BIN NK_PLUS duration_literal */
- 434, /* (466) tags_literal ::= NK_BIN NK_MINUS duration_literal */
- 434, /* (467) tags_literal ::= NK_PLUS NK_BIN */
- 434, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */
- 434, /* (469) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */
- 434, /* (470) tags_literal ::= NK_MINUS NK_BIN */
- 434, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */
- 434, /* (472) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */
- 434, /* (473) tags_literal ::= NK_HEX */
- 434, /* (474) tags_literal ::= NK_HEX NK_PLUS duration_literal */
- 434, /* (475) tags_literal ::= NK_HEX NK_MINUS duration_literal */
- 434, /* (476) tags_literal ::= NK_PLUS NK_HEX */
- 434, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */
- 434, /* (478) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */
- 434, /* (479) tags_literal ::= NK_MINUS NK_HEX */
- 434, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */
- 434, /* (481) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */
- 434, /* (482) tags_literal ::= NK_STRING */
- 434, /* (483) tags_literal ::= NK_STRING NK_PLUS duration_literal */
- 434, /* (484) tags_literal ::= NK_STRING NK_MINUS duration_literal */
- 434, /* (485) tags_literal ::= NK_BOOL */
- 434, /* (486) tags_literal ::= NULL */
- 434, /* (487) tags_literal ::= literal_func */
- 434, /* (488) tags_literal ::= literal_func NK_PLUS duration_literal */
- 434, /* (489) tags_literal ::= literal_func NK_MINUS duration_literal */
- 437, /* (490) tags_literal_list ::= tags_literal */
- 437, /* (491) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */
- 386, /* (492) literal ::= NK_INTEGER */
- 386, /* (493) literal ::= NK_FLOAT */
- 386, /* (494) literal ::= NK_STRING */
- 386, /* (495) literal ::= NK_BOOL */
- 386, /* (496) literal ::= TIMESTAMP NK_STRING */
- 386, /* (497) literal ::= duration_literal */
- 386, /* (498) literal ::= NULL */
- 386, /* (499) literal ::= NK_QUESTION */
- 447, /* (500) duration_literal ::= NK_VARIABLE */
- 417, /* (501) signed ::= NK_INTEGER */
- 417, /* (502) signed ::= NK_PLUS NK_INTEGER */
- 417, /* (503) signed ::= NK_MINUS NK_INTEGER */
- 417, /* (504) signed ::= NK_FLOAT */
- 417, /* (505) signed ::= NK_PLUS NK_FLOAT */
- 417, /* (506) signed ::= NK_MINUS NK_FLOAT */
- 498, /* (507) signed_literal ::= signed */
- 498, /* (508) signed_literal ::= NK_STRING */
- 498, /* (509) signed_literal ::= NK_BOOL */
- 498, /* (510) signed_literal ::= TIMESTAMP NK_STRING */
- 498, /* (511) signed_literal ::= duration_literal */
- 498, /* (512) signed_literal ::= NULL */
- 498, /* (513) signed_literal ::= literal_func */
- 498, /* (514) signed_literal ::= NK_QUESTION */
- 499, /* (515) literal_list ::= signed_literal */
- 499, /* (516) literal_list ::= literal_list NK_COMMA signed_literal */
- 400, /* (517) db_name ::= NK_ID */
- 401, /* (518) table_name ::= NK_ID */
- 431, /* (519) column_name ::= NK_ID */
- 449, /* (520) function_name ::= NK_ID */
- 484, /* (521) view_name ::= NK_ID */
- 500, /* (522) table_alias ::= NK_ID */
- 459, /* (523) column_alias ::= NK_ID */
- 459, /* (524) column_alias ::= NK_ALIAS */
- 393, /* (525) user_name ::= NK_ID */
- 402, /* (526) topic_name ::= NK_ID */
- 485, /* (527) stream_name ::= NK_ID */
- 475, /* (528) cgroup_name ::= NK_ID */
- 466, /* (529) index_name ::= NK_ID */
- 460, /* (530) tsma_name ::= NK_ID */
- 501, /* (531) expr_or_subquery ::= expression */
- 494, /* (532) expression ::= literal */
- 494, /* (533) expression ::= pseudo_column */
- 494, /* (534) expression ::= column_reference */
- 494, /* (535) expression ::= function_expression */
- 494, /* (536) expression ::= case_when_expression */
- 494, /* (537) expression ::= NK_LP expression NK_RP */
- 494, /* (538) expression ::= NK_PLUS expr_or_subquery */
- 494, /* (539) expression ::= NK_MINUS expr_or_subquery */
- 494, /* (540) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
- 494, /* (541) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
- 494, /* (542) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
- 494, /* (543) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
- 494, /* (544) expression ::= expr_or_subquery NK_REM expr_or_subquery */
- 494, /* (545) expression ::= column_reference NK_ARROW NK_STRING */
- 494, /* (546) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
- 494, /* (547) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
- 471, /* (548) expression_list ::= expr_or_subquery */
- 471, /* (549) expression_list ::= expression_list NK_COMMA expr_or_subquery */
- 503, /* (550) column_reference ::= column_name */
- 503, /* (551) column_reference ::= table_name NK_DOT column_name */
- 503, /* (552) column_reference ::= NK_ALIAS */
- 503, /* (553) column_reference ::= table_name NK_DOT NK_ALIAS */
- 502, /* (554) pseudo_column ::= ROWTS */
- 502, /* (555) pseudo_column ::= TBNAME */
- 502, /* (556) pseudo_column ::= table_name NK_DOT TBNAME */
- 502, /* (557) pseudo_column ::= QSTART */
- 502, /* (558) pseudo_column ::= QEND */
- 502, /* (559) pseudo_column ::= QDURATION */
- 502, /* (560) pseudo_column ::= WSTART */
- 502, /* (561) pseudo_column ::= WEND */
- 502, /* (562) pseudo_column ::= WDURATION */
- 502, /* (563) pseudo_column ::= IROWTS */
- 502, /* (564) pseudo_column ::= ISFILLED */
- 502, /* (565) pseudo_column ::= QTAGS */
- 504, /* (566) function_expression ::= function_name NK_LP expression_list NK_RP */
- 504, /* (567) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- 504, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
- 504, /* (569) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */
- 504, /* (570) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */
- 504, /* (571) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */
- 504, /* (572) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */
- 504, /* (573) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
- 504, /* (574) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */
- 504, /* (575) function_expression ::= substr_func NK_LP expression_list NK_RP */
- 504, /* (576) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
- 504, /* (577) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */
- 504, /* (578) function_expression ::= REPLACE NK_LP expression_list NK_RP */
- 504, /* (579) function_expression ::= literal_func */
- 504, /* (580) function_expression ::= rand_func */
- 497, /* (581) literal_func ::= noarg_func NK_LP NK_RP */
- 497, /* (582) literal_func ::= NOW */
- 497, /* (583) literal_func ::= TODAY */
- 510, /* (584) rand_func ::= RAND NK_LP NK_RP */
- 510, /* (585) rand_func ::= RAND NK_LP expression_list NK_RP */
- 509, /* (586) substr_func ::= SUBSTR */
- 509, /* (587) substr_func ::= SUBSTRING */
- 508, /* (588) trim_specification_type ::= BOTH */
- 508, /* (589) trim_specification_type ::= TRAILING */
- 508, /* (590) trim_specification_type ::= LEADING */
- 511, /* (591) noarg_func ::= NOW */
- 511, /* (592) noarg_func ::= TODAY */
- 511, /* (593) noarg_func ::= TIMEZONE */
- 511, /* (594) noarg_func ::= DATABASE */
- 511, /* (595) noarg_func ::= CLIENT_VERSION */
- 511, /* (596) noarg_func ::= SERVER_VERSION */
- 511, /* (597) noarg_func ::= SERVER_STATUS */
- 511, /* (598) noarg_func ::= CURRENT_USER */
- 511, /* (599) noarg_func ::= USER */
- 511, /* (600) noarg_func ::= PI */
- 506, /* (601) star_func ::= COUNT */
- 506, /* (602) star_func ::= FIRST */
- 506, /* (603) star_func ::= LAST */
- 506, /* (604) star_func ::= LAST_ROW */
- 507, /* (605) star_func_para_list ::= NK_STAR */
- 507, /* (606) star_func_para_list ::= other_para_list */
- 512, /* (607) other_para_list ::= star_func_para */
- 512, /* (608) other_para_list ::= other_para_list NK_COMMA star_func_para */
- 513, /* (609) star_func_para ::= expr_or_subquery */
- 513, /* (610) star_func_para ::= table_name NK_DOT NK_STAR */
- 505, /* (611) case_when_expression ::= CASE when_then_list case_when_else_opt END */
- 505, /* (612) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- 514, /* (613) when_then_list ::= when_then_expr */
- 514, /* (614) when_then_list ::= when_then_list when_then_expr */
- 517, /* (615) when_then_expr ::= WHEN common_expression THEN common_expression */
- 515, /* (616) case_when_else_opt ::= */
- 515, /* (617) case_when_else_opt ::= ELSE common_expression */
- 518, /* (618) predicate ::= expr_or_subquery compare_op expr_or_subquery */
- 518, /* (619) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
- 518, /* (620) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
- 518, /* (621) predicate ::= expr_or_subquery IS NULL */
- 518, /* (622) predicate ::= expr_or_subquery IS NOT NULL */
- 518, /* (623) predicate ::= expr_or_subquery in_op in_predicate_value */
- 519, /* (624) compare_op ::= NK_LT */
- 519, /* (625) compare_op ::= NK_GT */
- 519, /* (626) compare_op ::= NK_LE */
- 519, /* (627) compare_op ::= NK_GE */
- 519, /* (628) compare_op ::= NK_NE */
- 519, /* (629) compare_op ::= NK_EQ */
- 519, /* (630) compare_op ::= LIKE */
- 519, /* (631) compare_op ::= NOT LIKE */
- 519, /* (632) compare_op ::= MATCH */
- 519, /* (633) compare_op ::= NMATCH */
- 519, /* (634) compare_op ::= CONTAINS */
- 520, /* (635) in_op ::= IN */
- 520, /* (636) in_op ::= NOT IN */
- 521, /* (637) in_predicate_value ::= NK_LP literal_list NK_RP */
- 522, /* (638) boolean_value_expression ::= boolean_primary */
- 522, /* (639) boolean_value_expression ::= NOT boolean_primary */
- 522, /* (640) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- 522, /* (641) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- 523, /* (642) boolean_primary ::= predicate */
- 523, /* (643) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- 516, /* (644) common_expression ::= expr_or_subquery */
- 516, /* (645) common_expression ::= boolean_value_expression */
- 524, /* (646) from_clause_opt ::= */
- 524, /* (647) from_clause_opt ::= FROM table_reference_list */
- 525, /* (648) table_reference_list ::= table_reference */
- 525, /* (649) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- 526, /* (650) table_reference ::= table_primary */
- 526, /* (651) table_reference ::= joined_table */
- 527, /* (652) table_primary ::= table_name alias_opt */
- 527, /* (653) table_primary ::= db_name NK_DOT table_name alias_opt */
- 527, /* (654) table_primary ::= subquery alias_opt */
- 527, /* (655) table_primary ::= parenthesized_joined_table */
- 529, /* (656) alias_opt ::= */
- 529, /* (657) alias_opt ::= table_alias */
- 529, /* (658) alias_opt ::= AS table_alias */
- 531, /* (659) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- 531, /* (660) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- 528, /* (661) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
- 532, /* (662) join_type ::= */
- 532, /* (663) join_type ::= INNER */
- 532, /* (664) join_type ::= LEFT */
- 532, /* (665) join_type ::= RIGHT */
- 532, /* (666) join_type ::= FULL */
- 533, /* (667) join_subtype ::= */
- 533, /* (668) join_subtype ::= OUTER */
- 533, /* (669) join_subtype ::= SEMI */
- 533, /* (670) join_subtype ::= ANTI */
- 533, /* (671) join_subtype ::= ASOF */
- 533, /* (672) join_subtype ::= WINDOW */
- 534, /* (673) join_on_clause_opt ::= */
- 534, /* (674) join_on_clause_opt ::= ON search_condition */
- 535, /* (675) window_offset_clause_opt ::= */
- 535, /* (676) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
- 537, /* (677) window_offset_literal ::= NK_VARIABLE */
- 537, /* (678) window_offset_literal ::= NK_MINUS NK_VARIABLE */
- 536, /* (679) jlimit_clause_opt ::= */
- 536, /* (680) jlimit_clause_opt ::= JLIMIT NK_INTEGER */
- 538, /* (681) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
- 539, /* (682) hint_list ::= */
- 539, /* (683) hint_list ::= NK_HINT */
- 541, /* (684) tag_mode_opt ::= */
- 541, /* (685) tag_mode_opt ::= TAGS */
- 540, /* (686) set_quantifier_opt ::= */
- 540, /* (687) set_quantifier_opt ::= DISTINCT */
- 540, /* (688) set_quantifier_opt ::= ALL */
- 542, /* (689) select_list ::= select_item */
- 542, /* (690) select_list ::= select_list NK_COMMA select_item */
- 550, /* (691) select_item ::= NK_STAR */
- 550, /* (692) select_item ::= common_expression */
- 550, /* (693) select_item ::= common_expression column_alias */
- 550, /* (694) select_item ::= common_expression AS column_alias */
- 550, /* (695) select_item ::= table_name NK_DOT NK_STAR */
- 474, /* (696) where_clause_opt ::= */
- 474, /* (697) where_clause_opt ::= WHERE search_condition */
- 543, /* (698) partition_by_clause_opt ::= */
- 543, /* (699) partition_by_clause_opt ::= PARTITION BY partition_list */
- 551, /* (700) partition_list ::= partition_item */
- 551, /* (701) partition_list ::= partition_list NK_COMMA partition_item */
- 552, /* (702) partition_item ::= expr_or_subquery */
- 552, /* (703) partition_item ::= expr_or_subquery column_alias */
- 552, /* (704) partition_item ::= expr_or_subquery AS column_alias */
- 547, /* (705) twindow_clause_opt ::= */
- 547, /* (706) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
- 547, /* (707) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- 547, /* (708) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- 547, /* (709) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- 547, /* (710) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
- 547, /* (711) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
- 547, /* (712) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- 467, /* (713) sliding_opt ::= */
- 467, /* (714) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
- 553, /* (715) interval_sliding_duration_literal ::= NK_VARIABLE */
- 553, /* (716) interval_sliding_duration_literal ::= NK_STRING */
- 553, /* (717) interval_sliding_duration_literal ::= NK_INTEGER */
- 546, /* (718) fill_opt ::= */
- 546, /* (719) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- 546, /* (720) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
- 546, /* (721) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
- 554, /* (722) fill_mode ::= NONE */
- 554, /* (723) fill_mode ::= PREV */
- 554, /* (724) fill_mode ::= NULL */
- 554, /* (725) fill_mode ::= NULL_F */
- 554, /* (726) fill_mode ::= LINEAR */
- 554, /* (727) fill_mode ::= NEXT */
- 548, /* (728) group_by_clause_opt ::= */
- 548, /* (729) group_by_clause_opt ::= GROUP BY group_by_list */
- 555, /* (730) group_by_list ::= expr_or_subquery */
- 555, /* (731) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- 549, /* (732) having_clause_opt ::= */
- 549, /* (733) having_clause_opt ::= HAVING search_condition */
- 544, /* (734) range_opt ::= */
- 544, /* (735) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- 544, /* (736) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
- 545, /* (737) every_opt ::= */
- 545, /* (738) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- 556, /* (739) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- 557, /* (740) query_simple ::= query_specification */
- 557, /* (741) query_simple ::= union_query_expression */
- 561, /* (742) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- 561, /* (743) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- 562, /* (744) query_simple_or_subquery ::= query_simple */
- 562, /* (745) query_simple_or_subquery ::= subquery */
- 473, /* (746) query_or_subquery ::= query_expression */
- 473, /* (747) query_or_subquery ::= subquery */
- 558, /* (748) order_by_clause_opt ::= */
- 558, /* (749) order_by_clause_opt ::= ORDER BY sort_specification_list */
- 559, /* (750) slimit_clause_opt ::= */
- 559, /* (751) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- 559, /* (752) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- 559, /* (753) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- 560, /* (754) limit_clause_opt ::= */
- 560, /* (755) limit_clause_opt ::= LIMIT NK_INTEGER */
- 560, /* (756) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- 560, /* (757) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- 530, /* (758) subquery ::= NK_LP query_expression NK_RP */
- 530, /* (759) subquery ::= NK_LP subquery NK_RP */
- 403, /* (760) search_condition ::= common_expression */
- 563, /* (761) sort_specification_list ::= sort_specification */
- 563, /* (762) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- 564, /* (763) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- 565, /* (764) ordering_specification_opt ::= */
- 565, /* (765) ordering_specification_opt ::= ASC */
- 565, /* (766) ordering_specification_opt ::= DESC */
- 566, /* (767) null_ordering_opt ::= */
- 566, /* (768) null_ordering_opt ::= NULLS FIRST */
- 566, /* (769) null_ordering_opt ::= NULLS LAST */
- 433, /* (770) column_options ::= */
- 433, /* (771) column_options ::= column_options PRIMARY KEY */
- 433, /* (772) column_options ::= column_options NK_ID NK_STRING */
+ 389, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
+ 389, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
+ 390, /* (2) account_options ::= */
+ 390, /* (3) account_options ::= account_options PPS literal */
+ 390, /* (4) account_options ::= account_options TSERIES literal */
+ 390, /* (5) account_options ::= account_options STORAGE literal */
+ 390, /* (6) account_options ::= account_options STREAMS literal */
+ 390, /* (7) account_options ::= account_options QTIME literal */
+ 390, /* (8) account_options ::= account_options DBS literal */
+ 390, /* (9) account_options ::= account_options USERS literal */
+ 390, /* (10) account_options ::= account_options CONNS literal */
+ 390, /* (11) account_options ::= account_options STATE literal */
+ 391, /* (12) alter_account_options ::= alter_account_option */
+ 391, /* (13) alter_account_options ::= alter_account_options alter_account_option */
+ 393, /* (14) alter_account_option ::= PASS literal */
+ 393, /* (15) alter_account_option ::= PPS literal */
+ 393, /* (16) alter_account_option ::= TSERIES literal */
+ 393, /* (17) alter_account_option ::= STORAGE literal */
+ 393, /* (18) alter_account_option ::= STREAMS literal */
+ 393, /* (19) alter_account_option ::= QTIME literal */
+ 393, /* (20) alter_account_option ::= DBS literal */
+ 393, /* (21) alter_account_option ::= USERS literal */
+ 393, /* (22) alter_account_option ::= CONNS literal */
+ 393, /* (23) alter_account_option ::= STATE literal */
+ 394, /* (24) ip_range_list ::= NK_STRING */
+ 394, /* (25) ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
+ 395, /* (26) white_list ::= HOST ip_range_list */
+ 396, /* (27) white_list_opt ::= */
+ 396, /* (28) white_list_opt ::= white_list */
+ 397, /* (29) is_import_opt ::= */
+ 397, /* (30) is_import_opt ::= IS_IMPORT NK_INTEGER */
+ 398, /* (31) is_createdb_opt ::= */
+ 398, /* (32) is_createdb_opt ::= CREATEDB NK_INTEGER */
+ 389, /* (33) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */
+ 389, /* (34) cmd ::= ALTER USER user_name PASS NK_STRING */
+ 389, /* (35) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
+ 389, /* (36) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
+ 389, /* (37) cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */
+ 389, /* (38) cmd ::= ALTER USER user_name ADD white_list */
+ 389, /* (39) cmd ::= ALTER USER user_name DROP white_list */
+ 389, /* (40) cmd ::= DROP USER user_name */
+ 400, /* (41) sysinfo_opt ::= */
+ 400, /* (42) sysinfo_opt ::= SYSINFO NK_INTEGER */
+ 389, /* (43) cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */
+ 389, /* (44) cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */
+ 401, /* (45) privileges ::= ALL */
+ 401, /* (46) privileges ::= priv_type_list */
+ 401, /* (47) privileges ::= SUBSCRIBE */
+ 404, /* (48) priv_type_list ::= priv_type */
+ 404, /* (49) priv_type_list ::= priv_type_list NK_COMMA priv_type */
+ 405, /* (50) priv_type ::= READ */
+ 405, /* (51) priv_type ::= WRITE */
+ 405, /* (52) priv_type ::= ALTER */
+ 402, /* (53) priv_level ::= NK_STAR NK_DOT NK_STAR */
+ 402, /* (54) priv_level ::= db_name NK_DOT NK_STAR */
+ 402, /* (55) priv_level ::= db_name NK_DOT table_name */
+ 402, /* (56) priv_level ::= topic_name */
+ 403, /* (57) with_clause_opt ::= */
+ 403, /* (58) with_clause_opt ::= WITH search_condition */
+ 389, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */
+ 389, /* (60) cmd ::= CREATE ANODE NK_STRING */
+ 389, /* (61) cmd ::= UPDATE ANODE NK_INTEGER */
+ 389, /* (62) cmd ::= UPDATE ALL ANODES */
+ 389, /* (63) cmd ::= DROP ANODE NK_INTEGER */
+ 389, /* (64) cmd ::= CREATE DNODE dnode_endpoint */
+ 389, /* (65) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+ 389, /* (66) cmd ::= DROP DNODE NK_INTEGER force_opt */
+ 389, /* (67) cmd ::= DROP DNODE dnode_endpoint force_opt */
+ 389, /* (68) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
+ 389, /* (69) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
+ 389, /* (70) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ 389, /* (71) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ 389, /* (72) cmd ::= ALTER ALL DNODES NK_STRING */
+ 389, /* (73) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ 389, /* (74) cmd ::= RESTORE DNODE NK_INTEGER */
+ 410, /* (75) dnode_endpoint ::= NK_STRING */
+ 410, /* (76) dnode_endpoint ::= NK_ID */
+ 410, /* (77) dnode_endpoint ::= NK_IPTOKEN */
+ 411, /* (78) force_opt ::= */
+ 411, /* (79) force_opt ::= FORCE */
+ 412, /* (80) unsafe_opt ::= UNSAFE */
+ 389, /* (81) cmd ::= ALTER CLUSTER NK_STRING */
+ 389, /* (82) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
+ 389, /* (83) cmd ::= ALTER LOCAL NK_STRING */
+ 389, /* (84) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ 389, /* (85) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ 389, /* (86) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ 389, /* (87) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
+ 389, /* (88) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ 389, /* (89) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ 389, /* (90) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ 389, /* (91) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ 389, /* (92) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ 389, /* (93) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ 389, /* (94) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
+ 389, /* (95) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
+ 389, /* (96) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ 389, /* (97) cmd ::= DROP DATABASE exists_opt db_name */
+ 389, /* (98) cmd ::= USE db_name */
+ 389, /* (99) cmd ::= ALTER DATABASE db_name alter_db_options */
+ 389, /* (100) cmd ::= FLUSH DATABASE db_name */
+ 389, /* (101) cmd ::= TRIM DATABASE db_name speed_opt */
+ 389, /* (102) cmd ::= S3MIGRATE DATABASE db_name */
+ 389, /* (103) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
+ 413, /* (104) not_exists_opt ::= IF NOT EXISTS */
+ 413, /* (105) not_exists_opt ::= */
+ 415, /* (106) exists_opt ::= IF EXISTS */
+ 415, /* (107) exists_opt ::= */
+ 414, /* (108) db_options ::= */
+ 414, /* (109) db_options ::= db_options BUFFER NK_INTEGER */
+ 414, /* (110) db_options ::= db_options CACHEMODEL NK_STRING */
+ 414, /* (111) db_options ::= db_options CACHESIZE NK_INTEGER */
+ 414, /* (112) db_options ::= db_options COMP NK_INTEGER */
+ 414, /* (113) db_options ::= db_options DURATION NK_INTEGER */
+ 414, /* (114) db_options ::= db_options DURATION NK_VARIABLE */
+ 414, /* (115) db_options ::= db_options MAXROWS NK_INTEGER */
+ 414, /* (116) db_options ::= db_options MINROWS NK_INTEGER */
+ 414, /* (117) db_options ::= db_options KEEP integer_list */
+ 414, /* (118) db_options ::= db_options KEEP variable_list */
+ 414, /* (119) db_options ::= db_options PAGES NK_INTEGER */
+ 414, /* (120) db_options ::= db_options PAGESIZE NK_INTEGER */
+ 414, /* (121) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+ 414, /* (122) db_options ::= db_options PRECISION NK_STRING */
+ 414, /* (123) db_options ::= db_options REPLICA NK_INTEGER */
+ 414, /* (124) db_options ::= db_options VGROUPS NK_INTEGER */
+ 414, /* (125) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ 414, /* (126) db_options ::= db_options RETENTIONS retention_list */
+ 414, /* (127) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ 414, /* (128) db_options ::= db_options WAL_LEVEL NK_INTEGER */
+ 414, /* (129) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+ 414, /* (130) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+ 414, /* (131) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ 414, /* (132) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+ 414, /* (133) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ 414, /* (134) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+ 414, /* (135) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+ 414, /* (136) db_options ::= db_options STT_TRIGGER NK_INTEGER */
+ 414, /* (137) db_options ::= db_options TABLE_PREFIX signed */
+ 414, /* (138) db_options ::= db_options TABLE_SUFFIX signed */
+ 414, /* (139) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */
+ 414, /* (140) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */
+ 414, /* (141) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */
+ 414, /* (142) db_options ::= db_options S3_COMPACT NK_INTEGER */
+ 414, /* (143) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
+ 414, /* (144) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */
+ 416, /* (145) alter_db_options ::= alter_db_option */
+ 416, /* (146) alter_db_options ::= alter_db_options alter_db_option */
+ 424, /* (147) alter_db_option ::= BUFFER NK_INTEGER */
+ 424, /* (148) alter_db_option ::= CACHEMODEL NK_STRING */
+ 424, /* (149) alter_db_option ::= CACHESIZE NK_INTEGER */
+ 424, /* (150) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+ 424, /* (151) alter_db_option ::= KEEP integer_list */
+ 424, /* (152) alter_db_option ::= KEEP variable_list */
+ 424, /* (153) alter_db_option ::= PAGES NK_INTEGER */
+ 424, /* (154) alter_db_option ::= REPLICA NK_INTEGER */
+ 424, /* (155) alter_db_option ::= WAL_LEVEL NK_INTEGER */
+ 424, /* (156) alter_db_option ::= STT_TRIGGER NK_INTEGER */
+ 424, /* (157) alter_db_option ::= MINROWS NK_INTEGER */
+ 424, /* (158) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
+ 424, /* (159) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ 424, /* (160) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
+ 424, /* (161) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ 424, /* (162) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */
+ 424, /* (163) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */
+ 424, /* (164) alter_db_option ::= S3_COMPACT NK_INTEGER */
+ 424, /* (165) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
+ 424, /* (166) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */
+ 420, /* (167) integer_list ::= NK_INTEGER */
+ 420, /* (168) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ 421, /* (169) variable_list ::= NK_VARIABLE */
+ 421, /* (170) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ 422, /* (171) retention_list ::= retention */
+ 422, /* (172) retention_list ::= retention_list NK_COMMA retention */
+ 425, /* (173) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ 425, /* (174) retention ::= NK_MINUS NK_COLON NK_VARIABLE */
+ 417, /* (175) speed_opt ::= */
+ 417, /* (176) speed_opt ::= BWLIMIT NK_INTEGER */
+ 418, /* (177) start_opt ::= */
+ 418, /* (178) start_opt ::= START WITH NK_INTEGER */
+ 418, /* (179) start_opt ::= START WITH NK_STRING */
+ 418, /* (180) start_opt ::= START WITH TIMESTAMP NK_STRING */
+ 419, /* (181) end_opt ::= */
+ 419, /* (182) end_opt ::= END WITH NK_INTEGER */
+ 419, /* (183) end_opt ::= END WITH NK_STRING */
+ 419, /* (184) end_opt ::= END WITH TIMESTAMP NK_STRING */
+ 389, /* (185) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ 389, /* (186) cmd ::= CREATE TABLE multi_create_clause */
+ 389, /* (187) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */
+ 389, /* (188) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ 389, /* (189) cmd ::= DROP TABLE with_opt multi_drop_clause */
+ 389, /* (190) cmd ::= DROP STABLE with_opt exists_opt full_table_name */
+ 389, /* (191) cmd ::= ALTER TABLE alter_table_clause */
+ 389, /* (192) cmd ::= ALTER STABLE alter_table_clause */
+ 435, /* (193) alter_table_clause ::= full_table_name alter_table_options */
+ 435, /* (194) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */
+ 435, /* (195) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ 435, /* (196) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ 435, /* (197) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
+ 435, /* (198) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ 435, /* (199) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ 435, /* (200) alter_table_clause ::= full_table_name DROP TAG column_name */
+ 435, /* (201) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ 435, /* (202) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ 435, /* (203) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */
+ 430, /* (204) multi_create_clause ::= create_subtable_clause */
+ 430, /* (205) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ 441, /* (206) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */
+ 434, /* (207) multi_drop_clause ::= drop_table_clause */
+ 434, /* (208) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
+ 444, /* (209) drop_table_clause ::= exists_opt full_table_name */
+ 433, /* (210) with_opt ::= */
+ 433, /* (211) with_opt ::= WITH */
+ 442, /* (212) specific_cols_opt ::= */
+ 442, /* (213) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ 426, /* (214) full_table_name ::= table_name */
+ 426, /* (215) full_table_name ::= db_name NK_DOT table_name */
+ 446, /* (216) tag_def_list ::= tag_def */
+ 446, /* (217) tag_def_list ::= tag_def_list NK_COMMA tag_def */
+ 447, /* (218) tag_def ::= column_name type_name */
+ 427, /* (219) column_def_list ::= column_def */
+ 427, /* (220) column_def_list ::= column_def_list NK_COMMA column_def */
+ 448, /* (221) column_def ::= column_name type_name column_options */
+ 438, /* (222) type_name ::= BOOL */
+ 438, /* (223) type_name ::= TINYINT */
+ 438, /* (224) type_name ::= SMALLINT */
+ 438, /* (225) type_name ::= INT */
+ 438, /* (226) type_name ::= INTEGER */
+ 438, /* (227) type_name ::= BIGINT */
+ 438, /* (228) type_name ::= FLOAT */
+ 438, /* (229) type_name ::= DOUBLE */
+ 438, /* (230) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ 438, /* (231) type_name ::= TIMESTAMP */
+ 438, /* (232) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ 438, /* (233) type_name ::= TINYINT UNSIGNED */
+ 438, /* (234) type_name ::= SMALLINT UNSIGNED */
+ 438, /* (235) type_name ::= INT UNSIGNED */
+ 438, /* (236) type_name ::= BIGINT UNSIGNED */
+ 438, /* (237) type_name ::= JSON */
+ 438, /* (238) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ 438, /* (239) type_name ::= MEDIUMBLOB */
+ 438, /* (240) type_name ::= BLOB */
+ 438, /* (241) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ 438, /* (242) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
+ 438, /* (243) type_name ::= DECIMAL */
+ 438, /* (244) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ 438, /* (245) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 449, /* (246) type_name_default_len ::= BINARY */
+ 449, /* (247) type_name_default_len ::= NCHAR */
+ 449, /* (248) type_name_default_len ::= VARCHAR */
+ 449, /* (249) type_name_default_len ::= VARBINARY */
+ 428, /* (250) tags_def_opt ::= */
+ 428, /* (251) tags_def_opt ::= tags_def */
+ 432, /* (252) tags_def ::= TAGS NK_LP tag_def_list NK_RP */
+ 429, /* (253) table_options ::= */
+ 429, /* (254) table_options ::= table_options COMMENT NK_STRING */
+ 429, /* (255) table_options ::= table_options MAX_DELAY duration_list */
+ 429, /* (256) table_options ::= table_options WATERMARK duration_list */
+ 429, /* (257) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ 429, /* (258) table_options ::= table_options TTL NK_INTEGER */
+ 429, /* (259) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ 429, /* (260) table_options ::= table_options DELETE_MARK duration_list */
+ 436, /* (261) alter_table_options ::= alter_table_option */
+ 436, /* (262) alter_table_options ::= alter_table_options alter_table_option */
+ 452, /* (263) alter_table_option ::= COMMENT NK_STRING */
+ 452, /* (264) alter_table_option ::= TTL NK_INTEGER */
+ 450, /* (265) duration_list ::= duration_literal */
+ 450, /* (266) duration_list ::= duration_list NK_COMMA duration_literal */
+ 451, /* (267) rollup_func_list ::= rollup_func_name */
+ 451, /* (268) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ 454, /* (269) rollup_func_name ::= function_name */
+ 454, /* (270) rollup_func_name ::= FIRST */
+ 454, /* (271) rollup_func_name ::= LAST */
+ 445, /* (272) col_name_list ::= col_name */
+ 445, /* (273) col_name_list ::= col_name_list NK_COMMA col_name */
+ 456, /* (274) col_name ::= column_name */
+ 389, /* (275) cmd ::= SHOW DNODES */
+ 389, /* (276) cmd ::= SHOW USERS */
+ 389, /* (277) cmd ::= SHOW USERS FULL */
+ 389, /* (278) cmd ::= SHOW USER PRIVILEGES */
+ 389, /* (279) cmd ::= SHOW db_kind_opt DATABASES */
+ 389, /* (280) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
+ 389, /* (281) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ 389, /* (282) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ 389, /* (283) cmd ::= SHOW MNODES */
+ 389, /* (284) cmd ::= SHOW QNODES */
+ 389, /* (285) cmd ::= SHOW ANODES */
+ 389, /* (286) cmd ::= SHOW ANODES FULL */
+ 389, /* (287) cmd ::= SHOW ARBGROUPS */
+ 389, /* (288) cmd ::= SHOW FUNCTIONS */
+ 389, /* (289) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ 389, /* (290) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
+ 389, /* (291) cmd ::= SHOW STREAMS */
+ 389, /* (292) cmd ::= SHOW ACCOUNTS */
+ 389, /* (293) cmd ::= SHOW APPS */
+ 389, /* (294) cmd ::= SHOW CONNECTIONS */
+ 389, /* (295) cmd ::= SHOW LICENCES */
+ 389, /* (296) cmd ::= SHOW GRANTS */
+ 389, /* (297) cmd ::= SHOW GRANTS FULL */
+ 389, /* (298) cmd ::= SHOW GRANTS LOGS */
+ 389, /* (299) cmd ::= SHOW CLUSTER MACHINES */
+ 389, /* (300) cmd ::= SHOW CREATE DATABASE db_name */
+ 389, /* (301) cmd ::= SHOW CREATE TABLE full_table_name */
+ 389, /* (302) cmd ::= SHOW CREATE STABLE full_table_name */
+ 389, /* (303) cmd ::= SHOW ENCRYPTIONS */
+ 389, /* (304) cmd ::= SHOW QUERIES */
+ 389, /* (305) cmd ::= SHOW SCORES */
+ 389, /* (306) cmd ::= SHOW TOPICS */
+ 389, /* (307) cmd ::= SHOW VARIABLES */
+ 389, /* (308) cmd ::= SHOW CLUSTER VARIABLES */
+ 389, /* (309) cmd ::= SHOW LOCAL VARIABLES */
+ 389, /* (310) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+ 389, /* (311) cmd ::= SHOW BNODES */
+ 389, /* (312) cmd ::= SHOW SNODES */
+ 389, /* (313) cmd ::= SHOW CLUSTER */
+ 389, /* (314) cmd ::= SHOW TRANSACTIONS */
+ 389, /* (315) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ 389, /* (316) cmd ::= SHOW CONSUMERS */
+ 389, /* (317) cmd ::= SHOW SUBSCRIPTIONS */
+ 389, /* (318) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ 389, /* (319) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
+ 389, /* (320) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+ 389, /* (321) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
+ 389, /* (322) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
+ 389, /* (323) cmd ::= SHOW VNODES */
+ 389, /* (324) cmd ::= SHOW db_name_cond_opt ALIVE */
+ 389, /* (325) cmd ::= SHOW CLUSTER ALIVE */
+ 389, /* (326) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
+ 389, /* (327) cmd ::= SHOW CREATE VIEW full_table_name */
+ 389, /* (328) cmd ::= SHOW COMPACTS */
+ 389, /* (329) cmd ::= SHOW COMPACT NK_INTEGER */
+ 458, /* (330) table_kind_db_name_cond_opt ::= */
+ 458, /* (331) table_kind_db_name_cond_opt ::= table_kind */
+ 458, /* (332) table_kind_db_name_cond_opt ::= db_name NK_DOT */
+ 458, /* (333) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
+ 463, /* (334) table_kind ::= NORMAL */
+ 463, /* (335) table_kind ::= CHILD */
+ 460, /* (336) db_name_cond_opt ::= */
+ 460, /* (337) db_name_cond_opt ::= db_name NK_DOT */
+ 459, /* (338) like_pattern_opt ::= */
+ 459, /* (339) like_pattern_opt ::= LIKE NK_STRING */
+ 461, /* (340) table_name_cond ::= table_name */
+ 462, /* (341) from_db_opt ::= */
+ 462, /* (342) from_db_opt ::= FROM db_name */
+ 431, /* (343) tag_list_opt ::= */
+ 431, /* (344) tag_list_opt ::= tag_item */
+ 431, /* (345) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
+ 464, /* (346) tag_item ::= TBNAME */
+ 464, /* (347) tag_item ::= QTAGS */
+ 464, /* (348) tag_item ::= column_name */
+ 464, /* (349) tag_item ::= column_name column_alias */
+ 464, /* (350) tag_item ::= column_name AS column_alias */
+ 457, /* (351) db_kind_opt ::= */
+ 457, /* (352) db_kind_opt ::= USER */
+ 457, /* (353) db_kind_opt ::= SYSTEM */
+ 389, /* (354) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */
+ 389, /* (355) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */
+ 389, /* (356) cmd ::= DROP TSMA exists_opt full_tsma_name */
+ 389, /* (357) cmd ::= SHOW db_name_cond_opt TSMAS */
+ 468, /* (358) full_tsma_name ::= tsma_name */
+ 468, /* (359) full_tsma_name ::= db_name NK_DOT tsma_name */
+ 467, /* (360) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */
+ 389, /* (361) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
+ 389, /* (362) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
+ 389, /* (363) cmd ::= DROP INDEX exists_opt full_index_name */
+ 471, /* (364) full_index_name ::= index_name */
+ 471, /* (365) full_index_name ::= db_name NK_DOT index_name */
+ 470, /* (366) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ 470, /* (367) 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 */
+ 469, /* (368) func_list ::= func */
+ 469, /* (369) func_list ::= func_list NK_COMMA func */
+ 475, /* (370) func ::= sma_func_name NK_LP expression_list NK_RP */
+ 476, /* (371) sma_func_name ::= function_name */
+ 476, /* (372) sma_func_name ::= COUNT */
+ 476, /* (373) sma_func_name ::= FIRST */
+ 476, /* (374) sma_func_name ::= LAST */
+ 476, /* (375) sma_func_name ::= LAST_ROW */
+ 474, /* (376) sma_stream_opt ::= */
+ 474, /* (377) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+ 474, /* (378) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+ 474, /* (379) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+ 478, /* (380) with_meta ::= AS */
+ 478, /* (381) with_meta ::= WITH META AS */
+ 478, /* (382) with_meta ::= ONLY META AS */
+ 389, /* (383) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+ 389, /* (384) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
+ 389, /* (385) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
+ 389, /* (386) cmd ::= DROP TOPIC exists_opt topic_name */
+ 389, /* (387) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ 389, /* (388) cmd ::= DESC full_table_name */
+ 389, /* (389) cmd ::= DESCRIBE full_table_name */
+ 389, /* (390) cmd ::= RESET QUERY CACHE */
+ 389, /* (391) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ 389, /* (392) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
+ 482, /* (393) analyze_opt ::= */
+ 482, /* (394) analyze_opt ::= ANALYZE */
+ 483, /* (395) explain_options ::= */
+ 483, /* (396) explain_options ::= explain_options VERBOSE NK_BOOL */
+ 483, /* (397) explain_options ::= explain_options RATIO NK_FLOAT */
+ 389, /* (398) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
+ 389, /* (399) cmd ::= DROP FUNCTION exists_opt function_name */
+ 486, /* (400) agg_func_opt ::= */
+ 486, /* (401) agg_func_opt ::= AGGREGATE */
+ 487, /* (402) bufsize_opt ::= */
+ 487, /* (403) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ 488, /* (404) language_opt ::= */
+ 488, /* (405) language_opt ::= LANGUAGE NK_STRING */
+ 485, /* (406) or_replace_opt ::= */
+ 485, /* (407) or_replace_opt ::= OR REPLACE */
+ 389, /* (408) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
+ 389, /* (409) cmd ::= DROP VIEW exists_opt full_view_name */
+ 489, /* (410) full_view_name ::= view_name */
+ 489, /* (411) full_view_name ::= db_name NK_DOT view_name */
+ 389, /* (412) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+ 389, /* (413) cmd ::= DROP STREAM exists_opt stream_name */
+ 389, /* (414) cmd ::= PAUSE STREAM exists_opt stream_name */
+ 389, /* (415) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
+ 493, /* (416) col_list_opt ::= */
+ 493, /* (417) col_list_opt ::= NK_LP column_stream_def_list NK_RP */
+ 497, /* (418) column_stream_def_list ::= column_stream_def */
+ 497, /* (419) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */
+ 498, /* (420) column_stream_def ::= column_name stream_col_options */
+ 499, /* (421) stream_col_options ::= */
+ 499, /* (422) stream_col_options ::= stream_col_options PRIMARY KEY */
+ 494, /* (423) tag_def_or_ref_opt ::= */
+ 494, /* (424) tag_def_or_ref_opt ::= tags_def */
+ 494, /* (425) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */
+ 492, /* (426) stream_options ::= */
+ 492, /* (427) stream_options ::= stream_options TRIGGER AT_ONCE */
+ 492, /* (428) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ 492, /* (429) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ 492, /* (430) stream_options ::= stream_options WATERMARK duration_literal */
+ 492, /* (431) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ 492, /* (432) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+ 492, /* (433) stream_options ::= stream_options DELETE_MARK duration_literal */
+ 492, /* (434) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+ 495, /* (435) subtable_opt ::= */
+ 495, /* (436) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ 496, /* (437) ignore_opt ::= */
+ 496, /* (438) ignore_opt ::= IGNORE UNTREATED */
+ 389, /* (439) cmd ::= KILL CONNECTION NK_INTEGER */
+ 389, /* (440) cmd ::= KILL QUERY NK_STRING */
+ 389, /* (441) cmd ::= KILL TRANSACTION NK_INTEGER */
+ 389, /* (442) cmd ::= KILL COMPACT NK_INTEGER */
+ 389, /* (443) cmd ::= BALANCE VGROUP */
+ 389, /* (444) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
+ 389, /* (445) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */
+ 389, /* (446) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ 389, /* (447) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ 389, /* (448) cmd ::= SPLIT VGROUP NK_INTEGER */
+ 501, /* (449) on_vgroup_id ::= */
+ 501, /* (450) on_vgroup_id ::= ON NK_INTEGER */
+ 502, /* (451) dnode_list ::= DNODE NK_INTEGER */
+ 502, /* (452) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ 389, /* (453) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ 389, /* (454) cmd ::= query_or_subquery */
+ 389, /* (455) cmd ::= insert_query */
+ 484, /* (456) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ 484, /* (457) insert_query ::= INSERT INTO full_table_name query_or_subquery */
+ 440, /* (458) tags_literal ::= NK_INTEGER */
+ 440, /* (459) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */
+ 440, /* (460) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */
+ 440, /* (461) tags_literal ::= NK_PLUS NK_INTEGER */
+ 440, /* (462) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */
+ 440, /* (463) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */
+ 440, /* (464) tags_literal ::= NK_MINUS NK_INTEGER */
+ 440, /* (465) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */
+ 440, /* (466) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */
+ 440, /* (467) tags_literal ::= NK_FLOAT */
+ 440, /* (468) tags_literal ::= NK_PLUS NK_FLOAT */
+ 440, /* (469) tags_literal ::= NK_MINUS NK_FLOAT */
+ 440, /* (470) tags_literal ::= NK_BIN */
+ 440, /* (471) tags_literal ::= NK_BIN NK_PLUS duration_literal */
+ 440, /* (472) tags_literal ::= NK_BIN NK_MINUS duration_literal */
+ 440, /* (473) tags_literal ::= NK_PLUS NK_BIN */
+ 440, /* (474) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */
+ 440, /* (475) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */
+ 440, /* (476) tags_literal ::= NK_MINUS NK_BIN */
+ 440, /* (477) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */
+ 440, /* (478) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */
+ 440, /* (479) tags_literal ::= NK_HEX */
+ 440, /* (480) tags_literal ::= NK_HEX NK_PLUS duration_literal */
+ 440, /* (481) tags_literal ::= NK_HEX NK_MINUS duration_literal */
+ 440, /* (482) tags_literal ::= NK_PLUS NK_HEX */
+ 440, /* (483) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */
+ 440, /* (484) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */
+ 440, /* (485) tags_literal ::= NK_MINUS NK_HEX */
+ 440, /* (486) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */
+ 440, /* (487) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */
+ 440, /* (488) tags_literal ::= NK_STRING */
+ 440, /* (489) tags_literal ::= NK_STRING NK_PLUS duration_literal */
+ 440, /* (490) tags_literal ::= NK_STRING NK_MINUS duration_literal */
+ 440, /* (491) tags_literal ::= NK_BOOL */
+ 440, /* (492) tags_literal ::= NULL */
+ 440, /* (493) tags_literal ::= literal_func */
+ 440, /* (494) tags_literal ::= literal_func NK_PLUS duration_literal */
+ 440, /* (495) tags_literal ::= literal_func NK_MINUS duration_literal */
+ 443, /* (496) tags_literal_list ::= tags_literal */
+ 443, /* (497) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */
+ 392, /* (498) literal ::= NK_INTEGER */
+ 392, /* (499) literal ::= NK_FLOAT */
+ 392, /* (500) literal ::= NK_STRING */
+ 392, /* (501) literal ::= NK_BOOL */
+ 392, /* (502) literal ::= TIMESTAMP NK_STRING */
+ 392, /* (503) literal ::= duration_literal */
+ 392, /* (504) literal ::= NULL */
+ 392, /* (505) literal ::= NK_QUESTION */
+ 453, /* (506) duration_literal ::= NK_VARIABLE */
+ 423, /* (507) signed ::= NK_INTEGER */
+ 423, /* (508) signed ::= NK_PLUS NK_INTEGER */
+ 423, /* (509) signed ::= NK_MINUS NK_INTEGER */
+ 423, /* (510) signed ::= NK_FLOAT */
+ 423, /* (511) signed ::= NK_PLUS NK_FLOAT */
+ 423, /* (512) signed ::= NK_MINUS NK_FLOAT */
+ 504, /* (513) signed_literal ::= signed */
+ 504, /* (514) signed_literal ::= NK_STRING */
+ 504, /* (515) signed_literal ::= NK_BOOL */
+ 504, /* (516) signed_literal ::= TIMESTAMP NK_STRING */
+ 504, /* (517) signed_literal ::= duration_literal */
+ 504, /* (518) signed_literal ::= NULL */
+ 504, /* (519) signed_literal ::= literal_func */
+ 504, /* (520) signed_literal ::= NK_QUESTION */
+ 505, /* (521) literal_list ::= signed_literal */
+ 505, /* (522) literal_list ::= literal_list NK_COMMA signed_literal */
+ 406, /* (523) db_name ::= NK_ID */
+ 407, /* (524) table_name ::= NK_ID */
+ 437, /* (525) column_name ::= NK_ID */
+ 455, /* (526) function_name ::= NK_ID */
+ 490, /* (527) view_name ::= NK_ID */
+ 506, /* (528) table_alias ::= NK_ID */
+ 465, /* (529) column_alias ::= NK_ID */
+ 465, /* (530) column_alias ::= NK_ALIAS */
+ 399, /* (531) user_name ::= NK_ID */
+ 408, /* (532) topic_name ::= NK_ID */
+ 491, /* (533) stream_name ::= NK_ID */
+ 481, /* (534) cgroup_name ::= NK_ID */
+ 472, /* (535) index_name ::= NK_ID */
+ 466, /* (536) tsma_name ::= NK_ID */
+ 507, /* (537) expr_or_subquery ::= expression */
+ 500, /* (538) expression ::= literal */
+ 500, /* (539) expression ::= pseudo_column */
+ 500, /* (540) expression ::= column_reference */
+ 500, /* (541) expression ::= function_expression */
+ 500, /* (542) expression ::= case_when_expression */
+ 500, /* (543) expression ::= NK_LP expression NK_RP */
+ 500, /* (544) expression ::= NK_PLUS expr_or_subquery */
+ 500, /* (545) expression ::= NK_MINUS expr_or_subquery */
+ 500, /* (546) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ 500, /* (547) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ 500, /* (548) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ 500, /* (549) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ 500, /* (550) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ 500, /* (551) expression ::= column_reference NK_ARROW NK_STRING */
+ 500, /* (552) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ 500, /* (553) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ 477, /* (554) expression_list ::= expr_or_subquery */
+ 477, /* (555) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ 509, /* (556) column_reference ::= column_name */
+ 509, /* (557) column_reference ::= table_name NK_DOT column_name */
+ 509, /* (558) column_reference ::= NK_ALIAS */
+ 509, /* (559) column_reference ::= table_name NK_DOT NK_ALIAS */
+ 508, /* (560) pseudo_column ::= ROWTS */
+ 508, /* (561) pseudo_column ::= TBNAME */
+ 508, /* (562) pseudo_column ::= table_name NK_DOT TBNAME */
+ 508, /* (563) pseudo_column ::= QSTART */
+ 508, /* (564) pseudo_column ::= QEND */
+ 508, /* (565) pseudo_column ::= QDURATION */
+ 508, /* (566) pseudo_column ::= WSTART */
+ 508, /* (567) pseudo_column ::= WEND */
+ 508, /* (568) pseudo_column ::= WDURATION */
+ 508, /* (569) pseudo_column ::= IROWTS */
+ 508, /* (570) pseudo_column ::= ISFILLED */
+ 508, /* (571) pseudo_column ::= QTAGS */
+ 508, /* (572) pseudo_column ::= FLOW */
+ 508, /* (573) pseudo_column ::= FHIGH */
+ 508, /* (574) pseudo_column ::= FROWTS */
+ 510, /* (575) function_expression ::= function_name NK_LP expression_list NK_RP */
+ 510, /* (576) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ 510, /* (577) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ 510, /* (578) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */
+ 510, /* (579) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */
+ 510, /* (580) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */
+ 510, /* (581) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */
+ 510, /* (582) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
+ 510, /* (583) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */
+ 510, /* (584) function_expression ::= substr_func NK_LP expression_list NK_RP */
+ 510, /* (585) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
+ 510, /* (586) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */
+ 510, /* (587) function_expression ::= REPLACE NK_LP expression_list NK_RP */
+ 510, /* (588) function_expression ::= literal_func */
+ 510, /* (589) function_expression ::= rand_func */
+ 503, /* (590) literal_func ::= noarg_func NK_LP NK_RP */
+ 503, /* (591) literal_func ::= NOW */
+ 503, /* (592) literal_func ::= TODAY */
+ 516, /* (593) rand_func ::= RAND NK_LP NK_RP */
+ 516, /* (594) rand_func ::= RAND NK_LP expression_list NK_RP */
+ 515, /* (595) substr_func ::= SUBSTR */
+ 515, /* (596) substr_func ::= SUBSTRING */
+ 514, /* (597) trim_specification_type ::= BOTH */
+ 514, /* (598) trim_specification_type ::= TRAILING */
+ 514, /* (599) trim_specification_type ::= LEADING */
+ 517, /* (600) noarg_func ::= NOW */
+ 517, /* (601) noarg_func ::= TODAY */
+ 517, /* (602) noarg_func ::= TIMEZONE */
+ 517, /* (603) noarg_func ::= DATABASE */
+ 517, /* (604) noarg_func ::= CLIENT_VERSION */
+ 517, /* (605) noarg_func ::= SERVER_VERSION */
+ 517, /* (606) noarg_func ::= SERVER_STATUS */
+ 517, /* (607) noarg_func ::= CURRENT_USER */
+ 517, /* (608) noarg_func ::= USER */
+ 517, /* (609) noarg_func ::= PI */
+ 512, /* (610) star_func ::= COUNT */
+ 512, /* (611) star_func ::= FIRST */
+ 512, /* (612) star_func ::= LAST */
+ 512, /* (613) star_func ::= LAST_ROW */
+ 513, /* (614) star_func_para_list ::= NK_STAR */
+ 513, /* (615) star_func_para_list ::= other_para_list */
+ 518, /* (616) other_para_list ::= star_func_para */
+ 518, /* (617) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ 519, /* (618) star_func_para ::= expr_or_subquery */
+ 519, /* (619) star_func_para ::= table_name NK_DOT NK_STAR */
+ 511, /* (620) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ 511, /* (621) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ 520, /* (622) when_then_list ::= when_then_expr */
+ 520, /* (623) when_then_list ::= when_then_list when_then_expr */
+ 523, /* (624) when_then_expr ::= WHEN common_expression THEN common_expression */
+ 521, /* (625) case_when_else_opt ::= */
+ 521, /* (626) case_when_else_opt ::= ELSE common_expression */
+ 524, /* (627) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ 524, /* (628) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ 524, /* (629) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ 524, /* (630) predicate ::= expr_or_subquery IS NULL */
+ 524, /* (631) predicate ::= expr_or_subquery IS NOT NULL */
+ 524, /* (632) predicate ::= expr_or_subquery in_op in_predicate_value */
+ 525, /* (633) compare_op ::= NK_LT */
+ 525, /* (634) compare_op ::= NK_GT */
+ 525, /* (635) compare_op ::= NK_LE */
+ 525, /* (636) compare_op ::= NK_GE */
+ 525, /* (637) compare_op ::= NK_NE */
+ 525, /* (638) compare_op ::= NK_EQ */
+ 525, /* (639) compare_op ::= LIKE */
+ 525, /* (640) compare_op ::= NOT LIKE */
+ 525, /* (641) compare_op ::= MATCH */
+ 525, /* (642) compare_op ::= NMATCH */
+ 525, /* (643) compare_op ::= CONTAINS */
+ 526, /* (644) in_op ::= IN */
+ 526, /* (645) in_op ::= NOT IN */
+ 527, /* (646) in_predicate_value ::= NK_LP literal_list NK_RP */
+ 528, /* (647) boolean_value_expression ::= boolean_primary */
+ 528, /* (648) boolean_value_expression ::= NOT boolean_primary */
+ 528, /* (649) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ 528, /* (650) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ 529, /* (651) boolean_primary ::= predicate */
+ 529, /* (652) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ 522, /* (653) common_expression ::= expr_or_subquery */
+ 522, /* (654) common_expression ::= boolean_value_expression */
+ 530, /* (655) from_clause_opt ::= */
+ 530, /* (656) from_clause_opt ::= FROM table_reference_list */
+ 531, /* (657) table_reference_list ::= table_reference */
+ 531, /* (658) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ 532, /* (659) table_reference ::= table_primary */
+ 532, /* (660) table_reference ::= joined_table */
+ 533, /* (661) table_primary ::= table_name alias_opt */
+ 533, /* (662) table_primary ::= db_name NK_DOT table_name alias_opt */
+ 533, /* (663) table_primary ::= subquery alias_opt */
+ 533, /* (664) table_primary ::= parenthesized_joined_table */
+ 535, /* (665) alias_opt ::= */
+ 535, /* (666) alias_opt ::= table_alias */
+ 535, /* (667) alias_opt ::= AS table_alias */
+ 537, /* (668) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ 537, /* (669) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ 534, /* (670) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
+ 538, /* (671) join_type ::= */
+ 538, /* (672) join_type ::= INNER */
+ 538, /* (673) join_type ::= LEFT */
+ 538, /* (674) join_type ::= RIGHT */
+ 538, /* (675) join_type ::= FULL */
+ 539, /* (676) join_subtype ::= */
+ 539, /* (677) join_subtype ::= OUTER */
+ 539, /* (678) join_subtype ::= SEMI */
+ 539, /* (679) join_subtype ::= ANTI */
+ 539, /* (680) join_subtype ::= ASOF */
+ 539, /* (681) join_subtype ::= WINDOW */
+ 540, /* (682) join_on_clause_opt ::= */
+ 540, /* (683) join_on_clause_opt ::= ON search_condition */
+ 541, /* (684) window_offset_clause_opt ::= */
+ 541, /* (685) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
+ 543, /* (686) window_offset_literal ::= NK_VARIABLE */
+ 543, /* (687) window_offset_literal ::= NK_MINUS NK_VARIABLE */
+ 542, /* (688) jlimit_clause_opt ::= */
+ 542, /* (689) jlimit_clause_opt ::= JLIMIT NK_INTEGER */
+ 544, /* (690) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ 545, /* (691) hint_list ::= */
+ 545, /* (692) hint_list ::= NK_HINT */
+ 547, /* (693) tag_mode_opt ::= */
+ 547, /* (694) tag_mode_opt ::= TAGS */
+ 546, /* (695) set_quantifier_opt ::= */
+ 546, /* (696) set_quantifier_opt ::= DISTINCT */
+ 546, /* (697) set_quantifier_opt ::= ALL */
+ 548, /* (698) select_list ::= select_item */
+ 548, /* (699) select_list ::= select_list NK_COMMA select_item */
+ 556, /* (700) select_item ::= NK_STAR */
+ 556, /* (701) select_item ::= common_expression */
+ 556, /* (702) select_item ::= common_expression column_alias */
+ 556, /* (703) select_item ::= common_expression AS column_alias */
+ 556, /* (704) select_item ::= table_name NK_DOT NK_STAR */
+ 480, /* (705) where_clause_opt ::= */
+ 480, /* (706) where_clause_opt ::= WHERE search_condition */
+ 549, /* (707) partition_by_clause_opt ::= */
+ 549, /* (708) partition_by_clause_opt ::= PARTITION BY partition_list */
+ 557, /* (709) partition_list ::= partition_item */
+ 557, /* (710) partition_list ::= partition_list NK_COMMA partition_item */
+ 558, /* (711) partition_item ::= expr_or_subquery */
+ 558, /* (712) partition_item ::= expr_or_subquery column_alias */
+ 558, /* (713) partition_item ::= expr_or_subquery AS column_alias */
+ 553, /* (714) twindow_clause_opt ::= */
+ 553, /* (715) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+ 553, /* (716) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ 553, /* (717) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ 553, /* (718) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ 553, /* (719) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+ 553, /* (720) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+ 553, /* (721) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ 553, /* (722) twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP */
+ 553, /* (723) twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP */
+ 473, /* (724) sliding_opt ::= */
+ 473, /* (725) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
+ 559, /* (726) interval_sliding_duration_literal ::= NK_VARIABLE */
+ 559, /* (727) interval_sliding_duration_literal ::= NK_STRING */
+ 559, /* (728) interval_sliding_duration_literal ::= NK_INTEGER */
+ 552, /* (729) fill_opt ::= */
+ 552, /* (730) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ 552, /* (731) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+ 552, /* (732) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+ 560, /* (733) fill_mode ::= NONE */
+ 560, /* (734) fill_mode ::= PREV */
+ 560, /* (735) fill_mode ::= NULL */
+ 560, /* (736) fill_mode ::= NULL_F */
+ 560, /* (737) fill_mode ::= LINEAR */
+ 560, /* (738) fill_mode ::= NEXT */
+ 554, /* (739) group_by_clause_opt ::= */
+ 554, /* (740) group_by_clause_opt ::= GROUP BY group_by_list */
+ 561, /* (741) group_by_list ::= expr_or_subquery */
+ 561, /* (742) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ 555, /* (743) having_clause_opt ::= */
+ 555, /* (744) having_clause_opt ::= HAVING search_condition */
+ 550, /* (745) range_opt ::= */
+ 550, /* (746) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ 550, /* (747) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+ 551, /* (748) every_opt ::= */
+ 551, /* (749) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ 562, /* (750) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ 563, /* (751) query_simple ::= query_specification */
+ 563, /* (752) query_simple ::= union_query_expression */
+ 567, /* (753) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ 567, /* (754) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ 568, /* (755) query_simple_or_subquery ::= query_simple */
+ 568, /* (756) query_simple_or_subquery ::= subquery */
+ 479, /* (757) query_or_subquery ::= query_expression */
+ 479, /* (758) query_or_subquery ::= subquery */
+ 564, /* (759) order_by_clause_opt ::= */
+ 564, /* (760) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ 565, /* (761) slimit_clause_opt ::= */
+ 565, /* (762) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ 565, /* (763) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ 565, /* (764) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 566, /* (765) limit_clause_opt ::= */
+ 566, /* (766) limit_clause_opt ::= LIMIT NK_INTEGER */
+ 566, /* (767) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ 566, /* (768) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 536, /* (769) subquery ::= NK_LP query_expression NK_RP */
+ 536, /* (770) subquery ::= NK_LP subquery NK_RP */
+ 409, /* (771) search_condition ::= common_expression */
+ 569, /* (772) sort_specification_list ::= sort_specification */
+ 569, /* (773) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ 570, /* (774) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ 571, /* (775) ordering_specification_opt ::= */
+ 571, /* (776) ordering_specification_opt ::= ASC */
+ 571, /* (777) ordering_specification_opt ::= DESC */
+ 572, /* (778) null_ordering_opt ::= */
+ 572, /* (779) null_ordering_opt ::= NULLS FIRST */
+ 572, /* (780) null_ordering_opt ::= NULLS LAST */
+ 439, /* (781) column_options ::= */
+ 439, /* (782) column_options ::= column_options PRIMARY KEY */
+ 439, /* (783) column_options ::= column_options NK_ID NK_STRING */
};
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
@@ -4747,719 +4804,730 @@ static const signed char yyRuleInfoNRhs[] = {
0, /* (57) with_clause_opt ::= */
-2, /* (58) with_clause_opt ::= WITH search_condition */
-3, /* (59) cmd ::= CREATE ENCRYPT_KEY NK_STRING */
- -3, /* (60) cmd ::= CREATE DNODE dnode_endpoint */
- -5, /* (61) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
- -4, /* (62) cmd ::= DROP DNODE NK_INTEGER force_opt */
- -4, /* (63) cmd ::= DROP DNODE dnode_endpoint force_opt */
- -4, /* (64) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
- -4, /* (65) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
- -4, /* (66) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
- -5, /* (67) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
- -4, /* (68) cmd ::= ALTER ALL DNODES NK_STRING */
- -5, /* (69) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
- -3, /* (70) cmd ::= RESTORE DNODE NK_INTEGER */
- -1, /* (71) dnode_endpoint ::= NK_STRING */
- -1, /* (72) dnode_endpoint ::= NK_ID */
- -1, /* (73) dnode_endpoint ::= NK_IPTOKEN */
- 0, /* (74) force_opt ::= */
- -1, /* (75) force_opt ::= FORCE */
- -1, /* (76) unsafe_opt ::= UNSAFE */
- -3, /* (77) cmd ::= ALTER CLUSTER NK_STRING */
- -4, /* (78) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
- -3, /* (79) cmd ::= ALTER LOCAL NK_STRING */
- -4, /* (80) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
- -5, /* (81) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
- -5, /* (82) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
- -5, /* (83) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
- -5, /* (84) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
- -5, /* (85) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
- -5, /* (86) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
- -5, /* (87) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
- -5, /* (88) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
- -5, /* (89) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
- -5, /* (90) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
- -5, /* (91) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
- -5, /* (92) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
- -4, /* (93) cmd ::= DROP DATABASE exists_opt db_name */
- -2, /* (94) cmd ::= USE db_name */
- -4, /* (95) cmd ::= ALTER DATABASE db_name alter_db_options */
- -3, /* (96) cmd ::= FLUSH DATABASE db_name */
- -4, /* (97) cmd ::= TRIM DATABASE db_name speed_opt */
- -3, /* (98) cmd ::= S3MIGRATE DATABASE db_name */
- -5, /* (99) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
- -3, /* (100) not_exists_opt ::= IF NOT EXISTS */
- 0, /* (101) not_exists_opt ::= */
- -2, /* (102) exists_opt ::= IF EXISTS */
- 0, /* (103) exists_opt ::= */
- 0, /* (104) db_options ::= */
- -3, /* (105) db_options ::= db_options BUFFER NK_INTEGER */
- -3, /* (106) db_options ::= db_options CACHEMODEL NK_STRING */
- -3, /* (107) db_options ::= db_options CACHESIZE NK_INTEGER */
- -3, /* (108) db_options ::= db_options COMP NK_INTEGER */
- -3, /* (109) db_options ::= db_options DURATION NK_INTEGER */
- -3, /* (110) db_options ::= db_options DURATION NK_VARIABLE */
- -3, /* (111) db_options ::= db_options MAXROWS NK_INTEGER */
- -3, /* (112) db_options ::= db_options MINROWS NK_INTEGER */
- -3, /* (113) db_options ::= db_options KEEP integer_list */
- -3, /* (114) db_options ::= db_options KEEP variable_list */
- -3, /* (115) db_options ::= db_options PAGES NK_INTEGER */
- -3, /* (116) db_options ::= db_options PAGESIZE NK_INTEGER */
- -3, /* (117) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
- -3, /* (118) db_options ::= db_options PRECISION NK_STRING */
- -3, /* (119) db_options ::= db_options REPLICA NK_INTEGER */
- -3, /* (120) db_options ::= db_options VGROUPS NK_INTEGER */
- -3, /* (121) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
- -3, /* (122) db_options ::= db_options RETENTIONS retention_list */
- -3, /* (123) db_options ::= db_options SCHEMALESS NK_INTEGER */
- -3, /* (124) db_options ::= db_options WAL_LEVEL NK_INTEGER */
- -3, /* (125) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
- -3, /* (126) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
- -4, /* (127) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- -3, /* (128) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
- -4, /* (129) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- -3, /* (130) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
- -3, /* (131) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
- -3, /* (132) db_options ::= db_options STT_TRIGGER NK_INTEGER */
- -3, /* (133) db_options ::= db_options TABLE_PREFIX signed */
- -3, /* (134) db_options ::= db_options TABLE_SUFFIX signed */
- -3, /* (135) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */
- -3, /* (136) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */
- -3, /* (137) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */
- -3, /* (138) db_options ::= db_options S3_COMPACT NK_INTEGER */
- -3, /* (139) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
- -3, /* (140) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */
- -1, /* (141) alter_db_options ::= alter_db_option */
- -2, /* (142) alter_db_options ::= alter_db_options alter_db_option */
- -2, /* (143) alter_db_option ::= BUFFER NK_INTEGER */
- -2, /* (144) alter_db_option ::= CACHEMODEL NK_STRING */
- -2, /* (145) alter_db_option ::= CACHESIZE NK_INTEGER */
- -2, /* (146) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
- -2, /* (147) alter_db_option ::= KEEP integer_list */
- -2, /* (148) alter_db_option ::= KEEP variable_list */
- -2, /* (149) alter_db_option ::= PAGES NK_INTEGER */
- -2, /* (150) alter_db_option ::= REPLICA NK_INTEGER */
- -2, /* (151) alter_db_option ::= WAL_LEVEL NK_INTEGER */
- -2, /* (152) alter_db_option ::= STT_TRIGGER NK_INTEGER */
- -2, /* (153) alter_db_option ::= MINROWS NK_INTEGER */
- -2, /* (154) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
- -3, /* (155) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
- -2, /* (156) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
- -3, /* (157) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
- -2, /* (158) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */
- -2, /* (159) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */
- -2, /* (160) alter_db_option ::= S3_COMPACT NK_INTEGER */
- -2, /* (161) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
- -2, /* (162) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */
- -1, /* (163) integer_list ::= NK_INTEGER */
- -3, /* (164) integer_list ::= integer_list NK_COMMA NK_INTEGER */
- -1, /* (165) variable_list ::= NK_VARIABLE */
- -3, /* (166) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
- -1, /* (167) retention_list ::= retention */
- -3, /* (168) retention_list ::= retention_list NK_COMMA retention */
- -3, /* (169) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- -3, /* (170) retention ::= NK_MINUS NK_COLON NK_VARIABLE */
- 0, /* (171) speed_opt ::= */
- -2, /* (172) speed_opt ::= BWLIMIT NK_INTEGER */
- 0, /* (173) start_opt ::= */
- -3, /* (174) start_opt ::= START WITH NK_INTEGER */
- -3, /* (175) start_opt ::= START WITH NK_STRING */
- -4, /* (176) start_opt ::= START WITH TIMESTAMP NK_STRING */
- 0, /* (177) end_opt ::= */
- -3, /* (178) end_opt ::= END WITH NK_INTEGER */
- -3, /* (179) end_opt ::= END WITH NK_STRING */
- -4, /* (180) end_opt ::= END WITH TIMESTAMP NK_STRING */
- -9, /* (181) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- -3, /* (182) cmd ::= CREATE TABLE multi_create_clause */
- -10, /* (183) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */
- -9, /* (184) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
- -4, /* (185) cmd ::= DROP TABLE with_opt multi_drop_clause */
- -5, /* (186) cmd ::= DROP STABLE with_opt exists_opt full_table_name */
- -3, /* (187) cmd ::= ALTER TABLE alter_table_clause */
- -3, /* (188) cmd ::= ALTER STABLE alter_table_clause */
- -2, /* (189) alter_table_clause ::= full_table_name alter_table_options */
- -6, /* (190) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */
- -4, /* (191) alter_table_clause ::= full_table_name DROP COLUMN column_name */
- -5, /* (192) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
- -5, /* (193) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
- -5, /* (194) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
- -5, /* (195) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
- -4, /* (196) alter_table_clause ::= full_table_name DROP TAG column_name */
- -5, /* (197) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
- -5, /* (198) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
- -6, /* (199) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */
- -1, /* (200) multi_create_clause ::= create_subtable_clause */
- -2, /* (201) multi_create_clause ::= multi_create_clause create_subtable_clause */
- -10, /* (202) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */
- -1, /* (203) multi_drop_clause ::= drop_table_clause */
- -3, /* (204) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
- -2, /* (205) drop_table_clause ::= exists_opt full_table_name */
- 0, /* (206) with_opt ::= */
- -1, /* (207) with_opt ::= WITH */
- 0, /* (208) specific_cols_opt ::= */
- -3, /* (209) specific_cols_opt ::= NK_LP col_name_list NK_RP */
- -1, /* (210) full_table_name ::= table_name */
- -3, /* (211) full_table_name ::= db_name NK_DOT table_name */
- -1, /* (212) tag_def_list ::= tag_def */
- -3, /* (213) tag_def_list ::= tag_def_list NK_COMMA tag_def */
- -2, /* (214) tag_def ::= column_name type_name */
- -1, /* (215) column_def_list ::= column_def */
- -3, /* (216) column_def_list ::= column_def_list NK_COMMA column_def */
- -3, /* (217) column_def ::= column_name type_name column_options */
- -1, /* (218) type_name ::= BOOL */
- -1, /* (219) type_name ::= TINYINT */
- -1, /* (220) type_name ::= SMALLINT */
- -1, /* (221) type_name ::= INT */
- -1, /* (222) type_name ::= INTEGER */
- -1, /* (223) type_name ::= BIGINT */
- -1, /* (224) type_name ::= FLOAT */
- -1, /* (225) type_name ::= DOUBLE */
- -4, /* (226) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
- -1, /* (227) type_name ::= TIMESTAMP */
- -4, /* (228) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
- -2, /* (229) type_name ::= TINYINT UNSIGNED */
- -2, /* (230) type_name ::= SMALLINT UNSIGNED */
- -2, /* (231) type_name ::= INT UNSIGNED */
- -2, /* (232) type_name ::= BIGINT UNSIGNED */
- -1, /* (233) type_name ::= JSON */
- -4, /* (234) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
- -1, /* (235) type_name ::= MEDIUMBLOB */
- -1, /* (236) type_name ::= BLOB */
- -4, /* (237) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
- -4, /* (238) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
- -1, /* (239) type_name ::= DECIMAL */
- -4, /* (240) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
- -6, /* (241) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- -1, /* (242) type_name_default_len ::= BINARY */
- -1, /* (243) type_name_default_len ::= NCHAR */
- -1, /* (244) type_name_default_len ::= VARCHAR */
- -1, /* (245) type_name_default_len ::= VARBINARY */
- 0, /* (246) tags_def_opt ::= */
- -1, /* (247) tags_def_opt ::= tags_def */
- -4, /* (248) tags_def ::= TAGS NK_LP tag_def_list NK_RP */
- 0, /* (249) table_options ::= */
- -3, /* (250) table_options ::= table_options COMMENT NK_STRING */
- -3, /* (251) table_options ::= table_options MAX_DELAY duration_list */
- -3, /* (252) table_options ::= table_options WATERMARK duration_list */
- -5, /* (253) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
- -3, /* (254) table_options ::= table_options TTL NK_INTEGER */
- -5, /* (255) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
- -3, /* (256) table_options ::= table_options DELETE_MARK duration_list */
- -1, /* (257) alter_table_options ::= alter_table_option */
- -2, /* (258) alter_table_options ::= alter_table_options alter_table_option */
- -2, /* (259) alter_table_option ::= COMMENT NK_STRING */
- -2, /* (260) alter_table_option ::= TTL NK_INTEGER */
- -1, /* (261) duration_list ::= duration_literal */
- -3, /* (262) duration_list ::= duration_list NK_COMMA duration_literal */
- -1, /* (263) rollup_func_list ::= rollup_func_name */
- -3, /* (264) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
- -1, /* (265) rollup_func_name ::= function_name */
- -1, /* (266) rollup_func_name ::= FIRST */
- -1, /* (267) rollup_func_name ::= LAST */
- -1, /* (268) col_name_list ::= col_name */
- -3, /* (269) col_name_list ::= col_name_list NK_COMMA col_name */
- -1, /* (270) col_name ::= column_name */
- -2, /* (271) cmd ::= SHOW DNODES */
- -2, /* (272) cmd ::= SHOW USERS */
- -3, /* (273) cmd ::= SHOW USERS FULL */
- -3, /* (274) cmd ::= SHOW USER PRIVILEGES */
- -3, /* (275) cmd ::= SHOW db_kind_opt DATABASES */
- -4, /* (276) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
- -4, /* (277) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
- -3, /* (278) cmd ::= SHOW db_name_cond_opt VGROUPS */
- -2, /* (279) cmd ::= SHOW MNODES */
- -2, /* (280) cmd ::= SHOW QNODES */
- -2, /* (281) cmd ::= SHOW ARBGROUPS */
- -2, /* (282) cmd ::= SHOW FUNCTIONS */
- -5, /* (283) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
- -6, /* (284) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
- -2, /* (285) cmd ::= SHOW STREAMS */
- -2, /* (286) cmd ::= SHOW ACCOUNTS */
- -2, /* (287) cmd ::= SHOW APPS */
- -2, /* (288) cmd ::= SHOW CONNECTIONS */
- -2, /* (289) cmd ::= SHOW LICENCES */
- -2, /* (290) cmd ::= SHOW GRANTS */
- -3, /* (291) cmd ::= SHOW GRANTS FULL */
- -3, /* (292) cmd ::= SHOW GRANTS LOGS */
- -3, /* (293) cmd ::= SHOW CLUSTER MACHINES */
- -4, /* (294) cmd ::= SHOW CREATE DATABASE db_name */
- -4, /* (295) cmd ::= SHOW CREATE TABLE full_table_name */
- -4, /* (296) cmd ::= SHOW CREATE STABLE full_table_name */
- -2, /* (297) cmd ::= SHOW ENCRYPTIONS */
- -2, /* (298) cmd ::= SHOW QUERIES */
- -2, /* (299) cmd ::= SHOW SCORES */
- -2, /* (300) cmd ::= SHOW TOPICS */
- -2, /* (301) cmd ::= SHOW VARIABLES */
- -3, /* (302) cmd ::= SHOW CLUSTER VARIABLES */
- -3, /* (303) cmd ::= SHOW LOCAL VARIABLES */
- -5, /* (304) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
- -2, /* (305) cmd ::= SHOW BNODES */
- -2, /* (306) cmd ::= SHOW SNODES */
- -2, /* (307) cmd ::= SHOW CLUSTER */
- -2, /* (308) cmd ::= SHOW TRANSACTIONS */
- -4, /* (309) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
- -2, /* (310) cmd ::= SHOW CONSUMERS */
- -2, /* (311) cmd ::= SHOW SUBSCRIPTIONS */
- -5, /* (312) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
- -6, /* (313) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
- -7, /* (314) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
- -8, /* (315) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
- -5, /* (316) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
- -2, /* (317) cmd ::= SHOW VNODES */
- -3, /* (318) cmd ::= SHOW db_name_cond_opt ALIVE */
- -3, /* (319) cmd ::= SHOW CLUSTER ALIVE */
- -4, /* (320) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
- -4, /* (321) cmd ::= SHOW CREATE VIEW full_table_name */
- -2, /* (322) cmd ::= SHOW COMPACTS */
- -3, /* (323) cmd ::= SHOW COMPACT NK_INTEGER */
- 0, /* (324) table_kind_db_name_cond_opt ::= */
- -1, /* (325) table_kind_db_name_cond_opt ::= table_kind */
- -2, /* (326) table_kind_db_name_cond_opt ::= db_name NK_DOT */
- -3, /* (327) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
- -1, /* (328) table_kind ::= NORMAL */
- -1, /* (329) table_kind ::= CHILD */
- 0, /* (330) db_name_cond_opt ::= */
- -2, /* (331) db_name_cond_opt ::= db_name NK_DOT */
- 0, /* (332) like_pattern_opt ::= */
- -2, /* (333) like_pattern_opt ::= LIKE NK_STRING */
- -1, /* (334) table_name_cond ::= table_name */
- 0, /* (335) from_db_opt ::= */
- -2, /* (336) from_db_opt ::= FROM db_name */
- 0, /* (337) tag_list_opt ::= */
- -1, /* (338) tag_list_opt ::= tag_item */
- -3, /* (339) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
- -1, /* (340) tag_item ::= TBNAME */
- -1, /* (341) tag_item ::= QTAGS */
- -1, /* (342) tag_item ::= column_name */
- -2, /* (343) tag_item ::= column_name column_alias */
- -3, /* (344) tag_item ::= column_name AS column_alias */
- 0, /* (345) db_kind_opt ::= */
- -1, /* (346) db_kind_opt ::= USER */
- -1, /* (347) db_kind_opt ::= SYSTEM */
- -11, /* (348) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */
- -11, /* (349) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */
- -4, /* (350) cmd ::= DROP TSMA exists_opt full_tsma_name */
- -3, /* (351) cmd ::= SHOW db_name_cond_opt TSMAS */
- -1, /* (352) full_tsma_name ::= tsma_name */
- -3, /* (353) full_tsma_name ::= db_name NK_DOT tsma_name */
- -4, /* (354) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */
- -8, /* (355) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
- -9, /* (356) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
- -4, /* (357) cmd ::= DROP INDEX exists_opt full_index_name */
- -1, /* (358) full_index_name ::= index_name */
- -3, /* (359) full_index_name ::= db_name NK_DOT index_name */
- -10, /* (360) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
- -12, /* (361) 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 */
- -1, /* (362) func_list ::= func */
- -3, /* (363) func_list ::= func_list NK_COMMA func */
- -4, /* (364) func ::= sma_func_name NK_LP expression_list NK_RP */
- -1, /* (365) sma_func_name ::= function_name */
- -1, /* (366) sma_func_name ::= COUNT */
- -1, /* (367) sma_func_name ::= FIRST */
- -1, /* (368) sma_func_name ::= LAST */
- -1, /* (369) sma_func_name ::= LAST_ROW */
- 0, /* (370) sma_stream_opt ::= */
- -3, /* (371) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
- -3, /* (372) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
- -3, /* (373) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
- -1, /* (374) with_meta ::= AS */
- -3, /* (375) with_meta ::= WITH META AS */
- -3, /* (376) with_meta ::= ONLY META AS */
- -6, /* (377) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
- -7, /* (378) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
- -8, /* (379) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
- -4, /* (380) cmd ::= DROP TOPIC exists_opt topic_name */
- -7, /* (381) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
- -2, /* (382) cmd ::= DESC full_table_name */
- -2, /* (383) cmd ::= DESCRIBE full_table_name */
- -3, /* (384) cmd ::= RESET QUERY CACHE */
- -4, /* (385) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- -4, /* (386) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
- 0, /* (387) analyze_opt ::= */
- -1, /* (388) analyze_opt ::= ANALYZE */
- 0, /* (389) explain_options ::= */
- -3, /* (390) explain_options ::= explain_options VERBOSE NK_BOOL */
- -3, /* (391) explain_options ::= explain_options RATIO NK_FLOAT */
- -12, /* (392) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
- -4, /* (393) cmd ::= DROP FUNCTION exists_opt function_name */
- 0, /* (394) agg_func_opt ::= */
- -1, /* (395) agg_func_opt ::= AGGREGATE */
- 0, /* (396) bufsize_opt ::= */
- -2, /* (397) bufsize_opt ::= BUFSIZE NK_INTEGER */
- 0, /* (398) language_opt ::= */
- -2, /* (399) language_opt ::= LANGUAGE NK_STRING */
- 0, /* (400) or_replace_opt ::= */
- -2, /* (401) or_replace_opt ::= OR REPLACE */
- -6, /* (402) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
- -4, /* (403) cmd ::= DROP VIEW exists_opt full_view_name */
- -1, /* (404) full_view_name ::= view_name */
- -3, /* (405) full_view_name ::= db_name NK_DOT view_name */
- -12, /* (406) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
- -4, /* (407) cmd ::= DROP STREAM exists_opt stream_name */
- -4, /* (408) cmd ::= PAUSE STREAM exists_opt stream_name */
- -5, /* (409) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
- 0, /* (410) col_list_opt ::= */
- -3, /* (411) col_list_opt ::= NK_LP column_stream_def_list NK_RP */
- -1, /* (412) column_stream_def_list ::= column_stream_def */
- -3, /* (413) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */
- -2, /* (414) column_stream_def ::= column_name stream_col_options */
- 0, /* (415) stream_col_options ::= */
- -3, /* (416) stream_col_options ::= stream_col_options PRIMARY KEY */
- 0, /* (417) tag_def_or_ref_opt ::= */
- -1, /* (418) tag_def_or_ref_opt ::= tags_def */
- -4, /* (419) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */
- 0, /* (420) stream_options ::= */
- -3, /* (421) stream_options ::= stream_options TRIGGER AT_ONCE */
- -3, /* (422) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
- -4, /* (423) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
- -3, /* (424) stream_options ::= stream_options WATERMARK duration_literal */
- -4, /* (425) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
- -3, /* (426) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
- -3, /* (427) stream_options ::= stream_options DELETE_MARK duration_literal */
- -4, /* (428) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
- 0, /* (429) subtable_opt ::= */
- -4, /* (430) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- 0, /* (431) ignore_opt ::= */
- -2, /* (432) ignore_opt ::= IGNORE UNTREATED */
- -3, /* (433) cmd ::= KILL CONNECTION NK_INTEGER */
- -3, /* (434) cmd ::= KILL QUERY NK_STRING */
- -3, /* (435) cmd ::= KILL TRANSACTION NK_INTEGER */
- -3, /* (436) cmd ::= KILL COMPACT NK_INTEGER */
- -2, /* (437) cmd ::= BALANCE VGROUP */
- -4, /* (438) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
- -5, /* (439) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */
- -4, /* (440) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
- -4, /* (441) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
- -3, /* (442) cmd ::= SPLIT VGROUP NK_INTEGER */
- 0, /* (443) on_vgroup_id ::= */
- -2, /* (444) on_vgroup_id ::= ON NK_INTEGER */
- -2, /* (445) dnode_list ::= DNODE NK_INTEGER */
- -3, /* (446) dnode_list ::= dnode_list DNODE NK_INTEGER */
- -4, /* (447) cmd ::= DELETE FROM full_table_name where_clause_opt */
- -1, /* (448) cmd ::= query_or_subquery */
- -1, /* (449) cmd ::= insert_query */
- -7, /* (450) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
- -4, /* (451) insert_query ::= INSERT INTO full_table_name query_or_subquery */
- -1, /* (452) tags_literal ::= NK_INTEGER */
- -3, /* (453) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */
- -3, /* (454) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */
- -2, /* (455) tags_literal ::= NK_PLUS NK_INTEGER */
- -4, /* (456) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */
- -4, /* (457) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */
- -2, /* (458) tags_literal ::= NK_MINUS NK_INTEGER */
- -4, /* (459) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */
- -4, /* (460) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */
- -1, /* (461) tags_literal ::= NK_FLOAT */
- -2, /* (462) tags_literal ::= NK_PLUS NK_FLOAT */
- -2, /* (463) tags_literal ::= NK_MINUS NK_FLOAT */
- -1, /* (464) tags_literal ::= NK_BIN */
- -3, /* (465) tags_literal ::= NK_BIN NK_PLUS duration_literal */
- -3, /* (466) tags_literal ::= NK_BIN NK_MINUS duration_literal */
- -2, /* (467) tags_literal ::= NK_PLUS NK_BIN */
- -4, /* (468) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */
- -4, /* (469) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */
- -2, /* (470) tags_literal ::= NK_MINUS NK_BIN */
- -4, /* (471) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */
- -4, /* (472) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */
- -1, /* (473) tags_literal ::= NK_HEX */
- -3, /* (474) tags_literal ::= NK_HEX NK_PLUS duration_literal */
- -3, /* (475) tags_literal ::= NK_HEX NK_MINUS duration_literal */
- -2, /* (476) tags_literal ::= NK_PLUS NK_HEX */
- -4, /* (477) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */
- -4, /* (478) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */
- -2, /* (479) tags_literal ::= NK_MINUS NK_HEX */
- -4, /* (480) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */
- -4, /* (481) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */
- -1, /* (482) tags_literal ::= NK_STRING */
- -3, /* (483) tags_literal ::= NK_STRING NK_PLUS duration_literal */
- -3, /* (484) tags_literal ::= NK_STRING NK_MINUS duration_literal */
- -1, /* (485) tags_literal ::= NK_BOOL */
- -1, /* (486) tags_literal ::= NULL */
- -1, /* (487) tags_literal ::= literal_func */
- -3, /* (488) tags_literal ::= literal_func NK_PLUS duration_literal */
- -3, /* (489) tags_literal ::= literal_func NK_MINUS duration_literal */
- -1, /* (490) tags_literal_list ::= tags_literal */
- -3, /* (491) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */
- -1, /* (492) literal ::= NK_INTEGER */
- -1, /* (493) literal ::= NK_FLOAT */
- -1, /* (494) literal ::= NK_STRING */
- -1, /* (495) literal ::= NK_BOOL */
- -2, /* (496) literal ::= TIMESTAMP NK_STRING */
- -1, /* (497) literal ::= duration_literal */
- -1, /* (498) literal ::= NULL */
- -1, /* (499) literal ::= NK_QUESTION */
- -1, /* (500) duration_literal ::= NK_VARIABLE */
- -1, /* (501) signed ::= NK_INTEGER */
- -2, /* (502) signed ::= NK_PLUS NK_INTEGER */
- -2, /* (503) signed ::= NK_MINUS NK_INTEGER */
- -1, /* (504) signed ::= NK_FLOAT */
- -2, /* (505) signed ::= NK_PLUS NK_FLOAT */
- -2, /* (506) signed ::= NK_MINUS NK_FLOAT */
- -1, /* (507) signed_literal ::= signed */
- -1, /* (508) signed_literal ::= NK_STRING */
- -1, /* (509) signed_literal ::= NK_BOOL */
- -2, /* (510) signed_literal ::= TIMESTAMP NK_STRING */
- -1, /* (511) signed_literal ::= duration_literal */
- -1, /* (512) signed_literal ::= NULL */
- -1, /* (513) signed_literal ::= literal_func */
- -1, /* (514) signed_literal ::= NK_QUESTION */
- -1, /* (515) literal_list ::= signed_literal */
- -3, /* (516) literal_list ::= literal_list NK_COMMA signed_literal */
- -1, /* (517) db_name ::= NK_ID */
- -1, /* (518) table_name ::= NK_ID */
- -1, /* (519) column_name ::= NK_ID */
- -1, /* (520) function_name ::= NK_ID */
- -1, /* (521) view_name ::= NK_ID */
- -1, /* (522) table_alias ::= NK_ID */
- -1, /* (523) column_alias ::= NK_ID */
- -1, /* (524) column_alias ::= NK_ALIAS */
- -1, /* (525) user_name ::= NK_ID */
- -1, /* (526) topic_name ::= NK_ID */
- -1, /* (527) stream_name ::= NK_ID */
- -1, /* (528) cgroup_name ::= NK_ID */
- -1, /* (529) index_name ::= NK_ID */
- -1, /* (530) tsma_name ::= NK_ID */
- -1, /* (531) expr_or_subquery ::= expression */
- -1, /* (532) expression ::= literal */
- -1, /* (533) expression ::= pseudo_column */
- -1, /* (534) expression ::= column_reference */
- -1, /* (535) expression ::= function_expression */
- -1, /* (536) expression ::= case_when_expression */
- -3, /* (537) expression ::= NK_LP expression NK_RP */
- -2, /* (538) expression ::= NK_PLUS expr_or_subquery */
- -2, /* (539) expression ::= NK_MINUS expr_or_subquery */
- -3, /* (540) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
- -3, /* (541) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
- -3, /* (542) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
- -3, /* (543) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
- -3, /* (544) expression ::= expr_or_subquery NK_REM expr_or_subquery */
- -3, /* (545) expression ::= column_reference NK_ARROW NK_STRING */
- -3, /* (546) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
- -3, /* (547) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
- -1, /* (548) expression_list ::= expr_or_subquery */
- -3, /* (549) expression_list ::= expression_list NK_COMMA expr_or_subquery */
- -1, /* (550) column_reference ::= column_name */
- -3, /* (551) column_reference ::= table_name NK_DOT column_name */
- -1, /* (552) column_reference ::= NK_ALIAS */
- -3, /* (553) column_reference ::= table_name NK_DOT NK_ALIAS */
- -1, /* (554) pseudo_column ::= ROWTS */
- -1, /* (555) pseudo_column ::= TBNAME */
- -3, /* (556) pseudo_column ::= table_name NK_DOT TBNAME */
- -1, /* (557) pseudo_column ::= QSTART */
- -1, /* (558) pseudo_column ::= QEND */
- -1, /* (559) pseudo_column ::= QDURATION */
- -1, /* (560) pseudo_column ::= WSTART */
- -1, /* (561) pseudo_column ::= WEND */
- -1, /* (562) pseudo_column ::= WDURATION */
- -1, /* (563) pseudo_column ::= IROWTS */
- -1, /* (564) pseudo_column ::= ISFILLED */
- -1, /* (565) pseudo_column ::= QTAGS */
- -4, /* (566) function_expression ::= function_name NK_LP expression_list NK_RP */
- -4, /* (567) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
- -6, /* (568) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
- -6, /* (569) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */
- -6, /* (570) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */
- -4, /* (571) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */
- -6, /* (572) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */
- -6, /* (573) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
- -7, /* (574) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */
- -4, /* (575) function_expression ::= substr_func NK_LP expression_list NK_RP */
- -6, /* (576) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
- -8, /* (577) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */
- -4, /* (578) function_expression ::= REPLACE NK_LP expression_list NK_RP */
- -1, /* (579) function_expression ::= literal_func */
- -1, /* (580) function_expression ::= rand_func */
- -3, /* (581) literal_func ::= noarg_func NK_LP NK_RP */
- -1, /* (582) literal_func ::= NOW */
- -1, /* (583) literal_func ::= TODAY */
- -3, /* (584) rand_func ::= RAND NK_LP NK_RP */
- -4, /* (585) rand_func ::= RAND NK_LP expression_list NK_RP */
- -1, /* (586) substr_func ::= SUBSTR */
- -1, /* (587) substr_func ::= SUBSTRING */
- -1, /* (588) trim_specification_type ::= BOTH */
- -1, /* (589) trim_specification_type ::= TRAILING */
- -1, /* (590) trim_specification_type ::= LEADING */
- -1, /* (591) noarg_func ::= NOW */
- -1, /* (592) noarg_func ::= TODAY */
- -1, /* (593) noarg_func ::= TIMEZONE */
- -1, /* (594) noarg_func ::= DATABASE */
- -1, /* (595) noarg_func ::= CLIENT_VERSION */
- -1, /* (596) noarg_func ::= SERVER_VERSION */
- -1, /* (597) noarg_func ::= SERVER_STATUS */
- -1, /* (598) noarg_func ::= CURRENT_USER */
- -1, /* (599) noarg_func ::= USER */
- -1, /* (600) noarg_func ::= PI */
- -1, /* (601) star_func ::= COUNT */
- -1, /* (602) star_func ::= FIRST */
- -1, /* (603) star_func ::= LAST */
- -1, /* (604) star_func ::= LAST_ROW */
- -1, /* (605) star_func_para_list ::= NK_STAR */
- -1, /* (606) star_func_para_list ::= other_para_list */
- -1, /* (607) other_para_list ::= star_func_para */
- -3, /* (608) other_para_list ::= other_para_list NK_COMMA star_func_para */
- -1, /* (609) star_func_para ::= expr_or_subquery */
- -3, /* (610) star_func_para ::= table_name NK_DOT NK_STAR */
- -4, /* (611) case_when_expression ::= CASE when_then_list case_when_else_opt END */
- -5, /* (612) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
- -1, /* (613) when_then_list ::= when_then_expr */
- -2, /* (614) when_then_list ::= when_then_list when_then_expr */
- -4, /* (615) when_then_expr ::= WHEN common_expression THEN common_expression */
- 0, /* (616) case_when_else_opt ::= */
- -2, /* (617) case_when_else_opt ::= ELSE common_expression */
- -3, /* (618) predicate ::= expr_or_subquery compare_op expr_or_subquery */
- -5, /* (619) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
- -6, /* (620) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
- -3, /* (621) predicate ::= expr_or_subquery IS NULL */
- -4, /* (622) predicate ::= expr_or_subquery IS NOT NULL */
- -3, /* (623) predicate ::= expr_or_subquery in_op in_predicate_value */
- -1, /* (624) compare_op ::= NK_LT */
- -1, /* (625) compare_op ::= NK_GT */
- -1, /* (626) compare_op ::= NK_LE */
- -1, /* (627) compare_op ::= NK_GE */
- -1, /* (628) compare_op ::= NK_NE */
- -1, /* (629) compare_op ::= NK_EQ */
- -1, /* (630) compare_op ::= LIKE */
- -2, /* (631) compare_op ::= NOT LIKE */
- -1, /* (632) compare_op ::= MATCH */
- -1, /* (633) compare_op ::= NMATCH */
- -1, /* (634) compare_op ::= CONTAINS */
- -1, /* (635) in_op ::= IN */
- -2, /* (636) in_op ::= NOT IN */
- -3, /* (637) in_predicate_value ::= NK_LP literal_list NK_RP */
- -1, /* (638) boolean_value_expression ::= boolean_primary */
- -2, /* (639) boolean_value_expression ::= NOT boolean_primary */
- -3, /* (640) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
- -3, /* (641) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
- -1, /* (642) boolean_primary ::= predicate */
- -3, /* (643) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
- -1, /* (644) common_expression ::= expr_or_subquery */
- -1, /* (645) common_expression ::= boolean_value_expression */
- 0, /* (646) from_clause_opt ::= */
- -2, /* (647) from_clause_opt ::= FROM table_reference_list */
- -1, /* (648) table_reference_list ::= table_reference */
- -3, /* (649) table_reference_list ::= table_reference_list NK_COMMA table_reference */
- -1, /* (650) table_reference ::= table_primary */
- -1, /* (651) table_reference ::= joined_table */
- -2, /* (652) table_primary ::= table_name alias_opt */
- -4, /* (653) table_primary ::= db_name NK_DOT table_name alias_opt */
- -2, /* (654) table_primary ::= subquery alias_opt */
- -1, /* (655) table_primary ::= parenthesized_joined_table */
- 0, /* (656) alias_opt ::= */
- -1, /* (657) alias_opt ::= table_alias */
- -2, /* (658) alias_opt ::= AS table_alias */
- -3, /* (659) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- -3, /* (660) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
- -8, /* (661) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
- 0, /* (662) join_type ::= */
- -1, /* (663) join_type ::= INNER */
- -1, /* (664) join_type ::= LEFT */
- -1, /* (665) join_type ::= RIGHT */
- -1, /* (666) join_type ::= FULL */
- 0, /* (667) join_subtype ::= */
- -1, /* (668) join_subtype ::= OUTER */
- -1, /* (669) join_subtype ::= SEMI */
- -1, /* (670) join_subtype ::= ANTI */
- -1, /* (671) join_subtype ::= ASOF */
- -1, /* (672) join_subtype ::= WINDOW */
- 0, /* (673) join_on_clause_opt ::= */
- -2, /* (674) join_on_clause_opt ::= ON search_condition */
- 0, /* (675) window_offset_clause_opt ::= */
- -6, /* (676) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
- -1, /* (677) window_offset_literal ::= NK_VARIABLE */
- -2, /* (678) window_offset_literal ::= NK_MINUS NK_VARIABLE */
- 0, /* (679) jlimit_clause_opt ::= */
- -2, /* (680) jlimit_clause_opt ::= JLIMIT NK_INTEGER */
- -14, /* (681) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
- 0, /* (682) hint_list ::= */
- -1, /* (683) hint_list ::= NK_HINT */
- 0, /* (684) tag_mode_opt ::= */
- -1, /* (685) tag_mode_opt ::= TAGS */
- 0, /* (686) set_quantifier_opt ::= */
- -1, /* (687) set_quantifier_opt ::= DISTINCT */
- -1, /* (688) set_quantifier_opt ::= ALL */
- -1, /* (689) select_list ::= select_item */
- -3, /* (690) select_list ::= select_list NK_COMMA select_item */
- -1, /* (691) select_item ::= NK_STAR */
- -1, /* (692) select_item ::= common_expression */
- -2, /* (693) select_item ::= common_expression column_alias */
- -3, /* (694) select_item ::= common_expression AS column_alias */
- -3, /* (695) select_item ::= table_name NK_DOT NK_STAR */
- 0, /* (696) where_clause_opt ::= */
- -2, /* (697) where_clause_opt ::= WHERE search_condition */
- 0, /* (698) partition_by_clause_opt ::= */
- -3, /* (699) partition_by_clause_opt ::= PARTITION BY partition_list */
- -1, /* (700) partition_list ::= partition_item */
- -3, /* (701) partition_list ::= partition_list NK_COMMA partition_item */
- -1, /* (702) partition_item ::= expr_or_subquery */
- -2, /* (703) partition_item ::= expr_or_subquery column_alias */
- -3, /* (704) partition_item ::= expr_or_subquery AS column_alias */
- 0, /* (705) twindow_clause_opt ::= */
- -6, /* (706) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
- -4, /* (707) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
- -6, /* (708) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- -8, /* (709) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
- -7, /* (710) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
- -4, /* (711) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
- -6, /* (712) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
- 0, /* (713) sliding_opt ::= */
- -4, /* (714) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
- -1, /* (715) interval_sliding_duration_literal ::= NK_VARIABLE */
- -1, /* (716) interval_sliding_duration_literal ::= NK_STRING */
- -1, /* (717) interval_sliding_duration_literal ::= NK_INTEGER */
- 0, /* (718) fill_opt ::= */
- -4, /* (719) fill_opt ::= FILL NK_LP fill_mode NK_RP */
- -6, /* (720) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
- -6, /* (721) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
- -1, /* (722) fill_mode ::= NONE */
- -1, /* (723) fill_mode ::= PREV */
- -1, /* (724) fill_mode ::= NULL */
- -1, /* (725) fill_mode ::= NULL_F */
- -1, /* (726) fill_mode ::= LINEAR */
- -1, /* (727) fill_mode ::= NEXT */
- 0, /* (728) group_by_clause_opt ::= */
- -3, /* (729) group_by_clause_opt ::= GROUP BY group_by_list */
- -1, /* (730) group_by_list ::= expr_or_subquery */
- -3, /* (731) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
- 0, /* (732) having_clause_opt ::= */
- -2, /* (733) having_clause_opt ::= HAVING search_condition */
- 0, /* (734) range_opt ::= */
- -6, /* (735) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
- -4, /* (736) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
- 0, /* (737) every_opt ::= */
- -4, /* (738) every_opt ::= EVERY NK_LP duration_literal NK_RP */
- -4, /* (739) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
- -1, /* (740) query_simple ::= query_specification */
- -1, /* (741) query_simple ::= union_query_expression */
- -4, /* (742) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
- -3, /* (743) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
- -1, /* (744) query_simple_or_subquery ::= query_simple */
- -1, /* (745) query_simple_or_subquery ::= subquery */
- -1, /* (746) query_or_subquery ::= query_expression */
- -1, /* (747) query_or_subquery ::= subquery */
- 0, /* (748) order_by_clause_opt ::= */
- -3, /* (749) order_by_clause_opt ::= ORDER BY sort_specification_list */
- 0, /* (750) slimit_clause_opt ::= */
- -2, /* (751) slimit_clause_opt ::= SLIMIT NK_INTEGER */
- -4, /* (752) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- -4, /* (753) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- 0, /* (754) limit_clause_opt ::= */
- -2, /* (755) limit_clause_opt ::= LIMIT NK_INTEGER */
- -4, /* (756) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
- -4, /* (757) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- -3, /* (758) subquery ::= NK_LP query_expression NK_RP */
- -3, /* (759) subquery ::= NK_LP subquery NK_RP */
- -1, /* (760) search_condition ::= common_expression */
- -1, /* (761) sort_specification_list ::= sort_specification */
- -3, /* (762) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
- -3, /* (763) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
- 0, /* (764) ordering_specification_opt ::= */
- -1, /* (765) ordering_specification_opt ::= ASC */
- -1, /* (766) ordering_specification_opt ::= DESC */
- 0, /* (767) null_ordering_opt ::= */
- -2, /* (768) null_ordering_opt ::= NULLS FIRST */
- -2, /* (769) null_ordering_opt ::= NULLS LAST */
- 0, /* (770) column_options ::= */
- -3, /* (771) column_options ::= column_options PRIMARY KEY */
- -3, /* (772) column_options ::= column_options NK_ID NK_STRING */
+ -3, /* (60) cmd ::= CREATE ANODE NK_STRING */
+ -3, /* (61) cmd ::= UPDATE ANODE NK_INTEGER */
+ -3, /* (62) cmd ::= UPDATE ALL ANODES */
+ -3, /* (63) cmd ::= DROP ANODE NK_INTEGER */
+ -3, /* (64) cmd ::= CREATE DNODE dnode_endpoint */
+ -5, /* (65) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+ -4, /* (66) cmd ::= DROP DNODE NK_INTEGER force_opt */
+ -4, /* (67) cmd ::= DROP DNODE dnode_endpoint force_opt */
+ -4, /* (68) cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
+ -4, /* (69) cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
+ -4, /* (70) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ -5, /* (71) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ -4, /* (72) cmd ::= ALTER ALL DNODES NK_STRING */
+ -5, /* (73) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ -3, /* (74) cmd ::= RESTORE DNODE NK_INTEGER */
+ -1, /* (75) dnode_endpoint ::= NK_STRING */
+ -1, /* (76) dnode_endpoint ::= NK_ID */
+ -1, /* (77) dnode_endpoint ::= NK_IPTOKEN */
+ 0, /* (78) force_opt ::= */
+ -1, /* (79) force_opt ::= FORCE */
+ -1, /* (80) unsafe_opt ::= UNSAFE */
+ -3, /* (81) cmd ::= ALTER CLUSTER NK_STRING */
+ -4, /* (82) cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
+ -3, /* (83) cmd ::= ALTER LOCAL NK_STRING */
+ -4, /* (84) cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ -5, /* (85) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ -5, /* (86) cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ -5, /* (87) cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
+ -5, /* (88) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ -5, /* (89) cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ -5, /* (90) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ -5, /* (91) cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ -5, /* (92) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ -5, /* (93) cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ -5, /* (94) cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
+ -5, /* (95) cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
+ -5, /* (96) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+ -4, /* (97) cmd ::= DROP DATABASE exists_opt db_name */
+ -2, /* (98) cmd ::= USE db_name */
+ -4, /* (99) cmd ::= ALTER DATABASE db_name alter_db_options */
+ -3, /* (100) cmd ::= FLUSH DATABASE db_name */
+ -4, /* (101) cmd ::= TRIM DATABASE db_name speed_opt */
+ -3, /* (102) cmd ::= S3MIGRATE DATABASE db_name */
+ -5, /* (103) cmd ::= COMPACT DATABASE db_name start_opt end_opt */
+ -3, /* (104) not_exists_opt ::= IF NOT EXISTS */
+ 0, /* (105) not_exists_opt ::= */
+ -2, /* (106) exists_opt ::= IF EXISTS */
+ 0, /* (107) exists_opt ::= */
+ 0, /* (108) db_options ::= */
+ -3, /* (109) db_options ::= db_options BUFFER NK_INTEGER */
+ -3, /* (110) db_options ::= db_options CACHEMODEL NK_STRING */
+ -3, /* (111) db_options ::= db_options CACHESIZE NK_INTEGER */
+ -3, /* (112) db_options ::= db_options COMP NK_INTEGER */
+ -3, /* (113) db_options ::= db_options DURATION NK_INTEGER */
+ -3, /* (114) db_options ::= db_options DURATION NK_VARIABLE */
+ -3, /* (115) db_options ::= db_options MAXROWS NK_INTEGER */
+ -3, /* (116) db_options ::= db_options MINROWS NK_INTEGER */
+ -3, /* (117) db_options ::= db_options KEEP integer_list */
+ -3, /* (118) db_options ::= db_options KEEP variable_list */
+ -3, /* (119) db_options ::= db_options PAGES NK_INTEGER */
+ -3, /* (120) db_options ::= db_options PAGESIZE NK_INTEGER */
+ -3, /* (121) db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+ -3, /* (122) db_options ::= db_options PRECISION NK_STRING */
+ -3, /* (123) db_options ::= db_options REPLICA NK_INTEGER */
+ -3, /* (124) db_options ::= db_options VGROUPS NK_INTEGER */
+ -3, /* (125) db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+ -3, /* (126) db_options ::= db_options RETENTIONS retention_list */
+ -3, /* (127) db_options ::= db_options SCHEMALESS NK_INTEGER */
+ -3, /* (128) db_options ::= db_options WAL_LEVEL NK_INTEGER */
+ -3, /* (129) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+ -3, /* (130) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+ -4, /* (131) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ -3, /* (132) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+ -4, /* (133) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ -3, /* (134) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+ -3, /* (135) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+ -3, /* (136) db_options ::= db_options STT_TRIGGER NK_INTEGER */
+ -3, /* (137) db_options ::= db_options TABLE_PREFIX signed */
+ -3, /* (138) db_options ::= db_options TABLE_SUFFIX signed */
+ -3, /* (139) db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */
+ -3, /* (140) db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */
+ -3, /* (141) db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */
+ -3, /* (142) db_options ::= db_options S3_COMPACT NK_INTEGER */
+ -3, /* (143) db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
+ -3, /* (144) db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */
+ -1, /* (145) alter_db_options ::= alter_db_option */
+ -2, /* (146) alter_db_options ::= alter_db_options alter_db_option */
+ -2, /* (147) alter_db_option ::= BUFFER NK_INTEGER */
+ -2, /* (148) alter_db_option ::= CACHEMODEL NK_STRING */
+ -2, /* (149) alter_db_option ::= CACHESIZE NK_INTEGER */
+ -2, /* (150) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+ -2, /* (151) alter_db_option ::= KEEP integer_list */
+ -2, /* (152) alter_db_option ::= KEEP variable_list */
+ -2, /* (153) alter_db_option ::= PAGES NK_INTEGER */
+ -2, /* (154) alter_db_option ::= REPLICA NK_INTEGER */
+ -2, /* (155) alter_db_option ::= WAL_LEVEL NK_INTEGER */
+ -2, /* (156) alter_db_option ::= STT_TRIGGER NK_INTEGER */
+ -2, /* (157) alter_db_option ::= MINROWS NK_INTEGER */
+ -2, /* (158) alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
+ -3, /* (159) alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ -2, /* (160) alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
+ -3, /* (161) alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ -2, /* (162) alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */
+ -2, /* (163) alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */
+ -2, /* (164) alter_db_option ::= S3_COMPACT NK_INTEGER */
+ -2, /* (165) alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
+ -2, /* (166) alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */
+ -1, /* (167) integer_list ::= NK_INTEGER */
+ -3, /* (168) integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ -1, /* (169) variable_list ::= NK_VARIABLE */
+ -3, /* (170) variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+ -1, /* (171) retention_list ::= retention */
+ -3, /* (172) retention_list ::= retention_list NK_COMMA retention */
+ -3, /* (173) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ -3, /* (174) retention ::= NK_MINUS NK_COLON NK_VARIABLE */
+ 0, /* (175) speed_opt ::= */
+ -2, /* (176) speed_opt ::= BWLIMIT NK_INTEGER */
+ 0, /* (177) start_opt ::= */
+ -3, /* (178) start_opt ::= START WITH NK_INTEGER */
+ -3, /* (179) start_opt ::= START WITH NK_STRING */
+ -4, /* (180) start_opt ::= START WITH TIMESTAMP NK_STRING */
+ 0, /* (181) end_opt ::= */
+ -3, /* (182) end_opt ::= END WITH NK_INTEGER */
+ -3, /* (183) end_opt ::= END WITH NK_STRING */
+ -4, /* (184) end_opt ::= END WITH TIMESTAMP NK_STRING */
+ -9, /* (185) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ -3, /* (186) cmd ::= CREATE TABLE multi_create_clause */
+ -10, /* (187) cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */
+ -9, /* (188) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */
+ -4, /* (189) cmd ::= DROP TABLE with_opt multi_drop_clause */
+ -5, /* (190) cmd ::= DROP STABLE with_opt exists_opt full_table_name */
+ -3, /* (191) cmd ::= ALTER TABLE alter_table_clause */
+ -3, /* (192) cmd ::= ALTER STABLE alter_table_clause */
+ -2, /* (193) alter_table_clause ::= full_table_name alter_table_options */
+ -6, /* (194) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */
+ -4, /* (195) alter_table_clause ::= full_table_name DROP COLUMN column_name */
+ -5, /* (196) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+ -5, /* (197) alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
+ -5, /* (198) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+ -5, /* (199) alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+ -4, /* (200) alter_table_clause ::= full_table_name DROP TAG column_name */
+ -5, /* (201) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+ -5, /* (202) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+ -6, /* (203) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */
+ -1, /* (204) multi_create_clause ::= create_subtable_clause */
+ -2, /* (205) multi_create_clause ::= multi_create_clause create_subtable_clause */
+ -10, /* (206) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */
+ -1, /* (207) multi_drop_clause ::= drop_table_clause */
+ -3, /* (208) multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */
+ -2, /* (209) drop_table_clause ::= exists_opt full_table_name */
+ 0, /* (210) with_opt ::= */
+ -1, /* (211) with_opt ::= WITH */
+ 0, /* (212) specific_cols_opt ::= */
+ -3, /* (213) specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ -1, /* (214) full_table_name ::= table_name */
+ -3, /* (215) full_table_name ::= db_name NK_DOT table_name */
+ -1, /* (216) tag_def_list ::= tag_def */
+ -3, /* (217) tag_def_list ::= tag_def_list NK_COMMA tag_def */
+ -2, /* (218) tag_def ::= column_name type_name */
+ -1, /* (219) column_def_list ::= column_def */
+ -3, /* (220) column_def_list ::= column_def_list NK_COMMA column_def */
+ -3, /* (221) column_def ::= column_name type_name column_options */
+ -1, /* (222) type_name ::= BOOL */
+ -1, /* (223) type_name ::= TINYINT */
+ -1, /* (224) type_name ::= SMALLINT */
+ -1, /* (225) type_name ::= INT */
+ -1, /* (226) type_name ::= INTEGER */
+ -1, /* (227) type_name ::= BIGINT */
+ -1, /* (228) type_name ::= FLOAT */
+ -1, /* (229) type_name ::= DOUBLE */
+ -4, /* (230) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+ -1, /* (231) type_name ::= TIMESTAMP */
+ -4, /* (232) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+ -2, /* (233) type_name ::= TINYINT UNSIGNED */
+ -2, /* (234) type_name ::= SMALLINT UNSIGNED */
+ -2, /* (235) type_name ::= INT UNSIGNED */
+ -2, /* (236) type_name ::= BIGINT UNSIGNED */
+ -1, /* (237) type_name ::= JSON */
+ -4, /* (238) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+ -1, /* (239) type_name ::= MEDIUMBLOB */
+ -1, /* (240) type_name ::= BLOB */
+ -4, /* (241) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+ -4, /* (242) type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
+ -1, /* (243) type_name ::= DECIMAL */
+ -4, /* (244) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+ -6, /* (245) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ -1, /* (246) type_name_default_len ::= BINARY */
+ -1, /* (247) type_name_default_len ::= NCHAR */
+ -1, /* (248) type_name_default_len ::= VARCHAR */
+ -1, /* (249) type_name_default_len ::= VARBINARY */
+ 0, /* (250) tags_def_opt ::= */
+ -1, /* (251) tags_def_opt ::= tags_def */
+ -4, /* (252) tags_def ::= TAGS NK_LP tag_def_list NK_RP */
+ 0, /* (253) table_options ::= */
+ -3, /* (254) table_options ::= table_options COMMENT NK_STRING */
+ -3, /* (255) table_options ::= table_options MAX_DELAY duration_list */
+ -3, /* (256) table_options ::= table_options WATERMARK duration_list */
+ -5, /* (257) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+ -3, /* (258) table_options ::= table_options TTL NK_INTEGER */
+ -5, /* (259) table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+ -3, /* (260) table_options ::= table_options DELETE_MARK duration_list */
+ -1, /* (261) alter_table_options ::= alter_table_option */
+ -2, /* (262) alter_table_options ::= alter_table_options alter_table_option */
+ -2, /* (263) alter_table_option ::= COMMENT NK_STRING */
+ -2, /* (264) alter_table_option ::= TTL NK_INTEGER */
+ -1, /* (265) duration_list ::= duration_literal */
+ -3, /* (266) duration_list ::= duration_list NK_COMMA duration_literal */
+ -1, /* (267) rollup_func_list ::= rollup_func_name */
+ -3, /* (268) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */
+ -1, /* (269) rollup_func_name ::= function_name */
+ -1, /* (270) rollup_func_name ::= FIRST */
+ -1, /* (271) rollup_func_name ::= LAST */
+ -1, /* (272) col_name_list ::= col_name */
+ -3, /* (273) col_name_list ::= col_name_list NK_COMMA col_name */
+ -1, /* (274) col_name ::= column_name */
+ -2, /* (275) cmd ::= SHOW DNODES */
+ -2, /* (276) cmd ::= SHOW USERS */
+ -3, /* (277) cmd ::= SHOW USERS FULL */
+ -3, /* (278) cmd ::= SHOW USER PRIVILEGES */
+ -3, /* (279) cmd ::= SHOW db_kind_opt DATABASES */
+ -4, /* (280) cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
+ -4, /* (281) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+ -3, /* (282) cmd ::= SHOW db_name_cond_opt VGROUPS */
+ -2, /* (283) cmd ::= SHOW MNODES */
+ -2, /* (284) cmd ::= SHOW QNODES */
+ -2, /* (285) cmd ::= SHOW ANODES */
+ -3, /* (286) cmd ::= SHOW ANODES FULL */
+ -2, /* (287) cmd ::= SHOW ARBGROUPS */
+ -2, /* (288) cmd ::= SHOW FUNCTIONS */
+ -5, /* (289) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+ -6, /* (290) cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
+ -2, /* (291) cmd ::= SHOW STREAMS */
+ -2, /* (292) cmd ::= SHOW ACCOUNTS */
+ -2, /* (293) cmd ::= SHOW APPS */
+ -2, /* (294) cmd ::= SHOW CONNECTIONS */
+ -2, /* (295) cmd ::= SHOW LICENCES */
+ -2, /* (296) cmd ::= SHOW GRANTS */
+ -3, /* (297) cmd ::= SHOW GRANTS FULL */
+ -3, /* (298) cmd ::= SHOW GRANTS LOGS */
+ -3, /* (299) cmd ::= SHOW CLUSTER MACHINES */
+ -4, /* (300) cmd ::= SHOW CREATE DATABASE db_name */
+ -4, /* (301) cmd ::= SHOW CREATE TABLE full_table_name */
+ -4, /* (302) cmd ::= SHOW CREATE STABLE full_table_name */
+ -2, /* (303) cmd ::= SHOW ENCRYPTIONS */
+ -2, /* (304) cmd ::= SHOW QUERIES */
+ -2, /* (305) cmd ::= SHOW SCORES */
+ -2, /* (306) cmd ::= SHOW TOPICS */
+ -2, /* (307) cmd ::= SHOW VARIABLES */
+ -3, /* (308) cmd ::= SHOW CLUSTER VARIABLES */
+ -3, /* (309) cmd ::= SHOW LOCAL VARIABLES */
+ -5, /* (310) cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+ -2, /* (311) cmd ::= SHOW BNODES */
+ -2, /* (312) cmd ::= SHOW SNODES */
+ -2, /* (313) cmd ::= SHOW CLUSTER */
+ -2, /* (314) cmd ::= SHOW TRANSACTIONS */
+ -4, /* (315) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+ -2, /* (316) cmd ::= SHOW CONSUMERS */
+ -2, /* (317) cmd ::= SHOW SUBSCRIPTIONS */
+ -5, /* (318) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+ -6, /* (319) cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
+ -7, /* (320) cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+ -8, /* (321) cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
+ -5, /* (322) cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
+ -2, /* (323) cmd ::= SHOW VNODES */
+ -3, /* (324) cmd ::= SHOW db_name_cond_opt ALIVE */
+ -3, /* (325) cmd ::= SHOW CLUSTER ALIVE */
+ -4, /* (326) cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
+ -4, /* (327) cmd ::= SHOW CREATE VIEW full_table_name */
+ -2, /* (328) cmd ::= SHOW COMPACTS */
+ -3, /* (329) cmd ::= SHOW COMPACT NK_INTEGER */
+ 0, /* (330) table_kind_db_name_cond_opt ::= */
+ -1, /* (331) table_kind_db_name_cond_opt ::= table_kind */
+ -2, /* (332) table_kind_db_name_cond_opt ::= db_name NK_DOT */
+ -3, /* (333) table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
+ -1, /* (334) table_kind ::= NORMAL */
+ -1, /* (335) table_kind ::= CHILD */
+ 0, /* (336) db_name_cond_opt ::= */
+ -2, /* (337) db_name_cond_opt ::= db_name NK_DOT */
+ 0, /* (338) like_pattern_opt ::= */
+ -2, /* (339) like_pattern_opt ::= LIKE NK_STRING */
+ -1, /* (340) table_name_cond ::= table_name */
+ 0, /* (341) from_db_opt ::= */
+ -2, /* (342) from_db_opt ::= FROM db_name */
+ 0, /* (343) tag_list_opt ::= */
+ -1, /* (344) tag_list_opt ::= tag_item */
+ -3, /* (345) tag_list_opt ::= tag_list_opt NK_COMMA tag_item */
+ -1, /* (346) tag_item ::= TBNAME */
+ -1, /* (347) tag_item ::= QTAGS */
+ -1, /* (348) tag_item ::= column_name */
+ -2, /* (349) tag_item ::= column_name column_alias */
+ -3, /* (350) tag_item ::= column_name AS column_alias */
+ 0, /* (351) db_kind_opt ::= */
+ -1, /* (352) db_kind_opt ::= USER */
+ -1, /* (353) db_kind_opt ::= SYSTEM */
+ -11, /* (354) cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */
+ -11, /* (355) cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */
+ -4, /* (356) cmd ::= DROP TSMA exists_opt full_tsma_name */
+ -3, /* (357) cmd ::= SHOW db_name_cond_opt TSMAS */
+ -1, /* (358) full_tsma_name ::= tsma_name */
+ -3, /* (359) full_tsma_name ::= db_name NK_DOT tsma_name */
+ -4, /* (360) tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */
+ -8, /* (361) cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
+ -9, /* (362) cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
+ -4, /* (363) cmd ::= DROP INDEX exists_opt full_index_name */
+ -1, /* (364) full_index_name ::= index_name */
+ -3, /* (365) full_index_name ::= db_name NK_DOT index_name */
+ -10, /* (366) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+ -12, /* (367) 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 */
+ -1, /* (368) func_list ::= func */
+ -3, /* (369) func_list ::= func_list NK_COMMA func */
+ -4, /* (370) func ::= sma_func_name NK_LP expression_list NK_RP */
+ -1, /* (371) sma_func_name ::= function_name */
+ -1, /* (372) sma_func_name ::= COUNT */
+ -1, /* (373) sma_func_name ::= FIRST */
+ -1, /* (374) sma_func_name ::= LAST */
+ -1, /* (375) sma_func_name ::= LAST_ROW */
+ 0, /* (376) sma_stream_opt ::= */
+ -3, /* (377) sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+ -3, /* (378) sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+ -3, /* (379) sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+ -1, /* (380) with_meta ::= AS */
+ -3, /* (381) with_meta ::= WITH META AS */
+ -3, /* (382) with_meta ::= ONLY META AS */
+ -6, /* (383) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+ -7, /* (384) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
+ -8, /* (385) cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
+ -4, /* (386) cmd ::= DROP TOPIC exists_opt topic_name */
+ -7, /* (387) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+ -2, /* (388) cmd ::= DESC full_table_name */
+ -2, /* (389) cmd ::= DESCRIBE full_table_name */
+ -3, /* (390) cmd ::= RESET QUERY CACHE */
+ -4, /* (391) cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ -4, /* (392) cmd ::= EXPLAIN analyze_opt explain_options insert_query */
+ 0, /* (393) analyze_opt ::= */
+ -1, /* (394) analyze_opt ::= ANALYZE */
+ 0, /* (395) explain_options ::= */
+ -3, /* (396) explain_options ::= explain_options VERBOSE NK_BOOL */
+ -3, /* (397) explain_options ::= explain_options RATIO NK_FLOAT */
+ -12, /* (398) cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
+ -4, /* (399) cmd ::= DROP FUNCTION exists_opt function_name */
+ 0, /* (400) agg_func_opt ::= */
+ -1, /* (401) agg_func_opt ::= AGGREGATE */
+ 0, /* (402) bufsize_opt ::= */
+ -2, /* (403) bufsize_opt ::= BUFSIZE NK_INTEGER */
+ 0, /* (404) language_opt ::= */
+ -2, /* (405) language_opt ::= LANGUAGE NK_STRING */
+ 0, /* (406) or_replace_opt ::= */
+ -2, /* (407) or_replace_opt ::= OR REPLACE */
+ -6, /* (408) cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
+ -4, /* (409) cmd ::= DROP VIEW exists_opt full_view_name */
+ -1, /* (410) full_view_name ::= view_name */
+ -3, /* (411) full_view_name ::= db_name NK_DOT view_name */
+ -12, /* (412) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+ -4, /* (413) cmd ::= DROP STREAM exists_opt stream_name */
+ -4, /* (414) cmd ::= PAUSE STREAM exists_opt stream_name */
+ -5, /* (415) cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
+ 0, /* (416) col_list_opt ::= */
+ -3, /* (417) col_list_opt ::= NK_LP column_stream_def_list NK_RP */
+ -1, /* (418) column_stream_def_list ::= column_stream_def */
+ -3, /* (419) column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */
+ -2, /* (420) column_stream_def ::= column_name stream_col_options */
+ 0, /* (421) stream_col_options ::= */
+ -3, /* (422) stream_col_options ::= stream_col_options PRIMARY KEY */
+ 0, /* (423) tag_def_or_ref_opt ::= */
+ -1, /* (424) tag_def_or_ref_opt ::= tags_def */
+ -4, /* (425) tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */
+ 0, /* (426) stream_options ::= */
+ -3, /* (427) stream_options ::= stream_options TRIGGER AT_ONCE */
+ -3, /* (428) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */
+ -4, /* (429) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+ -3, /* (430) stream_options ::= stream_options WATERMARK duration_literal */
+ -4, /* (431) stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+ -3, /* (432) stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+ -3, /* (433) stream_options ::= stream_options DELETE_MARK duration_literal */
+ -4, /* (434) stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+ 0, /* (435) subtable_opt ::= */
+ -4, /* (436) subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ 0, /* (437) ignore_opt ::= */
+ -2, /* (438) ignore_opt ::= IGNORE UNTREATED */
+ -3, /* (439) cmd ::= KILL CONNECTION NK_INTEGER */
+ -3, /* (440) cmd ::= KILL QUERY NK_STRING */
+ -3, /* (441) cmd ::= KILL TRANSACTION NK_INTEGER */
+ -3, /* (442) cmd ::= KILL COMPACT NK_INTEGER */
+ -2, /* (443) cmd ::= BALANCE VGROUP */
+ -4, /* (444) cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
+ -5, /* (445) cmd ::= BALANCE VGROUP LEADER DATABASE db_name */
+ -4, /* (446) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ -4, /* (447) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+ -3, /* (448) cmd ::= SPLIT VGROUP NK_INTEGER */
+ 0, /* (449) on_vgroup_id ::= */
+ -2, /* (450) on_vgroup_id ::= ON NK_INTEGER */
+ -2, /* (451) dnode_list ::= DNODE NK_INTEGER */
+ -3, /* (452) dnode_list ::= dnode_list DNODE NK_INTEGER */
+ -4, /* (453) cmd ::= DELETE FROM full_table_name where_clause_opt */
+ -1, /* (454) cmd ::= query_or_subquery */
+ -1, /* (455) cmd ::= insert_query */
+ -7, /* (456) insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+ -4, /* (457) insert_query ::= INSERT INTO full_table_name query_or_subquery */
+ -1, /* (458) tags_literal ::= NK_INTEGER */
+ -3, /* (459) tags_literal ::= NK_INTEGER NK_PLUS duration_literal */
+ -3, /* (460) tags_literal ::= NK_INTEGER NK_MINUS duration_literal */
+ -2, /* (461) tags_literal ::= NK_PLUS NK_INTEGER */
+ -4, /* (462) tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */
+ -4, /* (463) tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */
+ -2, /* (464) tags_literal ::= NK_MINUS NK_INTEGER */
+ -4, /* (465) tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */
+ -4, /* (466) tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */
+ -1, /* (467) tags_literal ::= NK_FLOAT */
+ -2, /* (468) tags_literal ::= NK_PLUS NK_FLOAT */
+ -2, /* (469) tags_literal ::= NK_MINUS NK_FLOAT */
+ -1, /* (470) tags_literal ::= NK_BIN */
+ -3, /* (471) tags_literal ::= NK_BIN NK_PLUS duration_literal */
+ -3, /* (472) tags_literal ::= NK_BIN NK_MINUS duration_literal */
+ -2, /* (473) tags_literal ::= NK_PLUS NK_BIN */
+ -4, /* (474) tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */
+ -4, /* (475) tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */
+ -2, /* (476) tags_literal ::= NK_MINUS NK_BIN */
+ -4, /* (477) tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */
+ -4, /* (478) tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */
+ -1, /* (479) tags_literal ::= NK_HEX */
+ -3, /* (480) tags_literal ::= NK_HEX NK_PLUS duration_literal */
+ -3, /* (481) tags_literal ::= NK_HEX NK_MINUS duration_literal */
+ -2, /* (482) tags_literal ::= NK_PLUS NK_HEX */
+ -4, /* (483) tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */
+ -4, /* (484) tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */
+ -2, /* (485) tags_literal ::= NK_MINUS NK_HEX */
+ -4, /* (486) tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */
+ -4, /* (487) tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */
+ -1, /* (488) tags_literal ::= NK_STRING */
+ -3, /* (489) tags_literal ::= NK_STRING NK_PLUS duration_literal */
+ -3, /* (490) tags_literal ::= NK_STRING NK_MINUS duration_literal */
+ -1, /* (491) tags_literal ::= NK_BOOL */
+ -1, /* (492) tags_literal ::= NULL */
+ -1, /* (493) tags_literal ::= literal_func */
+ -3, /* (494) tags_literal ::= literal_func NK_PLUS duration_literal */
+ -3, /* (495) tags_literal ::= literal_func NK_MINUS duration_literal */
+ -1, /* (496) tags_literal_list ::= tags_literal */
+ -3, /* (497) tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */
+ -1, /* (498) literal ::= NK_INTEGER */
+ -1, /* (499) literal ::= NK_FLOAT */
+ -1, /* (500) literal ::= NK_STRING */
+ -1, /* (501) literal ::= NK_BOOL */
+ -2, /* (502) literal ::= TIMESTAMP NK_STRING */
+ -1, /* (503) literal ::= duration_literal */
+ -1, /* (504) literal ::= NULL */
+ -1, /* (505) literal ::= NK_QUESTION */
+ -1, /* (506) duration_literal ::= NK_VARIABLE */
+ -1, /* (507) signed ::= NK_INTEGER */
+ -2, /* (508) signed ::= NK_PLUS NK_INTEGER */
+ -2, /* (509) signed ::= NK_MINUS NK_INTEGER */
+ -1, /* (510) signed ::= NK_FLOAT */
+ -2, /* (511) signed ::= NK_PLUS NK_FLOAT */
+ -2, /* (512) signed ::= NK_MINUS NK_FLOAT */
+ -1, /* (513) signed_literal ::= signed */
+ -1, /* (514) signed_literal ::= NK_STRING */
+ -1, /* (515) signed_literal ::= NK_BOOL */
+ -2, /* (516) signed_literal ::= TIMESTAMP NK_STRING */
+ -1, /* (517) signed_literal ::= duration_literal */
+ -1, /* (518) signed_literal ::= NULL */
+ -1, /* (519) signed_literal ::= literal_func */
+ -1, /* (520) signed_literal ::= NK_QUESTION */
+ -1, /* (521) literal_list ::= signed_literal */
+ -3, /* (522) literal_list ::= literal_list NK_COMMA signed_literal */
+ -1, /* (523) db_name ::= NK_ID */
+ -1, /* (524) table_name ::= NK_ID */
+ -1, /* (525) column_name ::= NK_ID */
+ -1, /* (526) function_name ::= NK_ID */
+ -1, /* (527) view_name ::= NK_ID */
+ -1, /* (528) table_alias ::= NK_ID */
+ -1, /* (529) column_alias ::= NK_ID */
+ -1, /* (530) column_alias ::= NK_ALIAS */
+ -1, /* (531) user_name ::= NK_ID */
+ -1, /* (532) topic_name ::= NK_ID */
+ -1, /* (533) stream_name ::= NK_ID */
+ -1, /* (534) cgroup_name ::= NK_ID */
+ -1, /* (535) index_name ::= NK_ID */
+ -1, /* (536) tsma_name ::= NK_ID */
+ -1, /* (537) expr_or_subquery ::= expression */
+ -1, /* (538) expression ::= literal */
+ -1, /* (539) expression ::= pseudo_column */
+ -1, /* (540) expression ::= column_reference */
+ -1, /* (541) expression ::= function_expression */
+ -1, /* (542) expression ::= case_when_expression */
+ -3, /* (543) expression ::= NK_LP expression NK_RP */
+ -2, /* (544) expression ::= NK_PLUS expr_or_subquery */
+ -2, /* (545) expression ::= NK_MINUS expr_or_subquery */
+ -3, /* (546) expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ -3, /* (547) expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ -3, /* (548) expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ -3, /* (549) expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ -3, /* (550) expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ -3, /* (551) expression ::= column_reference NK_ARROW NK_STRING */
+ -3, /* (552) expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ -3, /* (553) expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ -1, /* (554) expression_list ::= expr_or_subquery */
+ -3, /* (555) expression_list ::= expression_list NK_COMMA expr_or_subquery */
+ -1, /* (556) column_reference ::= column_name */
+ -3, /* (557) column_reference ::= table_name NK_DOT column_name */
+ -1, /* (558) column_reference ::= NK_ALIAS */
+ -3, /* (559) column_reference ::= table_name NK_DOT NK_ALIAS */
+ -1, /* (560) pseudo_column ::= ROWTS */
+ -1, /* (561) pseudo_column ::= TBNAME */
+ -3, /* (562) pseudo_column ::= table_name NK_DOT TBNAME */
+ -1, /* (563) pseudo_column ::= QSTART */
+ -1, /* (564) pseudo_column ::= QEND */
+ -1, /* (565) pseudo_column ::= QDURATION */
+ -1, /* (566) pseudo_column ::= WSTART */
+ -1, /* (567) pseudo_column ::= WEND */
+ -1, /* (568) pseudo_column ::= WDURATION */
+ -1, /* (569) pseudo_column ::= IROWTS */
+ -1, /* (570) pseudo_column ::= ISFILLED */
+ -1, /* (571) pseudo_column ::= QTAGS */
+ -1, /* (572) pseudo_column ::= FLOW */
+ -1, /* (573) pseudo_column ::= FHIGH */
+ -1, /* (574) pseudo_column ::= FROWTS */
+ -4, /* (575) function_expression ::= function_name NK_LP expression_list NK_RP */
+ -4, /* (576) function_expression ::= star_func NK_LP star_func_para_list NK_RP */
+ -6, /* (577) function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ -6, /* (578) function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */
+ -6, /* (579) function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */
+ -4, /* (580) function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */
+ -6, /* (581) function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */
+ -6, /* (582) function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
+ -7, /* (583) function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */
+ -4, /* (584) function_expression ::= substr_func NK_LP expression_list NK_RP */
+ -6, /* (585) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
+ -8, /* (586) function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */
+ -4, /* (587) function_expression ::= REPLACE NK_LP expression_list NK_RP */
+ -1, /* (588) function_expression ::= literal_func */
+ -1, /* (589) function_expression ::= rand_func */
+ -3, /* (590) literal_func ::= noarg_func NK_LP NK_RP */
+ -1, /* (591) literal_func ::= NOW */
+ -1, /* (592) literal_func ::= TODAY */
+ -3, /* (593) rand_func ::= RAND NK_LP NK_RP */
+ -4, /* (594) rand_func ::= RAND NK_LP expression_list NK_RP */
+ -1, /* (595) substr_func ::= SUBSTR */
+ -1, /* (596) substr_func ::= SUBSTRING */
+ -1, /* (597) trim_specification_type ::= BOTH */
+ -1, /* (598) trim_specification_type ::= TRAILING */
+ -1, /* (599) trim_specification_type ::= LEADING */
+ -1, /* (600) noarg_func ::= NOW */
+ -1, /* (601) noarg_func ::= TODAY */
+ -1, /* (602) noarg_func ::= TIMEZONE */
+ -1, /* (603) noarg_func ::= DATABASE */
+ -1, /* (604) noarg_func ::= CLIENT_VERSION */
+ -1, /* (605) noarg_func ::= SERVER_VERSION */
+ -1, /* (606) noarg_func ::= SERVER_STATUS */
+ -1, /* (607) noarg_func ::= CURRENT_USER */
+ -1, /* (608) noarg_func ::= USER */
+ -1, /* (609) noarg_func ::= PI */
+ -1, /* (610) star_func ::= COUNT */
+ -1, /* (611) star_func ::= FIRST */
+ -1, /* (612) star_func ::= LAST */
+ -1, /* (613) star_func ::= LAST_ROW */
+ -1, /* (614) star_func_para_list ::= NK_STAR */
+ -1, /* (615) star_func_para_list ::= other_para_list */
+ -1, /* (616) other_para_list ::= star_func_para */
+ -3, /* (617) other_para_list ::= other_para_list NK_COMMA star_func_para */
+ -1, /* (618) star_func_para ::= expr_or_subquery */
+ -3, /* (619) star_func_para ::= table_name NK_DOT NK_STAR */
+ -4, /* (620) case_when_expression ::= CASE when_then_list case_when_else_opt END */
+ -5, /* (621) case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+ -1, /* (622) when_then_list ::= when_then_expr */
+ -2, /* (623) when_then_list ::= when_then_list when_then_expr */
+ -4, /* (624) when_then_expr ::= WHEN common_expression THEN common_expression */
+ 0, /* (625) case_when_else_opt ::= */
+ -2, /* (626) case_when_else_opt ::= ELSE common_expression */
+ -3, /* (627) predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ -5, /* (628) predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ -6, /* (629) predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ -3, /* (630) predicate ::= expr_or_subquery IS NULL */
+ -4, /* (631) predicate ::= expr_or_subquery IS NOT NULL */
+ -3, /* (632) predicate ::= expr_or_subquery in_op in_predicate_value */
+ -1, /* (633) compare_op ::= NK_LT */
+ -1, /* (634) compare_op ::= NK_GT */
+ -1, /* (635) compare_op ::= NK_LE */
+ -1, /* (636) compare_op ::= NK_GE */
+ -1, /* (637) compare_op ::= NK_NE */
+ -1, /* (638) compare_op ::= NK_EQ */
+ -1, /* (639) compare_op ::= LIKE */
+ -2, /* (640) compare_op ::= NOT LIKE */
+ -1, /* (641) compare_op ::= MATCH */
+ -1, /* (642) compare_op ::= NMATCH */
+ -1, /* (643) compare_op ::= CONTAINS */
+ -1, /* (644) in_op ::= IN */
+ -2, /* (645) in_op ::= NOT IN */
+ -3, /* (646) in_predicate_value ::= NK_LP literal_list NK_RP */
+ -1, /* (647) boolean_value_expression ::= boolean_primary */
+ -2, /* (648) boolean_value_expression ::= NOT boolean_primary */
+ -3, /* (649) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ -3, /* (650) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ -1, /* (651) boolean_primary ::= predicate */
+ -3, /* (652) boolean_primary ::= NK_LP boolean_value_expression NK_RP */
+ -1, /* (653) common_expression ::= expr_or_subquery */
+ -1, /* (654) common_expression ::= boolean_value_expression */
+ 0, /* (655) from_clause_opt ::= */
+ -2, /* (656) from_clause_opt ::= FROM table_reference_list */
+ -1, /* (657) table_reference_list ::= table_reference */
+ -3, /* (658) table_reference_list ::= table_reference_list NK_COMMA table_reference */
+ -1, /* (659) table_reference ::= table_primary */
+ -1, /* (660) table_reference ::= joined_table */
+ -2, /* (661) table_primary ::= table_name alias_opt */
+ -4, /* (662) table_primary ::= db_name NK_DOT table_name alias_opt */
+ -2, /* (663) table_primary ::= subquery alias_opt */
+ -1, /* (664) table_primary ::= parenthesized_joined_table */
+ 0, /* (665) alias_opt ::= */
+ -1, /* (666) alias_opt ::= table_alias */
+ -2, /* (667) alias_opt ::= AS table_alias */
+ -3, /* (668) parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ -3, /* (669) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */
+ -8, /* (670) joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
+ 0, /* (671) join_type ::= */
+ -1, /* (672) join_type ::= INNER */
+ -1, /* (673) join_type ::= LEFT */
+ -1, /* (674) join_type ::= RIGHT */
+ -1, /* (675) join_type ::= FULL */
+ 0, /* (676) join_subtype ::= */
+ -1, /* (677) join_subtype ::= OUTER */
+ -1, /* (678) join_subtype ::= SEMI */
+ -1, /* (679) join_subtype ::= ANTI */
+ -1, /* (680) join_subtype ::= ASOF */
+ -1, /* (681) join_subtype ::= WINDOW */
+ 0, /* (682) join_on_clause_opt ::= */
+ -2, /* (683) join_on_clause_opt ::= ON search_condition */
+ 0, /* (684) window_offset_clause_opt ::= */
+ -6, /* (685) window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
+ -1, /* (686) window_offset_literal ::= NK_VARIABLE */
+ -2, /* (687) window_offset_literal ::= NK_MINUS NK_VARIABLE */
+ 0, /* (688) jlimit_clause_opt ::= */
+ -2, /* (689) jlimit_clause_opt ::= JLIMIT NK_INTEGER */
+ -14, /* (690) query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ 0, /* (691) hint_list ::= */
+ -1, /* (692) hint_list ::= NK_HINT */
+ 0, /* (693) tag_mode_opt ::= */
+ -1, /* (694) tag_mode_opt ::= TAGS */
+ 0, /* (695) set_quantifier_opt ::= */
+ -1, /* (696) set_quantifier_opt ::= DISTINCT */
+ -1, /* (697) set_quantifier_opt ::= ALL */
+ -1, /* (698) select_list ::= select_item */
+ -3, /* (699) select_list ::= select_list NK_COMMA select_item */
+ -1, /* (700) select_item ::= NK_STAR */
+ -1, /* (701) select_item ::= common_expression */
+ -2, /* (702) select_item ::= common_expression column_alias */
+ -3, /* (703) select_item ::= common_expression AS column_alias */
+ -3, /* (704) select_item ::= table_name NK_DOT NK_STAR */
+ 0, /* (705) where_clause_opt ::= */
+ -2, /* (706) where_clause_opt ::= WHERE search_condition */
+ 0, /* (707) partition_by_clause_opt ::= */
+ -3, /* (708) partition_by_clause_opt ::= PARTITION BY partition_list */
+ -1, /* (709) partition_list ::= partition_item */
+ -3, /* (710) partition_list ::= partition_list NK_COMMA partition_item */
+ -1, /* (711) partition_item ::= expr_or_subquery */
+ -2, /* (712) partition_item ::= expr_or_subquery column_alias */
+ -3, /* (713) partition_item ::= expr_or_subquery AS column_alias */
+ 0, /* (714) twindow_clause_opt ::= */
+ -6, /* (715) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+ -4, /* (716) twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+ -6, /* (717) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ -8, /* (718) twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+ -7, /* (719) twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+ -4, /* (720) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+ -6, /* (721) twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+ -4, /* (722) twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP */
+ -6, /* (723) twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP */
+ 0, /* (724) sliding_opt ::= */
+ -4, /* (725) sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */
+ -1, /* (726) interval_sliding_duration_literal ::= NK_VARIABLE */
+ -1, /* (727) interval_sliding_duration_literal ::= NK_STRING */
+ -1, /* (728) interval_sliding_duration_literal ::= NK_INTEGER */
+ 0, /* (729) fill_opt ::= */
+ -4, /* (730) fill_opt ::= FILL NK_LP fill_mode NK_RP */
+ -6, /* (731) fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+ -6, /* (732) fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+ -1, /* (733) fill_mode ::= NONE */
+ -1, /* (734) fill_mode ::= PREV */
+ -1, /* (735) fill_mode ::= NULL */
+ -1, /* (736) fill_mode ::= NULL_F */
+ -1, /* (737) fill_mode ::= LINEAR */
+ -1, /* (738) fill_mode ::= NEXT */
+ 0, /* (739) group_by_clause_opt ::= */
+ -3, /* (740) group_by_clause_opt ::= GROUP BY group_by_list */
+ -1, /* (741) group_by_list ::= expr_or_subquery */
+ -3, /* (742) group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+ 0, /* (743) having_clause_opt ::= */
+ -2, /* (744) having_clause_opt ::= HAVING search_condition */
+ 0, /* (745) range_opt ::= */
+ -6, /* (746) range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+ -4, /* (747) range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+ 0, /* (748) every_opt ::= */
+ -4, /* (749) every_opt ::= EVERY NK_LP duration_literal NK_RP */
+ -4, /* (750) query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ -1, /* (751) query_simple ::= query_specification */
+ -1, /* (752) query_simple ::= union_query_expression */
+ -4, /* (753) union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+ -3, /* (754) union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+ -1, /* (755) query_simple_or_subquery ::= query_simple */
+ -1, /* (756) query_simple_or_subquery ::= subquery */
+ -1, /* (757) query_or_subquery ::= query_expression */
+ -1, /* (758) query_or_subquery ::= subquery */
+ 0, /* (759) order_by_clause_opt ::= */
+ -3, /* (760) order_by_clause_opt ::= ORDER BY sort_specification_list */
+ 0, /* (761) slimit_clause_opt ::= */
+ -2, /* (762) slimit_clause_opt ::= SLIMIT NK_INTEGER */
+ -4, /* (763) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ -4, /* (764) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ 0, /* (765) limit_clause_opt ::= */
+ -2, /* (766) limit_clause_opt ::= LIMIT NK_INTEGER */
+ -4, /* (767) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
+ -4, /* (768) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ -3, /* (769) subquery ::= NK_LP query_expression NK_RP */
+ -3, /* (770) subquery ::= NK_LP subquery NK_RP */
+ -1, /* (771) search_condition ::= common_expression */
+ -1, /* (772) sort_specification_list ::= sort_specification */
+ -3, /* (773) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
+ -3, /* (774) sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+ 0, /* (775) ordering_specification_opt ::= */
+ -1, /* (776) ordering_specification_opt ::= ASC */
+ -1, /* (777) ordering_specification_opt ::= DESC */
+ 0, /* (778) null_ordering_opt ::= */
+ -2, /* (779) null_ordering_opt ::= NULLS FIRST */
+ -2, /* (780) null_ordering_opt ::= NULLS LAST */
+ 0, /* (781) column_options ::= */
+ -3, /* (782) column_options ::= column_options PRIMARY KEY */
+ -3, /* (783) column_options ::= column_options NK_ID NK_STRING */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -5551,11 +5619,11 @@ static YYACTIONTYPE yy_reduce(
YYMINORTYPE yylhsminor;
case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
- yy_destructor(yypParser,384,&yymsp[0].minor);
+ yy_destructor(yypParser,390,&yymsp[0].minor);
break;
case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
- yy_destructor(yypParser,385,&yymsp[0].minor);
+ yy_destructor(yypParser,391,&yymsp[0].minor);
break;
case 2: /* account_options ::= */
{ }
@@ -5569,20 +5637,20 @@ static YYACTIONTYPE yy_reduce(
case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9);
case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10);
case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11);
-{ yy_destructor(yypParser,384,&yymsp[-2].minor);
+{ yy_destructor(yypParser,390,&yymsp[-2].minor);
{ }
- yy_destructor(yypParser,386,&yymsp[0].minor);
+ yy_destructor(yypParser,392,&yymsp[0].minor);
}
break;
case 12: /* alter_account_options ::= alter_account_option */
-{ yy_destructor(yypParser,387,&yymsp[0].minor);
+{ yy_destructor(yypParser,393,&yymsp[0].minor);
{ }
}
break;
case 13: /* alter_account_options ::= alter_account_options alter_account_option */
-{ yy_destructor(yypParser,385,&yymsp[-1].minor);
+{ yy_destructor(yypParser,391,&yymsp[-1].minor);
{ }
- yy_destructor(yypParser,387,&yymsp[0].minor);
+ yy_destructor(yypParser,393,&yymsp[0].minor);
}
break;
case 14: /* alter_account_option ::= PASS literal */
@@ -5596,2110 +5664,2137 @@ static YYACTIONTYPE yy_reduce(
case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22);
case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23);
{ }
- yy_destructor(yypParser,386,&yymsp[0].minor);
+ yy_destructor(yypParser,392,&yymsp[0].minor);
break;
case 24: /* ip_range_list ::= NK_STRING */
-{ yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy334 = yylhsminor.yy334;
+{ yylhsminor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy946 = yylhsminor.yy946;
break;
case 25: /* ip_range_list ::= ip_range_list NK_COMMA NK_STRING */
-{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy334 = yylhsminor.yy334;
+{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy946 = yylhsminor.yy946;
break;
case 26: /* white_list ::= HOST ip_range_list */
-{ yymsp[-1].minor.yy334 = yymsp[0].minor.yy334; }
+{ yymsp[-1].minor.yy946 = yymsp[0].minor.yy946; }
break;
case 27: /* white_list_opt ::= */
- case 208: /* specific_cols_opt ::= */ yytestcase(yyruleno==208);
- case 246: /* tags_def_opt ::= */ yytestcase(yyruleno==246);
- case 337: /* tag_list_opt ::= */ yytestcase(yyruleno==337);
- case 410: /* col_list_opt ::= */ yytestcase(yyruleno==410);
- case 417: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==417);
- case 698: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==698);
- case 728: /* group_by_clause_opt ::= */ yytestcase(yyruleno==728);
- case 748: /* order_by_clause_opt ::= */ yytestcase(yyruleno==748);
-{ yymsp[1].minor.yy334 = NULL; }
+ case 212: /* specific_cols_opt ::= */ yytestcase(yyruleno==212);
+ case 250: /* tags_def_opt ::= */ yytestcase(yyruleno==250);
+ case 343: /* tag_list_opt ::= */ yytestcase(yyruleno==343);
+ case 416: /* col_list_opt ::= */ yytestcase(yyruleno==416);
+ case 423: /* tag_def_or_ref_opt ::= */ yytestcase(yyruleno==423);
+ case 707: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==707);
+ case 739: /* group_by_clause_opt ::= */ yytestcase(yyruleno==739);
+ case 759: /* order_by_clause_opt ::= */ yytestcase(yyruleno==759);
+{ yymsp[1].minor.yy946 = NULL; }
break;
case 28: /* white_list_opt ::= white_list */
- case 247: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==247);
- case 418: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==418);
- case 606: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==606);
-{ yylhsminor.yy334 = yymsp[0].minor.yy334; }
- yymsp[0].minor.yy334 = yylhsminor.yy334;
+ case 251: /* tags_def_opt ::= tags_def */ yytestcase(yyruleno==251);
+ case 424: /* tag_def_or_ref_opt ::= tags_def */ yytestcase(yyruleno==424);
+ case 615: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==615);
+{ yylhsminor.yy946 = yymsp[0].minor.yy946; }
+ yymsp[0].minor.yy946 = yylhsminor.yy946;
break;
case 29: /* is_import_opt ::= */
case 31: /* is_createdb_opt ::= */ yytestcase(yyruleno==31);
-{ yymsp[1].minor.yy719 = 0; }
+{ yymsp[1].minor.yy815 = 0; }
break;
case 30: /* is_import_opt ::= IS_IMPORT NK_INTEGER */
case 32: /* is_createdb_opt ::= CREATEDB NK_INTEGER */ yytestcase(yyruleno==32);
case 42: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ yytestcase(yyruleno==42);
-{ yymsp[-1].minor.yy719 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
+{ yymsp[-1].minor.yy815 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); }
break;
case 33: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt is_createdb_opt is_import_opt white_list_opt */
{
- pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy533, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy719, yymsp[-1].minor.yy719, yymsp[-2].minor.yy719);
- pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy334);
+ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-6].minor.yy557, &yymsp[-4].minor.yy0, yymsp[-3].minor.yy815, yymsp[-1].minor.yy815, yymsp[-2].minor.yy815);
+ pCxt->pRootNode = addCreateUserStmtWhiteList(pCxt, pCxt->pRootNode, yymsp[0].minor.yy946);
}
break;
case 34: /* cmd ::= ALTER USER user_name PASS NK_STRING */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); }
break;
case 35: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); }
break;
case 36: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); }
break;
case 37: /* cmd ::= ALTER USER user_name CREATEDB NK_INTEGER */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_CREATEDB, &yymsp[0].minor.yy0); }
break;
case 38: /* cmd ::= ALTER USER user_name ADD white_list */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy334); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_ADD_WHITE_LIST, yymsp[0].minor.yy946); }
break;
case 39: /* cmd ::= ALTER USER user_name DROP white_list */
-{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy533, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy334); }
+{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy557, TSDB_ALTER_USER_DROP_WHITE_LIST, yymsp[0].minor.yy946); }
break;
case 40: /* cmd ::= DROP USER user_name */
-{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy533); }
+{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy557); }
break;
case 41: /* sysinfo_opt ::= */
-{ yymsp[1].minor.yy719 = 1; }
+{ yymsp[1].minor.yy815 = 1; }
break;
case 43: /* cmd ::= GRANT privileges ON priv_level with_clause_opt TO user_name */
-{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy585, &yymsp[-3].minor.yy399, &yymsp[0].minor.yy533, yymsp[-2].minor.yy560); }
+{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-5].minor.yy483, &yymsp[-3].minor.yy723, &yymsp[0].minor.yy557, yymsp[-2].minor.yy974); }
break;
case 44: /* cmd ::= REVOKE privileges ON priv_level with_clause_opt FROM user_name */
-{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy585, &yymsp[-3].minor.yy399, &yymsp[0].minor.yy533, yymsp[-2].minor.yy560); }
+{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-5].minor.yy483, &yymsp[-3].minor.yy723, &yymsp[0].minor.yy557, yymsp[-2].minor.yy974); }
break;
case 45: /* privileges ::= ALL */
-{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_ALL; }
+{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_ALL; }
break;
case 46: /* privileges ::= priv_type_list */
case 48: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==48);
-{ yylhsminor.yy585 = yymsp[0].minor.yy585; }
- yymsp[0].minor.yy585 = yylhsminor.yy585;
+{ yylhsminor.yy483 = yymsp[0].minor.yy483; }
+ yymsp[0].minor.yy483 = yylhsminor.yy483;
break;
case 47: /* privileges ::= SUBSCRIBE */
-{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_SUBSCRIBE; }
+{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_SUBSCRIBE; }
break;
case 49: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */
-{ yylhsminor.yy585 = yymsp[-2].minor.yy585 | yymsp[0].minor.yy585; }
- yymsp[-2].minor.yy585 = yylhsminor.yy585;
+{ yylhsminor.yy483 = yymsp[-2].minor.yy483 | yymsp[0].minor.yy483; }
+ yymsp[-2].minor.yy483 = yylhsminor.yy483;
break;
case 50: /* priv_type ::= READ */
-{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_READ; }
+{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_READ; }
break;
case 51: /* priv_type ::= WRITE */
-{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_WRITE; }
+{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_WRITE; }
break;
case 52: /* priv_type ::= ALTER */
-{ yymsp[0].minor.yy585 = PRIVILEGE_TYPE_ALTER; }
+{ yymsp[0].minor.yy483 = PRIVILEGE_TYPE_ALTER; }
break;
case 53: /* priv_level ::= NK_STAR NK_DOT NK_STAR */
-{ yylhsminor.yy399.first = yymsp[-2].minor.yy0; yylhsminor.yy399.second = yymsp[0].minor.yy0; }
- yymsp[-2].minor.yy399 = yylhsminor.yy399;
+{ yylhsminor.yy723.first = yymsp[-2].minor.yy0; yylhsminor.yy723.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy723 = yylhsminor.yy723;
break;
case 54: /* priv_level ::= db_name NK_DOT NK_STAR */
-{ yylhsminor.yy399.first = yymsp[-2].minor.yy533; yylhsminor.yy399.second = yymsp[0].minor.yy0; }
- yymsp[-2].minor.yy399 = yylhsminor.yy399;
+{ yylhsminor.yy723.first = yymsp[-2].minor.yy557; yylhsminor.yy723.second = yymsp[0].minor.yy0; }
+ yymsp[-2].minor.yy723 = yylhsminor.yy723;
break;
case 55: /* priv_level ::= db_name NK_DOT table_name */
-{ yylhsminor.yy399.first = yymsp[-2].minor.yy533; yylhsminor.yy399.second = yymsp[0].minor.yy533; }
- yymsp[-2].minor.yy399 = yylhsminor.yy399;
+{ yylhsminor.yy723.first = yymsp[-2].minor.yy557; yylhsminor.yy723.second = yymsp[0].minor.yy557; }
+ yymsp[-2].minor.yy723 = yylhsminor.yy723;
break;
case 56: /* priv_level ::= topic_name */
-{ yylhsminor.yy399.first = yymsp[0].minor.yy533; yylhsminor.yy399.second = nil_token; }
- yymsp[0].minor.yy399 = yylhsminor.yy399;
+{ yylhsminor.yy723.first = yymsp[0].minor.yy557; yylhsminor.yy723.second = nil_token; }
+ yymsp[0].minor.yy723 = yylhsminor.yy723;
break;
case 57: /* with_clause_opt ::= */
- case 173: /* start_opt ::= */ yytestcase(yyruleno==173);
- case 177: /* end_opt ::= */ yytestcase(yyruleno==177);
- case 332: /* like_pattern_opt ::= */ yytestcase(yyruleno==332);
- case 429: /* subtable_opt ::= */ yytestcase(yyruleno==429);
- case 616: /* case_when_else_opt ::= */ yytestcase(yyruleno==616);
- case 646: /* from_clause_opt ::= */ yytestcase(yyruleno==646);
- case 673: /* join_on_clause_opt ::= */ yytestcase(yyruleno==673);
- case 675: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==675);
- case 679: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==679);
- case 696: /* where_clause_opt ::= */ yytestcase(yyruleno==696);
- case 705: /* twindow_clause_opt ::= */ yytestcase(yyruleno==705);
- case 713: /* sliding_opt ::= */ yytestcase(yyruleno==713);
- case 718: /* fill_opt ::= */ yytestcase(yyruleno==718);
- case 732: /* having_clause_opt ::= */ yytestcase(yyruleno==732);
- case 734: /* range_opt ::= */ yytestcase(yyruleno==734);
- case 737: /* every_opt ::= */ yytestcase(yyruleno==737);
- case 750: /* slimit_clause_opt ::= */ yytestcase(yyruleno==750);
- case 754: /* limit_clause_opt ::= */ yytestcase(yyruleno==754);
-{ yymsp[1].minor.yy560 = NULL; }
+ case 177: /* start_opt ::= */ yytestcase(yyruleno==177);
+ case 181: /* end_opt ::= */ yytestcase(yyruleno==181);
+ case 338: /* like_pattern_opt ::= */ yytestcase(yyruleno==338);
+ case 435: /* subtable_opt ::= */ yytestcase(yyruleno==435);
+ case 625: /* case_when_else_opt ::= */ yytestcase(yyruleno==625);
+ case 655: /* from_clause_opt ::= */ yytestcase(yyruleno==655);
+ case 682: /* join_on_clause_opt ::= */ yytestcase(yyruleno==682);
+ case 684: /* window_offset_clause_opt ::= */ yytestcase(yyruleno==684);
+ case 688: /* jlimit_clause_opt ::= */ yytestcase(yyruleno==688);
+ case 705: /* where_clause_opt ::= */ yytestcase(yyruleno==705);
+ case 714: /* twindow_clause_opt ::= */ yytestcase(yyruleno==714);
+ case 724: /* sliding_opt ::= */ yytestcase(yyruleno==724);
+ case 729: /* fill_opt ::= */ yytestcase(yyruleno==729);
+ case 743: /* having_clause_opt ::= */ yytestcase(yyruleno==743);
+ case 745: /* range_opt ::= */ yytestcase(yyruleno==745);
+ case 748: /* every_opt ::= */ yytestcase(yyruleno==748);
+ case 761: /* slimit_clause_opt ::= */ yytestcase(yyruleno==761);
+ case 765: /* limit_clause_opt ::= */ yytestcase(yyruleno==765);
+{ yymsp[1].minor.yy974 = NULL; }
break;
case 58: /* with_clause_opt ::= WITH search_condition */
- case 647: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==647);
- case 674: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==674);
- case 697: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==697);
- case 733: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==733);
-{ yymsp[-1].minor.yy560 = yymsp[0].minor.yy560; }
+ case 656: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==656);
+ case 683: /* join_on_clause_opt ::= ON search_condition */ yytestcase(yyruleno==683);
+ case 706: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==706);
+ case 744: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==744);
+{ yymsp[-1].minor.yy974 = yymsp[0].minor.yy974; }
break;
case 59: /* cmd ::= CREATE ENCRYPT_KEY NK_STRING */
{ pCxt->pRootNode = createEncryptKeyStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 60: /* cmd ::= CREATE DNODE dnode_endpoint */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy533, NULL); }
+ case 60: /* cmd ::= CREATE ANODE NK_STRING */
+{ pCxt->pRootNode = createCreateAnodeStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 61: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
-{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0); }
+ case 61: /* cmd ::= UPDATE ANODE NK_INTEGER */
+{ pCxt->pRootNode = createUpdateAnodeStmt(pCxt, &yymsp[0].minor.yy0, false); }
break;
- case 62: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy173, false); }
+ case 62: /* cmd ::= UPDATE ALL ANODES */
+{ pCxt->pRootNode = createUpdateAnodeStmt(pCxt, NULL, true); }
break;
- case 63: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy173, false); }
+ case 63: /* cmd ::= DROP ANODE NK_INTEGER */
+{ pCxt->pRootNode = createDropAnodeStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 64: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy173); }
+ case 64: /* cmd ::= CREATE DNODE dnode_endpoint */
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy557, NULL); }
break;
- case 65: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
-{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy533, false, yymsp[0].minor.yy173); }
+ case 65: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */
+{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0); }
break;
- case 66: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
+ case 66: /* cmd ::= DROP DNODE NK_INTEGER force_opt */
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy569, false); }
+ break;
+ case 67: /* cmd ::= DROP DNODE dnode_endpoint force_opt */
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy569, false); }
+ break;
+ case 68: /* cmd ::= DROP DNODE NK_INTEGER unsafe_opt */
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy0, false, yymsp[0].minor.yy569); }
+ break;
+ case 69: /* cmd ::= DROP DNODE dnode_endpoint unsafe_opt */
+{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[-1].minor.yy557, false, yymsp[0].minor.yy569); }
+ break;
+ case 70: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); }
break;
- case 67: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
+ case 71: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 68: /* cmd ::= ALTER ALL DNODES NK_STRING */
+ case 72: /* cmd ::= ALTER ALL DNODES NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[0].minor.yy0, NULL); }
break;
- case 69: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
+ case 73: /* cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */
{ pCxt->pRootNode = createAlterDnodeStmt(pCxt, NULL, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 70: /* cmd ::= RESTORE DNODE NK_INTEGER */
+ case 74: /* cmd ::= RESTORE DNODE NK_INTEGER */
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_DNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 71: /* dnode_endpoint ::= NK_STRING */
- case 72: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==72);
- case 73: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==73);
- case 366: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==366);
- case 367: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==367);
- case 368: /* sma_func_name ::= LAST */ yytestcase(yyruleno==368);
- case 369: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==369);
- case 517: /* db_name ::= NK_ID */ yytestcase(yyruleno==517);
- case 518: /* table_name ::= NK_ID */ yytestcase(yyruleno==518);
- case 519: /* column_name ::= NK_ID */ yytestcase(yyruleno==519);
- case 520: /* function_name ::= NK_ID */ yytestcase(yyruleno==520);
- case 521: /* view_name ::= NK_ID */ yytestcase(yyruleno==521);
- case 522: /* table_alias ::= NK_ID */ yytestcase(yyruleno==522);
- case 523: /* column_alias ::= NK_ID */ yytestcase(yyruleno==523);
- case 524: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==524);
- case 525: /* user_name ::= NK_ID */ yytestcase(yyruleno==525);
- case 526: /* topic_name ::= NK_ID */ yytestcase(yyruleno==526);
- case 527: /* stream_name ::= NK_ID */ yytestcase(yyruleno==527);
- case 528: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==528);
- case 529: /* index_name ::= NK_ID */ yytestcase(yyruleno==529);
- case 530: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==530);
- case 586: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==586);
- case 587: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==587);
- case 591: /* noarg_func ::= NOW */ yytestcase(yyruleno==591);
- case 592: /* noarg_func ::= TODAY */ yytestcase(yyruleno==592);
- case 593: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==593);
- case 594: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==594);
- case 595: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==595);
- case 596: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==596);
- case 597: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==597);
- case 598: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==598);
- case 599: /* noarg_func ::= USER */ yytestcase(yyruleno==599);
- case 600: /* noarg_func ::= PI */ yytestcase(yyruleno==600);
- case 601: /* star_func ::= COUNT */ yytestcase(yyruleno==601);
- case 602: /* star_func ::= FIRST */ yytestcase(yyruleno==602);
- case 603: /* star_func ::= LAST */ yytestcase(yyruleno==603);
- case 604: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==604);
-{ yylhsminor.yy533 = yymsp[0].minor.yy0; }
- yymsp[0].minor.yy533 = yylhsminor.yy533;
+ case 75: /* dnode_endpoint ::= NK_STRING */
+ case 76: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==76);
+ case 77: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==77);
+ case 372: /* sma_func_name ::= COUNT */ yytestcase(yyruleno==372);
+ case 373: /* sma_func_name ::= FIRST */ yytestcase(yyruleno==373);
+ case 374: /* sma_func_name ::= LAST */ yytestcase(yyruleno==374);
+ case 375: /* sma_func_name ::= LAST_ROW */ yytestcase(yyruleno==375);
+ case 523: /* db_name ::= NK_ID */ yytestcase(yyruleno==523);
+ case 524: /* table_name ::= NK_ID */ yytestcase(yyruleno==524);
+ case 525: /* column_name ::= NK_ID */ yytestcase(yyruleno==525);
+ case 526: /* function_name ::= NK_ID */ yytestcase(yyruleno==526);
+ case 527: /* view_name ::= NK_ID */ yytestcase(yyruleno==527);
+ case 528: /* table_alias ::= NK_ID */ yytestcase(yyruleno==528);
+ case 529: /* column_alias ::= NK_ID */ yytestcase(yyruleno==529);
+ case 530: /* column_alias ::= NK_ALIAS */ yytestcase(yyruleno==530);
+ case 531: /* user_name ::= NK_ID */ yytestcase(yyruleno==531);
+ case 532: /* topic_name ::= NK_ID */ yytestcase(yyruleno==532);
+ case 533: /* stream_name ::= NK_ID */ yytestcase(yyruleno==533);
+ case 534: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==534);
+ case 535: /* index_name ::= NK_ID */ yytestcase(yyruleno==535);
+ case 536: /* tsma_name ::= NK_ID */ yytestcase(yyruleno==536);
+ case 595: /* substr_func ::= SUBSTR */ yytestcase(yyruleno==595);
+ case 596: /* substr_func ::= SUBSTRING */ yytestcase(yyruleno==596);
+ case 600: /* noarg_func ::= NOW */ yytestcase(yyruleno==600);
+ case 601: /* noarg_func ::= TODAY */ yytestcase(yyruleno==601);
+ case 602: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==602);
+ case 603: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==603);
+ case 604: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==604);
+ case 605: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==605);
+ case 606: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==606);
+ case 607: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==607);
+ case 608: /* noarg_func ::= USER */ yytestcase(yyruleno==608);
+ case 609: /* noarg_func ::= PI */ yytestcase(yyruleno==609);
+ case 610: /* star_func ::= COUNT */ yytestcase(yyruleno==610);
+ case 611: /* star_func ::= FIRST */ yytestcase(yyruleno==611);
+ case 612: /* star_func ::= LAST */ yytestcase(yyruleno==612);
+ case 613: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==613);
+{ yylhsminor.yy557 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy557 = yylhsminor.yy557;
break;
- case 74: /* force_opt ::= */
- case 101: /* not_exists_opt ::= */ yytestcase(yyruleno==101);
- case 103: /* exists_opt ::= */ yytestcase(yyruleno==103);
- case 206: /* with_opt ::= */ yytestcase(yyruleno==206);
- case 387: /* analyze_opt ::= */ yytestcase(yyruleno==387);
- case 394: /* agg_func_opt ::= */ yytestcase(yyruleno==394);
- case 400: /* or_replace_opt ::= */ yytestcase(yyruleno==400);
- case 431: /* ignore_opt ::= */ yytestcase(yyruleno==431);
- case 684: /* tag_mode_opt ::= */ yytestcase(yyruleno==684);
- case 686: /* set_quantifier_opt ::= */ yytestcase(yyruleno==686);
-{ yymsp[1].minor.yy173 = false; }
+ case 78: /* force_opt ::= */
+ case 105: /* not_exists_opt ::= */ yytestcase(yyruleno==105);
+ case 107: /* exists_opt ::= */ yytestcase(yyruleno==107);
+ case 210: /* with_opt ::= */ yytestcase(yyruleno==210);
+ case 393: /* analyze_opt ::= */ yytestcase(yyruleno==393);
+ case 400: /* agg_func_opt ::= */ yytestcase(yyruleno==400);
+ case 406: /* or_replace_opt ::= */ yytestcase(yyruleno==406);
+ case 437: /* ignore_opt ::= */ yytestcase(yyruleno==437);
+ case 693: /* tag_mode_opt ::= */ yytestcase(yyruleno==693);
+ case 695: /* set_quantifier_opt ::= */ yytestcase(yyruleno==695);
+{ yymsp[1].minor.yy569 = false; }
break;
- case 75: /* force_opt ::= FORCE */
- case 76: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==76);
- case 207: /* with_opt ::= WITH */ yytestcase(yyruleno==207);
- case 388: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==388);
- case 395: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==395);
- case 685: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==685);
- case 687: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==687);
-{ yymsp[0].minor.yy173 = true; }
+ case 79: /* force_opt ::= FORCE */
+ case 80: /* unsafe_opt ::= UNSAFE */ yytestcase(yyruleno==80);
+ case 211: /* with_opt ::= WITH */ yytestcase(yyruleno==211);
+ case 394: /* analyze_opt ::= ANALYZE */ yytestcase(yyruleno==394);
+ case 401: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==401);
+ case 694: /* tag_mode_opt ::= TAGS */ yytestcase(yyruleno==694);
+ case 696: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==696);
+{ yymsp[0].minor.yy569 = true; }
break;
- case 77: /* cmd ::= ALTER CLUSTER NK_STRING */
+ case 81: /* cmd ::= ALTER CLUSTER NK_STRING */
{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 78: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
+ case 82: /* cmd ::= ALTER CLUSTER NK_STRING NK_STRING */
{ pCxt->pRootNode = createAlterClusterStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 79: /* cmd ::= ALTER LOCAL NK_STRING */
+ case 83: /* cmd ::= ALTER LOCAL NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 80: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
+ case 84: /* cmd ::= ALTER LOCAL NK_STRING NK_STRING */
{ pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 81: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
+ case 85: /* cmd ::= CREATE QNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_QNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 82: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
+ case 86: /* cmd ::= DROP QNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_QNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 83: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
+ case 87: /* cmd ::= RESTORE QNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_QNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 84: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
+ case 88: /* cmd ::= CREATE BNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_BNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 85: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */
+ case 89: /* cmd ::= DROP BNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_BNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 86: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
+ case 90: /* cmd ::= CREATE SNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_SNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 87: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */
+ case 91: /* cmd ::= DROP SNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_SNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 88: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
+ case 92: /* cmd ::= CREATE MNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createCreateComponentNodeStmt(pCxt, QUERY_NODE_CREATE_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 89: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */
+ case 93: /* cmd ::= DROP MNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 90: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
+ case 94: /* cmd ::= RESTORE MNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_MNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 91: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
+ case 95: /* cmd ::= RESTORE VNODE ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createRestoreComponentNodeStmt(pCxt, QUERY_NODE_RESTORE_VNODE_STMT, &yymsp[0].minor.yy0); }
break;
- case 92: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
-{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy173, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); }
+ case 96: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */
+{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy569, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); }
break;
- case 93: /* cmd ::= DROP DATABASE exists_opt db_name */
-{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); }
+ case 97: /* cmd ::= DROP DATABASE exists_opt db_name */
+{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); }
break;
- case 94: /* cmd ::= USE db_name */
-{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy533); }
+ case 98: /* cmd ::= USE db_name */
+{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy557); }
break;
- case 95: /* cmd ::= ALTER DATABASE db_name alter_db_options */
-{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); }
+ case 99: /* cmd ::= ALTER DATABASE db_name alter_db_options */
+{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); }
break;
- case 96: /* cmd ::= FLUSH DATABASE db_name */
-{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy533); }
+ case 100: /* cmd ::= FLUSH DATABASE db_name */
+{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy557); }
break;
- case 97: /* cmd ::= TRIM DATABASE db_name speed_opt */
-{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy802); }
+ case 101: /* cmd ::= TRIM DATABASE db_name speed_opt */
+{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy904); }
break;
- case 98: /* cmd ::= S3MIGRATE DATABASE db_name */
-{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy533); }
+ case 102: /* cmd ::= S3MIGRATE DATABASE db_name */
+{ pCxt->pRootNode = createS3MigrateDatabaseStmt(pCxt, &yymsp[0].minor.yy557); }
break;
- case 99: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */
-{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
+ case 103: /* cmd ::= COMPACT DATABASE db_name start_opt end_opt */
+{ pCxt->pRootNode = createCompactStmt(pCxt, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); }
break;
- case 100: /* not_exists_opt ::= IF NOT EXISTS */
-{ yymsp[-2].minor.yy173 = true; }
+ case 104: /* not_exists_opt ::= IF NOT EXISTS */
+{ yymsp[-2].minor.yy569 = true; }
break;
- case 102: /* exists_opt ::= IF EXISTS */
- case 401: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==401);
- case 432: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==432);
-{ yymsp[-1].minor.yy173 = true; }
+ case 106: /* exists_opt ::= IF EXISTS */
+ case 407: /* or_replace_opt ::= OR REPLACE */ yytestcase(yyruleno==407);
+ case 438: /* ignore_opt ::= IGNORE UNTREATED */ yytestcase(yyruleno==438);
+{ yymsp[-1].minor.yy569 = true; }
break;
- case 104: /* db_options ::= */
-{ yymsp[1].minor.yy560 = createDefaultDatabaseOptions(pCxt); }
+ case 108: /* db_options ::= */
+{ yymsp[1].minor.yy974 = createDefaultDatabaseOptions(pCxt); }
break;
- case 105: /* db_options ::= db_options BUFFER NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 109: /* db_options ::= db_options BUFFER NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 106: /* db_options ::= db_options CACHEMODEL NK_STRING */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 110: /* db_options ::= db_options CACHEMODEL NK_STRING */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 107: /* db_options ::= db_options CACHESIZE NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 111: /* db_options ::= db_options CACHESIZE NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 108: /* db_options ::= db_options COMP NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 112: /* db_options ::= db_options COMP NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_COMP, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 109: /* db_options ::= db_options DURATION NK_INTEGER */
- case 110: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==110);
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 113: /* db_options ::= db_options DURATION NK_INTEGER */
+ case 114: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==114);
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_DAYS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 111: /* db_options ::= db_options MAXROWS NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 115: /* db_options ::= db_options MAXROWS NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 112: /* db_options ::= db_options MINROWS NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 116: /* db_options ::= db_options MINROWS NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 113: /* db_options ::= db_options KEEP integer_list */
- case 114: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==114);
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP, yymsp[0].minor.yy334); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 117: /* db_options ::= db_options KEEP integer_list */
+ case 118: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==118);
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_KEEP, yymsp[0].minor.yy946); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 115: /* db_options ::= db_options PAGES NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 119: /* db_options ::= db_options PAGES NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PAGES, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 116: /* db_options ::= db_options PAGESIZE NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 120: /* db_options ::= db_options PAGESIZE NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 117: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 121: /* db_options ::= db_options TSDB_PAGESIZE NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TSDB_PAGESIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 118: /* db_options ::= db_options PRECISION NK_STRING */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 122: /* db_options ::= db_options PRECISION NK_STRING */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 119: /* db_options ::= db_options REPLICA NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 123: /* db_options ::= db_options REPLICA NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 120: /* db_options ::= db_options VGROUPS NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 124: /* db_options ::= db_options VGROUPS NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 121: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 125: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 122: /* db_options ::= db_options RETENTIONS retention_list */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_RETENTIONS, yymsp[0].minor.yy334); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 126: /* db_options ::= db_options RETENTIONS retention_list */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_RETENTIONS, yymsp[0].minor.yy946); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 123: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 127: /* db_options ::= db_options SCHEMALESS NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 124: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 128: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 125: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 129: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 126: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 130: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 127: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ case 131: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_PERIOD, &t);
+ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-3].minor.yy974, DB_OPTION_WAL_RETENTION_PERIOD, &t);
}
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 128: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 132: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 129: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ case 133: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-3].minor.yy560, DB_OPTION_WAL_RETENTION_SIZE, &t);
+ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-3].minor.yy974, DB_OPTION_WAL_RETENTION_SIZE, &t);
}
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 130: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 134: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 131: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 135: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 132: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 136: /* db_options ::= db_options STT_TRIGGER NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_STT_TRIGGER, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 133: /* db_options ::= db_options TABLE_PREFIX signed */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy560); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 137: /* db_options ::= db_options TABLE_PREFIX signed */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TABLE_PREFIX, yymsp[0].minor.yy974); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 134: /* db_options ::= db_options TABLE_SUFFIX signed */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy560); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 138: /* db_options ::= db_options TABLE_SUFFIX signed */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_TABLE_SUFFIX, yymsp[0].minor.yy974); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 135: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 139: /* db_options ::= db_options S3_CHUNKSIZE NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_CHUNKSIZE, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 136: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */
- case 137: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==137);
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 140: /* db_options ::= db_options S3_KEEPLOCAL NK_INTEGER */
+ case 141: /* db_options ::= db_options S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==141);
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_KEEPLOCAL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 138: /* db_options ::= db_options S3_COMPACT NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 142: /* db_options ::= db_options S3_COMPACT NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_S3_COMPACT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 139: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 143: /* db_options ::= db_options KEEP_TIME_OFFSET NK_INTEGER */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_KEEP_TIME_OFFSET, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 140: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */
-{ yylhsminor.yy560 = setDatabaseOption(pCxt, yymsp[-2].minor.yy560, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 144: /* db_options ::= db_options ENCRYPT_ALGORITHM NK_STRING */
+{ yylhsminor.yy974 = setDatabaseOption(pCxt, yymsp[-2].minor.yy974, DB_OPTION_ENCRYPT_ALGORITHM, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 141: /* alter_db_options ::= alter_db_option */
-{ yylhsminor.yy560 = createAlterDatabaseOptions(pCxt); yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yylhsminor.yy560, &yymsp[0].minor.yy389); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 145: /* alter_db_options ::= alter_db_option */
+{ yylhsminor.yy974 = createAlterDatabaseOptions(pCxt); yylhsminor.yy974 = setAlterDatabaseOption(pCxt, yylhsminor.yy974, &yymsp[0].minor.yy683); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 142: /* alter_db_options ::= alter_db_options alter_db_option */
-{ yylhsminor.yy560 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy560, &yymsp[0].minor.yy389); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 146: /* alter_db_options ::= alter_db_options alter_db_option */
+{ yylhsminor.yy974 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy974, &yymsp[0].minor.yy683); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 143: /* alter_db_option ::= BUFFER NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 147: /* alter_db_option ::= BUFFER NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_BUFFER; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 144: /* alter_db_option ::= CACHEMODEL NK_STRING */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 148: /* alter_db_option ::= CACHEMODEL NK_STRING */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 145: /* alter_db_option ::= CACHESIZE NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 149: /* alter_db_option ::= CACHESIZE NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 146: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 150: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 147: /* alter_db_option ::= KEEP integer_list */
- case 148: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==148);
-{ yymsp[-1].minor.yy389.type = DB_OPTION_KEEP; yymsp[-1].minor.yy389.pList = yymsp[0].minor.yy334; }
+ case 151: /* alter_db_option ::= KEEP integer_list */
+ case 152: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==152);
+{ yymsp[-1].minor.yy683.type = DB_OPTION_KEEP; yymsp[-1].minor.yy683.pList = yymsp[0].minor.yy946; }
break;
- case 149: /* alter_db_option ::= PAGES NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_PAGES; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 153: /* alter_db_option ::= PAGES NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_PAGES; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 150: /* alter_db_option ::= REPLICA NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 154: /* alter_db_option ::= REPLICA NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_REPLICA; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 151: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_WAL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 155: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_WAL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 152: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 156: /* alter_db_option ::= STT_TRIGGER NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_STT_TRIGGER; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 153: /* alter_db_option ::= MINROWS NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 157: /* alter_db_option ::= MINROWS NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_MINROWS; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 154: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 158: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 155: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
+ case 159: /* alter_db_option ::= WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yymsp[-2].minor.yy389.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy389.val = t;
+ yymsp[-2].minor.yy683.type = DB_OPTION_WAL_RETENTION_PERIOD; yymsp[-2].minor.yy683.val = t;
}
break;
- case 156: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 160: /* alter_db_option ::= WAL_RETENTION_SIZE NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 157: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
+ case 161: /* alter_db_option ::= WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yymsp[-2].minor.yy389.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy389.val = t;
+ yymsp[-2].minor.yy683.type = DB_OPTION_WAL_RETENTION_SIZE; yymsp[-2].minor.yy683.val = t;
}
break;
- case 158: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */
- case 159: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==159);
-{ yymsp[-1].minor.yy389.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
- break;
- case 160: /* alter_db_option ::= S3_COMPACT NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
- break;
- case 161: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
- break;
- case 162: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */
-{ yymsp[-1].minor.yy389.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
- break;
- case 163: /* integer_list ::= NK_INTEGER */
-{ yylhsminor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy334 = yylhsminor.yy334;
- break;
- case 164: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
- case 446: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==446);
-{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy334 = yylhsminor.yy334;
- break;
- case 165: /* variable_list ::= NK_VARIABLE */
-{ yylhsminor.yy334 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy334 = yylhsminor.yy334;
- break;
- case 166: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
-{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy334 = yylhsminor.yy334;
- break;
- case 167: /* retention_list ::= retention */
- case 200: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==200);
- case 203: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==203);
- case 212: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==212);
- case 215: /* column_def_list ::= column_def */ yytestcase(yyruleno==215);
- case 263: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==263);
- case 268: /* col_name_list ::= col_name */ yytestcase(yyruleno==268);
- case 338: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==338);
- case 362: /* func_list ::= func */ yytestcase(yyruleno==362);
- case 412: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==412);
- case 490: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==490);
- case 515: /* literal_list ::= signed_literal */ yytestcase(yyruleno==515);
- case 607: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==607);
- case 613: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==613);
- case 689: /* select_list ::= select_item */ yytestcase(yyruleno==689);
- case 700: /* partition_list ::= partition_item */ yytestcase(yyruleno==700);
- case 761: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==761);
-{ yylhsminor.yy334 = createNodeList(pCxt, yymsp[0].minor.yy560); }
- yymsp[0].minor.yy334 = yylhsminor.yy334;
- break;
- case 168: /* retention_list ::= retention_list NK_COMMA retention */
- case 204: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==204);
- case 213: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==213);
- case 216: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==216);
- case 264: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==264);
- case 269: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==269);
- case 339: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==339);
- case 363: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==363);
- case 413: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==413);
- case 491: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==491);
- case 516: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==516);
- case 608: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==608);
- case 690: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==690);
- case 701: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==701);
- case 762: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==762);
-{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); }
- yymsp[-2].minor.yy334 = yylhsminor.yy334;
- break;
- case 169: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
- case 170: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==170);
-{ yylhsminor.yy560 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
- break;
- case 171: /* speed_opt ::= */
- case 396: /* bufsize_opt ::= */ yytestcase(yyruleno==396);
-{ yymsp[1].minor.yy802 = 0; }
- break;
- case 172: /* speed_opt ::= BWLIMIT NK_INTEGER */
- case 397: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==397);
-{ yymsp[-1].minor.yy802 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
- break;
- case 174: /* start_opt ::= START WITH NK_INTEGER */
- case 178: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==178);
-{ yymsp[-2].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
- break;
- case 175: /* start_opt ::= START WITH NK_STRING */
- case 179: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==179);
-{ yymsp[-2].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
- break;
- case 176: /* start_opt ::= START WITH TIMESTAMP NK_STRING */
- case 180: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==180);
-{ yymsp[-3].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
- break;
- case 181: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
- case 184: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==184);
-{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); }
- break;
- case 182: /* cmd ::= CREATE TABLE multi_create_clause */
-{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy334); }
- break;
- case 183: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */
-{ pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy334, &yymsp[0].minor.yy0); }
- break;
- case 185: /* cmd ::= DROP TABLE with_opt multi_drop_clause */
-{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy334); }
- break;
- case 186: /* cmd ::= DROP STABLE with_opt exists_opt full_table_name */
-{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); }
- break;
- case 187: /* cmd ::= ALTER TABLE alter_table_clause */
- case 448: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==448);
- case 449: /* cmd ::= insert_query */ yytestcase(yyruleno==449);
-{ pCxt->pRootNode = yymsp[0].minor.yy560; }
- break;
- case 188: /* cmd ::= ALTER STABLE alter_table_clause */
-{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy560); }
- break;
- case 189: /* alter_table_clause ::= full_table_name alter_table_options */
-{ yylhsminor.yy560 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
- break;
- case 190: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */
-{ yylhsminor.yy560 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy560, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy952, yymsp[0].minor.yy560); }
- yymsp[-5].minor.yy560 = yylhsminor.yy560;
- break;
- case 191: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
-{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy533); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
- break;
- case 192: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
-{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); }
- yymsp[-4].minor.yy560 = yylhsminor.yy560;
- break;
- case 193: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
-{ yylhsminor.yy560 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy533, yymsp[0].minor.yy560); }
- yymsp[-4].minor.yy560 = yylhsminor.yy560;
- break;
- case 194: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
-{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); }
- yymsp[-4].minor.yy560 = yylhsminor.yy560;
- break;
- case 195: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
-{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); }
- yymsp[-4].minor.yy560 = yylhsminor.yy560;
+ case 162: /* alter_db_option ::= S3_KEEPLOCAL NK_INTEGER */
+ case 163: /* alter_db_option ::= S3_KEEPLOCAL NK_VARIABLE */ yytestcase(yyruleno==163);
+{ yymsp[-1].minor.yy683.type = DB_OPTION_S3_KEEPLOCAL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
+ break;
+ case 164: /* alter_db_option ::= S3_COMPACT NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_S3_COMPACT, yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
+ break;
+ case 165: /* alter_db_option ::= KEEP_TIME_OFFSET NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_KEEP_TIME_OFFSET; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
+ break;
+ case 166: /* alter_db_option ::= ENCRYPT_ALGORITHM NK_STRING */
+{ yymsp[-1].minor.yy683.type = DB_OPTION_ENCRYPT_ALGORITHM; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
+ break;
+ case 167: /* integer_list ::= NK_INTEGER */
+{ yylhsminor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy946 = yylhsminor.yy946;
+ break;
+ case 168: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */
+ case 452: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==452);
+{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy946 = yylhsminor.yy946;
+ break;
+ case 169: /* variable_list ::= NK_VARIABLE */
+{ yylhsminor.yy946 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy946 = yylhsminor.yy946;
+ break;
+ case 170: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */
+{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy946 = yylhsminor.yy946;
+ break;
+ case 171: /* retention_list ::= retention */
+ case 204: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==204);
+ case 207: /* multi_drop_clause ::= drop_table_clause */ yytestcase(yyruleno==207);
+ case 216: /* tag_def_list ::= tag_def */ yytestcase(yyruleno==216);
+ case 219: /* column_def_list ::= column_def */ yytestcase(yyruleno==219);
+ case 267: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==267);
+ case 272: /* col_name_list ::= col_name */ yytestcase(yyruleno==272);
+ case 344: /* tag_list_opt ::= tag_item */ yytestcase(yyruleno==344);
+ case 368: /* func_list ::= func */ yytestcase(yyruleno==368);
+ case 418: /* column_stream_def_list ::= column_stream_def */ yytestcase(yyruleno==418);
+ case 496: /* tags_literal_list ::= tags_literal */ yytestcase(yyruleno==496);
+ case 521: /* literal_list ::= signed_literal */ yytestcase(yyruleno==521);
+ case 616: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==616);
+ case 622: /* when_then_list ::= when_then_expr */ yytestcase(yyruleno==622);
+ case 698: /* select_list ::= select_item */ yytestcase(yyruleno==698);
+ case 709: /* partition_list ::= partition_item */ yytestcase(yyruleno==709);
+ case 772: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==772);
+{ yylhsminor.yy946 = createNodeList(pCxt, yymsp[0].minor.yy974); }
+ yymsp[0].minor.yy946 = yylhsminor.yy946;
+ break;
+ case 172: /* retention_list ::= retention_list NK_COMMA retention */
+ case 208: /* multi_drop_clause ::= multi_drop_clause NK_COMMA drop_table_clause */ yytestcase(yyruleno==208);
+ case 217: /* tag_def_list ::= tag_def_list NK_COMMA tag_def */ yytestcase(yyruleno==217);
+ case 220: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==220);
+ case 268: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==268);
+ case 273: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==273);
+ case 345: /* tag_list_opt ::= tag_list_opt NK_COMMA tag_item */ yytestcase(yyruleno==345);
+ case 369: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==369);
+ case 419: /* column_stream_def_list ::= column_stream_def_list NK_COMMA column_stream_def */ yytestcase(yyruleno==419);
+ case 497: /* tags_literal_list ::= tags_literal_list NK_COMMA tags_literal */ yytestcase(yyruleno==497);
+ case 522: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==522);
+ case 617: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==617);
+ case 699: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==699);
+ case 710: /* partition_list ::= partition_list NK_COMMA partition_item */ yytestcase(yyruleno==710);
+ case 773: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==773);
+{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); }
+ yymsp[-2].minor.yy946 = yylhsminor.yy946;
+ break;
+ case 173: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */
+ case 174: /* retention ::= NK_MINUS NK_COLON NK_VARIABLE */ yytestcase(yyruleno==174);
+{ yylhsminor.yy974 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
+ break;
+ case 175: /* speed_opt ::= */
+ case 402: /* bufsize_opt ::= */ yytestcase(yyruleno==402);
+{ yymsp[1].minor.yy904 = 0; }
+ break;
+ case 176: /* speed_opt ::= BWLIMIT NK_INTEGER */
+ case 403: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ yytestcase(yyruleno==403);
+{ yymsp[-1].minor.yy904 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); }
+ break;
+ case 178: /* start_opt ::= START WITH NK_INTEGER */
+ case 182: /* end_opt ::= END WITH NK_INTEGER */ yytestcase(yyruleno==182);
+{ yymsp[-2].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0); }
+ break;
+ case 179: /* start_opt ::= START WITH NK_STRING */
+ case 183: /* end_opt ::= END WITH NK_STRING */ yytestcase(yyruleno==183);
+{ yymsp[-2].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ break;
+ case 180: /* start_opt ::= START WITH TIMESTAMP NK_STRING */
+ case 184: /* end_opt ::= END WITH TIMESTAMP NK_STRING */ yytestcase(yyruleno==184);
+{ yymsp[-3].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ break;
+ case 185: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */
+ case 188: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==188);
+{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy946, yymsp[-1].minor.yy946, yymsp[0].minor.yy974); }
+ break;
+ case 186: /* cmd ::= CREATE TABLE multi_create_clause */
+{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy946); }
+ break;
+ case 187: /* cmd ::= CREATE TABLE not_exists_opt USING full_table_name NK_LP tag_list_opt NK_RP FILE NK_STRING */
+{ pCxt->pRootNode = createCreateSubTableFromFileClause(pCxt, yymsp[-7].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy946, &yymsp[0].minor.yy0); }
+ break;
+ case 189: /* cmd ::= DROP TABLE with_opt multi_drop_clause */
+{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy946); }
+ break;
+ case 190: /* cmd ::= DROP STABLE with_opt exists_opt full_table_name */
+{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); }
+ break;
+ case 191: /* cmd ::= ALTER TABLE alter_table_clause */
+ case 454: /* cmd ::= query_or_subquery */ yytestcase(yyruleno==454);
+ case 455: /* cmd ::= insert_query */ yytestcase(yyruleno==455);
+{ pCxt->pRootNode = yymsp[0].minor.yy974; }
+ break;
+ case 192: /* cmd ::= ALTER STABLE alter_table_clause */
+{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy974); }
+ break;
+ case 193: /* alter_table_clause ::= full_table_name alter_table_options */
+{ yylhsminor.yy974 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
+ break;
+ case 194: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name column_options */
+{ yylhsminor.yy974 = createAlterTableAddModifyColOptions2(pCxt, yymsp[-5].minor.yy974, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy424, yymsp[0].minor.yy974); }
+ yymsp[-5].minor.yy974 = yylhsminor.yy974;
+ break;
+ case 195: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */
+{ yylhsminor.yy974 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy974, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy557); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
+ break;
+ case 196: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */
+{ yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); }
+ yymsp[-4].minor.yy974 = yylhsminor.yy974;
+ break;
+ case 197: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name column_options */
+{ yylhsminor.yy974 = createAlterTableAddModifyColOptions(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_COMPRESS, &yymsp[-1].minor.yy557, yymsp[0].minor.yy974); }
+ yymsp[-4].minor.yy974 = yylhsminor.yy974;
+ break;
+ case 198: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */
+{ yylhsminor.yy974 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); }
+ yymsp[-4].minor.yy974 = yylhsminor.yy974;
+ break;
+ case 199: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */
+{ yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); }
+ yymsp[-4].minor.yy974 = yylhsminor.yy974;
break;
- case 196: /* alter_table_clause ::= full_table_name DROP TAG column_name */
-{ yylhsminor.yy560 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy560, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy533); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 200: /* alter_table_clause ::= full_table_name DROP TAG column_name */
+{ yylhsminor.yy974 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy974, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy557); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 197: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
-{ yylhsminor.yy560 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952); }
- yymsp[-4].minor.yy560 = yylhsminor.yy560;
+ case 201: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */
+{ yylhsminor.yy974 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424); }
+ yymsp[-4].minor.yy974 = yylhsminor.yy974;
break;
- case 198: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
-{ yylhsminor.yy560 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy560, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); }
- yymsp[-4].minor.yy560 = yylhsminor.yy560;
+ case 202: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */
+{ yylhsminor.yy974 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy974, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); }
+ yymsp[-4].minor.yy974 = yylhsminor.yy974;
break;
- case 199: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */
-{ yylhsminor.yy560 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy560, &yymsp[-2].minor.yy533, yymsp[0].minor.yy560); }
- yymsp[-5].minor.yy560 = yylhsminor.yy560;
+ case 203: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ tags_literal */
+{ yylhsminor.yy974 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy974, &yymsp[-2].minor.yy557, yymsp[0].minor.yy974); }
+ yymsp[-5].minor.yy974 = yylhsminor.yy974;
break;
- case 201: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
- case 614: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==614);
-{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-1].minor.yy334, yymsp[0].minor.yy560); }
- yymsp[-1].minor.yy334 = yylhsminor.yy334;
+ case 205: /* multi_create_clause ::= multi_create_clause create_subtable_clause */
+ case 623: /* when_then_list ::= when_then_list when_then_expr */ yytestcase(yyruleno==623);
+{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-1].minor.yy946, yymsp[0].minor.yy974); }
+ yymsp[-1].minor.yy946 = yylhsminor.yy946;
break;
- case 202: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */
-{ yylhsminor.yy560 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy173, yymsp[-8].minor.yy560, yymsp[-6].minor.yy560, yymsp[-5].minor.yy334, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); }
- yymsp[-9].minor.yy560 = yylhsminor.yy560;
+ case 206: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP tags_literal_list NK_RP table_options */
+{ yylhsminor.yy974 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy569, yymsp[-8].minor.yy974, yymsp[-6].minor.yy974, yymsp[-5].minor.yy946, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); }
+ yymsp[-9].minor.yy974 = yylhsminor.yy974;
break;
- case 205: /* drop_table_clause ::= exists_opt full_table_name */
-{ yylhsminor.yy560 = createDropTableClause(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 209: /* drop_table_clause ::= exists_opt full_table_name */
+{ yylhsminor.yy974 = createDropTableClause(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 209: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
- case 411: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==411);
-{ yymsp[-2].minor.yy334 = yymsp[-1].minor.yy334; }
+ case 213: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */
+ case 417: /* col_list_opt ::= NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==417);
+{ yymsp[-2].minor.yy946 = yymsp[-1].minor.yy946; }
break;
- case 210: /* full_table_name ::= table_name */
- case 352: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==352);
-{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy533, NULL); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 214: /* full_table_name ::= table_name */
+ case 358: /* full_tsma_name ::= tsma_name */ yytestcase(yyruleno==358);
+{ yylhsminor.yy974 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy557, NULL); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 211: /* full_table_name ::= db_name NK_DOT table_name */
- case 353: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==353);
-{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533, NULL); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 215: /* full_table_name ::= db_name NK_DOT table_name */
+ case 359: /* full_tsma_name ::= db_name NK_DOT tsma_name */ yytestcase(yyruleno==359);
+{ yylhsminor.yy974 = createRealTableNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557, NULL); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 214: /* tag_def ::= column_name type_name */
-{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy533, yymsp[0].minor.yy952, NULL); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 218: /* tag_def ::= column_name type_name */
+{ yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy557, yymsp[0].minor.yy424, NULL); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 217: /* column_def ::= column_name type_name column_options */
-{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy533, yymsp[-1].minor.yy952, yymsp[0].minor.yy560); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 221: /* column_def ::= column_name type_name column_options */
+{ yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-2].minor.yy557, yymsp[-1].minor.yy424, yymsp[0].minor.yy974); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 218: /* type_name ::= BOOL */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BOOL); }
+ case 222: /* type_name ::= BOOL */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BOOL); }
break;
- case 219: /* type_name ::= TINYINT */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TINYINT); }
+ case 223: /* type_name ::= TINYINT */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_TINYINT); }
break;
- case 220: /* type_name ::= SMALLINT */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
+ case 224: /* type_name ::= SMALLINT */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_SMALLINT); }
break;
- case 221: /* type_name ::= INT */
- case 222: /* type_name ::= INTEGER */ yytestcase(yyruleno==222);
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_INT); }
+ case 225: /* type_name ::= INT */
+ case 226: /* type_name ::= INTEGER */ yytestcase(yyruleno==226);
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_INT); }
break;
- case 223: /* type_name ::= BIGINT */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BIGINT); }
+ case 227: /* type_name ::= BIGINT */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BIGINT); }
break;
- case 224: /* type_name ::= FLOAT */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_FLOAT); }
+ case 228: /* type_name ::= FLOAT */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_FLOAT); }
break;
- case 225: /* type_name ::= DOUBLE */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
+ case 229: /* type_name ::= DOUBLE */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_DOUBLE); }
break;
- case 226: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
+ case 230: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); }
break;
- case 227: /* type_name ::= TIMESTAMP */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
+ case 231: /* type_name ::= TIMESTAMP */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); }
break;
- case 228: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
+ case 232: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); }
break;
- case 229: /* type_name ::= TINYINT UNSIGNED */
-{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
+ case 233: /* type_name ::= TINYINT UNSIGNED */
+{ yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UTINYINT); }
break;
- case 230: /* type_name ::= SMALLINT UNSIGNED */
-{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
+ case 234: /* type_name ::= SMALLINT UNSIGNED */
+{ yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_USMALLINT); }
break;
- case 231: /* type_name ::= INT UNSIGNED */
-{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UINT); }
+ case 235: /* type_name ::= INT UNSIGNED */
+{ yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UINT); }
break;
- case 232: /* type_name ::= BIGINT UNSIGNED */
-{ yymsp[-1].minor.yy952 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
+ case 236: /* type_name ::= BIGINT UNSIGNED */
+{ yymsp[-1].minor.yy424 = createDataType(TSDB_DATA_TYPE_UBIGINT); }
break;
- case 233: /* type_name ::= JSON */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_JSON); }
+ case 237: /* type_name ::= JSON */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_JSON); }
break;
- case 234: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
+ case 238: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); }
break;
- case 235: /* type_name ::= MEDIUMBLOB */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
+ case 239: /* type_name ::= MEDIUMBLOB */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); }
break;
- case 236: /* type_name ::= BLOB */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_BLOB); }
+ case 240: /* type_name ::= BLOB */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_BLOB); }
break;
- case 237: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
+ case 241: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); }
break;
- case 238: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
+ case 242: /* type_name ::= GEOMETRY NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_GEOMETRY, &yymsp[-1].minor.yy0); }
break;
- case 239: /* type_name ::= DECIMAL */
-{ yymsp[0].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 243: /* type_name ::= DECIMAL */
+{ yymsp[0].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 240: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 244: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 241: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy952 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
+ case 245: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+{ yymsp[-5].minor.yy424 = createDataType(TSDB_DATA_TYPE_DECIMAL); }
break;
- case 242: /* type_name_default_len ::= BINARY */
-{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); }
+ case 246: /* type_name_default_len ::= BINARY */
+{ yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, NULL); }
break;
- case 243: /* type_name_default_len ::= NCHAR */
-{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); }
+ case 247: /* type_name_default_len ::= NCHAR */
+{ yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, NULL); }
break;
- case 244: /* type_name_default_len ::= VARCHAR */
-{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); }
+ case 248: /* type_name_default_len ::= VARCHAR */
+{ yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, NULL); }
break;
- case 245: /* type_name_default_len ::= VARBINARY */
-{ yymsp[0].minor.yy952 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); }
+ case 249: /* type_name_default_len ::= VARBINARY */
+{ yymsp[0].minor.yy424 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, NULL); }
break;
- case 248: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */
- case 419: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==419);
-{ yymsp[-3].minor.yy334 = yymsp[-1].minor.yy334; }
+ case 252: /* tags_def ::= TAGS NK_LP tag_def_list NK_RP */
+ case 425: /* tag_def_or_ref_opt ::= TAGS NK_LP column_stream_def_list NK_RP */ yytestcase(yyruleno==425);
+{ yymsp[-3].minor.yy946 = yymsp[-1].minor.yy946; }
break;
- case 249: /* table_options ::= */
-{ yymsp[1].minor.yy560 = createDefaultTableOptions(pCxt); }
+ case 253: /* table_options ::= */
+{ yymsp[1].minor.yy974 = createDefaultTableOptions(pCxt); }
break;
- case 250: /* table_options ::= table_options COMMENT NK_STRING */
-{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 254: /* table_options ::= table_options COMMENT NK_STRING */
+{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 251: /* table_options ::= table_options MAX_DELAY duration_list */
-{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy334); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 255: /* table_options ::= table_options MAX_DELAY duration_list */
+{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy946); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 252: /* table_options ::= table_options WATERMARK duration_list */
-{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy334); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 256: /* table_options ::= table_options WATERMARK duration_list */
+{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy946); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 253: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
-{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy334); }
- yymsp[-4].minor.yy560 = yylhsminor.yy560;
+ case 257: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */
+{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-4].minor.yy974, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy946); }
+ yymsp[-4].minor.yy974 = yylhsminor.yy974;
break;
- case 254: /* table_options ::= table_options TTL NK_INTEGER */
-{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 258: /* table_options ::= table_options TTL NK_INTEGER */
+{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 255: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
-{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-4].minor.yy560, TABLE_OPTION_SMA, yymsp[-1].minor.yy334); }
- yymsp[-4].minor.yy560 = yylhsminor.yy560;
+ case 259: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */
+{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-4].minor.yy974, TABLE_OPTION_SMA, yymsp[-1].minor.yy946); }
+ yymsp[-4].minor.yy974 = yylhsminor.yy974;
break;
- case 256: /* table_options ::= table_options DELETE_MARK duration_list */
-{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-2].minor.yy560, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy334); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 260: /* table_options ::= table_options DELETE_MARK duration_list */
+{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-2].minor.yy974, TABLE_OPTION_DELETE_MARK, yymsp[0].minor.yy946); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 257: /* alter_table_options ::= alter_table_option */
-{ yylhsminor.yy560 = createAlterTableOptions(pCxt); yylhsminor.yy560 = setTableOption(pCxt, yylhsminor.yy560, yymsp[0].minor.yy389.type, &yymsp[0].minor.yy389.val); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 261: /* alter_table_options ::= alter_table_option */
+{ yylhsminor.yy974 = createAlterTableOptions(pCxt); yylhsminor.yy974 = setTableOption(pCxt, yylhsminor.yy974, yymsp[0].minor.yy683.type, &yymsp[0].minor.yy683.val); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 258: /* alter_table_options ::= alter_table_options alter_table_option */
-{ yylhsminor.yy560 = setTableOption(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy389.type, &yymsp[0].minor.yy389.val); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 262: /* alter_table_options ::= alter_table_options alter_table_option */
+{ yylhsminor.yy974 = setTableOption(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy683.type, &yymsp[0].minor.yy683.val); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 259: /* alter_table_option ::= COMMENT NK_STRING */
-{ yymsp[-1].minor.yy389.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 263: /* alter_table_option ::= COMMENT NK_STRING */
+{ yymsp[-1].minor.yy683.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 260: /* alter_table_option ::= TTL NK_INTEGER */
-{ yymsp[-1].minor.yy389.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy389.val = yymsp[0].minor.yy0; }
+ case 264: /* alter_table_option ::= TTL NK_INTEGER */
+{ yymsp[-1].minor.yy683.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy683.val = yymsp[0].minor.yy0; }
break;
- case 261: /* duration_list ::= duration_literal */
- case 548: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==548);
-{ yylhsminor.yy334 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); }
- yymsp[0].minor.yy334 = yylhsminor.yy334;
+ case 265: /* duration_list ::= duration_literal */
+ case 554: /* expression_list ::= expr_or_subquery */ yytestcase(yyruleno==554);
+{ yylhsminor.yy946 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); }
+ yymsp[0].minor.yy946 = yylhsminor.yy946;
break;
- case 262: /* duration_list ::= duration_list NK_COMMA duration_literal */
- case 549: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==549);
-{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); }
- yymsp[-2].minor.yy334 = yylhsminor.yy334;
+ case 266: /* duration_list ::= duration_list NK_COMMA duration_literal */
+ case 555: /* expression_list ::= expression_list NK_COMMA expr_or_subquery */ yytestcase(yyruleno==555);
+{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); }
+ yymsp[-2].minor.yy946 = yylhsminor.yy946;
break;
- case 265: /* rollup_func_name ::= function_name */
-{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy533, NULL); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 269: /* rollup_func_name ::= function_name */
+{ yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[0].minor.yy557, NULL); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 266: /* rollup_func_name ::= FIRST */
- case 267: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==267);
- case 341: /* tag_item ::= QTAGS */ yytestcase(yyruleno==341);
-{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 270: /* rollup_func_name ::= FIRST */
+ case 271: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==271);
+ case 347: /* tag_item ::= QTAGS */ yytestcase(yyruleno==347);
+{ yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 270: /* col_name ::= column_name */
- case 342: /* tag_item ::= column_name */ yytestcase(yyruleno==342);
-{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy533); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 274: /* col_name ::= column_name */
+ case 348: /* tag_item ::= column_name */ yytestcase(yyruleno==348);
+{ yylhsminor.yy974 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy557); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 271: /* cmd ::= SHOW DNODES */
+ case 275: /* cmd ::= SHOW DNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); }
break;
- case 272: /* cmd ::= SHOW USERS */
+ case 276: /* cmd ::= SHOW USERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USERS_STMT); }
break;
- case 273: /* cmd ::= SHOW USERS FULL */
+ case 277: /* cmd ::= SHOW USERS FULL */
{ pCxt->pRootNode = createShowStmtWithFull(pCxt, QUERY_NODE_SHOW_USERS_FULL_STMT); }
break;
- case 274: /* cmd ::= SHOW USER PRIVILEGES */
+ case 278: /* cmd ::= SHOW USER PRIVILEGES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_USER_PRIVILEGES_STMT); }
break;
- case 275: /* cmd ::= SHOW db_kind_opt DATABASES */
+ case 279: /* cmd ::= SHOW db_kind_opt DATABASES */
{
pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT);
- (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy537);
+ (void)setShowKind(pCxt, pCxt->pRootNode, yymsp[-1].minor.yy741);
}
break;
- case 276: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
+ case 280: /* cmd ::= SHOW table_kind_db_name_cond_opt TABLES like_pattern_opt */
{
- pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy709, yymsp[0].minor.yy560, OP_TYPE_LIKE);
+ pCxt->pRootNode = createShowTablesStmt(pCxt, yymsp[-2].minor.yy595, yymsp[0].minor.yy974, OP_TYPE_LIKE);
}
break;
- case 277: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); }
+ case 281: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, OP_TYPE_LIKE); }
break;
- case 278: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy560, NULL, OP_TYPE_LIKE); }
+ case 282: /* cmd ::= SHOW db_name_cond_opt VGROUPS */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy974, NULL, OP_TYPE_LIKE); }
break;
- case 279: /* cmd ::= SHOW MNODES */
+ case 283: /* cmd ::= SHOW MNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); }
break;
- case 280: /* cmd ::= SHOW QNODES */
+ case 284: /* cmd ::= SHOW QNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QNODES_STMT); }
break;
- case 281: /* cmd ::= SHOW ARBGROUPS */
+ case 285: /* cmd ::= SHOW ANODES */
+{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_STMT); }
+ break;
+ case 286: /* cmd ::= SHOW ANODES FULL */
+{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ANODES_FULL_STMT); }
+ break;
+ case 287: /* cmd ::= SHOW ARBGROUPS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ARBGROUPS_STMT); }
break;
- case 282: /* cmd ::= SHOW FUNCTIONS */
+ case 288: /* cmd ::= SHOW FUNCTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); }
break;
- case 283: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); }
+ case 289: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy974, yymsp[-1].minor.yy974, OP_TYPE_EQUAL); }
break;
- case 284: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), OP_TYPE_EQUAL); }
+ case 290: /* cmd ::= SHOW INDEXES FROM db_name NK_DOT table_name */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), OP_TYPE_EQUAL); }
break;
- case 285: /* cmd ::= SHOW STREAMS */
+ case 291: /* cmd ::= SHOW STREAMS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); }
break;
- case 286: /* cmd ::= SHOW ACCOUNTS */
+ case 292: /* cmd ::= SHOW ACCOUNTS */
{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); }
break;
- case 287: /* cmd ::= SHOW APPS */
+ case 293: /* cmd ::= SHOW APPS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_APPS_STMT); }
break;
- case 288: /* cmd ::= SHOW CONNECTIONS */
+ case 294: /* cmd ::= SHOW CONNECTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONNECTIONS_STMT); }
break;
- case 289: /* cmd ::= SHOW LICENCES */
- case 290: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==290);
+ case 295: /* cmd ::= SHOW LICENCES */
+ case 296: /* cmd ::= SHOW GRANTS */ yytestcase(yyruleno==296);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCES_STMT); }
break;
- case 291: /* cmd ::= SHOW GRANTS FULL */
+ case 297: /* cmd ::= SHOW GRANTS FULL */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_FULL_STMT); }
break;
- case 292: /* cmd ::= SHOW GRANTS LOGS */
+ case 298: /* cmd ::= SHOW GRANTS LOGS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_GRANTS_LOGS_STMT); }
break;
- case 293: /* cmd ::= SHOW CLUSTER MACHINES */
+ case 299: /* cmd ::= SHOW CLUSTER MACHINES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_MACHINES_STMT); }
break;
- case 294: /* cmd ::= SHOW CREATE DATABASE db_name */
-{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy533); }
+ case 300: /* cmd ::= SHOW CREATE DATABASE db_name */
+{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy557); }
break;
- case 295: /* cmd ::= SHOW CREATE TABLE full_table_name */
-{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy560); }
+ case 301: /* cmd ::= SHOW CREATE TABLE full_table_name */
+{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy974); }
break;
- case 296: /* cmd ::= SHOW CREATE STABLE full_table_name */
+ case 302: /* cmd ::= SHOW CREATE STABLE full_table_name */
{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT,
-yymsp[0].minor.yy560); }
+yymsp[0].minor.yy974); }
break;
- case 297: /* cmd ::= SHOW ENCRYPTIONS */
+ case 303: /* cmd ::= SHOW ENCRYPTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_ENCRYPTIONS_STMT); }
break;
- case 298: /* cmd ::= SHOW QUERIES */
+ case 304: /* cmd ::= SHOW QUERIES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); }
break;
- case 299: /* cmd ::= SHOW SCORES */
+ case 305: /* cmd ::= SHOW SCORES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SCORES_STMT); }
break;
- case 300: /* cmd ::= SHOW TOPICS */
+ case 306: /* cmd ::= SHOW TOPICS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TOPICS_STMT); }
break;
- case 301: /* cmd ::= SHOW VARIABLES */
- case 302: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==302);
+ case 307: /* cmd ::= SHOW VARIABLES */
+ case 308: /* cmd ::= SHOW CLUSTER VARIABLES */ yytestcase(yyruleno==308);
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_VARIABLES_STMT); }
break;
- case 303: /* cmd ::= SHOW LOCAL VARIABLES */
+ case 309: /* cmd ::= SHOW LOCAL VARIABLES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT); }
break;
- case 304: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
-{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy560); }
+ case 310: /* cmd ::= SHOW DNODE NK_INTEGER VARIABLES like_pattern_opt */
+{ pCxt->pRootNode = createShowDnodeVariablesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[-2].minor.yy0), yymsp[0].minor.yy974); }
break;
- case 305: /* cmd ::= SHOW BNODES */
+ case 311: /* cmd ::= SHOW BNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_BNODES_STMT); }
break;
- case 306: /* cmd ::= SHOW SNODES */
+ case 312: /* cmd ::= SHOW SNODES */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SNODES_STMT); }
break;
- case 307: /* cmd ::= SHOW CLUSTER */
+ case 313: /* cmd ::= SHOW CLUSTER */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CLUSTER_STMT); }
break;
- case 308: /* cmd ::= SHOW TRANSACTIONS */
+ case 314: /* cmd ::= SHOW TRANSACTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); }
break;
- case 309: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
-{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy560); }
+ case 315: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */
+{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy974); }
break;
- case 310: /* cmd ::= SHOW CONSUMERS */
+ case 316: /* cmd ::= SHOW CONSUMERS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); }
break;
- case 311: /* cmd ::= SHOW SUBSCRIPTIONS */
+ case 317: /* cmd ::= SHOW SUBSCRIPTIONS */
{ pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); }
break;
- case 312: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy560, yymsp[-1].minor.yy560, OP_TYPE_EQUAL); }
+ case 318: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy974, yymsp[-1].minor.yy974, OP_TYPE_EQUAL); }
break;
- case 313: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), OP_TYPE_EQUAL); }
+ case 319: /* cmd ::= SHOW TAGS FROM db_name NK_DOT table_name */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), OP_TYPE_EQUAL); }
break;
- case 314: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
-{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560, yymsp[-3].minor.yy334); }
+ case 320: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM table_name_cond from_db_opt */
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974, yymsp[-3].minor.yy946); }
break;
- case 315: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
-{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy533), yymsp[-4].minor.yy334); }
+ case 321: /* cmd ::= SHOW TABLE TAGS tag_list_opt FROM db_name NK_DOT table_name */
+{ pCxt->pRootNode = createShowTableTagsStmt(pCxt, createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557), createIdentifierValueNode(pCxt, &yymsp[-2].minor.yy557), yymsp[-4].minor.yy946); }
break;
- case 316: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
+ case 322: /* cmd ::= SHOW VNODES ON DNODE NK_INTEGER */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0), NULL); }
break;
- case 317: /* cmd ::= SHOW VNODES */
+ case 323: /* cmd ::= SHOW VNODES */
{ pCxt->pRootNode = createShowVnodesStmt(pCxt, NULL, NULL); }
break;
- case 318: /* cmd ::= SHOW db_name_cond_opt ALIVE */
-{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy560, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
+ case 324: /* cmd ::= SHOW db_name_cond_opt ALIVE */
+{ pCxt->pRootNode = createShowAliveStmt(pCxt, yymsp[-1].minor.yy974, QUERY_NODE_SHOW_DB_ALIVE_STMT); }
break;
- case 319: /* cmd ::= SHOW CLUSTER ALIVE */
+ case 325: /* cmd ::= SHOW CLUSTER ALIVE */
{ pCxt->pRootNode = createShowAliveStmt(pCxt, NULL, QUERY_NODE_SHOW_CLUSTER_ALIVE_STMT); }
break;
- case 320: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
-{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, OP_TYPE_LIKE); }
+ case 326: /* cmd ::= SHOW db_name_cond_opt VIEWS like_pattern_opt */
+{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VIEWS_STMT, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, OP_TYPE_LIKE); }
break;
- case 321: /* cmd ::= SHOW CREATE VIEW full_table_name */
-{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy560); }
+ case 327: /* cmd ::= SHOW CREATE VIEW full_table_name */
+{ pCxt->pRootNode = createShowCreateViewStmt(pCxt, QUERY_NODE_SHOW_CREATE_VIEW_STMT, yymsp[0].minor.yy974); }
break;
- case 322: /* cmd ::= SHOW COMPACTS */
+ case 328: /* cmd ::= SHOW COMPACTS */
{ pCxt->pRootNode = createShowCompactsStmt(pCxt, QUERY_NODE_SHOW_COMPACTS_STMT); }
break;
- case 323: /* cmd ::= SHOW COMPACT NK_INTEGER */
+ case 329: /* cmd ::= SHOW COMPACT NK_INTEGER */
{ pCxt->pRootNode = createShowCompactDetailsStmt(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
- case 324: /* table_kind_db_name_cond_opt ::= */
-{ yymsp[1].minor.yy709.kind = SHOW_KIND_ALL; yymsp[1].minor.yy709.dbName = nil_token; }
+ case 330: /* table_kind_db_name_cond_opt ::= */
+{ yymsp[1].minor.yy595.kind = SHOW_KIND_ALL; yymsp[1].minor.yy595.dbName = nil_token; }
break;
- case 325: /* table_kind_db_name_cond_opt ::= table_kind */
-{ yylhsminor.yy709.kind = yymsp[0].minor.yy537; yylhsminor.yy709.dbName = nil_token; }
- yymsp[0].minor.yy709 = yylhsminor.yy709;
+ case 331: /* table_kind_db_name_cond_opt ::= table_kind */
+{ yylhsminor.yy595.kind = yymsp[0].minor.yy741; yylhsminor.yy595.dbName = nil_token; }
+ yymsp[0].minor.yy595 = yylhsminor.yy595;
break;
- case 326: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy709.kind = SHOW_KIND_ALL; yylhsminor.yy709.dbName = yymsp[-1].minor.yy533; }
- yymsp[-1].minor.yy709 = yylhsminor.yy709;
+ case 332: /* table_kind_db_name_cond_opt ::= db_name NK_DOT */
+{ yylhsminor.yy595.kind = SHOW_KIND_ALL; yylhsminor.yy595.dbName = yymsp[-1].minor.yy557; }
+ yymsp[-1].minor.yy595 = yylhsminor.yy595;
break;
- case 327: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
-{ yylhsminor.yy709.kind = yymsp[-2].minor.yy537; yylhsminor.yy709.dbName = yymsp[-1].minor.yy533; }
- yymsp[-2].minor.yy709 = yylhsminor.yy709;
+ case 333: /* table_kind_db_name_cond_opt ::= table_kind db_name NK_DOT */
+{ yylhsminor.yy595.kind = yymsp[-2].minor.yy741; yylhsminor.yy595.dbName = yymsp[-1].minor.yy557; }
+ yymsp[-2].minor.yy595 = yylhsminor.yy595;
break;
- case 328: /* table_kind ::= NORMAL */
-{ yymsp[0].minor.yy537 = SHOW_KIND_TABLES_NORMAL; }
+ case 334: /* table_kind ::= NORMAL */
+{ yymsp[0].minor.yy741 = SHOW_KIND_TABLES_NORMAL; }
break;
- case 329: /* table_kind ::= CHILD */
-{ yymsp[0].minor.yy537 = SHOW_KIND_TABLES_CHILD; }
+ case 335: /* table_kind ::= CHILD */
+{ yymsp[0].minor.yy741 = SHOW_KIND_TABLES_CHILD; }
break;
- case 330: /* db_name_cond_opt ::= */
- case 335: /* from_db_opt ::= */ yytestcase(yyruleno==335);
-{ yymsp[1].minor.yy560 = createDefaultDatabaseCondValue(pCxt); }
+ case 336: /* db_name_cond_opt ::= */
+ case 341: /* from_db_opt ::= */ yytestcase(yyruleno==341);
+{ yymsp[1].minor.yy974 = createDefaultDatabaseCondValue(pCxt); }
break;
- case 331: /* db_name_cond_opt ::= db_name NK_DOT */
-{ yylhsminor.yy560 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy533); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 337: /* db_name_cond_opt ::= db_name NK_DOT */
+{ yylhsminor.yy974 = createIdentifierValueNode(pCxt, &yymsp[-1].minor.yy557); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 333: /* like_pattern_opt ::= LIKE NK_STRING */
-{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ case 339: /* like_pattern_opt ::= LIKE NK_STRING */
+{ yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
break;
- case 334: /* table_name_cond ::= table_name */
-{ yylhsminor.yy560 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 340: /* table_name_cond ::= table_name */
+{ yylhsminor.yy974 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 336: /* from_db_opt ::= FROM db_name */
-{ yymsp[-1].minor.yy560 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy533); }
+ case 342: /* from_db_opt ::= FROM db_name */
+{ yymsp[-1].minor.yy974 = createIdentifierValueNode(pCxt, &yymsp[0].minor.yy557); }
break;
- case 340: /* tag_item ::= TBNAME */
-{ yylhsminor.yy560 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 346: /* tag_item ::= TBNAME */
+{ yylhsminor.yy974 = setProjectionAlias(pCxt, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL), &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 343: /* tag_item ::= column_name column_alias */
-{ yylhsminor.yy560 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy533), &yymsp[0].minor.yy533); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 349: /* tag_item ::= column_name column_alias */
+{ yylhsminor.yy974 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-1].minor.yy557), &yymsp[0].minor.yy557); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 344: /* tag_item ::= column_name AS column_alias */
-{ yylhsminor.yy560 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy533), &yymsp[0].minor.yy533); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 350: /* tag_item ::= column_name AS column_alias */
+{ yylhsminor.yy974 = setProjectionAlias(pCxt, createColumnNode(pCxt, NULL, &yymsp[-2].minor.yy557), &yymsp[0].minor.yy557); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 345: /* db_kind_opt ::= */
-{ yymsp[1].minor.yy537 = SHOW_KIND_ALL; }
+ case 351: /* db_kind_opt ::= */
+{ yymsp[1].minor.yy741 = SHOW_KIND_ALL; }
break;
- case 346: /* db_kind_opt ::= USER */
-{ yymsp[0].minor.yy537 = SHOW_KIND_DATABASES_USER; }
+ case 352: /* db_kind_opt ::= USER */
+{ yymsp[0].minor.yy741 = SHOW_KIND_DATABASES_USER; }
break;
- case 347: /* db_kind_opt ::= SYSTEM */
-{ yymsp[0].minor.yy537 = SHOW_KIND_DATABASES_SYSTEM; }
+ case 353: /* db_kind_opt ::= SYSTEM */
+{ yymsp[0].minor.yy741 = SHOW_KIND_DATABASES_SYSTEM; }
break;
- case 348: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */
-{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy173, &yymsp[-7].minor.yy533, yymsp[-4].minor.yy560, yymsp[-5].minor.yy560, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
+ case 354: /* cmd ::= CREATE TSMA not_exists_opt tsma_name ON full_table_name tsma_func_list INTERVAL NK_LP duration_literal NK_RP */
+{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-8].minor.yy569, &yymsp[-7].minor.yy557, yymsp[-4].minor.yy974, yymsp[-5].minor.yy974, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); }
break;
- case 349: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */
-{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy173, &yymsp[-6].minor.yy533, NULL, yymsp[-4].minor.yy560, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
+ case 355: /* cmd ::= CREATE RECURSIVE TSMA not_exists_opt tsma_name ON full_table_name INTERVAL NK_LP duration_literal NK_RP */
+{ pCxt->pRootNode = createCreateTSMAStmt(pCxt, yymsp[-7].minor.yy569, &yymsp[-6].minor.yy557, NULL, yymsp[-4].minor.yy974, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); }
break;
- case 350: /* cmd ::= DROP TSMA exists_opt full_tsma_name */
-{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); }
+ case 356: /* cmd ::= DROP TSMA exists_opt full_tsma_name */
+{ pCxt->pRootNode = createDropTSMAStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); }
break;
- case 351: /* cmd ::= SHOW db_name_cond_opt TSMAS */
-{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy560); }
+ case 357: /* cmd ::= SHOW db_name_cond_opt TSMAS */
+{ pCxt->pRootNode = createShowTSMASStmt(pCxt, yymsp[-1].minor.yy974); }
break;
- case 354: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */
-{ yymsp[-3].minor.yy560 = createTSMAOptions(pCxt, yymsp[-1].minor.yy334); }
+ case 360: /* tsma_func_list ::= FUNCTION NK_LP func_list NK_RP */
+{ yymsp[-3].minor.yy974 = createTSMAOptions(pCxt, yymsp[-1].minor.yy946); }
break;
- case 355: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy173, yymsp[-3].minor.yy560, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); }
+ case 361: /* cmd ::= CREATE SMA INDEX not_exists_opt col_name ON full_table_name index_options */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy569, yymsp[-3].minor.yy974, yymsp[-1].minor.yy974, NULL, yymsp[0].minor.yy974); }
break;
- case 356: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
-{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy173, yymsp[-5].minor.yy560, yymsp[-3].minor.yy560, yymsp[-1].minor.yy334, NULL); }
+ case 362: /* cmd ::= CREATE INDEX not_exists_opt col_name ON full_table_name NK_LP col_name_list NK_RP */
+{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_NORMAL, yymsp[-6].minor.yy569, yymsp[-5].minor.yy974, yymsp[-3].minor.yy974, yymsp[-1].minor.yy946, NULL); }
break;
- case 357: /* cmd ::= DROP INDEX exists_opt full_index_name */
-{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); }
+ case 363: /* cmd ::= DROP INDEX exists_opt full_index_name */
+{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); }
break;
- case 358: /* full_index_name ::= index_name */
-{ yylhsminor.yy560 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy533); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 364: /* full_index_name ::= index_name */
+{ yylhsminor.yy974 = createRealTableNodeForIndexName(pCxt, NULL, &yymsp[0].minor.yy557); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 359: /* full_index_name ::= db_name NK_DOT index_name */
-{ yylhsminor.yy560 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 365: /* full_index_name ::= db_name NK_DOT index_name */
+{ yylhsminor.yy974 = createRealTableNodeForIndexName(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 360: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
-{ yymsp[-9].minor.yy560 = createIndexOption(pCxt, yymsp[-7].minor.yy334, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
+ case 366: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */
+{ yymsp[-9].minor.yy974 = createIndexOption(pCxt, yymsp[-7].minor.yy946, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); }
break;
- case 361: /* 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 */
-{ yymsp[-11].minor.yy560 = createIndexOption(pCxt, yymsp[-9].minor.yy334, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
+ case 367: /* 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 */
+{ yymsp[-11].minor.yy974 = createIndexOption(pCxt, yymsp[-9].minor.yy946, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy974, yymsp[0].minor.yy974); }
break;
- case 364: /* func ::= sma_func_name NK_LP expression_list NK_RP */
-{ yylhsminor.yy560 = createFunctionNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-1].minor.yy334); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 370: /* func ::= sma_func_name NK_LP expression_list NK_RP */
+{ yylhsminor.yy974 = createFunctionNode(pCxt, &yymsp[-3].minor.yy557, yymsp[-1].minor.yy946); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 365: /* sma_func_name ::= function_name */
- case 657: /* alias_opt ::= table_alias */ yytestcase(yyruleno==657);
-{ yylhsminor.yy533 = yymsp[0].minor.yy533; }
- yymsp[0].minor.yy533 = yylhsminor.yy533;
+ case 371: /* sma_func_name ::= function_name */
+ case 666: /* alias_opt ::= table_alias */ yytestcase(yyruleno==666);
+{ yylhsminor.yy557 = yymsp[0].minor.yy557; }
+ yymsp[0].minor.yy557 = yylhsminor.yy557;
break;
- case 370: /* sma_stream_opt ::= */
- case 420: /* stream_options ::= */ yytestcase(yyruleno==420);
-{ yymsp[1].minor.yy560 = createStreamOptions(pCxt); }
+ case 376: /* sma_stream_opt ::= */
+ case 426: /* stream_options ::= */ yytestcase(yyruleno==426);
+{ yymsp[1].minor.yy974 = createStreamOptions(pCxt); }
break;
- case 371: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 377: /* sma_stream_opt ::= sma_stream_opt WATERMARK duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy974)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 372: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 378: /* sma_stream_opt ::= sma_stream_opt MAX_DELAY duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy974)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 373: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
-{ ((SStreamOptions*)yymsp[-2].minor.yy560)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); yylhsminor.yy560 = yymsp[-2].minor.yy560; }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 379: /* sma_stream_opt ::= sma_stream_opt DELETE_MARK duration_literal */
+{ ((SStreamOptions*)yymsp[-2].minor.yy974)->pDeleteMark = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); yylhsminor.yy974 = yymsp[-2].minor.yy974; }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 374: /* with_meta ::= AS */
-{ yymsp[0].minor.yy802 = 0; }
+ case 380: /* with_meta ::= AS */
+{ yymsp[0].minor.yy904 = 0; }
break;
- case 375: /* with_meta ::= WITH META AS */
-{ yymsp[-2].minor.yy802 = 1; }
+ case 381: /* with_meta ::= WITH META AS */
+{ yymsp[-2].minor.yy904 = 1; }
break;
- case 376: /* with_meta ::= ONLY META AS */
-{ yymsp[-2].minor.yy802 = 2; }
+ case 382: /* with_meta ::= ONLY META AS */
+{ yymsp[-2].minor.yy904 = 2; }
break;
- case 377: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
-{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy533, yymsp[0].minor.yy560); }
+ case 383: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_or_subquery */
+{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy569, &yymsp[-2].minor.yy557, yymsp[0].minor.yy974); }
break;
- case 378: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
-{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy173, &yymsp[-3].minor.yy533, &yymsp[0].minor.yy533, yymsp[-2].minor.yy802); }
+ case 384: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta DATABASE db_name */
+{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy569, &yymsp[-3].minor.yy557, &yymsp[0].minor.yy557, yymsp[-2].minor.yy904); }
break;
- case 379: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
-{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy173, &yymsp[-4].minor.yy533, yymsp[-1].minor.yy560, yymsp[-3].minor.yy802, yymsp[0].minor.yy560); }
+ case 385: /* cmd ::= CREATE TOPIC not_exists_opt topic_name with_meta STABLE full_table_name where_clause_opt */
+{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-5].minor.yy569, &yymsp[-4].minor.yy557, yymsp[-1].minor.yy974, yymsp[-3].minor.yy904, yymsp[0].minor.yy974); }
break;
- case 380: /* cmd ::= DROP TOPIC exists_opt topic_name */
-{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); }
+ case 386: /* cmd ::= DROP TOPIC exists_opt topic_name */
+{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); }
break;
- case 381: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
-{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy173, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); }
+ case 387: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */
+{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy569, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); }
break;
- case 382: /* cmd ::= DESC full_table_name */
- case 383: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==383);
-{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy560); }
+ case 388: /* cmd ::= DESC full_table_name */
+ case 389: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==389);
+{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy974); }
break;
- case 384: /* cmd ::= RESET QUERY CACHE */
+ case 390: /* cmd ::= RESET QUERY CACHE */
{ pCxt->pRootNode = createResetQueryCacheStmt(pCxt); }
break;
- case 385: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
- case 386: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==386);
-{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
+ case 391: /* cmd ::= EXPLAIN analyze_opt explain_options query_or_subquery */
+ case 392: /* cmd ::= EXPLAIN analyze_opt explain_options insert_query */ yytestcase(yyruleno==392);
+{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); }
break;
- case 389: /* explain_options ::= */
-{ yymsp[1].minor.yy560 = createDefaultExplainOptions(pCxt); }
+ case 395: /* explain_options ::= */
+{ yymsp[1].minor.yy974 = createDefaultExplainOptions(pCxt); }
break;
- case 390: /* explain_options ::= explain_options VERBOSE NK_BOOL */
-{ yylhsminor.yy560 = setExplainVerbose(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 396: /* explain_options ::= explain_options VERBOSE NK_BOOL */
+{ yylhsminor.yy974 = setExplainVerbose(pCxt, yymsp[-2].minor.yy974, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 391: /* explain_options ::= explain_options RATIO NK_FLOAT */
-{ yylhsminor.yy560 = setExplainRatio(pCxt, yymsp[-2].minor.yy560, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 397: /* explain_options ::= explain_options RATIO NK_FLOAT */
+{ yylhsminor.yy974 = setExplainRatio(pCxt, yymsp[-2].minor.yy974, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 392: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
-{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy173, yymsp[-9].minor.yy173, &yymsp[-6].minor.yy533, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy952, yymsp[-1].minor.yy802, &yymsp[0].minor.yy533, yymsp[-10].minor.yy173); }
+ case 398: /* cmd ::= CREATE or_replace_opt agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt language_opt */
+{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-7].minor.yy569, yymsp[-9].minor.yy569, &yymsp[-6].minor.yy557, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy424, yymsp[-1].minor.yy904, &yymsp[0].minor.yy557, yymsp[-10].minor.yy569); }
break;
- case 393: /* cmd ::= DROP FUNCTION exists_opt function_name */
-{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); }
+ case 399: /* cmd ::= DROP FUNCTION exists_opt function_name */
+{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); }
break;
- case 398: /* language_opt ::= */
- case 443: /* on_vgroup_id ::= */ yytestcase(yyruleno==443);
-{ yymsp[1].minor.yy533 = nil_token; }
+ case 404: /* language_opt ::= */
+ case 449: /* on_vgroup_id ::= */ yytestcase(yyruleno==449);
+{ yymsp[1].minor.yy557 = nil_token; }
break;
- case 399: /* language_opt ::= LANGUAGE NK_STRING */
- case 444: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==444);
-{ yymsp[-1].minor.yy533 = yymsp[0].minor.yy0; }
+ case 405: /* language_opt ::= LANGUAGE NK_STRING */
+ case 450: /* on_vgroup_id ::= ON NK_INTEGER */ yytestcase(yyruleno==450);
+{ yymsp[-1].minor.yy557 = yymsp[0].minor.yy0; }
break;
- case 402: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
-{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy173, yymsp[-2].minor.yy560, &yymsp[-1].minor.yy0, yymsp[0].minor.yy560); }
+ case 408: /* cmd ::= CREATE or_replace_opt VIEW full_view_name AS query_or_subquery */
+{ pCxt->pRootNode = createCreateViewStmt(pCxt, yymsp[-4].minor.yy569, yymsp[-2].minor.yy974, &yymsp[-1].minor.yy0, yymsp[0].minor.yy974); }
break;
- case 403: /* cmd ::= DROP VIEW exists_opt full_view_name */
-{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy173, yymsp[0].minor.yy560); }
+ case 409: /* cmd ::= DROP VIEW exists_opt full_view_name */
+{ pCxt->pRootNode = createDropViewStmt(pCxt, yymsp[-1].minor.yy569, yymsp[0].minor.yy974); }
break;
- case 404: /* full_view_name ::= view_name */
-{ yylhsminor.yy560 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy533); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 410: /* full_view_name ::= view_name */
+{ yylhsminor.yy974 = createViewNode(pCxt, NULL, &yymsp[0].minor.yy557); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 405: /* full_view_name ::= db_name NK_DOT view_name */
-{ yylhsminor.yy560 = createViewNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 411: /* full_view_name ::= db_name NK_DOT view_name */
+{ yylhsminor.yy974 = createViewNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 406: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
-{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy173, &yymsp[-8].minor.yy533, yymsp[-5].minor.yy560, yymsp[-7].minor.yy560, yymsp[-3].minor.yy334, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, yymsp[-4].minor.yy334); }
+ case 412: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options INTO full_table_name col_list_opt tag_def_or_ref_opt subtable_opt AS query_or_subquery */
+{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-9].minor.yy569, &yymsp[-8].minor.yy557, yymsp[-5].minor.yy974, yymsp[-7].minor.yy974, yymsp[-3].minor.yy946, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, yymsp[-4].minor.yy946); }
break;
- case 407: /* cmd ::= DROP STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); }
+ case 413: /* cmd ::= DROP STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); }
break;
- case 408: /* cmd ::= PAUSE STREAM exists_opt stream_name */
-{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); }
+ case 414: /* cmd ::= PAUSE STREAM exists_opt stream_name */
+{ pCxt->pRootNode = createPauseStreamStmt(pCxt, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); }
break;
- case 409: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
-{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy173, yymsp[-1].minor.yy173, &yymsp[0].minor.yy533); }
+ case 415: /* cmd ::= RESUME STREAM exists_opt ignore_opt stream_name */
+{ pCxt->pRootNode = createResumeStreamStmt(pCxt, yymsp[-2].minor.yy569, yymsp[-1].minor.yy569, &yymsp[0].minor.yy557); }
break;
- case 414: /* column_stream_def ::= column_name stream_col_options */
-{ yylhsminor.yy560 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy533, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy560); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 420: /* column_stream_def ::= column_name stream_col_options */
+{ yylhsminor.yy974 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy557, createDataType(TSDB_DATA_TYPE_NULL), yymsp[0].minor.yy974); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 415: /* stream_col_options ::= */
- case 770: /* column_options ::= */ yytestcase(yyruleno==770);
-{ yymsp[1].minor.yy560 = createDefaultColumnOptions(pCxt); }
+ case 421: /* stream_col_options ::= */
+ case 781: /* column_options ::= */ yytestcase(yyruleno==781);
+{ yymsp[1].minor.yy974 = createDefaultColumnOptions(pCxt); }
break;
- case 416: /* stream_col_options ::= stream_col_options PRIMARY KEY */
- case 771: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==771);
-{ yylhsminor.yy560 = setColumnOptionsPK(pCxt, yymsp[-2].minor.yy560); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 422: /* stream_col_options ::= stream_col_options PRIMARY KEY */
+ case 782: /* column_options ::= column_options PRIMARY KEY */ yytestcase(yyruleno==782);
+{ yylhsminor.yy974 = setColumnOptionsPK(pCxt, yymsp[-2].minor.yy974); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 421: /* stream_options ::= stream_options TRIGGER AT_ONCE */
- case 422: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==422);
-{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 427: /* stream_options ::= stream_options TRIGGER AT_ONCE */
+ case 428: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ yytestcase(yyruleno==428);
+{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_TRIGGER_TYPE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 423: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
-{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 429: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */
+{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_TRIGGER_TYPE_SET, &yymsp[-1].minor.yy0, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 424: /* stream_options ::= stream_options WATERMARK duration_literal */
-{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 430: /* stream_options ::= stream_options WATERMARK duration_literal */
+{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_WATERMARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 425: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
-{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 431: /* stream_options ::= stream_options IGNORE EXPIRED NK_INTEGER */
+{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_IGNORE_EXPIRED_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 426: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
-{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 432: /* stream_options ::= stream_options FILL_HISTORY NK_INTEGER */
+{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_FILL_HISTORY_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 427: /* stream_options ::= stream_options DELETE_MARK duration_literal */
-{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-2].minor.yy560, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 433: /* stream_options ::= stream_options DELETE_MARK duration_literal */
+{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-2].minor.yy974, SOPT_DELETE_MARK_SET, NULL, releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 428: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
-{ yylhsminor.yy560 = setStreamOptions(pCxt, yymsp[-3].minor.yy560, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 434: /* stream_options ::= stream_options IGNORE UPDATE NK_INTEGER */
+{ yylhsminor.yy974 = setStreamOptions(pCxt, yymsp[-3].minor.yy974, SOPT_IGNORE_UPDATE_SET, &yymsp[0].minor.yy0, NULL); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 430: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
- case 714: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==714);
- case 738: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==738);
-{ yymsp[-3].minor.yy560 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy560); }
+ case 436: /* subtable_opt ::= SUBTABLE NK_LP expression NK_RP */
+ case 725: /* sliding_opt ::= SLIDING NK_LP interval_sliding_duration_literal NK_RP */ yytestcase(yyruleno==725);
+ case 749: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==749);
+{ yymsp[-3].minor.yy974 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy974); }
break;
- case 433: /* cmd ::= KILL CONNECTION NK_INTEGER */
+ case 439: /* cmd ::= KILL CONNECTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 434: /* cmd ::= KILL QUERY NK_STRING */
+ case 440: /* cmd ::= KILL QUERY NK_STRING */
{ pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 435: /* cmd ::= KILL TRANSACTION NK_INTEGER */
+ case 441: /* cmd ::= KILL TRANSACTION NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); }
break;
- case 436: /* cmd ::= KILL COMPACT NK_INTEGER */
+ case 442: /* cmd ::= KILL COMPACT NK_INTEGER */
{ pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_COMPACT_STMT, &yymsp[0].minor.yy0); }
break;
- case 437: /* cmd ::= BALANCE VGROUP */
+ case 443: /* cmd ::= BALANCE VGROUP */
{ pCxt->pRootNode = createBalanceVgroupStmt(pCxt); }
break;
- case 438: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
-{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy533); }
+ case 444: /* cmd ::= BALANCE VGROUP LEADER on_vgroup_id */
+{ pCxt->pRootNode = createBalanceVgroupLeaderStmt(pCxt, &yymsp[0].minor.yy557); }
break;
- case 439: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */
-{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy533); }
+ case 445: /* cmd ::= BALANCE VGROUP LEADER DATABASE db_name */
+{ pCxt->pRootNode = createBalanceVgroupLeaderDBNameStmt(pCxt, &yymsp[0].minor.yy557); }
break;
- case 440: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
+ case 446: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */
{ pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 441: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
-{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy334); }
+ case 447: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */
+{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy946); }
break;
- case 442: /* cmd ::= SPLIT VGROUP NK_INTEGER */
+ case 448: /* cmd ::= SPLIT VGROUP NK_INTEGER */
{ pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); }
break;
- case 445: /* dnode_list ::= DNODE NK_INTEGER */
-{ yymsp[-1].minor.yy334 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
+ case 451: /* dnode_list ::= DNODE NK_INTEGER */
+{ yymsp[-1].minor.yy946 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); }
break;
- case 447: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
-{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
+ case 453: /* cmd ::= DELETE FROM full_table_name where_clause_opt */
+{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); }
break;
- case 450: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
-{ yymsp[-6].minor.yy560 = createInsertStmt(pCxt, yymsp[-4].minor.yy560, yymsp[-2].minor.yy334, yymsp[0].minor.yy560); }
+ case 456: /* insert_query ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_or_subquery */
+{ yymsp[-6].minor.yy974 = createInsertStmt(pCxt, yymsp[-4].minor.yy974, yymsp[-2].minor.yy946, yymsp[0].minor.yy974); }
break;
- case 451: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
-{ yymsp[-3].minor.yy560 = createInsertStmt(pCxt, yymsp[-1].minor.yy560, NULL, yymsp[0].minor.yy560); }
+ case 457: /* insert_query ::= INSERT INTO full_table_name query_or_subquery */
+{ yymsp[-3].minor.yy974 = createInsertStmt(pCxt, yymsp[-1].minor.yy974, NULL, yymsp[0].minor.yy974); }
break;
- case 452: /* tags_literal ::= NK_INTEGER */
- case 464: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==464);
- case 473: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==473);
-{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 458: /* tags_literal ::= NK_INTEGER */
+ case 470: /* tags_literal ::= NK_BIN */ yytestcase(yyruleno==470);
+ case 479: /* tags_literal ::= NK_HEX */ yytestcase(yyruleno==479);
+{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 453: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */
- case 454: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==454);
- case 465: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==465);
- case 466: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==466);
- case 474: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==474);
- case 475: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==475);
- case 483: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==483);
- case 484: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==484);
+ case 459: /* tags_literal ::= NK_INTEGER NK_PLUS duration_literal */
+ case 460: /* tags_literal ::= NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==460);
+ case 471: /* tags_literal ::= NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==471);
+ case 472: /* tags_literal ::= NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==472);
+ case 480: /* tags_literal ::= NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==480);
+ case 481: /* tags_literal ::= NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==481);
+ case 489: /* tags_literal ::= NK_STRING NK_PLUS duration_literal */ yytestcase(yyruleno==489);
+ case 490: /* tags_literal ::= NK_STRING NK_MINUS duration_literal */ yytestcase(yyruleno==490);
{
SToken l = yymsp[-2].minor.yy0;
- SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
l.n = (r.z + r.n) - l.z;
- yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy560);
+ yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy974);
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 455: /* tags_literal ::= NK_PLUS NK_INTEGER */
- case 458: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==458);
- case 467: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==467);
- case 470: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==470);
- case 476: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==476);
- case 479: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==479);
+ case 461: /* tags_literal ::= NK_PLUS NK_INTEGER */
+ case 464: /* tags_literal ::= NK_MINUS NK_INTEGER */ yytestcase(yyruleno==464);
+ case 473: /* tags_literal ::= NK_PLUS NK_BIN */ yytestcase(yyruleno==473);
+ case 476: /* tags_literal ::= NK_MINUS NK_BIN */ yytestcase(yyruleno==476);
+ case 482: /* tags_literal ::= NK_PLUS NK_HEX */ yytestcase(yyruleno==482);
+ case 485: /* tags_literal ::= NK_MINUS NK_HEX */ yytestcase(yyruleno==485);
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
+ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &t, NULL);
}
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 456: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */
- case 457: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==457);
- case 459: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==459);
- case 460: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==460);
- case 468: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==468);
- case 469: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==469);
- case 471: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==471);
- case 472: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==472);
- case 477: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==477);
- case 478: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==478);
- case 480: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==480);
- case 481: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==481);
+ case 462: /* tags_literal ::= NK_PLUS NK_INTEGER NK_PLUS duration_literal */
+ case 463: /* tags_literal ::= NK_PLUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==463);
+ case 465: /* tags_literal ::= NK_MINUS NK_INTEGER NK_PLUS duration_literal */ yytestcase(yyruleno==465);
+ case 466: /* tags_literal ::= NK_MINUS NK_INTEGER NK_MINUS duration_literal */ yytestcase(yyruleno==466);
+ case 474: /* tags_literal ::= NK_PLUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==474);
+ case 475: /* tags_literal ::= NK_PLUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==475);
+ case 477: /* tags_literal ::= NK_MINUS NK_BIN NK_PLUS duration_literal */ yytestcase(yyruleno==477);
+ case 478: /* tags_literal ::= NK_MINUS NK_BIN NK_MINUS duration_literal */ yytestcase(yyruleno==478);
+ case 483: /* tags_literal ::= NK_PLUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==483);
+ case 484: /* tags_literal ::= NK_PLUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==484);
+ case 486: /* tags_literal ::= NK_MINUS NK_HEX NK_PLUS duration_literal */ yytestcase(yyruleno==486);
+ case 487: /* tags_literal ::= NK_MINUS NK_HEX NK_MINUS duration_literal */ yytestcase(yyruleno==487);
{
SToken l = yymsp[-3].minor.yy0;
- SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
l.n = (r.z + r.n) - l.z;
- yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy560);
+ yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, NULL, yymsp[0].minor.yy974);
}
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 461: /* tags_literal ::= NK_FLOAT */
-{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 467: /* tags_literal ::= NK_FLOAT */
+{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 462: /* tags_literal ::= NK_PLUS NK_FLOAT */
- case 463: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==463);
+ case 468: /* tags_literal ::= NK_PLUS NK_FLOAT */
+ case 469: /* tags_literal ::= NK_MINUS NK_FLOAT */ yytestcase(yyruleno==469);
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL);
+ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t, NULL);
}
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 482: /* tags_literal ::= NK_STRING */
-{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 488: /* tags_literal ::= NK_STRING */
+{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 485: /* tags_literal ::= NK_BOOL */
-{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 491: /* tags_literal ::= NK_BOOL */
+{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 486: /* tags_literal ::= NULL */
-{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 492: /* tags_literal ::= NULL */
+{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0, NULL); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 487: /* tags_literal ::= literal_func */
-{ yylhsminor.yy560 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy560); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 493: /* tags_literal ::= literal_func */
+{ yylhsminor.yy974 = createRawValueNode(pCxt, TSDB_DATA_TYPE_BINARY, NULL, yymsp[0].minor.yy974); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 488: /* tags_literal ::= literal_func NK_PLUS duration_literal */
- case 489: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==489);
+ case 494: /* tags_literal ::= literal_func NK_PLUS duration_literal */
+ case 495: /* tags_literal ::= literal_func NK_MINUS duration_literal */ yytestcase(yyruleno==495);
{
- SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
+ SToken l = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken r = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
l.n = (r.z + r.n) - l.z;
- yylhsminor.yy560 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy560, yymsp[0].minor.yy560);
+ yylhsminor.yy974 = createRawValueNodeExt(pCxt, TSDB_DATA_TYPE_BINARY, &l, yymsp[-2].minor.yy974, yymsp[0].minor.yy974);
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 492: /* literal ::= NK_INTEGER */
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 498: /* literal ::= NK_INTEGER */
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 493: /* literal ::= NK_FLOAT */
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 499: /* literal ::= NK_FLOAT */
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 494: /* literal ::= NK_STRING */
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 500: /* literal ::= NK_STRING */
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 495: /* literal ::= NK_BOOL */
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 501: /* literal ::= NK_BOOL */
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 496: /* literal ::= TIMESTAMP NK_STRING */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 502: /* literal ::= TIMESTAMP NK_STRING */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 497: /* literal ::= duration_literal */
- case 507: /* signed_literal ::= signed */ yytestcase(yyruleno==507);
- case 531: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==531);
- case 532: /* expression ::= literal */ yytestcase(yyruleno==532);
- case 534: /* expression ::= column_reference */ yytestcase(yyruleno==534);
- case 535: /* expression ::= function_expression */ yytestcase(yyruleno==535);
- case 536: /* expression ::= case_when_expression */ yytestcase(yyruleno==536);
- case 579: /* function_expression ::= literal_func */ yytestcase(yyruleno==579);
- case 580: /* function_expression ::= rand_func */ yytestcase(yyruleno==580);
- case 638: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==638);
- case 642: /* boolean_primary ::= predicate */ yytestcase(yyruleno==642);
- case 644: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==644);
- case 645: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==645);
- case 648: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==648);
- case 650: /* table_reference ::= table_primary */ yytestcase(yyruleno==650);
- case 651: /* table_reference ::= joined_table */ yytestcase(yyruleno==651);
- case 655: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==655);
- case 740: /* query_simple ::= query_specification */ yytestcase(yyruleno==740);
- case 741: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==741);
- case 744: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==744);
- case 746: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==746);
-{ yylhsminor.yy560 = yymsp[0].minor.yy560; }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 503: /* literal ::= duration_literal */
+ case 513: /* signed_literal ::= signed */ yytestcase(yyruleno==513);
+ case 537: /* expr_or_subquery ::= expression */ yytestcase(yyruleno==537);
+ case 538: /* expression ::= literal */ yytestcase(yyruleno==538);
+ case 540: /* expression ::= column_reference */ yytestcase(yyruleno==540);
+ case 541: /* expression ::= function_expression */ yytestcase(yyruleno==541);
+ case 542: /* expression ::= case_when_expression */ yytestcase(yyruleno==542);
+ case 588: /* function_expression ::= literal_func */ yytestcase(yyruleno==588);
+ case 589: /* function_expression ::= rand_func */ yytestcase(yyruleno==589);
+ case 647: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==647);
+ case 651: /* boolean_primary ::= predicate */ yytestcase(yyruleno==651);
+ case 653: /* common_expression ::= expr_or_subquery */ yytestcase(yyruleno==653);
+ case 654: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==654);
+ case 657: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==657);
+ case 659: /* table_reference ::= table_primary */ yytestcase(yyruleno==659);
+ case 660: /* table_reference ::= joined_table */ yytestcase(yyruleno==660);
+ case 664: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==664);
+ case 751: /* query_simple ::= query_specification */ yytestcase(yyruleno==751);
+ case 752: /* query_simple ::= union_query_expression */ yytestcase(yyruleno==752);
+ case 755: /* query_simple_or_subquery ::= query_simple */ yytestcase(yyruleno==755);
+ case 757: /* query_or_subquery ::= query_expression */ yytestcase(yyruleno==757);
+{ yylhsminor.yy974 = yymsp[0].minor.yy974; }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 498: /* literal ::= NULL */
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 504: /* literal ::= NULL */
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 499: /* literal ::= NK_QUESTION */
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 505: /* literal ::= NK_QUESTION */
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 500: /* duration_literal ::= NK_VARIABLE */
- case 715: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==715);
- case 716: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==716);
- case 717: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==717);
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 506: /* duration_literal ::= NK_VARIABLE */
+ case 726: /* interval_sliding_duration_literal ::= NK_VARIABLE */ yytestcase(yyruleno==726);
+ case 727: /* interval_sliding_duration_literal ::= NK_STRING */ yytestcase(yyruleno==727);
+ case 728: /* interval_sliding_duration_literal ::= NK_INTEGER */ yytestcase(yyruleno==728);
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 501: /* signed ::= NK_INTEGER */
-{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 507: /* signed ::= NK_INTEGER */
+{ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 502: /* signed ::= NK_PLUS NK_INTEGER */
-{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
+ case 508: /* signed ::= NK_PLUS NK_INTEGER */
+{ yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); }
break;
- case 503: /* signed ::= NK_MINUS NK_INTEGER */
+ case 509: /* signed ::= NK_MINUS NK_INTEGER */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
+ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t);
}
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 504: /* signed ::= NK_FLOAT */
-{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 510: /* signed ::= NK_FLOAT */
+{ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 505: /* signed ::= NK_PLUS NK_FLOAT */
-{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
+ case 511: /* signed ::= NK_PLUS NK_FLOAT */
+{ yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); }
break;
- case 506: /* signed ::= NK_MINUS NK_FLOAT */
+ case 512: /* signed ::= NK_MINUS NK_FLOAT */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
+ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t);
}
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 508: /* signed_literal ::= NK_STRING */
-{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 514: /* signed_literal ::= NK_STRING */
+{ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 509: /* signed_literal ::= NK_BOOL */
-{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 515: /* signed_literal ::= NK_BOOL */
+{ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 510: /* signed_literal ::= TIMESTAMP NK_STRING */
-{ yymsp[-1].minor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
+ case 516: /* signed_literal ::= TIMESTAMP NK_STRING */
+{ yymsp[-1].minor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); }
break;
- case 511: /* signed_literal ::= duration_literal */
- case 513: /* signed_literal ::= literal_func */ yytestcase(yyruleno==513);
- case 609: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==609);
- case 692: /* select_item ::= common_expression */ yytestcase(yyruleno==692);
- case 702: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==702);
- case 745: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==745);
- case 747: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==747);
- case 760: /* search_condition ::= common_expression */ yytestcase(yyruleno==760);
-{ yylhsminor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 517: /* signed_literal ::= duration_literal */
+ case 519: /* signed_literal ::= literal_func */ yytestcase(yyruleno==519);
+ case 618: /* star_func_para ::= expr_or_subquery */ yytestcase(yyruleno==618);
+ case 701: /* select_item ::= common_expression */ yytestcase(yyruleno==701);
+ case 711: /* partition_item ::= expr_or_subquery */ yytestcase(yyruleno==711);
+ case 756: /* query_simple_or_subquery ::= subquery */ yytestcase(yyruleno==756);
+ case 758: /* query_or_subquery ::= subquery */ yytestcase(yyruleno==758);
+ case 771: /* search_condition ::= common_expression */ yytestcase(yyruleno==771);
+{ yylhsminor.yy974 = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 512: /* signed_literal ::= NULL */
-{ yylhsminor.yy560 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 518: /* signed_literal ::= NULL */
+{ yylhsminor.yy974 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 514: /* signed_literal ::= NK_QUESTION */
-{ yylhsminor.yy560 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 520: /* signed_literal ::= NK_QUESTION */
+{ yylhsminor.yy974 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 533: /* expression ::= pseudo_column */
-{ yylhsminor.yy560 = yymsp[0].minor.yy560; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy560, true); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 539: /* expression ::= pseudo_column */
+{ yylhsminor.yy974 = yymsp[0].minor.yy974; (void)setRawExprNodeIsPseudoColumn(pCxt, yylhsminor.yy974, true); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 537: /* expression ::= NK_LP expression NK_RP */
- case 643: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==643);
- case 759: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==759);
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 543: /* expression ::= NK_LP expression NK_RP */
+ case 652: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==652);
+ case 770: /* subquery ::= NK_LP subquery NK_RP */ yytestcase(yyruleno==770);
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 538: /* expression ::= NK_PLUS expr_or_subquery */
+ case 544: /* expression ::= NK_PLUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy560));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy974));
}
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 539: /* expression ::= NK_MINUS expr_or_subquery */
+ case 545: /* expression ::= NK_MINUS expr_or_subquery */
{
- SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL));
+ SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy974), NULL));
}
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 540: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
+ case 546: /* expression ::= expr_or_subquery NK_PLUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 541: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
+ case 547: /* expression ::= expr_or_subquery NK_MINUS expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 542: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
+ case 548: /* expression ::= expr_or_subquery NK_STAR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 543: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
+ case 549: /* expression ::= expr_or_subquery NK_SLASH expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 544: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
+ case 550: /* expression ::= expr_or_subquery NK_REM expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 545: /* expression ::= column_reference NK_ARROW NK_STRING */
+ case 551: /* expression ::= column_reference NK_ARROW NK_STRING */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 546: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
+ case 552: /* expression ::= expr_or_subquery NK_BITAND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 547: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
+ case 553: /* expression ::= expr_or_subquery NK_BITOR expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 550: /* column_reference ::= column_name */
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy533, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy533)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 556: /* column_reference ::= column_name */
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy557, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy557)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 551: /* column_reference ::= table_name NK_DOT column_name */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533, createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy533)); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 557: /* column_reference ::= table_name NK_DOT column_name */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557, createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy557)); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 552: /* column_reference ::= NK_ALIAS */
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 558: /* column_reference ::= NK_ALIAS */
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 553: /* column_reference ::= table_name NK_DOT NK_ALIAS */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0)); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 559: /* column_reference ::= table_name NK_DOT NK_ALIAS */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0)); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 554: /* pseudo_column ::= ROWTS */
- case 555: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==555);
- case 557: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==557);
- case 558: /* pseudo_column ::= QEND */ yytestcase(yyruleno==558);
- case 559: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==559);
- case 560: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==560);
- case 561: /* pseudo_column ::= WEND */ yytestcase(yyruleno==561);
- case 562: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==562);
- case 563: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==563);
- case 564: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==564);
- case 565: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==565);
- case 582: /* literal_func ::= NOW */ yytestcase(yyruleno==582);
- case 583: /* literal_func ::= TODAY */ yytestcase(yyruleno==583);
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 560: /* pseudo_column ::= ROWTS */
+ case 561: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==561);
+ case 563: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==563);
+ case 564: /* pseudo_column ::= QEND */ yytestcase(yyruleno==564);
+ case 565: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==565);
+ case 566: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==566);
+ case 567: /* pseudo_column ::= WEND */ yytestcase(yyruleno==567);
+ case 568: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==568);
+ case 569: /* pseudo_column ::= IROWTS */ yytestcase(yyruleno==569);
+ case 570: /* pseudo_column ::= ISFILLED */ yytestcase(yyruleno==570);
+ case 571: /* pseudo_column ::= QTAGS */ yytestcase(yyruleno==571);
+ case 572: /* pseudo_column ::= FLOW */ yytestcase(yyruleno==572);
+ case 573: /* pseudo_column ::= FHIGH */ yytestcase(yyruleno==573);
+ case 574: /* pseudo_column ::= FROWTS */ yytestcase(yyruleno==574);
+ case 591: /* literal_func ::= NOW */ yytestcase(yyruleno==591);
+ case 592: /* literal_func ::= TODAY */ yytestcase(yyruleno==592);
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 556: /* pseudo_column ::= table_name NK_DOT TBNAME */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy533)))); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 562: /* pseudo_column ::= table_name NK_DOT TBNAME */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy557)))); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 566: /* function_expression ::= function_name NK_LP expression_list NK_RP */
- case 567: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==567);
- case 575: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==575);
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy533, yymsp[-1].minor.yy334)); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 575: /* function_expression ::= function_name NK_LP expression_list NK_RP */
+ case 576: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==576);
+ case 584: /* function_expression ::= substr_func NK_LP expression_list NK_RP */ yytestcase(yyruleno==584);
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy557, yymsp[-1].minor.yy946)); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 568: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
- case 569: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==569);
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy952)); }
- yymsp[-5].minor.yy560 = yylhsminor.yy560;
+ case 577: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name NK_RP */
+ case 578: /* function_expression ::= CAST NK_LP expr_or_subquery AS type_name_default_len NK_RP */ yytestcase(yyruleno==578);
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy424)); }
+ yymsp[-5].minor.yy974 = yylhsminor.yy974;
break;
- case 570: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); }
- yymsp[-5].minor.yy560 = yylhsminor.yy560;
+ case 579: /* function_expression ::= POSITION NK_LP expr_or_subquery IN expr_or_subquery NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createPositionFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); }
+ yymsp[-5].minor.yy974 = yylhsminor.yy974;
break;
- case 571: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), TRIM_TYPE_BOTH)); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 580: /* function_expression ::= TRIM NK_LP expr_or_subquery NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), TRIM_TYPE_BOTH)); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 572: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), yymsp[-3].minor.yy672)); }
- yymsp[-5].minor.yy560 = yylhsminor.yy560;
+ case 581: /* function_expression ::= TRIM NK_LP trim_specification_type FROM expr_or_subquery NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), yymsp[-3].minor.yy300)); }
+ yymsp[-5].minor.yy974 = yylhsminor.yy974;
break;
- case 573: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), TRIM_TYPE_BOTH)); }
- yymsp[-5].minor.yy560 = yylhsminor.yy560;
+ case 582: /* function_expression ::= TRIM NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), TRIM_TYPE_BOTH)); }
+ yymsp[-5].minor.yy974 = yylhsminor.yy974;
break;
- case 574: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), yymsp[-4].minor.yy672)); }
- yymsp[-6].minor.yy560 = yylhsminor.yy560;
+ case 583: /* function_expression ::= TRIM NK_LP trim_specification_type expr_or_subquery FROM expr_or_subquery NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-6].minor.yy0, &yymsp[0].minor.yy0, createTrimFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), yymsp[-4].minor.yy300)); }
+ yymsp[-6].minor.yy974 = yylhsminor.yy974;
break;
- case 576: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy533, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); }
- yymsp[-5].minor.yy560 = yylhsminor.yy560;
+ case 585: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy557, &yymsp[0].minor.yy0, createSubstrFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); }
+ yymsp[-5].minor.yy974 = yylhsminor.yy974;
break;
- case 577: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy533, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560))); }
- yymsp[-7].minor.yy560 = yylhsminor.yy560;
+ case 586: /* function_expression ::= substr_func NK_LP expr_or_subquery FROM expr_or_subquery FOR expr_or_subquery NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-7].minor.yy557, &yymsp[0].minor.yy0, createSubstrFunctionNodeExt(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974))); }
+ yymsp[-7].minor.yy974 = yylhsminor.yy974;
break;
- case 578: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */
- case 585: /* rand_func ::= RAND NK_LP expression_list NK_RP */ yytestcase(yyruleno==585);
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy334)); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 587: /* function_expression ::= REPLACE NK_LP expression_list NK_RP */
+ case 594: /* rand_func ::= RAND NK_LP expression_list NK_RP */ yytestcase(yyruleno==594);
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy946)); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 581: /* literal_func ::= noarg_func NK_LP NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy533, NULL)); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 590: /* literal_func ::= noarg_func NK_LP NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy557, NULL)); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 584: /* rand_func ::= RAND NK_LP NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy0, NULL)); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 593: /* rand_func ::= RAND NK_LP NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy0, NULL)); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 588: /* trim_specification_type ::= BOTH */
-{ yymsp[0].minor.yy672 = TRIM_TYPE_BOTH; }
+ case 597: /* trim_specification_type ::= BOTH */
+{ yymsp[0].minor.yy300 = TRIM_TYPE_BOTH; }
break;
- case 589: /* trim_specification_type ::= TRAILING */
-{ yymsp[0].minor.yy672 = TRIM_TYPE_TRAILING; }
+ case 598: /* trim_specification_type ::= TRAILING */
+{ yymsp[0].minor.yy300 = TRIM_TYPE_TRAILING; }
break;
- case 590: /* trim_specification_type ::= LEADING */
-{ yymsp[0].minor.yy672 = TRIM_TYPE_LEADING; }
+ case 599: /* trim_specification_type ::= LEADING */
+{ yymsp[0].minor.yy300 = TRIM_TYPE_LEADING; }
break;
- case 605: /* star_func_para_list ::= NK_STAR */
-{ yylhsminor.yy334 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy334 = yylhsminor.yy334;
+ case 614: /* star_func_para_list ::= NK_STAR */
+{ yylhsminor.yy946 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy946 = yylhsminor.yy946;
break;
- case 610: /* star_func_para ::= table_name NK_DOT NK_STAR */
- case 695: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==695);
-{ yylhsminor.yy560 = createColumnNode(pCxt, &yymsp[-2].minor.yy533, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 619: /* star_func_para ::= table_name NK_DOT NK_STAR */
+ case 704: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==704);
+{ yylhsminor.yy974 = createColumnNode(pCxt, &yymsp[-2].minor.yy557, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 611: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 620: /* case_when_expression ::= CASE when_then_list case_when_else_opt END */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, NULL, yymsp[-2].minor.yy946, yymsp[-1].minor.yy974)); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 612: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-2].minor.yy334, yymsp[-1].minor.yy560)); }
- yymsp[-4].minor.yy560 = yylhsminor.yy560;
+ case 621: /* case_when_expression ::= CASE common_expression when_then_list case_when_else_opt END */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0, createCaseWhenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-2].minor.yy946, yymsp[-1].minor.yy974)); }
+ yymsp[-4].minor.yy974 = yylhsminor.yy974;
break;
- case 615: /* when_then_expr ::= WHEN common_expression THEN common_expression */
-{ yymsp[-3].minor.yy560 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)); }
+ case 624: /* when_then_expr ::= WHEN common_expression THEN common_expression */
+{ yymsp[-3].minor.yy974 = createWhenThenNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)); }
break;
- case 617: /* case_when_else_opt ::= ELSE common_expression */
-{ yymsp[-1].minor.yy560 = releaseRawExprNode(pCxt, yymsp[0].minor.yy560); }
+ case 626: /* case_when_else_opt ::= ELSE common_expression */
+{ yymsp[-1].minor.yy974 = releaseRawExprNode(pCxt, yymsp[0].minor.yy974); }
break;
- case 618: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
- case 623: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==623);
+ case 627: /* predicate ::= expr_or_subquery compare_op expr_or_subquery */
+ case 632: /* predicate ::= expr_or_subquery in_op in_predicate_value */ yytestcase(yyruleno==632);
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy506, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy140, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 619: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 628: /* predicate ::= expr_or_subquery BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy974), releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-4].minor.yy560 = yylhsminor.yy560;
+ yymsp[-4].minor.yy974 = yylhsminor.yy974;
break;
- case 620: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
+ case 629: /* predicate ::= expr_or_subquery NOT BETWEEN expr_or_subquery AND expr_or_subquery */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-5].minor.yy560 = yylhsminor.yy560;
+ yymsp[-5].minor.yy974 = yylhsminor.yy974;
break;
- case 621: /* predicate ::= expr_or_subquery IS NULL */
+ case 630: /* predicate ::= expr_or_subquery IS NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), NULL));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 622: /* predicate ::= expr_or_subquery IS NOT NULL */
+ case 631: /* predicate ::= expr_or_subquery IS NOT NULL */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL));
}
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 624: /* compare_op ::= NK_LT */
-{ yymsp[0].minor.yy506 = OP_TYPE_LOWER_THAN; }
+ case 633: /* compare_op ::= NK_LT */
+{ yymsp[0].minor.yy140 = OP_TYPE_LOWER_THAN; }
break;
- case 625: /* compare_op ::= NK_GT */
-{ yymsp[0].minor.yy506 = OP_TYPE_GREATER_THAN; }
+ case 634: /* compare_op ::= NK_GT */
+{ yymsp[0].minor.yy140 = OP_TYPE_GREATER_THAN; }
break;
- case 626: /* compare_op ::= NK_LE */
-{ yymsp[0].minor.yy506 = OP_TYPE_LOWER_EQUAL; }
+ case 635: /* compare_op ::= NK_LE */
+{ yymsp[0].minor.yy140 = OP_TYPE_LOWER_EQUAL; }
break;
- case 627: /* compare_op ::= NK_GE */
-{ yymsp[0].minor.yy506 = OP_TYPE_GREATER_EQUAL; }
+ case 636: /* compare_op ::= NK_GE */
+{ yymsp[0].minor.yy140 = OP_TYPE_GREATER_EQUAL; }
break;
- case 628: /* compare_op ::= NK_NE */
-{ yymsp[0].minor.yy506 = OP_TYPE_NOT_EQUAL; }
+ case 637: /* compare_op ::= NK_NE */
+{ yymsp[0].minor.yy140 = OP_TYPE_NOT_EQUAL; }
break;
- case 629: /* compare_op ::= NK_EQ */
-{ yymsp[0].minor.yy506 = OP_TYPE_EQUAL; }
+ case 638: /* compare_op ::= NK_EQ */
+{ yymsp[0].minor.yy140 = OP_TYPE_EQUAL; }
break;
- case 630: /* compare_op ::= LIKE */
-{ yymsp[0].minor.yy506 = OP_TYPE_LIKE; }
+ case 639: /* compare_op ::= LIKE */
+{ yymsp[0].minor.yy140 = OP_TYPE_LIKE; }
break;
- case 631: /* compare_op ::= NOT LIKE */
-{ yymsp[-1].minor.yy506 = OP_TYPE_NOT_LIKE; }
+ case 640: /* compare_op ::= NOT LIKE */
+{ yymsp[-1].minor.yy140 = OP_TYPE_NOT_LIKE; }
break;
- case 632: /* compare_op ::= MATCH */
-{ yymsp[0].minor.yy506 = OP_TYPE_MATCH; }
+ case 641: /* compare_op ::= MATCH */
+{ yymsp[0].minor.yy140 = OP_TYPE_MATCH; }
break;
- case 633: /* compare_op ::= NMATCH */
-{ yymsp[0].minor.yy506 = OP_TYPE_NMATCH; }
+ case 642: /* compare_op ::= NMATCH */
+{ yymsp[0].minor.yy140 = OP_TYPE_NMATCH; }
break;
- case 634: /* compare_op ::= CONTAINS */
-{ yymsp[0].minor.yy506 = OP_TYPE_JSON_CONTAINS; }
+ case 643: /* compare_op ::= CONTAINS */
+{ yymsp[0].minor.yy140 = OP_TYPE_JSON_CONTAINS; }
break;
- case 635: /* in_op ::= IN */
-{ yymsp[0].minor.yy506 = OP_TYPE_IN; }
+ case 644: /* in_op ::= IN */
+{ yymsp[0].minor.yy140 = OP_TYPE_IN; }
break;
- case 636: /* in_op ::= NOT IN */
-{ yymsp[-1].minor.yy506 = OP_TYPE_NOT_IN; }
+ case 645: /* in_op ::= NOT IN */
+{ yymsp[-1].minor.yy140 = OP_TYPE_NOT_IN; }
break;
- case 637: /* in_predicate_value ::= NK_LP literal_list NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 646: /* in_predicate_value ::= NK_LP literal_list NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 639: /* boolean_value_expression ::= NOT boolean_primary */
+ case 648: /* boolean_value_expression ::= NOT boolean_primary */
{
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy560), NULL));
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy974), NULL));
}
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 640: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
+ case 649: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 641: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
+ case 650: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */
{
- SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy560);
- SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy560);
- yylhsminor.yy560 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), releaseRawExprNode(pCxt, yymsp[0].minor.yy560)));
+ SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy974);
+ SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy974);
+ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), releaseRawExprNode(pCxt, yymsp[0].minor.yy974)));
}
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 649: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
-{ yylhsminor.yy560 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy560, yymsp[0].minor.yy560, NULL); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 658: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */
+{ yylhsminor.yy974 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, JOIN_STYPE_NONE, yymsp[-2].minor.yy974, yymsp[0].minor.yy974, NULL); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 652: /* table_primary ::= table_name alias_opt */
-{ yylhsminor.yy560 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 661: /* table_primary ::= table_name alias_opt */
+{ yylhsminor.yy974 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 653: /* table_primary ::= db_name NK_DOT table_name alias_opt */
-{ yylhsminor.yy560 = createRealTableNode(pCxt, &yymsp[-3].minor.yy533, &yymsp[-1].minor.yy533, &yymsp[0].minor.yy533); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 662: /* table_primary ::= db_name NK_DOT table_name alias_opt */
+{ yylhsminor.yy974 = createRealTableNode(pCxt, &yymsp[-3].minor.yy557, &yymsp[-1].minor.yy557, &yymsp[0].minor.yy557); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 654: /* table_primary ::= subquery alias_opt */
-{ yylhsminor.yy560 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy533); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 663: /* table_primary ::= subquery alias_opt */
+{ yylhsminor.yy974 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), &yymsp[0].minor.yy557); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 656: /* alias_opt ::= */
-{ yymsp[1].minor.yy533 = nil_token; }
+ case 665: /* alias_opt ::= */
+{ yymsp[1].minor.yy557 = nil_token; }
break;
- case 658: /* alias_opt ::= AS table_alias */
-{ yymsp[-1].minor.yy533 = yymsp[0].minor.yy533; }
+ case 667: /* alias_opt ::= AS table_alias */
+{ yymsp[-1].minor.yy557 = yymsp[0].minor.yy557; }
break;
- case 659: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
- case 660: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==660);
-{ yymsp[-2].minor.yy560 = yymsp[-1].minor.yy560; }
+ case 668: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */
+ case 669: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==669);
+{ yymsp[-2].minor.yy974 = yymsp[-1].minor.yy974; }
break;
- case 661: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
+ case 670: /* joined_table ::= table_reference join_type join_subtype JOIN table_reference join_on_clause_opt window_offset_clause_opt jlimit_clause_opt */
{
- yylhsminor.yy560 = createJoinTableNode(pCxt, yymsp[-6].minor.yy36, yymsp[-5].minor.yy648, yymsp[-7].minor.yy560, yymsp[-3].minor.yy560, yymsp[-2].minor.yy560);
- yylhsminor.yy560 = addWindowOffsetClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560);
- yylhsminor.yy560 = addJLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560);
+ yylhsminor.yy974 = createJoinTableNode(pCxt, yymsp[-6].minor.yy792, yymsp[-5].minor.yy744, yymsp[-7].minor.yy974, yymsp[-3].minor.yy974, yymsp[-2].minor.yy974);
+ yylhsminor.yy974 = addWindowOffsetClause(pCxt, yylhsminor.yy974, yymsp[-1].minor.yy974);
+ yylhsminor.yy974 = addJLimitClause(pCxt, yylhsminor.yy974, yymsp[0].minor.yy974);
}
- yymsp[-7].minor.yy560 = yylhsminor.yy560;
+ yymsp[-7].minor.yy974 = yylhsminor.yy974;
break;
- case 662: /* join_type ::= */
-{ yymsp[1].minor.yy36 = JOIN_TYPE_INNER; }
+ case 671: /* join_type ::= */
+{ yymsp[1].minor.yy792 = JOIN_TYPE_INNER; }
break;
- case 663: /* join_type ::= INNER */
-{ yymsp[0].minor.yy36 = JOIN_TYPE_INNER; }
+ case 672: /* join_type ::= INNER */
+{ yymsp[0].minor.yy792 = JOIN_TYPE_INNER; }
break;
- case 664: /* join_type ::= LEFT */
-{ yymsp[0].minor.yy36 = JOIN_TYPE_LEFT; }
+ case 673: /* join_type ::= LEFT */
+{ yymsp[0].minor.yy792 = JOIN_TYPE_LEFT; }
break;
- case 665: /* join_type ::= RIGHT */
-{ yymsp[0].minor.yy36 = JOIN_TYPE_RIGHT; }
+ case 674: /* join_type ::= RIGHT */
+{ yymsp[0].minor.yy792 = JOIN_TYPE_RIGHT; }
break;
- case 666: /* join_type ::= FULL */
-{ yymsp[0].minor.yy36 = JOIN_TYPE_FULL; }
+ case 675: /* join_type ::= FULL */
+{ yymsp[0].minor.yy792 = JOIN_TYPE_FULL; }
break;
- case 667: /* join_subtype ::= */
-{ yymsp[1].minor.yy648 = JOIN_STYPE_NONE; }
+ case 676: /* join_subtype ::= */
+{ yymsp[1].minor.yy744 = JOIN_STYPE_NONE; }
break;
- case 668: /* join_subtype ::= OUTER */
-{ yymsp[0].minor.yy648 = JOIN_STYPE_OUTER; }
+ case 677: /* join_subtype ::= OUTER */
+{ yymsp[0].minor.yy744 = JOIN_STYPE_OUTER; }
break;
- case 669: /* join_subtype ::= SEMI */
-{ yymsp[0].minor.yy648 = JOIN_STYPE_SEMI; }
+ case 678: /* join_subtype ::= SEMI */
+{ yymsp[0].minor.yy744 = JOIN_STYPE_SEMI; }
break;
- case 670: /* join_subtype ::= ANTI */
-{ yymsp[0].minor.yy648 = JOIN_STYPE_ANTI; }
+ case 679: /* join_subtype ::= ANTI */
+{ yymsp[0].minor.yy744 = JOIN_STYPE_ANTI; }
break;
- case 671: /* join_subtype ::= ASOF */
-{ yymsp[0].minor.yy648 = JOIN_STYPE_ASOF; }
+ case 680: /* join_subtype ::= ASOF */
+{ yymsp[0].minor.yy744 = JOIN_STYPE_ASOF; }
break;
- case 672: /* join_subtype ::= WINDOW */
-{ yymsp[0].minor.yy648 = JOIN_STYPE_WIN; }
+ case 681: /* join_subtype ::= WINDOW */
+{ yymsp[0].minor.yy744 = JOIN_STYPE_WIN; }
break;
- case 676: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
-{ yymsp[-5].minor.yy560 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
+ case 685: /* window_offset_clause_opt ::= WINDOW_OFFSET NK_LP window_offset_literal NK_COMMA window_offset_literal NK_RP */
+{ yymsp[-5].minor.yy974 = createWindowOffsetNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); }
break;
- case 677: /* window_offset_literal ::= NK_VARIABLE */
-{ yylhsminor.yy560 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 686: /* window_offset_literal ::= NK_VARIABLE */
+{ yylhsminor.yy974 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createTimeOffsetValueNode(pCxt, &yymsp[0].minor.yy0)); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 678: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */
+ case 687: /* window_offset_literal ::= NK_MINUS NK_VARIABLE */
{
SToken t = yymsp[-1].minor.yy0;
t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z;
- yylhsminor.yy560 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t));
+ yylhsminor.yy974 = createRawExprNode(pCxt, &t, createTimeOffsetValueNode(pCxt, &t));
}
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 680: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */
- case 751: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==751);
- case 755: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==755);
-{ yymsp[-1].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
+ case 689: /* jlimit_clause_opt ::= JLIMIT NK_INTEGER */
+ case 762: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ yytestcase(yyruleno==762);
+ case 766: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==766);
+{ yymsp[-1].minor.yy974 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); }
break;
- case 681: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
+ case 690: /* query_specification ::= SELECT hint_list set_quantifier_opt tag_mode_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */
{
- yymsp[-13].minor.yy560 = createSelectStmt(pCxt, yymsp[-11].minor.yy173, yymsp[-9].minor.yy334, yymsp[-8].minor.yy560, yymsp[-12].minor.yy334);
- yymsp[-13].minor.yy560 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy560, yymsp[-10].minor.yy173);
- yymsp[-13].minor.yy560 = addWhereClause(pCxt, yymsp[-13].minor.yy560, yymsp[-7].minor.yy560);
- yymsp[-13].minor.yy560 = addPartitionByClause(pCxt, yymsp[-13].minor.yy560, yymsp[-6].minor.yy334);
- yymsp[-13].minor.yy560 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy560, yymsp[-2].minor.yy560);
- yymsp[-13].minor.yy560 = addGroupByClause(pCxt, yymsp[-13].minor.yy560, yymsp[-1].minor.yy334);
- yymsp[-13].minor.yy560 = addHavingClause(pCxt, yymsp[-13].minor.yy560, yymsp[0].minor.yy560);
- yymsp[-13].minor.yy560 = addRangeClause(pCxt, yymsp[-13].minor.yy560, yymsp[-5].minor.yy560);
- yymsp[-13].minor.yy560 = addEveryClause(pCxt, yymsp[-13].minor.yy560, yymsp[-4].minor.yy560);
- yymsp[-13].minor.yy560 = addFillClause(pCxt, yymsp[-13].minor.yy560, yymsp[-3].minor.yy560);
+ yymsp[-13].minor.yy974 = createSelectStmt(pCxt, yymsp[-11].minor.yy569, yymsp[-9].minor.yy946, yymsp[-8].minor.yy974, yymsp[-12].minor.yy946);
+ yymsp[-13].minor.yy974 = setSelectStmtTagMode(pCxt, yymsp[-13].minor.yy974, yymsp[-10].minor.yy569);
+ yymsp[-13].minor.yy974 = addWhereClause(pCxt, yymsp[-13].minor.yy974, yymsp[-7].minor.yy974);
+ yymsp[-13].minor.yy974 = addPartitionByClause(pCxt, yymsp[-13].minor.yy974, yymsp[-6].minor.yy946);
+ yymsp[-13].minor.yy974 = addWindowClauseClause(pCxt, yymsp[-13].minor.yy974, yymsp[-2].minor.yy974);
+ yymsp[-13].minor.yy974 = addGroupByClause(pCxt, yymsp[-13].minor.yy974, yymsp[-1].minor.yy946);
+ yymsp[-13].minor.yy974 = addHavingClause(pCxt, yymsp[-13].minor.yy974, yymsp[0].minor.yy974);
+ yymsp[-13].minor.yy974 = addRangeClause(pCxt, yymsp[-13].minor.yy974, yymsp[-5].minor.yy974);
+ yymsp[-13].minor.yy974 = addEveryClause(pCxt, yymsp[-13].minor.yy974, yymsp[-4].minor.yy974);
+ yymsp[-13].minor.yy974 = addFillClause(pCxt, yymsp[-13].minor.yy974, yymsp[-3].minor.yy974);
}
break;
- case 682: /* hint_list ::= */
-{ yymsp[1].minor.yy334 = createHintNodeList(pCxt, NULL); }
+ case 691: /* hint_list ::= */
+{ yymsp[1].minor.yy946 = createHintNodeList(pCxt, NULL); }
break;
- case 683: /* hint_list ::= NK_HINT */
-{ yylhsminor.yy334 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy334 = yylhsminor.yy334;
+ case 692: /* hint_list ::= NK_HINT */
+{ yylhsminor.yy946 = createHintNodeList(pCxt, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy946 = yylhsminor.yy946;
break;
- case 688: /* set_quantifier_opt ::= ALL */
-{ yymsp[0].minor.yy173 = false; }
+ case 697: /* set_quantifier_opt ::= ALL */
+{ yymsp[0].minor.yy569 = false; }
break;
- case 691: /* select_item ::= NK_STAR */
-{ yylhsminor.yy560 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
- yymsp[0].minor.yy560 = yylhsminor.yy560;
+ case 700: /* select_item ::= NK_STAR */
+{ yylhsminor.yy974 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy974 = yylhsminor.yy974;
break;
- case 693: /* select_item ::= common_expression column_alias */
- case 703: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==703);
-{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560), &yymsp[0].minor.yy533); }
- yymsp[-1].minor.yy560 = yylhsminor.yy560;
+ case 702: /* select_item ::= common_expression column_alias */
+ case 712: /* partition_item ::= expr_or_subquery column_alias */ yytestcase(yyruleno==712);
+{ yylhsminor.yy974 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), &yymsp[0].minor.yy557); }
+ yymsp[-1].minor.yy974 = yylhsminor.yy974;
break;
- case 694: /* select_item ::= common_expression AS column_alias */
- case 704: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==704);
-{ yylhsminor.yy560 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), &yymsp[0].minor.yy533); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 703: /* select_item ::= common_expression AS column_alias */
+ case 713: /* partition_item ::= expr_or_subquery AS column_alias */ yytestcase(yyruleno==713);
+{ yylhsminor.yy974 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), &yymsp[0].minor.yy557); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 699: /* partition_by_clause_opt ::= PARTITION BY partition_list */
- case 729: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==729);
- case 749: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==749);
-{ yymsp[-2].minor.yy334 = yymsp[0].minor.yy334; }
+ case 708: /* partition_by_clause_opt ::= PARTITION BY partition_list */
+ case 740: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==740);
+ case 760: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==760);
+{ yymsp[-2].minor.yy946 = yymsp[0].minor.yy946; }
break;
- case 706: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
-{ yymsp[-5].minor.yy560 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
+ case 715: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA interval_sliding_duration_literal NK_RP */
+{ yymsp[-5].minor.yy974 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); }
break;
- case 707: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
-{ yymsp[-3].minor.yy560 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
+ case 716: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy974 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); }
break;
- case 708: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-5].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), NULL, yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
+ case 717: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-5].minor.yy974 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), NULL, yymsp[-1].minor.yy974, yymsp[0].minor.yy974); }
break;
- case 709: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
-{ yymsp[-7].minor.yy560 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy560), releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), yymsp[-1].minor.yy560, yymsp[0].minor.yy560); }
+ case 718: /* twindow_clause_opt ::= INTERVAL NK_LP interval_sliding_duration_literal NK_COMMA interval_sliding_duration_literal NK_RP sliding_opt fill_opt */
+{ yymsp[-7].minor.yy974 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy974), releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), yymsp[-1].minor.yy974, yymsp[0].minor.yy974); }
break;
- case 710: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
-{ yymsp[-6].minor.yy560 = createEventWindowNode(pCxt, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); }
+ case 719: /* twindow_clause_opt ::= EVENT_WINDOW START WITH search_condition END WITH search_condition */
+{ yymsp[-6].minor.yy974 = createEventWindowNode(pCxt, yymsp[-3].minor.yy974, yymsp[0].minor.yy974); }
break;
- case 711: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
-{ yymsp[-3].minor.yy560 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); }
+ case 720: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_RP */
+{ yymsp[-3].minor.yy974 = createCountWindowNode(pCxt, &yymsp[-1].minor.yy0, &yymsp[-1].minor.yy0); }
break;
- case 712: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
-{ yymsp[-5].minor.yy560 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); }
+ case 721: /* twindow_clause_opt ::= COUNT_WINDOW NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */
+{ yymsp[-5].minor.yy974 = createCountWindowNode(pCxt, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0); }
break;
- case 719: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
-{ yymsp[-3].minor.yy560 = createFillNode(pCxt, yymsp[-1].minor.yy18, NULL); }
+ case 722: /* twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy974 = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974), NULL); }
break;
- case 720: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
-{ yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); }
+ case 723: /* twindow_clause_opt ::= ANOMALY_WINDOW NK_LP expr_or_subquery NK_COMMA NK_STRING NK_RP */
+{ yymsp[-5].minor.yy974 = createAnomalyWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), &yymsp[-1].minor.yy0); }
break;
- case 721: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
-{ yymsp[-5].minor.yy560 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy334)); }
+ case 730: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */
+{ yymsp[-3].minor.yy974 = createFillNode(pCxt, yymsp[-1].minor.yy102, NULL); }
break;
- case 722: /* fill_mode ::= NONE */
-{ yymsp[0].minor.yy18 = FILL_MODE_NONE; }
+ case 731: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA expression_list NK_RP */
+{ yymsp[-5].minor.yy974 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); }
break;
- case 723: /* fill_mode ::= PREV */
-{ yymsp[0].minor.yy18 = FILL_MODE_PREV; }
+ case 732: /* fill_opt ::= FILL NK_LP VALUE_F NK_COMMA expression_list NK_RP */
+{ yymsp[-5].minor.yy974 = createFillNode(pCxt, FILL_MODE_VALUE_F, createNodeListNode(pCxt, yymsp[-1].minor.yy946)); }
break;
- case 724: /* fill_mode ::= NULL */
-{ yymsp[0].minor.yy18 = FILL_MODE_NULL; }
+ case 733: /* fill_mode ::= NONE */
+{ yymsp[0].minor.yy102 = FILL_MODE_NONE; }
break;
- case 725: /* fill_mode ::= NULL_F */
-{ yymsp[0].minor.yy18 = FILL_MODE_NULL_F; }
+ case 734: /* fill_mode ::= PREV */
+{ yymsp[0].minor.yy102 = FILL_MODE_PREV; }
break;
- case 726: /* fill_mode ::= LINEAR */
-{ yymsp[0].minor.yy18 = FILL_MODE_LINEAR; }
+ case 735: /* fill_mode ::= NULL */
+{ yymsp[0].minor.yy102 = FILL_MODE_NULL; }
break;
- case 727: /* fill_mode ::= NEXT */
-{ yymsp[0].minor.yy18 = FILL_MODE_NEXT; }
+ case 736: /* fill_mode ::= NULL_F */
+{ yymsp[0].minor.yy102 = FILL_MODE_NULL_F; }
break;
- case 730: /* group_by_list ::= expr_or_subquery */
-{ yylhsminor.yy334 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); }
- yymsp[0].minor.yy334 = yylhsminor.yy334;
+ case 737: /* fill_mode ::= LINEAR */
+{ yymsp[0].minor.yy102 = FILL_MODE_LINEAR; }
break;
- case 731: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
-{ yylhsminor.yy334 = addNodeToList(pCxt, yymsp[-2].minor.yy334, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy560))); }
- yymsp[-2].minor.yy334 = yylhsminor.yy334;
+ case 738: /* fill_mode ::= NEXT */
+{ yymsp[0].minor.yy102 = FILL_MODE_NEXT; }
break;
- case 735: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
-{ yymsp[-5].minor.yy560 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy560), releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
+ case 741: /* group_by_list ::= expr_or_subquery */
+{ yylhsminor.yy946 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); }
+ yymsp[0].minor.yy946 = yylhsminor.yy946;
break;
- case 736: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
-{ yymsp[-3].minor.yy560 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy560)); }
+ case 742: /* group_by_list ::= group_by_list NK_COMMA expr_or_subquery */
+{ yylhsminor.yy946 = addNodeToList(pCxt, yymsp[-2].minor.yy946, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy974))); }
+ yymsp[-2].minor.yy946 = yylhsminor.yy946;
break;
- case 739: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
+ case 746: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_COMMA expr_or_subquery NK_RP */
+{ yymsp[-5].minor.yy974 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy974), releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); }
+ break;
+ case 747: /* range_opt ::= RANGE NK_LP expr_or_subquery NK_RP */
+{ yymsp[-3].minor.yy974 = createInterpTimePoint(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy974)); }
+ break;
+ case 750: /* query_expression ::= query_simple order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
- yylhsminor.yy560 = addOrderByClause(pCxt, yymsp[-3].minor.yy560, yymsp[-2].minor.yy334);
- yylhsminor.yy560 = addSlimitClause(pCxt, yylhsminor.yy560, yymsp[-1].minor.yy560);
- yylhsminor.yy560 = addLimitClause(pCxt, yylhsminor.yy560, yymsp[0].minor.yy560);
+ yylhsminor.yy974 = addOrderByClause(pCxt, yymsp[-3].minor.yy974, yymsp[-2].minor.yy946);
+ yylhsminor.yy974 = addSlimitClause(pCxt, yylhsminor.yy974, yymsp[-1].minor.yy974);
+ yylhsminor.yy974 = addLimitClause(pCxt, yylhsminor.yy974, yymsp[0].minor.yy974);
}
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 742: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
-{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy560, yymsp[0].minor.yy560); }
- yymsp[-3].minor.yy560 = yylhsminor.yy560;
+ case 753: /* union_query_expression ::= query_simple_or_subquery UNION ALL query_simple_or_subquery */
+{ yylhsminor.yy974 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy974, yymsp[0].minor.yy974); }
+ yymsp[-3].minor.yy974 = yylhsminor.yy974;
break;
- case 743: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
-{ yylhsminor.yy560 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy560, yymsp[0].minor.yy560); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 754: /* union_query_expression ::= query_simple_or_subquery UNION query_simple_or_subquery */
+{ yylhsminor.yy974 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy974, yymsp[0].minor.yy974); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 752: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
- case 756: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==756);
-{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
+ case 763: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
+ case 767: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==767);
+{ yymsp[-3].minor.yy974 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 753: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
- case 757: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==757);
-{ yymsp[-3].minor.yy560 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
+ case 764: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
+ case 768: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==768);
+{ yymsp[-3].minor.yy974 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); }
break;
- case 758: /* subquery ::= NK_LP query_expression NK_RP */
-{ yylhsminor.yy560 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy560); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 769: /* subquery ::= NK_LP query_expression NK_RP */
+{ yylhsminor.yy974 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy974); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 763: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
-{ yylhsminor.yy560 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy560), yymsp[-1].minor.yy974, yymsp[0].minor.yy109); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 774: /* sort_specification ::= expr_or_subquery ordering_specification_opt null_ordering_opt */
+{ yylhsminor.yy974 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy974), yymsp[-1].minor.yy410, yymsp[0].minor.yy307); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
- case 764: /* ordering_specification_opt ::= */
-{ yymsp[1].minor.yy974 = ORDER_ASC; }
+ case 775: /* ordering_specification_opt ::= */
+{ yymsp[1].minor.yy410 = ORDER_ASC; }
break;
- case 765: /* ordering_specification_opt ::= ASC */
-{ yymsp[0].minor.yy974 = ORDER_ASC; }
+ case 776: /* ordering_specification_opt ::= ASC */
+{ yymsp[0].minor.yy410 = ORDER_ASC; }
break;
- case 766: /* ordering_specification_opt ::= DESC */
-{ yymsp[0].minor.yy974 = ORDER_DESC; }
+ case 777: /* ordering_specification_opt ::= DESC */
+{ yymsp[0].minor.yy410 = ORDER_DESC; }
break;
- case 767: /* null_ordering_opt ::= */
-{ yymsp[1].minor.yy109 = NULL_ORDER_DEFAULT; }
+ case 778: /* null_ordering_opt ::= */
+{ yymsp[1].minor.yy307 = NULL_ORDER_DEFAULT; }
break;
- case 768: /* null_ordering_opt ::= NULLS FIRST */
-{ yymsp[-1].minor.yy109 = NULL_ORDER_FIRST; }
+ case 779: /* null_ordering_opt ::= NULLS FIRST */
+{ yymsp[-1].minor.yy307 = NULL_ORDER_FIRST; }
break;
- case 769: /* null_ordering_opt ::= NULLS LAST */
-{ yymsp[-1].minor.yy109 = NULL_ORDER_LAST; }
+ case 780: /* null_ordering_opt ::= NULLS LAST */
+{ yymsp[-1].minor.yy307 = NULL_ORDER_LAST; }
break;
- case 772: /* column_options ::= column_options NK_ID NK_STRING */
-{ yylhsminor.yy560 = setColumnOptions(pCxt, yymsp[-2].minor.yy560, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
- yymsp[-2].minor.yy560 = yylhsminor.yy560;
+ case 783: /* column_options ::= column_options NK_ID NK_STRING */
+{ yylhsminor.yy974 = setColumnOptions(pCxt, yymsp[-2].minor.yy974, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
+ yymsp[-2].minor.yy974 = yylhsminor.yy974;
break;
default:
break;
diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c
index 6ad30eccb8..40cd415cb9 100644
--- a/source/libs/planner/src/planLogicCreater.c
+++ b/source/libs/planner/src/planLogicCreater.c
@@ -973,6 +973,45 @@ static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p
return code;
}
+static bool isForecastFunc(int32_t funcId) {
+ return fmIsForecastFunc(funcId) || fmIsForecastPseudoColumnFunc(funcId) || fmIsGroupKeyFunc(funcId) || fmisSelectGroupConstValueFunc(funcId);
+}
+
+static int32_t createForecastFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {
+ if (!pSelect->hasForecastFunc) {
+ return TSDB_CODE_SUCCESS;
+ }
+
+ SForecastFuncLogicNode* pForecastFunc = NULL;
+ int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC, (SNode**)&pForecastFunc);
+ if (NULL == pForecastFunc) {
+ return code;
+ }
+
+ pForecastFunc->node.groupAction = getGroupAction(pCxt, pSelect);
+ pForecastFunc->node.requireDataOrder = getRequireDataOrder(true, pSelect);
+ pForecastFunc->node.resultDataOrder = pForecastFunc->node.requireDataOrder;
+
+ // interp functions and _group_key functions
+ code = nodesCollectFuncs(pSelect, SQL_CLAUSE_SELECT, NULL, isForecastFunc, &pForecastFunc->pFuncs);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = rewriteExprsForSelect(pForecastFunc->pFuncs, pSelect, SQL_CLAUSE_SELECT, NULL);
+ }
+
+ // set the output
+ if (TSDB_CODE_SUCCESS == code) {
+ code = createColumnByRewriteExprs(pForecastFunc->pFuncs, &pForecastFunc->node.pTargets);
+ }
+
+ if (TSDB_CODE_SUCCESS == code) {
+ *pLogicNode = (SLogicNode*)pForecastFunc;
+ } else {
+ nodesDestroyNode((SNode*)pForecastFunc);
+ }
+
+ return code;
+}
+
static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SWindowLogicNode* pWindow,
SLogicNode** pLogicNode) {
if (pCxt->pPlanCxt->streamQuery) {
@@ -1174,6 +1213,48 @@ static int32_t createWindowLogicNodeByCount(SLogicPlanContext* pCxt, SCountWindo
return createWindowLogicNodeFinalize(pCxt, pSelect, pWindow, pLogicNode);
}
+static int32_t createWindowLogicNodeByAnomaly(SLogicPlanContext* pCxt, SAnomalyWindowNode* pAnomaly,
+ SSelectStmt* pSelect, SLogicNode** pLogicNode) {
+ SWindowLogicNode* pWindow = NULL;
+ int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_PLAN_WINDOW, (SNode**)&pWindow);
+ if (NULL == pWindow) {
+ return code;
+ }
+
+ pWindow->winType = WINDOW_TYPE_ANOMALY;
+ pWindow->node.groupAction = getGroupAction(pCxt, pSelect);
+ pWindow->node.requireDataOrder =
+ pCxt->pPlanCxt->streamQuery ? DATA_ORDER_LEVEL_IN_BLOCK : getRequireDataOrder(true, pSelect);
+ pWindow->node.resultDataOrder =
+ pCxt->pPlanCxt->streamQuery ? DATA_ORDER_LEVEL_GLOBAL : pWindow->node.requireDataOrder;
+
+ pWindow->pAnomalyExpr = NULL;
+ code = nodesCloneNode(pAnomaly->pExpr, &pWindow->pAnomalyExpr);
+ if (TSDB_CODE_SUCCESS != code) {
+ nodesDestroyNode((SNode*)pWindow);
+ return code;
+ }
+
+ tstrncpy(pWindow->anomalyOpt, pAnomaly->anomalyOpt, sizeof(pWindow->anomalyOpt));
+
+ pWindow->pTspk = NULL;
+ code = nodesCloneNode(pAnomaly->pCol, &pWindow->pTspk);
+ if (NULL == pWindow->pTspk) {
+ nodesDestroyNode((SNode*)pWindow);
+ return code;
+ }
+
+ // rewrite the expression in subsequent clauses
+ code = rewriteExprForSelect(pWindow->pAnomalyExpr, pSelect, SQL_CLAUSE_WINDOW);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = createWindowLogicNodeFinalize(pCxt, pSelect, pWindow, pLogicNode);
+ } else {
+ nodesDestroyNode((SNode*)pWindow);
+ }
+
+ return code;
+}
+
static int32_t createWindowLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {
if (NULL == pSelect->pWindow) {
return TSDB_CODE_SUCCESS;
@@ -1189,6 +1270,8 @@ static int32_t createWindowLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSele
return createWindowLogicNodeByEvent(pCxt, (SEventWindowNode*)pSelect->pWindow, pSelect, pLogicNode);
case QUERY_NODE_COUNT_WINDOW:
return createWindowLogicNodeByCount(pCxt, (SCountWindowNode*)pSelect->pWindow, pSelect, pLogicNode);
+ case QUERY_NODE_ANOMALY_WINDOW:
+ return createWindowLogicNodeByAnomaly(pCxt, (SAnomalyWindowNode*)pSelect->pWindow, pSelect, pLogicNode);
default:
break;
}
@@ -1600,6 +1683,9 @@ static int32_t createSelectFromLogicNode(SLogicPlanContext* pCxt, SSelectStmt* p
if (TSDB_CODE_SUCCESS == code) {
code = createSelectRootLogicNode(pCxt, pSelect, createInterpFuncLogicNode, &pRoot);
}
+ if (TSDB_CODE_SUCCESS == code) {
+ code = createSelectRootLogicNode(pCxt, pSelect, createForecastFuncLogicNode, &pRoot);
+ }
if (TSDB_CODE_SUCCESS == code) {
code = createSelectRootLogicNode(pCxt, pSelect, createDistinctLogicNode, &pRoot);
}
diff --git a/source/libs/planner/src/planOptimizer.c b/source/libs/planner/src/planOptimizer.c
index 97c4fa9dde..885faa5461 100644
--- a/source/libs/planner/src/planOptimizer.c
+++ b/source/libs/planner/src/planOptimizer.c
@@ -2380,6 +2380,8 @@ static bool sortPriKeyOptHasUnsupportedPkFunc(SLogicNode* pLogicNode, EOrder sor
case QUERY_NODE_LOGIC_PLAN_INTERP_FUNC:
pFuncList = ((SInterpFuncLogicNode*)pLogicNode)->pFuncs;
break;
+ case QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC:
+ pFuncList = ((SForecastFuncLogicNode*)pLogicNode)->pFuncs;
default:
break;
}
diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c
index a00eb05482..738ccf3224 100644
--- a/source/libs/planner/src/planPhysiCreater.c
+++ b/source/libs/planner/src/planPhysiCreater.c
@@ -1990,6 +1990,50 @@ static int32_t createInterpFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pCh
return code;
}
+static int32_t createForecastFuncPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren,
+ SForecastFuncLogicNode* pFuncLogicNode, SPhysiNode** pPhyNode) {
+ SForecastFuncPhysiNode* pForecastFunc =
+ (SForecastFuncPhysiNode*)makePhysiNode(pCxt, (SLogicNode*)pFuncLogicNode, QUERY_NODE_PHYSICAL_PLAN_FORECAST_FUNC);
+ if (NULL == pForecastFunc) {
+ return terrno;
+ }
+
+ SNodeList* pPrecalcExprs = NULL;
+ SNodeList* pFuncs = NULL;
+ int32_t code = rewritePrecalcExprs(pCxt, pFuncLogicNode->pFuncs, &pPrecalcExprs, &pFuncs);
+
+ SDataBlockDescNode* pChildTupe = (((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc);
+ // push down expression to pOutputDataBlockDesc of child node
+ if (TSDB_CODE_SUCCESS == code && NULL != pPrecalcExprs) {
+ code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pPrecalcExprs, &pForecastFunc->pExprs);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = pushdownDataBlockSlots(pCxt, pForecastFunc->pExprs, pChildTupe);
+ }
+ }
+
+ if (TSDB_CODE_SUCCESS == code) {
+ code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pFuncs, &pForecastFunc->pFuncs);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = addDataBlockSlots(pCxt, pForecastFunc->pFuncs, pForecastFunc->node.pOutputDataBlockDesc);
+ }
+ }
+
+ if (TSDB_CODE_SUCCESS == code) {
+ code = setConditionsSlotId(pCxt, (const SLogicNode*)pFuncLogicNode, (SPhysiNode*)pForecastFunc);
+ }
+
+ if (TSDB_CODE_SUCCESS == code) {
+ *pPhyNode = (SPhysiNode*)pForecastFunc;
+ } else {
+ nodesDestroyNode((SNode*)pForecastFunc);
+ }
+
+ nodesDestroyList(pPrecalcExprs);
+ nodesDestroyList(pFuncs);
+
+ return code;
+}
+
static bool projectCanMergeDataBlock(SProjectLogicNode* pProject) {
if (GROUP_ACTION_KEEP == pProject->node.groupAction) {
return false;
@@ -2325,6 +2369,53 @@ static int32_t createCountWindowPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pC
return code;
}
+static int32_t createAnomalyWindowPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren,
+ SWindowLogicNode* pWindowLogicNode, SPhysiNode** pPhyNode) {
+ SAnomalyWindowPhysiNode* pAnomaly = (SAnomalyWindowPhysiNode*)makePhysiNode(
+ pCxt, (SLogicNode*)pWindowLogicNode,
+ (pCxt->pPlanCxt->streamQuery ? QUERY_NODE_PHYSICAL_PLAN_STREAM_ANOMALY : QUERY_NODE_PHYSICAL_PLAN_MERGE_ANOMALY));
+ if (NULL == pAnomaly) {
+ return terrno;
+ }
+
+ SNodeList* pPrecalcExprs = NULL;
+ SNode* pAnomalyKey = NULL;
+ int32_t code = rewritePrecalcExpr(pCxt, pWindowLogicNode->pAnomalyExpr, &pPrecalcExprs, &pAnomalyKey);
+
+ SDataBlockDescNode* pChildTupe = (((SPhysiNode*)nodesListGetNode(pChildren, 0))->pOutputDataBlockDesc);
+ // push down expression to pOutputDataBlockDesc of child node
+ if (TSDB_CODE_SUCCESS == code && NULL != pPrecalcExprs) {
+ code = setListSlotId(pCxt, pChildTupe->dataBlockId, -1, pPrecalcExprs, &pAnomaly->window.pExprs);
+ if (TSDB_CODE_SUCCESS == code) {
+ code = addDataBlockSlots(pCxt, pAnomaly->window.pExprs, pChildTupe);
+ }
+ }
+
+ if (TSDB_CODE_SUCCESS == code) {
+ code = setNodeSlotId(pCxt, pChildTupe->dataBlockId, -1, pAnomalyKey, &pAnomaly->pAnomalyKey);
+ // if (TSDB_CODE_SUCCESS == code) {
+ // code = addDataBlockSlot(pCxt, &pAnomaly->pAnomalyKey, pAnomaly->window.node.pOutputDataBlockDesc);
+ // }
+ }
+
+ tstrncpy(pAnomaly->anomalyOpt, pWindowLogicNode->anomalyOpt, sizeof(pAnomaly->anomalyOpt));
+
+ if (TSDB_CODE_SUCCESS == code) {
+ code = createWindowPhysiNodeFinalize(pCxt, pChildren, &pAnomaly->window, pWindowLogicNode);
+ }
+
+ if (TSDB_CODE_SUCCESS == code) {
+ *pPhyNode = (SPhysiNode*)pAnomaly;
+ } else {
+ nodesDestroyNode((SNode*)pAnomaly);
+ }
+
+ nodesDestroyList(pPrecalcExprs);
+ nodesDestroyNode(pAnomalyKey);
+
+ return code;
+}
+
static int32_t createWindowPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, SWindowLogicNode* pWindowLogicNode,
SPhysiNode** pPhyNode) {
switch (pWindowLogicNode->winType) {
@@ -2338,6 +2429,8 @@ static int32_t createWindowPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildr
return createEventWindowPhysiNode(pCxt, pChildren, pWindowLogicNode, pPhyNode);
case WINDOW_TYPE_COUNT:
return createCountWindowPhysiNode(pCxt, pChildren, pWindowLogicNode, pPhyNode);
+ case WINDOW_TYPE_ANOMALY:
+ return createAnomalyWindowPhysiNode(pCxt, pChildren, pWindowLogicNode, pPhyNode);
default:
break;
}
@@ -2652,6 +2745,8 @@ static int32_t doCreatePhysiNode(SPhysiPlanContext* pCxt, SLogicNode* pLogicNode
return createIndefRowsFuncPhysiNode(pCxt, pChildren, (SIndefRowsFuncLogicNode*)pLogicNode, pPhyNode);
case QUERY_NODE_LOGIC_PLAN_INTERP_FUNC:
return createInterpFuncPhysiNode(pCxt, pChildren, (SInterpFuncLogicNode*)pLogicNode, pPhyNode);
+ case QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC:
+ return createForecastFuncPhysiNode(pCxt, pChildren, (SForecastFuncLogicNode*)pLogicNode, pPhyNode);
case QUERY_NODE_LOGIC_PLAN_MERGE:
return createMergePhysiNode(pCxt, pChildren, (SMergeLogicNode*)pLogicNode, pPhyNode);
case QUERY_NODE_LOGIC_PLAN_GROUP_CACHE:
diff --git a/source/libs/planner/src/planSpliter.c b/source/libs/planner/src/planSpliter.c
index bd2462243d..e0e42087f3 100644
--- a/source/libs/planner/src/planSpliter.c
+++ b/source/libs/planner/src/planSpliter.c
@@ -939,6 +939,18 @@ static int32_t stbSplSplitCount(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
}
}
+static int32_t stbSplSplitAnomalyForStream(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
+ return TSDB_CODE_PLAN_INTERNAL_ERROR;
+}
+
+static int32_t stbSplSplitAnomaly(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
+ if (pCxt->pPlanCxt->streamQuery) {
+ return stbSplSplitAnomalyForStream(pCxt, pInfo);
+ } else {
+ return stbSplSplitSessionOrStateForBatch(pCxt, pInfo);
+ }
+}
+
static int32_t stbSplSplitWindowForCrossTable(SSplitContext* pCxt, SStableSplitInfo* pInfo) {
switch (((SWindowLogicNode*)pInfo->pSplitNode)->winType) {
case WINDOW_TYPE_INTERVAL:
@@ -951,6 +963,8 @@ static int32_t stbSplSplitWindowForCrossTable(SSplitContext* pCxt, SStableSplitI
return stbSplSplitEvent(pCxt, pInfo);
case WINDOW_TYPE_COUNT:
return stbSplSplitCount(pCxt, pInfo);
+ case WINDOW_TYPE_ANOMALY:
+ return stbSplSplitAnomaly(pCxt, pInfo);
default:
break;
}
@@ -2000,7 +2014,8 @@ typedef struct SQnodeSplitInfo {
static bool qndSplFindSplitNode(SSplitContext* pCxt, SLogicSubplan* pSubplan, SLogicNode* pNode,
SQnodeSplitInfo* pInfo) {
if (QUERY_NODE_LOGIC_PLAN_SCAN == nodeType(pNode) && NULL != pNode->pParent &&
- QUERY_NODE_LOGIC_PLAN_INTERP_FUNC != nodeType(pNode->pParent) && ((SScanLogicNode*)pNode)->scanSeq[0] <= 1 &&
+ QUERY_NODE_LOGIC_PLAN_INTERP_FUNC != nodeType(pNode->pParent) &&
+ QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC != nodeType(pNode->pParent) && ((SScanLogicNode*)pNode)->scanSeq[0] <= 1 &&
((SScanLogicNode*)pNode)->scanSeq[1] <= 1) {
pInfo->pSplitNode = pNode;
pInfo->pSubplan = pSubplan;
diff --git a/source/libs/planner/src/planUtil.c b/source/libs/planner/src/planUtil.c
index ae958de6e8..fd8670c23e 100644
--- a/source/libs/planner/src/planUtil.c
+++ b/source/libs/planner/src/planUtil.c
@@ -256,6 +256,15 @@ static int32_t adjustCountDataRequirement(SWindowLogicNode* pWindow, EDataOrderL
return TSDB_CODE_SUCCESS;
}
+static int32_t adjustAnomalyDataRequirement(SWindowLogicNode* pWindow, EDataOrderLevel requirement) {
+ if (requirement <= pWindow->node.resultDataOrder) {
+ return TSDB_CODE_SUCCESS;
+ }
+ pWindow->node.resultDataOrder = requirement;
+ pWindow->node.requireDataOrder = requirement;
+ return TSDB_CODE_SUCCESS;
+}
+
static int32_t adjustWindowDataRequirement(SWindowLogicNode* pWindow, EDataOrderLevel requirement) {
switch (pWindow->winType) {
case WINDOW_TYPE_INTERVAL:
@@ -268,6 +277,8 @@ static int32_t adjustWindowDataRequirement(SWindowLogicNode* pWindow, EDataOrder
return adjustEventDataRequirement(pWindow, requirement);
case WINDOW_TYPE_COUNT:
return adjustCountDataRequirement(pWindow, requirement);
+ case WINDOW_TYPE_ANOMALY:
+ return adjustAnomalyDataRequirement(pWindow, requirement);
default:
break;
}
@@ -318,6 +329,15 @@ static int32_t adjustInterpDataRequirement(SInterpFuncLogicNode* pInterp, EDataO
return TSDB_CODE_SUCCESS;
}
+static int32_t adjustForecastDataRequirement(SForecastFuncLogicNode* pForecast, EDataOrderLevel requirement) {
+ if (requirement <= pForecast->node.requireDataOrder) {
+ return TSDB_CODE_SUCCESS;
+ }
+ pForecast->node.resultDataOrder = requirement;
+ pForecast->node.requireDataOrder = requirement;
+ return TSDB_CODE_SUCCESS;
+}
+
int32_t adjustLogicNodeDataRequirement(SLogicNode* pNode, EDataOrderLevel requirement) {
int32_t code = TSDB_CODE_SUCCESS;
switch (nodeType(pNode)) {
@@ -355,6 +375,9 @@ int32_t adjustLogicNodeDataRequirement(SLogicNode* pNode, EDataOrderLevel requir
case QUERY_NODE_LOGIC_PLAN_INTERP_FUNC:
code = adjustInterpDataRequirement((SInterpFuncLogicNode*)pNode, requirement);
break;
+ case QUERY_NODE_LOGIC_PLAN_FORECAST_FUNC:
+ code = adjustForecastDataRequirement((SForecastFuncLogicNode*)pNode, requirement);
+ break;
default:
break;
}
diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c
index 802bec00f8..03bc2b544b 100644
--- a/source/libs/scalar/src/filter.c
+++ b/source/libs/scalar/src/filter.c
@@ -1769,36 +1769,36 @@ int32_t fltConverToStr(char *str, int32_t strMaxLen, int type, void *buf, int32_
switch (type) {
case TSDB_DATA_TYPE_NULL:
- n = snprintf(str, strMaxLen, "null");
+ n = tsnprintf(str, strMaxLen, "null");
break;
case TSDB_DATA_TYPE_BOOL:
- n = snprintf(str, strMaxLen, (*(int8_t *)buf) ? "true" : "false");
+ n = tsnprintf(str, strMaxLen, (*(int8_t *)buf) ? "true" : "false");
break;
case TSDB_DATA_TYPE_TINYINT:
- n = snprintf(str, strMaxLen, "%d", *(int8_t *)buf);
+ n = tsnprintf(str, strMaxLen, "%d", *(int8_t *)buf);
break;
case TSDB_DATA_TYPE_SMALLINT:
- n = snprintf(str, strMaxLen, "%d", *(int16_t *)buf);
+ n = tsnprintf(str, strMaxLen, "%d", *(int16_t *)buf);
break;
case TSDB_DATA_TYPE_INT:
- n = snprintf(str, strMaxLen, "%d", *(int32_t *)buf);
+ n = tsnprintf(str, strMaxLen, "%d", *(int32_t *)buf);
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_TIMESTAMP:
- n = snprintf(str, strMaxLen, "%" PRId64, *(int64_t *)buf);
+ n = tsnprintf(str, strMaxLen, "%" PRId64, *(int64_t *)buf);
break;
case TSDB_DATA_TYPE_FLOAT:
- n = snprintf(str, strMaxLen, "%e", GET_FLOAT_VAL(buf));
+ n = tsnprintf(str, strMaxLen, "%e", GET_FLOAT_VAL(buf));
break;
case TSDB_DATA_TYPE_DOUBLE:
- n = snprintf(str, strMaxLen, "%e", GET_DOUBLE_VAL(buf));
+ n = tsnprintf(str, strMaxLen, "%e", GET_DOUBLE_VAL(buf));
break;
case TSDB_DATA_TYPE_BINARY:
@@ -1817,19 +1817,19 @@ int32_t fltConverToStr(char *str, int32_t strMaxLen, int type, void *buf, int32_
break;
case TSDB_DATA_TYPE_UTINYINT:
- n = snprintf(str, strMaxLen, "%d", *(uint8_t *)buf);
+ n = tsnprintf(str, strMaxLen, "%d", *(uint8_t *)buf);
break;
case TSDB_DATA_TYPE_USMALLINT:
- n = snprintf(str, strMaxLen, "%d", *(uint16_t *)buf);
+ n = tsnprintf(str, strMaxLen, "%d", *(uint16_t *)buf);
break;
case TSDB_DATA_TYPE_UINT:
- n = snprintf(str, strMaxLen, "%u", *(uint32_t *)buf);
+ n = tsnprintf(str, strMaxLen, "%u", *(uint32_t *)buf);
break;
case TSDB_DATA_TYPE_UBIGINT:
- n = snprintf(str, strMaxLen, "%" PRIu64, *(uint64_t *)buf);
+ n = tsnprintf(str, strMaxLen, "%" PRIu64, *(uint64_t *)buf);
break;
default:
@@ -1886,7 +1886,7 @@ int32_t filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t optio
SFilterField *left = FILTER_UNIT_LEFT_FIELD(info, unit);
SColumnNode *refNode = (SColumnNode *)left->desc;
if (unit->compare.optr <= OP_TYPE_JSON_CONTAINS) {
- len += snprintf(str, sizeof(str), "UNIT[%d] => [%d][%d] %s [", i, refNode->dataBlockId, refNode->slotId,
+ len += tsnprintf(str, sizeof(str), "UNIT[%d] => [%d][%d] %s [", i, refNode->dataBlockId, refNode->slotId,
operatorTypeStr(unit->compare.optr));
}
@@ -1912,7 +1912,7 @@ int32_t filterDumpInfoToString(SFilterInfo *info, const char *msg, int32_t optio
(void)strncat(str, " && ", sizeof(str) - len - 1);
len += 4;
if (unit->compare.optr2 <= OP_TYPE_JSON_CONTAINS) {
- len += snprintf(str + len, sizeof(str) - len, "[%d][%d] %s [", refNode->dataBlockId,
+ len += tsnprintf(str + len, sizeof(str) - len, "[%d][%d] %s [", refNode->dataBlockId,
refNode->slotId, operatorTypeStr(unit->compare.optr2));
}
diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c
index 341ce760f5..6f6362a8f7 100644
--- a/source/libs/scalar/src/sclfunc.c
+++ b/source/libs/scalar/src/sclfunc.c
@@ -2068,7 +2068,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
case TSDB_DATA_TYPE_GEOMETRY: {
if (inputType == TSDB_DATA_TYPE_BOOL) {
// NOTE: snprintf will append '\0' at the end of string
- int32_t len = snprintf(varDataVal(output), outputLen + TSDB_NCHAR_SIZE - VARSTR_HEADER_SIZE, "%.*s",
+ int32_t len = tsnprintf(varDataVal(output), outputLen + TSDB_NCHAR_SIZE - VARSTR_HEADER_SIZE, "%.*s",
(int32_t)(outputLen - VARSTR_HEADER_SIZE), *(int8_t *)input ? "true" : "false");
varDataSetLen(output, len);
} else if (inputType == TSDB_DATA_TYPE_BINARY) {
@@ -2109,7 +2109,7 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
int32_t len;
if (inputType == TSDB_DATA_TYPE_BOOL) {
char tmp[8] = {0};
- len = snprintf(tmp, sizeof(tmp), "%.*s", outputCharLen, *(int8_t *)input ? "true" : "false");
+ len = tsnprintf(tmp, sizeof(tmp), "%.*s", outputCharLen, *(int8_t *)input ? "true" : "false");
bool ret = taosMbsToUcs4(tmp, len, (TdUcs4 *)varDataVal(output), outputLen - VARSTR_HEADER_SIZE, &len);
if (!ret) {
code = TSDB_CODE_SCALAR_CONVERT_ERROR;
@@ -4080,6 +4080,10 @@ int32_t diffScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam
return nonCalcScalarFunction(pInput, inputNum, pOutput);
}
+int32_t forecastScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
+ return nonCalcScalarFunction(pInput, inputNum, pOutput);
+}
+
int32_t twaScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutput) {
return avgScalarFunction(pInput, inputNum, pOutput);
}
@@ -4515,10 +4519,10 @@ int32_t histogramScalarFunction(SScalarParam *pInput, int32_t inputNum, SScalarP
int32_t len;
char buf[512] = {0};
if (!normalized) {
- len = snprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%" PRId64 "}",
+ len = tsnprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%" PRId64 "}",
bins[k].lower, bins[k].upper, bins[k].count);
} else {
- len = snprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%lf}",
+ len = tsnprintf(varDataVal(buf), sizeof(buf) - VARSTR_HEADER_SIZE, "{\"lower_bin\":%g, \"upper_bin\":%g, \"count\":%lf}",
bins[k].lower, bins[k].upper, bins[k].percentage);
}
varDataSetLen(buf, len);
diff --git a/source/libs/scalar/src/sclvector.c b/source/libs/scalar/src/sclvector.c
index a7c842172a..a086d1f367 100644
--- a/source/libs/scalar/src/sclvector.c
+++ b/source/libs/scalar/src/sclvector.c
@@ -734,7 +734,7 @@ int32_t vectorConvertToVarData(SSclVectorConvCtx *pCtx) {
int64_t value = 0;
GET_TYPED_DATA(value, int64_t, pCtx->inType, colDataGetData(pInputCol, i));
- int32_t len = snprintf(varDataVal(tmp), sizeof(tmp) - VARSTR_HEADER_SIZE, "%" PRId64, value);
+ int32_t len = tsnprintf(varDataVal(tmp), sizeof(tmp) - VARSTR_HEADER_SIZE, "%" PRId64, value);
varDataLen(tmp) = len;
if (pCtx->outType == TSDB_DATA_TYPE_NCHAR) {
SCL_ERR_RET(varToNchar(tmp, pCtx->pOut, i, NULL));
@@ -751,7 +751,7 @@ int32_t vectorConvertToVarData(SSclVectorConvCtx *pCtx) {
uint64_t value = 0;
GET_TYPED_DATA(value, uint64_t, pCtx->inType, colDataGetData(pInputCol, i));
- int32_t len = snprintf(varDataVal(tmp), sizeof(tmp) - VARSTR_HEADER_SIZE, "%" PRIu64, value);
+ int32_t len = tsnprintf(varDataVal(tmp), sizeof(tmp) - VARSTR_HEADER_SIZE, "%" PRIu64, value);
varDataLen(tmp) = len;
if (pCtx->outType == TSDB_DATA_TYPE_NCHAR) {
SCL_ERR_RET(varToNchar(tmp, pCtx->pOut, i, NULL));
@@ -768,7 +768,7 @@ int32_t vectorConvertToVarData(SSclVectorConvCtx *pCtx) {
double value = 0;
GET_TYPED_DATA(value, double, pCtx->inType, colDataGetData(pInputCol, i));
- int32_t len = snprintf(varDataVal(tmp), sizeof(tmp) - VARSTR_HEADER_SIZE, "%lf", value);
+ int32_t len = tsnprintf(varDataVal(tmp), sizeof(tmp) - VARSTR_HEADER_SIZE, "%lf", value);
varDataLen(tmp) = len;
if (pCtx->outType == TSDB_DATA_TYPE_NCHAR) {
SCL_ERR_RET(varToNchar(tmp, pCtx->pOut, i, NULL));
diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c
index a8e747ccd2..b15a6a09d3 100644
--- a/source/libs/scheduler/src/schRemote.c
+++ b/source/libs/scheduler/src/schRemote.c
@@ -504,6 +504,10 @@ int32_t schHandleDropCallback(void *param, SDataBuf *pMsg, int32_t code) {
code);
// called if drop task rsp received code
(void)rpcReleaseHandle(pMsg->handle, TAOS_CONN_CLIENT); // ignore error
+
+ if (pMsg->handle == NULL) {
+ qError("sch handle is NULL, may be already released and mem lea");
+ }
if (pMsg) {
taosMemoryFree(pMsg->pData);
taosMemoryFree(pMsg->pEpSet);
diff --git a/source/libs/stream/inc/streamBackendRocksdb.h b/source/libs/stream/inc/streamBackendRocksdb.h
index 567d9de949..1e0801fb6b 100644
--- a/source/libs/stream/inc/streamBackendRocksdb.h
+++ b/source/libs/stream/inc/streamBackendRocksdb.h
@@ -80,7 +80,7 @@ typedef struct {
TdThreadRwlock chkpDirLock;
int64_t dataWritten;
- void* pMeta;
+ void* pMeta;
int8_t removeAllFiles;
} STaskDbWrapper;
@@ -153,7 +153,7 @@ void taskDbUpdateChkpId(void* pTaskDb, int64_t chkpId);
void* taskDbAddRef(void* pTaskDb);
void taskDbRemoveRef(void* pTaskDb);
-void taskDbSetClearFileFlag(void* pTaskDb);
+void taskDbSetClearFileFlag(void* pTaskDb);
int streamStateOpenBackend(void* backend, SStreamState* pState);
void streamStateCloseBackend(SStreamState* pState, bool remove);
@@ -169,7 +169,7 @@ int32_t streamStateGetFirst_rocksdb(SStreamState* pState, SWinKey* key);
int32_t streamStateGetGroupKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen);
int32_t streamStateAddIfNotExist_rocksdb(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen);
void streamStateCurPrev_rocksdb(SStreamStateCur* pCur);
-int32_t streamStateGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen);
+int32_t streamStateGetKVByCur_rocksdb(SStreamState* pState, SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen);
SStreamStateCur* streamStateGetAndCheckCur_rocksdb(SStreamState* pState, SWinKey* key);
SStreamStateCur* streamStateSeekKeyNext_rocksdb(SStreamState* pState, const SWinKey* key);
SStreamStateCur* streamStateSeekToLast_rocksdb(SStreamState* pState);
@@ -191,7 +191,8 @@ SStreamStateCur* streamStateSessionSeekKeyPrev_rocksdb(SStreamState* pState, con
SStreamStateCur* streamStateSessionSeekToLast_rocksdb(SStreamState* pState, int64_t groupId);
int32_t streamStateSessionCurPrev_rocksdb(SStreamStateCur* pCur);
-int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen);
+int32_t streamStateSessionGetKVByCur_rocksdb(SStreamState* pState, SStreamStateCur* pCur, SSessionKey* pKey,
+ void** pVal, int32_t* pVLen);
int32_t streamStateSessionGetKeyByRange_rocksdb(SStreamState* pState, const SSessionKey* key, SSessionKey* curKey);
int32_t streamStateSessionAddIfNotExist_rocksdb(SStreamState* pState, SSessionKey* key, TSKEY gap, void** pVal,
int32_t* pVLen);
@@ -255,11 +256,11 @@ int32_t taskDbDestroySnap(void* arg, SArray* pSnapInfo);
int32_t taskDbDoCheckpoint(void* arg, int64_t chkpId, int64_t processId);
-int32_t bkdMgtCreate(char* path, SBkdMgt **bm);
-int32_t bkdMgtAddChkp(SBkdMgt* bm, char* task, char* path);
-int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list, char* name);
-int32_t bkdMgtDumpTo(SBkdMgt* bm, char* taskId, char* dname);
-void bkdMgtDestroy(SBkdMgt* bm);
+int32_t bkdMgtCreate(char* path, SBkdMgt** bm);
+int32_t bkdMgtAddChkp(SBkdMgt* bm, char* task, char* path);
+int32_t bkdMgtGetDelta(SBkdMgt* bm, char* taskId, int64_t chkpId, SArray* list, char* name);
+int32_t bkdMgtDumpTo(SBkdMgt* bm, char* taskId, char* dname);
+void bkdMgtDestroy(SBkdMgt* bm);
int32_t taskDbGenChkpUploadData(void* arg, void* bkdMgt, int64_t chkpId, int8_t type, char** path, SArray* list,
const char* id);
diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c
index c88971ab75..33cbf64905 100644
--- a/source/libs/stream/src/streamBackendRocksdb.c
+++ b/source/libs/stream/src/streamBackendRocksdb.c
@@ -3289,13 +3289,40 @@ int32_t streamStatePut_rocksdb(SStreamState* pState, const SWinKey* key, const v
int code = 0;
SStateKey sKey = {.key = *key, .opNum = pState->number};
- STREAM_STATE_PUT_ROCKSDB(pState, "state", &sKey, (void*)value, vLen);
+ char* dst = NULL;
+ size_t size = 0;
+ if (pState->pResultRowStore.resultRowPut == NULL || pState->pExprSupp == NULL) {
+ STREAM_STATE_PUT_ROCKSDB(pState, "state", &sKey, (void*)value, (int32_t)vLen);
+ } else {
+ code = (pState->pResultRowStore.resultRowPut)(pState->pExprSupp, value, vLen, &dst, &size);
+ if (code != 0) {
+ return code;
+ }
+ STREAM_STATE_PUT_ROCKSDB(pState, "state", &sKey, (void*)dst, (int32_t)size);
+ taosMemoryFree(dst);
+ }
return code;
}
int32_t streamStateGet_rocksdb(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) {
int code = 0;
SStateKey sKey = {.key = *key, .opNum = pState->number};
- STREAM_STATE_GET_ROCKSDB(pState, "state", &sKey, pVal, pVLen);
+
+ char* tVal = NULL;
+ size_t tValLen = 0;
+ STREAM_STATE_GET_ROCKSDB(pState, "state", &sKey, &tVal, &tValLen);
+ if (code != 0) {
+ taosMemoryFree(tVal);
+ return code;
+ }
+ if (pState->pResultRowStore.resultRowGet == NULL || pState->pExprSupp == NULL) {
+ *pVal = tVal;
+ *pVLen = tValLen;
+ return code;
+ }
+ size_t pValLen = 0;
+ code = (pState->pResultRowStore.resultRowGet)(pState->pExprSupp, tVal, tValLen, (char**)pVal, &pValLen);
+ *pVLen = (int32_t)pValLen;
+ taosMemoryFree(tVal);
return code;
}
int32_t streamStateDel_rocksdb(SStreamState* pState, const SWinKey* key) {
@@ -3351,7 +3378,7 @@ int32_t streamStateGetFirst_rocksdb(SStreamState* pState, SWinKey* key) {
}
SStreamStateCur* pCur = streamStateSeekKeyNext_rocksdb(pState, &tmp);
- code = streamStateGetKVByCur_rocksdb(pCur, key, NULL, 0);
+ code = streamStateGetKVByCur_rocksdb(pState, pCur, key, NULL, 0);
if (code != 0) {
return code;
}
@@ -3395,7 +3422,8 @@ void streamStateCurPrev_rocksdb(SStreamStateCur* pCur) {
rocksdb_iter_prev(pCur->iter);
}
}
-int32_t streamStateGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) {
+int32_t streamStateGetKVByCur_rocksdb(SStreamState* pState, SStreamStateCur* pCur, SWinKey* pKey, const void** pVal,
+ int32_t* pVLen) {
if (!pCur) return -1;
SStateKey tkey;
SStateKey* pKtmp = &tkey;
@@ -3411,7 +3439,35 @@ int32_t streamStateGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, cons
if (pVLen != NULL) {
size_t vlen = 0;
const char* valStr = rocksdb_iter_value(pCur->iter, &vlen);
- *pVLen = valueDecode((void*)valStr, vlen, NULL, (char**)pVal);
+ char* val = NULL;
+ int32_t len = valueDecode((void*)valStr, vlen, NULL, (char**)val);
+ if (len <= 0) {
+ taosMemoryFree(val);
+ return -1;
+ }
+
+ char* tVal = val;
+ size_t tVlen = len;
+
+ if (pVal != NULL) {
+ if (pState != NULL && pState->pResultRowStore.resultRowGet != NULL && pState->pExprSupp != NULL) {
+ int code =
+ (pState->pResultRowStore.resultRowGet)(pState->pExprSupp, val, len, (char**)&tVal, (size_t*)&tVlen);
+ if (code != 0) {
+ taosMemoryFree(val);
+ return code;
+ }
+ taosMemoryFree(val);
+ *pVal = (char*)tVal;
+ } else {
+ stInfo("streamStateGetKVByCur_rocksdb, pState = %p, pResultRowStore = %p, pExprSupp = %p", pState,
+ pState->pResultRowStore.resultRowGet, pState->pExprSupp);
+ *pVal = (char*)tVal;
+ }
+ } else {
+ taosMemoryFree(val);
+ }
+ *pVLen = (int32_t)tVlen;
}
*pKey = pKtmp->key;
@@ -3541,14 +3597,44 @@ SStreamStateCur* streamStateGetCur_rocksdb(SStreamState* pState, const SWinKey*
// func cf
int32_t streamStateFuncPut_rocksdb(SStreamState* pState, const STupleKey* key, const void* value, int32_t vLen) {
- int code = 0;
- STREAM_STATE_PUT_ROCKSDB(pState, "func", key, (void*)value, vLen);
+ int code = 0;
+ char* dst = NULL;
+ size_t size = 0;
+ if (pState->pResultRowStore.resultRowPut == NULL || pState->pExprSupp == NULL) {
+ STREAM_STATE_PUT_ROCKSDB(pState, "func", key, (void*)value, (int32_t)vLen);
+ return code;
+ }
+ code = (pState->pResultRowStore.resultRowPut)(pState->pExprSupp, value, vLen, &dst, &size);
+ if (code != 0) {
+ return code;
+ }
+ STREAM_STATE_PUT_ROCKSDB(pState, "func", key, (void*)dst, (int32_t)size);
+ taosMemoryFree(dst);
+
return code;
}
int32_t streamStateFuncGet_rocksdb(SStreamState* pState, const STupleKey* key, void** pVal, int32_t* pVLen) {
- int code = 0;
- STREAM_STATE_GET_ROCKSDB(pState, "func", key, pVal, pVLen);
- return 0;
+ int code = 0;
+ char* tVal = NULL;
+ size_t tValLen = 0;
+ STREAM_STATE_GET_ROCKSDB(pState, "func", key, tVal, &tValLen);
+ if (code != 0) {
+ taosMemoryFree(tVal);
+ return code;
+ }
+
+ if (pState->pResultRowStore.resultRowGet == NULL || pState->pExprSupp == NULL) {
+ *pVal = tVal;
+ *pVLen = tValLen;
+ return code;
+ }
+
+ size_t pValLen = 0;
+ code = (pState->pResultRowStore.resultRowGet)(pState->pExprSupp, tVal, tValLen, (char**)pVal, &pValLen);
+ *pVLen = (int32_t)pValLen;
+
+ taosMemoryFree(tVal);
+ return code;
}
int32_t streamStateFuncDel_rocksdb(SStreamState* pState, const STupleKey* key) {
int code = 0;
@@ -3563,7 +3649,20 @@ int32_t streamStateSessionPut_rocksdb(SStreamState* pState, const SSessionKey* k
if (value == NULL || vLen == 0) {
stError("streamStateSessionPut_rocksdb val: %p, len: %d", value, vLen);
}
- STREAM_STATE_PUT_ROCKSDB(pState, "sess", &sKey, value, vLen);
+ char* dst = NULL;
+ size_t size = 0;
+ if (pState->pResultRowStore.resultRowPut == NULL || pState->pExprSupp == NULL) {
+ STREAM_STATE_PUT_ROCKSDB(pState, "sess", &sKey, (void*)value, (int32_t)vLen);
+ return code;
+ }
+
+ code = (pState->pResultRowStore.resultRowPut)(pState->pExprSupp, value, vLen, &dst, &size);
+ if (code != 0) {
+ return code;
+ }
+ STREAM_STATE_PUT_ROCKSDB(pState, "sess", &sKey, dst, (int32_t)size);
+ taosMemoryFree(dst);
+
return code;
}
int32_t streamStateSessionGet_rocksdb(SStreamState* pState, SSessionKey* key, void** pVal, int32_t* pVLen) {
@@ -3574,7 +3673,7 @@ int32_t streamStateSessionGet_rocksdb(SStreamState* pState, SSessionKey* key, vo
void* tmp = NULL;
int32_t vLen = 0;
- code = streamStateSessionGetKVByCur_rocksdb(pCur, &resKey, &tmp, &vLen);
+ code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, &resKey, &tmp, &vLen);
if (code == 0 && key->win.skey == resKey.win.skey) {
*key = resKey;
@@ -3813,7 +3912,8 @@ SStreamStateCur* streamStateSessionSeekKeyPrev_rocksdb(SStreamState* pState, con
return pCur;
}
-int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey* pKey, void** pVal, int32_t* pVLen) {
+int32_t streamStateSessionGetKVByCur_rocksdb(SStreamState* pState, SStreamStateCur* pCur, SSessionKey* pKey,
+ void** pVal, int32_t* pVLen) {
if (!pCur) {
return -1;
}
@@ -3847,13 +3947,27 @@ int32_t streamStateSessionGetKVByCur_rocksdb(SStreamStateCur* pCur, SSessionKey*
return -1;
}
+ char* tVal = val;
+ size_t tVlen = len;
+
if (pVal != NULL) {
- *pVal = (char*)val;
+ if (pState != NULL && pState->pResultRowStore.resultRowGet != NULL && pState->pExprSupp != NULL) {
+ int code = (pState->pResultRowStore.resultRowGet)(pState->pExprSupp, val, len, (char**)&tVal, (size_t*)&tVlen);
+ if (code != 0) {
+ taosMemoryFree(val);
+ return code;
+ }
+ taosMemoryFree(val);
+ *pVal = (char*)tVal;
+ } else {
+ *pVal = (char*)tVal;
+ }
} else {
taosMemoryFree(val);
}
- if (pVLen != NULL) *pVLen = len;
+ if (pVLen != NULL) *pVLen = (int32_t)tVlen;
+
*pKey = pKTmp->key;
return 0;
}
@@ -3867,6 +3981,7 @@ int32_t streamStateFillPut_rocksdb(SStreamState* pState, const SWinKey* key, con
int32_t streamStateFillGet_rocksdb(SStreamState* pState, const SWinKey* key, void** pVal, int32_t* pVLen) {
int code = 0;
+
STREAM_STATE_GET_ROCKSDB(pState, "fill", key, pVal, pVLen);
return code;
}
@@ -4041,7 +4156,7 @@ int32_t streamStateSessionGetKeyByRange_rocksdb(SStreamState* pState, const SSes
c = stateSessionKeyCmpr(&sKey, sizeof(sKey), &iKey, sizeof(iKey));
SSessionKey resKey = *key;
- int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, &resKey, NULL, 0);
+ int32_t code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, &resKey, NULL, NULL);
if (code == 0 && sessionRangeKeyCmpr(key, &resKey) == 0) {
*curKey = resKey;
streamStateFreeCur(pCur);
@@ -4050,7 +4165,7 @@ int32_t streamStateSessionGetKeyByRange_rocksdb(SStreamState* pState, const SSes
if (c > 0) {
streamStateCurNext_rocksdb(pCur);
- code = streamStateSessionGetKVByCur_rocksdb(pCur, &resKey, NULL, 0);
+ code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, &resKey, NULL, NULL);
if (code == 0 && sessionRangeKeyCmpr(key, &resKey) == 0) {
*curKey = resKey;
streamStateFreeCur(pCur);
@@ -4058,7 +4173,7 @@ int32_t streamStateSessionGetKeyByRange_rocksdb(SStreamState* pState, const SSes
}
} else if (c < 0) {
streamStateCurPrev(pState, pCur);
- code = streamStateSessionGetKVByCur_rocksdb(pCur, &resKey, NULL, 0);
+ code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, &resKey, NULL, NULL);
if (code == 0 && sessionRangeKeyCmpr(key, &resKey) == 0) {
*curKey = resKey;
streamStateFreeCur(pCur);
@@ -4088,7 +4203,7 @@ int32_t streamStateSessionAddIfNotExist_rocksdb(SStreamState* pState, SSessionKe
}
SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentPrev_rocksdb(pState, key);
- int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, key, pVal, pVLen);
+ int32_t code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, key, pVal, pVLen);
if (code == 0) {
if (sessionRangeKeyCmpr(&searchKey, key) == 0) {
@@ -4105,7 +4220,7 @@ int32_t streamStateSessionAddIfNotExist_rocksdb(SStreamState* pState, SSessionKe
pCur = streamStateSessionSeekKeyNext_rocksdb(pState, key);
}
- code = streamStateSessionGetKVByCur_rocksdb(pCur, key, pVal, pVLen);
+ code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, key, pVal, pVLen);
if (code == 0) {
if (sessionRangeKeyCmpr(&searchKey, key) == 0) {
memcpy(tmp, *pVal, *pVLen);
@@ -4132,7 +4247,7 @@ void streamStateSessionClear_rocksdb(SStreamState* pState) {
SSessionKey delKey = {0};
void* buf = NULL;
int32_t size = 0;
- int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, &delKey, &buf, &size);
+ int32_t code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, &delKey, &buf, &size);
if (code == 0 && size > 0) {
memset(buf, 0, size);
// refactor later
@@ -4160,7 +4275,7 @@ int32_t streamStateStateAddIfNotExist_rocksdb(SStreamState* pState, SSessionKey*
}
SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentPrev_rocksdb(pState, key);
- int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, key, pVal, pVLen);
+ int32_t code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, key, pVal, pVLen);
if (code == 0) {
if (key->win.skey <= tmpKey.win.skey && tmpKey.win.ekey <= key->win.ekey) {
memcpy(tmp, *pVal, valSize);
@@ -4180,7 +4295,7 @@ int32_t streamStateStateAddIfNotExist_rocksdb(SStreamState* pState, SSessionKey*
pCur = streamStateSessionSeekKeyNext_rocksdb(pState, key);
}
taosMemoryFreeClear(*pVal);
- code = streamStateSessionGetKVByCur_rocksdb(pCur, key, pVal, pVLen);
+ code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, key, pVal, pVLen);
if (code == 0) {
void* stateKey = (char*)(*pVal) + (valSize - keyDataLen);
if (fn(pKeyData, stateKey) == true) {
@@ -4204,14 +4319,34 @@ _end:
#ifdef BUILD_NO_CALL
// partag cf
int32_t streamStatePutParTag_rocksdb(SStreamState* pState, int64_t groupId, const void* tag, int32_t tagLen) {
- int code = 0;
- STREAM_STATE_PUT_ROCKSDB(pState, "partag", &groupId, tag, tagLen);
+ int code = 0;
+ char* dst = NULL;
+ size_t size = 0;
+ if (pState->pResultRowStore.resultRowPut == NULL || pState->pExprSupp == NULL) {
+ STREAM_STATE_PUT_ROCKSDB(pState, "partag", &groupId, tag, tagLen);
+ return code;
+ }
+ code = (pState->pResultRowStore.resultRowPut)(pState->pExprSupp, value, vLen, &dst, &size);
+ if (code != 0) {
+ return code;
+ }
+ STREAM_STATE_PUT_ROCKSDB(pState, "partag", &groupId, dst, size);
+ taosMemoryFree(dst);
return code;
}
int32_t streamStateGetParTag_rocksdb(SStreamState* pState, int64_t groupId, void** tagVal, int32_t* tagLen) {
- int code = 0;
- STREAM_STATE_GET_ROCKSDB(pState, "partag", &groupId, tagVal, tagLen);
+ int code = 0;
+ char* tVal;
+ size_t tValLen = 0;
+ STREAM_STATE_GET_ROCKSDB(pState, "partag", &groupId, &tVal, &tValLen);
+ if (code != 0) {
+ taosMemoryFree(tVal);
+ return code;
+ }
+ code = (pState->pResultRowStore.resultRowGet)(pState->pExprSupp, tVal, tValLen, (char**)tagVal, (size_t*)tagLen);
+ taosMemoryFree(tVal);
+
return code;
}
#endif
@@ -4348,6 +4483,7 @@ void streamStateClearBatch(void* pBatch) { rocksdb_writebatch_clear((rocksdb_
void streamStateDestroyBatch(void* pBatch) { rocksdb_writebatch_destroy((rocksdb_writebatch_t*)pBatch); }
int32_t streamStatePutBatch(SStreamState* pState, const char* cfKeyName, rocksdb_writebatch_t* pBatch, void* key,
void* val, int32_t vlen, int64_t ttl) {
+ int32_t code = 0;
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
TAOS_UNUSED(atomic_add_fetch_64(&wrapper->dataWritten, 1));
@@ -4377,10 +4513,23 @@ int32_t streamStatePutBatch(SStreamState* pState, const char* cfKeyName, rocksdb
int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb_writebatch_t* pBatch, void* key,
void* val, int32_t vlen, int64_t ttl, void* tmpBuf) {
+ int32_t code = 0;
char buf[128] = {0};
+
+ char* dst = NULL;
+ size_t size = 0;
+ if (pState->pResultRowStore.resultRowPut == NULL || pState->pExprSupp == NULL) {
+ dst = val;
+ size = vlen;
+ } else {
+ code = (pState->pResultRowStore.resultRowPut)(pState->pExprSupp, val, vlen, &dst, &size);
+ if (code != 0) {
+ return code;
+ }
+ }
int32_t klen = ginitDict[cfIdx].enFunc((void*)key, buf);
char* ttlV = tmpBuf;
- int32_t ttlVLen = ginitDict[cfIdx].enValueFunc(val, vlen, ttl, &ttlV);
+ int32_t ttlVLen = ginitDict[cfIdx].enValueFunc(dst, size, ttl, &ttlV);
STaskDbWrapper* wrapper = pState->pTdbState->pOwner->pBackend;
@@ -4389,6 +4538,8 @@ int32_t streamStatePutBatchOptimize(SStreamState* pState, int32_t cfIdx, rocksdb
rocksdb_column_family_handle_t* pCf = wrapper->pCf[ginitDict[cfIdx].idx];
rocksdb_writebatch_put_cf((rocksdb_writebatch_t*)pBatch, pCf, buf, (size_t)klen, ttlV, (size_t)ttlVLen);
+ taosMemoryFree(dst);
+
if (tmpBuf == NULL) {
taosMemoryFree(ttlV);
}
@@ -4928,8 +5079,8 @@ int32_t dbChkpDumpTo(SDbChkp* p, char* dname, SArray* list) {
}
char content[256] = {0};
- nBytes = tsnprintf(content, sizeof(content), META_ON_S3_FORMATE, p->pCurrent, p->curChkpId, p->pManifest, p->curChkpId,
- "processVer", processId);
+ nBytes = tsnprintf(content, sizeof(content), META_ON_S3_FORMATE, p->pCurrent, p->curChkpId, p->pManifest,
+ p->curChkpId, "processVer", processId);
if (nBytes <= 0 || nBytes >= sizeof(content)) {
code = TSDB_CODE_OUT_OF_RANGE;
stError("chkp failed to format meta file: %s, reason: invalid msg", dstDir);
diff --git a/source/libs/stream/src/streamSessionState.c b/source/libs/stream/src/streamSessionState.c
index 7e3d8d59f9..536636533f 100644
--- a/source/libs/stream/src/streamSessionState.c
+++ b/source/libs/stream/src/streamSessionState.c
@@ -284,7 +284,7 @@ _end:
int32_t getSessionRowBuff(SStreamFileState* pFileState, void* pKey, int32_t keyLen, void** pVal, int32_t* pVLen,
int32_t* pWinCode) {
- SWinKey* pTmpkey = pKey;
+ SWinKey* pTmpkey = pKey;
SSessionKey pWinKey = {.groupId = pTmpkey->groupId, .win.skey = pTmpkey->ts, .win.ekey = pTmpkey->ts};
return getSessionWinResultBuff(pFileState, &pWinKey, 0, pVal, pVLen, pWinCode);
}
@@ -343,7 +343,8 @@ _end:
return code;
}
-int32_t getSessionFlushedBuff(SStreamFileState* pFileState, SSessionKey* pKey, void** pVal, int32_t* pVLen, int32_t* pWinCode) {
+int32_t getSessionFlushedBuff(SStreamFileState* pFileState, SSessionKey* pKey, void** pVal, int32_t* pVLen,
+ int32_t* pWinCode) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
SRowBuffPos* pNewPos = getNewRowPosForWrite(pFileState);
@@ -353,7 +354,7 @@ int32_t getSessionFlushedBuff(SStreamFileState* pFileState, SSessionKey* pKey, v
}
pNewPos->needFree = true;
pNewPos->beFlushed = true;
- void* pBuff = NULL;
+ void* pBuff = NULL;
(*pWinCode) = streamStateSessionGet_rocksdb(getStateFileStore(pFileState), pKey, &pBuff, pVLen);
if ((*pWinCode) != TSDB_CODE_SUCCESS) {
goto _end;
@@ -575,7 +576,7 @@ static void transformCursor(SStreamFileState* pFileState, SStreamStateCur* pCur)
static void checkAndTransformCursor(SStreamFileState* pFileState, const uint64_t groupId, SArray* pWinStates,
SStreamStateCur** ppCur) {
SSessionKey key = {.groupId = groupId};
- int32_t code = streamStateSessionGetKVByCur_rocksdb(*ppCur, &key, NULL, NULL);
+ int32_t code = streamStateSessionGetKVByCur_rocksdb(getStateFileStore(pFileState), *ppCur, &key, NULL, NULL);
if (taosArrayGetSize(pWinStates) > 0 &&
(code == TSDB_CODE_FAILED || sessionStateKeyCompare(&key, pWinStates, 0) >= 0)) {
if (!(*ppCur)) {
@@ -653,7 +654,7 @@ SStreamStateCur* countWinStateSeekKeyPrev(SStreamFileState* pFileState, const SS
SSessionKey key = {0};
void* pVal = NULL;
int len = 0;
- int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, &key, &pVal, &len);
+ int32_t code = streamStateSessionGetKVByCur_rocksdb(getStateFileStore(pFileState), pCur, &key, &pVal, &len);
if (code == TSDB_CODE_FAILED) {
streamStateFreeCur(pCur);
return pBuffCur;
@@ -667,7 +668,7 @@ SStreamStateCur* countWinStateSeekKeyPrev(SStreamFileState* pFileState, const SS
}
streamStateCurPrev(pFileStore, pCur);
while (1) {
- code = streamStateSessionGetKVByCur_rocksdb(pCur, &key, &pVal, &len);
+ code = streamStateSessionGetKVByCur_rocksdb(NULL, pCur, &key, &pVal, &len);
if (code == TSDB_CODE_FAILED) {
streamStateCurNext(pFileStore, pCur);
return pCur;
@@ -710,7 +711,7 @@ int32_t sessionWinStateGetKVByCur(SStreamStateCur* pCur, SSessionKey* pKey, void
*pKey = *(SSessionKey*)(pPos->pKey);
} else {
void* pData = NULL;
- code = streamStateSessionGetKVByCur_rocksdb(pCur, pKey, &pData, pVLen);
+ code = streamStateSessionGetKVByCur_rocksdb(getStateFileStore(pCur->pStreamFileState), pCur, pKey, &pData, pVLen);
if (taosArrayGetSize(pWinStates) > 0 &&
(code == TSDB_CODE_FAILED || sessionStateRangeKeyCompare(pKey, pWinStates, 0) >= 0)) {
transformCursor(pCur->pStreamFileState, pCur);
@@ -915,7 +916,7 @@ _end:
int32_t getCountWinStateFromDisc(SStreamState* pState, SSessionKey* pKey, void** pVal, int32_t* pVLen) {
SStreamStateCur* pCur = streamStateSessionSeekKeyCurrentNext_rocksdb(pState, pKey);
- int32_t code = streamStateSessionGetKVByCur_rocksdb(pCur, pKey, pVal, pVLen);
+ int32_t code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, pKey, pVal, pVLen);
streamStateFreeCur(pCur);
if (code == TSDB_CODE_SUCCESS) {
return code;
@@ -923,7 +924,7 @@ int32_t getCountWinStateFromDisc(SStreamState* pState, SSessionKey* pKey, void**
pCur = streamStateSessionSeekKeyPrev_rocksdb(pState, pKey);
}
- code = streamStateSessionGetKVByCur_rocksdb(pCur, pKey, pVal, pVLen);
+ code = streamStateSessionGetKVByCur_rocksdb(pState, pCur, pKey, pVal, pVLen);
streamStateFreeCur(pCur);
return code;
}
@@ -1060,7 +1061,8 @@ _end:
return code;
}
-int32_t createCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, COUNT_TYPE winCount, void** pVal, int32_t* pVLen) {
+int32_t createCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey, COUNT_TYPE winCount, void** pVal,
+ int32_t* pVLen) {
SSessionKey* pWinKey = pKey;
const TSKEY gap = 0;
int32_t code = TSDB_CODE_SUCCESS;
@@ -1098,7 +1100,7 @@ int32_t createCountWinResultBuff(SStreamFileState* pFileState, SSessionKey* pKey
QUERY_CHECK_CODE(code, lino, _end);
}
qDebug("===stream===0 get state win:%" PRId64 ",%" PRId64 " from disc, res %d", pWinKey->win.skey,
- pWinKey->win.ekey, code_file);
+ pWinKey->win.ekey, code_file);
}
} else {
code = addNewSessionWindow(pFileState, pWinStates, pWinKey, (SRowBuffPos**)pVal);
diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c
index 45a36bd451..cfe476540c 100644
--- a/source/libs/stream/src/streamState.c
+++ b/source/libs/stream/src/streamState.c
@@ -302,7 +302,7 @@ SStreamStateCur* streamStateGetAndCheckCur(SStreamState* pState, SWinKey* key) {
}
int32_t streamStateGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) {
- return streamStateGetKVByCur_rocksdb(pCur, pKey, pVal, pVLen);
+ return streamStateGetKVByCur_rocksdb(getStateFileStore(pCur->pStreamFileState), pCur, pKey, pVal, pVLen);
}
int32_t streamStateFillGetKVByCur(SStreamStateCur* pCur, SWinKey* pKey, const void** pVal, int32_t* pVLen) {
@@ -529,6 +529,9 @@ void streamStateCopyBackend(SStreamState* src, SStreamState* dst) {
}
dst->dump = 1;
dst->pTdbState->pOwner->pBackend = src->pTdbState->pOwner->pBackend;
+ dst->pResultRowStore.resultRowPut = src->pResultRowStore.resultRowPut;
+ dst->pResultRowStore.resultRowGet = src->pResultRowStore.resultRowGet;
+ dst->pExprSupp = src->pExprSupp;
return;
}
SStreamStateCur* createStreamStateCursor() {
diff --git a/source/libs/stream/src/tstreamFileState.c b/source/libs/stream/src/tstreamFileState.c
index cf5f1b2b91..424845e4f2 100644
--- a/source/libs/stream/src/tstreamFileState.c
+++ b/source/libs/stream/src/tstreamFileState.c
@@ -698,7 +698,7 @@ void flushSnapshot(SStreamFileState* pFileState, SStreamSnapshot* pSnapshot, boo
int idx = streamStateGetCfIdx(pFileState->pFileStore, pFileState->cfName);
- int32_t len = pFileState->rowSize + sizeof(uint64_t) + sizeof(int32_t) + 64;
+ int32_t len = (pFileState->rowSize + sizeof(uint64_t) + sizeof(int32_t) + 64) * 2;
char* buf = taosMemoryCalloc(1, len);
if (!buf) {
code = terrno;
@@ -849,7 +849,7 @@ int32_t recoverSesssion(SStreamFileState* pFileState, int64_t ckId) {
void* pVal = NULL;
int32_t vlen = 0;
SSessionKey key = {0};
- winRes = streamStateSessionGetKVByCur_rocksdb(pCur, &key, &pVal, &vlen);
+ winRes = streamStateSessionGetKVByCur_rocksdb(getStateFileStore(pFileState), pCur, &key, &pVal, &vlen);
if (winRes != TSDB_CODE_SUCCESS) {
break;
}
@@ -903,7 +903,7 @@ int32_t recoverSnapshot(SStreamFileState* pFileState, int64_t ckId) {
QUERY_CHECK_CODE(code, lino, _end);
}
- winCode = streamStateGetKVByCur_rocksdb(pCur, pNewPos->pKey, (const void**)&pVal, &vlen);
+ winCode = streamStateGetKVByCur_rocksdb(getStateFileStore(pFileState), pCur, pNewPos->pKey, (const void**)&pVal, &vlen);
if (winCode != TSDB_CODE_SUCCESS || pFileState->getTs(pNewPos->pKey) < pFileState->flushMark) {
destroyRowBuffPos(pNewPos);
SListNode* pNode = tdListPopTail(pFileState->usedBuffs);
@@ -912,6 +912,7 @@ int32_t recoverSnapshot(SStreamFileState* pFileState, int64_t ckId) {
break;
}
if (vlen != pFileState->rowSize) {
+ qError("row size mismatch, expect:%d, actual:%d", pFileState->rowSize, vlen);
code = TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
QUERY_CHECK_CODE(code, lino, _end);
}
diff --git a/source/libs/stream/test/backendTest.cpp b/source/libs/stream/test/backendTest.cpp
index e7e7149882..1518d22fe9 100644
--- a/source/libs/stream/test/backendTest.cpp
+++ b/source/libs/stream/test/backendTest.cpp
@@ -228,17 +228,17 @@ void *backendOpen() {
memset(&key, 0, sizeof(key));
char *val = NULL;
int32_t vlen = 0;
- code = streamStateSessionGetKVByCur_rocksdb(pCurr, &key, (void **)&val, &vlen);
+ code = streamStateSessionGetKVByCur_rocksdb(NULL, pCurr, &key, (void **)&val, &vlen);
ASSERT(code == 0);
pCurr = streamStateSessionSeekKeyPrev_rocksdb(p, &key);
- code = streamStateSessionGetKVByCur_rocksdb(pCurr, &key, (void **)&val, &vlen);
+ code = streamStateSessionGetKVByCur_rocksdb(NULL, pCurr, &key, (void **)&val, &vlen);
ASSERT(code == 0);
ASSERT(key.groupId == 0 && key.win.ekey == tsArray[tsArray.size() - 2]);
pCurr = streamStateSessionSeekKeyNext_rocksdb(p, &key);
- code = streamStateSessionGetKVByCur_rocksdb(pCurr, &key, (void **)&val, &vlen);
+ code = streamStateSessionGetKVByCur_rocksdb(NULL, pCurr, &key, (void **)&val, &vlen);
ASSERT(code == 0);
ASSERT(vlen == strlen("Value"));
ASSERT(key.groupId == 0 && key.win.skey == tsArray[tsArray.size() - 1]);
diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h
index 95ea6944e3..3a4f11ac81 100644
--- a/source/libs/transport/inc/transComm.h
+++ b/source/libs/transport/inc/transComm.h
@@ -114,6 +114,7 @@ typedef struct SExHandle {
void* handle;
int64_t refId;
void* pThrd;
+ int8_t pThrdIdx;
queue q;
int8_t inited;
SRWLatch latch;
@@ -135,57 +136,33 @@ typedef struct SCvtAddr {
bool cvt;
} SCvtAddr;
-typedef struct {
- SEpSet epSet; // ip list provided by app
- SEpSet origEpSet;
- void* ahandle; // handle provided by app
- tmsg_t msgType; // message type
- int8_t connType; // connection type cli/srv
-
- STransCtx appCtx; //
- STransMsg* pRsp; // for synchronous API
- tsem_t* pSem; // for synchronous API
- STransSyncMsg* pSyncMsg; // for syncchronous with timeout API
- int64_t syncMsgRef;
- SCvtAddr cvtAddr;
-
- int32_t retryMinInterval;
- int32_t retryMaxInterval;
- int32_t retryStepFactor;
- int64_t retryMaxTimeout;
- int64_t retryInitTimestamp;
- int64_t retryNextInterval;
- bool retryInit;
- int32_t retryStep;
- int8_t epsetRetryCnt;
- int32_t retryCode;
-
- void* task;
- int hThrdIdx;
-} STransConnCtx;
-
#pragma pack(push, 1)
+typedef struct {
+ int8_t inUse;
+ int8_t numOfEps;
+ SEp eps[];
+} SReqEpSet;
+
#define TRANS_VER 2
typedef struct {
- char version : 4; // RPC version
- char comp : 2; // compression algorithm, 0:no compression 1:lz4
- char noResp : 2; // noResp bits, 0: resp, 1: resp
- char persist : 2; // persist handle,0: no persit, 1: persist handle
- char release : 2;
+ char version : 4; // RPC version
+ char comp : 2; // compression algorithm, 0:no compression 1:lz4
+ char noResp : 2; // noResp bits, 0: resp, 1: resp
+ char withUserInfo : 2; // 0: sent user info or not
char secured : 2;
char spi : 2;
char hasEpSet : 2; // contain epset or not, 0(default): no epset, 1: contain epset
uint64_t timestamp;
- char user[TSDB_UNI_LEN];
int32_t compatibilityVer;
uint32_t magicNum;
STraceId traceId;
- uint64_t ahandle; // ahandle assigned by client
- uint32_t code; // del later
+ int64_t qid;
+ uint32_t code; // del later
uint32_t msgType;
int32_t msgLen;
+ int64_t seqNum;
uint8_t content[0]; // message body starts from here
} STransMsgHead;
@@ -206,6 +183,35 @@ typedef struct {
#pragma pack(pop)
+int32_t transCreateReqEpsetFromUserEpset(const SEpSet* pEpset, SReqEpSet** pReqEpSet);
+int32_t transCreateUserEpsetFromReqEpset(const SReqEpSet* pReqEpSet, SEpSet* pEpSet);
+
+int32_t transValidReqEpset(SReqEpSet* pReqEpSet);
+
+typedef struct {
+ SReqEpSet* epSet; // ip list provided by app
+ SReqEpSet* origEpSet;
+ void* ahandle; // handle provided by app
+ tmsg_t msgType; // message type
+
+ STransCtx userCtx; //
+ STransMsg* pRsp; // for synchronous API
+ tsem_t* pSem; // for synchronous API
+ STransSyncMsg* pSyncMsg; // for syncchronous with timeout API
+ int64_t syncMsgRef;
+ SCvtAddr* pCvtAddr;
+
+ int64_t retryInitTimestamp;
+ int64_t retryNextInterval;
+ int64_t retryMaxTimeout;
+ int32_t retryMinInterval;
+ int32_t retryMaxInterval;
+ int32_t retryStepFactor;
+ int32_t retryStep;
+ int32_t retryCode;
+ int8_t retryInit;
+ int8_t epsetRetryCnt;
+} SReqCtx;
typedef enum { Normal, Quit, Release, Register, Update, FreeById } STransMsgType;
typedef enum { ConnNormal, ConnAcquire, ConnRelease, ConnBroken, ConnInPool } ConnStatus;
@@ -272,24 +278,24 @@ bool transAsyncPoolIsEmpty(SAsyncPool* pool);
} \
} while (0)
-#define ASYNC_CHECK_HANDLE(exh1, id) \
- do { \
- if (id > 0) { \
- SExHandle* exh2 = transAcquireExHandle(transGetSvrRefMgt(), id); \
- if (exh2 == NULL || id != exh2->refId) { \
- tDebug("ref:%" PRId64 " already released", id); \
- code = terrno; \
- goto _return1; \
- } \
- } else { \
- tDebug("invalid handle to release"); \
- goto _return2; \
- } \
+#define ASYNC_CHECK_HANDLE(idMgt, id, exh1) \
+ do { \
+ if (id > 0) { \
+ SExHandle* exh2 = transAcquireExHandle(idMgt, id); \
+ if (exh2 == NULL || exh1 != exh2 || (exh2 != NULL && exh2->refId != id)) { \
+ tError("handle not match, exh1:%p, exh2:%p, refId:%"PRId64"", exh1, exh2, id); \
+ code = TSDB_CODE_INVALID_MSG; \
+ goto _return1; \
+ } \
+ } else { \
+ tError("invalid handle to release"); \
+ goto _return2; \
+ } \
} while (0)
int32_t transInitBuffer(SConnBuffer* buf);
int32_t transClearBuffer(SConnBuffer* buf);
-int32_t transDestroyBuffer(SConnBuffer* buf);
+void transDestroyBuffer(SConnBuffer* buf);
int32_t transAllocBuffer(SConnBuffer* connBuf, uv_buf_t* uvBuf);
bool transReadComplete(SConnBuffer* connBuf);
int32_t transResetBuffer(SConnBuffer* connBuf, int8_t resetBuf);
@@ -300,30 +306,31 @@ int32_t transSetConnOption(uv_tcp_t* stream, int keepalive);
void transRefSrvHandle(void* handle);
void transUnrefSrvHandle(void* handle);
-void transRefCliHandle(void* handle);
-void transUnrefCliHandle(void* handle);
+void transRefCliHandle(void* handle);
+int32_t transUnrefCliHandle(void* handle);
+int32_t transGetRefCount(void* handle);
int32_t transReleaseCliHandle(void* handle);
int32_t transReleaseSrvHandle(void* handle);
-int32_t transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pMsg, STransCtx* pCtx);
-int32_t transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pMsg, STransMsg* pRsp);
-int32_t transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pMsg, STransMsg* pRsp, int8_t* epUpdated,
+int32_t transSendRequest(void* pInit, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* pCtx);
+int32_t transSendRecv(void* pInit, const SEpSet* pEpSet, STransMsg* pReq, STransMsg* pRsp);
+int32_t transSendRecvWithTimeout(void* pInit, SEpSet* pEpSet, STransMsg* pReq, STransMsg* pRsp, int8_t* epUpdated,
int32_t timeoutMs);
-int32_t transSendRequestWithId(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId);
-int32_t transFreeConnById(void* shandle, int64_t transpointId);
+int32_t transSendRequestWithId(void* pInit, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId);
+int32_t transFreeConnById(void* pInit, int64_t transpointId);
int32_t transSendResponse(const STransMsg* msg);
int32_t transRegisterMsg(const STransMsg* msg);
-int32_t transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn);
-int32_t transSetIpWhiteList(void* shandle, void* arg, FilteFunc* func);
+int32_t transSetDefaultAddr(void* pInit, const char* ip, const char* fqdn);
+int32_t transSetIpWhiteList(void* pInit, void* arg, FilteFunc* func);
-int32_t transSockInfo2Str(struct sockaddr* sockname, char* dst);
+void transSockInfo2Str(struct sockaddr* sockname, char* dst);
int32_t transAllocHandle(int64_t* refId);
-void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
-void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
+void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* pInit);
+void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* pInit);
void transCloseClient(void* arg);
void transCloseServer(void* arg);
@@ -336,33 +343,29 @@ void* transCtxDumpVal(STransCtx* ctx, int32_t key);
void* transCtxDumpBrokenlinkVal(STransCtx* ctx, int32_t* msgType);
// request list
-typedef struct STransReq {
- queue q;
- uv_write_t wreq;
-} STransReq;
-
-void transReqQueueInit(queue* q);
-void* transReqQueuePush(queue* q);
-void* transReqQueueRemove(void* arg);
-void transReqQueueClear(queue* q);
+typedef struct SWriteReq {
+ queue node; // req queue node
+ void* conn;
+} SWriteReq;
// queue sending msgs
typedef struct {
- SArray* q;
- void (*freeFunc)(const void* arg);
+ queue node;
+ void (*freeFunc)(void* arg);
+ int32_t size;
} STransQueue;
/*
* init queue
* note: queue'size is small, default 1
*/
-int32_t transQueueInit(STransQueue* queue, void (*freeFunc)(const void* arg));
+int32_t transQueueInit(STransQueue* queue, void (*freeFunc)(void* arg));
/*
* put arg into queue
* if queue'size > 1, return false; else return true
*/
-bool transQueuePush(STransQueue* queue, void* arg);
+void transQueuePush(STransQueue* queue, void* arg);
/*
* the size of queue
*/
@@ -375,10 +378,25 @@ void* transQueuePop(STransQueue* queue);
* get ith from queue
*/
void* transQueueGet(STransQueue* queue, int i);
+/*
+ * head elm from queue
+ */
+
+void* tranQueueHead(STransQueue* q);
+/*
+ * remove all match elm from queue
+ */
+void transQueueRemoveByFilter(STransQueue* q, bool (*filter)(void* e, void* arg), void* arg, void* dst, int32_t size);
/*
* rm ith from queue
*/
+
void* transQueueRm(STransQueue* queue, int i);
+/*
+ * remove el from queue
+ */
+
+void transQueueRemove(STransQueue* q, void* e);
/*
* queue empty or not
*/
@@ -418,9 +436,9 @@ void transDQDestroy(SDelayQueue* queue, void (*freeFunc)(void* arg));
SDelayTask* transDQSched(SDelayQueue* queue, void (*func)(void* arg), void* arg, uint64_t timeoutMs);
void transDQCancel(SDelayQueue* queue, SDelayTask* task);
-bool transEpSetIsEqual(SEpSet* a, SEpSet* b);
+bool transReqEpsetIsEqual(SReqEpSet* a, SReqEpSet* b);
-bool transEpSetIsEqual2(SEpSet* a, SEpSet* b);
+bool transCompareReqAndUserEpset(SReqEpSet* a, SEpSet* b);
/*
* init global func
*/
@@ -432,14 +450,14 @@ void transPrintEpSet(SEpSet* pEpSet);
void transFreeMsg(void* msg);
int32_t transCompressMsg(char* msg, int32_t len);
-int32_t transDecompressMsg(char** msg, int32_t len);
+int32_t transDecompressMsg(char** msg, int32_t* len);
int32_t transOpenRefMgt(int size, void (*func)(void*));
void transCloseRefMgt(int32_t refMgt);
int64_t transAddExHandle(int32_t refMgt, void* p);
-int32_t transRemoveExHandle(int32_t refMgt, int64_t refId);
+void transRemoveExHandle(int32_t refMgt, int64_t refId);
void* transAcquireExHandle(int32_t refMgt, int64_t refId);
-int32_t transReleaseExHandle(int32_t refMgt, int64_t refId);
+void transReleaseExHandle(int32_t refMgt, int64_t refId);
void transDestroyExHandle(void* handle);
int32_t transGetRefMgt();
@@ -465,6 +483,33 @@ int32_t subnetDebugInfoToBuf(SubnetUtils* pUtils, char* buf);
int32_t transUtilSIpRangeToStr(SIpV4Range* pRange, char* buf);
int32_t transUtilSWhiteListToStr(SIpWhiteList* pWhiteList, char** ppBuf);
+enum { REQ_STATUS_INIT = 0, REQ_STATUS_PROCESSING };
+
+#if defined(WINDOWS) || defined(DARWIN)
+#define BUFFER_LIMIT 1
+#define STATE_BUFFER_LIMIT 1
+#else
+#define BUFFER_LIMIT 4
+#define STATE_BUFFER_LIMIT 8
+#endif
+
+#define HEAP_MISS_HIT_LIMIT 100000
+#define READ_TIMEOUT 100000
+
+typedef struct {
+ queue node; // queue for write
+ queue q; // queue for reqs
+ uv_write_t wreq;
+ void* arg;
+} SWReqsWrapper;
+
+int32_t initWQ(queue* wq);
+void destroyWQ(queue* wq);
+uv_write_t* allocWReqFromWQ(queue* wq, void* arg);
+
+void freeWReqToWQ(queue* wq, SWReqsWrapper* w);
+
+int32_t transSetReadOption(uv_handle_t* handle);
#ifdef __cplusplus
}
#endif
diff --git a/source/libs/transport/inc/transportInt.h b/source/libs/transport/inc/transportInt.h
index 703a4dde3e..39afb29342 100644
--- a/source/libs/transport/inc/transportInt.h
+++ b/source/libs/transport/inc/transportInt.h
@@ -32,8 +32,8 @@
extern "C" {
#endif
-void* taosInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
-void* taosInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle);
+void* taosInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* pInit);
+void* taosInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* pInit);
void taosCloseServer(void* arg);
void taosCloseClient(void* arg);
@@ -70,12 +70,16 @@ typedef struct {
int32_t connLimitNum;
int8_t connLimitLock; // 0: no lock. 1. lock
int8_t supportBatch; // 0: no batch, 1: support batch
- int32_t batchSize;
+ int32_t shareConnLimit;
+ int8_t optBatchFetch;
int32_t timeToGetConn;
int index;
void* parent;
void* tcphandle; // returned handle from TCP initialization
int64_t refId;
+ int8_t shareConn;
+ int8_t startReadTimer;
+ int64_t readTimeout;
TdThreadMutex mutex;
} SRpcInfo;
diff --git a/source/libs/transport/src/trans.c b/source/libs/transport/src/trans.c
index 9526c0ee9e..de129773a0 100644
--- a/source/libs/transport/src/trans.c
+++ b/source/libs/transport/src/trans.c
@@ -15,13 +15,13 @@
#include "transComm.h"
-void* (*taosInitHandle[])(uint32_t ip, uint32_t port, char* label, int32_t numOfThreads, void* fp, void* shandle) = {
+void* (*taosInitHandle[])(uint32_t ip, uint32_t port, char* label, int32_t numOfThreads, void* fp, void* pInit) = {
transInitServer, transInitClient};
void (*taosCloseHandle[])(void* arg) = {transCloseServer, transCloseClient};
void (*taosRefHandle[])(void* handle) = {transRefSrvHandle, transRefCliHandle};
-void (*taosUnRefHandle[])(void* handle) = {transUnrefSrvHandle, transUnrefCliHandle};
+void (*taosUnRefHandle[])(void* handle) = {transUnrefSrvHandle, NULL};
int (*transReleaseHandle[])(void* handle) = {transReleaseSrvHandle, transReleaseCliHandle};
@@ -42,6 +42,8 @@ void* rpcOpen(const SRpcInit* pInit) {
if (pRpc == NULL) {
TAOS_CHECK_GOTO(terrno, NULL, _end);
}
+
+ pRpc->startReadTimer = pInit->startReadTimer;
if (pInit->label) {
int len = strlen(pInit->label) > sizeof(pRpc->label) ? sizeof(pRpc->label) : strlen(pInit->label);
memcpy(pRpc->label, pInit->label, len);
@@ -77,7 +79,15 @@ void* rpcOpen(const SRpcInit* pInit) {
pRpc->connLimitLock = pInit->connLimitLock;
pRpc->supportBatch = pInit->supportBatch;
- pRpc->batchSize = pInit->batchSize;
+ pRpc->shareConnLimit = pInit->shareConnLimit;
+ if (pRpc->shareConnLimit <= 0) {
+ pRpc->shareConnLimit = BUFFER_LIMIT;
+ }
+
+ pRpc->readTimeout = pInit->readTimeout;
+ if (pRpc->readTimeout < 0) {
+ pRpc->readTimeout = INT64_MAX;
+ }
pRpc->numOfThreads = pInit->numOfThreads > TSDB_MAX_RPC_THREADS ? TSDB_MAX_RPC_THREADS : pInit->numOfThreads;
if (pRpc->numOfThreads <= 0) {
@@ -115,6 +125,8 @@ void* rpcOpen(const SRpcInit* pInit) {
int64_t refId = transAddExHandle(transGetInstMgt(), pRpc);
void* tmp = transAcquireExHandle(transGetInstMgt(), refId);
pRpc->refId = refId;
+
+ pRpc->shareConn = pInit->shareConn;
return (void*)refId;
_end:
taosMemoryFree(pRpc);
@@ -127,9 +139,8 @@ void rpcClose(void* arg) {
if (arg == NULL) {
return;
}
- TAOS_UNUSED(transRemoveExHandle(transGetInstMgt(), (int64_t)arg));
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)arg));
-
+ transRemoveExHandle(transGetInstMgt(), (int64_t)arg);
+ transReleaseExHandle(transGetInstMgt(), (int64_t)arg);
tInfo("end to close rpc");
return;
}
@@ -175,29 +186,29 @@ void* rpcReallocCont(void* ptr, int64_t contLen) {
return st + TRANS_MSG_OVERHEAD;
}
-int32_t rpcSendRequest(void* shandle, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid) {
- return transSendRequest(shandle, pEpSet, pMsg, NULL);
+int32_t rpcSendRequest(void* pInit, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid) {
+ return transSendRequest(pInit, pEpSet, pMsg, NULL);
}
-int32_t rpcSendRequestWithCtx(void* shandle, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid, SRpcCtx* pCtx) {
+int32_t rpcSendRequestWithCtx(void* pInit, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid, SRpcCtx* pCtx) {
if (pCtx != NULL || pMsg->info.handle != 0 || pMsg->info.noResp != 0 || pRid == NULL) {
- return transSendRequest(shandle, pEpSet, pMsg, pCtx);
+ return transSendRequest(pInit, pEpSet, pMsg, pCtx);
} else {
- return transSendRequestWithId(shandle, pEpSet, pMsg, pRid);
+ return transSendRequestWithId(pInit, pEpSet, pMsg, pRid);
}
}
-int32_t rpcSendRequestWithId(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId) {
- return transSendRequestWithId(shandle, pEpSet, pReq, transpointId);
+int32_t rpcSendRequestWithId(void* pInit, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId) {
+ return transSendRequestWithId(pInit, pEpSet, pReq, transpointId);
}
-int32_t rpcSendRecv(void* shandle, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp) {
- return transSendRecv(shandle, pEpSet, pMsg, pRsp);
+int32_t rpcSendRecv(void* pInit, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp) {
+ return transSendRecv(pInit, pEpSet, pMsg, pRsp);
}
-int32_t rpcSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp, int8_t* epUpdated,
+int32_t rpcSendRecvWithTimeout(void* pInit, SEpSet* pEpSet, SRpcMsg* pMsg, SRpcMsg* pRsp, int8_t* epUpdated,
int32_t timeoutMs) {
- return transSendRecvWithTimeout(shandle, pEpSet, pMsg, pRsp, epUpdated, timeoutMs);
+ return transSendRecvWithTimeout(pInit, pEpSet, pMsg, pRsp, epUpdated, timeoutMs);
}
-int32_t rpcFreeConnById(void* shandle, int64_t connId) { return transFreeConnById(shandle, connId); }
+int32_t rpcFreeConnById(void* pInit, int64_t connId) { return transFreeConnById(pInit, connId); }
int32_t rpcSendResponse(const SRpcMsg* pMsg) { return transSendResponse(pMsg); }
diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c
index c3f9819119..18bedab5c7 100644
--- a/source/libs/transport/src/transCli.c
+++ b/source/libs/transport/src/transCli.c
@@ -13,8 +13,10 @@
*/
// clang-format off
+#include "taoserror.h"
#include "transComm.h"
#include "tmisce.h"
+#include "transLog.h"
// clang-format on
typedef struct {
@@ -23,9 +25,9 @@ typedef struct {
} SMsgList;
typedef struct SConnList {
- queue conns;
- int32_t size;
- SMsgList* list;
+ queue conns;
+ int32_t size;
+ int32_t totaSize;
} SConnList;
typedef struct {
@@ -47,23 +49,23 @@ typedef struct {
queue wq;
queue listq;
int32_t wLen;
- int32_t batchSize; //
+ int32_t shareConnLimit; //
int32_t batch;
SCliBatchList* pList;
} SCliBatch;
typedef struct SCliConn {
- T_REF_DECLARE()
+ int32_t ref;
uv_connect_t connReq;
uv_stream_t* stream;
- queue wreqQueue;
uv_timer_t* timer; // read timer, forbidden
void* hostThrd;
SConnBuffer readBuf;
- STransQueue cliMsgs;
+ STransQueue reqsToSend;
+ STransQueue reqsSentOut;
queue q;
SConnList* list;
@@ -76,6 +78,9 @@ typedef struct SCliConn {
SDelayTask* task;
+ HeapNode node; // for heap
+ int8_t inHeap;
+ int32_t reqRefCnt;
uint32_t clientIp;
uint32_t serverIp;
@@ -83,20 +88,53 @@ typedef struct SCliConn {
char src[32];
char dst[32];
- int64_t refId;
+ char* ipStr;
+ int32_t port;
+
+ int64_t seq;
+
+ int8_t registered;
+ int8_t connnected;
+ SHashObj* pQTable;
+ int8_t userInited;
+ void* pInitUserReq;
+
+ void* heap; // point to req conn heap
+ int32_t heapMissHit;
+ int64_t lastAddHeapTime;
+ int8_t forceDelFromHeap;
+
+ uv_buf_t* buf;
+ int32_t bufSize;
+ int32_t readerStart;
+
+ queue wq; // uv_write_t queue
+
+ queue batchSendq;
+ int8_t inThreadSendq;
+
} SCliConn;
-typedef struct SCliMsg {
- STransConnCtx* ctx;
- STransMsg msg;
- queue q;
- STransMsgType type;
+typedef struct {
+ SCliConn* conn;
+ void* arg;
+} SReqState;
- int64_t refId;
- uint64_t st;
- int sent; //(0: no send, 1: alread sent)
- queue seqq;
-} SCliMsg;
+typedef struct {
+ int64_t seq;
+ int32_t msgType;
+} SFiterArg;
+typedef struct SCliReq {
+ SReqCtx* ctx;
+ queue q;
+ STransMsgType type;
+ uint64_t st;
+ int64_t seq;
+ int32_t sent; //(0: no send, 1: alread sent)
+ STransMsg msg;
+ int8_t inRetry;
+
+} SCliReq;
typedef struct SCliThrd {
TdThread thread; // tid
@@ -113,18 +151,28 @@ typedef struct SCliThrd {
SDelayQueue* timeoutQueue;
SDelayQueue* waitConnQueue;
uint64_t nextTimeout; // next timeout
- STrans* pTransInst; //
+ STrans* pInst; //
- int connCount;
void (*destroyAhandleFp)(void* ahandle);
SHashObj* fqdn2ipCache;
- SCvtAddr cvtAddr;
+ SCvtAddr* pCvtAddr;
SHashObj* failFastCache;
SHashObj* batchCache;
+ SHashObj* connHeapCache;
- SCliMsg* stopMsg;
+ SCliReq* stopMsg;
bool quit;
+
+ int32_t (*initCb)(void* arg, SCliReq* pReq, STransMsg* pResp);
+ int32_t (*notifyCb)(void* arg, SCliReq* pReq, STransMsg* pResp);
+ int32_t (*notifyExceptCb)(void* arg, SCliReq* pReq, STransMsg* pResp);
+
+ SHashObj* pIdConnTable; //
+
+ SArray* pQIdBuf; // tmp buf to avoid alloc buf;
+ queue batchSendSet;
+ int8_t thrdInited;
} SCliThrd;
typedef struct SCliObj {
@@ -144,14 +192,22 @@ typedef struct {
// conn pool
// add expire timeout and capacity limit
-static void* createConnPool(int size);
-static void* destroyConnPool(SCliThrd* thread);
-static SCliConn* getConnFromPool(SCliThrd* thread, char* key, bool* exceed);
-static void addConnToPool(void* pool, SCliConn* conn);
-static void doCloseIdleConn(void* param);
-
+static void* createConnPool(int size);
+static void* destroyConnPool(SCliThrd* thread);
+static void addConnToPool(void* pool, SCliConn* conn);
+static void doCloseIdleConn(void* param);
+static int32_t cliCreateConn2(SCliThrd* pThrd, SCliReq* pReq, SCliConn** pConn);
+static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn, char* ip, int port);
+static int32_t cliDoConn(SCliThrd* pThrd, SCliConn* conn);
+static void cliBatchSendCb(uv_write_t* req, int status);
+void cliBatchSendImpl(SCliConn* pConn);
+static int32_t cliBatchSend(SCliConn* conn, int8_t direct);
+void cliConnCheckTimoutMsg(SCliConn* conn);
+bool cliConnRmReleaseReq(SCliConn* conn, STransMsgHead* pHead);
// register conn timer
static void cliConnTimeout(uv_timer_t* handle);
+
+void cliConnTimeout__checkReq(uv_timer_t* handle);
// register timer for read
static void cliReadTimeoutCb(uv_timer_t* handle);
// register timer in each thread to clear expire conn
@@ -161,70 +217,75 @@ static FORCE_INLINE void cliAllocRecvBufferCb(uv_handle_t* handle, size_t sugges
// callback after recv nbytes from socket
static void cliRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf);
// callback after send data to socket
-static void cliSendCb(uv_write_t* req, int status);
+// static void cliSendCb(uv_write_t* req, int status);
// callback after conn to server
static void cliConnCb(uv_connect_t* req, int status);
static void cliAsyncCb(uv_async_t* handle);
-static void cliIdleCb(uv_idle_t* handle);
-
-static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd);
-static void cliSendBatchCb(uv_write_t* req, int status);
SCliBatch* cliGetHeadFromList(SCliBatchList* pList);
-static bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead);
+static void destroyCliConnQTable(SCliConn* conn);
-static int32_t allocConnRef(SCliConn* conn, bool update);
+static void cliHandleException(SCliConn* conn);
-static int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg);
+static int cliNotifyCb(SCliConn* pConn, SCliReq* pReq, STransMsg* pResp);
+void cliResetConnTimer(SCliConn* conn);
-static int32_t cliCreateConn(SCliThrd* thrd, SCliConn** pCliConn);
-static void cliDestroyConn(SCliConn* pConn, bool clear /*clear tcp handle or not*/);
-static void cliDestroy(uv_handle_t* handle);
-static void cliSend(SCliConn* pConn);
-static void cliSendBatch(SCliConn* pConn);
-static void cliDestroyConnMsgs(SCliConn* conn, bool destroy);
+static void cliDestroyConn(SCliConn* pConn, bool clear /*clear tcp handle or not*/);
+static void cliDestroy(uv_handle_t* handle);
-static void doFreeTimeoutMsg(void* param);
-static int32_t cliPreCheckSessionLimitForMsg(SCliThrd* pThrd, char* addr, SCliMsg** pMsg);
+static void cliDestroyConnMsgs(SCliConn* conn, bool destroy);
+
+static void doFreeTimeoutMsg(void* param);
static void cliDestroyBatch(SCliBatch* pBatch);
// cli util func
-static FORCE_INLINE bool cliIsEpsetUpdated(int32_t code, STransConnCtx* pCtx);
-static FORCE_INLINE void cliMayCvtFqdnToIp(SEpSet* pEpSet, SCvtAddr* pCvtAddr);
+static FORCE_INLINE bool cliIsEpsetUpdated(int32_t code, SReqCtx* pCtx);
+static FORCE_INLINE int32_t cliMayCvtFqdnToIp(SReqEpSet* pEpSet, const SCvtAddr* pCvtAddr);
-static FORCE_INLINE int32_t cliBuildExceptResp(SCliMsg* pMsg, STransMsg* resp);
+static FORCE_INLINE int32_t cliBuildExceptResp(SCliThrd* thrd, SCliReq* pReq, STransMsg* resp);
static FORCE_INLINE int32_t cliGetIpFromFqdnCache(SHashObj* cache, char* fqdn, uint32_t* ipaddr);
static FORCE_INLINE int32_t cliUpdateFqdnCache(SHashObj* cache, char* fqdn);
static FORCE_INLINE void cliMayUpdateFqdnCache(SHashObj* cache, char* dst);
// process data read from server, add decompress etc later
-static void cliHandleResp(SCliConn* conn);
// handle except about conn
-static void cliHandleExcept(SCliConn* conn, int32_t code);
-static void cliReleaseUnfinishedMsg(SCliConn* conn);
-static void cliHandleFastFail(SCliConn* pConn, int status);
-static void doNotifyApp(SCliMsg* pMsg, SCliThrd* pThrd, int32_t code);
+static void doNotifyCb(SCliReq* pReq, SCliThrd* pThrd, int32_t code);
// handle req from app
-static void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd);
-static void cliHandleQuit(SCliMsg* pMsg, SCliThrd* pThrd);
-static void cliHandleRelease(SCliMsg* pMsg, SCliThrd* pThrd);
-static void cliHandleUpdate(SCliMsg* pMsg, SCliThrd* pThrd);
-static void cliHandleFreeById(SCliMsg* pMsg, SCliThrd* pThrd);
+static void cliHandleReq(SCliThrd* pThrd, SCliReq* pReq);
+static void cliHandleQuit(SCliThrd* pThrd, SCliReq* pReq);
+static void cliHandleRelease(SCliThrd* pThrd, SCliReq* pReq);
+static void cliHandleUpdate(SCliThrd* pThrd, SCliReq* pReq);
+static void cliHandleFreeById(SCliThrd* pThrd, SCliReq* pReq) { return; }
-static void (*cliAsyncHandle[])(SCliMsg* pMsg, SCliThrd* pThrd) = {cliHandleReq, cliHandleQuit, cliHandleRelease,
+static void cliDoReq(queue* h, SCliThrd* pThrd);
+static void cliDoBatchReq(queue* h, SCliThrd* pThrd);
+static void (*cliDealFunc[])(queue* h, SCliThrd* pThrd) = {cliDoReq, cliDoBatchReq};
+
+static void (*cliAsyncHandle[])(SCliThrd* pThrd, SCliReq* pReq) = {cliHandleReq, cliHandleQuit, cliHandleRelease,
NULL, cliHandleUpdate, cliHandleFreeById};
-/// static void (*cliAsyncHandle[])(SCliMsg* pMsg, SCliThrd* pThrd) = {cliHandleReq, cliHandleQuit, cliHandleRelease,
-/// NULL,cliHandleUpdate};
-static FORCE_INLINE void destroyCmsg(void* cmsg);
+static FORCE_INLINE void destroyReq(void* cmsg);
-static FORCE_INLINE void destroyCmsgWrapper(void* arg, void* param);
-static FORCE_INLINE void destroyCmsgAndAhandle(void* cmsg);
-static FORCE_INLINE int cliRBChoseIdx(STrans* pTransInst);
-static FORCE_INLINE void transDestroyConnCtx(STransConnCtx* ctx);
+static FORCE_INLINE void destroyReqWrapper(void* arg, void* param);
+static FORCE_INLINE void destroyReqAndAhanlde(void* cmsg);
+static FORCE_INLINE int cliRBChoseIdx(STrans* pInst);
+static FORCE_INLINE void destroyReqCtx(SReqCtx* ctx);
+
+static int32_t cliHandleState_mayUpdateState(SCliConn* pConn, SCliReq* pReq);
+static int32_t cliHandleState_mayHandleReleaseResp(SCliConn* conn, STransMsgHead* pHead);
+static int32_t cliHandleState_mayCreateAhandle(SCliConn* conn, STransMsgHead* pHead, STransMsg* pResp);
+static int32_t cliHandleState_mayUpdateStateCtx(SCliConn* pConn, SCliReq* pReq);
+static int32_t cliHandleState_mayUpdateStateTime(SCliConn* pConn, SCliReq* pReq);
+
+int32_t cliMayGetStateByQid(SCliThrd* pThrd, SCliReq* pReq, SCliConn** pConn);
+
+static SCliConn* getConnFromHeapCache(SHashObj* pConnHeapCache, char* key);
+static int32_t addConnToHeapCache(SHashObj* pConnHeapCacahe, SCliConn* pConn);
+static int32_t delConnFromHeapCache(SHashObj* pConnHeapCache, SCliConn* pConn);
+static int32_t balanceConnHeapCache(SHashObj* pConnHeapCache, SCliConn* pConn);
// thread obj
static int32_t createThrdObj(void* trans, SCliThrd** pThrd);
@@ -233,11 +294,49 @@ static void destroyThrdObj(SCliThrd* pThrd);
int32_t cliSendQuit(SCliThrd* thrd);
static void cliWalkCb(uv_handle_t* handle, void* arg);
+static void cliWalkCb(uv_handle_t* handle, void* arg);
+
+static FORCE_INLINE int32_t destroyAllReqs(SCliConn* SCliConn);
+
+typedef struct SListFilterArg {
+ int64_t id;
+ STrans* pInst;
+} SListFilterArg;
+
+static FORCE_INLINE bool filterAllReq(void* key, void* arg);
+static FORCE_INLINE bool filerBySeq(void* key, void* arg);
+static FORCE_INLINE bool filterByQid(void* key, void* arg);
+static FORCE_INLINE bool filterToDebug_timeoutMsg(void* key, void* arg);
+static FORCE_INLINE bool filterToRmTimoutReq(void* key, void* arg);
+static FORCE_INLINE bool filterTimeoutReq(void* key, void* arg);
+
+static int8_t cliConnRemoveTimeoutMsg(SCliConn* pConn);
+typedef struct {
+ void* p;
+ HeapNode node;
+} SHeapNode;
+typedef struct {
+ // void* p;
+ Heap* heap;
+ int32_t (*cmpFunc)(const HeapNode* a, const HeapNode* b);
+ int64_t lastUpdateTs;
+ int64_t lastConnFailTs;
+} SHeap;
+
+int32_t compareHeapNode(const HeapNode* a, const HeapNode* b);
+int32_t transHeapInit(SHeap* heap, int32_t (*cmpFunc)(const HeapNode* a, const HeapNode* b));
+void transHeapDestroy(SHeap* heap);
+int32_t transHeapGet(SHeap* heap, SCliConn** p);
+int32_t transHeapInsert(SHeap* heap, SCliConn* p);
+int32_t transHeapDelete(SHeap* heap, SCliConn* p);
+int32_t transHeapBalance(SHeap* heap, SCliConn* p);
+int32_t transHeapUpdateFailTs(SHeap* heap, SCliConn* p);
+
#define CLI_RELEASE_UV(loop) \
do { \
- TAOS_UNUSED(uv_walk(loop, cliWalkCb, NULL)); \
- TAOS_UNUSED(uv_run(loop, UV_RUN_DEFAULT)); \
- TAOS_UNUSED(uv_loop_close(loop)); \
+ uv_walk(loop, cliWalkCb, NULL); \
+ (TAOS_UNUSED(uv_run(loop, UV_RUN_DEFAULT))); \
+ (TAOS_UNUSED(uv_loop_close(loop))); \
} while (0);
// snprintf may cause performance problem
@@ -251,54 +350,9 @@ static void cliWalkCb(uv_handle_t* handle, void* arg);
} while (0)
#define CONN_PERSIST_TIME(para) ((para) <= 90000 ? 90000 : (para))
-#define CONN_GET_INST_LABEL(conn) (((STrans*)(((SCliThrd*)(conn)->hostThrd)->pTransInst))->label)
+#define CONN_GET_INST_LABEL(conn) (((STrans*)(((SCliThrd*)(conn)->hostThrd)->pInst))->label)
-#define CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle) \
- do { \
- int i = 0, sz = transQueueSize(&conn->cliMsgs); \
- for (; i < sz; i++) { \
- pMsg = transQueueGet(&conn->cliMsgs, i); \
- if (pMsg->msg.msgType != TDMT_SCH_DROP_TASK && pMsg->ctx != NULL && (uint64_t)pMsg->ctx->ahandle == ahandle) { \
- break; \
- } \
- } \
- if (i == sz) { \
- pMsg = NULL; \
- } else { \
- pMsg = transQueueRm(&conn->cliMsgs, i); \
- } \
- } while (0)
-
-#define CONN_GET_NEXT_SENDMSG(conn) \
- do { \
- int i = 0; \
- do { \
- pCliMsg = transQueueGet(&conn->cliMsgs, i++); \
- if (pCliMsg && 0 == pCliMsg->sent) { \
- break; \
- } \
- } while (pCliMsg != NULL); \
- if (pCliMsg == NULL) { \
- goto _RETURN; \
- } \
- } while (0)
-
-#define CONN_SET_PERSIST_BY_APP(conn) \
- do { \
- if (conn->status == ConnNormal) { \
- conn->status = ConnAcquire; \
- transRefCliHandle(conn); \
- } \
- } while (0)
-
-#define CONN_NO_PERSIST_BY_APP(conn) \
- (((conn)->status == ConnNormal || (conn)->status == ConnInPool) && T_REF_VAL_GET(conn) == 1)
-#define CONN_RELEASE_BY_SERVER(conn) \
- (((conn)->status == ConnRelease || (conn)->status == ConnInPool) && T_REF_VAL_GET(conn) == 1)
-
-#define REQUEST_NO_RESP(msg) ((msg)->info.noResp == 1)
-#define REQUEST_PERSIS_HANDLE(msg) ((msg)->info.persistHandle == 1)
-#define REQUEST_RELEASE_HANDLE(cmsg) ((cmsg)->type == Release)
+#define REQUEST_NO_RESP(msg) ((msg)->info.noResp == 1)
#define EPSET_IS_VALID(epSet) ((epSet) != NULL && (epSet)->numOfEps >= 0 && (epSet)->inUse >= 0)
#define EPSET_GET_SIZE(epSet) (epSet)->numOfEps
@@ -314,310 +368,428 @@ static void cliWalkCb(uv_handle_t* handle, void* arg);
static void* cliWorkThread(void* arg);
-static void cliReleaseUnfinishedMsg(SCliConn* conn) {
- SCliThrd* pThrd = conn->hostThrd;
-
- for (int i = 0; i < transQueueSize(&conn->cliMsgs); i++) {
- SCliMsg* msg = transQueueGet(&conn->cliMsgs, i);
- if (msg != NULL && msg->ctx != NULL && msg->ctx->ahandle != (void*)0x9527) {
- if (conn->ctx.freeFunc != NULL && msg->ctx->ahandle != NULL) {
- conn->ctx.freeFunc(msg->ctx->ahandle);
- } else if (msg->msg.info.notFreeAhandle == 0 && msg->ctx->ahandle != NULL && pThrd->destroyAhandleFp != NULL) {
- tDebug("%s conn %p destroy unfinished ahandle %p", CONN_GET_INST_LABEL(conn), conn, msg->ctx->ahandle);
- pThrd->destroyAhandleFp(msg->ctx->ahandle);
- }
+int32_t cliGetConnTimer(SCliThrd* pThrd, SCliConn* pConn) {
+ uv_timer_t* timer = taosArrayGetSize(pThrd->timerList) > 0 ? *(uv_timer_t**)taosArrayPop(pThrd->timerList) : NULL;
+ if (timer == NULL) {
+ timer = taosMemoryCalloc(1, sizeof(uv_timer_t));
+ if (timer == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ tDebug("no available timer, create a timer %p", timer);
+ int ret = uv_timer_init(pThrd->loop, timer);
+ if (ret != 0) {
+ tError("conn %p failed to init timer %p since %s", pConn, timer, uv_err_name(ret));
+ return TSDB_CODE_THIRDPARTY_ERROR;
}
- destroyCmsg(msg);
}
- transQueueClear(&conn->cliMsgs);
- memset(&conn->ctx, 0, sizeof(conn->ctx));
+ timer->data = pConn;
+ pConn->timer = timer;
+ return 0;
}
-void cliResetTimer(SCliThrd* pThrd, SCliConn* conn) {
+void cliResetConnTimer(SCliConn* conn) {
+ SCliThrd* pThrd = conn->hostThrd;
if (conn->timer) {
if (uv_is_active((uv_handle_t*)conn->timer)) {
tDebug("%s conn %p stop timer", CONN_GET_INST_LABEL(conn), conn);
TAOS_UNUSED(uv_timer_stop(conn->timer));
}
if (taosArrayPush(pThrd->timerList, &conn->timer) == NULL) {
- tError("failed to push timer %p to list, reason:%s", conn->timer, tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- conn->timer = NULL;
- return;
+ tError("%s conn %p failed to push timer %p to list since %s", CONN_GET_INST_LABEL(conn), conn, conn->timer,
+ tstrerror(terrno));
}
conn->timer->data = NULL;
conn->timer = NULL;
}
}
-bool cliMaySendCachedMsg(SCliConn* conn) {
- if (!transQueueEmpty(&conn->cliMsgs)) {
- SCliMsg* pCliMsg = NULL;
- CONN_GET_NEXT_SENDMSG(conn);
- cliSend(conn);
- return true;
+
+void cliConnMayUpdateTimer(SCliConn* conn, int64_t timeout) {
+ SCliThrd* pThrd = conn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+ if (pInst->startReadTimer == 0) {
+ return;
+ }
+ // reset previous timer
+ if (conn->timer != NULL) {
+ // reset previous timer
+ cliResetConnTimer(conn);
+ }
+ int32_t reqsSentNum = transQueueSize(&conn->reqsSentOut);
+ if (reqsSentNum == 0) {
+ // no need to set timer
+ return;
+ }
+
+ // start a new timer
+ if (cliGetConnTimer(conn->hostThrd, conn) != 0) {
+ return;
+ }
+ int ret = uv_timer_start(conn->timer, cliConnTimeout__checkReq, timeout, 0);
+ if (ret != 0) {
+ tError("%s conn %p failed to start timer %p since %s", CONN_GET_INST_LABEL(conn), conn, conn->timer,
+ uv_err_name(ret));
}
- return false;
-_RETURN:
- return false;
}
-bool cliConnSendSeqMsg(int64_t refId, SCliConn* conn) {
- if (refId == 0) return false;
- SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId);
- if (exh == NULL) {
- tDebug("release conn %p, refId: %" PRId64 "", conn, refId);
+
+void destroyCliConnQTable(SCliConn* conn) {
+ SCliThrd* thrd = conn->hostThrd;
+ int32_t code = 0;
+ void* pIter = taosHashIterate(conn->pQTable, NULL);
+ while (pIter != NULL) {
+ int64_t* qid = taosHashGetKey(pIter, NULL);
+ STransCtx* ctx = pIter;
+ transCtxCleanup(ctx);
+ pIter = taosHashIterate(conn->pQTable, pIter);
+
+ TAOS_UNUSED(taosHashRemove(thrd->pIdConnTable, qid, sizeof(*qid)));
+
+ transReleaseExHandle(transGetRefMgt(), *qid);
+ transRemoveExHandle(transGetRefMgt(), *qid);
+ }
+ taosHashCleanup(conn->pQTable);
+ conn->pQTable = NULL;
+}
+
+static bool filteBySeq(void* key, void* arg) {
+ SFiterArg* targ = arg;
+ SCliReq* pReq = QUEUE_DATA(key, SCliReq, q);
+ if (pReq->seq == targ->seq && pReq->msg.msgType + 1 == targ->msgType) {
+ return true;
+ } else {
return false;
}
- taosWLockLatch(&exh->latch);
- if (exh->handle == NULL) exh->handle = conn;
- exh->inited = 1;
- exh->pThrd = conn->hostThrd;
- if (!QUEUE_IS_EMPTY(&exh->q)) {
- queue* h = QUEUE_HEAD(&exh->q);
- QUEUE_REMOVE(h);
- taosWUnLockLatch(&exh->latch);
- SCliMsg* t = QUEUE_DATA(h, SCliMsg, seqq);
- transCtxMerge(&conn->ctx, &t->ctx->appCtx);
- TAOS_UNUSED(transQueuePush(&conn->cliMsgs, t));
- tDebug("pop from conn %p, refId: %" PRId64 "", conn, refId);
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), refId));
- cliSend(conn);
- return true;
+}
+int32_t cliGetReqBySeq(SCliConn* conn, int64_t seq, int32_t msgType, SCliReq** pReq) {
+ int32_t code = 0;
+ queue set;
+ QUEUE_INIT(&set)
+
+ SFiterArg arg = {.seq = seq, .msgType = msgType};
+ transQueueRemoveByFilter(&conn->reqsSentOut, filteBySeq, &arg, &set, 1);
+
+ if (QUEUE_IS_EMPTY(&set)) {
+ return TSDB_CODE_OUT_OF_RANGE;
}
- taosWUnLockLatch(&exh->latch);
- tDebug("empty conn %p, refId: %" PRId64 "", conn, refId);
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), refId));
- return false;
+
+ queue* e = QUEUE_HEAD(&set);
+ SCliReq* p = QUEUE_DATA(e, SCliReq, q);
+
+ *pReq = p;
+ return 0;
}
-void cliHandleResp(SCliConn* conn) {
+int8_t cliMayRecycleConn(SCliConn* conn) {
+ int32_t code = 0;
SCliThrd* pThrd = conn->hostThrd;
- STrans* pTransInst = pThrd->pTransInst;
+ STrans* pInst = pThrd->pInst;
- cliResetTimer(pThrd, conn);
+ tTrace("%s conn %p in-process req summary:reqsToSend:%d, reqsSentOut:%d, statusTableSize:%d",
+ CONN_GET_INST_LABEL(conn), conn, transQueueSize(&conn->reqsToSend), transQueueSize(&conn->reqsSentOut),
+ taosHashGetSize(conn->pQTable));
+
+ if (transQueueSize(&conn->reqsToSend) == 0 && transQueueSize(&conn->reqsSentOut) == 0 &&
+ taosHashGetSize(conn->pQTable) == 0) {
+ cliResetConnTimer(conn);
+ code = delConnFromHeapCache(pThrd->connHeapCache, conn);
+ if (code == TSDB_CODE_RPC_ASYNC_IN_PROCESS) {
+ tDebug("%s conn %p failed to remove conn from heap cache since %s", CONN_GET_INST_LABEL(conn), conn,
+ tstrerror(code));
+ return 1;
+ } else {
+ if (code != 0) {
+ tDebug("%s conn %p failed to remove conn from heap cache since %s", CONN_GET_INST_LABEL(conn), conn,
+ tstrerror(code));
+ }
+ }
+ addConnToPool(pThrd->pool, conn);
+ return 1;
+ } else if ((transQueueSize(&conn->reqsToSend) == 0) && (transQueueSize(&conn->reqsSentOut) == 0) &&
+ (taosHashGetSize(conn->pQTable) != 0)) {
+ tDebug("%s conn %p do balance directly", CONN_GET_INST_LABEL(conn), conn);
+ TAOS_UNUSED(transHeapBalance(conn->heap, conn));
+ } else {
+ SCliConn* topConn = NULL;
+ if (conn->heap != NULL) {
+ code = transHeapGet(conn->heap, &topConn);
+ if (code != 0) {
+ tDebug("%s conn %p failed to get top conn since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code));
+ return 0;
+ }
+
+ if (topConn == conn) {
+ return 0;
+ }
+ int32_t topReqs = transQueueSize(&topConn->reqsSentOut) + transQueueSize(&topConn->reqsToSend);
+ int32_t currReqs = transQueueSize(&conn->reqsSentOut) + transQueueSize(&conn->reqsToSend);
+ if (topReqs <= currReqs) {
+ tTrace("%s conn %p not balance conn heap since top conn has less req, topConnReqs:%d, currConnReqs:%d",
+ CONN_GET_INST_LABEL(conn), conn, topReqs, currReqs);
+ return 0;
+ } else {
+ tDebug("%s conn %p do balance conn heap since top conn has more reqs, topConnReqs:%d, currConnReqs:%d",
+ CONN_GET_INST_LABEL(conn), conn, topReqs, currReqs);
+ TAOS_UNUSED(transHeapBalance(conn->heap, conn));
+ }
+ }
+ }
+ return 0;
+}
+
+bool filterByQid(void* key, void* arg) {
+ int64_t* qid = arg;
+ SCliReq* pReq = QUEUE_DATA(key, SCliReq, q);
+
+ if (pReq->msg.info.qId == *qid) {
+ return true;
+ } else {
+ return false;
+ }
+}
+int32_t cliBuildRespFromCont(SCliReq* pReq, STransMsg* pResp, STransMsgHead* pHead) {
+ pResp->contLen = transContLenFromMsg(pHead->msgLen);
+ pResp->pCont = transContFromHead((char*)pHead);
+ pResp->code = pHead->code;
+ pResp->msgType = pHead->msgType;
+ if (pResp->info.ahandle == 0) {
+ pResp->info.ahandle = (pReq && pReq->ctx) ? pReq->ctx->ahandle : NULL;
+ }
+ pResp->info.traceId = pHead->traceId;
+ pResp->info.hasEpSet = pHead->hasEpSet;
+ pResp->info.cliVer = htonl(pHead->compatibilityVer);
+ pResp->info.seqNum = taosHton64(pHead->seqNum);
+
+ int64_t qid = taosHton64(pHead->qid);
+ pResp->info.handle = (void*)qid;
+ return 0;
+}
+int32_t cliHandleState_mayHandleReleaseResp(SCliConn* conn, STransMsgHead* pHead) {
+ int32_t code = 0;
+ SCliThrd* pThrd = conn->hostThrd;
+ if (pHead->msgType == TDMT_SCH_TASK_RELEASE || pHead->msgType == TDMT_SCH_TASK_RELEASE + 1) {
+ int64_t qId = taosHton64(pHead->qid);
+ STraceId* trace = &pHead->traceId;
+ int64_t seqNum = taosHton64(pHead->seqNum);
+ tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, seqNum:%" PRId64 ", sid:%" PRId64 "",
+ CONN_GET_INST_LABEL(conn), conn, TMSG_INFO(pHead->msgType), conn->dst, conn->src, pHead->msgLen, seqNum,
+ qId);
+
+ STransCtx* p = taosHashGet(conn->pQTable, &qId, sizeof(qId));
+ transCtxCleanup(p);
+
+ code = taosHashRemove(conn->pQTable, &qId, sizeof(qId));
+ if (code != 0) {
+ tDebug("%s conn %p failed to release req:%" PRId64 " from conn", CONN_GET_INST_LABEL(conn), conn, qId);
+ }
+
+ code = taosHashRemove(pThrd->pIdConnTable, &qId, sizeof(qId));
+ if (code != 0) {
+ tDebug("%s conn %p failed to release req:%" PRId64 " from thrd ", CONN_GET_INST_LABEL(conn), conn, qId);
+ }
+
+ tDebug("%s %p reqToSend:%d, sentOut:%d", CONN_GET_INST_LABEL(conn), conn, transQueueSize(&conn->reqsToSend),
+ transQueueSize(&conn->reqsSentOut));
+
+ queue set;
+ QUEUE_INIT(&set);
+ transQueueRemoveByFilter(&conn->reqsSentOut, filterByQid, &qId, &set, -1);
+ transQueueRemoveByFilter(&conn->reqsToSend, filterByQid, &qId, &set, -1);
+
+ transReleaseExHandle(transGetRefMgt(), qId);
+ transRemoveExHandle(transGetRefMgt(), qId);
+
+ while (!QUEUE_IS_EMPTY(&set)) {
+ queue* el = QUEUE_HEAD(&set);
+ QUEUE_REMOVE(el);
+ SCliReq* pReq = QUEUE_DATA(el, SCliReq, q);
+
+ STraceId* trace = &pReq->msg.info.traceId;
+ tGDebug("start to free msg %p", pReq);
+ destroyReqWrapper(pReq, pThrd);
+ }
+ taosMemoryFree(pHead);
+ return 1;
+ }
+ return 0;
+}
+int32_t cliHandleState_mayCreateAhandle(SCliConn* conn, STransMsgHead* pHead, STransMsg* pResp) {
+ int32_t code = 0;
+ int64_t qId = taosHton64(pHead->qid);
+ if (qId == 0) {
+ return 0;
+ }
+
+ STransCtx* pCtx = taosHashGet(conn->pQTable, &qId, sizeof(qId));
+ if (pCtx == 0) {
+ return TSDB_CODE_RPC_NO_STATE;
+ }
+ pCtx->st = taosGetTimestampUs();
+ STraceId* trace = &pHead->traceId;
+ pResp->info.ahandle = transCtxDumpVal(pCtx, pHead->msgType);
+ tGDebug("%s conn %p %s received from %s, local info:%s, sid:%" PRId64 ", create ahandle %p by %s",
+ CONN_GET_INST_LABEL(conn), conn, TMSG_INFO(pHead->msgType), conn->dst, conn->src, qId, pResp->info.ahandle,
+ TMSG_INFO(pHead->msgType));
+ return 0;
+}
+
+static FORCE_INLINE void cliConnClearInitUserMsg(SCliConn* conn) {
+ if (conn->pInitUserReq) {
+ taosMemoryFree(conn->pInitUserReq);
+ conn->pInitUserReq = NULL;
+ }
+}
+void cliHandleResp(SCliConn* conn) {
+ int32_t code = 0;
+ SCliThrd* pThrd = conn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+
+ cliConnClearInitUserMsg(conn);
+ SCliReq* pReq = NULL;
STransMsgHead* pHead = NULL;
-
- int8_t resetBuf = conn->status == ConnAcquire ? 0 : 1;
- int32_t msgLen = transDumpFromBuffer(&conn->readBuf, (char**)&pHead, resetBuf);
- if (msgLen <= 0) {
+ int32_t msgLen = transDumpFromBuffer(&conn->readBuf, (char**)&pHead, 0);
+ if (msgLen < 0) {
taosMemoryFree(pHead);
- tDebug("%s conn %p recv invalid packet ", CONN_GET_INST_LABEL(conn), conn);
+ tWarn("%s conn %p recv invalid packet", CONN_GET_INST_LABEL(conn), conn);
+ // TODO: notify cb
+ code = pThrd->notifyExceptCb(pThrd, NULL, NULL);
+ if (code != 0) {
+ tError("%s conn %p failed to notify user since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code));
+ }
return;
}
- if (resetBuf == 0) {
- tTrace("%s conn %p not reset read buf", transLabel(pTransInst), conn);
- }
-
- if (transDecompressMsg((char**)&pHead, msgLen) < 0) {
+ if ((code = transDecompressMsg((char**)&pHead, &msgLen)) < 0) {
tDebug("%s conn %p recv invalid packet, failed to decompress", CONN_GET_INST_LABEL(conn), conn);
+ // TODO: notify cb
+ return;
}
+ int64_t qId = taosHton64(pHead->qid);
pHead->code = htonl(pHead->code);
pHead->msgLen = htonl(pHead->msgLen);
- if (cliRecvReleaseReq(conn, pHead)) {
- return;
- }
+ int64_t seq = taosHton64(pHead->seqNum);
+ STransMsg resp = {0};
- STransMsg transMsg = {0};
- transMsg.contLen = transContLenFromMsg(pHead->msgLen);
- transMsg.pCont = transContFromHead((char*)pHead);
- transMsg.code = pHead->code;
- transMsg.msgType = pHead->msgType;
- transMsg.info.ahandle = NULL;
- transMsg.info.traceId = pHead->traceId;
- transMsg.info.hasEpSet = pHead->hasEpSet;
- transMsg.info.cliVer = htonl(pHead->compatibilityVer);
-
- SCliMsg* pMsg = NULL;
- STransConnCtx* pCtx = NULL;
- if (CONN_NO_PERSIST_BY_APP(conn)) {
- pMsg = transQueuePop(&conn->cliMsgs);
-
- pCtx = pMsg ? pMsg->ctx : NULL;
- transMsg.info.ahandle = pCtx ? pCtx->ahandle : NULL;
- tDebug("%s conn %p get ahandle %p, persist: 0", CONN_GET_INST_LABEL(conn), conn, transMsg.info.ahandle);
- } else {
- uint64_t ahandle = (uint64_t)pHead->ahandle;
- CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle);
- if (pMsg == NULL) {
- transMsg.info.ahandle = transCtxDumpVal(&conn->ctx, transMsg.msgType);
- tDebug("%s conn %p construct ahandle %p by %s, persist: 1", CONN_GET_INST_LABEL(conn), conn,
- transMsg.info.ahandle, TMSG_INFO(transMsg.msgType));
- if (!CONN_RELEASE_BY_SERVER(conn) && transMsg.info.ahandle == NULL) {
- transMsg.code = TSDB_CODE_RPC_BROKEN_LINK;
- transMsg.info.ahandle = transCtxDumpBrokenlinkVal(&conn->ctx, (int32_t*)&(transMsg.msgType));
- tDebug("%s conn %p construct ahandle %p due brokenlink, persist: 1", CONN_GET_INST_LABEL(conn), conn,
- transMsg.info.ahandle);
- }
- } else {
- pCtx = pMsg->ctx;
- transMsg.info.ahandle = pCtx ? pCtx->ahandle : NULL;
- tDebug("%s conn %p get ahandle %p, persist: 1", CONN_GET_INST_LABEL(conn), conn, transMsg.info.ahandle);
- }
- }
- // buf's mem alread translated to transMsg.pCont
- if (!CONN_NO_PERSIST_BY_APP(conn)) {
- transMsg.info.handle = (void*)conn->refId;
- transMsg.info.refId = (int64_t)(void*)conn->refId;
- tDebug("%s conn %p ref by app", CONN_GET_INST_LABEL(conn), conn);
- }
-
- STraceId* trace = &transMsg.info.traceId;
- tGDebug("%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, pHead->msgLen, 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);
- transFreeMsg(transMsg.pCont);
- return;
- }
- if (CONN_RELEASE_BY_SERVER(conn) && transMsg.info.ahandle == NULL) {
- tDebug("%s except, conn %p read while cli ignore it", CONN_GET_INST_LABEL(conn), conn);
- transFreeMsg(transMsg.pCont);
- return;
- }
-
- if (pMsg == NULL || (pMsg && pMsg->type != Release)) {
- if (cliAppCb(conn, &transMsg, pMsg) != 0) {
+ if (cliHandleState_mayHandleReleaseResp(conn, pHead)) {
+ if (cliMayRecycleConn(conn)) {
return;
}
- }
- int64_t refId = (pMsg == NULL ? 0 : (int64_t)(pMsg->msg.info.handle));
- tDebug("conn %p msg refId: %" PRId64 "", conn, refId);
- destroyCmsg(pMsg);
-
- if (cliConnSendSeqMsg(refId, conn)) {
return;
}
-
- if (cliMaySendCachedMsg(conn) == true) {
- return;
- }
-
- if (CONN_NO_PERSIST_BY_APP(conn)) {
- SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId);
- if (exh != NULL) {
- exh->handle = NULL;
- }
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), refId));
-
- return addConnToPool(pThrd->pool, conn);
- }
-
- TAOS_UNUSED(uv_read_start((uv_stream_t*)conn->stream, cliAllocRecvBufferCb, cliRecvCb));
-}
-static void cliDestroyMsgInExhandle(int64_t refId) {
- if (refId == 0) return;
- SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId);
- if (exh) {
- taosWLockLatch(&exh->latch);
- while (!QUEUE_IS_EMPTY(&exh->q)) {
- queue* h = QUEUE_HEAD(&exh->q);
- QUEUE_REMOVE(h);
- SCliMsg* t = QUEUE_DATA(h, SCliMsg, seqq);
- destroyCmsg(t);
- }
- taosWUnLockLatch(&exh->latch);
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), refId));
- }
-}
-
-void cliHandleExceptImpl(SCliConn* pConn, int32_t code) {
- if (transQueueEmpty(&pConn->cliMsgs)) {
- if (pConn->broken == true && CONN_NO_PERSIST_BY_APP(pConn)) {
- tTrace("%s conn %p handle except, persist:0", CONN_GET_INST_LABEL(pConn), pConn);
- if (T_REF_VAL_GET(pConn) > 1) transUnrefCliHandle(pConn);
- transUnrefCliHandle(pConn);
+ code = cliGetReqBySeq(conn, seq, pHead->msgType, &pReq);
+ if (code == TSDB_CODE_OUT_OF_RANGE) {
+ code = cliHandleState_mayCreateAhandle(conn, pHead, &resp);
+ if (code == 0) {
+ code = cliBuildRespFromCont(NULL, &resp, pHead);
+ code = cliNotifyCb(conn, NULL, &resp);
return;
}
- }
- SCliThrd* pThrd = pConn->hostThrd;
- STrans* pTransInst = pThrd->pTransInst;
- bool once = false;
- do {
- SCliMsg* pMsg = transQueuePop(&pConn->cliMsgs);
-
- if (pMsg == NULL && once) {
- break;
- }
-
- if (pMsg != NULL && REQUEST_NO_RESP(&pMsg->msg)) {
- destroyCmsg(pMsg);
- break;
- }
-
- STransConnCtx* pCtx = pMsg ? pMsg->ctx : NULL;
-
- STransMsg transMsg = {0};
- transMsg.code = code == -1 ? (pConn->broken ? TSDB_CODE_RPC_BROKEN_LINK : TSDB_CODE_RPC_NETWORK_UNAVAIL) : code;
- transMsg.msgType = pMsg ? pMsg->msg.msgType + 1 : 0;
- transMsg.info.ahandle = NULL;
- transMsg.info.cliVer = pTransInst->compatibilityVer;
-
- if (pMsg == NULL && !CONN_NO_PERSIST_BY_APP(pConn)) {
- transMsg.info.ahandle = transCtxDumpVal(&pConn->ctx, transMsg.msgType);
- tDebug("%s conn %p construct ahandle %p by %s", CONN_GET_INST_LABEL(pConn), pConn, transMsg.info.ahandle,
- TMSG_INFO(transMsg.msgType));
- if (transMsg.info.ahandle == NULL) {
- int32_t msgType = 0;
- transMsg.info.ahandle = transCtxDumpBrokenlinkVal(&pConn->ctx, &msgType);
- transMsg.msgType = msgType;
- tDebug("%s conn %p construct ahandle %p due to brokenlink", CONN_GET_INST_LABEL(pConn), pConn,
- transMsg.info.ahandle);
- }
- } else {
- transMsg.info.ahandle = (pMsg != NULL && pMsg->type != Release && pCtx) ? pCtx->ahandle : NULL;
- }
-
- if (pCtx == NULL || pCtx->pSem == NULL) {
- if (transMsg.info.ahandle == NULL) {
- if (pMsg == NULL || REQUEST_NO_RESP(&pMsg->msg) || pMsg->type == Release) {
- destroyCmsg(pMsg);
- once = true;
- continue;
- }
- }
- }
-
- if (pMsg == NULL || (pMsg && pMsg->type != Release)) {
- int64_t refId = (pMsg == NULL ? 0 : (int64_t)(pMsg->msg.info.handle));
- cliDestroyMsgInExhandle(refId);
- if (cliAppCb(pConn, &transMsg, pMsg) != 0) {
+ if (code != 0) {
+ tWarn("%s conn %p recv unexpected packet, msgType:%s, seqNum:%" PRId64 ", sid:%" PRId64
+ ", the sever may sends repeated response since %s",
+ CONN_GET_INST_LABEL(conn), conn, TMSG_INFO(pHead->msgType), seq, qId, tstrerror(code));
+ // TODO: notify cb
+ taosMemoryFree(pHead);
+ if (cliMayRecycleConn(conn)) {
return;
}
+ return;
+ }
+ } else {
+ code = cliHandleState_mayUpdateStateTime(conn, pReq);
+ if (code != 0) {
+ tDebug("%s conn %p failed to update state time sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(conn), conn, qId,
+ tstrerror(code));
}
- destroyCmsg(pMsg);
- tTrace("%s conn %p start to destroy, ref:%d", CONN_GET_INST_LABEL(pConn), pConn, T_REF_VAL_GET(pConn));
- } while (!transQueueEmpty(&pConn->cliMsgs));
- if (T_REF_VAL_GET(pConn) > 1) transUnrefCliHandle(pConn);
- transUnrefCliHandle(pConn);
-}
-void cliHandleExcept(SCliConn* conn, int32_t code) {
- tTrace("%s conn %p except ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn));
- if (code != TSDB_CODE_RPC_FQDN_ERROR) {
- code = -1;
}
- cliHandleExceptImpl(conn, -1);
+
+ code = cliBuildRespFromCont(pReq, &resp, pHead);
+ STraceId* trace = &resp.info.traceId;
+ tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, seq:%" PRId64 ", sid:%" PRId64 "",
+ CONN_GET_INST_LABEL(conn), conn, TMSG_INFO(resp.msgType), conn->dst, conn->src, pHead->msgLen, seq, qId);
+
+ code = cliNotifyCb(conn, pReq, &resp);
+ if (code == TSDB_CODE_RPC_ASYNC_IN_PROCESS) {
+ tGWarn("%s msg need retry", CONN_GET_INST_LABEL(conn));
+ } else {
+ destroyReq(pReq);
+ }
+ if (cliMayRecycleConn(conn)) {
+ return;
+ }
+ // cliConnCheckTimoutMsg(conn);
+
+ cliConnMayUpdateTimer(conn, pInst->readTimeout * 1000);
}
void cliConnTimeout(uv_timer_t* handle) {
SCliConn* conn = handle->data;
SCliThrd* pThrd = conn->hostThrd;
+ int32_t ref = transUnrefCliHandle(conn);
+ if (ref <= 0) {
+ cliResetConnTimer(conn);
+ return;
+ }
- tTrace("%s conn %p conn timeout, ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn));
-
- TAOS_UNUSED(uv_timer_stop(handle));
- handle->data = NULL;
-
- cliResetTimer(pThrd, conn);
-
- cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr);
- cliHandleFastFail(conn, UV_ECANCELED);
+ tTrace("%s conn %p conn timeout", CONN_GET_INST_LABEL(conn), conn);
+ TAOS_UNUSED(transUnrefCliHandle(conn));
}
-void cliReadTimeoutCb(uv_timer_t* handle) {
- // set up timeout cb
+
+bool filterToRmTimoutReq(void* key, void* arg) {
+ SListFilterArg* filterArg = arg;
+ SCliReq* pReq = QUEUE_DATA(key, SCliReq, q);
+ if (pReq->msg.info.qId == 0 && !REQUEST_NO_RESP(&pReq->msg) && pReq->ctx) {
+ int64_t elapse = ((taosGetTimestampUs() - pReq->st) / 1000000);
+ if (filterArg && (elapse >= filterArg->pInst->readTimeout)) {
+ return false;
+ } else {
+ return false;
+ }
+ }
+ return false;
+}
+
+bool filterToDebug_timeoutMsg(void* key, void* arg) {
+ SListFilterArg* filterArg = arg;
+ SCliReq* pReq = QUEUE_DATA(key, SCliReq, q);
+ if (pReq->msg.info.qId == 0 && !REQUEST_NO_RESP(&pReq->msg) && pReq->ctx) {
+ int64_t elapse = ((taosGetTimestampUs() - pReq->st) / 1000000);
+ if (filterArg && elapse >= filterArg->pInst->readTimeout) {
+ tWarn("req %s timeout, elapse:%" PRId64 "ms", TMSG_INFO(pReq->msg.msgType), elapse);
+ return false;
+ }
+ return false;
+ }
+ return false;
+}
+
+void cliConnCheckTimoutMsg(SCliConn* conn) {
+ int32_t code = 0;
+ queue set;
+ QUEUE_INIT(&set);
+ SCliThrd* pThrd = conn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+
+ // transQueueRemoveByFilter(&conn->reqsSentOut, filterToDebug_timeoutMsg, NULL, &set, -1);
+
+ if (pInst->startReadTimer == 0) {
+ return;
+ }
+
+ if (transQueueSize(&conn->reqsSentOut) == 0) {
+ return;
+ }
+ code = cliConnRemoveTimeoutMsg(conn);
+ if (code != 0) {
+ tDebug("%s conn %p do remove timeout msg", CONN_GET_INST_LABEL(conn), conn);
+ if (!cliMayRecycleConn(conn)) {
+ TAOS_UNUSED(transHeapBalance(conn->heap, conn));
+ }
+ } else {
+ TAOS_UNUSED(cliMayRecycleConn(conn));
+ }
+}
+void cliConnTimeout__checkReq(uv_timer_t* handle) {
SCliConn* conn = handle->data;
- tTrace("%s conn %p timeout, ref:%d", CONN_GET_INST_LABEL(conn), conn, T_REF_VAL_GET(conn));
- TAOS_UNUSED(uv_read_stop(conn->stream));
- cliHandleExceptImpl(conn, TSDB_CODE_RPC_TIMEOUT);
+ cliConnCheckTimoutMsg(conn);
}
void* createConnPool(int size) {
@@ -633,25 +805,11 @@ void* destroyConnPool(SCliThrd* pThrd) {
SConnList* connList = taosHashIterate((SHashObj*)pool, NULL);
while (connList != NULL) {
while (!QUEUE_IS_EMPTY(&connList->conns)) {
- queue* h = QUEUE_HEAD(&connList->conns);
+ queue* h = QUEUE_HEAD(&connList->conns);
+ QUEUE_REMOVE(h);
SCliConn* c = QUEUE_DATA(h, SCliConn, q);
cliDestroyConn(c, true);
}
-
- SMsgList* msglist = connList->list;
- while (!QUEUE_IS_EMPTY(&msglist->msgQ)) {
- queue* h = QUEUE_HEAD(&msglist->msgQ);
- QUEUE_REMOVE(h);
-
- SCliMsg* pMsg = QUEUE_DATA(h, SCliMsg, q);
-
- transDQCancel(pThrd->waitConnQueue, pMsg->ctx->task);
- pMsg->ctx->task = NULL;
-
- doNotifyApp(pMsg, pThrd, TSDB_CODE_RPC_MAX_SESSIONS);
- }
- taosMemoryFree(msglist);
-
connList = taosHashIterate((SHashObj*)pool, connList);
}
taosHashCleanup(pool);
@@ -659,289 +817,117 @@ void* destroyConnPool(SCliThrd* pThrd) {
return NULL;
}
-static SCliConn* getConnFromPool(SCliThrd* pThrd, char* key, bool* exceed) {
+static int32_t getOrCreateConnList(SCliThrd* pThrd, const char* key, SConnList** ppList) {
int32_t code = 0;
void* pool = pThrd->pool;
- STrans* pTranInst = pThrd->pTransInst;
size_t klen = strlen(key);
SConnList* plist = taosHashGet((SHashObj*)pool, key, klen);
if (plist == NULL) {
SConnList list = {0};
- if ((code = taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list))) != 0) {
- return NULL;
+ QUEUE_INIT(&list.conns);
+ code = taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list));
+ if (code != 0) {
+ return code;
}
+
plist = taosHashGet(pool, key, klen);
-
- SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList));
- if (nList == NULL) {
- tError("failed to alloc memory for msg list, reason:%s", tstrerror(terrno));
- return NULL;
+ if (plist == NULL) {
+ return TSDB_CODE_INVALID_PTR;
}
- QUEUE_INIT(&nList->msgQ);
- nList->numOfConn++;
-
QUEUE_INIT(&plist->conns);
- plist->list = nList;
+ *ppList = plist;
+ tDebug("create conn list %p for key %s", plist, key);
+ } else {
+ *ppList = plist;
+ }
+ return 0;
+}
+static int32_t cliGetConnFromPool(SCliThrd* pThrd, const char* key, SCliConn** ppConn) {
+ int32_t code = 0;
+ void* pool = pThrd->pool;
+ STrans* pInst = pThrd->pInst;
+
+ SConnList* plist = NULL;
+ code = getOrCreateConnList(pThrd, key, &plist);
+ if (code != 0) {
+ return code;
}
if (QUEUE_IS_EMPTY(&plist->conns)) {
- if (plist->list->numOfConn >= pTranInst->connLimitNum) {
- *exceed = true;
- return NULL;
+ if (plist->size >= pInst->connLimitNum) {
+ return TSDB_CODE_RPC_MAX_SESSIONS;
}
- plist->list->numOfConn++;
- return NULL;
+ plist->totaSize += 1;
+ return TSDB_CODE_RPC_NETWORK_BUSY;
}
- queue* h = QUEUE_TAIL(&plist->conns);
- QUEUE_REMOVE(h);
+ queue* h = QUEUE_HEAD(&plist->conns);
plist->size -= 1;
+ QUEUE_REMOVE(h);
SCliConn* conn = QUEUE_DATA(h, SCliConn, q);
conn->status = ConnNormal;
QUEUE_INIT(&conn->q);
- tDebug("conn %p get from pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr);
+ conn->list = plist;
if (conn->task != NULL) {
- transDQCancel(((SCliThrd*)conn->hostThrd)->timeoutQueue, conn->task);
+ SDelayTask* task = conn->task;
conn->task = NULL;
+ transDQCancel(((SCliThrd*)conn->hostThrd)->timeoutQueue, task);
}
- return conn;
+
+ tDebug("conn %p get from pool, pool size:%d, dst:%s", conn, conn->list->size, conn->dstAddr);
+
+ *ppConn = conn;
+ return 0;
}
-static SCliConn* getConnFromPool2(SCliThrd* pThrd, char* key, SCliMsg** pMsg) {
- int32_t code = 0;
- void* pool = pThrd->pool;
- STrans* pTransInst = pThrd->pTransInst;
- size_t klen = strlen(key);
- SConnList* plist = taosHashGet((SHashObj*)pool, key, klen);
- if (plist == NULL) {
- SConnList list = {0};
- if ((code = taosHashPut((SHashObj*)pool, key, klen, (void*)&list, sizeof(list))) != 0) {
- tError("failed to put key %s to pool, reason:%s", key, tstrerror(code));
- return NULL;
- }
- plist = taosHashGet(pool, key, klen);
+// code
+static int32_t cliGetOrCreateConn(SCliThrd* pThrd, SCliReq* pReq, SCliConn** pConn) {
+ // impl later
+ char* fqdn = EPSET_GET_INUSE_IP(pReq->ctx->epSet);
+ uint16_t port = EPSET_GET_INUSE_PORT(pReq->ctx->epSet);
+ char addr[TSDB_FQDN_LEN + 64] = {0};
+ CONN_CONSTRUCT_HASH_KEY(addr, fqdn, port);
- SMsgList* nList = taosMemoryCalloc(1, sizeof(SMsgList));
- if (nList == NULL) {
- tError("failed to alloc memory for msg list, reason:%s", tstrerror(terrno));
- return NULL;
- }
-
- QUEUE_INIT(&nList->msgQ);
- nList->numOfConn++;
-
- QUEUE_INIT(&plist->conns);
- plist->list = nList;
+ int32_t code = cliGetConnFromPool(pThrd, addr, pConn);
+ if (code == TSDB_CODE_RPC_MAX_SESSIONS) {
+ return code;
+ } else if (code == TSDB_CODE_RPC_NETWORK_BUSY) {
+ code = cliCreateConn2(pThrd, pReq, pConn);
+ } else {
}
-
- STraceId* trace = &(*pMsg)->msg.info.traceId;
- // no avaliable conn in pool
- if (QUEUE_IS_EMPTY(&plist->conns)) {
- SMsgList* list = plist->list;
- if ((list)->numOfConn >= pTransInst->connLimitNum) {
- STraceId* trace = &(*pMsg)->msg.info.traceId;
- if (pTransInst->notWaitAvaliableConn ||
- (pTransInst->noDelayFp != NULL && pTransInst->noDelayFp((*pMsg)->msg.msgType))) {
- tDebug("%s msg %s not to send, reason: %s", pTransInst->label, TMSG_INFO((*pMsg)->msg.msgType),
- tstrerror(TSDB_CODE_RPC_NETWORK_BUSY));
- doNotifyApp(*pMsg, pThrd, TSDB_CODE_RPC_NETWORK_BUSY);
- *pMsg = NULL;
- return NULL;
- }
-
- STaskArg* arg = taosMemoryMalloc(sizeof(STaskArg));
- if (arg == NULL) {
- doNotifyApp(*pMsg, pThrd, TSDB_CODE_OUT_OF_MEMORY);
- *pMsg = NULL;
- return NULL;
- }
- arg->param1 = *pMsg;
- arg->param2 = pThrd;
-
- SDelayTask* task = transDQSched(pThrd->waitConnQueue, doFreeTimeoutMsg, arg, pTransInst->timeToGetConn);
- if (task == NULL) {
- taosMemoryFree(arg);
- doNotifyApp(*pMsg, pThrd, TSDB_CODE_OUT_OF_MEMORY);
- *pMsg = NULL;
- return NULL;
- }
- (*pMsg)->ctx->task = task;
- tGTrace("%s msg %s delay to send, wait for avaiable connect", pTransInst->label, TMSG_INFO((*pMsg)->msg.msgType));
- QUEUE_PUSH(&(list)->msgQ, &(*pMsg)->q);
- *pMsg = NULL;
- } else {
- // send msg in delay queue
- if (!(QUEUE_IS_EMPTY(&(list)->msgQ))) {
- STaskArg* arg = taosMemoryMalloc(sizeof(STaskArg));
- if (arg == NULL) {
- doNotifyApp(*pMsg, pThrd, TSDB_CODE_OUT_OF_MEMORY);
- *pMsg = NULL;
- return NULL;
- }
- arg->param1 = *pMsg;
- arg->param2 = pThrd;
-
- SDelayTask* task = transDQSched(pThrd->waitConnQueue, doFreeTimeoutMsg, arg, pTransInst->timeToGetConn);
- if (task == NULL) {
- taosMemoryFree(arg);
- doNotifyApp(*pMsg, pThrd, TSDB_CODE_OUT_OF_MEMORY);
- *pMsg = NULL;
- return NULL;
- }
-
- (*pMsg)->ctx->task = task;
- tGTrace("%s msg %s delay to send, wait for avaiable connect", pTransInst->label,
- TMSG_INFO((*pMsg)->msg.msgType));
-
- QUEUE_PUSH(&(list)->msgQ, &(*pMsg)->q);
- queue* h = QUEUE_HEAD(&(list)->msgQ);
- QUEUE_REMOVE(h);
- SCliMsg* ans = QUEUE_DATA(h, SCliMsg, q);
-
- *pMsg = ans;
-
- trace = &(*pMsg)->msg.info.traceId;
- tGTrace("%s msg %s pop from delay queue, start to send", pTransInst->label, TMSG_INFO((*pMsg)->msg.msgType));
- transDQCancel(pThrd->waitConnQueue, ans->ctx->task);
- }
- list->numOfConn++;
- }
- tDebug("%s numOfConn: %d, limit: %d, dst:%s", pTransInst->label, list->numOfConn, pTransInst->connLimitNum, key);
- return NULL;
- }
-
- queue* h = QUEUE_TAIL(&plist->conns);
- plist->size -= 1;
- QUEUE_REMOVE(h);
-
- SCliConn* conn = QUEUE_DATA(h, SCliConn, q);
- conn->status = ConnNormal;
- QUEUE_INIT(&conn->q);
- tDebug("conn %p get from pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr);
-
- if (conn->task != NULL) {
- transDQCancel(((SCliThrd*)conn->hostThrd)->timeoutQueue, conn->task);
- conn->task = NULL;
- }
- return conn;
+ return code;
}
static void addConnToPool(void* pool, SCliConn* conn) {
if (conn->status == ConnInPool) {
return;
}
- int32_t code = allocConnRef(conn, true);
- if (code != 0) {
- cliDestroyConn(conn, true);
- return;
- }
SCliThrd* thrd = conn->hostThrd;
- cliResetTimer(thrd, conn);
-
- if (T_REF_VAL_GET(conn) > 1) {
- transUnrefCliHandle(conn);
- }
-
- cliDestroyConnMsgs(conn, false);
-
- if (conn->list == NULL) {
+ cliResetConnTimer(conn);
+ if (conn->list == NULL && conn->dstAddr != NULL) {
conn->list = taosHashGet((SHashObj*)pool, conn->dstAddr, strlen(conn->dstAddr));
}
- SConnList* pList = conn->list;
- SMsgList* msgList = pList->list;
- if (!QUEUE_IS_EMPTY(&msgList->msgQ)) {
- queue* h = QUEUE_HEAD(&(msgList)->msgQ);
- QUEUE_REMOVE(h);
-
- SCliMsg* pMsg = QUEUE_DATA(h, SCliMsg, q);
-
- transDQCancel(thrd->waitConnQueue, pMsg->ctx->task);
- pMsg->ctx->task = NULL;
-
- transCtxMerge(&conn->ctx, &pMsg->ctx->appCtx);
- TAOS_UNUSED(transQueuePush(&conn->cliMsgs, pMsg));
-
- conn->status = ConnNormal;
- cliSend(conn);
- return;
- }
-
conn->status = ConnInPool;
+ QUEUE_INIT(&conn->q);
QUEUE_PUSH(&conn->list->conns, &conn->q);
conn->list->size += 1;
tDebug("conn %p added to pool, pool size: %d, dst: %s", conn, conn->list->size, conn->dstAddr);
- if (conn->list->size >= 10) {
+ conn->heapMissHit = 0;
+
+ if (conn->list->size >= 5) {
STaskArg* arg = taosMemoryCalloc(1, sizeof(STaskArg));
if (arg == NULL) return;
arg->param1 = conn;
arg->param2 = thrd;
- STrans* pTransInst = thrd->pTransInst;
- conn->task = transDQSched(thrd->timeoutQueue, doCloseIdleConn, arg, 10 * CONN_PERSIST_TIME(pTransInst->idleTime));
+ STrans* pInst = thrd->pInst;
+ conn->task = transDQSched(thrd->timeoutQueue, doCloseIdleConn, arg, (10 * CONN_PERSIST_TIME(pInst->idleTime) / 3));
}
}
-static int32_t allocConnRef(SCliConn* conn, bool update) {
- if (update) {
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), conn->refId));
- TAOS_UNUSED(transRemoveExHandle(transGetRefMgt(), conn->refId));
- conn->refId = -1;
- }
-
- SExHandle* exh = taosMemoryCalloc(1, sizeof(SExHandle));
- if (exh == NULL) {
- return terrno;
- }
-
- exh->refId = transAddExHandle(transGetRefMgt(), exh);
- if (exh->refId < 0) {
- taosMemoryFree(exh);
- return TSDB_CODE_REF_INVALID_ID;
- }
-
- QUEUE_INIT(&exh->q);
- taosInitRWLatch(&exh->latch);
- exh->handle = conn;
- exh->pThrd = conn->hostThrd;
-
- SExHandle* self = transAcquireExHandle(transGetRefMgt(), exh->refId);
- if (self != exh) {
- taosMemoryFree(exh);
- return TSDB_CODE_REF_INVALID_ID;
- }
-
- conn->refId = exh->refId;
- if (conn->refId < 0) {
- taosMemoryFree(exh);
- }
- return 0;
-}
-
-static int32_t specifyConnRef(SCliConn* conn, bool update, int64_t handle) {
- if (update) {
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), conn->refId));
- TAOS_UNUSED(transRemoveExHandle(transGetRefMgt(), conn->refId));
- conn->refId = -1;
- }
- SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle);
- if (exh == NULL) {
- return -1;
- }
- taosWLockLatch(&exh->latch);
- exh->handle = conn;
- exh->pThrd = conn->hostThrd;
- taosWUnLockLatch(&exh->latch);
-
- conn->refId = exh->refId;
-
- tDebug("conn %p specified by %" PRId64 "", conn, handle);
-
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), handle));
- return 0;
-}
static void cliAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
SCliConn* conn = handle->data;
@@ -952,20 +938,28 @@ static void cliAllocRecvBufferCb(uv_handle_t* handle, size_t suggested_size, uv_
}
}
static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
+ int32_t code = 0;
STUB_RAND_NETWORK_ERR(nread);
if (handle->data == NULL) {
return;
}
- SCliConn* conn = handle->data;
+ SCliConn* conn = handle->data;
+ code = transSetReadOption((uv_handle_t*)handle);
+ if (code != 0) {
+ tWarn("%s conn %p failed to set recv opt since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code));
+ }
+
SConnBuffer* pBuf = &conn->readBuf;
if (nread > 0) {
pBuf->len += nread;
while (transReadComplete(pBuf)) {
tTrace("%s conn %p read complete", CONN_GET_INST_LABEL(conn), conn);
if (pBuf->invalid) {
- cliHandleExcept(conn, -1);
+ conn->broken = true;
+ TAOS_UNUSED(transUnrefCliHandle(conn));
+ return;
break;
} else {
cliHandleResp(conn);
@@ -983,19 +977,81 @@ static void cliRecvCb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) {
}
if (nread < 0) {
tDebug("%s conn %p read error:%s, ref:%d", CONN_GET_INST_LABEL(conn), conn, uv_err_name(nread),
- T_REF_VAL_GET(conn));
+ transGetRefCount(conn));
conn->broken = true;
- cliHandleExcept(conn, -1);
+ TAOS_UNUSED(transUnrefCliHandle(conn));
}
}
-static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn) {
+static int32_t cliCreateConn2(SCliThrd* pThrd, SCliReq* pReq, SCliConn** ppConn) {
int32_t code = 0;
+ SCliConn* pConn = NULL;
+ char* ip = EPSET_GET_INUSE_IP(pReq->ctx->epSet);
+ int32_t port = EPSET_GET_INUSE_PORT(pReq->ctx->epSet);
+
+ TAOS_CHECK_GOTO(cliCreateConn(pThrd, &pConn, ip, port), NULL, _exception);
+
+ code = cliHandleState_mayUpdateState(pConn, pReq);
+
+ code = addConnToHeapCache(pThrd->connHeapCache, pConn);
+ // code = 0, succ
+ // code = TSDB_CODE_RPC_NETWORK_UNAVALI, fail fast, and not insert into conn heap
+ if (code != 0 && code != TSDB_CODE_RPC_NETWORK_UNAVAIL) {
+ TAOS_CHECK_GOTO(code, NULL, _exception);
+ }
+ transQueuePush(&pConn->reqsToSend, &pReq->q);
+ return cliDoConn(pThrd, pConn);
+_exception:
+ // free conn
+ return code;
+}
+void cliDestroyMsg(void* arg) {
+ queue* e = arg;
+ SCliReq* pReq = QUEUE_DATA(e, SCliReq, q);
+ if (pReq->msg.info.notFreeAhandle == 0 && pReq->ctx->ahandle != 0) {
+ // taosMemoryFree(pReq->ctx->ahandle);
+ }
+ destroyReq(pReq);
+}
+static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn, char* ip, int32_t port) {
+ int32_t code = 0;
+ int32_t lino = 0;
+
+ STrans* pInst = pThrd->pInst;
SCliConn* conn = taosMemoryCalloc(1, sizeof(SCliConn));
if (conn == NULL) {
- return terrno;
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _failed);
}
+ char addr[TSDB_FQDN_LEN + 64] = {0};
+ CONN_CONSTRUCT_HASH_KEY(addr, ip, port);
+ conn->hostThrd = pThrd;
+ conn->dstAddr = taosStrdup(addr);
+ conn->ipStr = taosStrdup(ip);
+ conn->port = port;
+ if (conn->dstAddr == NULL || conn->ipStr == NULL) {
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _failed);
+ }
+
+ conn->status = ConnNormal;
+ conn->broken = false;
+ QUEUE_INIT(&conn->q);
+
+ TAOS_CHECK_GOTO(transQueueInit(&conn->reqsToSend, cliDestroyMsg), NULL, _failed);
+ TAOS_CHECK_GOTO(transQueueInit(&conn->reqsSentOut, cliDestroyMsg), NULL, _failed);
+
+ TAOS_CHECK_GOTO(transInitBuffer(&conn->readBuf), NULL, _failed);
+
+ conn->hostThrd = pThrd;
+ conn->seq = 0;
+
+ conn->pQTable = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
+ if (conn->pQTable == NULL) {
+ TAOS_CHECK_GOTO(terrno, NULL, _failed);
+ }
+
+ TAOS_CHECK_GOTO(cliGetConnTimer(pThrd, conn), &lino, _failed);
+
// read/write stream handle
conn->stream = (uv_stream_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
if (conn->stream == NULL) {
@@ -1009,353 +1065,437 @@ static int32_t cliCreateConn(SCliThrd* pThrd, SCliConn** pCliConn) {
code = TSDB_CODE_THIRDPARTY_ERROR;
TAOS_CHECK_GOTO(code, NULL, _failed);
}
- conn->stream->data = conn;
- uv_timer_t* timer = taosArrayGetSize(pThrd->timerList) > 0 ? *(uv_timer_t**)taosArrayPop(pThrd->timerList) : NULL;
- if (timer == NULL) {
- timer = taosMemoryCalloc(1, sizeof(uv_timer_t));
- if (timer == NULL) {
- TAOS_CHECK_GOTO(terrno, NULL, _failed);
- }
-
- tDebug("no available timer, create a timer %p", timer);
- TAOS_UNUSED(uv_timer_init(pThrd->loop, timer));
+ conn->bufSize = pInst->shareConnLimit;
+ conn->buf = (uv_buf_t*)taosMemoryCalloc(1, pInst->shareConnLimit * sizeof(uv_buf_t));
+ if (conn->buf == NULL) {
+ TAOS_CHECK_GOTO(terrno, NULL, _failed);
}
- timer->data = conn;
- conn->timer = timer;
+ TAOS_CHECK_GOTO(initWQ(&conn->wq), NULL, _failed);
+
+ QUEUE_INIT(&conn->batchSendq);
+
+ conn->stream->data = conn;
conn->connReq.data = conn;
- transReqQueueInit(&conn->wreqQueue);
-
- TAOS_CHECK_GOTO(transQueueInit(&conn->cliMsgs, NULL), NULL, _failed);
-
- TAOS_CHECK_GOTO(transInitBuffer(&conn->readBuf), NULL, _failed);
-
- QUEUE_INIT(&conn->q);
- conn->hostThrd = pThrd;
- conn->status = ConnNormal;
- conn->broken = false;
- transRefCliHandle(conn);
-
- TAOS_UNUSED(atomic_add_fetch_32(&pThrd->connCount, 1));
-
- TAOS_CHECK_GOTO(allocConnRef(conn, false), NULL, _failed);
*pCliConn = conn;
+
return code;
_failed:
if (conn) {
+ taosMemoryFree(conn->buf);
taosMemoryFree(conn->stream);
- transReqQueueClear(&conn->wreqQueue);
- TAOS_UNUSED(transDestroyBuffer(&conn->readBuf));
- transQueueDestroy(&conn->cliMsgs);
+ destroyCliConnQTable(conn);
+ taosHashCleanup(conn->pQTable);
+ transDestroyBuffer(&conn->readBuf);
+ transQueueDestroy(&conn->reqsToSend);
+ transQueueDestroy(&conn->reqsSentOut);
+ taosMemoryFree(conn->dstAddr);
}
+ tError("failed to create conn, code:%d", code);
taosMemoryFree(conn);
return code;
}
-static void cliDestroyConn(SCliConn* conn, bool clear) {
+
+static void cliDestroyAllQidFromThrd(SCliConn* conn) {
+ int32_t code = 0;
SCliThrd* pThrd = conn->hostThrd;
- tTrace("%s conn %p remove from conn pool", CONN_GET_INST_LABEL(conn), conn);
- conn->broken = true;
- QUEUE_REMOVE(&conn->q);
- QUEUE_INIT(&conn->q);
- conn->broken = true;
- if (conn->list == NULL) {
- conn->list = taosHashGet((SHashObj*)pThrd->pool, conn->dstAddr, strlen(conn->dstAddr));
- }
+ void* pIter = taosHashIterate(conn->pQTable, NULL);
+ while (pIter != NULL) {
+ int64_t* qid = taosHashGetKey(pIter, NULL);
- if (conn->list) {
- SConnList* list = conn->list;
- list->list->numOfConn--;
- if (conn->status == ConnInPool) {
- list->size--;
+ code = taosHashRemove(pThrd->pIdConnTable, qid, sizeof(*qid));
+ if (code != 0) {
+ tDebug("%s conn %p failed to remove state %" PRId64 " since %s", CONN_GET_INST_LABEL(conn), conn, *qid,
+ tstrerror(code));
+ } else {
+ tDebug("%s conn %p destroy sid::%" PRId64 "", CONN_GET_INST_LABEL(conn), conn, *qid);
}
- }
- conn->list = NULL;
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), conn->refId));
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), conn->refId));
- TAOS_UNUSED(transRemoveExHandle(transGetRefMgt(), conn->refId));
- conn->refId = -1;
+ STransCtx* ctx = pIter;
+ transCtxCleanup(ctx);
- if (conn->task != NULL) {
- transDQCancel(pThrd->timeoutQueue, conn->task);
- conn->task = NULL;
- }
- cliResetTimer(pThrd, conn);
+ transReleaseExHandle(transGetRefMgt(), *qid);
+ transRemoveExHandle(transGetRefMgt(), *qid);
- if (clear) {
- if (!uv_is_closing((uv_handle_t*)conn->stream)) {
- TAOS_UNUSED(uv_read_stop(conn->stream));
- uv_close((uv_handle_t*)conn->stream, cliDestroy);
- }
+ pIter = taosHashIterate(conn->pQTable, pIter);
}
+ taosHashCleanup(conn->pQTable);
+ conn->pQTable = NULL;
}
+static void cliDestroyConn(SCliConn* conn, bool clear) { cliHandleException(conn); }
static void cliDestroy(uv_handle_t* handle) {
+ int32_t code = 0;
if (uv_handle_get_type(handle) != UV_TCP || handle->data == NULL) {
return;
}
SCliConn* conn = handle->data;
SCliThrd* pThrd = conn->hostThrd;
- cliResetTimer(pThrd, conn);
+ cliResetConnTimer(conn);
- TAOS_UNUSED(atomic_sub_fetch_32(&pThrd->connCount, 1));
+ tDebug("%s conn %p try to destroy", CONN_GET_INST_LABEL(conn), conn);
- if (conn->refId > 0) {
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), conn->refId));
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), conn->refId));
- TAOS_UNUSED(transRemoveExHandle(transGetRefMgt(), conn->refId));
+ code = destroyAllReqs(conn);
+ if (code != 0) {
+ tDebug("%s conn %p failed to all reqs since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code));
}
+
+ conn->forceDelFromHeap = 1;
+ code = delConnFromHeapCache(pThrd->connHeapCache, conn);
+ if (code != 0) {
+ tDebug("%s conn %p failed to del conn from heapcach since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code));
+ }
+
taosMemoryFree(conn->dstAddr);
taosMemoryFree(conn->stream);
+ taosMemoryFree(conn->ipStr);
+ cliDestroyAllQidFromThrd(conn);
- cliDestroyConnMsgs(conn, true);
+ if (conn->pInitUserReq) {
+ taosMemoryFree(conn->pInitUserReq);
+ conn->pInitUserReq = NULL;
+ }
+
+ taosMemoryFree(conn->buf);
+ destroyWQ(&conn->wq);
+ transDestroyBuffer(&conn->readBuf);
tTrace("%s conn %p destroy successfully", CONN_GET_INST_LABEL(conn), conn);
- transReqQueueClear(&conn->wreqQueue);
- TAOS_UNUSED(transDestroyBuffer(&conn->readBuf));
taosMemoryFree(conn);
}
-static bool cliHandleNoResp(SCliConn* conn) {
- bool res = false;
- if (!transQueueEmpty(&conn->cliMsgs)) {
- SCliMsg* pMsg = transQueueGet(&conn->cliMsgs, 0);
- if (REQUEST_NO_RESP(&pMsg->msg)) {
- TAOS_UNUSED(transQueuePop(&conn->cliMsgs));
- destroyCmsg(pMsg);
- res = true;
- }
- if (res == true) {
- if (cliMaySendCachedMsg(conn) == false) {
- SCliThrd* thrd = conn->hostThrd;
- addConnToPool(thrd->pool, conn);
- res = false;
- } else {
- res = true;
- }
- }
- }
- return res;
-}
-static void cliSendCb(uv_write_t* req, int status) {
- STUB_RAND_NETWORK_ERR(status);
- SCliConn* pConn = transReqQueueRemove(req);
- if (pConn == NULL) return;
+static FORCE_INLINE bool filterAllReq(void* e, void* arg) { return 1; }
- SCliMsg* pMsg = transQueueGet(&pConn->cliMsgs, 0);
- if (pMsg != NULL) {
- int64_t cost = taosGetTimestampUs() - pMsg->st;
- if (cost > 1000 * 50) {
- tTrace("%s conn %p send cost:%dus ", CONN_GET_INST_LABEL(pConn), pConn, (int)cost);
- }
- }
- if (pMsg != NULL && pMsg->msg.contLen == 0 && pMsg->msg.pCont != 0) {
- rpcFreeCont(pMsg->msg.pCont);
- pMsg->msg.pCont = 0;
+static void notifyAndDestroyReq(SCliConn* pConn, SCliReq* pReq, int32_t code) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+
+ SReqCtx* pCtx = pReq ? pReq->ctx : NULL;
+ STransMsg resp = {0};
+ resp.code = (pConn->connnected ? TSDB_CODE_RPC_BROKEN_LINK : TSDB_CODE_RPC_NETWORK_UNAVAIL);
+ if (code != 0) {
+ resp.code = code;
}
- if (status == 0) {
- tDebug("%s conn %p data already was written out", CONN_GET_INST_LABEL(pConn), pConn);
+ resp.msgType = pReq ? pReq->msg.msgType + 1 : 0;
+ resp.info.cliVer = pInst->compatibilityVer;
+ resp.info.ahandle = pCtx ? pCtx->ahandle : 0;
+ resp.info.handle = pReq->msg.info.handle;
+ if (pReq) {
+ resp.info.traceId = pReq->msg.info.traceId;
+ }
+
+ STraceId* trace = &resp.info.traceId;
+ tDebug("%s conn %p notify user and destroy msg %s since %s", CONN_GET_INST_LABEL(pConn), pConn,
+ TMSG_INFO(pReq->msg.msgType), tstrerror(resp.code));
+
+ // handle noresp and inter manage msg
+ if (pCtx == NULL || REQUEST_NO_RESP(&pReq->msg)) {
+ tDebug("%s conn %p destroy %s msg directly since %s", CONN_GET_INST_LABEL(pConn), pConn,
+ TMSG_INFO(pReq->msg.msgType), tstrerror(resp.code));
+ destroyReq(pReq);
+ return;
+ }
+
+ pReq->seq = 0;
+ code = cliNotifyCb(pConn, pReq, &resp);
+ if (code == TSDB_CODE_RPC_ASYNC_IN_PROCESS) {
+ return;
} else {
- if (!uv_is_closing((uv_handle_t*)&pConn->stream)) {
- tError("%s conn %p failed to write:%s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(status));
- cliHandleExcept(pConn, -1);
- }
- return;
+ // already notify user
+ destroyReq(pReq);
}
- if (cliHandleNoResp(pConn) == true) {
- tTrace("%s conn %p no resp required", CONN_GET_INST_LABEL(pConn), pConn);
- return;
- }
- TAOS_UNUSED(uv_read_start((uv_stream_t*)pConn->stream, cliAllocRecvBufferCb, cliRecvCb));
}
-void cliSendBatch(SCliConn* pConn) {
+
+static FORCE_INLINE void destroyReqInQueue(SCliConn* conn, queue* set, int32_t code) {
+ while (!QUEUE_IS_EMPTY(set)) {
+ queue* el = QUEUE_HEAD(set);
+ QUEUE_REMOVE(el);
+
+ SCliReq* pReq = QUEUE_DATA(el, SCliReq, q);
+ notifyAndDestroyReq(conn, pReq, code);
+ }
+}
+static FORCE_INLINE int32_t destroyAllReqs(SCliConn* conn) {
+ int32_t code = 0;
+ SCliThrd* pThrd = conn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+ queue set;
+ QUEUE_INIT(&set);
+ // TODO
+ // 1. from qId from thread table
+ // 2. not itera to all reqs
+ transQueueRemoveByFilter(&conn->reqsSentOut, filterAllReq, NULL, &set, -1);
+ transQueueRemoveByFilter(&conn->reqsToSend, filterAllReq, NULL, &set, -1);
+
+ destroyReqInQueue(conn, &set, 0);
+ return 0;
+}
+static void cliHandleException(SCliConn* conn) {
+ int32_t code = 0;
+ SCliThrd* pThrd = conn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+
+ cliResetConnTimer(conn);
+ code = destroyAllReqs(conn);
+ if (code != 0) {
+ tError("%s conn %p failed to destroy all reqs on conn since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code));
+ }
+
+ cliDestroyAllQidFromThrd(conn);
+ QUEUE_REMOVE(&conn->q);
+ if (conn->list) {
+ conn->list->totaSize -= 1;
+ conn->list = NULL;
+ }
+
+ if (conn->task != NULL) {
+ transDQCancel(((SCliThrd*)conn->hostThrd)->timeoutQueue, conn->task);
+ conn->task = NULL;
+ }
+ conn->forceDelFromHeap = 1;
+ code = delConnFromHeapCache(pThrd->connHeapCache, conn);
+ if (code != 0) {
+ tError("%s conn %p failed to del conn from heapcach since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code));
+ }
+
+ if (conn->registered) {
+ int8_t ref = transGetRefCount(conn);
+ if (ref == 0 && !uv_is_closing((uv_handle_t*)conn->stream)) {
+ uv_close((uv_handle_t*)conn->stream, cliDestroy);
+ }
+ }
+}
+
+bool filterToRmReq(void* h, void* arg) {
+ queue* el = h;
+ SCliReq* pReq = QUEUE_DATA(el, SCliReq, q);
+ if (pReq->sent == 1 && REQUEST_NO_RESP(&pReq->msg)) {
+ return true;
+ }
+ return false;
+}
+static void cliConnRmReqs(SCliConn* conn) {
+ queue set;
+ QUEUE_INIT(&set);
+
+ transQueueRemoveByFilter(&conn->reqsSentOut, filterToRmReq, NULL, &set, -1);
+ while (!QUEUE_IS_EMPTY(&set)) {
+ queue* el = QUEUE_HEAD(&set);
+ QUEUE_REMOVE(el);
+ SCliReq* pReq = QUEUE_DATA(el, SCliReq, q);
+ destroyReq(pReq);
+ }
+ return;
+}
+
+static void cliBatchSendCb(uv_write_t* req, int status) {
+ int32_t code = 0;
+ SWReqsWrapper* wrapper = (SWReqsWrapper*)req->data;
+ SCliConn* conn = wrapper->arg;
+
+ SCliThrd* pThrd = conn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+
+ freeWReqToWQ(&conn->wq, wrapper);
+
+ int32_t ref = transUnrefCliHandle(conn);
+ if (ref <= 0) {
+ return;
+ }
+ cliConnRmReqs(conn);
+ if (status != 0) {
+ tDebug("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(conn), conn, uv_err_name(status));
+ TAOS_UNUSED(transUnrefCliHandle(conn));
+ return;
+ }
+
+ cliConnMayUpdateTimer(conn, pInst->readTimeout * 1000);
+ if (conn->readerStart == 0) {
+ code = uv_read_start((uv_stream_t*)conn->stream, cliAllocRecvBufferCb, cliRecvCb);
+ if (code != 0) {
+ tDebug("%s conn %p failed to start read since%s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code));
+ TAOS_UNUSED(transUnrefCliHandle(conn));
+ return;
+ }
+ conn->readerStart = 1;
+ }
+
+ if (!cliMayRecycleConn(conn)) {
+ code = cliBatchSend(conn, 1);
+ if (code != 0) {
+ tDebug("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(conn), conn, tstrerror(code));
+ TAOS_UNUSED(transUnrefCliHandle(conn));
+ }
+ }
+}
+bool cliConnMayAddUserInfo(SCliConn* pConn, STransMsgHead** ppHead, int32_t* msgLen) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+ if (pConn->userInited == 1) {
+ return false;
+ }
+ STransMsgHead* pHead = *ppHead;
+ STransMsgHead* tHead = taosMemoryCalloc(1, *msgLen + sizeof(pInst->user));
+ memcpy((char*)tHead, (char*)pHead, TRANS_MSG_OVERHEAD);
+ memcpy((char*)tHead + TRANS_MSG_OVERHEAD, pInst->user, sizeof(pInst->user));
+
+ memcpy((char*)tHead + TRANS_MSG_OVERHEAD + sizeof(pInst->user), (char*)pHead + TRANS_MSG_OVERHEAD,
+ *msgLen - TRANS_MSG_OVERHEAD);
+
+ tHead->withUserInfo = 1;
+ *ppHead = tHead;
+ *msgLen += sizeof(pInst->user);
+
+ pConn->pInitUserReq = tHead;
+ pConn->userInited = 1;
+ return true;
+}
+int32_t cliBatchSend(SCliConn* pConn, int8_t direct) {
int32_t code = 0;
SCliThrd* pThrd = pConn->hostThrd;
- STrans* pTransInst = pThrd->pTransInst;
+ STrans* pInst = pThrd->pInst;
- SCliBatch* pBatch = pConn->pBatch;
- int32_t wLen = pBatch->wLen;
-
- pBatch->pList->connCnt += 1;
-
- uv_buf_t* wb = taosMemoryCalloc(wLen, sizeof(uv_buf_t));
- if (wb == NULL) {
- code = terrno;
- tError("%s conn %p failed to send batch msg since:%s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code));
- goto _exception;
+ if (pConn->broken) {
+ return 0;
}
- int i = 0;
- queue* h = NULL;
- QUEUE_FOREACH(h, &pBatch->wq) {
- SCliMsg* pCliMsg = QUEUE_DATA(h, SCliMsg, q);
+ if (pConn->connnected != 1) {
+ return 0;
+ }
- STransConnCtx* pCtx = pCliMsg->ctx;
+ if (!direct) {
+ if (pConn->inThreadSendq) {
+ return 0;
+ }
+ QUEUE_PUSH(&pThrd->batchSendSet, &pConn->batchSendq);
+ pConn->inThreadSendq = 1;
+ tDebug("%s conn %p batch send later", pInst->label, pConn);
+ return 0;
+ }
- STransMsg* pMsg = (STransMsg*)(&pCliMsg->msg);
- if (pMsg->pCont == 0) {
- pMsg->pCont = (void*)rpcMallocCont(0);
- if (pMsg->pCont == NULL) {
- code = TSDB_CODE_OUT_OF_BUFFER;
- tError("%s conn %p failed to send batch msg since:%s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code));
- goto _exception;
+ int32_t size = transQueueSize(&pConn->reqsToSend);
+
+ int32_t totalLen = 0;
+ if (size == 0) {
+ tDebug("%s conn %p not msg to send", pInst->label, pConn);
+ return 0;
+ }
+ uv_buf_t* wb = NULL;
+ if (pConn->bufSize < size) {
+ uv_buf_t* twb = (uv_buf_t*)taosMemoryRealloc(pConn->buf, size * sizeof(uv_buf_t));
+ if (twb == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ pConn->buf = twb;
+ pConn->bufSize = size;
+ }
+
+ wb = pConn->buf;
+
+ int j = 0;
+ int32_t batchLimit = 64;
+ while (!transQueueEmpty(&pConn->reqsToSend)) {
+ queue* h = transQueuePop(&pConn->reqsToSend);
+ SCliReq* pCliMsg = QUEUE_DATA(h, SCliReq, q);
+ SReqCtx* pCtx = pCliMsg->ctx;
+ pConn->seq++;
+
+ STransMsg* pReq = (STransMsg*)(&pCliMsg->msg);
+ if (pReq->pCont == 0) {
+ pReq->pCont = (void*)rpcMallocCont(0);
+ if (pReq->pCont == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
}
- pMsg->contLen = 0;
+ pReq->contLen = 0;
}
- int msgLen = transMsgLenFromCont(pMsg->contLen);
- STransMsgHead* pHead = transHeadFromCont(pMsg->pCont);
+ int32_t msgLen = transMsgLenFromCont(pReq->contLen);
+ STransMsgHead* pHead = transHeadFromCont(pReq->pCont);
+
+ char* content = pReq->pCont;
+ int32_t contLen = pReq->contLen;
+ if (cliConnMayAddUserInfo(pConn, &pHead, &msgLen)) {
+ content = transContFromHead(pHead);
+ contLen = transContLenFromMsg(msgLen);
+ }
if (pHead->comp == 0) {
- pHead->ahandle = pCtx != NULL ? (uint64_t)pCtx->ahandle : 0;
- pHead->noResp = REQUEST_NO_RESP(pMsg) ? 1 : 0;
- pHead->persist = REQUEST_PERSIS_HANDLE(pMsg) ? 1 : 0;
- pHead->msgType = pMsg->msgType;
+ pHead->noResp = REQUEST_NO_RESP(pReq) ? 1 : 0;
+ pHead->msgType = pReq->msgType;
pHead->msgLen = (int32_t)htonl((uint32_t)msgLen);
- pHead->release = REQUEST_RELEASE_HANDLE(pCliMsg) ? 1 : 0;
- memcpy(pHead->user, pTransInst->user, strlen(pTransInst->user));
- pHead->traceId = pMsg->info.traceId;
+ pHead->traceId = pReq->info.traceId;
pHead->magicNum = htonl(TRANS_MAGIC_NUM);
pHead->version = TRANS_VER;
- pHead->compatibilityVer = htonl(pTransInst->compatibilityVer);
+ pHead->compatibilityVer = htonl(pInst->compatibilityVer);
}
- pHead->timestamp = taosHton64(taosGetTimestampUs());
+ pHead->timestamp = taosHton64(pCliMsg->st);
+ pHead->seqNum = taosHton64(pConn->seq);
+ pHead->qid = taosHton64(pReq->info.qId);
- if (pHead->comp == 0 && pMsg->info.compressed == 0 && pConn->clientIp != pConn->serverIp) {
- if (pTransInst->compressSize != -1 && pTransInst->compressSize < pMsg->contLen) {
- msgLen = transCompressMsg(pMsg->pCont, pMsg->contLen) + sizeof(STransMsgHead);
+ if (pHead->comp == 0) {
+ if (pInst->compressSize != -1 && pInst->compressSize < contLen) {
+ msgLen = transCompressMsg(content, contLen) + sizeof(STransMsgHead);
pHead->msgLen = (int32_t)htonl((uint32_t)msgLen);
}
} else {
msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen));
}
- wb[i++] = uv_buf_init((char*)pHead, msgLen);
- }
+ wb[j++] = uv_buf_init((char*)pHead, msgLen);
+ totalLen += msgLen;
- uv_write_t* req = taosMemoryCalloc(1, sizeof(uv_write_t));
+ pCliMsg->sent = 1;
+ pCliMsg->seq = pConn->seq;
+
+ STraceId* trace = &pCliMsg->msg.info.traceId;
+ tGDebug("%s conn %p %s is sent to %s, local info:%s, seq:%" PRId64 ", sid:%" PRId64 "", CONN_GET_INST_LABEL(pConn),
+ pConn, TMSG_INFO(pReq->msgType), pConn->dst, pConn->src, pConn->seq, pReq->info.qId);
+ transQueuePush(&pConn->reqsSentOut, &pCliMsg->q);
+ if (j >= batchLimit) {
+ break;
+ }
+ }
+ transRefCliHandle(pConn);
+ uv_write_t* req = allocWReqFromWQ(&pConn->wq, pConn);
if (req == NULL) {
- code = terrno;
- tError("%s conn %p failed to send batch msg since:%s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code));
- goto _exception;
- }
- req->data = pConn;
- tDebug("%s conn %p start to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(pConn), pConn,
- pBatch->wLen, pBatch->batchSize);
-
- code = uv_write(req, (uv_stream_t*)pConn->stream, wb, wLen, cliSendBatchCb);
- if (code != 0) {
- tDebug("%s conn %p failed to to send batch msg since %s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(code));
- goto _exception;
+ tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(terrno));
+ transRefCliHandle(pConn);
+ return terrno;
}
- taosMemoryFree(wb);
- return;
+ tDebug("%s conn %p start to send msg, batch size:%d, len:%d", CONN_GET_INST_LABEL(pConn), pConn, j, totalLen);
-_exception:
- cliDestroyBatch(pBatch);
- taosMemoryFree(wb);
- pConn->pBatch = NULL;
- return;
+ int32_t ret = uv_write(req, (uv_stream_t*)pConn->stream, wb, j, cliBatchSendCb);
+ if (ret != 0) {
+ tError("%s conn %p failed to send msg since %s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(ret));
+ freeWReqToWQ(&pConn->wq, req->data);
+ code = TSDB_CODE_THIRDPARTY_ERROR;
+ TAOS_UNUSED(transUnrefCliHandle(pConn));
+ }
+
+ return code;
}
-void cliSend(SCliConn* pConn) {
- SCliThrd* pThrd = pConn->hostThrd;
- STrans* pTransInst = pThrd->pTransInst;
- if (transQueueEmpty(&pConn->cliMsgs)) {
- tError("%s conn %p not msg to send", pTransInst->label, pConn);
- cliHandleExcept(pConn, -1);
- return;
+int32_t cliSendReq(SCliConn* pConn, SCliReq* pCliMsg) {
+ transQueuePush(&pConn->reqsToSend, &pCliMsg->q);
+
+ return cliBatchSend(pConn, pCliMsg->inRetry);
+}
+int32_t cliSendReqPrepare(SCliConn* pConn, SCliReq* pCliMsg) {
+ transQueuePush(&pConn->reqsToSend, &pCliMsg->q);
+
+ if (pConn->broken) {
+ return 0;
}
- SCliMsg* pCliMsg = NULL;
- CONN_GET_NEXT_SENDMSG(pConn);
- pCliMsg->sent = 1;
-
- STransConnCtx* pCtx = pCliMsg->ctx;
-
- STransMsg* pMsg = (STransMsg*)(&pCliMsg->msg);
- if (pMsg->pCont == 0) {
- pMsg->pCont = (void*)rpcMallocCont(0);
- tDebug("malloc memory: %p", pMsg->pCont);
- pMsg->contLen = 0;
+ if (pConn->connnected != 1) {
+ return 0;
}
-
- int msgLen = transMsgLenFromCont(pMsg->contLen);
- STransMsgHead* pHead = transHeadFromCont(pMsg->pCont);
-
- if (pHead->comp == 0) {
- pHead->ahandle = pCtx != NULL ? (uint64_t)pCtx->ahandle : 0;
- pHead->noResp = REQUEST_NO_RESP(pMsg) ? 1 : 0;
- pHead->persist = REQUEST_PERSIS_HANDLE(pMsg) ? 1 : 0;
- pHead->msgType = pMsg->msgType;
- pHead->msgLen = (int32_t)htonl((uint32_t)msgLen);
- pHead->release = REQUEST_RELEASE_HANDLE(pCliMsg) ? 1 : 0;
- memcpy(pHead->user, pTransInst->user, strlen(pTransInst->user));
- pHead->traceId = pMsg->info.traceId;
- pHead->magicNum = htonl(TRANS_MAGIC_NUM);
- pHead->version = TRANS_VER;
- pHead->compatibilityVer = htonl(pTransInst->compatibilityVer);
- }
- pHead->timestamp = taosHton64(taosGetTimestampUs());
-
- if (pHead->persist == 1) {
- CONN_SET_PERSIST_BY_APP(pConn);
- }
-
- STraceId* trace = &pMsg->info.traceId;
-
- if (pTransInst->startTimer != NULL && pTransInst->startTimer(0, pMsg->msgType)) {
- uv_timer_t* timer = taosArrayGetSize(pThrd->timerList) > 0 ? *(uv_timer_t**)taosArrayPop(pThrd->timerList) : NULL;
- if (timer == NULL) {
- timer = taosMemoryCalloc(1, sizeof(uv_timer_t));
- if (timer == NULL) {
- tError("failed to alloc timer since %s", tstrerror(terrno));
- }
- tDebug("no available timer, create a timer %p", timer);
- TAOS_UNUSED(uv_timer_init(pThrd->loop, timer));
- }
- if (timer != NULL) {
- timer->data = pConn;
- pConn->timer = timer;
- }
-
- tGTrace("%s conn %p start timer for msg:%s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pMsg->msgType));
- TAOS_UNUSED(uv_timer_start((uv_timer_t*)pConn->timer, cliReadTimeoutCb, TRANS_READ_TIMEOUT, 0));
- }
-
- if (pHead->comp == 0 && pMsg->info.compressed == 0 && pConn->clientIp != pConn->serverIp) {
- if (pTransInst->compressSize != -1 && pTransInst->compressSize < pMsg->contLen) {
- msgLen = transCompressMsg(pMsg->pCont, pMsg->contLen) + sizeof(STransMsgHead);
- pHead->msgLen = (int32_t)htonl((uint32_t)msgLen);
- }
- } else {
- msgLen = (int32_t)ntohl((uint32_t)(pHead->msgLen));
- }
-
- tGDebug("%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, msgLen);
-
- uv_buf_t wb = uv_buf_init((char*)pHead, msgLen);
- uv_write_t* req = transReqQueuePush(&pConn->wreqQueue);
- if (req == NULL) {
- tGError("%s conn %p failed to send msg:%s, errmsg:%s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pMsg->msgType),
- tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- cliHandleExcept(pConn, -1);
- }
-
- int status = uv_write(req, (uv_stream_t*)pConn->stream, &wb, 1, cliSendCb);
- if (status != 0) {
- tGError("%s conn %p failed to send msg:%s, errmsg:%s", CONN_GET_INST_LABEL(pConn), pConn, TMSG_INFO(pMsg->msgType),
- uv_err_name(status));
- cliHandleExcept(pConn, -1);
- }
- return;
-_RETURN:
- return;
+ // return cliBatchSend(pConn);
+ return 0;
}
static void cliDestroyBatch(SCliBatch* pBatch) {
@@ -1364,215 +1504,96 @@ static void cliDestroyBatch(SCliBatch* pBatch) {
queue* h = QUEUE_HEAD(&pBatch->wq);
QUEUE_REMOVE(h);
- SCliMsg* p = QUEUE_DATA(h, SCliMsg, q);
- destroyCmsg(p);
+ SCliReq* p = QUEUE_DATA(h, SCliReq, q);
+ destroyReq(p);
}
SCliBatchList* p = pBatch->pList;
p->sending -= 1;
taosMemoryFree(pBatch);
}
-static void cliHandleBatchReq(SCliBatch* pBatch, SCliThrd* pThrd) {
- int32_t code = 0;
- if (pThrd->quit == true) {
- cliDestroyBatch(pBatch);
- return;
+
+static int32_t cliDoConn(SCliThrd* pThrd, SCliConn* conn) {
+ int32_t lino = 0;
+ STrans* pInst = pThrd->pInst;
+
+ uint32_t ipaddr;
+ int32_t code = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, conn->ipStr, &ipaddr);
+ if (code != 0) {
+ TAOS_CHECK_GOTO(code, &lino, _exception1);
}
- if (pBatch == NULL || pBatch->wLen == 0 || QUEUE_IS_EMPTY(&pBatch->wq)) {
- return;
- }
- STrans* pTransInst = pThrd->pTransInst;
- SCliBatchList* pList = pBatch->pList;
+ struct sockaddr_in addr;
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = ipaddr;
+ addr.sin_port = (uint16_t)htons(conn->port);
- char key[TSDB_FQDN_LEN + 64] = {0};
- CONN_CONSTRUCT_HASH_KEY(key, pList->ip, pList->port);
+ tTrace("%s conn %p try to connect to %s", pInst->label, conn, conn->dstAddr);
- bool exceed = false;
- SCliConn* conn = getConnFromPool(pThrd, key, &exceed);
-
- if (conn == NULL && exceed) {
- tError("%s failed to send batch msg, batch size:%d, msgLen: %d, conn limit:%d", pTransInst->label, pBatch->wLen,
- pBatch->batchSize, pTransInst->connLimitNum);
- cliDestroyBatch(pBatch);
- return;
- }
- if (conn == NULL) {
- code = cliCreateConn(pThrd, &conn);
- if (code != 0) {
- tError("%s failed to send batch msg, batch size:%d, msgLen: %d, conn limit:%d, reason:%s", pTransInst->label,
- pBatch->wLen, pBatch->batchSize, pTransInst->connLimitNum, tstrerror(code));
- cliDestroyBatch(pBatch);
- return;
- }
-
- conn->pBatch = pBatch;
- conn->dstAddr = taosStrdup(pList->dst);
- if (conn->dstAddr == NULL) {
- tError("%s conn %p failed to send batch msg, reason:%s", transLabel(pTransInst), conn,
- tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- cliHandleFastFail(conn, -1);
- return;
- }
-
- uint32_t ipaddr = 0;
- if ((code = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, pList->ip, &ipaddr)) != 0) {
- cliResetTimer(pThrd, conn);
- cliHandleFastFail(conn, code);
- return;
- }
-
- struct sockaddr_in addr;
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = ipaddr;
- addr.sin_port = (uint16_t)htons(pList->port);
-
- tTrace("%s conn %p try to connect to %s", pTransInst->label, conn, pList->dst);
- int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10);
- if (fd == -1) {
- tError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, tstrerror(terrno));
- cliHandleFastFail(conn, -1);
- return;
- }
- int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd);
- if (ret != 0) {
- tError("%s conn %p failed to set stream, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
- cliHandleFastFail(conn, -1);
- return;
- }
- ret = transSetConnOption((uv_tcp_t*)conn->stream, 20);
- if (ret != 0) {
- tError("%s conn %p failed to set socket opt, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
- cliHandleFastFail(conn, -1);
- return;
- }
-
- ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
- if (ret != 0) {
- cliResetTimer(pThrd, conn);
-
- cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr);
- cliHandleFastFail(conn, -1);
- return;
- }
- TAOS_UNUSED(uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0));
- return;
+ int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10);
+ if (fd < 0) {
+ TAOS_CHECK_GOTO(terrno, &lino, _exception1);
}
- conn->pBatch = pBatch;
- cliSendBatch(conn);
-}
-static void cliSendBatchCb(uv_write_t* req, int status) {
- STUB_RAND_NETWORK_ERR(status);
- SCliConn* conn = req->data;
- SCliThrd* thrd = conn->hostThrd;
- SCliBatch* p = conn->pBatch;
-
- SCliBatchList* pBatchList = p->pList;
- SCliBatch* nxtBatch = cliGetHeadFromList(pBatchList);
- pBatchList->connCnt -= 1;
-
- conn->pBatch = NULL;
-
- if (status != 0) {
- tDebug("%s conn %p failed to send batch msg, batch size:%d, msgLen:%d, reason:%s", CONN_GET_INST_LABEL(conn), conn,
- p->wLen, p->batchSize, uv_err_name(status));
-
- if (!uv_is_closing((uv_handle_t*)&conn->stream)) cliHandleExcept(conn, -1);
-
- cliHandleBatchReq(nxtBatch, thrd);
- } else {
- tDebug("%s conn %p succ to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(conn), conn, p->wLen,
- p->batchSize);
- if (!uv_is_closing((uv_handle_t*)&conn->stream) && conn->broken == false) {
- if (nxtBatch != NULL) {
- conn->pBatch = nxtBatch;
- cliSendBatch(conn);
- } else {
- addConnToPool(thrd->pool, conn);
- }
- } else {
- cliDestroyBatch(nxtBatch);
- // conn release by other callback
- }
+ int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd);
+ if (ret != 0) {
+ tError("%s conn %p failed to set stream since %s", transLabel(pInst), conn, uv_err_name(ret));
+ TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1);
+ }
+ ret = transSetConnOption((uv_tcp_t*)conn->stream, 20);
+ if (ret != 0) {
+ tError("%s conn %p failed to set socket opt since %s", transLabel(pInst), conn, uv_err_name(ret));
+ TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1);
+ return code;
}
- cliDestroyBatch(p);
- taosMemoryFree(req);
-}
-static void cliHandleFastFail(SCliConn* pConn, int status) {
- SCliThrd* pThrd = pConn->hostThrd;
- STrans* pTransInst = pThrd->pTransInst;
+ transRefCliHandle(conn);
+ ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
+ if (ret != 0) {
+ tError("failed connect to %s since %s", conn->dstAddr, uv_err_name(ret));
- if (status == -1) status = UV_EADDRNOTAVAIL;
-
- if (pConn->pBatch == NULL) {
- SCliMsg* pMsg = transQueueGet(&pConn->cliMsgs, 0);
-
- STraceId* trace = &pMsg->msg.info.traceId;
- tGError("%s msg %s failed to send, conn %p failed to connect to %s, reason: %s", CONN_GET_INST_LABEL(pConn),
- TMSG_INFO(pMsg->msg.msgType), pConn, pConn->dstAddr, uv_strerror(status));
-
- if (pMsg != NULL && REQUEST_NO_RESP(&pMsg->msg) &&
- (pTransInst->failFastFp != NULL && pTransInst->failFastFp(pMsg->msg.msgType))) {
- SFailFastItem* item = taosHashGet(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr));
- int64_t cTimestamp = taosGetTimestampMs();
- if (item != NULL) {
- int32_t elapse = cTimestamp - item->timestamp;
- if (elapse >= 0 && elapse <= pTransInst->failFastInterval) {
- item->count++;
- } else {
- item->count = 1;
- item->timestamp = cTimestamp;
- }
- } else {
- SFailFastItem item = {.count = 1, .timestamp = cTimestamp};
- int32_t code =
- taosHashPut(pThrd->failFastCache, pConn->dstAddr, strlen(pConn->dstAddr), &item, sizeof(SFailFastItem));
- if (code != 0) {
- tError("failed to put fail-fast item to cache, reason:%s", tstrerror(code));
- }
- }
- }
- } else {
- tError("%s batch msg failed to send, conn %p failed to connect to %s, reason: %s", CONN_GET_INST_LABEL(pConn),
- pConn, pConn->dstAddr, uv_strerror(status));
- cliDestroyBatch(pConn->pBatch);
- pConn->pBatch = NULL;
+ TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception1);
}
- cliHandleExcept(pConn, status);
+
+ conn->registered = 1;
+ transRefCliHandle(conn);
+ ret = uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0);
+ if (ret != 0) {
+ tError("%s conn %p failed to start timer since %s", transLabel(pInst), conn, uv_err_name(ret));
+ TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, &lino, _exception2);
+ }
+ return TSDB_CODE_RPC_ASYNC_IN_PROCESS;
+
+_exception1:
+ tError("%s conn %p failed to do connect since %s", transLabel(pInst), conn, tstrerror(code));
+ cliDestroyConn(conn, true);
+ return code;
+
+_exception2:
+ TAOS_UNUSED(transUnrefCliHandle(conn));
+ tError("%s conn %p failed to do connect since %s", transLabel(pInst), conn, tstrerror(code));
+ return code;
}
-void cliConnCb(uv_connect_t* req, int status) {
- SCliConn* pConn = req->data;
- SCliThrd* pThrd = pConn->hostThrd;
- bool timeout = false;
-
- if (pConn->timer == NULL) {
- timeout = true;
- } else {
- cliResetTimer(pThrd, pConn);
- }
-
- STUB_RAND_NETWORK_ERR(status);
-
- if (status != 0) {
- cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, pConn->dstAddr);
- if (timeout == false) {
- cliHandleFastFail(pConn, status);
- } else if (timeout == true) {
- // already deal by timeout
- }
- return;
- }
-
+int32_t cliConnSetSockInfo(SCliConn* pConn) {
struct sockaddr peername, sockname;
int addrlen = sizeof(peername);
- TAOS_UNUSED(uv_tcp_getpeername((uv_tcp_t*)pConn->stream, &peername, &addrlen));
- TAOS_UNUSED(transSockInfo2Str(&peername, pConn->dst));
+
+ int32_t code = uv_tcp_getpeername((uv_tcp_t*)pConn->stream, &peername, &addrlen);
+ if (code != 0) {
+ tWarn("failed to get perrname since %s", uv_err_name(code));
+ code = TSDB_CODE_THIRDPARTY_ERROR;
+ return code;
+ }
+ transSockInfo2Str(&peername, pConn->dst);
addrlen = sizeof(sockname);
- TAOS_UNUSED(uv_tcp_getsockname((uv_tcp_t*)pConn->stream, &sockname, &addrlen));
- TAOS_UNUSED(transSockInfo2Str(&sockname, pConn->src));
+ code = uv_tcp_getsockname((uv_tcp_t*)pConn->stream, &sockname, &addrlen);
+ if (code != 0) {
+ tWarn("failed to get sock name since %s", uv_err_name(code));
+ code = TSDB_CODE_THIRDPARTY_ERROR;
+ return code;
+ }
+ transSockInfo2Str(&sockname, pConn->src);
struct sockaddr_in addr = *(struct sockaddr_in*)&sockname;
struct sockaddr_in saddr = *(struct sockaddr_in*)&peername;
@@ -1580,182 +1601,164 @@ void cliConnCb(uv_connect_t* req, int status) {
pConn->clientIp = addr.sin_addr.s_addr;
pConn->serverIp = saddr.sin_addr.s_addr;
- tTrace("%s conn %p connect to server successfully", CONN_GET_INST_LABEL(pConn), pConn);
- if (pConn->pBatch != NULL) {
- cliSendBatch(pConn);
+ return 0;
+};
+
+// static int32_t cliBuildExeceptMsg(SCliConn* pConn, SCliReq* pReq, STransMsg* pResp) {
+// SCliThrd* pThrd = pConn->hostThrd;
+// STrans* pInst = pThrd->pInst;
+// memset(pResp, 0, sizeof(STransMsg));
+// STransMsg resp = {0};
+// resp.contLen = 0;
+// resp.pCont = NULL;
+// resp.msgType = pReq->msg.msgType + 1;
+// resp.info.ahandle = pReq->ctx->ahandle;
+// resp.info.traceId = pReq->msg.info.traceId;
+// resp.info.hasEpSet = false;
+// resp.info.cliVer = pInst->compatibilityVer;
+// return 0;
+// }
+
+bool filteGetAll(void* q, void* arg) { return true; }
+void cliConnCb(uv_connect_t* req, int status) {
+ int32_t code = 0;
+ SCliConn* pConn = req->data;
+ SCliThrd* pThrd = pConn->hostThrd;
+ bool timeout = false;
+
+ int32_t ref = transUnrefCliHandle(pConn);
+ if (ref <= 0) {
+ return;
+ }
+ if (pConn->timer == NULL) {
+ timeout = true;
+ return;
} else {
- cliSend(pConn);
+ cliResetConnTimer(pConn);
+ }
+
+ STUB_RAND_NETWORK_ERR(status);
+
+ if (status != 0) {
+ tDebug("%s conn %p failed to connect to %s since %s", CONN_GET_INST_LABEL(pConn), pConn, pConn->dstAddr,
+ uv_strerror(status));
+ TAOS_UNUSED(transUnrefCliHandle(pConn));
+ return;
+ }
+ pConn->connnected = 1;
+ code = cliConnSetSockInfo(pConn);
+ if (code != 0) {
+ tDebug("%s conn %p failed to get sock info since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code));
+ TAOS_UNUSED(transUnrefCliHandle(pConn));
+ }
+ tTrace("%s conn %p connect to server successfully", CONN_GET_INST_LABEL(pConn), pConn);
+
+ code = cliBatchSend(pConn, 1);
+ if (code != 0) {
+ tDebug("%s conn %p failed to get sock info since %s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code));
+ TAOS_UNUSED(transUnrefCliHandle(pConn));
}
}
-static void doNotifyApp(SCliMsg* pMsg, SCliThrd* pThrd, int32_t code) {
- STransConnCtx* pCtx = pMsg->ctx;
- STrans* pTransInst = pThrd->pTransInst;
+static void doNotifyCb(SCliReq* pReq, SCliThrd* pThrd, int32_t code) {
+ SReqCtx* pCtx = pReq->ctx;
+ STrans* pInst = pThrd->pInst;
- STransMsg transMsg = {0};
- transMsg.contLen = 0;
- transMsg.pCont = NULL;
- transMsg.code = code;
- transMsg.msgType = pMsg->msg.msgType + 1;
- transMsg.info.ahandle = pMsg->ctx->ahandle;
- transMsg.info.traceId = pMsg->msg.info.traceId;
- transMsg.info.hasEpSet = false;
- transMsg.info.cliVer = pTransInst->compatibilityVer;
+ STransMsg resp = {0};
+ resp.contLen = 0;
+ resp.pCont = NULL;
+ resp.code = code;
+ resp.msgType = pReq->msg.msgType + 1;
+ resp.info.ahandle = pReq->ctx->ahandle;
+ resp.info.traceId = pReq->msg.info.traceId;
+ resp.info.hasEpSet = false;
+ resp.info.cliVer = pInst->compatibilityVer;
if (pCtx->pSem != NULL) {
if (pCtx->pRsp == NULL) {
} else {
- memcpy((char*)pCtx->pRsp, (char*)&transMsg, sizeof(transMsg));
+ memcpy((char*)pCtx->pRsp, (char*)&resp, sizeof(resp));
}
} else {
- pTransInst->cfp(pTransInst->parent, &transMsg, NULL);
+ pInst->cfp(pInst->parent, &resp, NULL);
}
- destroyCmsg(pMsg);
+ destroyReq(pReq);
}
-static void cliHandleQuit(SCliMsg* pMsg, SCliThrd* pThrd) {
+static void cliHandleQuit(SCliThrd* pThrd, SCliReq* pReq) {
if (!transAsyncPoolIsEmpty(pThrd->asyncPool)) {
- pThrd->stopMsg = pMsg;
+ pThrd->stopMsg = pReq;
return;
}
pThrd->stopMsg = NULL;
pThrd->quit = true;
+
tDebug("cli work thread %p start to quit", pThrd);
- destroyCmsg(pMsg);
+ destroyReq(pReq);
TAOS_UNUSED(destroyConnPool(pThrd));
TAOS_UNUSED(uv_walk(pThrd->loop, cliWalkCb, NULL));
}
-static void cliHandleRelease(SCliMsg* pMsg, SCliThrd* pThrd) {
- int64_t refId = (int64_t)(pMsg->msg.info.handle);
- SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId);
- if (exh == NULL) {
- tDebug("%" PRId64 " already released", refId);
- destroyCmsg(pMsg);
- return;
+static void cliHandleRelease(SCliThrd* pThrd, SCliReq* pReq) { return; }
+static void cliHandleUpdate(SCliThrd* pThrd, SCliReq* pReq) {
+ SReqCtx* pCtx = pReq->ctx;
+ if (pThrd->pCvtAddr != NULL) {
+ taosMemoryFreeClear(pThrd->pCvtAddr);
}
-
- taosRLockLatch(&exh->latch);
- SCliConn* conn = exh->handle;
- taosRUnLockLatch(&exh->latch);
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), refId));
- tDebug("%s conn %p start to release to inst", CONN_GET_INST_LABEL(conn), conn);
-
- if (T_REF_VAL_GET(conn) == 2) {
- transUnrefCliHandle(conn);
- if (!transQueuePush(&conn->cliMsgs, pMsg)) {
- return;
- }
- cliSend(conn);
- } else {
- tError("%s conn %p already released", CONN_GET_INST_LABEL(conn), conn);
- destroyCmsg(pMsg);
- }
-}
-static void cliHandleUpdate(SCliMsg* pMsg, SCliThrd* pThrd) {
- STransConnCtx* pCtx = pMsg->ctx;
- pThrd->cvtAddr = pCtx->cvtAddr;
- destroyCmsg(pMsg);
-}
-static void cliHandleFreeById(SCliMsg* pMsg, SCliThrd* pThrd) {
- int32_t code = 0;
- int64_t refId = (int64_t)(pMsg->msg.info.handle);
- SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId);
- if (exh == NULL) {
- tDebug("refId %" PRId64 " already released", refId);
- destroyCmsg(pMsg);
- return;
- }
-
- taosRLockLatch(&exh->latch);
- SCliConn* conn = exh->handle;
- taosRUnLockLatch(&exh->latch);
-
- if (conn == NULL || conn->refId != refId) {
- TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _exception);
- }
- tDebug("do free conn %p by refId %" PRId64 "", conn, refId);
-
- int32_t size = transQueueSize(&conn->cliMsgs);
- if (size == 0) {
- // already recv, and notify upper layer
- TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _exception);
- } else {
- destroyCmsg(pMsg);
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), refId));
-
- while (T_REF_VAL_GET(conn) >= 1) {
- transUnrefCliHandle(conn);
- }
- return;
- }
-_exception:
- tDebug("already free conn %p by id %" PRId64 "", conn, refId);
-
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), refId));
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), refId));
- TAOS_UNUSED(transRemoveExHandle(transGetRefMgt(), refId));
- destroyCmsg(pMsg);
+ pThrd->pCvtAddr = pCtx->pCvtAddr;
+ destroyReq(pReq);
+ return;
}
-SCliConn* cliGetConn(SCliMsg** pMsg, SCliThrd* pThrd, bool* ignore, char* addr) {
- STransConnCtx* pCtx = (*pMsg)->ctx;
- SCliConn* conn = NULL;
-
- int64_t refId = (int64_t)((*pMsg)->msg.info.handle);
- if (refId != 0) {
- SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId);
- if (exh == NULL) {
- tError("failed to get conn, refId: %" PRId64 "", refId);
- *ignore = true;
- return NULL;
- } else {
- taosRLockLatch(&exh->latch);
- conn = exh->handle;
- taosRUnLockLatch(&exh->latch);
- if (conn == NULL) {
- conn = getConnFromPool2(pThrd, addr, pMsg);
- if (conn != NULL) specifyConnRef(conn, true, refId);
- }
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), refId));
- }
- return conn;
- };
-
- conn = getConnFromPool2(pThrd, addr, pMsg);
- if (conn != NULL) {
- tTrace("%s conn %p get from conn pool:%p", CONN_GET_INST_LABEL(conn), conn, pThrd->pool);
- } else {
- tTrace("%s not found conn in conn pool:%p, dst:%s", ((STrans*)pThrd->pTransInst)->label, pThrd->pool, addr);
+FORCE_INLINE int32_t cliMayCvtFqdnToIp(SReqEpSet* pEpSet, const SCvtAddr* pCvtAddr) {
+ if (pEpSet == NULL || pCvtAddr == NULL) {
+ return 0;
}
- return conn;
-}
-FORCE_INLINE void cliMayCvtFqdnToIp(SEpSet* pEpSet, SCvtAddr* pCvtAddr) {
if (pCvtAddr->cvt == false) {
- return;
+ if (EPSET_IS_VALID(pEpSet)) {
+ return 0;
+ } else {
+ return TSDB_CODE_RPC_FQDN_ERROR;
+ }
}
+
if (pEpSet->numOfEps == 1 && strncmp(pEpSet->eps[0].fqdn, pCvtAddr->fqdn, TSDB_FQDN_LEN) == 0) {
memset(pEpSet->eps[0].fqdn, 0, TSDB_FQDN_LEN);
memcpy(pEpSet->eps[0].fqdn, pCvtAddr->ip, TSDB_FQDN_LEN);
}
+ if (EPSET_IS_VALID(pEpSet)) {
+ return 0;
+ }
+ return TSDB_CODE_RPC_FQDN_ERROR;
}
-FORCE_INLINE bool cliIsEpsetUpdated(int32_t code, STransConnCtx* pCtx) {
+FORCE_INLINE bool cliIsEpsetUpdated(int32_t code, SReqCtx* pCtx) {
if (code != 0) return false;
- // if (pCtx->retryCnt == 0) return false;
- if (transEpSetIsEqual(&pCtx->epSet, &pCtx->origEpSet)) return false;
- return true;
+
+ return transReqEpsetIsEqual(pCtx->epSet, pCtx->origEpSet) ? false : true;
}
-FORCE_INLINE int32_t cliBuildExceptResp(SCliMsg* pMsg, STransMsg* pResp) {
- if (pMsg == NULL) return -1;
- // memset(pResp, 0, sizeof(STransMsg));
+FORCE_INLINE int32_t cliBuildExceptResp(SCliThrd* pThrd, SCliReq* pReq, STransMsg* pResp) {
+ if (pReq == NULL) return -1;
+ STrans* pInst = pThrd->pInst;
+
+ SReqCtx* pCtx = pReq ? pReq->ctx : NULL;
+ STransMsg resp = {0};
+ // resp.code = (conn->connnected ? TSDB_CODE_RPC_BROKEN_LINK : TSDB_CODE_RPC_NETWORK_UNAVAIL);
+ pResp->msgType = pReq ? pReq->msg.msgType + 1 : 0;
+ pResp->info.cliVer = pInst->compatibilityVer;
+ pResp->info.ahandle = pCtx ? pCtx->ahandle : 0;
+ if (pReq) {
+ pResp->info.traceId = pReq->msg.info.traceId;
+ }
+
+ // handle noresp and inter manage msg
+ if (pCtx == NULL || REQUEST_NO_RESP(&pReq->msg)) {
+ return TSDB_CODE_RPC_NO_STATE;
+ }
if (pResp->code == 0) {
pResp->code = TSDB_CODE_RPC_BROKEN_LINK;
}
- pResp->msgType = pMsg->msg.msgType + 1;
- pResp->info.ahandle = pMsg->ctx ? pMsg->ctx->ahandle : NULL;
- pResp->info.traceId = pMsg->msg.info.traceId;
return 0;
}
@@ -1818,149 +1821,196 @@ static void cliMayUpdateFqdnCache(SHashObj* cache, char* dst) {
static void doFreeTimeoutMsg(void* param) {
STaskArg* arg = param;
- SCliMsg* pMsg = arg->param1;
+ SCliReq* pReq = arg->param1;
SCliThrd* pThrd = arg->param2;
- STrans* pTransInst = pThrd->pTransInst;
- int32_t code = TSDB_CODE_RPC_MAX_SESSIONS;
- QUEUE_REMOVE(&pMsg->q);
- STraceId* trace = &pMsg->msg.info.traceId;
- tGTrace("%s msg %s cannot get available conn after timeout", pTransInst->label, TMSG_INFO(pMsg->msg.msgType));
- doNotifyApp(pMsg, pThrd, code);
+ STrans* pInst = pThrd->pInst;
+
+ QUEUE_REMOVE(&pReq->q);
+ STraceId* trace = &pReq->msg.info.traceId;
+
+ tGTrace("%s msg %s cannot get available conn after timeout", pInst->label, TMSG_INFO(pReq->msg.msgType));
+ doNotifyCb(pReq, pThrd, TSDB_CODE_RPC_MAX_SESSIONS);
+
taosMemoryFree(arg);
}
-void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) {
- int32_t code = 0;
- STrans* pTransInst = pThrd->pTransInst;
-
- cliMayCvtFqdnToIp(&pMsg->ctx->epSet, &pThrd->cvtAddr);
- if (!EPSET_IS_VALID(&pMsg->ctx->epSet)) {
- destroyCmsg(pMsg);
- return;
- }
-
- char* fqdn = EPSET_GET_INUSE_IP(&pMsg->ctx->epSet);
- uint16_t port = EPSET_GET_INUSE_PORT(&pMsg->ctx->epSet);
- char addr[TSDB_FQDN_LEN + 64] = {0};
- CONN_CONSTRUCT_HASH_KEY(addr, fqdn, port);
-
- bool ignore = false;
- SCliConn* conn = cliGetConn(&pMsg, pThrd, &ignore, addr);
- if (ignore == true) {
- // persist conn already release by server
- STransMsg resp = {0};
- TAOS_UNUSED(cliBuildExceptResp(pMsg, &resp));
- // refactorr later
- resp.info.cliVer = pTransInst->compatibilityVer;
-
- if (pMsg->type != Release) {
- pTransInst->cfp(pTransInst->parent, &resp, NULL);
+int32_t cliHandleState_mayUpdateStateTime(SCliConn* pConn, SCliReq* pReq) {
+ int64_t qid = pReq->msg.info.qId;
+ if (qid > 0) {
+ STransCtx* pUserCtx = taosHashGet(pConn->pQTable, &qid, sizeof(qid));
+ if (pUserCtx != NULL) {
+ pUserCtx->st = taosGetTimestampUs();
}
- destroyCmsg(pMsg);
- return;
}
- if (conn == NULL && pMsg == NULL) {
- return;
+ return 0;
+}
+int32_t cliHandleState_mayUpdateStateCtx(SCliConn* pConn, SCliReq* pReq) {
+ int32_t code = 0;
+ int64_t qid = pReq->msg.info.qId;
+ SReqCtx* pCtx = pReq->ctx;
+ SCliThrd* pThrd = pConn->hostThrd;
+ if (pCtx == NULL) {
+ tDebug("%s conn %p not need to update statue ctx, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid);
+ return 0;
}
- STraceId* trace = &pMsg->msg.info.traceId;
- if (conn != NULL) {
- transCtxMerge(&conn->ctx, &pMsg->ctx->appCtx);
- TAOS_UNUSED(transQueuePush(&conn->cliMsgs, pMsg));
- cliSend(conn);
+ STransCtx* pUserCtx = taosHashGet(pConn->pQTable, &qid, sizeof(qid));
+ if (pUserCtx == NULL) {
+ pCtx->userCtx.st = taosGetTimestampUs();
+ code = taosHashPut(pConn->pQTable, &qid, sizeof(qid), &pCtx->userCtx, sizeof(pCtx->userCtx));
+ tDebug("%s conn %p succ to add statue ctx, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid);
} else {
- code = cliCreateConn(pThrd, &conn);
- if (code != 0) {
- tError("%s failed to create conn, reason:%s", pTransInst->label, tstrerror(code));
- STransMsg resp = {.code = code};
- TAOS_UNUSED(cliBuildExceptResp(pMsg, &resp));
-
- resp.info.cliVer = pTransInst->compatibilityVer;
- if (pMsg->type != Release) {
- pTransInst->cfp(pTransInst->parent, &resp, NULL);
- }
- destroyCmsg(pMsg);
- return;
- }
-
- int64_t refId = (int64_t)pMsg->msg.info.handle;
- if (refId != 0) specifyConnRef(conn, true, refId);
-
- transCtxMerge(&conn->ctx, &pMsg->ctx->appCtx);
- TAOS_UNUSED(transQueuePush(&conn->cliMsgs, pMsg));
-
- conn->dstAddr = taosStrdup(addr);
- if (conn->dstAddr == NULL) {
- tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, tstrerror(terrno));
- cliHandleExcept(conn, -1);
- }
-
- uint32_t ipaddr;
- int32_t code = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, fqdn, &ipaddr);
- if (code != 0) {
- cliResetTimer(pThrd, conn);
- cliHandleExcept(conn, code);
- return;
- }
-
- struct sockaddr_in addr;
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = ipaddr;
- addr.sin_port = (uint16_t)htons(port);
-
- tGTrace("%s conn %p try to connect to %s", pTransInst->label, conn, conn->dstAddr);
- int32_t fd = taosCreateSocketWithTimeout(TRANS_CONN_TIMEOUT * 10);
- if (fd == -1) {
- tGError("%s conn %p failed to create socket, reason:%s", transLabel(pTransInst), conn, tstrerror(terrno));
- cliHandleExcept(conn, -1);
- terrno = 0;
- return;
- }
-
- int ret = uv_tcp_open((uv_tcp_t*)conn->stream, fd);
- if (ret != 0) {
- tGError("%s conn %p failed to set stream, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
- cliHandleExcept(conn, -1);
- return;
- }
-
- ret = transSetConnOption((uv_tcp_t*)conn->stream, tsKeepAliveIdle);
- if (ret != 0) {
- tGError("%s conn %p failed to set socket opt, reason:%s", transLabel(pTransInst), conn, uv_err_name(ret));
- cliHandleExcept(conn, -1);
- return;
- }
-
- ret = uv_tcp_connect(&conn->connReq, (uv_tcp_t*)(conn->stream), (const struct sockaddr*)&addr, cliConnCb);
- if (ret != 0) {
- cliResetTimer(pThrd, conn);
-
- cliMayUpdateFqdnCache(pThrd->fqdn2ipCache, conn->dstAddr);
- cliHandleFastFail(conn, ret);
- return;
- }
- TAOS_UNUSED(uv_timer_start(conn->timer, cliConnTimeout, TRANS_CONN_TIMEOUT, 0));
+ transCtxMerge(pUserCtx, &pCtx->userCtx);
+ pUserCtx->st = taosGetTimestampUs();
+ tDebug("%s conn %p succ to update statue ctx, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid);
}
- tGTrace("%s conn %p ready", pTransInst->label, conn);
+ return 0;
}
-static void cliNoBatchDealReq(queue* wq, SCliThrd* pThrd) {
+int32_t cliMayGetStateByQid(SCliThrd* pThrd, SCliReq* pReq, SCliConn** pConn) {
+ int32_t code = 0;
+ int64_t qid = pReq->msg.info.qId;
+ if (qid == 0) {
+ return TSDB_CODE_RPC_NO_STATE;
+ } else {
+ SExHandle* exh = transAcquireExHandle(transGetRefMgt(), qid);
+ if (exh == NULL) {
+ return TSDB_CODE_RPC_STATE_DROPED;
+ }
+
+ SReqState* pState = taosHashGet(pThrd->pIdConnTable, &qid, sizeof(qid));
+
+ if (pState == NULL) {
+ if (pReq->ctx == NULL) {
+ transReleaseExHandle(transGetRefMgt(), qid);
+ return TSDB_CODE_RPC_STATE_DROPED;
+ }
+ tDebug("%s conn %p failed to get statue, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid);
+ transReleaseExHandle(transGetRefMgt(), qid);
+ return TSDB_CODE_RPC_ASYNC_IN_PROCESS;
+ } else {
+ *pConn = pState->conn;
+ tDebug("%s conn %p succ to get conn of statue, sid:%" PRId64 "", transLabel(pThrd->pInst), pConn, qid);
+ }
+ transReleaseExHandle(transGetRefMgt(), qid);
+ return 0;
+ }
+}
+
+int32_t cliHandleState_mayUpdateState(SCliConn* pConn, SCliReq* pReq) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ int32_t code = 0;
+ int64_t qid = pReq->msg.info.qId;
+ if (qid == 0) {
+ return TSDB_CODE_RPC_NO_STATE;
+ }
+
+ SReqState state = {.conn = pConn, .arg = NULL};
+ code = taosHashPut(pThrd->pIdConnTable, &qid, sizeof(qid), &state, sizeof(state));
+ if (code != 0) {
+ tDebug("%s conn %p failed to statue, sid:%" PRId64 " since %s", transLabel(pThrd->pInst), pConn, qid,
+ tstrerror(code));
+ } else {
+ tDebug("%s conn %p succ to add statue, sid:%" PRId64 " (1)", transLabel(pThrd->pInst), pConn, qid);
+ }
+
+ TAOS_UNUSED(cliHandleState_mayUpdateStateCtx(pConn, pReq));
+ return code;
+}
+void cliHandleBatchReq(SCliThrd* pThrd, SCliReq* pReq) {
+ int32_t lino = 0;
+ STransMsg resp = {0};
+ int32_t code = (pThrd->initCb)(pThrd, pReq, NULL);
+ TAOS_CHECK_GOTO(code, &lino, _exception);
+
+ STrans* pInst = pThrd->pInst;
+ SCliConn* pConn = NULL;
+ code = cliMayGetStateByQid(pThrd, pReq, &pConn);
+ if (code == 0) {
+ TAOS_UNUSED(cliHandleState_mayUpdateStateCtx(pConn, pReq));
+ } else if (code == TSDB_CODE_RPC_STATE_DROPED) {
+ TAOS_CHECK_GOTO(code, &lino, _exception);
+ return;
+ } else if (code == TSDB_CODE_RPC_NO_STATE || code == TSDB_CODE_RPC_ASYNC_IN_PROCESS) {
+ char addr[TSDB_FQDN_LEN + 64] = {0};
+ char* ip = EPSET_GET_INUSE_IP(pReq->ctx->epSet);
+ int32_t port = EPSET_GET_INUSE_PORT(pReq->ctx->epSet);
+ CONN_CONSTRUCT_HASH_KEY(addr, ip, port);
+
+ pConn = getConnFromHeapCache(pThrd->connHeapCache, addr);
+ if (pConn == NULL) {
+ code = cliGetOrCreateConn(pThrd, pReq, &pConn);
+ if (code == TSDB_CODE_RPC_MAX_SESSIONS) {
+ TAOS_CHECK_GOTO(code, &lino, _exception);
+ } else if (code == TSDB_CODE_RPC_ASYNC_IN_PROCESS) {
+ // do nothing, notiy
+ return;
+ } else if (code == 0) {
+ code = addConnToHeapCache(pThrd->connHeapCache, pConn);
+ if (code != 0) {
+ tWarn("%s conn %p failed to added to heap cache since %s", pInst->label, pConn, tstrerror(code));
+ }
+ } else {
+ // TAOS_CHECK_GOTO(code, &lino, _exception);
+ return;
+ }
+ }
+ code = cliHandleState_mayUpdateState(pConn, pReq);
+ }
+ code = cliSendReq(pConn, pReq);
+ if (code != 0) {
+ tWarn("%s conn %p failed to send req since %s", pInst->label, pConn, tstrerror(code));
+ TAOS_UNUSED(transUnrefCliHandle(pConn));
+ }
+
+ tTrace("%s conn %p ready", pInst->label, pConn);
+ return;
+
+_exception:
+ resp.code = code;
+ STraceId* trace = &pReq->msg.info.traceId;
+ tGWarn("%s failed to process req since %s", pInst->label, tstrerror(code));
+
+ code = (pThrd->notifyExceptCb)(pThrd, pReq, &resp);
+ if (code != 0) {
+ tWarn("%s failed to notify user since %s", pInst->label, tstrerror(code));
+ }
+ return;
+}
+
+void cliHandleReq(SCliThrd* pThrd, SCliReq* pReq) { return cliHandleBatchReq(pThrd, pReq); }
+
+static void cliDoReq(queue* wq, SCliThrd* pThrd) {
int count = 0;
+ QUEUE_INIT(&pThrd->batchSendSet);
while (!QUEUE_IS_EMPTY(wq)) {
queue* h = QUEUE_HEAD(wq);
QUEUE_REMOVE(h);
- SCliMsg* pMsg = QUEUE_DATA(h, SCliMsg, q);
-
- if (pMsg->type == Quit) {
- pThrd->stopMsg = pMsg;
+ SCliReq* pReq = QUEUE_DATA(h, SCliReq, q);
+ if (pReq->type == Quit) {
+ pThrd->stopMsg = pReq;
continue;
}
- (*cliAsyncHandle[pMsg->type])(pMsg, pThrd);
-
+ (*cliAsyncHandle[pReq->type])(pThrd, pReq);
count++;
}
+ int32_t code = 0;
+ while (!QUEUE_IS_EMPTY(&pThrd->batchSendSet)) {
+ queue* el = QUEUE_HEAD(&pThrd->batchSendSet);
+ QUEUE_REMOVE(el);
+
+ SCliConn* conn = QUEUE_DATA(el, SCliConn, batchSendq);
+ conn->inThreadSendq = 0;
+ QUEUE_INIT(&conn->batchSendq);
+ code = cliBatchSend(conn, 1);
+ if (code != 0) {
+ tWarn("%s conn %p failed to send req since %s", pThrd->pInst->label, conn, tstrerror(code));
+ TAOS_UNUSED(transUnrefCliHandle(conn));
+ }
+ }
+ QUEUE_INIT(&pThrd->batchSendSet);
if (count >= 2) {
tTrace("cli process batch size:%d", count);
}
@@ -1978,11 +2028,74 @@ SCliBatch* cliGetHeadFromList(SCliBatchList* pList) {
SCliBatch* batch = QUEUE_DATA(hr, SCliBatch, listq);
return batch;
}
+static int32_t createBatch(SCliBatch** ppBatch, SCliBatchList* pList, SCliReq* pReq);
+static int32_t createBatchList(SCliBatchList** ppBatchList, char* key, char* ip, uint32_t port);
+
+static void destroyBatchList(SCliBatchList* pList);
+static void cliBuildBatch(SCliReq* pReq, queue* h, SCliThrd* pThrd) {
+ int32_t code = 0;
+ STrans* pInst = pThrd->pInst;
+ SReqCtx* pCtx = pReq->ctx;
+
+ char* ip = EPSET_GET_INUSE_IP(pCtx->epSet);
+ uint32_t port = EPSET_GET_INUSE_PORT(pCtx->epSet);
+ char key[TSDB_FQDN_LEN + 64] = {0};
+ CONN_CONSTRUCT_HASH_KEY(key, ip, port);
+ size_t klen = strlen(key);
+ SCliBatchList** ppBatchList = taosHashGet(pThrd->batchCache, key, klen);
+ if (ppBatchList == NULL || *ppBatchList == NULL) {
+ SCliBatchList* pBatchList = NULL;
+ code = createBatchList(&pBatchList, key, ip, port);
+ if (code != 0) {
+ destroyReq(pReq);
+ return;
+ }
+
+ pBatchList->batchLenLimit = pInst->shareConnLimit;
+
+ SCliBatch* pBatch = NULL;
+ code = createBatch(&pBatch, pBatchList, pReq);
+ if (code != 0) {
+ destroyBatchList(pBatchList);
+ destroyReq(pReq);
+ return;
+ }
+
+ code = taosHashPut(pThrd->batchCache, key, klen, &pBatchList, sizeof(void*));
+ if (code != 0) {
+ destroyBatchList(pBatchList);
+ }
+ } else {
+ if (QUEUE_IS_EMPTY(&(*ppBatchList)->wq)) {
+ SCliBatch* pBatch = NULL;
+ code = createBatch(&pBatch, *ppBatchList, pReq);
+ if (code != 0) {
+ destroyReq(pReq);
+ cliDestroyBatch(pBatch);
+ }
+ } else {
+ queue* hdr = QUEUE_TAIL(&((*ppBatchList)->wq));
+ SCliBatch* pBatch = QUEUE_DATA(hdr, SCliBatch, listq);
+ if ((pBatch->shareConnLimit + pReq->msg.contLen) < (*ppBatchList)->batchLenLimit) {
+ QUEUE_PUSH(&pBatch->wq, h);
+ pBatch->shareConnLimit += pReq->msg.contLen;
+ pBatch->wLen += 1;
+ } else {
+ SCliBatch* tBatch = NULL;
+ code = createBatch(&tBatch, *ppBatchList, pReq);
+ if (code != 0) {
+ destroyReq(pReq);
+ }
+ }
+ }
+ }
+ return;
+}
static int32_t createBatchList(SCliBatchList** ppBatchList, char* key, char* ip, uint32_t port) {
SCliBatchList* pBatchList = taosMemoryCalloc(1, sizeof(SCliBatchList));
if (pBatchList == NULL) {
- tError("failed to create batch list, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
+ tError("failed to create batch list since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
return terrno;
}
QUEUE_INIT(&pBatchList->wq);
@@ -1998,7 +2111,7 @@ static int32_t createBatchList(SCliBatchList** ppBatchList, char* key, char* ip,
taosMemoryFree(pBatchList->ip);
taosMemoryFree(pBatchList->dst);
taosMemoryFree(pBatchList);
- tError("failed to create batch list, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
+ tError("failed to create batch list since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
return terrno;
}
*ppBatchList = pBatchList;
@@ -2019,19 +2132,19 @@ static void destroyBatchList(SCliBatchList* pList) {
taosMemoryFree(pList->dst);
taosMemoryFree(pList);
}
-static int32_t createBatch(SCliBatch** ppBatch, SCliBatchList* pList, SCliMsg* pMsg) {
+static int32_t createBatch(SCliBatch** ppBatch, SCliBatchList* pList, SCliReq* pReq) {
SCliBatch* pBatch = taosMemoryCalloc(1, sizeof(SCliBatch));
if (pBatch == NULL) {
- tError("failed to create batch, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
+ tError("failed to create batch since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
return terrno;
}
QUEUE_INIT(&pBatch->wq);
QUEUE_INIT(&pBatch->listq);
- QUEUE_PUSH(&pBatch->wq, &pMsg->q);
+ QUEUE_PUSH(&pBatch->wq, &pReq->q);
pBatch->wLen += 1;
- pBatch->batchSize = pMsg->msg.contLen;
+ pBatch->shareConnLimit = pReq->msg.contLen;
pBatch->pList = pList;
QUEUE_PUSH(&pList->wq, &pBatch->listq);
@@ -2040,184 +2153,64 @@ static int32_t createBatch(SCliBatch** ppBatch, SCliBatchList* pList, SCliMsg* p
*ppBatch = pBatch;
return 0;
}
-static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
- STrans* pInst = pThrd->pTransInst;
- int32_t code = 0;
-
- int count = 0;
- while (!QUEUE_IS_EMPTY(wq)) {
- queue* h = QUEUE_HEAD(wq);
- QUEUE_REMOVE(h);
-
- SCliMsg* pMsg = QUEUE_DATA(h, SCliMsg, q);
-
- if (pMsg->type == Quit) {
- pThrd->stopMsg = pMsg;
- continue;
- }
-
- if (pMsg->type == Normal && REQUEST_NO_RESP(&pMsg->msg)) {
- STransConnCtx* pCtx = pMsg->ctx;
-
- char* ip = EPSET_GET_INUSE_IP(&pCtx->epSet);
- uint32_t port = EPSET_GET_INUSE_PORT(&pCtx->epSet);
- char key[TSDB_FQDN_LEN + 64] = {0};
- CONN_CONSTRUCT_HASH_KEY(key, ip, port);
- size_t klen = strlen(key);
- SCliBatchList** ppBatchList = taosHashGet(pThrd->batchCache, key, klen);
- if (ppBatchList == NULL || *ppBatchList == NULL) {
- SCliBatchList* pBatchList = NULL;
- code = createBatchList(&pBatchList, key, ip, port);
- if (code != 0) {
- destroyCmsg(pMsg);
- continue;
- }
- pBatchList->batchLenLimit = pInst->batchSize;
-
- SCliBatch* pBatch = NULL;
- code = createBatch(&pBatch, pBatchList, pMsg);
- if (code != 0) {
- destroyBatchList(pBatchList);
- destroyCmsg(pMsg);
- continue;
- }
-
- code = taosHashPut(pThrd->batchCache, key, klen, &pBatchList, sizeof(void*));
- if (code != 0) {
- destroyBatchList(pBatchList);
- }
- } else {
- if (QUEUE_IS_EMPTY(&(*ppBatchList)->wq)) {
- SCliBatch* pBatch = NULL;
- code = createBatch(&pBatch, *ppBatchList, pMsg);
- if (code != 0) {
- destroyCmsg(pMsg);
- cliDestroyBatch(pBatch);
- }
- } else {
- queue* hdr = QUEUE_TAIL(&((*ppBatchList)->wq));
- SCliBatch* pBatch = QUEUE_DATA(hdr, SCliBatch, listq);
- if ((pBatch->batchSize + pMsg->msg.contLen) < (*ppBatchList)->batchLenLimit) {
- QUEUE_PUSH(&pBatch->wq, h);
- pBatch->batchSize += pMsg->msg.contLen;
- pBatch->wLen += 1;
- } else {
- SCliBatch* tBatch = NULL;
- code = createBatch(&tBatch, *ppBatchList, pMsg);
- if (code != 0) {
- destroyCmsg(pMsg);
- }
- }
- }
- }
- continue;
- }
- (*cliAsyncHandle[pMsg->type])(pMsg, pThrd);
- count++;
- }
-
- void** pIter = taosHashIterate(pThrd->batchCache, NULL);
- while (pIter != NULL) {
- SCliBatchList* batchList = (SCliBatchList*)(*pIter);
- SCliBatch* batch = cliGetHeadFromList(batchList);
- if (batch != NULL) {
- cliHandleBatchReq(batch, pThrd);
- }
- pIter = (void**)taosHashIterate(pThrd->batchCache, pIter);
- }
-
- if (count >= 2) {
- tTrace("cli process batch size:%d", count);
- }
-}
+static void cliDoBatchReq(queue* wq, SCliThrd* pThrd) { return cliDoReq(wq, pThrd); }
static void cliAsyncCb(uv_async_t* handle) {
SAsyncItem* item = handle->data;
SCliThrd* pThrd = item->pThrd;
- STrans* pTransInst = pThrd->pTransInst;
+ STrans* pInst = pThrd->pInst;
// batch process to avoid to lock/unlock frequently
queue wq;
if (taosThreadMutexLock(&item->mtx) != 0) {
- tError("failed to lock mutex, reason:%s", tstrerror(terrno));
+ tError("failed to lock mutex since %s", tstrerror(terrno));
}
QUEUE_MOVE(&item->qmsg, &wq);
if (taosThreadMutexUnlock(&item->mtx) != 0) {
- tError("failed to unlock mutex, reason:%s", tstrerror(terrno));
+ tError("failed to unlock mutex since %s", tstrerror(terrno));
}
- int8_t supportBatch = pTransInst->supportBatch;
- if (supportBatch == 0) {
- cliNoBatchDealReq(&wq, pThrd);
- } else if (supportBatch == 1) {
- cliBatchDealReq(&wq, pThrd);
- }
+ cliDealFunc[pInst->supportBatch](&wq, pThrd);
- if (pThrd->stopMsg != NULL) cliHandleQuit(pThrd->stopMsg, pThrd);
+ if (pThrd->stopMsg != NULL) cliHandleQuit(pThrd, pThrd->stopMsg);
}
-void cliDestroyConnMsgs(SCliConn* conn, bool destroy) {
- transCtxCleanup(&conn->ctx);
- cliReleaseUnfinishedMsg(conn);
- if (destroy == 1) {
- transQueueDestroy(&conn->cliMsgs);
- } else {
- transQueueClear(&conn->cliMsgs);
+static FORCE_INLINE void destroyReq(void* arg) {
+ SCliReq* pReq = arg;
+ if (pReq == NULL) {
+ return;
}
+ STraceId* trace = &pReq->msg.info.traceId;
+ tGDebug("free memory:%p, free ctx: %p", pReq, pReq->ctx);
+
+ if (pReq->ctx) {
+ destroyReqCtx(pReq->ctx);
+ }
+ transFreeMsg(pReq->msg.pCont);
+ taosMemoryFree(pReq);
}
+static FORCE_INLINE void destroyReqWrapper(void* arg, void* param) {
+ if (arg == NULL) return;
-void cliConnFreeMsgs(SCliConn* conn) {
- SCliThrd* pThrd = conn->hostThrd;
- STrans* pTransInst = pThrd->pTransInst;
+ SCliReq* pReq = arg;
+ SCliThrd* pThrd = param;
- for (int i = 0; i < transQueueSize(&conn->cliMsgs); i++) {
- SCliMsg* cmsg = transQueueGet(&conn->cliMsgs, i);
- if (cmsg->type == Release || REQUEST_NO_RESP(&cmsg->msg) || cmsg->msg.msgType == TDMT_SCH_DROP_TASK) {
- continue;
+ if (pReq->ctx != NULL && pReq->ctx->ahandle != NULL) {
+ if (pReq->msg.info.notFreeAhandle == 0 && pThrd != NULL && pThrd->destroyAhandleFp != NULL) {
+ (*pThrd->destroyAhandleFp)(pReq->ctx->ahandle);
}
-
- STransMsg resp = {0};
- if (-1 == cliBuildExceptResp(cmsg, &resp)) {
- continue;
- }
- resp.info.cliVer = pTransInst->compatibilityVer;
- pTransInst->cfp(pTransInst->parent, &resp, NULL);
-
- cmsg->ctx->ahandle = NULL;
}
+ destroyReq(pReq);
}
-bool cliRecvReleaseReq(SCliConn* conn, STransMsgHead* pHead) {
- if (pHead->release == 1 && (pHead->msgLen) == sizeof(*pHead)) {
- uint64_t ahandle = pHead->ahandle;
- SCliMsg* pMsg = NULL;
- CONN_GET_MSGCTX_BY_AHANDLE(conn, ahandle);
- tDebug("%s conn %p receive release request, refId:%" PRId64 ", may ignore", CONN_GET_INST_LABEL(conn), conn,
- conn->refId);
+static FORCE_INLINE void destroyReqAndAhanlde(void* param) {
+ if (param == NULL) return;
- TAOS_UNUSED(transClearBuffer(&conn->readBuf));
- transFreeMsg(transContFromHead((char*)pHead));
-
- for (int i = 0; ahandle == 0 && i < transQueueSize(&conn->cliMsgs); i++) {
- SCliMsg* cliMsg = transQueueGet(&conn->cliMsgs, i);
- if (cliMsg->type == Release) {
- tDebug("%s conn %p receive release request, refId:%" PRId64 ", ignore msg", CONN_GET_INST_LABEL(conn), conn,
- conn->refId);
- cliDestroyConn(conn, true);
- return true;
- }
- }
-
- cliConnFreeMsgs(conn);
-
- tDebug("%s conn %p receive release request, refId:%" PRId64 "", CONN_GET_INST_LABEL(conn), conn, conn->refId);
- destroyCmsg(pMsg);
-
- addConnToPool(((SCliThrd*)conn->hostThrd)->pool, conn);
- return true;
- }
- return false;
+ STaskArg* arg = param;
+ SCliReq* pReq = arg->param1;
+ SCliThrd* pThrd = arg->param2;
+ destroyReqWrapper(pReq, pThrd);
}
static void* cliWorkThread(void* arg) {
@@ -2226,23 +2219,24 @@ static void* cliWorkThread(void* arg) {
SCliThrd* pThrd = (SCliThrd*)arg;
pThrd->pid = taosGetSelfPthreadId();
- TAOS_UNUSED(strtolower(threadName, pThrd->pTransInst->label));
+ tsEnableRandErr = true;
+ TAOS_UNUSED(strtolower(threadName, pThrd->pInst->label));
setThreadName(threadName);
TAOS_UNUSED(uv_run(pThrd->loop, UV_RUN_DEFAULT));
- tDebug("thread quit-thread:%08" PRId64, pThrd->pid);
+ tDebug("thread quit-thread:%08" PRId64 "", pThrd->pid);
return NULL;
}
-void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle) {
+void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* pInstRef) {
int32_t code = 0;
SCliObj* cli = taosMemoryCalloc(1, sizeof(SCliObj));
if (cli == NULL) {
TAOS_CHECK_GOTO(terrno, NULL, _err);
}
- STrans* pTransInst = shandle;
+ STrans* pInst = pInstRef;
memcpy(cli->label, label, TSDB_LABEL_LEN);
cli->numOfThreads = numOfThreads;
@@ -2253,18 +2247,20 @@ void* transInitClient(uint32_t ip, uint32_t port, char* label, int numOfThreads,
for (int i = 0; i < cli->numOfThreads; i++) {
SCliThrd* pThrd = NULL;
- code = createThrdObj(shandle, &pThrd);
+ code = createThrdObj(pInstRef, &pThrd);
if (code != 0) {
goto _err;
}
int err = taosThreadCreate(&pThrd->thread, NULL, cliWorkThread, (void*)(pThrd));
if (err != 0) {
+ destroyThrdObj(pThrd);
code = TAOS_SYSTEM_ERROR(errno);
TAOS_CHECK_GOTO(code, NULL, _err);
} else {
tDebug("success to create tranport-cli thread:%d", i);
}
+ pThrd->thrdInited = 1;
cli->pThreadObj[i] = pThrd;
}
return cli;
@@ -2283,52 +2279,37 @@ _err:
terrno = code;
return NULL;
}
-
-static FORCE_INLINE void destroyCmsg(void* arg) {
- SCliMsg* pMsg = arg;
- if (pMsg == NULL) {
- return;
+int32_t initCb(void* thrd, SCliReq* pReq, STransMsg* pResp) {
+ SCliThrd* pThrd = thrd;
+ if (pReq->ctx == NULL || pReq->ctx->epSet == NULL) {
+ return 0;
}
- tDebug("free memory:%p, free ctx: %p", pMsg, pMsg->ctx);
-
- transDestroyConnCtx(pMsg->ctx);
- transFreeMsg(pMsg->msg.pCont);
- taosMemoryFree(pMsg);
+ return cliMayCvtFqdnToIp(pReq->ctx->epSet, pThrd->pCvtAddr);
}
-static FORCE_INLINE void destroyCmsgWrapper(void* arg, void* param) {
- if (arg == NULL) return;
-
- SCliMsg* pMsg = arg;
- SCliThrd* pThrd = param;
- if (pMsg->msg.info.notFreeAhandle == 0 && pThrd != NULL) {
- if (pThrd->destroyAhandleFp) (*pThrd->destroyAhandleFp)(pMsg->msg.info.ahandle);
+int32_t notifyExceptCb(void* thrd, SCliReq* pReq, STransMsg* pResp) {
+ SCliThrd* pThrd = thrd;
+ STrans* pInst = pThrd->pInst;
+ int32_t code = cliBuildExceptResp(pThrd, pReq, pResp);
+ if (code != 0) {
+ destroyReq(pReq);
+ return code;
}
- destroyCmsg(pMsg);
+ pInst->cfp(pInst->parent, pResp, NULL);
+ destroyReq(pReq);
+ return code;
}
-static FORCE_INLINE void destroyCmsgAndAhandle(void* param) {
- if (param == NULL) return;
- STaskArg* arg = param;
- SCliMsg* pMsg = arg->param1;
- SCliThrd* pThrd = arg->param2;
+int32_t notfiyCb(void* thrd, SCliReq* pReq, STransMsg* pResp) {
+ // impl later
+ SCliThrd* pThrd = thrd;
+ STrans* pInst = pThrd->pInst;
- if (pMsg->msg.info.notFreeAhandle == 0 && pThrd != NULL && pThrd->destroyAhandleFp != NULL) {
- pThrd->destroyAhandleFp(pMsg->ctx->ahandle);
- }
-
- if (pMsg->msg.info.handle != 0) {
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), (int64_t)pMsg->msg.info.handle));
- TAOS_UNUSED(transRemoveExHandle(transGetRefMgt(), (int64_t)pMsg->msg.info.handle));
- }
-
- transDestroyConnCtx(pMsg->ctx);
- transFreeMsg(pMsg->msg.pCont);
- taosMemoryFree(pMsg);
+ return 0;
}
static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
int32_t code = 0;
- STrans* pTransInst = trans;
+ STrans* pInst = trans;
SCliThrd* pThrd = (SCliThrd*)taosMemoryCalloc(1, sizeof(SCliThrd));
if (pThrd == NULL) {
@@ -2347,17 +2328,40 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
code = uv_loop_init(pThrd->loop);
if (code != 0) {
- tError("failed to init uv_loop, reason:%s", uv_err_name(code));
+ tError("failed to init uv_loop since %s", uv_err_name(code));
TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, NULL, _end);
}
- int32_t nSync = pTransInst->supportBatch ? 4 : 8;
+ int32_t nSync = 2; // pInst->supportBatch ? 4 : 8;
code = transAsyncPoolCreate(pThrd->loop, nSync, pThrd, cliAsyncCb, &pThrd->asyncPool);
if (code != 0) {
tError("failed to init async pool since:%s", tstrerror(code));
TAOS_CHECK_GOTO(code, NULL, _end);
}
+ int32_t timerSize = 64;
+ pThrd->timerList = taosArrayInit(timerSize, sizeof(void*));
+ if (pThrd->timerList == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
+ }
+
+ for (int i = 0; i < timerSize; i++) {
+ uv_timer_t* timer = taosMemoryCalloc(1, sizeof(uv_timer_t));
+ if (timer == NULL) {
+ TAOS_CHECK_GOTO(terrno, NULL, _end);
+ }
+ code = uv_timer_init(pThrd->loop, timer);
+ if (code != 0) {
+ tError("failed to init timer since %s", uv_err_name(code));
+ code = TSDB_CODE_THIRDPARTY_ERROR;
+ TAOS_CHECK_GOTO(code, NULL, _end);
+ }
+ if (taosArrayPush(pThrd->timerList, &timer) == NULL) {
+ TAOS_CHECK_GOTO(terrno, NULL, _end);
+ }
+ }
+
pThrd->pool = createConnPool(4);
if (pThrd->pool == NULL) {
code = terrno;
@@ -2375,40 +2379,39 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) {
TAOS_CHECK_GOTO(code, NULL, _end);
}
- pThrd->destroyAhandleFp = pTransInst->destroyFp;
- pThrd->fqdn2ipCache = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+ pThrd->destroyAhandleFp = pInst->destroyFp;
+
+ pThrd->fqdn2ipCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
if (pThrd->fqdn2ipCache == NULL) {
TAOS_CHECK_GOTO(terrno, NULL, _end);
}
- pThrd->failFastCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
- if (pThrd->failFastCache == NULL) {
- TAOS_CHECK_GOTO(terrno, NULL, _end);
- }
pThrd->batchCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
if (pThrd->batchCache == NULL) {
TAOS_CHECK_GOTO(terrno, NULL, _end);
}
- int32_t timerSize = 64;
- pThrd->timerList = taosArrayInit(timerSize, sizeof(void*));
- if (pThrd->timerList == NULL) {
- code = terrno;
- TAOS_CHECK_GOTO(terrno, NULL, _end);
+ pThrd->connHeapCache = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK);
+ if (pThrd->connHeapCache == NULL) {
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
}
- for (int i = 0; i < timerSize; i++) {
- uv_timer_t* timer = taosMemoryCalloc(1, sizeof(uv_timer_t));
- if (timer == NULL) {
- TAOS_CHECK_GOTO(terrno, NULL, _end);
- }
- TAOS_UNUSED(uv_timer_init(pThrd->loop, timer));
- if (taosArrayPush(pThrd->timerList, &timer) == NULL) {
- TAOS_CHECK_GOTO(terrno, NULL, _end);
- }
+ pThrd->pIdConnTable = taosHashInit(512, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), false, HASH_NO_LOCK);
+ if (pThrd->connHeapCache == NULL) {
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
}
- pThrd->nextTimeout = taosGetTimestampMs() + CONN_PERSIST_TIME(pTransInst->idleTime);
- pThrd->pTransInst = trans;
+
+ pThrd->pQIdBuf = taosArrayInit(8, sizeof(int64_t));
+ if (pThrd->pQIdBuf == NULL) {
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, NULL, _end);
+ }
+
+ pThrd->initCb = initCb;
+ pThrd->notifyCb = notfiyCb;
+ pThrd->notifyExceptCb = notifyExceptCb;
+
+ pThrd->nextTimeout = taosGetTimestampMs() + CONN_PERSIST_TIME(pInst->idleTime);
+ pThrd->pInst = trans;
pThrd->quit = false;
*ppThrd = pThrd;
@@ -2420,6 +2423,7 @@ _end:
TAOS_UNUSED(uv_loop_close(pThrd->loop));
taosMemoryFree(pThrd->loop);
+ TAOS_UNUSED((taosThreadMutexDestroy(&pThrd->msgMtx)));
transAsyncPoolDestroy(pThrd->asyncPool);
for (int i = 0; i < taosArrayGetSize(pThrd->timerList); i++) {
uv_timer_t* timer = taosArrayGetP(pThrd->timerList, i);
@@ -2435,6 +2439,8 @@ _end:
taosHashCleanup(pThrd->fqdn2ipCache);
taosHashCleanup(pThrd->failFastCache);
taosHashCleanup(pThrd->batchCache);
+ taosHashCleanup(pThrd->pIdConnTable);
+ taosArrayDestroy(pThrd->pQIdBuf);
taosMemoryFree(pThrd);
}
@@ -2445,16 +2451,16 @@ static void destroyThrdObj(SCliThrd* pThrd) {
return;
}
- if (taosThreadJoin(pThrd->thread, NULL) != 0) {
- tTrace("failed to join thread, reason:%s", tstrerror(terrno));
+ if (pThrd->thrdInited && taosThreadJoin(pThrd->thread, NULL) != 0) {
+ tTrace("failed to join thread since %s", tstrerror(terrno));
}
CLI_RELEASE_UV(pThrd->loop);
TAOS_UNUSED(taosThreadMutexDestroy(&pThrd->msgMtx));
- TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SCliMsg, destroyCmsgWrapper, (void*)pThrd);
+ TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SCliReq, destroyReqWrapper, (void*)pThrd);
transAsyncPoolDestroy(pThrd->asyncPool);
- transDQDestroy(pThrd->delayQueue, destroyCmsgAndAhandle);
+ transDQDestroy(pThrd->delayQueue, destroyReqAndAhanlde);
transDQDestroy(pThrd->timeoutQueue, NULL);
transDQDestroy(pThrd->waitConnQueue, NULL);
@@ -2467,7 +2473,6 @@ static void destroyThrdObj(SCliThrd* pThrd) {
taosArrayDestroy(pThrd->timerList);
taosMemoryFree(pThrd->loop);
taosHashCleanup(pThrd->fqdn2ipCache);
- taosHashCleanup(pThrd->failFastCache);
void** pIter = taosHashIterate(pThrd->batchCache, NULL);
while (pIter != NULL) {
@@ -2486,18 +2491,35 @@ static void destroyThrdObj(SCliThrd* pThrd) {
pIter = (void**)taosHashIterate(pThrd->batchCache, pIter);
}
taosHashCleanup(pThrd->batchCache);
+
+ void* pIter2 = taosHashIterate(pThrd->connHeapCache, NULL);
+ while (pIter2 != NULL) {
+ SHeap* heap = (SHeap*)(pIter2);
+ transHeapDestroy(heap);
+ pIter2 = (void*)taosHashIterate(pThrd->connHeapCache, pIter2);
+ }
+ taosHashCleanup(pThrd->connHeapCache);
+
+ taosHashCleanup(pThrd->pIdConnTable);
+
+ taosMemoryFree(pThrd->pCvtAddr);
+ taosArrayDestroy(pThrd->pQIdBuf);
+
taosMemoryFree(pThrd);
}
-static FORCE_INLINE void transDestroyConnCtx(STransConnCtx* ctx) {
- //
- taosMemoryFree(ctx);
+static FORCE_INLINE void destroyReqCtx(SReqCtx* ctx) {
+ if (ctx) {
+ taosMemoryFree(ctx->epSet);
+ taosMemoryFree(ctx->origEpSet);
+ taosMemoryFree(ctx);
+ }
}
int32_t cliSendQuit(SCliThrd* thrd) {
// cli can stop gracefully
int32_t code = 0;
- SCliMsg* msg = taosMemoryCalloc(1, sizeof(SCliMsg));
+ SCliReq* msg = taosMemoryCalloc(1, sizeof(SCliReq));
if (msg == NULL) {
return terrno;
}
@@ -2523,77 +2545,124 @@ void cliWalkCb(uv_handle_t* handle, void* arg) {
}
}
-FORCE_INLINE int cliRBChoseIdx(STrans* pTransInst) {
- int32_t index = pTransInst->index;
- if (pTransInst->numOfThreads == 0) {
+FORCE_INLINE int cliRBChoseIdx(STrans* pInst) {
+ int32_t index = pInst->index;
+ if (pInst->numOfThreads == 0) {
return -1;
}
/*
- * no lock, and to avoid CPU load imbalance, set limit pTransInst->numOfThreads * 2000;
+ * no lock, and to avoid CPU load imbalance, set limit pInst->numOfThreads * 2000;
*/
- if (pTransInst->index++ >= pTransInst->numOfThreads * 2000) {
- pTransInst->index = 0;
+ if (pInst->index++ >= pInst->numOfThreads * 2000) {
+ pInst->index = 0;
}
- return index % pTransInst->numOfThreads;
+ return index % pInst->numOfThreads;
}
static FORCE_INLINE void doDelayTask(void* param) {
STaskArg* arg = param;
- cliHandleReq((SCliMsg*)arg->param1, (SCliThrd*)arg->param2);
+
+ if (arg && arg->param1) {
+ SCliReq* pReq = arg->param1;
+ pReq->inRetry = 1;
+ }
+ cliHandleReq((SCliThrd*)arg->param2, (SCliReq*)arg->param1);
taosMemoryFree(arg);
}
-static void doCloseIdleConn(void* param) {
+static FORCE_INLINE void doCloseIdleConn(void* param) {
STaskArg* arg = param;
SCliConn* conn = arg->param1;
tDebug("%s conn %p idle, close it", CONN_GET_INST_LABEL(conn), conn);
conn->task = NULL;
- cliDestroyConn(conn, true);
taosMemoryFree(arg);
+
+ int32_t ref = transUnrefCliHandle(conn);
+ if (ref <= 0) {
+ return;
+ }
}
-static void cliSchedMsgToDebug(SCliMsg* pMsg, char* label) {
+static FORCE_INLINE void cliPerfLog_schedMsg(SCliReq* pReq, char* label) {
+ int32_t code = 0;
if (!(rpcDebugFlag & DEBUG_DEBUG)) {
return;
}
- STransConnCtx* pCtx = pMsg->ctx;
- STraceId* trace = &pMsg->msg.info.traceId;
- char tbuf[512] = {0};
- TAOS_UNUSED(epsetToStr(&pCtx->epSet, tbuf, tListLen(tbuf)));
+ SReqCtx* pCtx = pReq->ctx;
+ STraceId* trace = &pReq->msg.info.traceId;
+ char tbuf[512] = {0};
+
+ code = epsetToStr((SEpSet*)pCtx->epSet, tbuf, tListLen(tbuf));
+ if (code != 0) {
+ tWarn("failed to debug epset since %s", tstrerror(code));
+ return;
+ }
+
tGDebug("%s retry on next node,use:%s, step: %d,timeout:%" PRId64 "", label, tbuf, pCtx->retryStep,
pCtx->retryNextInterval);
return;
}
+static FORCE_INLINE void cliPerfLog_epset(SCliConn* pConn, SCliReq* pReq) {
+ int32_t code = 0;
+ if (!(rpcDebugFlag & DEBUG_TRACE)) {
+ return;
+ }
+ SReqCtx* pCtx = pReq->ctx;
-static void cliSchedMsgToNextNode(SCliMsg* pMsg, SCliThrd* pThrd) {
- STrans* pTransInst = pThrd->pTransInst;
- STransConnCtx* pCtx = pMsg->ctx;
- cliSchedMsgToDebug(pMsg, transLabel(pThrd->pTransInst));
+ char tbuf[512] = {0};
+
+ code = epsetToStr((SEpSet*)pCtx->epSet, tbuf, tListLen(tbuf));
+ if (code != 0) {
+ tWarn("failed to debug epset since %s", tstrerror(code));
+ return;
+ }
+ tTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn);
+ return;
+}
+
+static FORCE_INLINE int32_t cliSchedMsgToNextNode(SCliReq* pReq, SCliThrd* pThrd) {
+ STrans* pInst = pThrd->pInst;
+ SReqCtx* pCtx = pReq->ctx;
+ cliPerfLog_schedMsg(pReq, transLabel(pThrd->pInst));
STaskArg* arg = taosMemoryMalloc(sizeof(STaskArg));
if (arg == NULL) {
- tError("failed to malloc memory, reason:%s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- return;
+ return TSDB_CODE_OUT_OF_MEMORY;
}
- arg->param1 = pMsg;
+ arg->param1 = pReq;
arg->param2 = pThrd;
- TAOS_UNUSED(transDQSched(pThrd->delayQueue, doDelayTask, arg, pCtx->retryNextInterval));
+ SDelayTask* pTask = transDQSched(pThrd->delayQueue, doDelayTask, arg, pCtx->retryNextInterval);
+ if (pTask == NULL) {
+ taosMemoryFree(arg);
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ return 0;
}
-FORCE_INLINE bool cliTryExtractEpSet(STransMsg* pResp, SEpSet* dst) {
+FORCE_INLINE bool cliTryUpdateEpset(SCliReq* pReq, STransMsg* pResp) {
+ int32_t code = 0;
+ SReqCtx* ctx = pReq->ctx;
+
if ((pResp == NULL || pResp->info.hasEpSet == 0)) {
return false;
}
// rebuild resp msg
SEpSet epset;
- if (tDeserializeSEpSet(pResp->pCont, pResp->contLen, &epset) < 0) {
+ if ((code = tDeserializeSEpSet(pResp->pCont, pResp->contLen, &epset)) < 0) {
+ tError("failed to deserialize epset, code:%d", code);
return false;
}
- int32_t tlen = tSerializeSEpSet(NULL, 0, dst);
+ SEpSet tepset;
+ int32_t tlen = tSerializeSEpSet(NULL, 0, &tepset);
char* buf = NULL;
int32_t len = pResp->contLen - tlen;
if (len != 0) {
buf = rpcMallocCont(len);
+ if (buf == NULL) {
+ pResp->code = TSDB_CODE_OUT_OF_MEMORY;
+ return false;
+ }
+ // TODO: check buf
memcpy(buf, (char*)pResp->pCont + tlen, len);
}
rpcFreeCont(pResp->pCont);
@@ -2601,41 +2670,49 @@ FORCE_INLINE bool cliTryExtractEpSet(STransMsg* pResp, SEpSet* dst) {
pResp->pCont = buf;
pResp->contLen = len;
- epsetAssign(dst, &epset);
+ pResp->info.hasEpSet = 1;
+
+ if (transCreateReqEpsetFromUserEpset(&epset, &ctx->epSet) != 0) {
+ return false;
+ }
return true;
}
-bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) {
+
+bool cliResetEpset(SReqCtx* pCtx, STransMsg* pResp, bool hasEpSet) {
bool noDelay = true;
if (hasEpSet == false) {
if (pResp->contLen == 0) {
- if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
+ if (pCtx->epsetRetryCnt >= pCtx->epSet->numOfEps) {
noDelay = false;
} else {
- EPSET_FORWARD_INUSE(&pCtx->epSet);
+ EPSET_FORWARD_INUSE(pCtx->epSet);
}
} else if (pResp->contLen != 0) {
SEpSet epSet;
int32_t valid = tDeserializeSEpSet(pResp->pCont, pResp->contLen, &epSet);
if (valid < 0) {
tDebug("get invalid epset, epset equal, continue");
- if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
+ if (pCtx->epsetRetryCnt >= pCtx->epSet->numOfEps) {
noDelay = false;
} else {
- EPSET_FORWARD_INUSE(&pCtx->epSet);
+ EPSET_FORWARD_INUSE(pCtx->epSet);
}
} else {
- if (!transEpSetIsEqual2(&pCtx->epSet, &epSet)) {
+ if (!transCompareReqAndUserEpset(pCtx->epSet, &epSet)) {
tDebug("epset not equal, retry new epset1");
- transPrintEpSet(&pCtx->epSet);
+ transPrintEpSet((SEpSet*)pCtx->epSet);
transPrintEpSet(&epSet);
- epsetAssign(&pCtx->epSet, &epSet);
+
+ if (transCreateReqEpsetFromUserEpset(&epSet, &pCtx->epSet) != 0) {
+ tDebug("failed to create req epset from user epset");
+ }
noDelay = false;
} else {
- if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
+ if (pCtx->epsetRetryCnt >= pCtx->epSet->numOfEps) {
noDelay = false;
} else {
tDebug("epset equal, continue");
- EPSET_FORWARD_INUSE(&pCtx->epSet);
+ EPSET_FORWARD_INUSE(pCtx->epSet);
}
}
}
@@ -2645,97 +2722,63 @@ bool cliResetEpset(STransConnCtx* pCtx, STransMsg* pResp, bool hasEpSet) {
int32_t valid = tDeserializeSEpSet(pResp->pCont, pResp->contLen, &epSet);
if (valid < 0) {
tDebug("get invalid epset, epset equal, continue");
- if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
+ if (pCtx->epsetRetryCnt >= pCtx->epSet->numOfEps) {
noDelay = false;
} else {
- EPSET_FORWARD_INUSE(&pCtx->epSet);
+ EPSET_FORWARD_INUSE(pCtx->epSet);
}
} else {
- if (!transEpSetIsEqual2(&pCtx->epSet, &epSet)) {
+ if (!transCompareReqAndUserEpset(pCtx->epSet, &epSet)) {
tDebug("epset not equal, retry new epset2");
- transPrintEpSet(&pCtx->epSet);
+ transPrintEpSet((SEpSet*)pCtx->epSet);
transPrintEpSet(&epSet);
- epsetAssign(&pCtx->epSet, &epSet);
+ if (transCreateReqEpsetFromUserEpset(&epSet, &pCtx->epSet) != 0) {
+ tError("failed to create req epset from user epset");
+ }
noDelay = false;
} else {
- if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps) {
+ if (pCtx->epsetRetryCnt >= pCtx->epSet->numOfEps) {
noDelay = false;
} else {
tDebug("epset equal, continue");
- EPSET_FORWARD_INUSE(&pCtx->epSet);
+ EPSET_FORWARD_INUSE(pCtx->epSet);
}
}
}
}
return noDelay;
}
-bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
- SCliThrd* pThrd = pConn->hostThrd;
- STrans* pTransInst = pThrd->pTransInst;
-
- STransConnCtx* pCtx = pMsg->ctx;
- int32_t code = pResp->code;
-
- bool retry = pTransInst->retry != NULL ? pTransInst->retry(code, pResp->msgType - 1) : false;
- if (retry == false) {
- return false;
- }
+void cliRetryMayInitCtx(STrans* pInst, SCliReq* pReq) {
+ SReqCtx* pCtx = pReq->ctx;
if (!pCtx->retryInit) {
- pCtx->retryMinInterval = pTransInst->retryMinInterval;
- pCtx->retryMaxInterval = pTransInst->retryMaxInterval;
- pCtx->retryStepFactor = pTransInst->retryStepFactor;
- pCtx->retryMaxTimeout = pTransInst->retryMaxTimeout;
+ pCtx->retryMinInterval = pInst->retryMinInterval;
+ pCtx->retryMaxInterval = pInst->retryMaxInterval;
+ pCtx->retryStepFactor = pInst->retryStepFactor;
+ pCtx->retryMaxTimeout = pInst->retryMaxTimeout;
pCtx->retryInitTimestamp = taosGetTimestampMs();
pCtx->retryNextInterval = pCtx->retryMinInterval;
pCtx->retryStep = 0;
- pCtx->retryInit = true;
+ pCtx->retryInit = 1;
pCtx->retryCode = TSDB_CODE_SUCCESS;
-
- // already retry, not use handle specified by app;
- pMsg->msg.info.handle = 0;
+ pReq->msg.info.handle = 0;
}
+}
- if (-1 != pCtx->retryMaxTimeout && taosGetTimestampMs() - pCtx->retryInitTimestamp >= pCtx->retryMaxTimeout) {
- return false;
+int32_t cliRetryIsTimeout(STrans* pInst, SCliReq* pReq) {
+ SReqCtx* pCtx = pReq->ctx;
+ if (pCtx->retryMaxTimeout != -1 && taosGetTimestampMs() - pCtx->retryInitTimestamp >= pCtx->retryMaxTimeout) {
+ return 1;
}
+ return 0;
+}
- // code, msgType
-
- // A: epset, leader, not self
- // B: epset, not know leader
- // C: no epset, leader but not serivce
-
- bool noDelay = false;
- if (code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
- tTrace("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen);
- noDelay = cliResetEpset(pCtx, pResp, false);
- transFreeMsg(pResp->pCont);
- transUnrefCliHandle(pConn);
- } else if (code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_INTERNAL_ERROR ||
- code == TSDB_CODE_SYN_PROPOSE_NOT_READY || code == TSDB_CODE_VND_STOPPED ||
- code == TSDB_CODE_MNODE_NOT_FOUND || code == TSDB_CODE_APP_IS_STARTING ||
- code == TSDB_CODE_APP_IS_STOPPING || code == TSDB_CODE_VND_STOPPED) {
- tTrace("code str %s, contlen:%d 1", tstrerror(code), pResp->contLen);
- noDelay = cliResetEpset(pCtx, pResp, true);
- transFreeMsg(pResp->pCont);
- addConnToPool(pThrd->pool, pConn);
- } else if (code == TSDB_CODE_SYN_RESTORING) {
- tTrace("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen);
- noDelay = cliResetEpset(pCtx, pResp, true);
- addConnToPool(pThrd->pool, pConn);
- transFreeMsg(pResp->pCont);
- } else {
- tTrace("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen);
- noDelay = cliResetEpset(pCtx, pResp, false);
- addConnToPool(pThrd->pool, pConn);
- transFreeMsg(pResp->pCont);
- }
- if (code != TSDB_CODE_RPC_BROKEN_LINK && code != TSDB_CODE_RPC_NETWORK_UNAVAIL && code != TSDB_CODE_SUCCESS) {
- // save one internal code
- pCtx->retryCode = code;
- }
+int8_t cliRetryShouldRetry(STrans* pInst, STransMsg* pResp) {
+ bool retry = pInst->retry != NULL ? pInst->retry(pResp->code, pResp->msgType - 1) : false;
+ return retry == false ? 0 : 1;
+}
+void cliRetryUpdateRule(SReqCtx* pCtx, int8_t noDelay) {
if (noDelay == false) {
pCtx->epsetRetryCnt = 1;
pCtx->retryStep++;
@@ -2749,28 +2792,85 @@ bool cliGenRetryRule(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
pCtx->retryNextInterval = 0;
pCtx->epsetRetryCnt++;
}
+}
- pMsg->sent = 0;
- cliSchedMsgToNextNode(pMsg, pThrd);
+int32_t cliRetryDoSched(SCliReq* pReq, SCliThrd* pThrd) {
+ int32_t code = cliSchedMsgToNextNode(pReq, pThrd);
+ if (code != 0) {
+ tError("failed to sched msg to next node since %s", tstrerror(code));
+ return code;
+ }
+ return 0;
+}
+
+bool cliMayRetry(SCliConn* pConn, SCliReq* pReq, STransMsg* pResp) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+
+ SReqCtx* pCtx = pReq->ctx;
+ int32_t code = pResp->code;
+
+ if (pReq && pReq->msg.info.qId != 0) {
+ return false;
+ }
+
+ cliRetryMayInitCtx(pInst, pReq);
+
+ if (!cliRetryShouldRetry(pInst, pResp)) {
+ return false;
+ }
+
+ if (cliRetryIsTimeout(pInst, pReq)) {
+ return false;
+ }
+
+ // code, msgType
+ // A: epset,leader, not self
+ // B: epset,not know leader
+ // C: noepset,leader but not serivce
+
+ bool noDelay = false;
+ if (code == TSDB_CODE_RPC_BROKEN_LINK || code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
+ tTrace("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen);
+ noDelay = cliResetEpset(pCtx, pResp, false);
+ transFreeMsg(pResp->pCont);
+ } else if (code == TSDB_CODE_SYN_NOT_LEADER || code == TSDB_CODE_SYN_INTERNAL_ERROR ||
+ code == TSDB_CODE_SYN_PROPOSE_NOT_READY || code == TSDB_CODE_VND_STOPPED ||
+ code == TSDB_CODE_MNODE_NOT_FOUND || code == TSDB_CODE_APP_IS_STARTING ||
+ code == TSDB_CODE_APP_IS_STOPPING || code == TSDB_CODE_VND_STOPPED) {
+ tTrace("code str %s, contlen:%d 1", tstrerror(code), pResp->contLen);
+ noDelay = cliResetEpset(pCtx, pResp, true);
+ transFreeMsg(pResp->pCont);
+ } else if (code == TSDB_CODE_SYN_RESTORING) {
+ tTrace("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen);
+ noDelay = cliResetEpset(pCtx, pResp, true);
+ transFreeMsg(pResp->pCont);
+ } else {
+ tTrace("code str %s, contlen:%d 0", tstrerror(code), pResp->contLen);
+ noDelay = cliResetEpset(pCtx, pResp, false);
+ transFreeMsg(pResp->pCont);
+ }
+ if (code != TSDB_CODE_RPC_BROKEN_LINK && code != TSDB_CODE_RPC_NETWORK_UNAVAIL && code != TSDB_CODE_SUCCESS) {
+ // save one internal code
+ pCtx->retryCode = code;
+ }
+
+ cliRetryUpdateRule(pCtx, noDelay);
+
+ pReq->sent = 0;
+ pReq->seq = 0;
+
+ code = cliRetryDoSched(pReq, pThrd);
+ if (code != 0) {
+ pResp->code = code;
+ tError("failed to sched msg to next node since %s", tstrerror(code));
+ return false;
+ }
return true;
}
-int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
- SCliThrd* pThrd = pConn->hostThrd;
- STrans* pTransInst = pThrd->pTransInst;
-
- if (pMsg == NULL || pMsg->ctx == NULL) {
- tTrace("%s conn %p handle resp", pTransInst->label, pConn);
- pTransInst->cfp(pTransInst->parent, pResp, NULL);
- return 0;
- }
-
- STransConnCtx* pCtx = pMsg->ctx;
-
- bool retry = cliGenRetryRule(pConn, pResp, pMsg);
- if (retry == true) {
- return -1;
- }
+void cliMayResetRespCode(SCliReq* pReq, STransMsg* pResp) {
+ SReqCtx* pCtx = pReq->ctx;
if (pCtx->retryCode != TSDB_CODE_SUCCESS) {
int32_t code = pResp->code;
// return internal code app
@@ -2781,22 +2881,24 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
}
// check whole vnodes is offline on this vgroup
- if (pCtx->epsetRetryCnt >= pCtx->epSet.numOfEps || pCtx->retryStep > 0) {
+ if (((pCtx->epSet != NULL) && pCtx->epsetRetryCnt >= pCtx->epSet->numOfEps) || pCtx->retryStep > 0) {
if (pResp->code == TSDB_CODE_RPC_NETWORK_UNAVAIL) {
pResp->code = TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED;
} else if (pResp->code == TSDB_CODE_RPC_BROKEN_LINK) {
pResp->code = TSDB_CODE_RPC_SOMENODE_BROKEN_LINK;
}
}
+}
+int32_t cliNotifyImplCb(SCliConn* pConn, SCliReq* pReq, STransMsg* pResp) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+ SReqCtx* pCtx = pReq ? pReq->ctx : NULL;
STraceId* trace = &pResp->info.traceId;
- bool hasEpSet = cliTryExtractEpSet(pResp, &pCtx->epSet);
- if (hasEpSet) {
- if (rpcDebugFlag & DEBUG_TRACE) {
- char tbuf[512] = {0};
- TAOS_UNUSED(epsetToStr(&pCtx->epSet, tbuf, tListLen(tbuf)));
- tGTrace("%s conn %p extract epset from msg", CONN_GET_INST_LABEL(pConn), pConn);
- }
+
+ if (pCtx == NULL) {
+ pInst->cfp(pInst->parent, pResp, NULL);
+ return 0;
}
if (pCtx->pSem || pCtx->syncMsgRef != 0) {
tGTrace("%s conn %p(sync) handle resp", CONN_GET_INST_LABEL(pConn), pConn);
@@ -2814,7 +2916,12 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
memcpy(pSyncMsg->pRsp, (char*)pResp, sizeof(*pResp));
if (cliIsEpsetUpdated(pResp->code, pCtx)) {
pSyncMsg->hasEpSet = 1;
- epsetAssign(&pSyncMsg->epSet, &pCtx->epSet);
+
+ SEpSet epset = {0};
+ if (transCreateUserEpsetFromReqEpset(pCtx->epSet, &epset) != 0) {
+ tError("failed to create user epset from req epset");
+ }
+ epsetAssign(&pSyncMsg->epSet, &epset);
}
TAOS_UNUSED(tsem2_post(pSyncMsg->pSem));
TAOS_UNUSED(taosReleaseRef(transGetSyncMsgMgt(), pCtx->syncMsgRef));
@@ -2824,18 +2931,43 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
}
} else {
tGTrace("%s conn %p handle resp", CONN_GET_INST_LABEL(pConn), pConn);
- if (retry == false && hasEpSet == true) {
- pTransInst->cfp(pTransInst->parent, pResp, &pCtx->epSet);
+ if (pResp->info.hasEpSet == 1) {
+ SEpSet epset = {0};
+ if (transCreateUserEpsetFromReqEpset(pCtx->epSet, &epset) != 0) {
+ tError("failed to create user epset from req epset");
+ }
+ pInst->cfp(pInst->parent, pResp, &epset);
} else {
if (!cliIsEpsetUpdated(pResp->code, pCtx)) {
- pTransInst->cfp(pTransInst->parent, pResp, NULL);
+ pInst->cfp(pInst->parent, pResp, NULL);
} else {
- pTransInst->cfp(pTransInst->parent, pResp, &pCtx->epSet);
+ SEpSet epset = {0};
+ if (transCreateUserEpsetFromReqEpset(pCtx->epSet, &epset) != 0) {
+ tError("failed to create user epset from req epset");
+ }
+ pInst->cfp(pInst->parent, pResp, &epset);
}
}
}
return 0;
}
+int32_t cliNotifyCb(SCliConn* pConn, SCliReq* pReq, STransMsg* pResp) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+
+ if (pReq != NULL) {
+ if (cliMayRetry(pConn, pReq, pResp)) {
+ return TSDB_CODE_RPC_ASYNC_IN_PROCESS;
+ }
+
+ cliMayResetRespCode(pReq, pResp);
+
+ if (cliTryUpdateEpset(pReq, pResp)) {
+ cliPerfLog_epset(pConn, pReq);
+ }
+ }
+ return cliNotifyImplCb(pConn, pReq, pResp);
+}
void transCloseClient(void* arg) {
int32_t code = 0;
@@ -2843,7 +2975,7 @@ void transCloseClient(void* arg) {
for (int i = 0; i < cli->numOfThreads; i++) {
code = cliSendQuit(cli->pThreadObj[i]);
if (code != 0) {
- tError("failed to send quit to thread:%d, reason:%s", i, tstrerror(code));
+ tError("failed to send quit to thread:%d since %s", i, tstrerror(code));
}
destroyThrdObj(cli->pThreadObj[i]);
@@ -2852,30 +2984,43 @@ void transCloseClient(void* arg) {
taosMemoryFree(cli);
}
void transRefCliHandle(void* handle) {
+ int32_t ref = 0;
if (handle == NULL) {
return;
}
- int ref = T_REF_INC((SCliConn*)handle);
- tTrace("%s conn %p ref %d", CONN_GET_INST_LABEL((SCliConn*)handle), handle, ref);
- UNUSED(ref);
+ SCliConn* conn = (SCliConn*)handle;
+ conn->ref++;
+
+ tTrace("%s conn %p ref %d", CONN_GET_INST_LABEL(conn), conn, conn->ref);
}
-void transUnrefCliHandle(void* handle) {
+int32_t transUnrefCliHandle(void* handle) {
if (handle == NULL) {
- return;
+ return 0;
}
- int ref = T_REF_DEC((SCliConn*)handle);
- tTrace("%s conn %p ref:%d", CONN_GET_INST_LABEL((SCliConn*)handle), handle, ref);
- if (ref == 0) {
- cliDestroyConn((SCliConn*)handle, true);
+ int32_t ref = 0;
+ SCliConn* conn = (SCliConn*)handle;
+ conn->ref--;
+ ref = conn->ref;
+
+ tTrace("%s conn %p ref:%d", CONN_GET_INST_LABEL(conn), conn, conn->ref);
+ if (conn->ref == 0) {
+ cliDestroyConn(conn, true);
}
+ return ref;
+}
+
+int32_t transGetRefCount(void* handle) {
+ if (handle == NULL) {
+ return 0;
+ }
+ SCliConn* conn = (SCliConn*)handle;
+ return conn->ref;
}
static FORCE_INLINE SCliThrd* transGetWorkThrdFromHandle(STrans* trans, int64_t handle) {
SCliThrd* pThrd = NULL;
SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle);
if (exh == NULL) {
return NULL;
- } else {
- tDebug("conn %p got", exh->handle);
}
taosWLockLatch(&exh->latch);
if (exh->pThrd == NULL && trans != NULL) {
@@ -2886,7 +3031,7 @@ static FORCE_INLINE SCliThrd* transGetWorkThrdFromHandle(STrans* trans, int64_t
pThrd = exh->pThrd;
taosWUnLockLatch(&exh->latch);
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), handle));
+ transReleaseExHandle(transGetRefMgt(), handle);
return pThrd;
}
@@ -2906,145 +3051,141 @@ int32_t transReleaseCliHandle(void* handle) {
return TSDB_CODE_RPC_BROKEN_LINK;
}
- STransMsg tmsg = {.info.handle = handle, .info.ahandle = (void*)0x9527};
+ STransMsg tmsg = {
+ .msgType = TDMT_SCH_TASK_RELEASE, .info.handle = handle, .info.ahandle = (void*)0, .info.qId = (int64_t)handle};
+
TRACE_SET_MSGID(&tmsg.info.traceId, tGenIdPI64());
- STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
+ SReqCtx* pCtx = taosMemoryCalloc(1, sizeof(SReqCtx));
if (pCtx == NULL) {
return terrno;
}
-
pCtx->ahandle = tmsg.info.ahandle;
+ SCliReq* cmsg = taosMemoryCalloc(1, sizeof(SCliReq));
- SCliMsg* cmsg = taosMemoryCalloc(1, sizeof(SCliMsg));
if (cmsg == NULL) {
taosMemoryFree(pCtx);
return terrno;
}
cmsg->msg = tmsg;
cmsg->st = taosGetTimestampUs();
- cmsg->type = Release;
+ cmsg->type = Normal;
cmsg->ctx = pCtx;
STraceId* trace = &tmsg.info.traceId;
tGDebug("send release request at thread:%08" PRId64 ", malloc memory:%p", pThrd->pid, cmsg);
if ((code = transAsyncSend(pThrd->asyncPool, &cmsg->q)) != 0) {
- destroyCmsg(cmsg);
+ destroyReq(cmsg);
return code == TSDB_CODE_RPC_ASYNC_MODULE_QUIT ? TSDB_CODE_RPC_MODULE_QUIT : code;
}
return code;
}
-static int32_t transInitMsg(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx, SCliMsg** pCliMsg) {
- if (pReq->info.traceId.msgId == 0) TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64());
- STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
+static int32_t transInitMsg(void* pInstRef, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx, SCliReq** pCliMsg) {
+ int32_t code = 0;
+ TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64());
+
+ SCliReq* pCliReq = NULL;
+ SReqCtx* pCtx = taosMemoryCalloc(1, sizeof(SReqCtx));
if (pCtx == NULL) {
- return terrno;
+ TAOS_CHECK_GOTO(terrno, NULL, _exception);
}
- epsetAssign(&pCtx->epSet, pEpSet);
- epsetAssign(&pCtx->origEpSet, pEpSet);
+ code = transCreateReqEpsetFromUserEpset(pEpSet, &pCtx->epSet);
+ if (code != 0) {
+ TAOS_CHECK_GOTO(code, NULL, _exception);
+ }
+
+ code = transCreateReqEpsetFromUserEpset(pEpSet, &pCtx->origEpSet);
+ if (code != 0) {
+ TAOS_CHECK_GOTO(code, NULL, _exception);
+ }
pCtx->ahandle = pReq->info.ahandle;
pCtx->msgType = pReq->msgType;
- if (ctx != NULL) pCtx->appCtx = *ctx;
+ if (ctx != NULL) pCtx->userCtx = *ctx;
- SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg));
- if (cliMsg == NULL) {
- taosMemoryFree(pCtx);
- return terrno;
+ pCliReq = taosMemoryCalloc(1, sizeof(SCliReq));
+ if (pReq == NULL) {
+ TAOS_CHECK_GOTO(terrno, NULL, _exception);
}
- cliMsg->ctx = pCtx;
- cliMsg->msg = *pReq;
- cliMsg->st = taosGetTimestampUs();
- cliMsg->type = Normal;
- cliMsg->refId = (int64_t)shandle;
- QUEUE_INIT(&cliMsg->seqq);
+ pCliReq->ctx = pCtx;
+ pCliReq->msg = *pReq;
+ pCliReq->st = taosGetTimestampUs();
+ pCliReq->type = Normal;
- *pCliMsg = cliMsg;
-
- return 0;
+ *pCliMsg = pCliReq;
+ return code;
+_exception:
+ if (pCtx != NULL) {
+ taosMemoryFree(pCtx->epSet);
+ taosMemoryFree(pCtx->origEpSet);
+ taosMemoryFree(pCtx);
+ }
+ taosMemoryFree(pCliReq);
+ return code;
}
-int32_t transSendRequest(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) {
- STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle);
- if (pTransInst == NULL) {
+int32_t transSendRequest(void* pInstRef, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) {
+ STrans* pInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)pInstRef);
+ if (pInst == NULL) {
transFreeMsg(pReq->pCont);
pReq->pCont = NULL;
return TSDB_CODE_RPC_MODULE_QUIT;
}
int32_t code = 0;
int64_t handle = (int64_t)pReq->info.handle;
- SCliThrd* pThrd = transGetWorkThrd(pTransInst, handle);
+ SCliThrd* pThrd = transGetWorkThrd(pInst, handle);
if (pThrd == NULL) {
- TAOS_CHECK_GOTO(TSDB_CODE_RPC_BROKEN_LINK, NULL, _exception;);
+ TAOS_CHECK_GOTO(TSDB_CODE_RPC_BROKEN_LINK, NULL, _exception);
}
- if (handle != 0) {
- SExHandle* exh = transAcquireExHandle(transGetRefMgt(), handle);
- if (exh != NULL) {
- taosWLockLatch(&exh->latch);
- if (exh->handle == NULL && exh->inited != 0) {
- SCliMsg* pCliMsg = NULL;
- code = transInitMsg(shandle, pEpSet, pReq, ctx, &pCliMsg);
- if (code != 0) {
- taosWUnLockLatch(&exh->latch);
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), handle));
- TAOS_CHECK_GOTO(code, NULL, _exception);
- }
+ pReq->info.qId = handle;
- QUEUE_PUSH(&exh->q, &pCliMsg->seqq);
- taosWUnLockLatch(&exh->latch);
-
- tDebug("msg refId: %" PRId64 "", handle);
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), handle));
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
- return 0;
- } else {
- exh->inited = 1;
- taosWUnLockLatch(&exh->latch);
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), handle));
- }
- }
- }
-
- SCliMsg* pCliMsg = NULL;
- TAOS_CHECK_GOTO(transInitMsg(shandle, pEpSet, pReq, ctx, &pCliMsg), NULL, _exception);
+ SCliReq* pCliMsg = NULL;
+ TAOS_CHECK_GOTO(transInitMsg(pInstRef, pEpSet, pReq, ctx, &pCliMsg), NULL, _exception);
STraceId* trace = &pReq->info.traceId;
- tGDebug("%s send request at thread:%08" PRId64 ", dst:%s:%d, app:%p", transLabel(pTransInst), pThrd->pid,
+ tGDebug("%s send request at thread:%08" PRId64 ", dst:%s:%d, app:%p", transLabel(pInst), pThrd->pid,
EPSET_GET_INUSE_IP(pEpSet), EPSET_GET_INUSE_PORT(pEpSet), pReq->info.ahandle);
if ((code = transAsyncSend(pThrd->asyncPool, &(pCliMsg->q))) != 0) {
- destroyCmsg(pCliMsg);
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+ destroyReq(pCliMsg);
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
return (code == TSDB_CODE_RPC_ASYNC_MODULE_QUIT ? TSDB_CODE_RPC_MODULE_QUIT : code);
}
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+
+ // if (pReq->msgType == TDMT_SCH_DROP_TASK) {
+ // TAOS_UNUSED(transReleaseCliHandle(pReq->info.handle));
+ // }
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
return 0;
_exception:
transFreeMsg(pReq->pCont);
pReq->pCont = NULL;
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
+ if (code != 0) {
+ tError("failed to send request since %s", tstrerror(code));
+ }
return code;
}
-int32_t transSendRequestWithId(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId) {
+int32_t transSendRequestWithId(void* pInstRef, const SEpSet* pEpSet, STransMsg* pReq, int64_t* transpointId) {
if (transpointId == NULL) {
return TSDB_CODE_INVALID_PARA;
}
int32_t code = 0;
- STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle);
- if (pTransInst == NULL) {
+ STrans* pInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)pInstRef);
+ if (pInst == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_RPC_MODULE_QUIT, NULL, _exception);
}
TAOS_CHECK_GOTO(transAllocHandle(transpointId), NULL, _exception);
- SCliThrd* pThrd = transGetWorkThrd(pTransInst, *transpointId);
+ SCliThrd* pThrd = transGetWorkThrd(pInst, *transpointId);
if (pThrd == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_RPC_BROKEN_LINK, NULL, _exception);
}
@@ -3055,43 +3196,53 @@ int32_t transSendRequestWithId(void* shandle, const SEpSet* pEpSet, STransMsg* p
}
pReq->info.handle = (void*)(*transpointId);
+ pReq->info.qId = *transpointId;
- SCliMsg* pCliMsg = NULL;
- TAOS_CHECK_GOTO(transInitMsg(shandle, pEpSet, pReq, NULL, &pCliMsg), NULL, _exception);
+ SCliReq* pCliMsg = NULL;
+ TAOS_CHECK_GOTO(transInitMsg(pInstRef, pEpSet, pReq, NULL, &pCliMsg), NULL, _exception);
STraceId* trace = &pReq->info.traceId;
- tGDebug("%s send request at thread:%08" PRId64 ", dst:%s:%d, app:%p", transLabel(pTransInst), pThrd->pid,
+ tGDebug("%s send request at thread:%08" PRId64 ", dst:%s:%d, app:%p", transLabel(pInst), pThrd->pid,
EPSET_GET_INUSE_IP(pEpSet), EPSET_GET_INUSE_PORT(pEpSet), pReq->info.ahandle);
if ((code = transAsyncSend(pThrd->asyncPool, &(pCliMsg->q))) != 0) {
- destroyCmsg(pCliMsg);
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+ destroyReq(pCliMsg);
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
return (code == TSDB_CODE_RPC_ASYNC_MODULE_QUIT ? TSDB_CODE_RPC_MODULE_QUIT : code);
}
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+
+ // if (pReq->msgType == TDMT_SCH_DROP_TASK) {
+ // TAOS_UNUSED(transReleaseCliHandle(pReq->info.handle));
+ // }
+ transReleaseExHandle(transGetRefMgt(), *transpointId);
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
return 0;
_exception:
transFreeMsg(pReq->pCont);
pReq->pCont = NULL;
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
+
+ tError("failed to send request since %s", tstrerror(code));
return code;
}
-int32_t transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransMsg* pRsp) {
- STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle);
- if (pTransInst == NULL) {
+int32_t transSendRecv(void* pInstRef, const SEpSet* pEpSet, STransMsg* pReq, STransMsg* pRsp) {
+ STrans* pInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)pInstRef);
+ if (pInst == NULL) {
transFreeMsg(pReq->pCont);
pReq->pCont = NULL;
return TSDB_CODE_RPC_MODULE_QUIT;
}
- int32_t code = 0;
+ int32_t code = 0;
+ SCliReq* pCliReq = NULL;
+ SReqCtx* pCtx = NULL;
STransMsg* pTransRsp = taosMemoryCalloc(1, sizeof(STransMsg));
if (pTransRsp == NULL) {
TAOS_CHECK_GOTO(terrno, NULL, _RETURN1);
}
- SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle);
+ SCliThrd* pThrd = transGetWorkThrd(pInst, (int64_t)pReq->info.handle);
if (pThrd == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_RPC_BROKEN_LINK, NULL, _RETURN1);
}
@@ -3109,41 +3260,51 @@ int32_t transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STra
if (pReq->info.traceId.msgId == 0) TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64());
- STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
+ pCtx = taosMemoryCalloc(1, sizeof(SReqCtx));
if (pCtx == NULL) {
TAOS_UNUSED(tsem_destroy(sem));
taosMemoryFree(sem);
TAOS_CHECK_GOTO(terrno, NULL, _RETURN1);
}
- epsetAssign(&pCtx->epSet, pEpSet);
- epsetAssign(&pCtx->origEpSet, pEpSet);
+ code = transCreateReqEpsetFromUserEpset(pEpSet, &pCtx->epSet);
+ if (code != 0) {
+ (TAOS_UNUSED(tsem_destroy(sem)));
+ taosMemoryFree(sem);
+ TAOS_CHECK_GOTO(code, NULL, _RETURN1);
+ }
+
+ code = transCreateReqEpsetFromUserEpset(pEpSet, &pCtx->origEpSet);
+ if (code != 0) {
+ (TAOS_UNUSED(tsem_destroy(sem)));
+ taosMemoryFree(sem);
+ TAOS_CHECK_GOTO(code, NULL, _RETURN1);
+ }
+
pCtx->ahandle = pReq->info.ahandle;
pCtx->msgType = pReq->msgType;
pCtx->pSem = sem;
pCtx->pRsp = pTransRsp;
- SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg));
- if (cliMsg == NULL) {
- TAOS_UNUSED(tsem_destroy(sem));
+ pCliReq = taosMemoryCalloc(1, sizeof(SCliReq));
+ if (pCliReq == NULL) {
+ (TAOS_UNUSED(tsem_destroy(sem)));
taosMemoryFree(sem);
- taosMemoryFree(pCtx);
TAOS_CHECK_GOTO(terrno, NULL, _RETURN1);
}
- cliMsg->ctx = pCtx;
- cliMsg->msg = *pReq;
- cliMsg->st = taosGetTimestampUs();
- cliMsg->type = Normal;
- cliMsg->refId = (int64_t)shandle;
+ pCliReq->ctx = pCtx;
+ pCliReq->msg = *pReq;
+ pCliReq->st = taosGetTimestampUs();
+ pCliReq->type = Normal;
STraceId* trace = &pReq->info.traceId;
- tGDebug("%s send request at thread:%08" PRId64 ", dst:%s:%d, app:%p", transLabel(pTransInst), pThrd->pid,
- EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet), pReq->info.ahandle);
+ tGDebug("%s send request at thread:%08" PRId64 ", dst:%s:%d, app:%p", transLabel(pInst), pThrd->pid,
+ EPSET_GET_INUSE_IP(pCtx->epSet), EPSET_GET_INUSE_PORT(pCtx->epSet), pReq->info.ahandle);
- code = transAsyncSend(pThrd->asyncPool, &cliMsg->q);
+ code = transAsyncSend(pThrd->asyncPool, &pCliReq->q);
if (code != 0) {
- destroyCmsg(cliMsg);
+ destroyReq(pReq);
TAOS_CHECK_GOTO((code == TSDB_CODE_RPC_ASYNC_MODULE_QUIT ? TSDB_CODE_RPC_MODULE_QUIT : code), NULL, _RETURN);
}
TAOS_UNUSED(tsem_wait(sem));
@@ -3153,16 +3314,22 @@ int32_t transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STra
_RETURN:
tsem_destroy(sem);
taosMemoryFree(sem);
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
taosMemoryFree(pTransRsp);
return code;
_RETURN1:
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
taosMemoryFree(pTransRsp);
taosMemoryFree(pReq->pCont);
pReq->pCont = NULL;
+ if (pCtx != NULL) {
+ taosMemoryFree(pCtx->epSet);
+ taosMemoryFree(pCtx->origEpSet);
+ taosMemoryFree(pCtx);
+ }
return code;
}
+
int32_t transCreateSyncMsg(STransMsg* pTransMsg, int64_t* refId) {
int32_t code = 0;
tsem2_t* sem = taosMemoryCalloc(1, sizeof(tsem2_t));
@@ -3199,11 +3366,12 @@ _EXIT:
taosMemoryFree(pSyncMsg);
return code;
}
-int32_t transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq, STransMsg* pRsp, int8_t* epUpdated,
+
+int32_t transSendRecvWithTimeout(void* pInstRef, SEpSet* pEpSet, STransMsg* pReq, STransMsg* pRsp, int8_t* epUpdated,
int32_t timeoutMs) {
int32_t code = 0;
- STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle);
- if (pTransInst == NULL) {
+ STrans* pInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)pInstRef);
+ if (pInst == NULL) {
transFreeMsg(pReq->pCont);
pReq->pCont = NULL;
return TSDB_CODE_RPC_MODULE_QUIT;
@@ -3214,20 +3382,28 @@ int32_t transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq,
TAOS_CHECK_GOTO(terrno, NULL, _RETURN2);
}
- SCliThrd* pThrd = transGetWorkThrd(pTransInst, (int64_t)pReq->info.handle);
+ SCliThrd* pThrd = transGetWorkThrd(pInst, (int64_t)pReq->info.handle);
if (pThrd == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_RPC_BROKEN_LINK, NULL, _RETURN2);
}
if (pReq->info.traceId.msgId == 0) TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64());
- STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
+ SReqCtx* pCtx = taosMemoryCalloc(1, sizeof(SReqCtx));
if (pCtx == NULL) {
TAOS_CHECK_GOTO(terrno, NULL, _RETURN2);
}
- epsetAssign(&pCtx->epSet, pEpSet);
- epsetAssign(&pCtx->origEpSet, pEpSet);
+ code = transCreateReqEpsetFromUserEpset(pEpSet, &pCtx->epSet);
+ if (code != 0) {
+ taosMemoryFreeClear(pCtx->epSet);
+ TAOS_CHECK_GOTO(code, NULL, _RETURN2);
+ }
+ code = transCreateReqEpsetFromUserEpset(pEpSet, &pCtx->origEpSet);
+ if (code != 0) {
+ taosMemoryFreeClear(pCtx->epSet);
+ TAOS_CHECK_GOTO(code, NULL, _RETURN2);
+ }
pCtx->ahandle = pReq->info.ahandle;
pCtx->msgType = pReq->msgType;
@@ -3243,25 +3419,24 @@ int32_t transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq,
TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _RETURN2);
}
- SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg));
- if (cliMsg == NULL) {
+ SCliReq* pCliReq = taosMemoryCalloc(1, sizeof(SCliReq));
+ if (pReq == NULL) {
taosMemoryFree(pCtx);
TAOS_CHECK_GOTO(terrno, NULL, _RETURN2);
}
- cliMsg->ctx = pCtx;
- cliMsg->msg = *pReq;
- cliMsg->st = taosGetTimestampUs();
- cliMsg->type = Normal;
- cliMsg->refId = (int64_t)shandle;
+ pCliReq->ctx = pCtx;
+ pCliReq->msg = *pReq;
+ pCliReq->st = taosGetTimestampUs();
+ pCliReq->type = Normal;
STraceId* trace = &pReq->info.traceId;
- tGDebug("%s send request at thread:%08" PRId64 ", dst:%s:%d, app:%p", transLabel(pTransInst), pThrd->pid,
- EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet), pReq->info.ahandle);
+ tGDebug("%s send request at thread:%08" PRId64 ", dst:%s:%d, app:%p", transLabel(pInst), pThrd->pid,
+ EPSET_GET_INUSE_IP(pCtx->epSet), EPSET_GET_INUSE_PORT(pCtx->epSet), pReq->info.ahandle);
- code = transAsyncSend(pThrd->asyncPool, &cliMsg->q);
+ code = transAsyncSend(pThrd->asyncPool, &pCliReq->q);
if (code != 0) {
- destroyCmsg(cliMsg);
+ destroyReq(pReq);
TAOS_CHECK_GOTO(code == TSDB_CODE_RPC_ASYNC_MODULE_QUIT ? TSDB_CODE_RPC_MODULE_QUIT : code, NULL, _RETURN);
goto _RETURN;
}
@@ -3278,25 +3453,31 @@ int32_t transSendRecvWithTimeout(void* shandle, SEpSet* pEpSet, STransMsg* pReq,
}
}
_RETURN:
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
TAOS_UNUSED(taosReleaseRef(transGetSyncMsgMgt(), ref));
TAOS_UNUSED(taosRemoveRef(transGetSyncMsgMgt(), ref));
return code;
_RETURN2:
transFreeMsg(pReq->pCont);
+
+ if (pCtx != NULL) {
+ taosMemoryFree(pCtx->epSet);
+ taosMemoryFree(pCtx->origEpSet);
+ taosMemoryFree(pCtx);
+ }
pReq->pCont = NULL;
taosMemoryFree(pTransMsg);
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
return code;
}
/*
*
**/
-int32_t transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) {
+int32_t transSetDefaultAddr(void* pInstRef, const char* ip, const char* fqdn) {
if (ip == NULL || fqdn == NULL) return TSDB_CODE_INVALID_PARA;
- STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle);
- if (pTransInst == NULL) {
+ STrans* pInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)pInstRef);
+ if (pInst == NULL) {
return TSDB_CODE_RPC_MODULE_QUIT;
}
@@ -3306,31 +3487,39 @@ int32_t transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) {
cvtAddr.cvt = true;
int32_t code = 0;
- for (int8_t i = 0; i < pTransInst->numOfThreads; i++) {
- STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
+ for (int8_t i = 0; i < pInst->numOfThreads; i++) {
+ SReqCtx* pCtx = taosMemoryCalloc(1, sizeof(SReqCtx));
if (pCtx == NULL) {
code = terrno;
break;
}
- pCtx->cvtAddr = cvtAddr;
-
- SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg));
- if (cliMsg == NULL) {
+ pCtx->pCvtAddr = (SCvtAddr*)taosMemoryCalloc(1, sizeof(SCvtAddr));
+ if (pCtx->pCvtAddr == NULL) {
taosMemoryFree(pCtx);
code = terrno;
break;
}
- cliMsg->ctx = pCtx;
- cliMsg->type = Update;
- cliMsg->refId = (int64_t)shandle;
+ memcpy(pCtx->pCvtAddr, &cvtAddr, sizeof(SCvtAddr));
- SCliThrd* thrd = ((SCliObj*)pTransInst->tcphandle)->pThreadObj[i];
- tDebug("%s update epset at thread:%08" PRId64, pTransInst->label, thrd->pid);
+ SCliReq* pReq = taosMemoryCalloc(1, sizeof(SCliReq));
+ if (pReq == NULL) {
+ taosMemoryFree(pCtx->pCvtAddr);
+ taosMemoryFree(pCtx);
+ code = terrno;
+ break;
+ }
- if ((code = transAsyncSend(thrd->asyncPool, &(cliMsg->q))) != 0) {
- destroyCmsg(cliMsg);
+ pReq->ctx = pCtx;
+ pReq->type = Update;
+
+ SCliThrd* thrd = ((SCliObj*)pInst->tcphandle)->pThreadObj[i];
+ tDebug("%s update epset at thread:%08" PRId64, pInst->label, thrd->pid);
+
+ if ((code = transAsyncSend(thrd->asyncPool, &(pReq->q))) != 0) {
+ taosMemoryFree(pCtx->pCvtAddr);
+ destroyReq(pReq);
if (code == TSDB_CODE_RPC_ASYNC_MODULE_QUIT) {
code = TSDB_CODE_RPC_MODULE_QUIT;
}
@@ -3338,7 +3527,7 @@ int32_t transSetDefaultAddr(void* shandle, const char* ip, const char* fqdn) {
}
}
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
return code;
}
@@ -3362,15 +3551,14 @@ int32_t transAllocHandle(int64_t* refId) {
QUEUE_INIT(&exh->q);
taosInitRWLatch(&exh->latch);
- tDebug("pre alloc refId %" PRId64 ", alloc exhandle %p", exh->refId, exh);
+ tDebug("trans alloc sid:%" PRId64 ", malloc:%p", exh->refId, exh);
*refId = exh->refId;
return 0;
}
-int32_t transFreeConnById(void* shandle, int64_t transpointId) {
- int32_t code = 0;
- SCliMsg* pCli = NULL;
- STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)shandle);
- if (pTransInst == NULL) {
+int32_t transFreeConnById(void* pInstRef, int64_t transpointId) {
+ int32_t code = 0;
+ STrans* pInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)pInstRef);
+ if (pInst == NULL) {
return TSDB_CODE_RPC_MODULE_QUIT;
}
if (transpointId == 0) {
@@ -3378,22 +3566,25 @@ int32_t transFreeConnById(void* shandle, int64_t transpointId) {
TAOS_CHECK_GOTO(0, NULL, _exception);
}
- SCliThrd* pThrd = transGetWorkThrdFromHandle(pTransInst, transpointId);
+ SCliThrd* pThrd = transGetWorkThrdFromHandle(pInst, transpointId);
if (pThrd == NULL) {
TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _exception);
}
- pCli = taosMemoryCalloc(1, sizeof(SCliMsg));
+ SCliReq* pCli = taosMemoryCalloc(1, sizeof(SCliReq));
if (pCli == NULL) {
TAOS_CHECK_GOTO(terrno, NULL, _exception);
}
- pCli->type = FreeById;
+ pCli->type = Normal;
- tDebug("release conn id %" PRId64 "", transpointId);
-
- STransMsg msg = {.info.handle = (void*)transpointId};
+ STransMsg msg = {.msgType = TDMT_SCH_TASK_RELEASE, .info.handle = (void*)transpointId};
+ TRACE_SET_MSGID(&msg.info.traceId, tGenIdPI64());
+ msg.info.qId = transpointId;
pCli->msg = msg;
+ STraceId* trace = &pCli->msg.info.traceId;
+ tGDebug("%s start to free conn sid:%" PRId64 "", pInst->label, transpointId);
+
code = transAsyncSend(pThrd->asyncPool, &pCli->q);
if (code != 0) {
taosMemoryFreeClear(pCli);
@@ -3401,14 +3592,363 @@ int32_t transFreeConnById(void* shandle, int64_t transpointId) {
}
_exception:
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)shandle));
- if (code != 0) {
- if (transpointId != 0) {
- TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), transpointId));
- TAOS_UNUSED(transRemoveExHandle(transGetRefMgt(), transpointId));
- }
- taosMemoryFree(pCli);
- }
-
+ transReleaseExHandle(transGetInstMgt(), (int64_t)pInstRef);
return code;
}
+
+static int32_t getOrCreateHeap(SHashObj* pConnHeapCache, char* key, SHeap** pHeap) {
+ int32_t code = 0;
+ size_t klen = strlen(key);
+
+ SHeap* p = taosHashGet(pConnHeapCache, key, klen);
+ if (p == NULL) {
+ SHeap heap = {0};
+ code = transHeapInit(&heap, compareHeapNode);
+ if (code != 0) {
+ tError("failed to init heap cache for key:%s since %s", key, tstrerror(code));
+ return code;
+ }
+
+ code = taosHashPut(pConnHeapCache, key, klen, &heap, sizeof(heap));
+ if (code != 0) {
+ transHeapDestroy(&heap);
+ tError("failed to put heap to cache for key:%s since %s", key, tstrerror(code));
+ return code;
+ }
+ p = taosHashGet(pConnHeapCache, key, klen);
+ if (p == NULL) {
+ code = TSDB_CODE_INVALID_PARA;
+ }
+ }
+ *pHeap = p;
+ return code;
+}
+
+bool filterTimeoutReq(void* key, void* arg) {
+ SListFilterArg* listArg = arg;
+ if (listArg == NULL) {
+ return false;
+ }
+
+ int64_t st = listArg->id;
+ SCliReq* pReq = QUEUE_DATA(key, SCliReq, q);
+ if (pReq->msg.info.qId == 0 && !REQUEST_NO_RESP(&pReq->msg) && pReq->ctx) {
+ int64_t elapse = ((st - pReq->st) / 1000000);
+ if (listArg && elapse >= listArg->pInst->readTimeout) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return false;
+}
+
+static void cliConnRemoveTimoutQidMsg(SCliConn* pConn, int64_t* st, queue* set) {
+ int32_t code = 0;
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+
+ SArray* pQIdBuf = pThrd->pQIdBuf;
+ void* pIter = taosHashIterate(pConn->pQTable, NULL);
+ while (pIter) {
+ STransCtx* pCtx = (STransCtx*)pIter;
+ int64_t* qid = taosHashGetKey(pIter, NULL);
+
+ if (((*st - pCtx->st) / 1000000) >= pInst->readTimeout) {
+ code = taosHashRemove(pThrd->pIdConnTable, qid, sizeof(*qid));
+ if (code != 0) {
+ tError("%s conn %p failed to remove state sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(pConn), pConn, *qid,
+ tstrerror(code));
+ }
+
+ transReleaseExHandle(transGetRefMgt(), *qid);
+ transRemoveExHandle(transGetRefMgt(), *qid);
+
+ if (taosArrayPush(pQIdBuf, qid) == NULL) {
+ code = terrno;
+ tError("%s conn %p failed to add sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(pConn), pConn, *qid,
+ tstrerror(code));
+ break;
+ }
+ tWarn("%s conn %p remove timeout msg sid:%" PRId64 "", CONN_GET_INST_LABEL(pConn), pConn, *qid);
+ }
+ pIter = taosHashIterate(pConn->pQTable, pIter);
+ }
+
+ for (int32_t i = 0; i < taosArrayGetSize(pQIdBuf); i++) {
+ int64_t* qid = taosArrayGet(pQIdBuf, i);
+ transQueueRemoveByFilter(&pConn->reqsSentOut, filterByQid, qid, set, -1);
+ transQueueRemoveByFilter(&pConn->reqsToSend, filterByQid, qid, set, -1);
+
+ STransCtx* p = taosHashGet(pConn->pQTable, qid, sizeof(*qid));
+ transCtxCleanup(p);
+ code = taosHashRemove(pConn->pQTable, qid, sizeof(*qid));
+ if (code != 0) {
+ tError("%s conn %p failed to drop ctx of sid:%" PRId64 " since %s", CONN_GET_INST_LABEL(pConn), pConn, *qid,
+ tstrerror(code));
+ }
+ }
+
+ taosArrayClear(pQIdBuf);
+}
+
+static void cliConnRemoveTimeoutNoQidMsg(SCliConn* pConn, int64_t* st, queue* set) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+ SListFilterArg arg = {.id = *st, .pInst = pInst};
+ transQueueRemoveByFilter(&pConn->reqsSentOut, filterTimeoutReq, &arg, set, -1);
+ transQueueRemoveByFilter(&pConn->reqsToSend, filterTimeoutReq, &arg, set, -1);
+ return;
+}
+
+static int8_t cliConnRemoveTimeoutMsg(SCliConn* pConn) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+
+ queue set;
+ QUEUE_INIT(&set);
+
+ int64_t now = taosGetTimestampUs();
+
+ cliConnRemoveTimoutQidMsg(pConn, &now, &set);
+ cliConnRemoveTimeoutNoQidMsg(pConn, &now, &set);
+
+ if (QUEUE_IS_EMPTY(&set)) {
+ return 0;
+ }
+ tWarn("%s conn %p do remove timeout msg", pInst->label, pConn);
+ destroyReqInQueue(pConn, &set, TSDB_CODE_RPC_TIMEOUT);
+ return 1;
+}
+static FORCE_INLINE int8_t shouldSWitchToOtherConn(SCliConn* pConn, char* key) {
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+
+ tDebug("get conn %p from heap cache for key:%s, status:%d, refCnt:%d", pConn, key, pConn->inHeap, pConn->reqRefCnt);
+ int32_t reqsNum = transQueueSize(&pConn->reqsToSend);
+ int32_t reqsSentOut = transQueueSize(&pConn->reqsSentOut);
+ int32_t stateNum = taosHashGetSize(pConn->pQTable);
+ int32_t totalReqs = reqsNum + reqsSentOut;
+
+ if (totalReqs >= pInst->shareConnLimit) {
+ if (pConn->list == NULL && pConn->dstAddr != NULL) {
+ pConn->list = taosHashGet((SHashObj*)pThrd->pool, pConn->dstAddr, strlen(pConn->dstAddr));
+ if (pConn->list != NULL) {
+ tTrace("conn %p get list %p from pool for key:%s", pConn, pConn->list, key);
+ }
+ }
+ if (pConn->list && pConn->list->totaSize >= pInst->connLimitNum / 4) {
+ tWarn("%s conn %p try to remove timeout msg since too many conn created", transLabel(pInst), pConn);
+
+ if (cliConnRemoveTimeoutMsg(pConn)) {
+ tWarn("%s conn %p succ to remove timeout msg", transLabel(pInst), pConn);
+ }
+ return 1;
+ }
+ // check req timeout or not
+ return 1;
+ }
+
+ return 0;
+}
+
+static FORCE_INLINE bool filterToDebug(void* e, void* arg) {
+ SCliReq* pReq = QUEUE_DATA(e, SCliReq, q);
+ STraceId* trace = &pReq->msg.info.traceId;
+ tGWarn("%s is sent to, and no resp from server", TMSG_INFO(pReq->msg.msgType));
+ return false;
+}
+static FORCE_INLINE void logConnMissHit(SCliConn* pConn) {
+ // queue set;
+ // QUEUE_INIT(&set);
+ SCliThrd* pThrd = pConn->hostThrd;
+ STrans* pInst = pThrd->pInst;
+ pConn->heapMissHit++;
+ tDebug("conn %p has %d reqs, %d sentout and %d status in process, total limit:%d, switch to other conn", pConn,
+ transQueueSize(&pConn->reqsToSend), transQueueSize(&pConn->reqsSentOut), taosHashGetSize(pConn->pQTable),
+ pInst->shareConnLimit);
+ // if (transQueueSize(&pConn->reqsSentOut) >= pInst->shareConnLimit) {
+ // transQueueRemoveByFilter(&pConn->reqsSentOut, filterToDebug, NULL, &set, 1);
+ // }
+}
+static SCliConn* getConnFromHeapCache(SHashObj* pConnHeapCache, char* key) {
+ int code = 0;
+ SHeap* pHeap = NULL;
+ SCliConn* pConn = NULL;
+ code = getOrCreateHeap(pConnHeapCache, key, &pHeap);
+ if (code != 0) {
+ tTrace("failed to get conn heap from cache for key:%s", key);
+ return NULL;
+ }
+ code = transHeapGet(pHeap, &pConn);
+ if (code != 0) {
+ tTrace("failed to get conn from heap cache for key:%s", key);
+ return NULL;
+ } else {
+ tTrace("conn %p get conn from heap cache for key:%s", pConn, key);
+ if (shouldSWitchToOtherConn(pConn, key)) {
+ code = balanceConnHeapCache(pConnHeapCache, pConn);
+ if (code != 0) {
+ tTrace("failed to balance conn heap cache for key:%s", key);
+ }
+ logConnMissHit(pConn);
+ return NULL;
+ }
+ }
+
+ return pConn;
+}
+static int32_t addConnToHeapCache(SHashObj* pConnHeapCacahe, SCliConn* pConn) {
+ SHeap* p = NULL;
+ int32_t code = 0;
+
+ if (pConn->heap != NULL) {
+ p = pConn->heap;
+ tTrace("conn %p add to heap cache for key:%s,status:%d, refCnt:%d, add direct", pConn, pConn->dstAddr,
+ pConn->inHeap, pConn->reqRefCnt);
+ } else {
+ code = getOrCreateHeap(pConnHeapCacahe, pConn->dstAddr, &p);
+ if (code != 0) {
+ return code;
+ }
+ if (pConn->connnected == 0) {
+ int64_t now = taosGetTimestampMs();
+ if (now - p->lastConnFailTs < 3000) {
+ return TSDB_CODE_RPC_NETWORK_UNAVAIL;
+ }
+ }
+ }
+
+ code = transHeapInsert(p, pConn);
+ tTrace("conn %p add to heap cache for key:%s,status:%d, refCnt:%d", pConn, pConn->dstAddr, pConn->inHeap,
+ pConn->reqRefCnt);
+ return code;
+}
+
+static int32_t delConnFromHeapCache(SHashObj* pConnHeapCache, SCliConn* pConn) {
+ if (pConn->heap != NULL) {
+ tTrace("conn %p try to delete from heap cache direct", pConn);
+ return transHeapDelete(pConn->heap, pConn);
+ }
+
+ SHeap* p = taosHashGet(pConnHeapCache, pConn->dstAddr, strlen(pConn->dstAddr));
+ if (p == NULL) {
+ tTrace("failed to get heap cache for key:%s, no need to del", pConn->dstAddr);
+ return 0;
+ }
+ int32_t code = transHeapDelete(p, pConn);
+ if (code != 0) {
+ tTrace("conn %p failed delete from heap cache since %s", pConn, tstrerror(code));
+ }
+ return code;
+}
+
+static int32_t balanceConnHeapCache(SHashObj* pConnHeapCache, SCliConn* pConn) {
+ if (pConn->heap != NULL && pConn->inHeap != 0) {
+ SHeap* heap = pConn->heap;
+ tTrace("conn %p'heap may should do balance, numOfConn:%d", pConn, (int)(heap->heap->nelts));
+ int64_t now = taosGetTimestampMs();
+ if (((now - heap->lastUpdateTs) / 1000) > 30) {
+ heap->lastUpdateTs = now;
+ tTrace("conn %p'heap do balance, numOfConn:%d", pConn, (int)(heap->heap->nelts));
+ return transHeapBalance(pConn->heap, pConn);
+ }
+ }
+ return 0;
+}
+// conn heap
+int32_t compareHeapNode(const HeapNode* a, const HeapNode* b) {
+ SCliConn* args1 = container_of(a, SCliConn, node);
+ SCliConn* args2 = container_of(b, SCliConn, node);
+
+ int32_t totalReq1 = transQueueSize(&args1->reqsToSend) + transQueueSize(&args1->reqsSentOut);
+ int32_t totalReq2 = transQueueSize(&args2->reqsToSend) + transQueueSize(&args2->reqsSentOut);
+ if (totalReq1 > totalReq2) {
+ return 0;
+ }
+ return 1;
+}
+int32_t transHeapInit(SHeap* heap, int32_t (*cmpFunc)(const HeapNode* a, const HeapNode* b)) {
+ heap->heap = heapCreate(cmpFunc);
+ if (heap->heap == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+
+ heap->cmpFunc = cmpFunc;
+ return 0;
+}
+void transHeapDestroy(SHeap* heap) {
+ if (heap != NULL) {
+ heapDestroy(heap->heap);
+ }
+}
+int32_t transHeapGet(SHeap* heap, SCliConn** p) {
+ if (heapSize(heap->heap) == 0) {
+ *p = NULL;
+ return -1;
+ }
+ HeapNode* minNode = heapMin(heap->heap);
+ if (minNode == NULL) {
+ *p = NULL;
+ return -1;
+ }
+ *p = container_of(minNode, SCliConn, node);
+ return 0;
+}
+int32_t transHeapInsert(SHeap* heap, SCliConn* p) {
+ // impl later
+ p->reqRefCnt++;
+ if (p->inHeap == 1) {
+ tTrace("failed to insert conn %p since already in heap", p);
+ return TSDB_CODE_DUP_KEY;
+ }
+
+ heapInsert(heap->heap, &p->node);
+ p->inHeap = 1;
+ p->lastAddHeapTime = taosGetTimestampMs();
+ p->heap = heap;
+ return 0;
+}
+int32_t transHeapDelete(SHeap* heap, SCliConn* p) {
+ // impl later
+ if (p->connnected == 0) {
+ TAOS_UNUSED(transHeapUpdateFailTs(heap, p));
+ }
+
+ if (p->inHeap == 0) {
+ tTrace("failed to del conn %p since not in heap", p);
+ return 0;
+ } else {
+ int64_t now = taosGetTimestampMs();
+ if (p->forceDelFromHeap == 0 && now - p->lastAddHeapTime < 10000) {
+ tTrace("conn %p not added/delete to heap frequently", p);
+ return TSDB_CODE_RPC_ASYNC_IN_PROCESS;
+ }
+ }
+
+ p->inHeap = 0;
+ p->reqRefCnt--;
+ if (p->reqRefCnt == 0) {
+ heapRemove(heap->heap, &p->node);
+ tTrace("conn %p delete from heap", p);
+ } else if (p->reqRefCnt < 0) {
+ tTrace("conn %p has %d reqs, not delete from heap,assert", p, p->reqRefCnt);
+ } else {
+ tTrace("conn %p has %d reqs, not delete from heap", p, p->reqRefCnt);
+ }
+ return 0;
+}
+
+int32_t transHeapUpdateFailTs(SHeap* heap, SCliConn* p) {
+ heap->lastConnFailTs = taosGetTimestampMs();
+ return 0;
+}
+
+int32_t transHeapBalance(SHeap* heap, SCliConn* p) {
+ if (p->inHeap == 0 || heap == NULL || heap->heap == NULL) {
+ return 0;
+ }
+ heapRemove(heap->heap, &p->node);
+ heapInsert(heap->heap, &p->node);
+ return 0;
+}
diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c
index d3a79f330c..35ca6678b8 100644
--- a/source/libs/transport/src/transComm.c
+++ b/source/libs/transport/src/transComm.c
@@ -15,7 +15,7 @@
#include "transComm.h"
-#define BUFFER_CAP 4096
+#define BUFFER_CAP 8 * 1024
static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT;
@@ -59,7 +59,7 @@ int32_t transCompressMsg(char* msg, int32_t len) {
taosMemoryFree(buf);
return ret;
}
-int32_t transDecompressMsg(char** msg, int32_t len) {
+int32_t transDecompressMsg(char** msg, int32_t* len) {
STransMsgHead* pHead = (STransMsgHead*)(*msg);
if (pHead->comp == 0) return 0;
@@ -68,16 +68,18 @@ int32_t transDecompressMsg(char** msg, int32_t len) {
STransCompMsg* pComp = (STransCompMsg*)pCont;
int32_t oriLen = htonl(pComp->contLen);
- char* buf = taosMemoryCalloc(1, oriLen + sizeof(STransMsgHead));
+ int32_t tlen = *len;
+ char* buf = taosMemoryCalloc(1, oriLen + sizeof(STransMsgHead));
if (buf == NULL) {
return terrno;
}
STransMsgHead* pNewHead = (STransMsgHead*)buf;
int32_t decompLen = LZ4_decompress_safe(pCont + sizeof(STransCompMsg), (char*)pNewHead->content,
- len - sizeof(STransMsgHead) - sizeof(STransCompMsg), oriLen);
+ tlen - sizeof(STransMsgHead) - sizeof(STransCompMsg), oriLen);
memcpy((char*)pNewHead, (char*)pHead, sizeof(STransMsgHead));
+ *len = oriLen + sizeof(STransMsgHead);
pNewHead->msgLen = htonl(oriLen + sizeof(STransMsgHead));
taosMemoryFree(pHead);
@@ -95,13 +97,12 @@ void transFreeMsg(void* msg) {
tTrace("rpc free cont:%p", (char*)msg - TRANS_MSG_OVERHEAD);
taosMemoryFree((char*)msg - sizeof(STransMsgHead));
}
-int transSockInfo2Str(struct sockaddr* sockname, char* dst) {
+void transSockInfo2Str(struct sockaddr* sockname, char* dst) {
struct sockaddr_in addr = *(struct sockaddr_in*)sockname;
char buf[20] = {0};
int r = uv_ip4_name(&addr, (char*)buf, sizeof(buf));
sprintf(dst, "%s:%d", buf, ntohs(addr.sin_port));
- return r;
}
int32_t transInitBuffer(SConnBuffer* buf) {
buf->buf = taosMemoryCalloc(1, BUFFER_CAP);
@@ -116,10 +117,9 @@ int32_t transInitBuffer(SConnBuffer* buf) {
buf->invalid = 0;
return 0;
}
-int32_t transDestroyBuffer(SConnBuffer* p) {
+void transDestroyBuffer(SConnBuffer* p) {
taosMemoryFree(p->buf);
p->buf = NULL;
- return 0;
}
int32_t transClearBuffer(SConnBuffer* buf) {
@@ -184,7 +184,7 @@ int32_t transResetBuffer(SConnBuffer* connBuf, int8_t resetBuf) {
}
}
} else {
- tError("failed to reset buffer, total:%d, len:%d, reason:%s", p->total, p->len, tstrerror(TSDB_CODE_INVALID_MSG));
+ tError("failed to reset buffer, total:%d, len:%d since %s", p->total, p->len, tstrerror(TSDB_CODE_INVALID_MSG));
return TSDB_CODE_INVALID_MSG;
}
return 0;
@@ -281,7 +281,7 @@ int32_t transAsyncPoolCreate(uv_loop_t* loop, int sz, void* arg, AsyncCB cb, SAs
async->data = item;
err = uv_async_init(loop, async, cb);
if (err != 0) {
- tError("failed to init async, reason:%s", uv_err_name(err));
+ tError("failed to init async since %s", uv_err_name(err));
code = TSDB_CODE_THIRDPARTY_ERROR;
break;
}
@@ -333,14 +333,16 @@ int transAsyncSend(SAsyncPool* pool, queue* q) {
SAsyncItem* item = async->data;
if (taosThreadMutexLock(&item->mtx) != 0) {
- tError("failed to lock mutex");
+ tError("failed to lock mutex since %s", tstrerror(terrno));
+ return terrno;
}
QUEUE_PUSH(&item->qmsg, q);
TAOS_UNUSED(taosThreadMutexUnlock(&item->mtx));
+
int ret = uv_async_send(async);
if (ret != 0) {
- tError("failed to send async,reason:%s", uv_err_name(ret));
+ tError("failed to send async since %s", uv_err_name(ret));
return TSDB_CODE_THIRDPARTY_ERROR;
}
return 0;
@@ -348,15 +350,17 @@ int transAsyncSend(SAsyncPool* pool, queue* q) {
void transCtxInit(STransCtx* ctx) {
// init transCtx
- ctx->args = taosHashInit(2, taosGetDefaultHashFunction(TSDB_DATA_TYPE_UINT), true, HASH_NO_LOCK);
+ ctx->args = taosHashInit(2, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), true, HASH_NO_LOCK);
}
void transCtxCleanup(STransCtx* ctx) {
- if (ctx->args == NULL) {
+ if (ctx == NULL || ctx->args == NULL) {
return;
}
STransCtxVal* iter = taosHashIterate(ctx->args, NULL);
while (iter) {
+ int32_t* type = taosHashGetKey(iter, NULL);
+ tDebug("free msg type %s dump func", TMSG_INFO(*type));
ctx->freeFunc(iter->val);
iter = taosHashIterate(ctx->args, iter);
}
@@ -385,7 +389,7 @@ void transCtxMerge(STransCtx* dst, STransCtx* src) {
int32_t code = taosHashPut(dst->args, key, klen, sVal, sizeof(*sVal));
if (code != 0) {
- tError("failed to put val to hash, reason:%s", tstrerror(code));
+ tError("failed to put val to hash since %s", tstrerror(code));
}
iter = taosHashIterate(src->args, iter);
}
@@ -415,120 +419,93 @@ void* transCtxDumpBrokenlinkVal(STransCtx* ctx, int32_t* msgType) {
return ret;
}
-void transReqQueueInit(queue* q) {
- // init req queue
- QUEUE_INIT(q);
-}
-void* transReqQueuePush(queue* q) {
- STransReq* req = taosMemoryCalloc(1, sizeof(STransReq));
- if (req == NULL) {
- return NULL;
- }
- req->wreq.data = req;
- QUEUE_PUSH(q, &req->q);
- return &req->wreq;
-}
-void* transReqQueueRemove(void* arg) {
- void* ret = NULL;
- uv_write_t* wreq = arg;
-
- STransReq* req = wreq ? wreq->data : NULL;
- if (req == NULL) return NULL;
- QUEUE_REMOVE(&req->q);
-
- ret = wreq && wreq->handle ? wreq->handle->data : NULL;
- taosMemoryFree(req);
-
- return ret;
-}
-void transReqQueueClear(queue* q) {
- while (!QUEUE_IS_EMPTY(q)) {
- queue* h = QUEUE_HEAD(q);
- QUEUE_REMOVE(h);
- STransReq* req = QUEUE_DATA(h, STransReq, q);
- taosMemoryFree(req);
- }
-}
-
-int32_t transQueueInit(STransQueue* queue, void (*freeFunc)(const void* arg)) {
- queue->q = taosArrayInit(2, sizeof(void*));
- if (queue->q == NULL) {
- return terrno;
- }
- queue->freeFunc = (void (*)(const void*))freeFunc;
-
+int32_t transQueueInit(STransQueue* wq, void (*freeFunc)(void* arg)) {
+ QUEUE_INIT(&wq->node);
+ wq->freeFunc = (void (*)(void*))freeFunc;
+ wq->size = 0;
return 0;
}
-bool transQueuePush(STransQueue* queue, void* arg) {
- if (queue->q == NULL) {
- return true;
- }
- if (taosArrayPush(queue->q, &arg) == NULL) {
- return false;
- }
- if (taosArrayGetSize(queue->q) > 1) {
- return false;
- }
- return true;
+void transQueuePush(STransQueue* q, void* arg) {
+ queue* node = arg;
+ QUEUE_PUSH(&q->node, node);
+ q->size++;
}
-void* transQueuePop(STransQueue* queue) {
- if (queue->q == NULL || taosArrayGetSize(queue->q) == 0) {
- return NULL;
- }
- void* ptr = taosArrayGetP(queue->q, 0);
- taosArrayRemove(queue->q, 0);
- return ptr;
-}
-int32_t transQueueSize(STransQueue* queue) {
- if (queue->q == NULL) {
- return 0;
- }
- return taosArrayGetSize(queue->q);
-}
-void* transQueueGet(STransQueue* queue, int i) {
- if (queue->q == NULL || taosArrayGetSize(queue->q) == 0) {
- return NULL;
- }
- if (i >= taosArrayGetSize(queue->q)) {
- return NULL;
- }
+void* transQueuePop(STransQueue* q) {
+ if (q->size == 0) return NULL;
- void* ptr = taosArrayGetP(queue->q, i);
- return ptr;
+ queue* head = QUEUE_HEAD(&q->node);
+ QUEUE_REMOVE(head);
+ q->size--;
+ return head;
+}
+int32_t transQueueSize(STransQueue* q) { return q->size; }
+
+void* transQueueGet(STransQueue* q, int idx) {
+ if (q->size == 0) return NULL;
+
+ while (idx-- > 0) {
+ queue* node = QUEUE_NEXT(&q->node);
+ if (node == &q->node) return NULL;
+ }
+ return NULL;
}
-void* transQueueRm(STransQueue* queue, int i) {
- if (queue->q == NULL || taosArrayGetSize(queue->q) == 0) {
- return NULL;
- }
- if (i >= taosArrayGetSize(queue->q)) {
- return NULL;
- }
- void* ptr = taosArrayGetP(queue->q, i);
- taosArrayRemove(queue->q, i);
- return ptr;
-}
-
-bool transQueueEmpty(STransQueue* queue) {
- if (queue->q == NULL) {
- return true;
- }
- return taosArrayGetSize(queue->q) == 0;
-}
-void transQueueClear(STransQueue* queue) {
- if (queue->freeFunc != NULL) {
- for (int i = 0; i < taosArrayGetSize(queue->q); i++) {
- void* p = taosArrayGetP(queue->q, i);
- queue->freeFunc(p);
+void transQueueRemoveByFilter(STransQueue* q, bool (*filter)(void* e, void* arg), void* arg, void* dst, int32_t size) {
+ queue* d = dst;
+ queue* node = QUEUE_NEXT(&q->node);
+ while (node != &q->node) {
+ queue* next = QUEUE_NEXT(node);
+ if (filter && filter(node, arg)) {
+ QUEUE_REMOVE(node);
+ q->size--;
+ QUEUE_PUSH(d, node);
+ if (--size == 0) {
+ break;
+ }
}
+ node = next;
}
- taosArrayClear(queue->q);
}
-void transQueueDestroy(STransQueue* queue) {
- transQueueClear(queue);
- taosArrayDestroy(queue->q);
+
+void* tranQueueHead(STransQueue* q) {
+ if (q->size == 0) return NULL;
+
+ queue* head = QUEUE_HEAD(&q->node);
+ return head;
}
+void* transQueueRm(STransQueue* q, int i) {
+ // if (queue->q == NULL || taosArrayGetSize(queue->q) == 0) {
+ // return NULL;
+ // }
+ // if (i >= taosArrayGetSize(queue->q)) {
+ // return NULL;
+ // }
+ // void* ptr = taosArrayGetP(queue->q, i);
+ // taosArrayRemove(queue->q, i);
+ // return ptr;
+ return NULL;
+}
+
+void transQueueRemove(STransQueue* q, void* e) {
+ if (q->size == 0) return;
+ queue* node = e;
+ QUEUE_REMOVE(node);
+ q->size--;
+}
+
+bool transQueueEmpty(STransQueue* q) { return q->size == 0 ? true : false; }
+
+void transQueueClear(STransQueue* q) {
+ while (!QUEUE_IS_EMPTY(&q->node)) {
+ queue* h = QUEUE_HEAD(&q->node);
+ QUEUE_REMOVE(h);
+ if (q->freeFunc != NULL) (q->freeFunc)(h);
+ q->size--;
+ }
+}
+void transQueueDestroy(STransQueue* q) { transQueueClear(q); }
+
static FORCE_INLINE int32_t timeCompare(const HeapNode* a, const HeapNode* b) {
SDelayTask* arg1 = container_of(a, SDelayTask, node);
SDelayTask* arg2 = container_of(b, SDelayTask, node);
@@ -690,7 +667,13 @@ void transPrintEpSet(SEpSet* pEpSet) {
len += tsnprintf(buf + len, sizeof(buf) - len, "}");
tTrace("%s, inUse:%d", buf, pEpSet->inUse);
}
-bool transEpSetIsEqual(SEpSet* a, SEpSet* b) {
+bool transReqEpsetIsEqual(SReqEpSet* a, SReqEpSet* b) {
+ if (a == NULL && b == NULL) {
+ return true;
+ } else if (a == NULL || b == NULL) {
+ return false;
+ }
+
if (a->numOfEps != b->numOfEps || a->inUse != b->inUse) {
return false;
}
@@ -701,7 +684,7 @@ bool transEpSetIsEqual(SEpSet* a, SEpSet* b) {
}
return true;
}
-bool transEpSetIsEqual2(SEpSet* a, SEpSet* b) {
+bool transCompareReqAndUserEpset(SReqEpSet* a, SEpSet* b) {
if (a->numOfEps != b->numOfEps) {
return false;
}
@@ -757,28 +740,31 @@ int64_t transAddExHandle(int32_t refMgt, void* p) {
// acquire extern handle
return taosAddRef(refMgt, p);
}
-int32_t transRemoveExHandle(int32_t refMgt, int64_t refId) {
+void transRemoveExHandle(int32_t refMgt, int64_t refId) {
// acquire extern handle
- return taosRemoveRef(refMgt, refId);
+ int32_t code = taosRemoveRef(refMgt, refId);
+ if (code != 0) {
+ tTrace("failed to remove %" PRId64 " from resetId:%d", refId, refMgt);
+ }
}
void* transAcquireExHandle(int32_t refMgt, int64_t refId) { // acquire extern handle
return (void*)taosAcquireRef(refMgt, refId);
}
-int32_t transReleaseExHandle(int32_t refMgt, int64_t refId) {
+void transReleaseExHandle(int32_t refMgt, int64_t refId) {
// release extern handle
- return taosReleaseRef(refMgt, refId);
+ int32_t code = taosReleaseRef(refMgt, refId);
+ if (code != 0) {
+ tTrace("failed to release %" PRId64 " from resetId:%d", refId, refMgt);
+ }
}
void transDestroyExHandle(void* handle) {
if (handle == NULL) {
return;
}
SExHandle* eh = handle;
- if (!QUEUE_IS_EMPTY(&eh->q)) {
- tDebug("handle %p mem leak", handle);
- }
- tDebug("free exhandle %p", handle);
+ tDebug("trans destroy sid:%" PRId64 ", memory %p", eh->refId, handle);
taosMemoryFree(handle);
}
@@ -841,7 +827,7 @@ int32_t transUtilSIpRangeToStr(SIpV4Range* pRange, char* buf) {
int32_t err = uv_inet_ntop(AF_INET, &addr, buf, 32);
if (err != 0) {
- tError("failed to convert ip to string, reason:%s", uv_strerror(err));
+ tError("failed to convert ip to string since %s", uv_strerror(err));
return TSDB_CODE_THIRDPARTY_ERROR;
}
@@ -890,3 +876,113 @@ int32_t transUtilSWhiteListToStr(SIpWhiteList* pList, char** ppBuf) {
// STUB_RAND_NETWORK_ERR(status)
// return status;
// }
+
+int32_t initWQ(queue* wq) {
+ int32_t code = 0;
+ QUEUE_INIT(wq);
+ for (int i = 0; i < 4; i++) {
+ SWReqsWrapper* w = taosMemoryCalloc(1, sizeof(SWReqsWrapper));
+ if (w == NULL) {
+ TAOS_CHECK_GOTO(terrno, NULL, _exception);
+ }
+ w->wreq.data = w;
+ w->arg = NULL;
+ QUEUE_INIT(&w->node);
+ QUEUE_PUSH(wq, &w->q);
+ }
+ return 0;
+_exception:
+ destroyWQ(wq);
+ return code;
+}
+void destroyWQ(queue* wq) {
+ while (!QUEUE_IS_EMPTY(wq)) {
+ queue* h = QUEUE_HEAD(wq);
+ QUEUE_REMOVE(h);
+ SWReqsWrapper* w = QUEUE_DATA(h, SWReqsWrapper, q);
+ taosMemoryFree(w);
+ }
+}
+
+uv_write_t* allocWReqFromWQ(queue* wq, void* arg) {
+ if (!QUEUE_IS_EMPTY(wq)) {
+ queue* node = QUEUE_HEAD(wq);
+ QUEUE_REMOVE(node);
+ SWReqsWrapper* w = QUEUE_DATA(node, SWReqsWrapper, q);
+ w->arg = arg;
+ QUEUE_INIT(&w->node);
+
+ return &w->wreq;
+ } else {
+ SWReqsWrapper* w = taosMemoryCalloc(1, sizeof(SWReqsWrapper));
+ if (w == NULL) {
+ return NULL;
+ }
+ w->wreq.data = w;
+ w->arg = arg;
+ QUEUE_INIT(&w->node);
+ return &w->wreq;
+ }
+}
+
+void freeWReqToWQ(queue* wq, SWReqsWrapper* w) {
+ QUEUE_INIT(&w->node);
+ QUEUE_PUSH(wq, &w->q);
+}
+
+int32_t transSetReadOption(uv_handle_t* handle) {
+ int32_t code = 0;
+ int32_t fd;
+ int ret = uv_fileno((uv_handle_t*)handle, &fd);
+ if (ret != 0) {
+ tWarn("failed to get fd since %s", uv_err_name(ret));
+ return TSDB_CODE_THIRDPARTY_ERROR;
+ }
+ code = taosSetSockOpt2(fd);
+ return code;
+}
+
+int32_t transCreateReqEpsetFromUserEpset(const SEpSet* pEpset, SReqEpSet** pReqEpSet) {
+ if (pEpset == NULL) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+
+ if (pReqEpSet == NULL) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+
+ int32_t size = sizeof(SReqEpSet) + sizeof(SEp) * pEpset->numOfEps;
+ SReqEpSet* pReq = (SReqEpSet*)taosMemoryCalloc(1, size);
+ if (pReq == NULL) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ memcpy((char*)pReq, (char*)pEpset, size);
+ // clear previous
+ taosMemoryFree(*pReqEpSet);
+
+ if (transValidReqEpset(pReq) != TSDB_CODE_SUCCESS) {
+ taosMemoryFree(pReq);
+ return TSDB_CODE_INVALID_PARA;
+ }
+
+ *pReqEpSet = pReq;
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t transCreateUserEpsetFromReqEpset(const SReqEpSet* pReqEpSet, SEpSet* pEpSet) {
+ if (pReqEpSet == NULL) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+ memcpy((char*)pEpSet, (char*)pReqEpSet, sizeof(SReqEpSet) + sizeof(SEp) * pReqEpSet->numOfEps);
+ return TSDB_CODE_SUCCESS;
+}
+
+int32_t transValidReqEpset(SReqEpSet* pReqEpSet) {
+ if (pReqEpSet == NULL) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+ if (pReqEpSet->numOfEps == 0 || pReqEpSet->numOfEps > TSDB_MAX_EP_NUM || pReqEpSet->inUse >= TSDB_MAX_EP_NUM) {
+ return TSDB_CODE_INVALID_PARA;
+ }
+ return TSDB_CODE_SUCCESS;
+}
\ No newline at end of file
diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c
index d8737ef30f..a7c24f3fae 100644
--- a/source/libs/transport/src/transSvr.c
+++ b/source/libs/transport/src/transSvr.c
@@ -25,21 +25,20 @@ typedef struct {
} SSvrRegArg;
typedef struct SSvrConn {
- T_REF_DECLARE()
+ int32_t ref;
uv_tcp_t* pTcp;
- queue wreqQueue;
uv_timer_t pTimer;
queue queue;
SConnBuffer readBuf; // read buf,
int inType;
- void* pTransInst; // rpc init
- void* ahandle; //
+ void* pInst; // rpc init
+ void* ahandle; //
void* hostThrd;
- STransQueue srvMsgs;
+ STransQueue resps;
- SSvrRegArg regArg;
- bool broken; // conn broken;
+ // SSvrRegArg regArg;
+ bool broken; // conn broken;
ConnStatus status;
@@ -54,22 +53,30 @@ typedef struct SSvrConn {
int spi;
char info[64];
char user[TSDB_UNI_LEN]; // user ID for the link
+ int8_t userInited;
char secret[TSDB_PASSWORD_LEN];
char ckey[TSDB_PASSWORD_LEN]; // ciphering key
int64_t whiteListVer;
+
+ // state req dict
+ SHashObj* pQTable;
+ uv_buf_t* buf;
+ int32_t bufSize;
+ queue wq; // uv_write_t queue
} SSvrConn;
-typedef struct SSvrMsg {
+typedef struct SSvrRespMsg {
SSvrConn* pConn;
STransMsg msg;
queue q;
STransMsgType type;
+ int64_t seqNum;
+ void* arg;
+ FilteFunc func;
+ int8_t sent;
- void* arg;
- FilteFunc func;
-
-} SSvrMsg;
+} SSvrRespMsg;
typedef struct {
int64_t ver;
@@ -91,13 +98,16 @@ typedef struct SWorkThrd {
queue msg;
queue conn;
- void* pTransInst;
+ void* pInst;
bool quit;
SIpWhiteListTab* pWhiteList;
int64_t whiteListVer;
int8_t enableIpWhiteList;
- int8_t inited;
+
+ int32_t connRefMgt;
+
+ int8_t inited;
} SWorkThrd;
typedef struct SServerObj {
@@ -140,8 +150,6 @@ static void uvWorkerAsyncCb(uv_async_t* handle);
static void uvAcceptAsyncCb(uv_async_t* handle);
static void uvShutDownCb(uv_shutdown_t* req, int status);
-static bool uvRecvReleaseReq(SSvrConn* conn, STransMsgHead* pHead);
-
/*
* time-consuming task throwed into BG work thread
*/
@@ -151,27 +159,26 @@ static void uvWorkAfterTask(uv_work_t* req, int status);
static void uvWalkCb(uv_handle_t* handle, void* arg);
static void uvFreeCb(uv_handle_t* handle);
-static FORCE_INLINE void uvStartSendRespImpl(SSvrMsg* smsg);
+static FORCE_INLINE void uvStartSendRespImpl(SSvrRespMsg* smsg);
-static int uvPrepareSendData(SSvrMsg* msg, uv_buf_t* wb);
-static void uvStartSendResp(SSvrMsg* msg);
+static int32_t uvPrepareSendData(SSvrRespMsg* msg, uv_buf_t* wb);
+static void uvStartSendResp(SSvrRespMsg* msg);
static void uvNotifyLinkBrokenToApp(SSvrConn* conn);
-static FORCE_INLINE void destroySmsg(SSvrMsg* smsg);
+static FORCE_INLINE void destroySmsg(SSvrRespMsg* smsg);
static FORCE_INLINE SSvrConn* createConn(void* hThrd);
static FORCE_INLINE void destroyConn(SSvrConn* conn, bool clear /*clear handle or not*/);
-static FORCE_INLINE void destroyConnRegArg(SSvrConn* conn);
-static int32_t reallocConnRef(SSvrConn* conn);
+int32_t uvGetConnRefOfThrd(SWorkThrd* thrd) { return thrd ? thrd->connRefMgt : -1; }
-static void uvHandleQuit(SSvrMsg* msg, SWorkThrd* thrd);
-static void uvHandleRelease(SSvrMsg* msg, SWorkThrd* thrd);
-static void uvHandleResp(SSvrMsg* msg, SWorkThrd* thrd);
-static void uvHandleRegister(SSvrMsg* msg, SWorkThrd* thrd);
-static void uvHandleUpdate(SSvrMsg* pMsg, SWorkThrd* thrd);
-static void (*transAsyncHandle[])(SSvrMsg* msg, SWorkThrd* thrd) = {uvHandleResp, uvHandleQuit, uvHandleRelease,
- uvHandleRegister, uvHandleUpdate};
+static void uvHandleQuit(SSvrRespMsg* msg, SWorkThrd* thrd);
+static void uvHandleRelease(SSvrRespMsg* msg, SWorkThrd* thrd);
+static void uvHandleResp(SSvrRespMsg* msg, SWorkThrd* thrd);
+static void uvHandleRegister(SSvrRespMsg* msg, SWorkThrd* thrd);
+static void uvHandleUpdate(SSvrRespMsg* pMsg, SWorkThrd* thrd);
+static void (*transAsyncHandle[])(SSvrRespMsg* msg, SWorkThrd* thrd) = {uvHandleResp, uvHandleQuit, uvHandleRelease,
+ uvHandleRegister, uvHandleUpdate};
static void uvDestroyConn(uv_handle_t* handle);
@@ -373,32 +380,178 @@ void uvWhiteListSetConnVer(SIpWhiteListTab* pWhite, SSvrConn* pConn) {
pConn->whiteListVer = pWhite->ver;
}
+static void uvPerfLog_receive(SSvrConn* pConn, STransMsgHead* pHead, STransMsg* pTransMsg) {
+ if (!(rpcDebugFlag & DEBUG_DEBUG)) {
+ return;
+ }
+
+ STrans* pInst = pConn->pInst;
+ STraceId* trace = &pHead->traceId;
+
+ int64_t cost = taosGetTimestampUs() - taosNtoh64(pHead->timestamp);
+ static int64_t EXCEPTION_LIMIT_US = 100 * 1000;
+
+ if (pConn->status == ConnNormal && pHead->noResp == 0) {
+ if (cost >= EXCEPTION_LIMIT_US) {
+ tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, cost:%dus, recv exception, seqNum:%" PRId64
+ ", sid:%" PRId64 "",
+ transLabel(pInst), pConn, TMSG_INFO(pTransMsg->msgType), pConn->dst, pConn->src, pTransMsg->contLen,
+ (int)cost, pTransMsg->info.seqNum, pTransMsg->info.qId);
+ } else {
+ tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, cost:%dus, seqNum:%" PRId64 ", sid:%" PRId64 "",
+ transLabel(pInst), pConn, TMSG_INFO(pTransMsg->msgType), pConn->dst, pConn->src, pTransMsg->contLen,
+ (int)cost, pTransMsg->info.seqNum, pTransMsg->info.qId);
+ }
+ } else {
+ if (cost >= EXCEPTION_LIMIT_US) {
+ tGDebug(
+ "%s conn %p %s received from %s, local info:%s, len:%d, noResp:%d, code:%d, cost:%dus, recv exception, "
+ "seqNum:%" PRId64 ", sid:%" PRId64 "",
+ transLabel(pInst), pConn, TMSG_INFO(pTransMsg->msgType), pConn->dst, pConn->src, pTransMsg->contLen,
+ pHead->noResp, pTransMsg->code, (int)(cost), pTransMsg->info.seqNum, pTransMsg->info.qId);
+ } else {
+ tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, noResp:%d, code:%d, cost:%dus, seqNum:%" PRId64
+ ", "
+ "sid:%" PRId64 "",
+ transLabel(pInst), pConn, TMSG_INFO(pTransMsg->msgType), pConn->dst, pConn->src, pTransMsg->contLen,
+ pHead->noResp, pTransMsg->code, (int)(cost), pTransMsg->info.seqNum, pTransMsg->info.qId);
+ }
+ }
+ tGTrace("%s handle %p conn:%p translated to app, refId:%" PRIu64, transLabel(pInst), pTransMsg->info.handle, pConn,
+ pConn->refId);
+}
+
+static int8_t uvValidConn(SSvrConn* pConn) {
+ STrans* pInst = pConn->pInst;
+ SWorkThrd* pThrd = pConn->hostThrd;
+ int8_t forbiddenIp = 0;
+ if (pThrd->enableIpWhiteList) {
+ forbiddenIp = !uvWhiteListCheckConn(pThrd->pWhiteList, pConn) ? 1 : 0;
+ if (forbiddenIp == 0) {
+ uvWhiteListSetConnVer(pThrd->pWhiteList, pConn);
+ }
+ }
+ return forbiddenIp;
+}
+
+static int32_t uvMayHandleReleaseReq(SSvrConn* pConn, STransMsgHead* pHead) {
+ int32_t code = 0;
+ STrans* pInst = pConn->pInst;
+ if (pHead->msgType == TDMT_SCH_TASK_RELEASE) {
+ int64_t qId = taosHton64(pHead->qid);
+ if (qId <= 0) {
+ tError("conn %p recv release, but invalid sid:%" PRId64 "", pConn, qId);
+ code = TSDB_CODE_RPC_NO_STATE;
+ } else {
+ void* p = taosHashGet(pConn->pQTable, &qId, sizeof(qId));
+ if (p == NULL) {
+ code = TSDB_CODE_RPC_NO_STATE;
+ tTrace("conn %p recv release, and releady release by server sid:%" PRId64 "", pConn, qId);
+ } else {
+ SSvrRegArg* arg = p;
+ (pInst->cfp)(pInst->parent, &(arg->msg), NULL);
+ tTrace("conn %p recv release, notify server app, sid:%" PRId64 "", pConn, qId);
+
+ code = taosHashRemove(pConn->pQTable, &qId, sizeof(qId));
+ if (code != 0) {
+ tDebug("conn %p failed to remove sid:%" PRId64 "", pConn, qId);
+ }
+ tTrace("conn %p clear state,sid:%" PRId64 "", pConn, qId);
+ }
+ }
+
+ STransMsg tmsg = {.code = code,
+ .msgType = pHead->msgType + 1,
+ .info.qId = qId,
+ .info.traceId = pHead->traceId,
+ .info.seqNum = taosHton64(pHead->seqNum)};
+
+ SSvrRespMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSvrRespMsg));
+ if (srvMsg == NULL) {
+ tError("conn %p recv release, failed to send release-resp since %s", pConn, tstrerror(terrno));
+ taosMemoryFree(pHead);
+ return terrno;
+ }
+ srvMsg->msg = tmsg;
+ srvMsg->type = Normal;
+ srvMsg->pConn = pConn;
+
+ transQueuePush(&pConn->resps, &srvMsg->q);
+
+ uvStartSendRespImpl(srvMsg);
+ taosMemoryFree(pHead);
+ return TSDB_CODE_RPC_ASYNC_IN_PROCESS;
+ }
+ return 0;
+}
+
+bool uvConnMayGetUserInfo(SSvrConn* pConn, STransMsgHead** ppHead, int32_t* msgLen) {
+ if (pConn->userInited) {
+ return false;
+ }
+
+ STrans* pInst = pConn->pInst;
+ STransMsgHead* pHead = *ppHead;
+ int32_t len = *msgLen;
+ if (pHead->withUserInfo) {
+ STransMsgHead* tHead = taosMemoryCalloc(1, len - sizeof(pInst->user));
+ if (tHead == NULL) {
+ tError("conn %p failed to get user info since %s", pConn, tstrerror(terrno));
+ return false;
+ }
+ memcpy((char*)tHead, (char*)pHead, TRANS_MSG_OVERHEAD);
+ memcpy((char*)tHead + TRANS_MSG_OVERHEAD, (char*)pHead + TRANS_MSG_OVERHEAD + sizeof(pInst->user),
+ len - sizeof(STransMsgHead) - sizeof(pInst->user));
+ tHead->msgLen = htonl(htonl(pHead->msgLen) - sizeof(pInst->user));
+
+ memcpy(pConn->user, (char*)pHead + TRANS_MSG_OVERHEAD, sizeof(pConn->user));
+ pConn->userInited = 1;
+
+ taosMemoryFree(pHead);
+ *ppHead = tHead;
+ *msgLen = len - sizeof(pInst->user);
+ return true;
+ }
+ return false;
+}
static bool uvHandleReq(SSvrConn* pConn) {
- STrans* pTransInst = pConn->pTransInst;
+ STrans* pInst = pConn->pInst;
SWorkThrd* pThrd = pConn->hostThrd;
int8_t acquire = 0;
STransMsgHead* pHead = NULL;
- int8_t resetBuf = pConn->status == ConnAcquire ? 0 : 1;
- int msgLen = transDumpFromBuffer(&pConn->readBuf, (char**)&pHead, resetBuf);
+ int8_t resetBuf = 0;
+ int msgLen = transDumpFromBuffer(&pConn->readBuf, (char**)&pHead, 0);
if (msgLen <= 0) {
- tError("%s conn %p read invalid packet", transLabel(pTransInst), pConn);
+ tError("%s conn %p read invalid packet", transLabel(pInst), pConn);
return false;
}
- if (resetBuf == 0) {
- tTrace("%s conn %p not reset read buf", transLabel(pTransInst), pConn);
+ if (transDecompressMsg((char**)&pHead, &msgLen) < 0) {
+ tError("%s conn %p recv invalid packet, failed to decompress", transLabel(pInst), pConn);
+ taosMemoryFree(pHead);
+ return false;
}
- if (transDecompressMsg((char**)&pHead, msgLen) < 0) {
- tError("%s conn %p recv invalid packet, failed to decompress", transLabel(pTransInst), pConn);
- return false;
+ if (uvConnMayGetUserInfo(pConn, &pHead, &msgLen) == true) {
+ tDebug("%s conn %p get user info", transLabel(pInst), pConn);
+ } else {
+ if (pConn->userInited == 0) {
+ taosMemoryFree(pHead);
+ tDebug("%s conn %p failed get user info since %s", transLabel(pInst), pConn, tstrerror(terrno));
+ return false;
+ }
+ tDebug("%s conn %p no need get user info", transLabel(pInst), pConn);
}
+
+ if (resetBuf == 0) {
+ tTrace("%s conn %p not reset read buf", transLabel(pInst), pConn);
+ }
+
pHead->code = htonl(pHead->code);
pHead->msgLen = htonl(pHead->msgLen);
pConn->inType = pHead->msgType;
- memcpy(pConn->user, pHead->user, strlen(pHead->user));
int8_t forbiddenIp = 0;
if (pThrd->enableIpWhiteList && tsEnableWhiteList) {
@@ -408,85 +561,39 @@ static bool uvHandleReq(SSvrConn* pConn) {
}
}
- if (uvRecvReleaseReq(pConn, pHead)) {
+ if (uvMayHandleReleaseReq(pConn, pHead)) {
return true;
}
- // TODO(dengyihao): time-consuming task throwed into BG Thread
- // uv_work_t* wreq = taosMemoryMalloc(sizeof(uv_work_t));
- // wreq->data = pConn;
- // uv_read_stop((uv_stream_t*)pConn->pTcp);
- // transRefSrvHandle(pConn);
- // uv_queue_work(((SWorkThrd*)pConn->hostThrd)->loop, wreq, uvWorkDoTask, uvWorkAfterTask);
-
- STransMsg transMsg;
- memset(&transMsg, 0, sizeof(transMsg));
+ STransMsg transMsg = {0};
transMsg.contLen = transContLenFromMsg(pHead->msgLen);
transMsg.pCont = pHead->content;
transMsg.msgType = pHead->msgType;
transMsg.code = pHead->code;
- if (pConn->status == ConnNormal) {
- if (pHead->persist == 1) {
- pConn->status = ConnAcquire;
- transRefSrvHandle(pConn);
- tDebug("conn %p acquired by server app", pConn);
- }
+ if (pHead->seqNum == 0) {
+ STraceId* trace = &pHead->traceId;
+ tGError("%s conn %p received invalid seqNum, msgType:%s", transLabel(pInst), pConn, TMSG_INFO(pHead->msgType));
+ return false;
}
- STraceId* trace = &pHead->traceId;
- int64_t cost = taosGetTimestampUs() - taosNtoh64(pHead->timestamp);
- static int64_t EXCEPTION_LIMIT_US = 100 * 1000;
-
- if (pConn->status == ConnNormal && pHead->noResp == 0) {
- transRefSrvHandle(pConn);
- if (cost >= EXCEPTION_LIMIT_US) {
- tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, cost:%dus, recv exception",
- transLabel(pTransInst), pConn, TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, msgLen, (int)cost);
- } else {
- tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, cost:%dus", transLabel(pTransInst), pConn,
- TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, msgLen, (int)cost);
- }
- } else {
- if (cost >= EXCEPTION_LIMIT_US) {
- tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, noResp:%d, code:%d, cost:%dus, recv exception",
- transLabel(pTransInst), pConn, TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, msgLen, pHead->noResp,
- transMsg.code, (int)(cost));
- } else {
- tGDebug("%s conn %p %s received from %s, local info:%s, len:%d, noResp:%d, code:%d, cost:%dus",
- transLabel(pTransInst), pConn, TMSG_INFO(transMsg.msgType), pConn->dst, pConn->src, msgLen, pHead->noResp,
- transMsg.code, (int)(cost));
- }
- }
+ transMsg.info.handle = (void*)transAcquireExHandle(uvGetConnRefOfThrd(pThrd), pConn->refId);
+ transMsg.info.refIdMgt = pThrd->connRefMgt;
// pHead->noResp = 1,
// 1. server application should not send resp on handle
// 2. once send out data, cli conn released to conn pool immediately
// 3. not mixed with persist
- transMsg.info.ahandle = (void*)pHead->ahandle;
-
- if (pHead->noResp == 1) {
- transMsg.info.handle = NULL;
- } else {
- transMsg.info.handle = (void*)transAcquireExHandle(transGetSvrRefMgt(), pConn->refId);
- acquire = 1;
- }
- transMsg.info.refId = pConn->refId;
+ transMsg.info.refId = pHead->noResp == 1 ? -1 : pConn->refId;
transMsg.info.traceId = pHead->traceId;
transMsg.info.cliVer = htonl(pHead->compatibilityVer);
transMsg.info.forbiddenIp = forbiddenIp;
transMsg.info.noResp = pHead->noResp == 1 ? 1 : 0;
+ transMsg.info.seqNum = taosHton64(pHead->seqNum);
+ transMsg.info.qId = taosHton64(pHead->qid);
+ transMsg.info.msgType = pHead->msgType;
- tGTrace("%s handle %p conn:%p translated to app, refId:%" PRIu64, transLabel(pTransInst), transMsg.info.handle, pConn,
- pConn->refId);
- // if (transMsg.info.handle == NULL) {
- // tError("%s handle %p conn:%p handle failed to init" PRIu64, transLabel(pTransInst), transMsg.info.handle, pConn);
- // return false;
- // }
-
- if (pHead->noResp == 1) {
- transMsg.info.refId = -1;
- }
+ uvPerfLog_receive(pConn, pHead, &transMsg);
// set up conn info
SRpcConnInfo* pConnInfo = &(transMsg.info.conn);
@@ -494,14 +601,16 @@ static bool uvHandleReq(SSvrConn* pConn) {
pConnInfo->clientPort = pConn->port;
tstrncpy(pConnInfo->user, pConn->user, sizeof(pConnInfo->user));
- if (acquire) transReleaseExHandle(transGetSvrRefMgt(), pConn->refId);
+ transReleaseExHandle(uvGetConnRefOfThrd(pThrd), pConn->refId);
- (*pTransInst->cfp)(pTransInst->parent, &transMsg, NULL);
+ (*pInst->cfp)(pInst->parent, &transMsg, NULL);
return true;
}
void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
+ int32_t code = 0;
SSvrConn* conn = cli->data;
+ STrans* pInst = conn->pInst;
SWorkThrd* pThrd = conn->hostThrd;
STUB_RAND_NETWORK_ERR(nread);
@@ -511,7 +620,11 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
destroyConn(conn, true);
return;
}
- STrans* pTransInst = conn->pTransInst;
+
+ code = transSetReadOption((uv_handle_t*)cli);
+ if (code != 0) {
+ tWarn("%s conn %p failed to set recv opt since %s", transLabel(pInst), conn, tstrerror(code));
+ }
SConnBuffer* pBuf = &conn->readBuf;
if (nread > 0) {
@@ -519,17 +632,18 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
if (pBuf->len <= TRANS_PACKET_LIMIT) {
while (transReadComplete(pBuf)) {
if (true == pBuf->invalid || false == uvHandleReq(conn)) {
- tError("%s conn %p read invalid packet, received from %s, local info:%s", transLabel(pTransInst), conn,
- conn->dst, conn->src);
- destroyConn(conn, true);
+ tError("%s conn %p read invalid packet, received from %s, local info:%s", transLabel(pInst), conn, conn->dst,
+ conn->src);
+ conn->broken = true;
+ transUnrefSrvHandle(conn);
return;
}
}
return;
} else {
- tError("%s conn %p read invalid packet, exceed limit, received from %s, local info:%s", transLabel(pTransInst),
- conn, conn->dst, conn->src);
- destroyConn(conn, true);
+ tError("%s conn %p read invalid packet, exceed limit, received from %s, local info:%s", transLabel(pInst), conn,
+ conn->dst, conn->src);
+ transUnrefSrvHandle(conn);
return;
}
}
@@ -537,18 +651,10 @@ void uvOnRecvCb(uv_stream_t* cli, ssize_t nread, const uv_buf_t* buf) {
return;
}
- tDebug("%s conn %p read error:%s", transLabel(pTransInst), conn, uv_err_name(nread));
+ tDebug("%s conn %p read error:%s", transLabel(pInst), conn, uv_err_name(nread));
if (nread < 0) {
conn->broken = true;
- if (conn->status == ConnAcquire) {
- if (conn->regArg.init) {
- tTrace("%s conn %p broken, notify server app", transLabel(pTransInst), conn);
- STrans* pTransInst = conn->pTransInst;
- (*pTransInst->cfp)(pTransInst->parent, &(conn->regArg.msg), NULL);
- memset(&conn->regArg, 0, sizeof(conn->regArg));
- }
- }
- destroyConn(conn, true);
+ transUnrefSrvHandle(conn);
}
}
void uvAllocConnBufferCb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
@@ -567,60 +673,51 @@ void uvOnTimeoutCb(uv_timer_t* handle) {
void uvOnSendCb(uv_write_t* req, int status) {
STUB_RAND_NETWORK_ERR(status);
- SSvrConn* conn = transReqQueueRemove(req);
- if (conn == NULL) return;
+ SWReqsWrapper* wrapper = req->data;
+ SSvrConn* conn = wrapper->arg;
+
+ queue src;
+ QUEUE_INIT(&src);
+ QUEUE_MOVE(&wrapper->node, &src);
+
+ freeWReqToWQ(&conn->wq, wrapper);
+
+ tDebug("%s conn %p send data out ", transLabel(conn->pInst), conn);
if (status == 0) {
- tTrace("conn %p data already was written on stream", conn);
- if (!transQueueEmpty(&conn->srvMsgs)) {
- SSvrMsg* msg = transQueuePop(&conn->srvMsgs);
- STraceId* trace = &msg->msg.info.traceId;
- tGDebug("conn %p write data out", conn);
+ while (!QUEUE_IS_EMPTY(&src)) {
+ queue* head = QUEUE_HEAD(&src);
+ QUEUE_REMOVE(head);
- destroySmsg(msg);
- // send cached data
- if (!transQueueEmpty(&conn->srvMsgs)) {
- msg = (SSvrMsg*)transQueueGet(&conn->srvMsgs, 0);
- if (msg->type == Register && conn->status == ConnAcquire) {
- if (conn->regArg.init) {
- transFreeMsg(conn->regArg.msg.pCont);
- conn->regArg.init = 0;
- }
- conn->regArg.notifyCount = 0;
- conn->regArg.init = 1;
- conn->regArg.msg = msg->msg;
- if (conn->broken) {
- STrans* pTransInst = conn->pTransInst;
- (pTransInst->cfp)(pTransInst->parent, &(conn->regArg.msg), NULL);
- memset(&conn->regArg, 0, sizeof(conn->regArg));
- }
- TAOS_UNUSED(transQueuePop(&conn->srvMsgs));
- taosMemoryFree(msg);
-
- msg = (SSvrMsg*)transQueueGet(&conn->srvMsgs, 0);
- if (msg != NULL) {
- uvStartSendRespImpl(msg);
- }
- } else {
- uvStartSendRespImpl(msg);
- }
- }
+ SSvrRespMsg* smsg = QUEUE_DATA(head, SSvrRespMsg, q);
+ STraceId* trace = &smsg->msg.info.traceId;
+ tGDebug("%s conn %p msg already send out, seqNum:%" PRId64 ", sid:%" PRId64 "", transLabel(conn->pInst), conn,
+ smsg->msg.info.seqNum, smsg->msg.info.qId);
+ destroySmsg(smsg);
}
- transUnrefSrvHandle(conn);
} else {
- if (!uv_is_closing((uv_handle_t*)(conn->pTcp))) {
- tError("conn %p failed to write data, %s", conn, uv_err_name(status));
- conn->broken = true;
- transUnrefSrvHandle(conn);
+ while (!QUEUE_IS_EMPTY(&src)) {
+ queue* head = QUEUE_HEAD(&src);
+ QUEUE_REMOVE(head);
+
+ SSvrRespMsg* smsg = QUEUE_DATA(head, SSvrRespMsg, q);
+ STraceId* trace = &smsg->msg.info.traceId;
+ tGDebug("%s conn %p failed to send, seqNum:%" PRId64 ", sid:%" PRId64 " since %s", transLabel(conn->pInst), conn,
+ smsg->msg.info.seqNum, smsg->msg.info.qId, uv_err_name(status));
+ destroySmsg(smsg);
}
+
+ conn->broken = true;
+ transUnrefSrvHandle(conn);
}
+ transUnrefSrvHandle(conn);
}
static void uvOnPipeWriteCb(uv_write_t* req, int status) {
STUB_RAND_NETWORK_ERR(status);
if (status == 0) {
tTrace("success to dispatch conn to work thread");
} else {
- tError("fail to dispatch conn to work thread, reason:%s", uv_strerror(status));
+ tError("fail to dispatch conn to work thread since %s", uv_strerror(status));
}
if (!uv_is_closing((uv_handle_t*)req->data)) {
uv_close((uv_handle_t*)req->data, uvFreeCb);
@@ -630,7 +727,7 @@ static void uvOnPipeWriteCb(uv_write_t* req, int status) {
taosMemoryFree(req);
}
-static int uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
+static int32_t uvPrepareSendData(SSvrRespMsg* smsg, uv_buf_t* wb) {
SSvrConn* pConn = smsg->pConn;
STransMsg* pMsg = &smsg->msg;
if (pMsg->pCont == 0) {
@@ -638,109 +735,181 @@ static int uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
if (pMsg->pCont == NULL) {
return terrno;
}
-
pMsg->contLen = 0;
}
STransMsgHead* pHead = transHeadFromCont(pMsg->pCont);
- pHead->ahandle = (uint64_t)pMsg->info.ahandle;
pHead->traceId = pMsg->info.traceId;
pHead->hasEpSet = pMsg->info.hasEpSet;
pHead->magicNum = htonl(TRANS_MAGIC_NUM);
- pHead->compatibilityVer = htonl(((STrans*)pConn->pTransInst)->compatibilityVer);
+ pHead->compatibilityVer = htonl(((STrans*)pConn->pInst)->compatibilityVer);
pHead->version = TRANS_VER;
+ pHead->seqNum = taosHton64(pMsg->info.seqNum);
+ pHead->qid = taosHton64(pMsg->info.qId);
+ pHead->withUserInfo = pConn->userInited == 0 ? 1 : 0;
// handle invalid drop_task resp, TD-20098
- if (pConn->inType == TDMT_SCH_DROP_TASK && pMsg->code == TSDB_CODE_VND_INVALID_VGROUP_ID) {
- TAOS_UNUSED(transQueuePop(&pConn->srvMsgs));
- destroySmsg(smsg);
- return TSDB_CODE_INVALID_MSG;
- }
+ // if (pConn->inType == TDMT_SCH_DROP_TASK && pMsg->code == TSDB_CODE_VND_INVALID_VGROUP_ID) {
+ // // return TSDB_CODE_INVALID_MSG;
+ // return 0;
+ // }
- if (pConn->status == ConnNormal) {
- pHead->msgType = (0 == pMsg->msgType ? pConn->inType + 1 : pMsg->msgType);
- if (smsg->type == Release) pHead->msgType = 0;
- } else {
- if (smsg->type == Release) {
- pHead->msgType = 0;
- pConn->status = ConnNormal;
- destroyConnRegArg(pConn);
- transUnrefSrvHandle(pConn);
- } else {
- // set up resp msg type
- pHead->msgType = (0 == pMsg->msgType ? pConn->inType + 1 : pMsg->msgType);
- }
- }
-
- pHead->release = smsg->type == Release ? 1 : 0;
+ pHead->msgType = (0 == pMsg->msgType ? pConn->inType + 1 : pMsg->msgType);
+ // pHead->msgType = pMsg->msgType;
+ // pHead->release = smsg->type == Release ? 1 : 0;
pHead->code = htonl(pMsg->code);
pHead->msgLen = htonl(pMsg->contLen + sizeof(STransMsgHead));
char* msg = (char*)pHead;
int32_t len = transMsgLenFromCont(pMsg->contLen);
- STrans* pTransInst = pConn->pTransInst;
- if (pMsg->info.compressed == 0 && pConn->clientIp != pConn->serverIp && pTransInst->compressSize != -1 &&
- pTransInst->compressSize < pMsg->contLen) {
+ STrans* pInst = pConn->pInst;
+ if (pMsg->info.compressed == 0 && pConn->clientIp != pConn->serverIp && pInst->compressSize != -1 &&
+ pInst->compressSize < pMsg->contLen) {
len = transCompressMsg(pMsg->pCont, pMsg->contLen) + sizeof(STransMsgHead);
pHead->msgLen = (int32_t)htonl((uint32_t)len);
}
STraceId* trace = &pMsg->info.traceId;
- tGDebug("%s conn %p %s is sent to %s, local info:%s, len:%d", transLabel(pTransInst), pConn,
- TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, len);
+ tGDebug("%s conn %p %s is sent to %s, local info:%s, len:%d, seqNum:%" PRId64 ", sid:%" PRId64 "", transLabel(pInst),
+ pConn, TMSG_INFO(pHead->msgType), pConn->dst, pConn->src, len, pMsg->info.seqNum, pMsg->info.qId);
wb->base = (char*)pHead;
wb->len = len;
return 0;
}
+static int32_t uvBuildToSendData(SSvrConn* pConn, uv_buf_t** ppBuf, int32_t* bufNum, queue* toSendQ) {
+ int32_t code = 0;
+ int32_t size = transQueueSize(&pConn->resps);
+ tDebug("%s conn %p has %d msg to send", transLabel(pConn->pInst), pConn, size);
+ if (size == 0) {
+ return 0;
+ }
-static FORCE_INLINE void uvStartSendRespImpl(SSvrMsg* smsg) {
+ if (pConn->bufSize < size) {
+ pConn->buf = taosMemoryRealloc(pConn->buf, size * sizeof(uv_buf_t));
+ if (pConn->buf == NULL) {
+ return terrno;
+ }
+ pConn->bufSize = size;
+ }
+ uv_buf_t* pWb = pConn->buf;
+
+ int32_t count = 0;
+
+ while (transQueueSize(&pConn->resps) > 0) {
+ queue* el = transQueuePop(&pConn->resps);
+ SSvrRespMsg* pMsg = QUEUE_DATA(el, SSvrRespMsg, q);
+ uv_buf_t wb;
+ code = uvPrepareSendData(pMsg, &wb);
+ if (code != 0) {
+ return code;
+ }
+ pWb[count] = wb;
+ pMsg->sent = 1;
+ QUEUE_PUSH(toSendQ, &pMsg->q);
+ count++;
+ }
+
+ if (count == 0) {
+ return 0;
+ }
+
+ *bufNum = count;
+ *ppBuf = pWb;
+
+ return 0;
+}
+
+static FORCE_INLINE void uvStartSendRespImpl(SSvrRespMsg* smsg) {
+ int32_t code = 0;
SSvrConn* pConn = smsg->pConn;
if (pConn->broken) {
return;
}
+ int32_t size = transQueueSize(&pConn->resps);
+ if (size == 0) {
+ tDebug("%s conn %p has %d msg to send", transLabel(pConn->pInst), pConn, size);
+ return;
+ }
- uv_buf_t wb;
- if (uvPrepareSendData(smsg, &wb) < 0) {
+ uv_write_t* req = allocWReqFromWQ(&pConn->wq, pConn);
+ if (req == NULL) {
+ uError("%s conn %p failed to alloc write req since %s", transLabel(pConn->pInst), pConn, tstrerror(terrno));
+ transUnrefSrvHandle(pConn);
+ return;
+ }
+ SWReqsWrapper* pWreq = req->data;
+
+ uv_buf_t* pBuf = NULL;
+ int32_t bufNum = 0;
+ code = uvBuildToSendData(pConn, &pBuf, &bufNum, &pWreq->node);
+ if (code != 0) {
+ tError("%s conn %p failed to send data", transLabel(pConn->pInst), pConn);
+ return;
+ }
+ if (bufNum == 0) {
+ tDebug("%s conn %p no data to send", transLabel(pConn->pInst), pConn);
return;
}
transRefSrvHandle(pConn);
- uv_write_t* req = transReqQueuePush(&pConn->wreqQueue);
- if (req == NULL) {
- tError("failed to send resp since %s", tstrerror(TSDB_CODE_OUT_OF_MEMORY));
- return;
+
+ int32_t ret = uv_write(req, (uv_stream_t*)pConn->pTcp, pBuf, bufNum, uvOnSendCb);
+ if (ret != 0) {
+ tError("conn %p failed to write data since %s", pConn, uv_err_name(ret));
+ pConn->broken = true;
+ while (!QUEUE_IS_EMPTY(&pWreq->node)) {
+ queue* head = QUEUE_HEAD(&pWreq->node);
+ QUEUE_REMOVE(head);
+ SSvrRespMsg* smsg = QUEUE_DATA(head, SSvrRespMsg, q);
+ destroySmsg(smsg);
+ }
+ freeWReqToWQ(&pConn->wq, req->data);
+
+ transUnrefSrvHandle(pConn);
}
- TAOS_UNUSED(uv_write(req, (uv_stream_t*)pConn->pTcp, &wb, 1, uvOnSendCb));
}
-static void uvStartSendResp(SSvrMsg* smsg) {
+int32_t uvMayHandleReleaseResp(SSvrRespMsg* pMsg) {
+ int32_t code = 0;
+ SSvrConn* pConn = pMsg->pConn;
+ int64_t qid = pMsg->msg.info.qId;
+ if (pMsg->msg.msgType == TDMT_SCH_TASK_RELEASE && qid > 0) {
+ SSvrRegArg* p = taosHashGet(pConn->pQTable, &qid, sizeof(qid));
+ if (p == NULL) {
+ tError("%s conn %p already release sid:%" PRId64 "", transLabel(pConn->pInst), pConn, qid);
+ return TSDB_CODE_RPC_NO_STATE;
+ } else {
+ transFreeMsg(p->msg.pCont);
+ code = taosHashRemove(pConn->pQTable, &qid, sizeof(qid));
+ if (code != 0) {
+ tError("%s conn %p failed to release sid:%" PRId64 " since %s", transLabel(pConn->pInst), pConn, qid,
+ tstrerror(code));
+ }
+ }
+ }
+ return 0;
+}
+static void uvStartSendResp(SSvrRespMsg* smsg) {
// impl
SSvrConn* pConn = smsg->pConn;
- if (pConn->broken == true) {
- // persist by
+ if (uvMayHandleReleaseResp(smsg) == TSDB_CODE_RPC_NO_STATE) {
destroySmsg(smsg);
- transUnrefSrvHandle(pConn);
return;
}
- if (pConn->status == ConnNormal) {
- transUnrefSrvHandle(pConn);
- }
- if (!transQueuePush(&pConn->srvMsgs, smsg)) {
- return;
- }
+ transQueuePush(&pConn->resps, &smsg->q);
uvStartSendRespImpl(smsg);
return;
}
-static FORCE_INLINE void destroySmsg(SSvrMsg* smsg) {
+static FORCE_INLINE void destroySmsg(SSvrRespMsg* smsg) {
if (smsg == NULL) {
return;
}
transFreeMsg(smsg->msg.pCont);
taosMemoryFree(smsg);
}
-static FORCE_INLINE void destroySmsgWrapper(void* smsg, void* param) { destroySmsg((SSvrMsg*)smsg); }
+static FORCE_INLINE void destroySmsgWrapper(void* smsg, void* param) { destroySmsg((SSvrRespMsg*)smsg); }
static void destroyAllConn(SWorkThrd* pThrd) {
tTrace("thread %p destroy all conn ", pThrd);
@@ -750,7 +919,7 @@ static void destroyAllConn(SWorkThrd* pThrd) {
QUEUE_INIT(h);
SSvrConn* c = QUEUE_DATA(h, SSvrConn, queue);
- while (T_REF_VAL_GET(c) >= 2) {
+ while (c->ref >= 2) {
transUnrefSrvHandle(c);
}
transUnrefSrvHandle(c);
@@ -777,7 +946,7 @@ void uvWorkerAsyncCb(uv_async_t* handle) {
queue* head = QUEUE_HEAD(&wq);
QUEUE_REMOVE(head);
- SSvrMsg* msg = QUEUE_DATA(head, SSvrMsg, q);
+ SSvrRespMsg* msg = QUEUE_DATA(head, SSvrRespMsg, q);
if (msg == NULL) {
tError("unexcept occurred, continue");
continue;
@@ -791,15 +960,17 @@ void uvWorkerAsyncCb(uv_async_t* handle) {
SExHandle* exh1 = transMsg.info.handle;
int64_t refId = transMsg.info.refId;
- SExHandle* exh2 = transAcquireExHandle(transGetSvrRefMgt(), refId);
+ msg->seqNum = transMsg.info.seqNum;
+
+ SExHandle* exh2 = transAcquireExHandle(uvGetConnRefOfThrd(pThrd), refId);
if (exh2 == NULL || exh1 != exh2) {
tTrace("handle except msg %p, ignore it", exh1);
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(uvGetConnRefOfThrd(pThrd), refId);
destroySmsg(msg);
continue;
}
msg->pConn = exh1->handle;
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(uvGetConnRefOfThrd(pThrd), refId);
(*transAsyncHandle[msg->type])(msg, pThrd);
}
}
@@ -827,47 +998,6 @@ static void uvShutDownCb(uv_shutdown_t* req, int status) {
uv_close((uv_handle_t*)req->handle, uvDestroyConn);
taosMemoryFree(req);
}
-static bool uvRecvReleaseReq(SSvrConn* pConn, STransMsgHead* pHead) {
- if ((pHead)->release == 1 && (pHead->msgLen) == sizeof(*pHead)) {
- int32_t code = reallocConnRef(pConn);
- if (code != 0) {
- destroyConn(pConn, true);
- return true;
- }
- tTrace("conn %p received release request", pConn);
-
- STraceId traceId = pHead->traceId;
- TAOS_UNUSED(transClearBuffer(&pConn->readBuf));
- transFreeMsg(transContFromHead((char*)pHead));
- if (pConn->status != ConnAcquire) {
- return true;
- }
- pConn->status = ConnRelease;
-
- STransMsg tmsg = {.code = 0, .info.handle = (void*)pConn, .info.traceId = traceId, .info.ahandle = (void*)0x9527};
- SSvrMsg* srvMsg = taosMemoryCalloc(1, sizeof(SSvrMsg));
- if (srvMsg == NULL) {
- tError("failed to alloc buf to send release resp since %s", tstrerror(terrno));
- return true;
- }
- srvMsg->msg = tmsg;
- srvMsg->type = Release;
- srvMsg->pConn = pConn;
- if (!transQueuePush(&pConn->srvMsgs, srvMsg)) {
- return true;
- }
- if (pConn->regArg.init) {
- tTrace("conn %p release, notify server app", pConn);
- STrans* pTransInst = pConn->pTransInst;
- (*pTransInst->cfp)(pTransInst->parent, &(pConn->regArg.msg), NULL);
- memset(&pConn->regArg, 0, sizeof(pConn->regArg));
- }
- uvStartSendRespImpl(srvMsg);
- return true;
- }
- return false;
-}
-
static void uvWorkDoTask(uv_work_t* req) {
// doing time-consumeing task
// only auth conn currently, add more func later
@@ -938,13 +1068,14 @@ void uvOnAcceptCb(uv_stream_t* stream, int status) {
}
}
void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
+ int32_t code = 0;
STUB_RAND_NETWORK_ERR(nread);
if (nread < 0) {
if (nread != UV_EOF) {
tError("read error %s", uv_err_name(nread));
}
// TODO(log other failure reason)
- tWarn("failed to create connect:%p, reason: %s", q, uv_err_name(nread));
+ tWarn("failed to create connect:%p since %s", q, uv_err_name(nread));
taosMemoryFree(buf->base);
uv_close((uv_handle_t*)q, NULL);
return;
@@ -962,33 +1093,22 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
uv_pipe_t* pipe = (uv_pipe_t*)q;
if (!uv_pipe_pending_count(pipe)) {
- tError("no pending count, unexpected error");
- uv_close((uv_handle_t*)q, NULL);
+ tError("No pending count");
+ // uv_close((uv_handle_t*)q, NULL);
return;
}
if (pThrd->quit) {
tWarn("thread already received quit msg, ignore incoming conn");
-
- uv_close((uv_handle_t*)q, NULL);
+ // uv_close((uv_handle_t*)q, NULL);
return;
}
SSvrConn* pConn = createConn(pThrd);
if (pConn == NULL) {
- uv_close((uv_handle_t*)q, NULL);
+ // uv_close((uv_handle_t*)q, NULL);
return;
}
- // pConn->pTransInst = pThrd->pTransInst;
- // /* init conn timer*/
- // // uv_timer_init(pThrd->loop, &pConn->pTimer);
- // // pConn->pTimer.data = pConn;
- // pConn->hostThrd = pThrd;
- // // init client handle
- // pConn->pTcp = (uv_tcp_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
- // uv_tcp_init(pThrd->loop, pConn->pTcp);
- // pConn->pTcp->data = pConn;
-
if (uv_accept(q, (uv_stream_t*)(pConn->pTcp)) == 0) {
uv_os_fd_t fd;
TAOS_UNUSED(uv_fileno((const uv_handle_t*)pConn->pTcp, &fd));
@@ -1018,8 +1138,16 @@ void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf) {
pConn->serverIp = saddr.sin_addr.s_addr;
pConn->port = ntohs(addr.sin_port);
- TAOS_UNUSED(uv_read_start((uv_stream_t*)(pConn->pTcp), uvAllocRecvBufferCb, uvOnRecvCb));
-
+ code = transSetConnOption((uv_tcp_t*)pConn->pTcp, 20);
+ if (code != 0) {
+ tWarn("failed to set tcp option since %s", tstrerror(code));
+ }
+ code = uv_read_start((uv_stream_t*)(pConn->pTcp), uvAllocRecvBufferCb, uvOnRecvCb);
+ if (code != 0) {
+ tWarn("conn %p failed to start to read since %s", pConn, uv_err_name(code));
+ transUnrefSrvHandle(pConn);
+ return;
+ }
} else {
tDebug("failed to create new connection");
transUnrefSrvHandle(pConn);
@@ -1142,91 +1270,114 @@ static int32_t addHandleToAcceptloop(void* arg) {
}
void* transWorkerThread(void* arg) {
+ int32_t code = 0;
setThreadName("trans-svr-work");
SWorkThrd* pThrd = (SWorkThrd*)arg;
- TAOS_UNUSED(uv_run(pThrd->loop, UV_RUN_DEFAULT));
+ tsEnableRandErr = true;
+ code = uv_run(pThrd->loop, UV_RUN_DEFAULT);
+ if (code != 0) {
+ tWarn("failed to start to worker thread since %s", uv_err_name(code));
+ }
return NULL;
}
-
+void uvDestroyResp(void* e) {
+ SSvrRespMsg* pMsg = QUEUE_DATA(e, SSvrRespMsg, q);
+ destroySmsg(pMsg);
+}
static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
int32_t code = 0;
SWorkThrd* pThrd = hThrd;
+ int32_t lino;
SSvrConn* pConn = (SSvrConn*)taosMemoryCalloc(1, sizeof(SSvrConn));
if (pConn == NULL) {
- TAOS_CHECK_GOTO(terrno, NULL, _end);
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _end);
}
- transReqQueueInit(&pConn->wreqQueue);
QUEUE_INIT(&pConn->queue);
- QUEUE_PUSH(&pThrd->conn, &pConn->queue);
- if ((code = transQueueInit(&pConn->srvMsgs, NULL)) != 0) {
- TAOS_CHECK_GOTO(code, NULL, _end);
+ if ((code = transQueueInit(&pConn->resps, uvDestroyResp)) != 0) {
+ TAOS_CHECK_GOTO(code, &lino, _end);
}
if ((code = transInitBuffer(&pConn->readBuf)) != 0) {
- TAOS_CHECK_GOTO(code, NULL, _end);
+ TAOS_CHECK_GOTO(code, &lino, _end);
}
- memset(&pConn->regArg, 0, sizeof(pConn->regArg));
pConn->broken = false;
pConn->status = ConnNormal;
SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle));
if (exh == NULL) {
- TAOS_CHECK_GOTO(terrno, NULL, _end);
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _end);
}
exh->handle = pConn;
exh->pThrd = pThrd;
- exh->refId = transAddExHandle(transGetSvrRefMgt(), exh);
+ exh->refId = transAddExHandle(uvGetConnRefOfThrd(pThrd), exh);
if (exh->refId < 0) {
- TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _end);
+ TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, &lino, _end);
}
QUEUE_INIT(&exh->q);
- SExHandle* pSelf = transAcquireExHandle(transGetSvrRefMgt(), exh->refId);
+ SExHandle* pSelf = transAcquireExHandle(uvGetConnRefOfThrd(pThrd), exh->refId);
if (pSelf != exh) {
TAOS_CHECK_GOTO(TSDB_CODE_REF_INVALID_ID, NULL, _end);
}
- STrans* pTransInst = pThrd->pTransInst;
+ STrans* pInst = pThrd->pInst;
pConn->refId = exh->refId;
- QUEUE_INIT(&exh->q);
- transRefSrvHandle(pConn);
- tTrace("%s handle %p, conn %p created, refId:%" PRId64, transLabel(pTransInst), exh, pConn, pConn->refId);
- pConn->pTransInst = pThrd->pTransInst;
- /* init conn timer*/
- // uv_timer_init(pThrd->loop, &pConn->pTimer);
- // pConn->pTimer.data = pConn;
- pConn->hostThrd = pThrd;
+ QUEUE_INIT(&exh->q);
+ tTrace("%s handle %p, conn %p created, refId:%" PRId64, transLabel(pInst), exh, pConn, pConn->refId);
+
+ pConn->pQTable = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_NO_LOCK);
+ if (pConn->pQTable == NULL) {
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _end);
+ }
+
+ code = initWQ(&pConn->wq);
+ TAOS_CHECK_GOTO(code, &lino, _end);
+
// init client handle
pConn->pTcp = (uv_tcp_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
if (pConn->pTcp == NULL) {
- TAOS_CHECK_GOTO(terrno, NULL, _end);
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _end);
+ }
+
+ pConn->bufSize = pInst->shareConnLimit;
+ pConn->buf = taosMemoryCalloc(1, pInst->shareConnLimit * sizeof(uv_buf_t));
+ if (pConn->buf == NULL) {
+ TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _end);
}
code = uv_tcp_init(pThrd->loop, pConn->pTcp);
if (code != 0) {
- tError("%s failed to create conn since %s" PRId64, transLabel(pTransInst), uv_strerror(code));
+ tError("%s failed to create conn since %s" PRId64, transLabel(pInst), uv_strerror(code));
TAOS_CHECK_GOTO(TSDB_CODE_THIRDPARTY_ERROR, NULL, _end);
}
pConn->pTcp->data = pConn;
+ QUEUE_PUSH(&pThrd->conn, &pConn->queue);
+ pConn->pInst = pThrd->pInst;
+ pConn->hostThrd = pThrd;
+
+ transRefSrvHandle(pConn);
return pConn;
_end:
if (pConn) {
- transQueueDestroy(&pConn->srvMsgs);
- TAOS_UNUSED(transDestroyBuffer(&pConn->readBuf));
+ transQueueDestroy(&pConn->resps);
+ transDestroyBuffer(&pConn->readBuf);
+ taosHashCleanup(pConn->pQTable);
taosMemoryFree(pConn->pTcp);
+ destroyWQ(&pConn->wq);
+ taosMemoryFree(pConn->buf);
taosMemoryFree(pConn);
pConn = NULL;
}
- tError("%s failed to create conn since %s" PRId64, transLabel(pTransInst), tstrerror(code));
+ tError("%s failed to create conn since %s" PRId64, transLabel(pInst), tstrerror(code));
return NULL;
}
@@ -1242,42 +1393,24 @@ static FORCE_INLINE void destroyConn(SSvrConn* conn, bool clear) {
}
}
}
-static FORCE_INLINE void destroyConnRegArg(SSvrConn* conn) {
- if (conn->regArg.init == 1) {
- transFreeMsg(conn->regArg.msg.pCont);
- conn->regArg.init = 0;
- }
-}
-static int32_t reallocConnRef(SSvrConn* conn) {
- if (conn->refId > 0) {
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), conn->refId));
- TAOS_UNUSED(transRemoveExHandle(transGetSvrRefMgt(), conn->refId));
- }
- // avoid app continue to send msg on invalid handle
- SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle));
- if (exh == NULL) {
- return terrno;
+
+void uvConnDestroyAllState(SSvrConn* p) {
+ STrans* pInst = p->pInst;
+ SHashObj* pQTable = p->pQTable;
+ if (pQTable == NULL) return;
+
+ void* pIter = taosHashIterate(pQTable, NULL);
+ while (pIter) {
+ SSvrRegArg* arg = pIter;
+ int64_t* qid = taosHashGetKey(pIter, NULL);
+ (pInst->cfp)(pInst->parent, &(arg->msg), NULL);
+ tTrace("conn %p broken, notify server app, sid:%" PRId64 "", p, *qid);
+ pIter = taosHashIterate(pQTable, pIter);
}
- exh->handle = conn;
- exh->pThrd = conn->hostThrd;
- exh->refId = transAddExHandle(transGetSvrRefMgt(), exh);
- if (exh->refId < 0) {
- taosMemoryFree(exh);
- return TSDB_CODE_REF_INVALID_ID;
- }
-
- QUEUE_INIT(&exh->q);
- SExHandle* pSelf = transAcquireExHandle(transGetSvrRefMgt(), exh->refId);
- if (pSelf != exh) {
- tError("conn %p failed to acquire handle", conn);
- taosMemoryFree(exh);
- return TSDB_CODE_REF_INVALID_ID;
- }
-
- conn->refId = exh->refId;
-
- return 0;
+ taosHashCleanup(pQTable);
+ pQTable = NULL;
+ return;
}
static void uvDestroyConn(uv_handle_t* handle) {
SSvrConn* conn = handle->data;
@@ -1287,23 +1420,24 @@ static void uvDestroyConn(uv_handle_t* handle) {
}
SWorkThrd* thrd = conn->hostThrd;
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), conn->refId));
- TAOS_UNUSED(transRemoveExHandle(transGetSvrRefMgt(), conn->refId));
+ transReleaseExHandle(uvGetConnRefOfThrd(thrd), conn->refId);
+ transRemoveExHandle(uvGetConnRefOfThrd(thrd), conn->refId);
- STrans* pTransInst = thrd->pTransInst;
- tDebug("%s conn %p destroy", transLabel(pTransInst), conn);
+ STrans* pInst = thrd->pInst;
+ tDebug("%s conn %p destroy", transLabel(pInst), conn);
- for (int i = 0; i < transQueueSize(&conn->srvMsgs); i++) {
- SSvrMsg* msg = transQueueGet(&conn->srvMsgs, i);
- destroySmsg(msg);
- }
- transQueueDestroy(&conn->srvMsgs);
- transReqQueueClear(&conn->wreqQueue);
+ transQueueDestroy(&conn->resps);
QUEUE_REMOVE(&conn->queue);
+
taosMemoryFree(conn->pTcp);
- destroyConnRegArg(conn);
- TAOS_UNUSED(transDestroyBuffer(&conn->readBuf));
+
+ uvConnDestroyAllState(conn);
+
+ transDestroyBuffer(&conn->readBuf);
+
+ destroyWQ(&conn->wq);
+ taosMemoryFree(conn->buf);
taosMemoryFree(conn);
if (thrd->quit && QUEUE_IS_EMPTY(&thrd->conn)) {
@@ -1350,7 +1484,7 @@ static void uvPipeListenCb(uv_stream_t* handle, int status) {
srv->numOfWorkerReady++;
}
-void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* shandle) {
+void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads, void* fp, void* pInit) {
int32_t code = 0;
SServerObj* srv = taosMemoryCalloc(1, sizeof(SServerObj));
@@ -1382,7 +1516,7 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
if (false == taosValidIpAndPort(srv->ip, srv->port)) {
code = TAOS_SYSTEM_ERROR(errno);
- tError("invalid ip/port, %d:%d, reason:%s", srv->ip, srv->port, terrstr());
+ tError("invalid ip/port, %d:%d since %s", srv->ip, srv->port, terrstr());
goto End;
}
char pipeName[PATH_MAX];
@@ -1414,19 +1548,20 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
for (int i = 0; i < srv->numOfThreads; i++) {
SWorkThrd* thrd = (SWorkThrd*)taosMemoryCalloc(1, sizeof(SWorkThrd));
- if (thrd == NULL) {
- code = terrno;
- goto End;
- }
- thrd->pTransInst = shandle;
+ thrd->pInst = pInit;
thrd->quit = false;
- thrd->pTransInst = shandle;
+ thrd->pInst = pInit;
thrd->pWhiteList = uvWhiteListCreate();
if (thrd->pWhiteList == NULL) {
destroyWorkThrdObj(thrd);
code = terrno;
goto End;
}
+ thrd->connRefMgt = transOpenRefMgt(50000, transDestroyExHandle);
+ if (thrd->connRefMgt < 0) {
+ code = thrd->connRefMgt;
+ goto End;
+ }
srv->pipe[i] = (uv_pipe_t*)taosMemoryCalloc(2, sizeof(uv_pipe_t));
if (srv->pipe[i] == NULL) {
@@ -1460,11 +1595,10 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
code = terrno;
goto End;
}
- srv->pThreadObj[i] = thrd;
- thrd->pTransInst = shandle;
+ thrd->pInst = pInit;
thrd->quit = false;
- thrd->pTransInst = shandle;
+ thrd->pInst = pInit;
thrd->pWhiteList = uvWhiteListCreate();
if (thrd->pWhiteList == NULL) {
destroyWorkThrdObj(thrd);
@@ -1472,6 +1606,12 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
goto End;
}
+ thrd->connRefMgt = transOpenRefMgt(50000, transDestroyExHandle);
+ if (thrd->connRefMgt < 0) {
+ code = thrd->connRefMgt;
+ goto End;
+ }
+
srv->pipe[i] = (uv_pipe_t*)taosMemoryCalloc(2, sizeof(uv_pipe_t));
if (srv->pipe[i] == NULL) {
code = terrno;
@@ -1501,7 +1641,9 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
thrd->pipe = &(srv->pipe[i][1]); // init read
thrd->fd = fds[0];
+ srv->pThreadObj[i] = thrd;
+ thrd->inited = 1;
if ((code = addHandleToWorkloop(thrd, pipeName)) != 0) {
goto End;
}
@@ -1514,7 +1656,6 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
tError("failed to create worker-thread:%d", i);
goto End;
}
- thrd->inited = 1;
}
#endif
@@ -1547,7 +1688,7 @@ End:
return NULL;
}
-void uvHandleQuit(SSvrMsg* msg, SWorkThrd* thrd) {
+void uvHandleQuit(SSvrRespMsg* msg, SWorkThrd* thrd) {
thrd->quit = true;
if (QUEUE_IS_EMPTY(&thrd->conn)) {
uv_walk(thrd->loop, uvWalkCb, NULL);
@@ -1556,57 +1697,38 @@ void uvHandleQuit(SSvrMsg* msg, SWorkThrd* thrd) {
}
taosMemoryFree(msg);
}
-void uvHandleRelease(SSvrMsg* msg, SWorkThrd* thrd) {
- int32_t code = 0;
- SSvrConn* conn = msg->pConn;
- if (conn->status == ConnAcquire) {
- code = reallocConnRef(conn);
- if (code != 0) {
- destroyConn(conn, true);
- return;
- }
- if (!transQueuePush(&conn->srvMsgs, msg)) {
- return;
- }
- uvStartSendRespImpl(msg);
- return;
- } else if (conn->status == ConnRelease || conn->status == ConnNormal) {
- tDebug("%s conn %p already released, ignore release-msg", transLabel(thrd->pTransInst), conn);
- }
- destroySmsg(msg);
-}
-void uvHandleResp(SSvrMsg* msg, SWorkThrd* thrd) {
+void uvHandleRelease(SSvrRespMsg* msg, SWorkThrd* thrd) { return; }
+
+void uvHandleResp(SSvrRespMsg* msg, SWorkThrd* thrd) {
// send msg to client
- tDebug("%s conn %p start to send resp (2/2)", transLabel(thrd->pTransInst), msg->pConn);
+ tDebug("%s conn %p start to send resp (2/2)", transLabel(thrd->pInst), msg->pConn);
uvStartSendResp(msg);
}
-void uvHandleRegister(SSvrMsg* msg, SWorkThrd* thrd) {
+
+int32_t uvHandleStateReq(SSvrRespMsg* msg) {
+ int32_t code = 0;
SSvrConn* conn = msg->pConn;
- tDebug("%s conn %p register brokenlink callback", transLabel(thrd->pTransInst), conn);
- if (conn->status == ConnAcquire) {
- if (!transQueuePush(&conn->srvMsgs, msg)) {
- return;
- }
- TAOS_UNUSED(transQueuePop(&conn->srvMsgs));
+ int64_t qid = msg->msg.info.qId;
+ tDebug("%s conn %p start to register brokenlink callback, sid:%" PRId64 "", transLabel(conn->pInst), conn, qid);
- if (conn->regArg.init) {
- transFreeMsg(conn->regArg.msg.pCont);
- conn->regArg.init = 0;
- }
- conn->regArg.notifyCount = 0;
- conn->regArg.init = 1;
- conn->regArg.msg = msg->msg;
- tDebug("conn %p register brokenlink callback succ", conn);
-
- if (conn->broken) {
- STrans* pTransInst = conn->pTransInst;
- (*pTransInst->cfp)(pTransInst->parent, &(conn->regArg.msg), NULL);
- memset(&conn->regArg, 0, sizeof(conn->regArg));
- }
- taosMemoryFree(msg);
+ SSvrRegArg arg = {.notifyCount = 0, .init = 1, .msg = msg->msg};
+ SSvrRegArg* p = taosHashGet(conn->pQTable, &qid, sizeof(qid));
+ if (p != NULL) {
+ transFreeMsg(p->msg.pCont);
}
+
+ code = taosHashPut(conn->pQTable, &qid, sizeof(qid), &arg, sizeof(arg));
+ if (code == 0) tDebug("conn %p register brokenlink callback succ", conn);
+ return code;
}
-void uvHandleUpdate(SSvrMsg* msg, SWorkThrd* thrd) {
+void uvHandleRegister(SSvrRespMsg* msg, SWorkThrd* thrd) {
+ SSvrConn* conn = msg->pConn;
+ tDebug("%s conn %p register brokenlink callback", transLabel(thrd->pInst), conn);
+ int32_t code = uvHandleStateReq(msg);
+ taosMemoryFree(msg);
+}
+
+void uvHandleUpdate(SSvrRespMsg* msg, SWorkThrd* thrd) {
SUpdateIpWhite* req = msg->arg;
if (req == NULL) {
tDebug("ip-white-list disable on trans");
@@ -1651,6 +1773,7 @@ void destroyWorkThrdObj(SWorkThrd* pThrd) {
}
transAsyncPoolDestroy(pThrd->asyncPool);
uvWhiteListDestroy(pThrd->pWhiteList);
+ taosCloseRef(pThrd->connRefMgt);
taosMemoryFree(pThrd->loop);
taosMemoryFree(pThrd);
}
@@ -1665,12 +1788,12 @@ void destroyWorkThrd(SWorkThrd* pThrd) {
}
SRV_RELEASE_UV(pThrd->loop);
- TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SSvrMsg, destroySmsgWrapper, NULL);
+ TRANS_DESTROY_ASYNC_POOL_MSG(pThrd->asyncPool, SSvrRespMsg, destroySmsgWrapper, NULL);
}
destroyWorkThrdObj(pThrd);
}
void sendQuitToWorkThrd(SWorkThrd* pThrd) {
- SSvrMsg* msg = taosMemoryCalloc(1, sizeof(SSvrMsg));
+ SSvrRespMsg* msg = taosMemoryCalloc(1, sizeof(SSvrRespMsg));
if (msg == NULL) {
tError("failed to send quit msg to work thread since %s", tstrerror(terrno));
return;
@@ -1717,17 +1840,19 @@ void transRefSrvHandle(void* handle) {
if (handle == NULL) {
return;
}
- int ref = T_REF_INC((SSvrConn*)handle);
- tTrace("conn %p ref count:%d", handle, ref);
+ SSvrConn* pConn = handle;
+ pConn->ref++;
+ tTrace("conn %p ref count:%d", pConn, pConn->ref);
}
void transUnrefSrvHandle(void* handle) {
if (handle == NULL) {
return;
}
- int ref = T_REF_DEC((SSvrConn*)handle);
- tTrace("conn %p ref count:%d", handle, ref);
- if (ref == 0) {
+ SSvrConn* pConn = handle;
+ pConn->ref--;
+ tTrace("conn %p ref count:%d", pConn, pConn->ref);
+ if (pConn->ref == 0) {
destroyConn((SSvrConn*)handle, true);
}
}
@@ -1736,36 +1861,44 @@ int32_t transReleaseSrvHandle(void* handle) {
int32_t code = 0;
SRpcHandleInfo* info = handle;
SExHandle* exh = info->handle;
+ int64_t qId = info->qId;
int64_t refId = info->refId;
- ASYNC_CHECK_HANDLE(exh, refId);
+ ASYNC_CHECK_HANDLE(info->refIdMgt, refId, exh);
SWorkThrd* pThrd = exh->pThrd;
ASYNC_ERR_JRET(pThrd);
- STransMsg tmsg = {.code = 0, .info.handle = exh, .info.ahandle = NULL, .info.refId = refId};
+ STransMsg tmsg = {.msgType = TDMT_SCH_TASK_RELEASE,
+ .code = 0,
+ .info.handle = exh,
+ .info.ahandle = NULL,
+ .info.refId = refId,
+ .info.qId = qId,
+ .info.traceId = info->traceId};
- SSvrMsg* m = taosMemoryCalloc(1, sizeof(SSvrMsg));
+ SSvrRespMsg* m = taosMemoryCalloc(1, sizeof(SSvrRespMsg));
if (m == NULL) {
code = terrno;
goto _return1;
}
m->msg = tmsg;
- m->type = Release;
+ m->type = Normal;
- tDebug("%s conn %p start to release", transLabel(pThrd->pTransInst), exh->handle);
+ tDebug("%s conn %p start to send %s, sid:%" PRId64 "", transLabel(pThrd->pInst), exh->handle, TMSG_INFO(tmsg.msgType),
+ qId);
if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) {
destroySmsg(m);
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(info->refIdMgt, refId);
return code;
}
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(info->refIdMgt, refId);
return 0;
_return1:
tDebug("handle %p failed to send to release handle", exh);
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(info->refIdMgt, refId);
return code;
_return2:
tDebug("handle %p failed to send to release handle", exh);
@@ -1787,38 +1920,41 @@ int32_t transSendResponse(const STransMsg* msg) {
return 0;
}
int64_t refId = msg->info.refId;
- ASYNC_CHECK_HANDLE(exh, refId);
+ ASYNC_CHECK_HANDLE(msg->info.refIdMgt, refId, exh);
STransMsg tmsg = *msg;
tmsg.info.refId = refId;
+ if (tmsg.info.qId == 0) {
+ tmsg.msgType = msg->info.msgType + 1;
+ }
SWorkThrd* pThrd = exh->pThrd;
ASYNC_ERR_JRET(pThrd);
- SSvrMsg* m = taosMemoryCalloc(1, sizeof(SSvrMsg));
+ SSvrRespMsg* m = taosMemoryCalloc(1, sizeof(SSvrRespMsg));
if (m == NULL) {
code = terrno;
goto _return1;
}
-
m->msg = tmsg;
+
m->type = Normal;
STraceId* trace = (STraceId*)&msg->info.traceId;
tGDebug("conn %p start to send resp (1/2)", exh->handle);
if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) {
destroySmsg(m);
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(msg->info.refIdMgt, refId);
return code;
}
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(msg->info.refIdMgt, refId);
return 0;
_return1:
tDebug("handle %p failed to send resp", exh);
rpcFreeCont(msg->pCont);
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(msg->info.refIdMgt, refId);
return code;
_return2:
tDebug("handle %p failed to send resp", exh);
@@ -1830,17 +1966,20 @@ int32_t transRegisterMsg(const STransMsg* msg) {
SExHandle* exh = msg->info.handle;
int64_t refId = msg->info.refId;
- ASYNC_CHECK_HANDLE(exh, refId);
+ ASYNC_CHECK_HANDLE(msg->info.refIdMgt, refId, exh);
STransMsg tmsg = *msg;
tmsg.info.noResp = 1;
+ tmsg.info.qId = msg->info.qId;
+ tmsg.info.seqNum = msg->info.seqNum;
tmsg.info.refId = refId;
+ tmsg.info.refIdMgt = msg->info.refIdMgt;
SWorkThrd* pThrd = exh->pThrd;
ASYNC_ERR_JRET(pThrd);
- SSvrMsg* m = taosMemoryCalloc(1, sizeof(SSvrMsg));
+ SSvrRespMsg* m = taosMemoryCalloc(1, sizeof(SSvrRespMsg));
if (m == NULL) {
code = terrno;
goto _return1;
@@ -1849,21 +1988,21 @@ int32_t transRegisterMsg(const STransMsg* msg) {
m->msg = tmsg;
m->type = Register;
- STrans* pTransInst = pThrd->pTransInst;
- tDebug("%s conn %p start to register brokenlink callback", transLabel(pTransInst), exh->handle);
+ STrans* pInst = pThrd->pInst;
+ tDebug("%s conn %p start to register brokenlink callback", transLabel(pInst), exh->handle);
if ((code = transAsyncSend(pThrd->asyncPool, &m->q)) != 0) {
destroySmsg(m);
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(msg->info.refIdMgt, refId);
return code;
}
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(msg->info.refIdMgt, refId);
return 0;
_return1:
tDebug("handle %p failed to register brokenlink", exh);
rpcFreeCont(msg->pCont);
- TAOS_UNUSED(transReleaseExHandle(transGetSvrRefMgt(), refId));
+ transReleaseExHandle(msg->info.refIdMgt, refId);
return code;
_return2:
tDebug("handle %p failed to register brokenlink", exh);
@@ -1872,19 +2011,19 @@ _return2:
}
int32_t transSetIpWhiteList(void* thandle, void* arg, FilteFunc* func) {
- STrans* pTransInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)thandle);
- if (pTransInst == NULL) {
+ STrans* pInst = (STrans*)transAcquireExHandle(transGetInstMgt(), (int64_t)thandle);
+ if (pInst == NULL) {
return TSDB_CODE_RPC_MODULE_QUIT;
}
int32_t code = 0;
tDebug("ip-white-list update on rpc");
- SServerObj* svrObj = pTransInst->tcphandle;
+ SServerObj* svrObj = pInst->tcphandle;
for (int i = 0; i < svrObj->numOfThreads; i++) {
SWorkThrd* pThrd = svrObj->pThreadObj[i];
- SSvrMsg* msg = taosMemoryCalloc(1, sizeof(SSvrMsg));
+ SSvrRespMsg* msg = taosMemoryCalloc(1, sizeof(SSvrRespMsg));
if (msg == NULL) {
code = terrno;
break;
@@ -1908,12 +2047,10 @@ int32_t transSetIpWhiteList(void* thandle, void* arg, FilteFunc* func) {
break;
}
}
- TAOS_UNUSED(transReleaseExHandle(transGetInstMgt(), (int64_t)thandle));
+ transReleaseExHandle(transGetInstMgt(), (int64_t)thandle);
if (code != 0) {
tError("ip-white-list update failed since %s", tstrerror(code));
}
return code;
}
-
-int32_t transGetConnInfo(void* thandle, STransHandleInfo* pConnInfo) { return -1; }
diff --git a/source/libs/transport/test/cliBench.c b/source/libs/transport/test/cliBench.c
index 134c911401..e73c209d55 100644
--- a/source/libs/transport/test/cliBench.c
+++ b/source/libs/transport/test/cliBench.c
@@ -117,7 +117,7 @@ int main(int argc, char *argv[]) {
rpcInit.connType = TAOS_CONN_CLIENT;
rpcInit.connLimitNum = 10;
rpcInit.connLimitLock = 1;
- rpcInit.batchSize = 16 * 1024;
+ rpcInit.shareConnLimit = 16 * 1024;
rpcInit.supportBatch = 1;
rpcDebugFlag = 135;
diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c
index 46cca99e5f..2f18c6e697 100644
--- a/source/os/src/osFile.c
+++ b/source/os/src/osFile.c
@@ -395,10 +395,11 @@ HANDLE taosOpenFileNotStream(const char *path, int32_t tdFileOptions) {
SetFilePointer(h, 0, NULL, FILE_END);
}
if (h == INVALID_HANDLE_VALUE) {
- DWORD dwError = GetLastError();
+ DWORD dwError = GetLastError();
terrno = TAOS_SYSTEM_WINAPI_ERROR(dwError);
// LPVOID lpMsgBuf;
- // FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, (LPTSTR)&lpMsgBuf, 0,
+ // FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwError, 0, (LPTSTR)&lpMsgBuf,
+ // 0,
// NULL);
// printf("CreateFile failed with error %d: %s", dwError, (char *)lpMsgBuf);
// LocalFree(lpMsgBuf);
@@ -915,7 +916,7 @@ int32_t taosFStatFile(TdFilePtr pFile, int64_t *size, int32_t *mtime) {
}
struct stat fileStat;
- int32_t code = fstat(pFile->fd, &fileStat);
+ int32_t code = fstat(pFile->fd, &fileStat);
if (-1 == code) {
terrno = TAOS_SYSTEM_ERROR(errno);
return terrno;
@@ -983,7 +984,7 @@ int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, in
}
#ifdef _TD_DARWIN_64
- if(lseek(pFileIn->fd, (int32_t)(*offset), 0) < 0) {
+ if (lseek(pFileIn->fd, (int32_t)(*offset), 0) < 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
return -1;
}
@@ -1015,7 +1016,7 @@ int64_t taosFSendFile(TdFilePtr pFileOut, TdFilePtr pFileIn, int64_t *offset, in
}
return writeLen;
-#else // for linux
+#else // for linux
int64_t leftbytes = size;
int64_t sentbytes;
@@ -1126,7 +1127,7 @@ int32_t taosCloseFile(TdFilePtr *ppFile) {
if ((*ppFile)->hFile != NULL) {
// FlushFileBuffers((*ppFile)->hFile);
if (!CloseHandle((*ppFile)->hFile)) {
- terrno = TAOS_SYSTEM_WINAPI_ERROR(GetLastError());
+ terrno = TAOS_SYSTEM_WINAPI_ERROR(GetLastError());
code = -1;
}
(*ppFile)->hFile = NULL;
@@ -1469,7 +1470,7 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName) {
while (!feof(pSrcFile->fp)) {
len = (int32_t)fread(data, 1, compressSize, pSrcFile->fp);
if (len > 0) {
- if(gzwrite(dstFp, data, len) == 0) {
+ if (gzwrite(dstFp, data, len) == 0) {
terrno = TAOS_SYSTEM_ERROR(errno);
ret = terrno;
goto cmp_end;
@@ -1564,4 +1565,4 @@ int taosSetAutoDelFile(char *path) {
}
return 0;
#endif
-}
+}
\ No newline at end of file
diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c
index c084b76485..f4aa966d2b 100644
--- a/source/os/src/osMemory.c
+++ b/source/os/src/osMemory.c
@@ -308,6 +308,7 @@ void *taosMemoryCalloc(int64_t num, int64_t size) {
uint32_t r = taosRand() % tsRandErrDivisor;
if ((r + 1) <= tsRandErrChance) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
+ uError("random memory error: %s, %s", tstrerror(terrno), __func__);
return NULL;
}
}
diff --git a/source/os/src/osSemaphore.c b/source/os/src/osSemaphore.c
index cc3a13a818..538d5bf63e 100644
--- a/source/os/src/osSemaphore.c
+++ b/source/os/src/osSemaphore.c
@@ -74,7 +74,7 @@ int32_t taosGetAppName(char* name, int32_t* len) {
int32_t tsem_wait(tsem_t* sem) {
DWORD ret = WaitForSingleObject(*sem, INFINITE);
- if(ret == WAIT_OBJECT_0) {
+ if (ret == WAIT_OBJECT_0) {
return 0;
} else {
return TAOS_SYSTEM_WINAPI_ERROR(GetLastError());
@@ -140,7 +140,7 @@ int32_t tsem_wait(tsem_t *psem) {
int32_t tsem_timewait(tsem_t *psem, int64_t milis) {
if (psem == NULL || *psem == NULL) return -1;
dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(milis * USEC_PER_SEC));
- if(dispatch_semaphore_wait(*psem, time) == 0) {
+ if (dispatch_semaphore_wait(*psem, time) == 0) {
return 0;
} else {
return TSDB_CODE_TIMEOUT_ERROR;
@@ -218,7 +218,7 @@ int32_t taosGetAppName(char* name, int32_t* len) {
} else {
++end;
}
-
+
tstrncpy(name, end, TSDB_APP_NAME_LEN);
if (len != NULL) {
@@ -228,8 +228,8 @@ int32_t taosGetAppName(char* name, int32_t* len) {
return 0;
}
-int32_t tsem_init(tsem_t *psem, int flags, unsigned int count) {
- if(sem_init(psem, flags, count) == 0) {
+int32_t tsem_init(tsem_t* psem, int flags, unsigned int count) {
+ if (sem_init(psem, flags, count) == 0) {
return 0;
} else {
return terrno = TAOS_SYSTEM_ERROR(errno);
@@ -251,9 +251,9 @@ int32_t tsem_timewait(tsem_t* sem, int64_t ms) {
ts.tv_nsec %= 1000000000;
while ((ret = sem_timedwait(sem, &ts)) == -1) {
- if(errno == EINTR) {
+ if (errno == EINTR) {
continue;
- } else if(errno == ETIMEDOUT) {
+ } else if (errno == ETIMEDOUT) {
return TSDB_CODE_TIMEOUT_ERROR;
} else {
terrno = TAOS_SYSTEM_ERROR(errno);
@@ -274,27 +274,27 @@ int32_t tsem_wait(tsem_t* sem) {
terrno = TAOS_SYSTEM_ERROR(errno);
return terrno;
}
-
+
return ret;
}
int tsem2_init(tsem2_t* sem, int pshared, unsigned int value) {
int ret = taosThreadMutexInit(&sem->mutex, NULL);
if (ret != 0) return ret;
-
+
ret = taosThreadCondAttrInit(&sem->attr);
if (ret != 0) {
(void)taosThreadMutexDestroy(&sem->mutex);
return ret;
}
-
+
ret = taosThreadCondAttrSetclock(&sem->attr, CLOCK_MONOTONIC);
if (ret != 0) {
(void)taosThreadMutexDestroy(&sem->mutex);
(void)taosThreadCondAttrDestroy(&sem->attr);
return ret;
}
-
+
ret = taosThreadCondInit(&sem->cond, &sem->attr);
if (ret != 0) {
(void)taosThreadMutexDestroy(&sem->mutex);
@@ -303,7 +303,7 @@ int tsem2_init(tsem2_t* sem, int pshared, unsigned int value) {
}
sem->count = value;
-
+
return 0;
}
@@ -315,7 +315,7 @@ int32_t tsem_post(tsem_t* psem) {
}
}
-int32_t tsem_destroy(tsem_t *sem) {
+int32_t tsem_destroy(tsem_t* sem) {
if (sem_destroy(sem) == 0) {
return 0;
} else {
@@ -323,7 +323,7 @@ int32_t tsem_destroy(tsem_t *sem) {
}
}
-int tsem2_post(tsem2_t *sem) {
+int tsem2_post(tsem2_t* sem) {
int32_t code = taosThreadMutexLock(&sem->mutex);
if (code) {
return code;
@@ -347,7 +347,7 @@ int tsem2_destroy(tsem2_t* sem) {
(void)taosThreadMutexDestroy(&sem->mutex);
(void)taosThreadCondDestroy(&sem->cond);
(void)taosThreadCondAttrDestroy(&sem->attr);
-
+
return 0;
}
@@ -367,7 +367,7 @@ int32_t tsem2_wait(tsem2_t* sem) {
}
}
sem->count--;
-
+
code = taosThreadMutexUnlock(&sem->mutex);
if (code) {
return code;
@@ -383,7 +383,7 @@ int32_t tsem2_timewait(tsem2_t* sem, int64_t ms) {
if (code) {
return code;
}
-
+
if (sem->count <= 0) {
struct timespec ts = {0};
if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) {
diff --git a/source/os/src/osSocket.c b/source/os/src/osSocket.c
index d17cc9b239..5f983d5480 100644
--- a/source/os/src/osSocket.c
+++ b/source/os/src/osSocket.c
@@ -482,3 +482,18 @@ uint64_t taosNtoh64(uint64_t val) {
}
#endif
}
+
+int32_t taosSetSockOpt2(int32_t fd) {
+#if defined(WINDOWS) || defined(DARWIN)
+ return 0;
+#else
+ int32_t ret = setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, (int[]){1}, sizeof(int));
+ if (ret < 0) {
+ terrno = TAOS_SYSTEM_ERROR(errno);
+ return terrno;
+ } else {
+ return 0;
+ }
+#endif
+ return 0;
+}
diff --git a/source/os/src/osTimezone.c b/source/os/src/osTimezone.c
index 5eded97cde..89c7ce9e31 100644
--- a/source/os/src/osTimezone.c
+++ b/source/os/src/osTimezone.c
@@ -805,7 +805,7 @@ int32_t taosSetSystemTimezone(const char *inTimezoneStr, char *outTimezoneStr, i
char *ppp = strchr(inTimezoneStr, ',');
int indexStr;
if (pp == NULL || ppp == NULL) {
- indexStr = snprintf(winStr, sizeof(winStr), "TZ=UTC");
+ indexStr = tsnprintf(winStr, sizeof(winStr), "TZ=UTC");
} else {
memcpy(winStr, "TZ=", 3);
pp++;
diff --git a/source/util/CMakeLists.txt b/source/util/CMakeLists.txt
index f907746821..4972e9f50b 100644
--- a/source/util/CMakeLists.txt
+++ b/source/util/CMakeLists.txt
@@ -12,6 +12,10 @@ ELSE ()
MESSAGE(STATUS "enable assert core")
ENDIF (${ASSERT_NOT_CORE})
+if(${BUILD_WITH_ANALYSIS})
+ add_definitions(-DUSE_ANAL)
+endif()
+
target_include_directories(
util
PUBLIC "${TD_SOURCE_DIR}/include/util"
diff --git a/source/util/src/tanal.c b/source/util/src/tanal.c
new file mode 100644
index 0000000000..92eee28ba8
--- /dev/null
+++ b/source/util/src/tanal.c
@@ -0,0 +1,756 @@
+/*
+ * Copyright (c) 2019 TAOS Data, Inc.
+ *
+ * This program is free software: you can use, redistribute, and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3
+ * or later ("AGPL"), as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+#define _DEFAULT_SOURCE
+#include "tanal.h"
+#include "tmsg.h"
+#include "ttypes.h"
+#include "tutil.h"
+
+#ifdef USE_ANAL
+#include
+#define ANAL_ALGO_SPLIT ","
+
+typedef struct {
+ int64_t ver;
+ SHashObj *hash; // algoname:algotype -> SAnalUrl
+ TdThreadMutex lock;
+} SAlgoMgmt;
+
+typedef struct {
+ char *data;
+ int64_t dataLen;
+} SCurlResp;
+
+static SAlgoMgmt tsAlgos = {0};
+static int32_t taosAnalBufGetCont(SAnalBuf *pBuf, char **ppCont, int64_t *pContLen);
+
+const char *taosAnalAlgoStr(EAnalAlgoType type) {
+ switch (type) {
+ case ANAL_ALGO_TYPE_ANOMALY_DETECT:
+ return "anomaly-detection";
+ case ANAL_ALGO_TYPE_FORECAST:
+ return "forecast";
+ default:
+ return "unknown";
+ }
+}
+
+const char *taosAnalAlgoUrlStr(EAnalAlgoType type) {
+ switch (type) {
+ case ANAL_ALGO_TYPE_ANOMALY_DETECT:
+ return "anomaly-detect";
+ case ANAL_ALGO_TYPE_FORECAST:
+ return "forecast";
+ default:
+ return "unknown";
+ }
+}
+
+EAnalAlgoType taosAnalAlgoInt(const char *name) {
+ for (EAnalAlgoType i = 0; i < ANAL_ALGO_TYPE_END; ++i) {
+ if (strcasecmp(name, taosAnalAlgoStr(i)) == 0) {
+ return i;
+ }
+ }
+
+ return ANAL_ALGO_TYPE_END;
+}
+
+int32_t taosAnalInit() {
+ if (curl_global_init(CURL_GLOBAL_ALL) != 0) {
+ uError("failed to init curl");
+ return -1;
+ }
+
+ tsAlgos.ver = 0;
+ if (taosThreadMutexInit(&tsAlgos.lock, NULL) != 0) {
+ uError("failed to init algo mutex");
+ return -1;
+ }
+
+ tsAlgos.hash = taosHashInit(64, MurmurHash3_32, true, HASH_ENTRY_LOCK);
+ if (tsAlgos.hash == NULL) {
+ uError("failed to init algo hash");
+ return -1;
+ }
+
+ uInfo("analysis env is initialized");
+ return 0;
+}
+
+static void taosAnalFreeHash(SHashObj *hash) {
+ void *pIter = taosHashIterate(hash, NULL);
+ while (pIter != NULL) {
+ SAnalUrl *pUrl = (SAnalUrl *)pIter;
+ taosMemoryFree(pUrl->url);
+ pIter = taosHashIterate(hash, pIter);
+ }
+ taosHashCleanup(hash);
+}
+
+void taosAnalCleanup() {
+ curl_global_cleanup();
+ if (taosThreadMutexDestroy(&tsAlgos.lock) != 0) {
+ uError("failed to destroy anal lock");
+ }
+ taosAnalFreeHash(tsAlgos.hash);
+ tsAlgos.hash = NULL;
+ uInfo("analysis env is cleaned up");
+}
+
+void taosAnalUpdate(int64_t newVer, SHashObj *pHash) {
+ if (newVer > tsAlgos.ver) {
+ if (taosThreadMutexLock(&tsAlgos.lock) == 0) {
+ SHashObj *hash = tsAlgos.hash;
+ tsAlgos.ver = newVer;
+ tsAlgos.hash = pHash;
+ if (taosThreadMutexUnlock(&tsAlgos.lock) != 0) {
+ uError("failed to unlock hash")
+ }
+ taosAnalFreeHash(hash);
+ }
+ } else {
+ taosAnalFreeHash(pHash);
+ }
+}
+
+bool taosAnalGetOptStr(const char *option, const char *optName, char *optValue, int32_t optMaxLen) {
+ char buf[TSDB_ANAL_ALGO_OPTION_LEN] = {0};
+ int32_t bufLen = tsnprintf(buf, sizeof(buf), "%s=", optName);
+
+ char *pos1 = strstr(option, buf);
+ char *pos2 = strstr(option, ANAL_ALGO_SPLIT);
+ if (pos1 != NULL) {
+ if (optMaxLen > 0) {
+ int32_t copyLen = optMaxLen;
+ if (pos2 != NULL) {
+ copyLen = (int32_t)(pos2 - pos1 - strlen(optName));
+ copyLen = MIN(copyLen, optMaxLen);
+ }
+ tstrncpy(optValue, pos1 + bufLen, copyLen);
+ }
+ return true;
+ } else {
+ return false;
+ }
+}
+
+bool taosAnalGetOptInt(const char *option, const char *optName, int64_t *optValue) {
+ char buf[TSDB_ANAL_ALGO_OPTION_LEN] = {0};
+ int32_t bufLen = tsnprintf(buf, sizeof(buf), "%s=", optName);
+
+ char *pos1 = strstr(option, buf);
+ char *pos2 = strstr(option, ANAL_ALGO_SPLIT);
+ if (pos1 != NULL) {
+ *optValue = taosStr2Int64(pos1 + bufLen, NULL, 10);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen) {
+ int32_t code = 0;
+ char name[TSDB_ANAL_ALGO_KEY_LEN] = {0};
+ int32_t nameLen = 1 + tsnprintf(name, sizeof(name) - 1, "%d:%s", type, algoName);
+
+ if (taosThreadMutexLock(&tsAlgos.lock) == 0) {
+ SAnalUrl *pUrl = taosHashAcquire(tsAlgos.hash, name, nameLen);
+ if (pUrl != NULL) {
+ tstrncpy(url, pUrl->url, urlLen);
+ uDebug("algo:%s, type:%s, url:%s", algoName, taosAnalAlgoStr(type), url);
+ } else {
+ url[0] = 0;
+ terrno = TSDB_CODE_ANAL_ALGO_NOT_FOUND;
+ code = terrno;
+ uError("algo:%s, type:%s, url not found", algoName, taosAnalAlgoStr(type));
+ }
+ if (taosThreadMutexUnlock(&tsAlgos.lock) != 0) {
+ uError("failed to unlock hash");
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ }
+
+ return code;
+}
+
+int64_t taosAnalGetVersion() { return tsAlgos.ver; }
+
+static size_t taosCurlWriteData(char *pCont, size_t contLen, size_t nmemb, void *userdata) {
+ SCurlResp *pRsp = userdata;
+ if (contLen == 0 || nmemb == 0 || pCont == NULL) {
+ pRsp->dataLen = 0;
+ pRsp->data = NULL;
+ uError("curl response is received, len:%" PRId64, pRsp->dataLen);
+ return 0;
+ }
+
+ pRsp->dataLen = (int64_t)contLen * (int64_t)nmemb;
+ pRsp->data = taosMemoryMalloc(pRsp->dataLen + 1);
+
+ if (pRsp->data != NULL) {
+ (void)memcpy(pRsp->data, pCont, pRsp->dataLen);
+ pRsp->data[pRsp->dataLen] = 0;
+ uDebugL("curl response is received, len:%" PRId64 ", content:%s", pRsp->dataLen, pRsp->data);
+ return pRsp->dataLen;
+ } else {
+ pRsp->dataLen = 0;
+ uError("failed to malloc curl response");
+ return 0;
+ }
+}
+
+static int32_t taosCurlGetRequest(const char *url, SCurlResp *pRsp) {
+ CURL *curl = NULL;
+ CURLcode code = 0;
+
+ curl = curl_easy_init();
+ if (curl == NULL) {
+ uError("failed to create curl handle");
+ return -1;
+ }
+
+ if (curl_easy_setopt(curl, CURLOPT_URL, url) != 0) goto _OVER;
+ if (curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, taosCurlWriteData) != 0) goto _OVER;
+ if (curl_easy_setopt(curl, CURLOPT_WRITEDATA, pRsp) != 0) goto _OVER;
+ if (curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 100) != 0) goto _OVER;
+
+ uDebug("curl get request will sent, url:%s", url);
+ code = curl_easy_perform(curl);
+ if (code != CURLE_OK) {
+ uError("failed to perform curl action, code:%d", code);
+ }
+
+_OVER:
+ if (curl != NULL) curl_easy_cleanup(curl);
+ return code;
+}
+
+static int32_t taosCurlPostRequest(const char *url, SCurlResp *pRsp, const char *buf, int32_t bufLen) {
+ struct curl_slist *headers = NULL;
+ CURL *curl = NULL;
+ CURLcode code = 0;
+
+ curl = curl_easy_init();
+ if (curl == NULL) {
+ uError("failed to create curl handle");
+ return -1;
+ }
+
+ headers = curl_slist_append(headers, "Content-Type:application/json;charset=UTF-8");
+ if (curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers) != 0) goto _OVER;
+ if (curl_easy_setopt(curl, CURLOPT_URL, url) != 0) goto _OVER;
+ if (curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, taosCurlWriteData) != 0) goto _OVER;
+ if (curl_easy_setopt(curl, CURLOPT_WRITEDATA, pRsp) != 0) goto _OVER;
+ if (curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 60000) != 0) goto _OVER;
+ if (curl_easy_setopt(curl, CURLOPT_POST, 1) != 0) goto _OVER;
+ if (curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, bufLen) != 0) goto _OVER;
+ if (curl_easy_setopt(curl, CURLOPT_POSTFIELDS, buf) != 0) goto _OVER;
+
+ uDebugL("curl post request will sent, url:%s len:%d content:%s", url, bufLen, buf);
+ code = curl_easy_perform(curl);
+ if (code != CURLE_OK) {
+ uError("failed to perform curl action, code:%d", code);
+ }
+
+_OVER:
+ if (curl != NULL) {
+ curl_slist_free_all(headers);
+ curl_easy_cleanup(curl);
+ }
+ return code;
+}
+
+SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalBuf *pBuf) {
+ int32_t code = -1;
+ char *pCont = NULL;
+ int64_t contentLen;
+ SJson *pJson = NULL;
+ SCurlResp curlRsp = {0};
+
+ if (type == ANAL_HTTP_TYPE_GET) {
+ if (taosCurlGetRequest(url, &curlRsp) != 0) {
+ terrno = TSDB_CODE_ANAL_URL_CANT_ACCESS;
+ goto _OVER;
+ }
+ } else {
+ code = taosAnalBufGetCont(pBuf, &pCont, &contentLen);
+ if (code != 0) {
+ terrno = code;
+ goto _OVER;
+ }
+ if (taosCurlPostRequest(url, &curlRsp, pCont, contentLen) != 0) {
+ terrno = TSDB_CODE_ANAL_URL_CANT_ACCESS;
+ goto _OVER;
+ }
+ }
+
+ if (curlRsp.data == NULL || curlRsp.dataLen == 0) {
+ terrno = TSDB_CODE_ANAL_URL_RSP_IS_NULL;
+ goto _OVER;
+ }
+
+ pJson = tjsonParse(curlRsp.data);
+ if (pJson == NULL) {
+ if (curlRsp.data[0] == '<') {
+ terrno = TSDB_CODE_ANAL_ANODE_RETURN_ERROR;
+ } else {
+ terrno = TSDB_CODE_INVALID_JSON_FORMAT;
+ }
+ goto _OVER;
+ }
+
+_OVER:
+ if (curlRsp.data != NULL) taosMemoryFreeClear(curlRsp.data);
+ if (pCont != NULL) taosMemoryFree(pCont);
+ return pJson;
+}
+
+static int32_t taosAnalJsonBufGetCont(const char *fileName, char **ppCont, int64_t *pContLen) {
+ int32_t code = 0;
+ int64_t contLen;
+ char *pCont = NULL;
+ TdFilePtr pFile = NULL;
+
+ pFile = taosOpenFile(fileName, TD_FILE_READ);
+ if (pFile == NULL) {
+ code = terrno;
+ goto _OVER;
+ }
+
+ code = taosFStatFile(pFile, &contLen, NULL);
+ if (code != 0) goto _OVER;
+
+ pCont = taosMemoryMalloc(contLen + 1);
+ if (pCont == NULL) {
+ code = TSDB_CODE_OUT_OF_MEMORY;
+ goto _OVER;
+ }
+
+ if (taosReadFile(pFile, pCont, contLen) != contLen) {
+ code = terrno;
+ goto _OVER;
+ }
+
+ pCont[contLen] = '\0';
+
+_OVER:
+ if (code == 0) {
+ *ppCont = pCont;
+ *pContLen = contLen;
+ } else {
+ if (pCont != NULL) taosMemoryFree(pCont);
+ }
+ if (pFile != NULL) taosCloseFile(&pFile);
+ return code;
+}
+
+static int32_t taosAnalJsonBufWriteOptInt(SAnalBuf *pBuf, const char *optName, int64_t optVal) {
+ char buf[64] = {0};
+ int32_t bufLen = tsnprintf(buf, sizeof(buf), "\"%s\": %" PRId64 ",\n", optName, optVal);
+ if (taosWriteFile(pBuf->filePtr, buf, bufLen) != bufLen) {
+ return terrno;
+ }
+ return 0;
+}
+
+static int32_t taosAnalJsonBufWriteOptStr(SAnalBuf *pBuf, const char *optName, const char *optVal) {
+ char buf[128] = {0};
+ int32_t bufLen = tsnprintf(buf, sizeof(buf), "\"%s\": \"%s\",\n", optName, optVal);
+ if (taosWriteFile(pBuf->filePtr, buf, bufLen) != bufLen) {
+ return terrno;
+ }
+ return 0;
+}
+
+static int32_t taosAnalJsonBufWriteOptFloat(SAnalBuf *pBuf, const char *optName, float optVal) {
+ char buf[128] = {0};
+ int32_t bufLen = tsnprintf(buf, sizeof(buf), "\"%s\": %f,\n", optName, optVal);
+ if (taosWriteFile(pBuf->filePtr, buf, bufLen) != bufLen) {
+ return terrno;
+ }
+ return 0;
+}
+
+static int32_t taosAnalJsonBufWriteStr(SAnalBuf *pBuf, const char *buf, int32_t bufLen) {
+ if (bufLen <= 0) {
+ bufLen = strlen(buf);
+ }
+ if (taosWriteFile(pBuf->filePtr, buf, bufLen) != bufLen) {
+ return terrno;
+ }
+ return 0;
+}
+
+static int32_t taosAnalJsonBufWriteStart(SAnalBuf *pBuf) { return taosAnalJsonBufWriteStr(pBuf, "{\n", 0); }
+
+static int32_t tsosAnalJsonBufOpen(SAnalBuf *pBuf, int32_t numOfCols) {
+ pBuf->filePtr = taosOpenFile(pBuf->fileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
+ if (pBuf->filePtr == NULL) {
+ return terrno;
+ }
+
+ pBuf->pCols = taosMemoryCalloc(numOfCols, sizeof(SAnalColBuf));
+ if (pBuf->pCols == NULL) return TSDB_CODE_OUT_OF_MEMORY;
+ pBuf->numOfCols = numOfCols;
+
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON) {
+ return taosAnalJsonBufWriteStart(pBuf);
+ }
+
+ for (int32_t i = 0; i < numOfCols; ++i) {
+ SAnalColBuf *pCol = &pBuf->pCols[i];
+ snprintf(pCol->fileName, sizeof(pCol->fileName), "%s-c%d", pBuf->fileName, i);
+ pCol->filePtr =
+ taosOpenFile(pCol->fileName, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_TRUNC | TD_FILE_WRITE_THROUGH);
+ if (pCol->filePtr == NULL) {
+ return terrno;
+ }
+ }
+
+ return taosAnalJsonBufWriteStart(pBuf);
+}
+
+static int32_t taosAnalJsonBufWriteColMeta(SAnalBuf *pBuf, int32_t colIndex, int32_t colType, const char *colName) {
+ char buf[128] = {0};
+ bool first = (colIndex == 0);
+ bool last = (colIndex == pBuf->numOfCols - 1);
+
+ if (first) {
+ if (taosAnalJsonBufWriteStr(pBuf, "\"schema\": [\n", 0) != 0) {
+ return terrno;
+ }
+ }
+
+ int32_t bufLen = tsnprintf(buf, sizeof(buf), " [\"%s\", \"%s\", %d]%s\n", colName, tDataTypes[colType].name,
+ tDataTypes[colType].bytes, last ? "" : ",");
+ if (taosWriteFile(pBuf->filePtr, buf, bufLen) != bufLen) {
+ return terrno;
+ }
+
+ if (last) {
+ if (taosAnalJsonBufWriteStr(pBuf, "],\n", 0) != 0) {
+ return terrno;
+ }
+ }
+
+ return 0;
+}
+
+static int32_t taosAnalJsonBufWriteDataBegin(SAnalBuf *pBuf) {
+ return taosAnalJsonBufWriteStr(pBuf, "\"data\": [\n", 0);
+}
+
+static int32_t taosAnalJsonBufWriteStrUseCol(SAnalBuf *pBuf, const char *buf, int32_t bufLen, int32_t colIndex) {
+ if (bufLen <= 0) {
+ bufLen = strlen(buf);
+ }
+
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON) {
+ if (taosWriteFile(pBuf->filePtr, buf, bufLen) != bufLen) {
+ return terrno;
+ }
+ } else {
+ if (taosWriteFile(pBuf->pCols[colIndex].filePtr, buf, bufLen) != bufLen) {
+ return terrno;
+ }
+ }
+
+ return 0;
+}
+
+static int32_t taosAnalJsonBufWriteColBegin(SAnalBuf *pBuf, int32_t colIndex) {
+ return taosAnalJsonBufWriteStrUseCol(pBuf, "[\n", 0, colIndex);
+}
+
+static int32_t taosAnalJsonBufWriteColEnd(SAnalBuf *pBuf, int32_t colIndex) {
+ if (colIndex == pBuf->numOfCols - 1) {
+ return taosAnalJsonBufWriteStrUseCol(pBuf, "\n]\n", 0, colIndex);
+
+ } else {
+ return taosAnalJsonBufWriteStrUseCol(pBuf, "\n],\n", 0, colIndex);
+ }
+}
+
+static int32_t taosAnalJsonBufWriteColData(SAnalBuf *pBuf, int32_t colIndex, int32_t colType, void *colValue) {
+ char buf[64];
+ int32_t bufLen = 0;
+
+ if (pBuf->pCols[colIndex].numOfRows != 0) {
+ buf[bufLen] = ',';
+ buf[bufLen + 1] = '\n';
+ buf[bufLen + 2] = 0;
+ bufLen += 2;
+ }
+
+ switch (colType) {
+ case TSDB_DATA_TYPE_BOOL:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%d", (*((int8_t *)colValue) == 1) ? 1 : 0);
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%d", *(int8_t *)colValue);
+ break;
+ case TSDB_DATA_TYPE_UTINYINT:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%u", *(uint8_t *)colValue);
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%d", *(int16_t *)colValue);
+ break;
+ case TSDB_DATA_TYPE_USMALLINT:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%u", *(uint16_t *)colValue);
+ break;
+ case TSDB_DATA_TYPE_INT:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%d", *(int32_t *)colValue);
+ break;
+ case TSDB_DATA_TYPE_UINT:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%u", *(uint32_t *)colValue);
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%" PRId64 "", *(int64_t *)colValue);
+ break;
+ case TSDB_DATA_TYPE_UBIGINT:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%" PRIu64 "", *(uint64_t *)colValue);
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%f", GET_FLOAT_VAL(colValue));
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ bufLen += tsnprintf(buf + bufLen, sizeof(buf) - bufLen, "%f", GET_DOUBLE_VAL(colValue));
+ break;
+ default:
+ buf[bufLen] = '\0';
+ }
+
+ pBuf->pCols[colIndex].numOfRows++;
+ return taosAnalJsonBufWriteStrUseCol(pBuf, buf, bufLen, colIndex);
+}
+
+static int32_t taosAnalJsonBufWriteDataEnd(SAnalBuf *pBuf) {
+ int32_t code = 0;
+ char *pCont = NULL;
+ int64_t contLen = 0;
+
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ for (int32_t i = 0; i < pBuf->numOfCols; ++i) {
+ SAnalColBuf *pCol = &pBuf->pCols[i];
+
+ code = taosFsyncFile(pCol->filePtr);
+ if (code != 0) return code;
+
+ code = taosCloseFile(&pCol->filePtr);
+ if (code != 0) return code;
+
+ code = taosAnalJsonBufGetCont(pBuf->pCols[i].fileName, &pCont, &contLen);
+ if (code != 0) return code;
+
+ code = taosAnalJsonBufWriteStr(pBuf, pCont, contLen);
+ if (code != 0) return code;
+
+ taosMemoryFreeClear(pCont);
+ contLen = 0;
+ }
+ }
+
+ return taosAnalJsonBufWriteStr(pBuf, "],\n", 0);
+}
+
+static int32_t taosAnalJsonBufWriteEnd(SAnalBuf *pBuf) {
+ int32_t code = taosAnalJsonBufWriteOptInt(pBuf, "rows", pBuf->pCols[0].numOfRows);
+ if (code != 0) return code;
+
+ return taosAnalJsonBufWriteStr(pBuf, "\"protocol\": 1.0\n}", 0);
+}
+
+int32_t taosAnalJsonBufClose(SAnalBuf *pBuf) {
+ int32_t code = taosAnalJsonBufWriteEnd(pBuf);
+ if (code != 0) return code;
+
+ if (pBuf->filePtr != NULL) {
+ code = taosFsyncFile(pBuf->filePtr);
+ if (code != 0) return code;
+ code = taosCloseFile(&pBuf->filePtr);
+ if (code != 0) return code;
+ }
+
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ for (int32_t i = 0; i < pBuf->numOfCols; ++i) {
+ SAnalColBuf *pCol = &pBuf->pCols[i];
+ if (pCol->filePtr != NULL) {
+ code = taosFsyncFile(pCol->filePtr);
+ if (code != 0) return code;
+ code = taosCloseFile(&pCol->filePtr);
+ if (code != 0) return code;
+ }
+ }
+ }
+
+ return 0;
+}
+
+void taosAnalBufDestroy(SAnalBuf *pBuf) {
+ if (pBuf->fileName[0] != 0) {
+ if (pBuf->filePtr != NULL) (void)taosCloseFile(&pBuf->filePtr);
+ // taosRemoveFile(pBuf->fileName);
+ pBuf->fileName[0] = 0;
+ }
+
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ for (int32_t i = 0; i < pBuf->numOfCols; ++i) {
+ SAnalColBuf *pCol = &pBuf->pCols[i];
+ if (pCol->fileName[0] != 0) {
+ if (pCol->filePtr != NULL) (void)taosCloseFile(&pCol->filePtr);
+ if (taosRemoveFile(pCol->fileName) != 0) {
+ uError("failed to remove file %s", pCol->fileName);
+ }
+ pCol->fileName[0] = 0;
+ }
+ }
+ }
+
+ taosMemoryFreeClear(pBuf->pCols);
+ pBuf->numOfCols = 0;
+}
+
+int32_t tsosAnalBufOpen(SAnalBuf *pBuf, int32_t numOfCols) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return tsosAnalJsonBufOpen(pBuf, numOfCols);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+int32_t taosAnalBufWriteOptStr(SAnalBuf *pBuf, const char *optName, const char *optVal) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufWriteOptStr(pBuf, optName, optVal);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+int32_t taosAnalBufWriteOptInt(SAnalBuf *pBuf, const char *optName, int64_t optVal) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufWriteOptInt(pBuf, optName, optVal);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+int32_t taosAnalBufWriteOptFloat(SAnalBuf *pBuf, const char *optName, float optVal) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufWriteOptFloat(pBuf, optName, optVal);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+int32_t taosAnalBufWriteColMeta(SAnalBuf *pBuf, int32_t colIndex, int32_t colType, const char *colName) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufWriteColMeta(pBuf, colIndex, colType, colName);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+int32_t taosAnalBufWriteDataBegin(SAnalBuf *pBuf) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufWriteDataBegin(pBuf);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+int32_t taosAnalBufWriteColBegin(SAnalBuf *pBuf, int32_t colIndex) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufWriteColBegin(pBuf, colIndex);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+int32_t taosAnalBufWriteColData(SAnalBuf *pBuf, int32_t colIndex, int32_t colType, void *colValue) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufWriteColData(pBuf, colIndex, colType, colValue);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+int32_t taosAnalBufWriteColEnd(SAnalBuf *pBuf, int32_t colIndex) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufWriteColEnd(pBuf, colIndex);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+int32_t taosAnalBufWriteDataEnd(SAnalBuf *pBuf) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufWriteDataEnd(pBuf);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+int32_t taosAnalBufClose(SAnalBuf *pBuf) {
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufClose(pBuf);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+static int32_t taosAnalBufGetCont(SAnalBuf *pBuf, char **ppCont, int64_t *pContLen) {
+ *ppCont = NULL;
+ *pContLen = 0;
+
+ if (pBuf->bufType == ANAL_BUF_TYPE_JSON || pBuf->bufType == ANAL_BUF_TYPE_JSON_COL) {
+ return taosAnalJsonBufGetCont(pBuf->fileName, ppCont, pContLen);
+ } else {
+ return TSDB_CODE_ANAL_BUF_INVALID_TYPE;
+ }
+}
+
+#else
+
+int32_t taosAnalInit() { return 0; }
+void taosAnalCleanup() {}
+SJson *taosAnalSendReqRetJson(const char *url, EAnalHttpType type, SAnalBuf *pBuf) { return NULL; }
+
+int32_t taosAnalGetAlgoUrl(const char *algoName, EAnalAlgoType type, char *url, int32_t urlLen) { return 0; }
+bool taosAnalGetOptStr(const char *option, const char *optName, char *optValue, int32_t optMaxLen) { return true; }
+bool taosAnalGetOptInt(const char *option, const char *optName, int64_t *optValue) { return true; }
+int64_t taosAnalGetVersion() { return 0; }
+void taosAnalUpdate(int64_t newVer, SHashObj *pHash) {}
+
+int32_t tsosAnalBufOpen(SAnalBuf *pBuf, int32_t numOfCols) { return 0; }
+int32_t taosAnalBufWriteOptStr(SAnalBuf *pBuf, const char *optName, const char *optVal) { return 0; }
+int32_t taosAnalBufWriteOptInt(SAnalBuf *pBuf, const char *optName, int64_t optVal) { return 0; }
+int32_t taosAnalBufWriteOptFloat(SAnalBuf *pBuf, const char *optName, float optVal) { return 0; }
+int32_t taosAnalBufWriteColMeta(SAnalBuf *pBuf, int32_t colIndex, int32_t colType, const char *colName) { return 0; }
+int32_t taosAnalBufWriteDataBegin(SAnalBuf *pBuf) { return 0; }
+int32_t taosAnalBufWriteColBegin(SAnalBuf *pBuf, int32_t colIndex) { return 0; }
+int32_t taosAnalBufWriteColData(SAnalBuf *pBuf, int32_t colIndex, int32_t colType, void *colValue) { return 0; }
+int32_t taosAnalBufWriteColEnd(SAnalBuf *pBuf, int32_t colIndex) { return 0; }
+int32_t taosAnalBufWriteDataEnd(SAnalBuf *pBuf) { return 0; }
+int32_t taosAnalBufClose(SAnalBuf *pBuf) { return 0; }
+void taosAnalBufDestroy(SAnalBuf *pBuf) {}
+
+const char *taosAnalAlgoStr(EAnalAlgoType algoType) { return 0; }
+EAnalAlgoType taosAnalAlgoInt(const char *algoName) { return 0; }
+const char *taosAnalAlgoUrlStr(EAnalAlgoType algoType) { return 0; }
+
+#endif
\ No newline at end of file
diff --git a/source/util/src/terror.c b/source/util/src/terror.c
index 35f0bc73eb..9b85e82184 100644
--- a/source/util/src/terror.c
+++ b/source/util/src/terror.c
@@ -55,10 +55,13 @@ TAOS_DEFINE_ERROR(TSDB_CODE_RPC_TIMEOUT, "Conn read timeout")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_SOMENODE_NOT_CONNECTED, "some vnode/qnode/mnode(s) out of service")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_MAX_SESSIONS, "rpc open too many session")
TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_ERROR, "rpc network error")
-TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_BUSY, "rpc network busy")
-TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_MODULE_QUIT, "http-report already quit")
-TAOS_DEFINE_ERROR(TSDB_CODE_RPC_MODULE_QUIT, "rpc module already quit")
-TAOS_DEFINE_ERROR(TSDB_CODE_RPC_ASYNC_MODULE_QUIT, "rpc async module already quit")
+TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NETWORK_BUSY, "rpc network busy")
+TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_MODULE_QUIT, "http-report already quit")
+TAOS_DEFINE_ERROR(TSDB_CODE_RPC_MODULE_QUIT, "rpc module already quit")
+TAOS_DEFINE_ERROR(TSDB_CODE_RPC_ASYNC_MODULE_QUIT, "rpc async module already quit")
+TAOS_DEFINE_ERROR(TSDB_CODE_RPC_ASYNC_IN_PROCESS, "rpc async in process")
+TAOS_DEFINE_ERROR(TSDB_CODE_RPC_NO_STATE, "rpc no state")
+TAOS_DEFINE_ERROR(TSDB_CODE_RPC_STATE_DROPED, "rpc state already dropped")
//common & util
TAOS_DEFINE_ERROR(TSDB_CODE_TIME_UNSYNCED, "Client and server's time is not synchronized")
@@ -345,6 +348,24 @@ TAOS_DEFINE_ERROR(TSDB_CODE_MND_MULTI_REPLICA_SOURCE_DB, "Stream temporarily do
TAOS_DEFINE_ERROR(TSDB_CODE_MND_TOO_MANY_STREAMS, "Too many streams")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_INVALID_TARGET_TABLE, "Cannot write the same stable as other stream")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_ALREADY_EXIST, "Anode already exists")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_NOT_EXIST, "Anode not there")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_LONG_URL, "Anode too long url")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_INVALID_PROTOCOL, "Anode invalid protocol")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_INVALID_ALGO_TYPE, "Anode invalid algorithm type")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_INVALID_VERSION, "Anode invalid version")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_MANY_ALGO, "Anode too many algorithm")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_LONG_ALGO_NAME, "Anode too long algorithm name")
+TAOS_DEFINE_ERROR(TSDB_CODE_MND_ANODE_TOO_MANY_ALGO_TYPE, "Anode too many algorithm type")
+
+TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_URL_RSP_IS_NULL, "Analysis url response is NULL")
+TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_URL_CANT_ACCESS, "Analysis url can't access")
+TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_ALGO_NOT_FOUND, "Analysis algorithm not found")
+TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_ALGO_NOT_LOAD, "Analysis algorithm not loaded")
+TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_BUF_INVALID_TYPE, "Analysis invalid buffer type")
+TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_ANODE_RETURN_ERROR, "Analysis failed since anode return error")
+TAOS_DEFINE_ERROR(TSDB_CODE_ANAL_ANODE_TOO_MANY_ROWS, "Analysis failed since too many input rows for anode")
+
// mnode-sma
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_ALREADY_EXIST, "SMA already exists")
TAOS_DEFINE_ERROR(TSDB_CODE_MND_SMA_NOT_EXIST, "sma not exist")
@@ -709,6 +730,11 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TBNAME_DUPLICATED, "Table name duplicat
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TAG_NAME_DUPLICATED, "Tag name duplicated")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_NOT_ALLOWED_DIFFERENT_BY_ROW_FUNC, "Some functions cannot appear in the select list at the same time")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR, "Syntax error in regular expression")
+TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ANOMALY_WIN_TYPE, "ANOMALY_WINDOW only support mathable column")
+TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ANOMALY_WIN_COL, "ANOMALY_WINDOW not support on tag column")
+TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_ANOMALY_WIN_OPT, "ANOMALY_WINDOW option should include algo field")
+TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_FORECAST_CLAUSE, "Invalid forecast clause")
+TAOS_DEFINE_ERROR(TSDB_CODE_PAR_REGULAR_EXPRESSION_ERROR, "Syntax error in regular expression")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
//planner
diff --git a/source/util/src/theap.c b/source/util/src/theap.c
index e906d1f55b..600bc2b998 100644
--- a/source/util/src/theap.c
+++ b/source/util/src/theap.c
@@ -225,7 +225,8 @@ void destroyPriorityQueue(PriorityQueue* pq) {
static size_t pqParent(size_t i) { return (--i) >> 1; /* (i - 1) / 2 */ }
static size_t pqLeft(size_t i) { return (i << 1) | 1; /* i * 2 + 1 */ }
static size_t pqRight(size_t i) { return (++i) << 1; /* (i + 1) * 2 */ }
-static void pqSwapPQNode(PriorityQueueNode* a, PriorityQueueNode* b) {
+
+static void pqSwapPQNode(PriorityQueueNode* a, PriorityQueueNode* b) {
void* tmp = a->data;
a->data = b->data;
b->data = tmp;
diff --git a/source/util/src/tjson.c b/source/util/src/tjson.c
index 0f2504ff5e..7e95a842ff 100644
--- a/source/util/src/tjson.c
+++ b/source/util/src/tjson.c
@@ -194,6 +194,10 @@ int32_t tjsonGetObjectValueString(const SJson* pJson, char** pValueString) {
return TSDB_CODE_SUCCESS;
}
+void tjsonGetObjectValueBigInt(const SJson* pJson, int64_t* pVal) { *pVal = (int64_t)((cJSON*)pJson)->valuedouble; }
+
+void tjsonGetObjectValueDouble(const SJson* pJson, double* pVal) { *pVal = ((cJSON*)pJson)->valuedouble; }
+
int32_t tjsonGetStringValue(const SJson* pJson, const char* pName, char* pVal) {
char* p = cJSON_GetStringValue(tjsonGetObjectItem((cJSON*)pJson, pName));
if (NULL == p) {
@@ -203,6 +207,19 @@ int32_t tjsonGetStringValue(const SJson* pJson, const char* pName, char* pVal) {
return TSDB_CODE_SUCCESS;
}
+int32_t tjsonGetStringValue2(const SJson* pJson, const char* pName, char* pVal, int32_t maxLen) {
+ char* p = cJSON_GetStringValue(tjsonGetObjectItem((cJSON*)pJson, pName));
+ if (NULL == p) {
+ return TSDB_CODE_SUCCESS;
+ }
+ int32_t len = strlen(p);
+ if (len >= maxLen - 1) {
+ return TSDB_CODE_OUT_OF_MEMORY;
+ }
+ strcpy(pVal, p);
+ return TSDB_CODE_SUCCESS;
+}
+
int32_t tjsonDupStringValue(const SJson* pJson, const char* pName, char** pVal) {
char* p = cJSON_GetStringValue(tjsonGetObjectItem((cJSON*)pJson, pName));
if (NULL == p) {
diff --git a/source/util/src/tref.c b/source/util/src/tref.c
index 9360bd8b0e..f3597b5586 100644
--- a/source/util/src/tref.c
+++ b/source/util/src/tref.c
@@ -19,7 +19,7 @@
#include "tlog.h"
#include "tutil.h"
-#define TSDB_REF_OBJECTS 50
+#define TSDB_REF_OBJECTS 100
#define TSDB_REF_STATE_EMPTY 0
#define TSDB_REF_STATE_ACTIVE 1
#define TSDB_REF_STATE_DELETED 2
@@ -56,7 +56,7 @@ static void taosLockList(int64_t *lockedBy);
static void taosUnlockList(int64_t *lockedBy);
static void taosIncRsetCount(SRefSet *pSet);
static void taosDecRsetCount(SRefSet *pSet);
-static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove, int32_t* isReleased);
+static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove, int32_t *isReleased);
int32_t taosOpenRef(int32_t max, RefFp fp) {
SRefNode **nodeList;
@@ -254,7 +254,9 @@ void *taosAcquireRef(int32_t rsetId, int64_t rid) {
}
int32_t taosReleaseRef(int32_t rsetId, int64_t rid) { return taosDecRefCount(rsetId, rid, 0, NULL); }
-int32_t taosReleaseRefEx(int32_t rsetId, int64_t rid, int32_t* isReleased) { return taosDecRefCount(rsetId, rid, 0, isReleased); }
+int32_t taosReleaseRefEx(int32_t rsetId, int64_t rid, int32_t *isReleased) {
+ return taosDecRefCount(rsetId, rid, 0, isReleased);
+}
// if rid is 0, return the first p in hash list, otherwise, return the next after current rid
void *taosIterateRef(int32_t rsetId, int64_t rid) {
@@ -387,7 +389,7 @@ int32_t taosListRef() {
return num;
}
-static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove, int32_t* isReleased) {
+static int32_t taosDecRefCount(int32_t rsetId, int64_t rid, int32_t remove, int32_t *isReleased) {
int32_t hash;
SRefSet *pSet;
SRefNode *pNode;
diff --git a/source/util/test/heapTest.cpp b/source/util/test/heapTest.cpp
new file mode 100644
index 0000000000..51eeb26ed3
--- /dev/null
+++ b/source/util/test/heapTest.cpp
@@ -0,0 +1,55 @@
+#include
+
+#include "taoserror.h"
+#include "theap.h"
+
+using namespace std;
+
+typedef struct TNode {
+ int32_t data;
+ HeapNode node;
+} TNodeMem;
+
+#define container_of(ptr, type, member) ((type*)((char*)(ptr)-offsetof(type, member)))
+int32_t heapCompare(const HeapNode* a, const HeapNode* b) {
+ TNodeMem *ta = container_of(a, TNodeMem, node);
+ TNodeMem *tb = container_of(b, TNodeMem, node);
+ if (ta->data > tb->data) {
+ return 0;
+ }
+ return 1;
+}
+
+TEST(TD_UTIL_HEAP_TEST, heapTest) {
+ Heap* heap = heapCreate(heapCompare);
+ ASSERT_TRUE(heap != NULL);
+ ASSERT_EQ(0, heapSize(heap));
+
+
+ int32_t limit = 10;
+
+ TNodeMem **pArr = (TNodeMem **)taosMemoryCalloc(100, sizeof(TNodeMem *));
+ for (int i = 0; i < 100; i++) {
+ TNodeMem *a = (TNodeMem *)taosMemoryCalloc(1, sizeof(TNodeMem));
+ a->data = i%limit;
+
+ heapInsert(heap, &a->node);
+
+ pArr[i] = a;
+ TNodeMem *b = (TNodeMem *)taosMemoryCalloc(1, sizeof(TNodeMem));
+ b->data = (limit - i)%limit;
+ heapInsert(heap, &b->node);
+ }
+ for (int i = 98; i < 100; i++) {
+ TNodeMem *p = pArr[i];
+ p->data = -100000;
+ }
+ HeapNode *node = heapMin(heap);
+ while (node != NULL) {
+ TNodeMem *data = container_of(node, TNodeMem, node);
+ heapRemove(heap, node);
+ printf("%d\t", data->data);
+ node = heapMin(heap);
+ }
+ heapDestroy(heap);
+}
diff --git a/tests/develop-test/2-query/table_count_scan.py b/tests/develop-test/2-query/table_count_scan.py
index 38e35a175e..b2b48c1f0b 100644
--- a/tests/develop-test/2-query/table_count_scan.py
+++ b/tests/develop-test/2-query/table_count_scan.py
@@ -65,7 +65,7 @@ class TDTestCase:
tdSql.query('select count(*),db_name, stable_name from information_schema.ins_tables group by db_name, stable_name;')
tdSql.checkRows(3)
- tdSql.checkData(0, 0, 32)
+ tdSql.checkData(0, 0, 34)
tdSql.checkData(0, 1, 'information_schema')
tdSql.checkData(0, 2, None)
tdSql.checkData(1, 0, 3)
@@ -77,7 +77,7 @@ class TDTestCase:
tdSql.query('select count(1) v,db_name, stable_name from information_schema.ins_tables group by db_name, stable_name order by v desc;')
tdSql.checkRows(3)
- tdSql.checkData(0, 0, 32)
+ tdSql.checkData(0, 0, 34)
tdSql.checkData(0, 1, 'information_schema')
tdSql.checkData(0, 2, None)
tdSql.checkData(1, 0, 5)
@@ -93,7 +93,7 @@ class TDTestCase:
tdSql.checkData(1, 1, 'performance_schema')
tdSql.checkData(0, 0, 3)
tdSql.checkData(0, 1, 'tbl_count')
- tdSql.checkData(2, 0, 32)
+ tdSql.checkData(2, 0, 34)
tdSql.checkData(2, 1, 'information_schema')
tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'")
@@ -106,7 +106,7 @@ class TDTestCase:
tdSql.query('select count(*) from information_schema.ins_tables')
tdSql.checkRows(1)
- tdSql.checkData(0, 0, 40)
+ tdSql.checkData(0, 0, 42)
tdSql.execute('create table stba (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(10), c9 nchar(10), c10 tinyint unsigned, c11 smallint unsigned, c12 int unsigned, c13 bigint unsigned) TAGS(t1 int, t2 binary(10), t3 double);')
@@ -189,7 +189,7 @@ class TDTestCase:
tdSql.checkData(2, 0, 5)
tdSql.checkData(2, 1, 'performance_schema')
tdSql.checkData(2, 2, None)
- tdSql.checkData(3, 0, 32)
+ tdSql.checkData(3, 0, 34)
tdSql.checkData(3, 1, 'information_schema')
tdSql.checkData(3, 2, None)
@@ -204,7 +204,7 @@ class TDTestCase:
tdSql.checkData(2, 0, 5)
tdSql.checkData(2, 1, 'performance_schema')
tdSql.checkData(2, 2, None)
- tdSql.checkData(3, 0, 32)
+ tdSql.checkData(3, 0, 34)
tdSql.checkData(3, 1, 'information_schema')
tdSql.checkData(3, 2, None)
@@ -215,7 +215,7 @@ class TDTestCase:
tdSql.checkData(0, 1, 'tbl_count')
tdSql.checkData(1, 0, 5)
tdSql.checkData(1, 1, 'performance_schema')
- tdSql.checkData(2, 0, 32)
+ tdSql.checkData(2, 0, 34)
tdSql.checkData(2, 1, 'information_schema')
tdSql.query("select count(*) from information_schema.ins_tables where db_name='tbl_count'")
@@ -228,7 +228,7 @@ class TDTestCase:
tdSql.query('select count(*) from information_schema.ins_tables')
tdSql.checkRows(1)
- tdSql.checkData(0, 0, 41)
+ tdSql.checkData(0, 0, 43)
tdSql.execute('drop database tbl_count')
diff --git a/tests/script/tsim/query/sys_tbname.sim b/tests/script/tsim/query/sys_tbname.sim
index dabe4fcdde..9736893428 100644
--- a/tests/script/tsim/query/sys_tbname.sim
+++ b/tests/script/tsim/query/sys_tbname.sim
@@ -58,7 +58,7 @@ endi
sql select tbname from information_schema.ins_tables;
print $rows $data00
-if $rows != 41 then
+if $rows != 43 then
return -1
endi
if $data00 != @ins_tables@ then
diff --git a/tests/script/tsim/query/tableCount.sim b/tests/script/tsim/query/tableCount.sim
index 5a3dd0714f..87f72eb3b6 100644
--- a/tests/script/tsim/query/tableCount.sim
+++ b/tests/script/tsim/query/tableCount.sim
@@ -53,7 +53,7 @@ sql select stable_name,count(table_name) from information_schema.ins_tables grou
if $rows != 3 then
return -1
endi
-if $data01 != 38 then
+if $data01 != 40 then
return -1
endi
if $data11 != 10 then
@@ -72,7 +72,7 @@ endi
if $data11 != 5 then
return -1
endi
-if $data21 != 32 then
+if $data21 != 34 then
return -1
endi
if $data31 != 5 then
@@ -97,7 +97,7 @@ endi
if $data42 != 3 then
return -1
endi
-if $data52 != 32 then
+if $data52 != 34 then
return -1
endi
if $data62 != 5 then
diff --git a/tests/script/tsim/tagindex/sma_and_tag_index.sim b/tests/script/tsim/tagindex/sma_and_tag_index.sim
index 77cc9f53f9..4a6a948e21 100644
--- a/tests/script/tsim/tagindex/sma_and_tag_index.sim
+++ b/tests/script/tsim/tagindex/sma_and_tag_index.sim
@@ -96,6 +96,7 @@ while $i < 5
sql drop index $sma
endw
+#sleep 5000
sql drop stable $mtPrefix
sql select * from information_schema.ins_indexes
if $rows != 0 then
diff --git a/tests/system-test/0-others/information_schema.py b/tests/system-test/0-others/information_schema.py
index f59410b552..01e416bb26 100644
--- a/tests/system-test/0-others/information_schema.py
+++ b/tests/system-test/0-others/information_schema.py
@@ -61,7 +61,7 @@ class TDTestCase:
self.ins_list = ['ins_dnodes','ins_mnodes','ins_qnodes','ins_snodes','ins_cluster','ins_databases','ins_functions',\
'ins_indexes','ins_stables','ins_tables','ins_tags','ins_columns','ins_users','ins_grants','ins_vgroups','ins_configs','ins_dnode_variables',\
'ins_topics','ins_subscriptions','ins_streams','ins_stream_tasks','ins_vnodes','ins_user_privileges','ins_views',
- 'ins_compacts', 'ins_compact_details', 'ins_grants_full','ins_grants_logs', 'ins_machines', 'ins_arbgroups', 'ins_tsmas', "ins_encryptions"]
+ 'ins_compacts', 'ins_compact_details', 'ins_grants_full','ins_grants_logs', 'ins_machines', 'ins_arbgroups', 'ins_tsmas', "ins_encryptions", "ins_anodes", "ins_anodes_full"]
self.perf_list = ['perf_connections','perf_queries','perf_consumers','perf_trans','perf_apps']
def insert_data(self,column_dict,tbname,row_num):
insert_sql = self.setsql.set_insertsql(column_dict,tbname,self.binary_str,self.nchar_str)
@@ -222,7 +222,7 @@ class TDTestCase:
tdSql.query("select * from information_schema.ins_columns where db_name ='information_schema'")
tdLog.info(len(tdSql.queryResult))
- tdSql.checkEqual(True, len(tdSql.queryResult) in range(272, 273))
+ tdSql.checkEqual(True, len(tdSql.queryResult) in range(280, 281))
tdSql.query("select * from information_schema.ins_columns where db_name ='performance_schema'")
tdSql.checkEqual(56, len(tdSql.queryResult))
diff --git a/tools/auto/stmt2Performance/json/query.json b/tools/auto/stmt2Performance/json/query.json
index 70f1d90edc..3b6750be13 100644
--- a/tools/auto/stmt2Performance/json/query.json
+++ b/tools/auto/stmt2Performance/json/query.json
@@ -8,15 +8,14 @@
"confirm_parameter_prompt": "no",
"continue_if_fail": "yes",
"databases": "dbrate",
- "query_times": 20,
+ "query_times": 5,
"query_mode": "taosc",
"specified_table_query": {
"query_interval": 0,
- "concurrent": 10,
+ "threads": 10,
"sqls": [
{
- "sql": "select count(*) from meters",
- "result": "./query_result.txt"
+ "sql": "select count(*) from meters"
}
]
}
diff --git a/tools/auto/stmt2Performance/json/template.json b/tools/auto/stmt2Performance/json/template.json
index 8c54c5be22..6d015370e9 100644
--- a/tools/auto/stmt2Performance/json/template.json
+++ b/tools/auto/stmt2Performance/json/template.json
@@ -17,7 +17,9 @@
"dbinfo": {
"name": "dbrate",
"vgroups": 1,
- "drop": "yes"
+ "drop": "yes",
+ "wal_retention_size": 1,
+ "wal_retention_period": 1
},
"super_tables": [
{
@@ -27,7 +29,7 @@
"childtable_prefix": "d",
"insert_mode": "@STMT_MODE",
"interlace_rows": @INTERLACE_MODE,
- "insert_rows": 100000,
+ "insert_rows": 10000,
"timestamp_step": 1,
"start_timestamp": "2020-10-01 00:00:00.000",
"auto_create_table": "no",
diff --git a/tools/auto/stmt2Performance/stmt2Perf.py b/tools/auto/stmt2Performance/stmt2Perf.py
index 4d99f2483d..ae66504c8a 100644
--- a/tools/auto/stmt2Performance/stmt2Perf.py
+++ b/tools/auto/stmt2Performance/stmt2Perf.py
@@ -34,28 +34,6 @@ def exec(command, show=True):
print(f"exec {command}\n")
return os.system(command)
-# run return output and error
-def run(command, timeout = 60, show=True):
- if(show):
- print(f"run {command} timeout={timeout}s\n")
-
- process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- process.wait(timeout)
-
- output = process.stdout.read().decode(encoding="gbk")
- error = process.stderr.read().decode(encoding="gbk")
-
- return output, error
-
-# return list after run
-def runRetList(command, timeout=10, first=True):
- output,error = run(command, timeout)
- if first:
- return output.splitlines()
- else:
- return error.splitlines()
-
-
def readFileContext(filename):
file = open(filename)
context = file.read()
@@ -78,6 +56,27 @@ def appendFileContext(filename, context):
except:
print(f"appand file error context={context} .")
+# run return output and error
+def run(command, show=True):
+ # out to file
+ out = "out.txt"
+ err = "err.txt"
+ ret = exec(command + f" 1>{out} 2>{err}", True)
+
+ # read from file
+ output = readFileContext(out)
+ error = readFileContext(err)
+
+ return output, error
+
+# return list after run
+def runRetList(command, first=True):
+ output,error = run(command)
+ if first:
+ return output.splitlines()
+ else:
+ return error.splitlines()
+
def getFolderSize(folder):
total_size = 0
for dirpath, dirnames, filenames in os.walk(folder):
@@ -134,8 +133,6 @@ def getMatch(datatype, algo):
def generateJsonFile(stmt, interlace):
- print(f"doTest stmt: {stmt} interlace_rows={interlace}\n")
-
# replace datatype
context = readFileContext(templateFile)
# replace compress
@@ -204,9 +201,16 @@ def writeTemplateInfo(resultFile):
insertRows = findContextValue(context, "insert_rows")
bindVGroup = findContextValue(context, "thread_bind_vgroup")
nThread = findContextValue(context, "thread_count")
+ batch = findContextValue(context, "num_of_records_per_req")
+
if bindVGroup.lower().find("yes") != -1:
nThread = vgroups
- line = f"thread_bind_vgroup = {bindVGroup}\nvgroups = {vgroups}\nchildtable_count = {childCount}\ninsert_rows = {insertRows}\ninsertThreads = {nThread} \n\n"
+ line = f"thread_bind_vgroup = {bindVGroup}\n"
+ line += f"vgroups = {vgroups}\n"
+ line += f"childtable_count = {childCount}\n"
+ line += f"insert_rows = {insertRows}\n"
+ line += f"insertThreads = {nThread}\n"
+ line += f"batchSize = {batch}\n\n"
print(line)
appendFileContext(resultFile, line)
@@ -247,14 +251,8 @@ def totalCompressRate(stmt, interlace, resultFile, spent, spentReal, writeSpeed,
# %("No", "stmtMode", "interlaceRows", "spent", "spent-real", "writeSpeed", "write-real", "query-QPS", "dataSize", "rate")
Number += 1
- '''
- context = "%2s %6s %10s %10s %10s %15s %15s %16s %16s %16s %16s %16s %8s %8s %8s\n"%(
- Number, stmt, interlace, spent + "s", spentReal + "s", writeSpeed + " rows/s", writeReal + " rows/s",
- min, avg, p90, p99, max,
- querySpeed, str(totalSize) + " MB", rate + "%")
- '''
context = "%2s %8s %10s %10s %16s %16s %12s %12s %12s %12s %12s %12s %10s %10s %10s\n"%(
- Number, stmt, interlace, spent + "s", spentReal + "s", writeSpeed + "r/s", writeReal + "r/s",
+ Number, stmt, interlace, spent + "s", spentReal + "s", writeSpeed + " r/s", writeReal + " r/s",
min, avg, p90, p99, max + "ms",
querySpeed, str(totalSize) + " MB", rate + "%")
@@ -323,7 +321,7 @@ def testWrite(jsonFile):
def testQuery():
command = f"taosBenchmark -f json/query.json"
- lines = runRetList(command, 60000)
+ lines = runRetList(command)
# INFO: Spend 6.7350 second completed total queries: 10, the QPS of all threads: 1.485
speed = None
diff --git a/tools/auto/testCompression/json/query.json b/tools/auto/testCompression/json/query.json
index e810c1009f..12bba6af9b 100644
--- a/tools/auto/testCompression/json/query.json
+++ b/tools/auto/testCompression/json/query.json
@@ -8,15 +8,14 @@
"confirm_parameter_prompt": "no",
"continue_if_fail": "yes",
"databases": "dbrate",
- "query_times": 20,
+ "query_times": 5,
"query_mode": "taosc",
"specified_table_query": {
"query_interval": 0,
- "concurrent": 10,
+ "threads": 10,
"sqls": [
{
- "sql": "select * from meters",
- "result": "./query_res0.txt"
+ "sql": "select * from meters"
}
]
}
diff --git a/tools/auto/testCompression/testCompression.py b/tools/auto/testCompression/testCompression.py
index ee922a1a23..4314817067 100644
--- a/tools/auto/testCompression/testCompression.py
+++ b/tools/auto/testCompression/testCompression.py
@@ -34,28 +34,6 @@ def exec(command, show=True):
print(f"exec {command}\n")
return os.system(command)
-# run return output and error
-def run(command, timeout = 60, show=True):
- if(show):
- print(f"run {command} timeout={timeout}s\n")
-
- process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- process.wait(timeout)
-
- output = process.stdout.read().decode(encoding="gbk")
- error = process.stderr.read().decode(encoding="gbk")
-
- return output, error
-
-# return list after run
-def runRetList(command, timeout=10, first=True):
- output,error = run(command, timeout)
- if first:
- return output.splitlines()
- else:
- return error.splitlines()
-
-
def readFileContext(filename):
file = open(filename)
context = file.read()
@@ -78,6 +56,27 @@ def appendFileContext(filename, context):
except:
print(f"appand file error context={context} .")
+# run return output and error
+def run(command, show=True):
+ # out to file
+ out = "out.txt"
+ err = "err.txt"
+ ret = exec(command + f" 1>{out} 2>{err}", True)
+
+ # read from file
+ output = readFileContext(out)
+ error = readFileContext(err)
+
+ return output, error
+
+# return list after run
+def runRetList(command, first=True):
+ output,error = run(command)
+ if first:
+ return output.splitlines()
+ else:
+ return error.splitlines()
+
def getFolderSize(folder):
total_size = 0
for dirpath, dirnames, filenames in os.walk(folder):
@@ -196,48 +195,55 @@ def findContextValue(context, label):
def writeTemplateInfo(resultFile):
# create info
context = readFileContext(templateFile)
+ dbname = findContextValue(context, "name")
vgroups = findContextValue(context, "vgroups")
childCount = findContextValue(context, "childtable_count")
insertRows = findContextValue(context, "insert_rows")
line = f"vgroups = {vgroups}\nchildtable_count = {childCount}\ninsert_rows = {insertRows}\n\n"
print(line)
appendFileContext(resultFile, line)
+ return dbname
def totalCompressRate(algo, resultFile, writeSpeed, querySpeed):
global Number
- # flush
- command = 'taos -s "flush database dbrate;"'
- rets = exec(command)
- command = 'taos -s "compact database dbrate;"'
- rets = exec(command)
- waitCompactFinish(60)
+ loop = 30
- # read compress rate
- command = 'taos -s "show table distributed dbrate.meters\G;"'
- rets = runRetList(command)
- print(rets)
- str1 = rets[5]
- arr = str1.split(" ")
+ while loop > 0:
+ loop -= 1
- # Total_Size KB
- str2 = arr[2]
- pos = str2.find("=[")
- totalSize = int(float(str2[pos+2:])/1024)
+ # flush database
+ command = 'taos -s "flush database dbrate;"'
+ exec(command)
+ time.sleep(1)
- # Compression_Ratio
- str2 = arr[6]
- pos = str2.find("=[")
- rate = str2[pos+2:]
- print("rate =" + rate)
+ # read compress rate
+ command = 'taos -s "show table distributed dbrate.meters\G;"'
+ rets = runRetList(command)
+ print(rets)
- # total data file size
- #dataSize = getFolderSize(f"{dataDir}/vnode/")
- #dataSizeMB = int(dataSize/1024/1024)
+ str1 = rets[5]
+ arr = str1.split(" ")
- # appand to file
-
+ # Total_Size KB
+ str2 = arr[2]
+ pos = str2.find("=[")
+ totalSize = int(float(str2[pos+2:])/1024)
+
+ # Compression_Ratio
+ str2 = arr[6]
+ pos = str2.find("=[")
+ rate = str2[pos+2:]
+ print("rate =" + rate)
+ if rate != "0.00":
+ break
+
+ # total data file size
+ #dataSize = getFolderSize(f"{dataDir}/vnode/")
+ #dataSizeMB = int(dataSize/1024/1024)
+
+ # appand to file
Number += 1
context = "%10s %10s %10s %10s %30s %15s\n"%( Number, algo, str(totalSize)+" MB", rate+"%", writeSpeed + " Records/second", querySpeed)
showLog(context)
@@ -269,11 +275,15 @@ def testWrite(jsonFile):
speed = context[pos: end]
#print(f"write pos ={pos} end={end} speed={speed}\n output={context} \n")
+
+ # flush database
+ command = 'taos -s "flush database dbrate;"'
+ exec(command)
return speed
def testQuery():
command = f"taosBenchmark -f json/query.json"
- lines = runRetList(command, 60000)
+ lines = runRetList(command)
# INFO: Spend 6.7350 second completed total queries: 10, the QPS of all threads: 1.485
speed = None
@@ -296,7 +306,6 @@ def testQuery():
def doTest(algo, resultFile):
print(f"doTest algo: {algo} \n")
- #cleanAndStartTaosd()
# json
jsonFile = generateJsonFile(algo)
diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c
index 1d8d82ccb9..55fa336221 100644
--- a/utils/test/c/sml_test.c
+++ b/utils/test/c/sml_test.c
@@ -2130,6 +2130,7 @@ int sml_ts5528_test(){
printf("%s result success\n", __FUNCTION__);
return 0;
}
+
int main(int argc, char *argv[]) {
if (argc == 2) {
taos_options(TSDB_OPTION_CONFIGDIR, argv[1]);
diff --git a/utils/test/c/tmqSim.c b/utils/test/c/tmqSim.c
index e2a09c4259..c045629d1f 100644
--- a/utils/test/c/tmqSim.c
+++ b/utils/test/c/tmqSim.c
@@ -1275,10 +1275,10 @@ void* ombProduceThreadFunc(void* param) {
msgsOfSql = remainder;
}
int len = 0;
- len += snprintf(sqlBuf + len, MAX_SQL_LEN - len, "insert into %s values ", ctbName);
+ len += tsnprintf(sqlBuf + len, MAX_SQL_LEN - len, "insert into %s values ", ctbName);
for (int j = 0; j < msgsOfSql; j++) {
int64_t timeStamp = taosGetTimestampNs();
- len += snprintf(sqlBuf + len, MAX_SQL_LEN - len, "(%" PRId64 ", \"%s\")", timeStamp, g_payload);
+ len += tsnprintf(sqlBuf + len, MAX_SQL_LEN - len, "(%" PRId64 ", \"%s\")", timeStamp, g_payload);
sendMsgs++;
pInfo->totalProduceMsgs++;
}