diff --git a/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md b/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md
index bee3d99b26..4563b5b5fc 100644
--- a/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md
+++ b/documentation20/webdocs/markdowndocs/TAOS SQL-ch.md
@@ -121,6 +121,7 @@ TDengine缺省的时间戳是毫秒精度,但通过修改配置参数enableMic
**Tips**: 以上所有参数修改后都可以用show databases来确认是否修改成功。
- **显示系统所有数据库**
+
```mysql
SHOW DATABASES;
```
@@ -742,7 +743,7 @@ TDengine支持针对数据的聚合查询。提供支持的聚合和选择函数
应用字段:不能应用在timestamp、binary、nchar、bool类型字段。
- 适用于:表。
+ 适用于:表。(从 2.0.15 版本开始,本函数也支持超级表)
示例:
```mysql
@@ -1156,7 +1157,7 @@ SELECT AVG(current), MAX(current), LEASTSQUARES(current, start_val, step_val), P
- 数据库名最大长度为32
- 表名最大长度为192,每行数据最大长度16k个字符
- 列名最大长度为64,最多允许1024列,最少需要2列,第一列必须是时间戳
-- 标签最多允许128个,可以0个,标签总长度不超过16k个字符
+- 标签最多允许128个,可以1个,标签总长度不超过16k个字符
- SQL语句最大长度65480个字符,但可通过系统配置参数maxSQLLength修改,最长可配置为1M
- 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制
diff --git a/documentation20/webdocs/markdowndocs/architecture-ch.md b/documentation20/webdocs/markdowndocs/architecture-ch.md
index 47fb8094b7..773d8196f2 100644
--- a/documentation20/webdocs/markdowndocs/architecture-ch.md
+++ b/documentation20/webdocs/markdowndocs/architecture-ch.md
@@ -248,7 +248,7 @@ Master Vnode遵循下面的写入流程:
1. Master vnode收到应用的数据插入请求,验证OK,进入下一步;
2. 如果系统配置参数walLevel大于0,vnode将把该请求的原始数据包写入数据库日志文件WAL。如果walLevel设置为2,而且fsync设置为0,TDengine还将WAL数据立即落盘,以保证即使宕机,也能从数据库日志文件中恢复数据,避免数据的丢失;
3. 如果有多个副本,vnode将把数据包转发给同一虚拟节点组内slave vnodes, 该转发包带有数据的版本号(version);
-4. 写入内存,并加记录加入到skip list;
+4. 写入内存,并将记录加入到skip list;
5. Master vnode返回确认信息给应用,表示写入成功。
6. 如果第2,3,4步中任何一步失败,将直接返回错误给应用。
@@ -372,7 +372,7 @@ select count(*) from d1001 interval(1h);
select count(*) from d1001 interval(1h) fill(prev);
```
-针对d1001设备采集数据统计每小时记录数,如果某一个小时不存在数据,这返回之前一个小时的统计数据。TDengine提供前向插值(prev)、线性插值(linear)、NULL值填充(NULL)、特定值填充(value)。
+针对d1001设备采集数据统计每小时记录数,如果某一个小时不存在数据,则返回之前一个小时的统计数据。TDengine提供前向插值(prev)、线性插值(linear)、NULL值填充(NULL)、特定值填充(value)。
### 多表聚合查询
TDengine对每个数据采集点单独建表,但在实际应用中经常需要对不同的采集点数据进行聚合。为高效的进行聚合操作,TDengine引入超级表(STable)的概念。超级表用来代表一特定类型的数据采集点,它是包含多张表的表集合,集合里每张表的模式(schema)完全一致,但每张表都带有自己的静态标签,标签可以多个,可以随时增加、删除和修改。 应用可通过指定标签的过滤条件,对一个STable下的全部或部分表进行聚合或统计操作,这样大大简化应用的开发。其具体流程如下图所示:
diff --git a/documentation20/webdocs/markdowndocs/cluster-ch.md b/documentation20/webdocs/markdowndocs/cluster-ch.md
index 3d53f3a86b..f3f6f2b300 100644
--- a/documentation20/webdocs/markdowndocs/cluster-ch.md
+++ b/documentation20/webdocs/markdowndocs/cluster-ch.md
@@ -227,5 +227,5 @@ SHOW MNODES;
如果副本数为偶数,当一个vnode group里一半vnode不工作时,是无法从中选出master的。同理,一半mnode不工作时,是无法选出mnode的master的,因为存在“split brain”问题。为解决这个问题,TDengine引入了arbitrator的概念。Arbitrator模拟一个vnode或mnode在工作,但只简单的负责网络连接,不处理任何数据插入或访问。只要包含arbitrator在内,超过半数的vnode或mnode工作,那么该vnode group或mnode组就可以正常的提供数据插入或查询服务。比如对于副本数为2的情形,如果一个节点A离线,但另外一个节点B正常,而且能连接到arbitrator, 那么节点B就能正常工作。
-TDengine提供一个执行程序tarbitrator, 找任何一台Linux服务器运行它即可。请点击[安装包下载](https://www.taosdata.com/cn/all-downloads/),在TDengine Arbitrator Linux一节中,选择适合的版本下载并安装。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6042。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为arbitrator的End Point。如果该参数配置了,当副本数为偶数数,系统将自动连接配置的arbitrator。如果副本数为奇数,即使配置了arbitrator, 系统也不会去建立连接。
+TDengine提供一个执行程序tarbitrator, 找任何一台Linux服务器运行它即可。请点击[安装包下载](https://www.taosdata.com/cn/all-downloads/),在TDengine Arbitrator Linux一节中,选择适合的版本下载并安装。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6042。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为arbitrator的End Point。如果该参数配置了,当副本数为偶数时,系统将自动连接配置的arbitrator。如果副本数为奇数,即使配置了arbitrator, 系统也不会去建立连接。
diff --git a/documentation20/webdocs/markdowndocs/cluster.md b/documentation20/webdocs/markdowndocs/cluster.md
index 08206a85a8..8cf7065f72 100644
--- a/documentation20/webdocs/markdowndocs/cluster.md
+++ b/documentation20/webdocs/markdowndocs/cluster.md
@@ -141,6 +141,6 @@ SHOW MNODES;
如果副本数为偶数,当一个vnode group里一半vnode不工作时,是无法从中选出master的。同理,一半mnode不工作时,是无法选出mnode的master的,因为存在“split brain”问题。为解决这个问题,TDengine引入了arbitrator的概念。Arbitrator模拟一个vnode或mnode在工作,但只简单的负责网络连接,不处理任何数据插入或访问。只要包含arbitrator在内,超过半数的vnode或mnode工作,那么该vnode group或mnode组就可以正常的提供数据插入或查询服务。比如对于副本数为2的情形,如果一个节点A离线,但另外一个节点B正常,而且能连接到arbitrator, 那么节点B就能正常工作。
-TDengine安装包里带有一个执行程序tarbitrator, 找任何一台Linux服务器运行它即可。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6030。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为Arbitrator的End Point。如果该参数配置了,当副本数为偶数数,系统将自动连接配置的Arbitrator。
+TDengine安装包里带有一个执行程序tarbitrator, 找任何一台Linux服务器运行它即可。该程序对系统资源几乎没有要求,只需要保证有网络连接即可。该应用的命令行参数`-p`可以指定其对外服务的端口号,缺省是6030。配置每个taosd实例时,可以在配置文件taos.cfg里将参数arbitrator设置为Arbitrator的End Point。如果该参数配置了,当副本数为偶数时,系统将自动连接配置的Arbitrator。
在配置了Arbitrator的情况下,它也会显示在“show dnodes;”指令给出的节点列表中。
diff --git a/documentation20/webdocs/markdowndocs/connector-ch.md b/documentation20/webdocs/markdowndocs/connector-ch.md
index da9c2e5a11..bcaabe3c0a 100644
--- a/documentation20/webdocs/markdowndocs/connector-ch.md
+++ b/documentation20/webdocs/markdowndocs/connector-ch.md
@@ -288,13 +288,6 @@ C/C++的API类似于MySQL的C API。应用程序使用时,需要包含TDengine
* res:`taos_query_a`回调时返回的结果集
* fp:回调函数。其参数`param`是用户可定义的传递给回调函数的参数结构体;`numOfRows`是获取到的数据的行数(不是整个查询结果集的函数)。 在回调函数中,应用可以通过调用`taos_fetch_row`前向迭代获取批量记录中每一行记录。读完一块内的所有记录后,应用需要在回调函数中继续调用`taos_fetch_rows_a`获取下一批记录进行处理,直到返回的记录数(numOfRows)为零(结果返回完成)或记录数为负值(查询出错)。
-- `void taos_fetch_row_a(TAOS_RES *res, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row), void *param);`
-
- 异步获取一条记录。其中:
-
- * res:`taos_query_a`回调时返回的结果集
- * fp:回调函数。其参数`param`是应用提供的一个用于回调的参数。回调时,第三个参数`row`指向一行记录。不同于`taos_fetch_rows_a`,应用无需调用`taos_fetch_row`来获取一行数据,更加简单,但数据提取性能不及批量获取的API。
-
TDengine的异步API均采用非阻塞调用模式。应用程序可以用多线程同时打开多张表,并可以同时对每张打开的表进行查询或者插入操作。需要指出的是,**客户端应用必须确保对同一张表的操作完全串行化**,即对同一个表的插入或查询操作未完成时(未返回时),不能够执行第二个插入或查询操作。
### 参数绑定API
diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg
index 4aefc2f449..2908a8a21e 100644
--- a/packaging/cfg/taos.cfg
+++ b/packaging/cfg/taos.cfg
@@ -36,6 +36,9 @@
# 0.0: only one core available.
# tsRatioOfQueryCores 1.0
+# the last_row/first/last aggregator will not change the original column name in the result fields
+# keepColumnName 0
+
# number of management nodes in the system
# numOfMnodes 3
diff --git a/src/client/inc/tscLog.h b/src/client/inc/tscLog.h
index 5273a87ea0..f25ec02bd8 100644
--- a/src/client/inc/tscLog.h
+++ b/src/client/inc/tscLog.h
@@ -13,8 +13,8 @@
* along with this program. If not, see .
*/
-#ifndef TDENGINE_TSC_LOG_H
-#define TDENGINE_TSC_LOG_H
+#ifndef TDENGINE_TSCLOG_H
+#define TDENGINE_TSCLOG_H
#ifdef __cplusplus
extern "C" {
@@ -22,7 +22,7 @@ extern "C" {
#include "tlog.h"
-extern int32_t cDebugFlag;
+extern uint32_t cDebugFlag;
extern int8_t tscEmbedded;
#define tscFatal(...) do { if (cDebugFlag & DEBUG_FATAL) { taosPrintLog("TSC FATAL ", tscEmbedded ? 255 : cDebugFlag, __VA_ARGS__); }} while(0)
diff --git a/src/client/inc/tscSubquery.h b/src/client/inc/tscSubquery.h
index 43c9b009bf..e1370513ef 100644
--- a/src/client/inc/tscSubquery.h
+++ b/src/client/inc/tscSubquery.h
@@ -13,8 +13,8 @@
* along with this program. If not, see .
*/
-#ifndef TDENGINE_TSCJOINPROCESS_H
-#define TDENGINE_TSCJOINPROCESS_H
+#ifndef TDENGINE_TSCSUBQUERY_H
+#define TDENGINE_TSCSUBQUERY_H
#ifdef __cplusplus
extern "C" {
@@ -47,9 +47,8 @@ void tscLockByThread(int64_t *lockedBy);
void tscUnlockByThread(int64_t *lockedBy);
-
#ifdef __cplusplus
}
#endif
-#endif // TDENGINE_TSCJOINPROCESS_H
+#endif // TDENGINE_TSCSUBQUERY_H
diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h
index 8d82c65cee..633512e324 100644
--- a/src/client/inc/tscUtil.h
+++ b/src/client/inc/tscUtil.h
@@ -110,7 +110,7 @@ void* tscDestroyBlockArrayList(SArray* pDataBlockList);
void* tscDestroyBlockHashTable(SHashObj* pBlockHashTable);
int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock);
-int32_t tscMergeTableDataBlocks(SSqlObj* pSql);
+int32_t tscMergeTableDataBlocks(SSqlObj* pSql, bool freeBlockMap);
int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, int32_t startOffset, int32_t rowSize, const char* tableId, STableMeta* pTableMeta,
STableDataBlocks** dataBlocks, SArray* pBlockList);
@@ -256,11 +256,11 @@ void tscSVgroupInfoCopy(SVgroupInfo* dst, const SVgroupInfo* src);
* @param pPrevSql
* @return
*/
-SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cmd);
+SSqlObj* createSimpleSubObj(SSqlObj* pSql, __async_cb_func_t fp, void* param, int32_t cmd);
void registerSqlObj(SSqlObj* pSql);
-SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void* param, int32_t cmd, SSqlObj* pPrevSql);
+SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t fp, void* param, int32_t cmd, SSqlObj* pPrevSql);
void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClauseIndex, int32_t tableIndex);
void doAddGroupColumnForSubquery(SQueryInfo* pQueryInfo, int32_t tagIndex);
diff --git a/src/client/inc/tschemautil.h b/src/client/inc/tschemautil.h
index c881a7a763..a9dcd230a6 100644
--- a/src/client/inc/tschemautil.h
+++ b/src/client/inc/tschemautil.h
@@ -24,10 +24,6 @@ extern "C" {
#include "tstoken.h"
#include "tsclient.h"
-#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS)
-
-#define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS)
-
/**
* get the number of tags of this table
* @param pTableMeta
@@ -79,26 +75,6 @@ SSchema *tscGetTableColumnSchema(const STableMeta *pMeta, int32_t colIndex);
*/
SSchema* tscGetColumnSchemaById(STableMeta* pTableMeta, int16_t colId);
-/**
- * check if the schema is valid or not, including following aspects:
- * 1. number of columns
- * 2. column types
- * 3. column length
- * 4. column names
- * 5. total length
- *
- * @param pSchema
- * @param numOfCols
- * @return
- */
-bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags);
-
-/**
- * get the schema for the "tbname" column. it is a built column
- * @return
- */
-SSchema tscGetTbnameColumnSchema();
-
/**
* create the table meta from the msg
* @param pTableMetaMsg
diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h
index 900fab53a2..085791e45c 100644
--- a/src/client/inc/tsclient.h
+++ b/src/client/inc/tsclient.h
@@ -235,7 +235,7 @@ typedef struct {
int32_t numOfTablesInSubmit;
};
- uint32_t insertType;
+ uint32_t insertType; // TODO remove it
int32_t clauseIndex; // index of multiple subclause query
char * curSql; // current sql, resume position of sql after parsing paused
@@ -317,7 +317,8 @@ typedef struct STscObj {
} STscObj;
typedef struct SSubqueryState {
- int32_t numOfRemain; // the number of remain unfinished subquery
+ pthread_mutex_t mutex;
+ int8_t *states;
int32_t numOfSub; // the number of total sub-queries
uint64_t numOfRetrievedRows; // total number of points in this query
} SSubqueryState;
@@ -327,8 +328,8 @@ typedef struct SSqlObj {
pthread_t owner; // owner of sql object, by which it is executed
STscObj *pTscObj;
int64_t rpcRid;
- void (*fp)();
- void (*fetchFp)();
+ __async_cb_func_t fp;
+ __async_cb_func_t fetchFp;
void *param;
int64_t stime;
uint32_t queryId;
@@ -463,7 +464,7 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField
pRes->length[columnIndex] = pInfo->pSqlExpr->param[1].nLen;
pRes->tsrow[columnIndex] = (pInfo->pSqlExpr->param[1].nType == TSDB_DATA_TYPE_NULL) ? NULL : (unsigned char*)pData;
} else {
- assert(bytes == tDataTypeDesc[type].nSize);
+ assert(bytes == tDataTypes[type].bytes);
pRes->tsrow[columnIndex] = isNull(pData, type) ? NULL : (unsigned char*)&pInfo->pSqlExpr->param[1].i64;
pRes->length[columnIndex] = bytes;
@@ -480,7 +481,7 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField
pRes->length[columnIndex] = realLen;
} else {
- assert(bytes == tDataTypeDesc[type].nSize);
+ assert(bytes == tDataTypes[type].bytes);
pRes->tsrow[columnIndex] = isNull(pData, type) ? NULL : (unsigned char*)pData;
pRes->length[columnIndex] = bytes;
diff --git a/src/client/src/taos.def b/src/client/src/taos.def
index 49d7290ce7..43cd819061 100644
--- a/src/client/src/taos.def
+++ b/src/client/src/taos.def
@@ -32,7 +32,6 @@ taos_errstr
taos_errno
taos_query_a
taos_fetch_rows_a
-taos_fetch_row_a
taos_subscribe
taos_consume
taos_unsubscribe
diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c
index 37207858a8..4eae2b7a87 100644
--- a/src/client/src/tscAsync.c
+++ b/src/client/src/tscAsync.c
@@ -20,24 +20,19 @@
#include "trpc.h"
#include "tscLog.h"
#include "tscSubquery.h"
-#include "tscLocalMerge.h"
#include "tscUtil.h"
#include "tsched.h"
#include "tschemautil.h"
#include "tsclient.h"
-static void tscProcessFetchRow(SSchedMsg *pMsg);
static void tscAsyncQueryRowsForNextVnode(void *param, TAOS_RES *tres, int numOfRows);
-static void tscProcessAsyncRetrieveImpl(void *param, TAOS_RES *tres, int numOfRows, void (*fp)());
-
/*
* Proxy function to perform sequentially query&retrieve operation.
* If sql queries upon a super table and two-stage merge procedure is not involved (when employ the projection
* query), it will sequentially query&retrieve data for all vnodes
*/
static void tscAsyncFetchRowsProxy(void *param, TAOS_RES *tres, int numOfRows);
-static void tscAsyncFetchSingleRowProxy(void *param, TAOS_RES *tres, int numOfRows);
void doAsyncQuery(STscObj* pObj, SSqlObj* pSql, __async_cb_func_t fp, void* param, const char* sqlstr, size_t sqlLen) {
SSqlCmd* pCmd = &pSql->cmd;
@@ -148,7 +143,7 @@ static void tscAsyncFetchRowsProxy(void *param, TAOS_RES *tres, int numOfRows) {
}
// actual continue retrieve function with user-specified callback function
-static void tscProcessAsyncRetrieveImpl(void *param, TAOS_RES *tres, int numOfRows, void (*fp)()) {
+static void tscProcessAsyncRetrieveImpl(void *param, TAOS_RES *tres, int numOfRows, __async_cb_func_t fp) {
SSqlObj *pSql = (SSqlObj *)tres;
if (pSql == NULL) { // error
tscError("sql object is NULL");
@@ -191,11 +186,6 @@ static void tscAsyncQueryRowsForNextVnode(void *param, TAOS_RES *tres, int numOf
tscProcessAsyncRetrieveImpl(param, tres, numOfRows, tscAsyncFetchRowsProxy);
}
-void tscAsyncQuerySingleRowForNextVnode(void *param, TAOS_RES *tres, int numOfRows) {
- // query completed, continue to retrieve
- tscProcessAsyncRetrieveImpl(param, tres, numOfRows, tscAsyncFetchSingleRowProxy);
-}
-
void taos_fetch_rows_a(TAOS_RES *taosa, __async_cb_func_t fp, void *param) {
SSqlObj *pSql = (SSqlObj *)taosa;
if (pSql == NULL || pSql->signature != pSql) {
@@ -263,103 +253,6 @@ void taos_fetch_rows_a(TAOS_RES *taosa, __async_cb_func_t fp, void *param) {
}
}
-void taos_fetch_row_a(TAOS_RES *taosa, void (*fp)(void *, TAOS_RES *, TAOS_ROW), void *param) {
- SSqlObj *pSql = (SSqlObj *)taosa;
- if (pSql == NULL || pSql->signature != pSql) {
- tscError("sql object is NULL");
- tscQueueAsyncError(fp, param, TSDB_CODE_TSC_DISCONNECTED);
- return;
- }
-
- SSqlRes *pRes = &pSql->res;
- SSqlCmd *pCmd = &pSql->cmd;
-
- if (pRes->qhandle == 0) {
- tscError("qhandle is NULL");
- pSql->param = param;
- pRes->code = TSDB_CODE_TSC_INVALID_QHANDLE;
-
- tscAsyncResultOnError(pSql);
- return;
- }
-
- pSql->fetchFp = fp;
- pSql->param = param;
-
- if (pRes->row >= pRes->numOfRows) {
- tscResetForNextRetrieve(pRes);
- pSql->fp = tscAsyncFetchSingleRowProxy;
-
- if (pCmd->command != TSDB_SQL_RETRIEVE_LOCALMERGE && pCmd->command < TSDB_SQL_LOCAL) {
- pCmd->command = (pCmd->command > TSDB_SQL_MGMT) ? TSDB_SQL_RETRIEVE : TSDB_SQL_FETCH;
- }
-
- tscProcessSql(pSql);
- } else {
- SSchedMsg schedMsg = { 0 };
- schedMsg.fp = tscProcessFetchRow;
- schedMsg.ahandle = pSql;
- schedMsg.thandle = pRes->tsrow;
- schedMsg.msg = NULL;
- taosScheduleTask(tscQhandle, &schedMsg);
- }
-}
-
-void tscAsyncFetchSingleRowProxy(void *param, TAOS_RES *tres, int numOfRows) {
- SSqlObj *pSql = (SSqlObj *)tres;
- SSqlRes *pRes = &pSql->res;
- SSqlCmd *pCmd = &pSql->cmd;
-
- SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
-
- if (numOfRows == 0) {
- if (hasMoreVnodesToTry(pSql)) { // sequentially retrieve data from remain vnodes.
- tscTryQueryNextVnode(pSql, tscAsyncQuerySingleRowForNextVnode);
- } else {
- /*
- * 1. has reach the limitation
- * 2. no remain virtual nodes to be retrieved anymore
- */
- (*pSql->fetchFp)(pSql->param, pSql, NULL);
- }
- return;
- }
-
- for (int i = 0; i < pCmd->numOfCols; ++i){
- SInternalField* pSup = taosArrayGet(pQueryInfo->fieldsInfo.internalField, i);
- if (pSup->pSqlExpr != NULL) {
-// pRes->tsrow[i] = TSC_GET_RESPTR_BASE(pRes, pQueryInfo, i) + pSup->pSqlExpr->resBytes * pRes->row;
- } else {
- //todo add
- }
- }
-
- pRes->row++;
-
- (*pSql->fetchFp)(pSql->param, pSql, pSql->res.tsrow);
-}
-
-void tscProcessFetchRow(SSchedMsg *pMsg) {
- SSqlObj *pSql = (SSqlObj *)pMsg->ahandle;
- SSqlRes *pRes = &pSql->res;
- SSqlCmd *pCmd = &pSql->cmd;
-
- SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
-
- for (int i = 0; i < pCmd->numOfCols; ++i) {
- SInternalField* pSup = taosArrayGet(pQueryInfo->fieldsInfo.internalField, i);
-
- if (pSup->pSqlExpr != NULL) {
- tscGetResultColumnChr(pRes, &pQueryInfo->fieldsInfo, i, 0);
- } else {
-// todo add
- }
- }
-
- pRes->row++;
- (*pSql->fetchFp)(pSql->param, pSql, pRes->tsrow);
-}
-
// this function will be executed by queue task threads, so the terrno is not valid
static void tscProcessAsyncError(SSchedMsg *pMsg) {
void (*fp)() = pMsg->ahandle;
@@ -372,7 +265,7 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) {
int32_t* c = malloc(sizeof(int32_t));
*c = code;
- SSchedMsg schedMsg = { 0 };
+ SSchedMsg schedMsg = {0};
schedMsg.fp = tscProcessAsyncError;
schedMsg.ahandle = fp;
schedMsg.thandle = param;
@@ -380,7 +273,6 @@ void tscQueueAsyncError(void(*fp), void *param, int32_t code) {
taosScheduleTask(tscQhandle, &schedMsg);
}
-
void tscAsyncResultOnError(SSqlObj *pSql) {
if (pSql == NULL || pSql->signature != pSql) {
tscDebug("%p SqlObj is freed, not add into queue async res", pSql);
diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c
index 48380f8641..599fa86460 100644
--- a/src/client/src/tscLocal.c
+++ b/src/client/src/tscLocal.c
@@ -79,7 +79,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
char* dst = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 0) * totalNumOfRows + pField->bytes * i;
STR_WITH_MAXSIZE_TO_VARSTR(dst, pSchema[i].name, pField->bytes);
- char *type = tDataTypeDesc[pSchema[i].type].aName;
+ char *type = tDataTypes[pSchema[i].type].name;
pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 1);
dst = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 1) * totalNumOfRows + pField->bytes * i;
@@ -119,7 +119,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
// type name
pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 1);
- char *type = tDataTypeDesc[pSchema[i].type].aName;
+ char *type = tDataTypes[pSchema[i].type].name;
output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 1) * totalNumOfRows + pField->bytes * i;
STR_WITH_MAXSIZE_TO_VARSTR(output, type, pField->bytes);
@@ -619,9 +619,9 @@ static int32_t tscRebuildDDLForNormalTable(SSqlObj *pSql, const char *tableName,
if (type == TSDB_DATA_TYPE_NCHAR) {
bytes = bytes/TSDB_NCHAR_SIZE;
}
- snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s(%d),", pSchema[i].name, tDataTypeDesc[pSchema[i].type].aName, bytes);
+ snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s(%d),", pSchema[i].name, tDataTypes[pSchema[i].type].name, bytes);
} else {
- snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypeDesc[pSchema[i].type].aName);
+ snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypes[pSchema[i].type].name);
}
}
sprintf(result + strlen(result) - 1, "%s", ")");
@@ -646,9 +646,9 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
if (type == TSDB_DATA_TYPE_NCHAR) {
bytes = bytes/TSDB_NCHAR_SIZE;
}
- snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result),"%s %s(%d),", pSchema[i].name,tDataTypeDesc[pSchema[i].type].aName, bytes);
+ snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result),"%s %s(%d),", pSchema[i].name,tDataTypes[pSchema[i].type].name, bytes);
} else {
- snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypeDesc[type].aName);
+ snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypes[type].name);
}
}
snprintf(result + strlen(result) - 1, TSDB_MAX_BINARY_LEN - strlen(result), "%s %s", ")", "TAGS (");
@@ -660,9 +660,9 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
if (type == TSDB_DATA_TYPE_NCHAR) {
bytes = bytes/TSDB_NCHAR_SIZE;
}
- snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s(%d),", pSchema[i].name,tDataTypeDesc[pSchema[i].type].aName, bytes);
+ snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s(%d),", pSchema[i].name,tDataTypes[pSchema[i].type].name, bytes);
} else {
- snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypeDesc[type].aName);
+ snprintf(result + strlen(result), TSDB_MAX_BINARY_LEN - strlen(result), "%s %s,", pSchema[i].name, tDataTypes[type].name);
}
}
sprintf(result + strlen(result) - 1, "%s", ")");
diff --git a/src/client/src/tscLocalMerge.c b/src/client/src/tscLocalMerge.c
index 4aa751574c..c9c877c043 100644
--- a/src/client/src/tscLocalMerge.c
+++ b/src/client/src/tscLocalMerge.c
@@ -979,14 +979,13 @@ static void doFillResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool doneO
pQueryInfo->limit.offset -= newRows;
pRes->numOfRows = 0;
- int32_t rpoints = taosNumOfRemainRows(pFillInfo);
- if (rpoints <= 0) {
+ if (!taosFillHasMoreResults(pFillInfo)) {
if (!doneOutput) { // reduce procedure has not completed yet, but current results for fill are exhausted
break;
}
// all output in current group are completed
- int32_t totalRemainRows = (int32_t)getNumOfResWithFill(pFillInfo, actualETime, pLocalReducer->resColModel->capacity);
+ int32_t totalRemainRows = (int32_t)getNumOfResultsAfterFillGap(pFillInfo, actualETime, pLocalReducer->resColModel->capacity);
if (totalRemainRows <= 0) {
break;
}
@@ -1337,14 +1336,14 @@ static bool doBuildFilledResultForGroup(SSqlObj *pSql) {
SLocalReducer *pLocalReducer = pRes->pLocalReducer;
SFillInfo *pFillInfo = pLocalReducer->pFillInfo;
- if (pFillInfo != NULL && taosNumOfRemainRows(pFillInfo) > 0) {
+ if (pFillInfo != NULL && taosFillHasMoreResults(pFillInfo)) {
assert(pQueryInfo->fillType != TSDB_FILL_NONE);
tFilePage *pFinalDataBuf = pLocalReducer->pResultBuf;
int64_t etime = *(int64_t *)(pFinalDataBuf->data + TSDB_KEYSIZE * (pFillInfo->numOfRows - 1));
// the first column must be the timestamp column
- int32_t rows = (int32_t) getNumOfResWithFill(pFillInfo, etime, pLocalReducer->resColModel->capacity);
+ int32_t rows = (int32_t) getNumOfResultsAfterFillGap(pFillInfo, etime, pLocalReducer->resColModel->capacity);
if (rows > 0) { // do fill gap
doFillResult(pSql, pLocalReducer, false);
}
@@ -1373,7 +1372,7 @@ static bool doHandleLastRemainData(SSqlObj *pSql) {
((pRes->numOfRowsGroup < pQueryInfo->limit.limit && pQueryInfo->limit.limit > 0) || (pQueryInfo->limit.limit < 0))) {
int64_t etime = (pQueryInfo->order.order == TSDB_ORDER_ASC)? pQueryInfo->window.ekey : pQueryInfo->window.skey;
- int32_t rows = (int32_t)getNumOfResWithFill(pFillInfo, etime, pLocalReducer->resColModel->capacity);
+ int32_t rows = (int32_t)getNumOfResultsAfterFillGap(pFillInfo, etime, pLocalReducer->resColModel->capacity);
if (rows > 0) {
doFillResult(pSql, pLocalReducer, true);
}
@@ -1428,6 +1427,10 @@ int32_t tscDoLocalMerge(SSqlObj *pSql) {
tscResetForNextRetrieve(pRes);
if (pSql->signature != pSql || pRes == NULL || pRes->pLocalReducer == NULL) { // all data has been processed
+ if (pRes->code == TSDB_CODE_SUCCESS) {
+ return pRes->code;
+ }
+
tscError("%p local merge abort due to error occurs, code:%s", pSql, tstrerror(pRes->code));
return pRes->code;
}
diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c
index 7151c33393..0c7af5d4e3 100644
--- a/src/client/src/tscParseInsert.c
+++ b/src/client/src/tscParseInsert.c
@@ -1281,7 +1281,7 @@ int tsParseInsertSql(SSqlObj *pSql) {
}
if (taosHashGetSize(pCmd->pTableBlockHashList) > 0) { // merge according to vgId
- if ((code = tscMergeTableDataBlocks(pSql)) != TSDB_CODE_SUCCESS) {
+ if ((code = tscMergeTableDataBlocks(pSql, true)) != TSDB_CODE_SUCCESS) {
goto _clean;
}
}
@@ -1336,15 +1336,6 @@ int tsParseSql(SSqlObj *pSql, bool initial) {
}
if (tscIsInsertData(pSql->sqlstr)) {
- /*
- * Set the fp before parse the sql string, in case of getTableMeta failed, in which
- * the error handle callback function can rightfully restore the user-defined callback function (fp).
- */
- if (initial && (pSql->cmd.insertType != TSDB_QUERY_TYPE_STMT_INSERT)) {
- pSql->fetchFp = pSql->fp;
- pSql->fp = (void(*)())tscHandleMultivnodeInsert;
- }
-
if (initial && ((ret = tsInsertInitialCheck(pSql)) != TSDB_CODE_SUCCESS)) {
return ret;
}
@@ -1398,7 +1389,7 @@ static int doPackSendDataBlock(SSqlObj *pSql, int32_t numOfRows, STableDataBlock
return tscInvalidSQLErrMsg(pCmd->payload, "too many rows in sql, total number of rows should be less than 32767", NULL);
}
- if ((code = tscMergeTableDataBlocks(pSql)) != TSDB_CODE_SUCCESS) {
+ if ((code = tscMergeTableDataBlocks(pSql, true)) != TSDB_CODE_SUCCESS) {
return code;
}
diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c
index 981b354c8a..7c69c16b04 100644
--- a/src/client/src/tscPrepare.c
+++ b/src/client/src/tscPrepare.c
@@ -255,7 +255,6 @@ static char* normalStmtBuildSql(STscStmt* stmt) {
////////////////////////////////////////////////////////////////////////////////
// functions for insertion statement preparation
-
static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
if (bind->is_null != NULL && *(bind->is_null)) {
setNull(data + param->offset, param->type, param->bytes);
@@ -697,71 +696,52 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
static int insertStmtBindParam(STscStmt* stmt, TAOS_BIND* bind) {
SSqlCmd* pCmd = &stmt->pSql->cmd;
- int32_t alloced = 1, binded = 0;
- if (pCmd->batchSize > 0) {
- alloced = (pCmd->batchSize + 1) / 2;
- binded = pCmd->batchSize / 2;
+ STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, 0, 0);
+
+ STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
+ if (pCmd->pTableBlockHashList == NULL) {
+ pCmd->pTableBlockHashList = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false);
}
- size_t size = taosArrayGetSize(pCmd->pDataBlocks);
- for (int32_t i = 0; i < size; ++i) {
- STableDataBlocks* pBlock = taosArrayGetP(pCmd->pDataBlocks, i);
- uint32_t totalDataSize = pBlock->size - sizeof(SSubmitBlk);
- uint32_t dataSize = totalDataSize / alloced;
- assert(dataSize * alloced == totalDataSize);
+ STableDataBlocks* pBlock = NULL;
- if (alloced == binded) {
- totalDataSize += dataSize + sizeof(SSubmitBlk);
- if (totalDataSize > pBlock->nAllocSize) {
- const double factor = 1.5;
- void* tmp = realloc(pBlock->pData, (uint32_t)(totalDataSize * factor));
- if (tmp == NULL) {
- return TSDB_CODE_TSC_OUT_OF_MEMORY;
- }
- pBlock->pData = (char*)tmp;
- pBlock->nAllocSize = (uint32_t)(totalDataSize * factor);
- }
+ int32_t ret =
+ tscGetDataBlockFromList(pCmd->pTableBlockHashList, pTableMeta->id.uid, TSDB_PAYLOAD_SIZE, sizeof(SSubmitBlk),
+ pTableMeta->tableInfo.rowSize, pTableMetaInfo->name, pTableMeta, &pBlock, NULL);
+ if (ret != 0) {
+ // todo handle error
+ }
+
+ uint32_t totalDataSize = sizeof(SSubmitBlk) + pCmd->batchSize * pBlock->rowSize;
+ if (totalDataSize > pBlock->nAllocSize) {
+ const double factor = 1.5;
+
+ void* tmp = realloc(pBlock->pData, (uint32_t)(totalDataSize * factor));
+ if (tmp == NULL) {
+ return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
- char* data = pBlock->pData + sizeof(SSubmitBlk) + dataSize * binded;
- for (uint32_t j = 0; j < pBlock->numOfParams; ++j) {
- SParamInfo* param = pBlock->params + j;
- int code = doBindParam(data, param, bind + param->idx);
- if (code != TSDB_CODE_SUCCESS) {
- tscDebug("param %d: type mismatch or invalid", param->idx);
- return code;
- }
+ pBlock->pData = (char*)tmp;
+ pBlock->nAllocSize = (uint32_t)(totalDataSize * factor);
+ }
+
+ char* data = pBlock->pData + sizeof(SSubmitBlk) + pBlock->rowSize * pCmd->batchSize;
+ for (uint32_t j = 0; j < pBlock->numOfParams; ++j) {
+ SParamInfo* param = &pBlock->params[j];
+
+ int code = doBindParam(data, param, &bind[param->idx]);
+ if (code != TSDB_CODE_SUCCESS) {
+ tscDebug("param %d: type mismatch or invalid", param->idx);
+ return code;
}
}
- // actual work of all data blocks is done, update block size and numOfRows.
- // note we don't do this block by block during the binding process, because
- // we cannot recover if something goes wrong.
- pCmd->batchSize = binded * 2 + 1;
-
- if (binded < alloced) {
- return TSDB_CODE_SUCCESS;
- }
-
- size_t total = taosArrayGetSize(pCmd->pDataBlocks);
- for (int32_t i = 0; i < total; ++i) {
- STableDataBlocks* pBlock = taosArrayGetP(pCmd->pDataBlocks, i);
-
- uint32_t totalDataSize = pBlock->size - sizeof(SSubmitBlk);
- pBlock->size += totalDataSize / alloced;
-
- SSubmitBlk* pSubmit = (SSubmitBlk*)pBlock->pData;
- pSubmit->numOfRows += pSubmit->numOfRows / alloced;
- }
-
return TSDB_CODE_SUCCESS;
}
static int insertStmtAddBatch(STscStmt* stmt) {
SSqlCmd* pCmd = &stmt->pSql->cmd;
- if ((pCmd->batchSize % 2) == 1) {
- ++pCmd->batchSize;
- }
+ ++pCmd->batchSize;
return TSDB_CODE_SUCCESS;
}
@@ -793,50 +773,66 @@ static int insertStmtExecute(STscStmt* stmt) {
if (pCmd->batchSize == 0) {
return TSDB_CODE_TSC_INVALID_VALUE;
}
- if ((pCmd->batchSize % 2) == 1) {
- ++pCmd->batchSize;
- }
- STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
assert(pCmd->numOfClause == 1);
-
- if (taosHashGetSize(pCmd->pTableBlockHashList) > 0) {
- // merge according to vgid
- int code = tscMergeTableDataBlocks(stmt->pSql);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
-
- STableDataBlocks *pDataBlock = taosArrayGetP(pCmd->pDataBlocks, 0);
- code = tscCopyDataBlockToPayload(stmt->pSql, pDataBlock);
- if (code != TSDB_CODE_SUCCESS) {
- return code;
- }
-
- // set the next sent data vnode index in data block arraylist
- pTableMetaInfo->vgroupIndex = 1;
- } else {
- pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks);
+ if (taosHashGetSize(pCmd->pTableBlockHashList) == 0) {
+ return TSDB_CODE_SUCCESS;
}
- SSqlObj *pSql = stmt->pSql;
- SSqlRes *pRes = &pSql->res;
- pRes->numOfRows = 0;
+ STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, 0, 0);
+
+ STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
+ if (pCmd->pTableBlockHashList == NULL) {
+ pCmd->pTableBlockHashList = taosHashInit(16, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, false);
+ }
+
+ STableDataBlocks* pBlock = NULL;
+
+ int32_t ret =
+ tscGetDataBlockFromList(pCmd->pTableBlockHashList, pTableMeta->id.uid, TSDB_PAYLOAD_SIZE, sizeof(SSubmitBlk),
+ pTableMeta->tableInfo.rowSize, pTableMetaInfo->name, pTableMeta, &pBlock, NULL);
+ assert(ret == 0);
+ pBlock->size = sizeof(SSubmitBlk) + pCmd->batchSize * pBlock->rowSize;
+ SSubmitBlk* pBlk = (SSubmitBlk*) pBlock->pData;
+ pBlk->numOfRows = pCmd->batchSize;
+ pBlk->dataLen = 0;
+ pBlk->uid = pTableMeta->id.uid;
+ pBlk->tid = pTableMeta->id.tid;
+
+ int code = tscMergeTableDataBlocks(stmt->pSql, false);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+
+ STableDataBlocks* pDataBlock = taosArrayGetP(pCmd->pDataBlocks, 0);
+ code = tscCopyDataBlockToPayload(stmt->pSql, pDataBlock);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+
+ SSqlObj* pSql = stmt->pSql;
+ SSqlRes* pRes = &pSql->res;
+ pRes->numOfRows = 0;
pRes->numOfTotal = 0;
- pRes->numOfClauseTotal = 0;
- pRes->qhandle = 0;
-
- pSql->cmd.insertType = 0;
- pSql->fetchFp = waitForQueryRsp;
- pSql->fp = (void(*)())tscHandleMultivnodeInsert;
-
- tscDoQuery(pSql);
+ tscProcessSql(pSql);
// wait for the callback function to post the semaphore
tsem_wait(&pSql->rspSem);
- return pSql->res.code;
+ // data block reset
+ pCmd->batchSize = 0;
+ for(int32_t i = 0; i < pCmd->numOfTables; ++i) {
+ if (pCmd->pTableNameList && pCmd->pTableNameList[i]) {
+ tfree(pCmd->pTableNameList[i]);
+ }
+ }
+
+ pCmd->numOfTables = 0;
+ tfree(pCmd->pTableNameList);
+ pCmd->pDataBlocks = tscDestroyBlockArrayList(pCmd->pDataBlocks);
+
+ return pSql->res.code;
}
////////////////////////////////////////////////////////////////////////////////
@@ -867,11 +863,11 @@ TAOS_STMT* taos_stmt_init(TAOS* taos) {
}
tsem_init(&pSql->rspSem, 0, 0);
- pSql->signature = pSql;
- pSql->pTscObj = pObj;
- pSql->maxRetry = TSDB_MAX_REPLICA;
+ pSql->signature = pSql;
+ pSql->pTscObj = pObj;
+ pSql->maxRetry = TSDB_MAX_REPLICA;
+ pStmt->pSql = pSql;
- pStmt->pSql = pSql;
return pStmt;
}
@@ -890,7 +886,9 @@ int taos_stmt_prepare(TAOS_STMT* stmt, const char* sql, unsigned long length) {
SSqlRes *pRes = &pSql->res;
pSql->param = (void*) pSql;
pSql->fp = waitForQueryRsp;
- pSql->cmd.insertType = TSDB_QUERY_TYPE_STMT_INSERT;
+ pSql->fetchFp = waitForQueryRsp;
+
+ pCmd->insertType = TSDB_QUERY_TYPE_STMT_INSERT;
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, TSDB_DEFAULT_PAYLOAD_SIZE)) {
tscError("%p failed to malloc payload buffer", pSql);
@@ -956,8 +954,9 @@ int taos_stmt_bind_param(TAOS_STMT* stmt, TAOS_BIND* bind) {
STscStmt* pStmt = (STscStmt*)stmt;
if (pStmt->isInsert) {
return insertStmtBindParam(pStmt, bind);
+ } else {
+ return normalStmtBindParam(pStmt, bind);
}
- return normalStmtBindParam(pStmt, bind);
}
int taos_stmt_add_batch(TAOS_STMT* stmt) {
@@ -981,7 +980,7 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
STscStmt* pStmt = (STscStmt*)stmt;
if (pStmt->isInsert) {
ret = insertStmtExecute(pStmt);
- } else {
+ } else { // normal stmt query
char* sql = normalStmtBuildSql(pStmt);
if (sql == NULL) {
ret = TSDB_CODE_TSC_OUT_OF_MEMORY;
@@ -995,6 +994,7 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
free(sql);
}
}
+
return ret;
}
diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c
index 2eae5b3935..2461a58308 100644
--- a/src/client/src/tscSQLParser.c
+++ b/src/client/src/tscSQLParser.c
@@ -231,7 +231,7 @@ static int32_t handlePassword(SSqlCmd* pCmd, SStrToken* pPwd) {
}
int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
- if (pInfo == NULL || pSql == NULL || pSql->signature != pSql) {
+ if (pInfo == NULL || pSql == NULL) {
return TSDB_CODE_TSC_APP_ERROR;
}
@@ -266,6 +266,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
case TSDB_SQL_DROP_DB: {
const char* msg2 = "invalid name";
const char* msg3 = "param name too long";
+ const char* msg4 = "table is not super table";
SStrToken* pzName = &pInfo->pDCLInfo->a[0];
if ((pInfo->type != TSDB_SQL_DROP_DNODE) && (tscValidateName(pzName) != TSDB_CODE_SUCCESS)) {
@@ -287,6 +288,18 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
if(code != TSDB_CODE_SUCCESS) {
return code;
}
+
+ if (pInfo->pDCLInfo->tableType == TSDB_SUPER_TABLE) {
+ code = tscGetTableMeta(pSql, pTableMetaInfo);
+ if (code != TSDB_CODE_SUCCESS) {
+ return code;
+ }
+
+ if (!UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4);
+ }
+ }
+
} else if (pInfo->type == TSDB_SQL_DROP_DNODE) {
pzName->n = strdequote(pzName->z);
strncpy(pTableMetaInfo->name, pzName->z, pzName->n);
@@ -644,7 +657,11 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
pSql->cmd.parseFinished = 1;
- return tscBuildMsg[pCmd->command](pSql, pInfo);
+ if (tscBuildMsg[pCmd->command] != NULL) {
+ return tscBuildMsg[pCmd->command](pSql, pInfo);
+ } else {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), "not support sql expression");
+ }
}
/*
@@ -1740,7 +1757,7 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
return -1;
} else {
type = TSDB_DATA_TYPE_DOUBLE;
- bytes = tDataTypeDesc[type].nSize;
+ bytes = tDataTypes[type].bytes;
}
} else {
type = pSchema->type;
@@ -1846,7 +1863,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
index = (SColumnIndex){0, PRIMARYKEY_TIMESTAMP_COL_INDEX};
- int32_t size = tDataTypeDesc[TSDB_DATA_TYPE_BIGINT].nSize;
+ int32_t size = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
pExpr = tscSqlExprAppend(pQueryInfo, functionID, &index, TSDB_DATA_TYPE_BIGINT, size, getNewResColId(pQueryInfo), size, false);
} else if (sqlOptr == TK_INTEGER) { // select count(1) from table1
char buf[8] = {0};
@@ -1858,7 +1875,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
if (val == 1) {
index = (SColumnIndex){0, PRIMARYKEY_TIMESTAMP_COL_INDEX};
- int32_t size = tDataTypeDesc[TSDB_DATA_TYPE_BIGINT].nSize;
+ int32_t size = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
pExpr = tscSqlExprAppend(pQueryInfo, functionID, &index, TSDB_DATA_TYPE_BIGINT, size, getNewResColId(pQueryInfo), size, false);
} else {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
@@ -1878,12 +1895,12 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
isTag = true;
}
- int32_t size = tDataTypeDesc[TSDB_DATA_TYPE_BIGINT].nSize;
+ int32_t size = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
pExpr = tscSqlExprAppend(pQueryInfo, functionID, &index, TSDB_DATA_TYPE_BIGINT, size, getNewResColId(pQueryInfo), size, isTag);
}
} else { // count(*) is equalled to count(primary_timestamp_key)
index = (SColumnIndex){0, PRIMARYKEY_TIMESTAMP_COL_INDEX};
- int32_t size = tDataTypeDesc[TSDB_DATA_TYPE_BIGINT].nSize;
+ int32_t size = tDataTypes[TSDB_DATA_TYPE_BIGINT].bytes;
pExpr = tscSqlExprAppend(pQueryInfo, functionID, &index, TSDB_DATA_TYPE_BIGINT, size, getNewResColId(pQueryInfo), size, false);
}
@@ -4512,6 +4529,8 @@ int32_t parseFillClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQuery
}
} else if (strncasecmp(pItem->pVar.pz, "prev", 4) == 0 && pItem->pVar.nLen == 4) {
pQueryInfo->fillType = TSDB_FILL_PREV;
+ } else if (strncasecmp(pItem->pVar.pz, "next", 4) == 0 && pItem->pVar.nLen == 4) {
+ pQueryInfo->fillType = TSDB_FILL_NEXT;
} else if (strncasecmp(pItem->pVar.pz, "linear", 6) == 0 && pItem->pVar.nLen == 6) {
pQueryInfo->fillType = TSDB_FILL_LINEAR;
} else if (strncasecmp(pItem->pVar.pz, "value", 5) == 0 && pItem->pVar.nLen == 5) {
@@ -4790,6 +4809,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
const char* msg17 = "invalid column name";
const char* msg18 = "primary timestamp column cannot be dropped";
const char* msg19 = "invalid new tag name";
+ const char* msg20 = "table is not super table";
int32_t code = TSDB_CODE_SUCCESS;
@@ -4815,6 +4835,10 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
STableMeta* pTableMeta = pTableMetaInfo->pTableMeta;
+ if (pAlterSQL->tableType == TSDB_SUPER_TABLE && !(UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo))) {
+ return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg20);
+ }
+
if (pAlterSQL->type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN || pAlterSQL->type == TSDB_ALTER_TABLE_DROP_TAG_COLUMN ||
pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN) {
if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) {
@@ -4871,7 +4895,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char name1[128] = {0};
strncpy(name1, pItem->pVar.pz, pItem->pVar.nLen);
- TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name1, tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize);
+ TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name1, tDataTypes[TSDB_DATA_TYPE_INT].bytes);
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN) {
SArray* pVarList = pAlterSQL->varList;
@@ -4907,14 +4931,14 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char name[TSDB_COL_NAME_LEN] = {0};
strncpy(name, pItem->pVar.pz, pItem->pVar.nLen);
- TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name, tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize);
+ TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name, tDataTypes[TSDB_DATA_TYPE_INT].bytes);
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
pItem = taosArrayGet(pVarList, 1);
memset(name, 0, tListLen(name));
strncpy(name, pItem->pVar.pz, pItem->pVar.nLen);
- f = tscCreateField(TSDB_DATA_TYPE_INT, name, tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize);
+ f = tscCreateField(TSDB_DATA_TYPE_INT, name, tDataTypes[TSDB_DATA_TYPE_INT].bytes);
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
} else if (pAlterSQL->type == TSDB_ALTER_TABLE_UPDATE_TAG_VAL) {
// Note: update can only be applied to table not super table.
@@ -4989,7 +5013,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
int32_t len = 0;
if (pTagsSchema->type != TSDB_DATA_TYPE_BINARY && pTagsSchema->type != TSDB_DATA_TYPE_NCHAR) {
- len = tDataTypeDesc[pTagsSchema->type].nSize;
+ len = tDataTypes[pTagsSchema->type].bytes;
} else {
len = varDataTLen(pUpdateMsg->data + schemaLen);
}
@@ -5036,7 +5060,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char name1[TSDB_COL_NAME_LEN] = {0};
tstrncpy(name1, pItem->pVar.pz, sizeof(name1));
- TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name1, tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize);
+ TAOS_FIELD f = tscCreateField(TSDB_DATA_TYPE_INT, name1, tDataTypes[TSDB_DATA_TYPE_INT].bytes);
tscFieldInfoAppend(&pQueryInfo->fieldsInfo, &f);
}
@@ -5999,7 +6023,7 @@ int32_t doLocalQueryProcess(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQ
SColumnIndex ind = {0};
SSqlExpr* pExpr1 = tscSqlExprAppend(pQueryInfo, TSDB_FUNC_TAG_DUMMY, &ind, TSDB_DATA_TYPE_INT,
- tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize, getNewResColId(pQueryInfo), tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize, false);
+ tDataTypes[TSDB_DATA_TYPE_INT].bytes, getNewResColId(pQueryInfo), tDataTypes[TSDB_DATA_TYPE_INT].bytes, false);
const char* name = (pExprList->a[0].aliasName != NULL)? pExprList->a[0].aliasName:functionsInfo[index].name;
tstrncpy(pExpr1->aliasName, name, tListLen(pExpr1->aliasName));
diff --git a/src/client/src/tscSchemaUtil.c b/src/client/src/tscSchemaUtil.c
index 123f0fd222..47c3cd9716 100644
--- a/src/client/src/tscSchemaUtil.c
+++ b/src/client/src/tscSchemaUtil.c
@@ -66,68 +66,6 @@ STableComInfo tscGetTableInfo(const STableMeta* pTableMeta) {
return pTableMeta->tableInfo;
}
-static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen) {
- int32_t rowLen = 0;
-
- for (int32_t i = 0; i < numOfCols; ++i) {
- // 1. valid types
- if (!isValidDataType(pSchema[i].type)) {
- return false;
- }
-
- // 2. valid length for each type
- if (pSchema[i].type == TSDB_DATA_TYPE_BINARY) {
- if (pSchema[i].bytes > TSDB_MAX_BINARY_LEN) {
- return false;
- }
- } else if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR) {
- if (pSchema[i].bytes > TSDB_MAX_NCHAR_LEN) {
- return false;
- }
- } else {
- if (pSchema[i].bytes != tDataTypeDesc[pSchema[i].type].nSize) {
- return false;
- }
- }
-
- // 3. valid column names
- for (int32_t j = i + 1; j < numOfCols; ++j) {
- if (strncasecmp(pSchema[i].name, pSchema[j].name, sizeof(pSchema[i].name) - 1) == 0) {
- return false;
- }
- }
-
- rowLen += pSchema[i].bytes;
- }
-
- return rowLen <= maxLen;
-}
-
-bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags) {
- if (!VALIDNUMOFCOLS(numOfCols)) {
- return false;
- }
-
- if (!VALIDNUMOFTAGS(numOfTags)) {
- return false;
- }
-
- /* first column must be the timestamp, which is a primary key */
- if (pSchema[0].type != TSDB_DATA_TYPE_TIMESTAMP) {
- return false;
- }
-
- if (!doValidateSchema(pSchema, numOfCols, TSDB_MAX_BYTES_PER_ROW)) {
- return false;
- }
-
- if (!doValidateSchema(&pSchema[numOfCols], numOfTags, TSDB_MAX_TAGS_LEN)) {
- return false;
- }
-
- return true;
-}
-
SSchema* tscGetTableColumnSchema(const STableMeta* pTableMeta, int32_t colIndex) {
assert(pTableMeta != NULL);
diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c
index 15dd77faeb..953680c43e 100644
--- a/src/client/src/tscServer.c
+++ b/src/client/src/tscServer.c
@@ -25,8 +25,6 @@
#include "ttimer.h"
#include "tlockfree.h"
-///SRpcCorEpSet tscMgmtEpSet;
-
int (*tscBuildMsg[TSDB_SQL_MAX])(SSqlObj *pSql, SSqlInfo *pInfo) = {0};
int (*tscProcessMsgRsp[TSDB_SQL_MAX])(SSqlObj *pSql);
@@ -341,7 +339,8 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
if (pSql->retry > pSql->maxRetry) {
tscError("%p max retry %d reached, give up", pSql, pSql->maxRetry);
} else {
- // wait for a little bit moment and then retry, todo do not sleep in rpc callback thread
+ // wait for a little bit moment and then retry
+ // todo do not sleep in rpc callback thread, add this process into queueu to process
if (rpcMsg->code == TSDB_CODE_APP_NOT_READY || rpcMsg->code == TSDB_CODE_VND_INVALID_VGROUP_ID) {
int32_t duration = getWaitingTimeInterval(pSql->retry);
taosMsleep(duration);
@@ -484,9 +483,9 @@ int tscProcessSql(SSqlObj *pSql) {
pSql->res.code = TSDB_CODE_TSC_APP_ERROR;
return pSql->res.code;
}
- } else if (pCmd->command < TSDB_SQL_LOCAL) {
+ } else if (pCmd->command >= TSDB_SQL_LOCAL) {
//pSql->epSet = tscMgmtEpSet;
- } else { // local handler
+// } else { // local handler
return (*tscProcessMsgRsp[pCmd->command])(pSql);
}
@@ -1157,7 +1156,7 @@ int32_t tscBuildDropTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMDropTableMsg *pDropTableMsg = (SCMDropTableMsg*)pCmd->payload;
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
- strcpy(pDropTableMsg->tableId, pTableMetaInfo->name);
+ strcpy(pDropTableMsg->tableFname, pTableMetaInfo->name);
pDropTableMsg->igNotExists = pInfo->pDCLInfo->existsCheck ? 1 : 0;
pCmd->msgType = TSDB_MSG_TYPE_CM_DROP_TABLE;
@@ -1180,7 +1179,7 @@ int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
return TSDB_CODE_SUCCESS;
}
-int32_t tscBuildDropUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
+int32_t tscBuildDropUserMsg(SSqlObj *pSql, SSqlInfo * UNUSED_PARAM(pInfo)) {
SSqlCmd *pCmd = &pSql->cmd;
pCmd->payloadLen = sizeof(SDropUserMsg);
pCmd->msgType = TSDB_MSG_TYPE_CM_DROP_USER;
@@ -1347,7 +1346,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pMsg += sizeof(SCreateTableMsg);
SCreatedTableInfo* p = taosArrayGet(list, i);
- strcpy(pCreate->tableId, p->fullname);
+ strcpy(pCreate->tableFname, p->fullname);
pCreate->igExists = (p->igExist)? 1 : 0;
// use dbinfo from table id without modifying current db info
@@ -1360,7 +1359,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
} else { // create (super) table
pCreateTableMsg->numOfTables = htonl(1); // only one table will be created
- strcpy(pCreateMsg->tableId, pTableMetaInfo->name);
+ strcpy(pCreateMsg->tableFname, pTableMetaInfo->name);
// use dbinfo from table id without modifying current db info
tscGetDBInfoFromTableFullName(pTableMetaInfo->name, pCreateMsg->db);
@@ -1431,7 +1430,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SAlterTableMsg *pAlterTableMsg = (SAlterTableMsg *)pCmd->payload;
tscGetDBInfoFromTableFullName(pTableMetaInfo->name, pAlterTableMsg->db);
- strcpy(pAlterTableMsg->tableId, pTableMetaInfo->name);
+ strcpy(pAlterTableMsg->tableFname, pTableMetaInfo->name);
pAlterTableMsg->type = htons(pAlterInfo->type);
pAlterTableMsg->numOfCols = htons(tscNumOfFields(pQueryInfo));
@@ -1630,7 +1629,7 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
STableInfoMsg *pInfoMsg = (STableInfoMsg *)pCmd->payload;
- strcpy(pInfoMsg->tableId, pTableMetaInfo->name);
+ strcpy(pInfoMsg->tableFname, pTableMetaInfo->name);
pInfoMsg->createFlag = htons(pSql->cmd.autoCreated ? 1 : 0);
char *pMsg = (char *)pInfoMsg + sizeof(STableInfoMsg);
@@ -1799,7 +1798,7 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
if ((pMetaMsg->tableType != TSDB_SUPER_TABLE) &&
(pMetaMsg->tid <= 0 || pMetaMsg->vgroup.vgId < 2 || pMetaMsg->vgroup.numOfEps <= 0)) {
tscError("invalid value in table numOfEps:%d, vgId:%d tid:%d, name:%s", pMetaMsg->vgroup.numOfEps, pMetaMsg->vgroup.vgId,
- pMetaMsg->tid, pMetaMsg->tableId);
+ pMetaMsg->tid, pMetaMsg->tableFname);
return TSDB_CODE_TSC_INVALID_VALUE;
}
@@ -1831,12 +1830,16 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
assert(isValidDataType(pSchema->type));
pSchema++;
}
-
- STableMeta* pTableMeta = tscCreateTableMetaFromMsg(pMetaMsg);
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0);
assert(pTableMetaInfo->pTableMeta == NULL);
+ STableMeta* pTableMeta = tscCreateTableMetaFromMsg(pMetaMsg);
+ if (!isValidSchema(pTableMeta->schema, pTableMeta->tableInfo.numOfColumns, pTableMeta->tableInfo.numOfTags)) {
+ tscError("%p invalid table meta from mnode, name:%s", pSql, pTableMetaInfo->name);
+ return TSDB_CODE_TSC_INVALID_VALUE;
+ }
+
if (pTableMeta->tableType == TSDB_CHILD_TABLE) {
// check if super table hashmap or not
int32_t len = (int32_t) strnlen(pTableMeta->sTableName, TSDB_TABLE_FNAME_LEN);
@@ -2097,7 +2100,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
return 0;
}
-static void createHBObj(STscObj* pObj) {
+static void createHbObj(STscObj* pObj) {
if (pObj->hbrid != 0) {
return;
}
@@ -2160,7 +2163,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
pObj->superAuth = pConnect->superAuth;
pObj->connId = htonl(pConnect->connId);
- createHBObj(pObj);
+ createHbObj(pObj);
//launch a timer to send heartbeat to maintain the connection and send status to mnode
taosTmrReset(tscProcessActivityTimer, tsShellActivityTimer * 500, (void *)pObj->rid, tscTmr, &pObj->pTimer);
@@ -2190,7 +2193,7 @@ int tscProcessDropTableRsp(SSqlObj *pSql) {
tscDebug("%p remove table meta after drop table:%s, numOfRemain:%d", pSql, pTableMetaInfo->name,
(int32_t) taosHashGetSize(tscTableMetaInfo));
- assert(pTableMetaInfo->pTableMeta == NULL);
+ pTableMetaInfo->pTableMeta = NULL;
return 0;
}
diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c
index 3f25d7a14d..a4f2976cad 100644
--- a/src/client/src/tscSql.c
+++ b/src/client/src/tscSql.c
@@ -781,6 +781,7 @@ bool taos_is_null(TAOS_RES *res, int32_t row, int32_t col) {
int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields) {
int len = 0;
+
for (int i = 0; i < num_fields; ++i) {
if (i > 0) {
str[len++] = ' ';
@@ -838,13 +839,15 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)
case TSDB_DATA_TYPE_BINARY:
case TSDB_DATA_TYPE_NCHAR: {
- size_t xlen = 0;
- for (xlen = 0; xlen < fields[i].bytes - VARSTR_HEADER_SIZE; xlen++) {
- char c = ((char *)row[i])[xlen];
- if (c == 0) break;
- str[len++] = c;
+ int32_t charLen = varDataLen((char*)row[i] - VARSTR_HEADER_SIZE);
+ if (fields[i].type == TSDB_DATA_TYPE_BINARY) {
+ assert(charLen <= fields[i].bytes);
+ } else {
+ assert(charLen <= fields[i].bytes * TSDB_NCHAR_SIZE);
}
- str[len] = 0;
+
+ memcpy(str + len, row[i], charLen);
+ len += charLen;
} break;
case TSDB_DATA_TYPE_TIMESTAMP:
diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c
index 2622246111..ee9526e297 100644
--- a/src/client/src/tscSubquery.c
+++ b/src/client/src/tscSubquery.c
@@ -55,6 +55,58 @@ static void skipRemainValue(STSBuf* pTSBuf, tVariant* tag1) {
}
}
+static void subquerySetState(SSqlObj *pSql, SSubqueryState *subState, int idx, int8_t state) {
+ assert(idx < subState->numOfSub);
+ assert(subState->states);
+
+ pthread_mutex_lock(&subState->mutex);
+
+ tscDebug("subquery:%p,%d state set to %d", pSql, idx, state);
+
+ subState->states[idx] = state;
+
+ pthread_mutex_unlock(&subState->mutex);
+}
+
+static bool allSubqueryDone(SSqlObj *pParentSql) {
+ bool done = true;
+ SSubqueryState *subState = &pParentSql->subState;
+
+ //lock in caller
+
+ for (int i = 0; i < subState->numOfSub; i++) {
+ if (0 == subState->states[i]) {
+ tscDebug("%p subquery:%p,%d is NOT finished, total:%d", pParentSql, pParentSql->pSubs[i], i, subState->numOfSub);
+ done = false;
+ break;
+ } else {
+ tscDebug("%p subquery:%p,%d is finished, total:%d", pParentSql, pParentSql->pSubs[i], i, subState->numOfSub);
+ }
+ }
+
+ return done;
+}
+
+static bool subAndCheckDone(SSqlObj *pSql, SSqlObj *pParentSql, int idx) {
+ SSubqueryState *subState = &pParentSql->subState;
+
+ assert(idx < subState->numOfSub);
+
+ pthread_mutex_lock(&subState->mutex);
+
+ tscDebug("%p subquery:%p,%d state set to 1", pParentSql, pSql, idx);
+
+ subState->states[idx] = 1;
+
+ bool done = allSubqueryDone(pParentSql);
+
+ pthread_mutex_unlock(&subState->mutex);
+
+ return done;
+}
+
+
+
static int64_t doTSBlockIntersect(SSqlObj* pSql, SJoinSupporter* pSupporter1, SJoinSupporter* pSupporter2, STimeWindow * win) {
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, pSql->cmd.clauseIndex);
@@ -367,10 +419,6 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
// scan all subquery, if one sub query has only ts, ignore it
tscDebug("%p start to launch secondary subqueries, %d out of %d needs to query", pSql, numOfSub, pSql->subState.numOfSub);
- //the subqueries that do not actually launch the secondary query to virtual node is set as completed.
- SSubqueryState* pState = &pSql->subState;
- pState->numOfRemain = numOfSub;
-
bool success = true;
for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
@@ -403,6 +451,7 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
success = false;
break;
}
+
tscClearSubqueryInfo(&pNew->cmd);
pSql->pSubs[i] = pNew;
@@ -480,6 +529,8 @@ static int32_t tscLaunchRealSubqueries(SSqlObj* pSql) {
}
}
+ subquerySetState(pPrevSub, &pSql->subState, i, 0);
+
size_t numOfCols = taosArrayGetSize(pQueryInfo->colList);
tscDebug("%p subquery:%p tableIndex:%d, vgroupIndex:%d, type:%d, exprInfo:%" PRIzu ", colList:%" PRIzu ", fieldsInfo:%d, name:%s",
pSql, pNew, 0, pTableMetaInfo->vgroupIndex, pQueryInfo->type, taosArrayGetSize(pQueryInfo->exprList),
@@ -517,20 +568,25 @@ void freeJoinSubqueryObj(SSqlObj* pSql) {
SJoinSupporter* p = pSub->param;
tscDestroyJoinSupporter(p);
- if (pSub->res.code == TSDB_CODE_SUCCESS) {
- taos_free_result(pSub);
- }
+ taos_free_result(pSub);
+ pSql->pSubs[i] = NULL;
}
+ if (pSql->subState.states) {
+ pthread_mutex_destroy(&pSql->subState.mutex);
+ }
+
+ tfree(pSql->subState.states);
+
+
pSql->subState.numOfSub = 0;
}
-static void quitAllSubquery(SSqlObj* pSqlObj, SJoinSupporter* pSupporter) {
- assert(pSqlObj->subState.numOfRemain > 0);
-
- if (atomic_sub_fetch_32(&pSqlObj->subState.numOfRemain, 1) <= 0) {
- tscError("%p all subquery return and query failed, global code:%s", pSqlObj, tstrerror(pSqlObj->res.code));
+static void quitAllSubquery(SSqlObj* pSqlSub, SSqlObj* pSqlObj, SJoinSupporter* pSupporter) {
+ if (subAndCheckDone(pSqlSub, pSqlObj, pSupporter->subqueryIndex)) {
+ tscError("%p all subquery return and query failed, global code:%s", pSqlObj, tstrerror(pSqlObj->res.code));
freeJoinSubqueryObj(pSqlObj);
+ return;
}
//tscDestroyJoinSupporter(pSupporter);
@@ -777,6 +833,15 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
assert(TSDB_QUERY_HAS_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_TAG_FILTER_QUERY));
+ if (pParentSql->res.code != TSDB_CODE_SUCCESS) {
+ tscError("%p abort query due to other subquery failure. code:%d, global code:%d", pSql, numOfRows, pParentSql->res.code);
+ quitAllSubquery(pSql, pParentSql, pSupporter);
+
+ tscAsyncResultOnError(pParentSql);
+
+ return;
+ }
+
// check for the error code firstly
if (taos_errno(pSql) != TSDB_CODE_SUCCESS) {
// todo retry if other subqueries are not failed
@@ -785,7 +850,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
tscError("%p sub query failed, code:%s, index:%d", pSql, tstrerror(numOfRows), pSupporter->subqueryIndex);
pParentSql->res.code = numOfRows;
- quitAllSubquery(pParentSql, pSupporter);
+ quitAllSubquery(pSql, pParentSql, pSupporter);
tscAsyncResultOnError(pParentSql);
return;
@@ -802,7 +867,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
tscError("%p failed to malloc memory", pSql);
pParentSql->res.code = TAOS_SYSTEM_ERROR(errno);
- quitAllSubquery(pParentSql, pSupporter);
+ quitAllSubquery(pSql, pParentSql, pSupporter);
tscAsyncResultOnError(pParentSql);
return;
@@ -844,9 +909,10 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
// no data exists in next vnode, mark the query completed
// only when there is no subquery exits any more, proceeds to get the intersect of the tuple sets.
- if (atomic_sub_fetch_32(&pParentSql->subState.numOfRemain, 1) > 0) {
+ if (!subAndCheckDone(pSql, pParentSql, pSupporter->subqueryIndex)) {
+ tscDebug("%p tagRetrieve:%p,%d completed, total:%d", pParentSql, tres, pSupporter->subqueryIndex, pParentSql->subState.numOfSub);
return;
- }
+ }
SArray *s1 = NULL, *s2 = NULL;
int32_t code = getIntersectionOfTableTuple(pQueryInfo, pParentSql, &s1, &s2);
@@ -891,8 +957,10 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
((SJoinSupporter*)psub2->param)->pVgroupTables = tscVgroupTableInfoClone(pTableMetaInfo2->pVgroupTables);
pParentSql->subState.numOfSub = 2;
- pParentSql->subState.numOfRemain = pParentSql->subState.numOfSub;
-
+
+ memset(pParentSql->subState.states, 0, sizeof(pParentSql->subState.states[0]) * pParentSql->subState.numOfSub);
+ tscDebug("%p reset all sub states to 0", pParentSql);
+
for (int32_t m = 0; m < pParentSql->subState.numOfSub; ++m) {
SSqlObj* sub = pParentSql->pSubs[m];
issueTSCompQuery(sub, sub->param, pParentSql);
@@ -915,6 +983,15 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
assert(!TSDB_QUERY_HAS_TYPE(pQueryInfo->type, TSDB_QUERY_TYPE_JOIN_SEC_STAGE));
+ if (pParentSql->res.code != TSDB_CODE_SUCCESS) {
+ tscError("%p abort query due to other subquery failure. code:%d, global code:%d", pSql, numOfRows, pParentSql->res.code);
+ quitAllSubquery(pSql, pParentSql, pSupporter);
+
+ tscAsyncResultOnError(pParentSql);
+
+ return;
+ }
+
// check for the error code firstly
if (taos_errno(pSql) != TSDB_CODE_SUCCESS) {
// todo retry if other subqueries are not failed yet
@@ -922,7 +999,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
tscError("%p sub query failed, code:%s, index:%d", pSql, tstrerror(numOfRows), pSupporter->subqueryIndex);
pParentSql->res.code = numOfRows;
- quitAllSubquery(pParentSql, pSupporter);
+ quitAllSubquery(pSql, pParentSql, pSupporter);
tscAsyncResultOnError(pParentSql);
return;
@@ -937,7 +1014,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
pParentSql->res.code = TAOS_SYSTEM_ERROR(errno);
- quitAllSubquery(pParentSql, pSupporter);
+ quitAllSubquery(pSql, pParentSql, pSupporter);
tscAsyncResultOnError(pParentSql);
@@ -955,7 +1032,7 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
pParentSql->res.code = TAOS_SYSTEM_ERROR(errno);
- quitAllSubquery(pParentSql, pSupporter);
+ quitAllSubquery(pSql, pParentSql, pSupporter);
tscAsyncResultOnError(pParentSql);
@@ -1009,9 +1086,9 @@ static void tsCompRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
return;
}
- if (atomic_sub_fetch_32(&pParentSql->subState.numOfRemain, 1) > 0) {
+ if (!subAndCheckDone(pSql, pParentSql, pSupporter->subqueryIndex)) {
return;
- }
+ }
tscDebug("%p all subquery retrieve ts complete, do ts block intersect", pParentSql);
@@ -1049,6 +1126,17 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR
SSqlRes* pRes = &pSql->res;
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
+
+ if (pParentSql->res.code != TSDB_CODE_SUCCESS) {
+ tscError("%p abort query due to other subquery failure. code:%d, global code:%d", pSql, numOfRows, pParentSql->res.code);
+ quitAllSubquery(pSql, pParentSql, pSupporter);
+
+ tscAsyncResultOnError(pParentSql);
+
+ return;
+ }
+
+
if (taos_errno(pSql) != TSDB_CODE_SUCCESS) {
assert(numOfRows == taos_errno(pSql));
@@ -1088,9 +1176,8 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR
}
}
- assert(pState->numOfRemain > 0);
- if (atomic_sub_fetch_32(&pState->numOfRemain, 1) > 0) {
- tscDebug("%p sub:%p completed, remain:%d, total:%d", pParentSql, tres, pState->numOfRemain, pState->numOfSub);
+ if (!subAndCheckDone(pSql, pParentSql, pSupporter->subqueryIndex)) {
+ tscDebug("%p sub:%p,%d completed, total:%d", pParentSql, tres, pSupporter->subqueryIndex, pState->numOfSub);
return;
}
@@ -1205,15 +1292,16 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) {
}
}
- // get the number of subquery that need to retrieve the next vnode.
+
if (orderedPrjQuery) {
for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
SSqlObj* pSub = pSql->pSubs[i];
if (pSub != NULL && pSub->res.row >= pSub->res.numOfRows && pSub->res.completed) {
- pSql->subState.numOfRemain++;
+ subquerySetState(pSub, &pSql->subState, i, 0);
}
}
}
+
for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
SSqlObj* pSub = pSql->pSubs[i];
@@ -1270,7 +1358,19 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) {
// retrieve data from current vnode.
tscDebug("%p retrieve data from %d subqueries", pSql, numOfFetch);
SJoinSupporter* pSupporter = NULL;
- pSql->subState.numOfRemain = numOfFetch;
+
+ for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
+ SSqlObj* pSql1 = pSql->pSubs[i];
+ if (pSql1 == NULL) {
+ continue;
+ }
+
+ SSqlRes* pRes1 = &pSql1->res;
+
+ if (pRes1->row >= pRes1->numOfRows) {
+ subquerySetState(pSql1, &pSql->subState, i, 0);
+ }
+ }
for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
SSqlObj* pSql1 = pSql->pSubs[i];
@@ -1372,7 +1472,8 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
// retrieve actual query results from vnode during the second stage join subquery
if (pParentSql->res.code != TSDB_CODE_SUCCESS) {
tscError("%p abort query due to other subquery failure. code:%d, global code:%d", pSql, code, pParentSql->res.code);
- quitAllSubquery(pParentSql, pSupporter);
+ quitAllSubquery(pSql, pParentSql, pSupporter);
+
tscAsyncResultOnError(pParentSql);
return;
@@ -1384,7 +1485,8 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
tscError("%p abort query, code:%s, global code:%s", pSql, tstrerror(code), tstrerror(pParentSql->res.code));
pParentSql->res.code = code;
- quitAllSubquery(pParentSql, pSupporter);
+
+ quitAllSubquery(pSql, pParentSql, pSupporter);
tscAsyncResultOnError(pParentSql);
return;
@@ -1408,9 +1510,9 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
// In case of consequence query from other vnode, do not wait for other query response here.
if (!(pTableMetaInfo->vgroupIndex > 0 && tscNonOrderedProjectionQueryOnSTable(pQueryInfo, 0))) {
- if (atomic_sub_fetch_32(&pParentSql->subState.numOfRemain, 1) > 0) {
+ if (!subAndCheckDone(pSql, pParentSql, pSupporter->subqueryIndex)) {
return;
- }
+ }
}
tscSetupOutputColumnIndex(pParentSql);
@@ -1422,6 +1524,7 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
if (pTableMetaInfo->vgroupIndex > 0 && tscNonOrderedProjectionQueryOnSTable(pQueryInfo, 0)) {
pSql->fp = joinRetrieveFinalResCallback; // continue retrieve data
pSql->cmd.command = TSDB_SQL_FETCH;
+
tscProcessSql(pSql);
} else { // first retrieve from vnode during the secondary stage sub-query
// set the command flag must be after the semaphore been correctly set.
@@ -1457,8 +1560,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
- pSql->pSubs[pSql->subState.numOfRemain++] = pNew;
- assert(pSql->subState.numOfRemain <= pSql->subState.numOfSub);
+ pSql->pSubs[tableIndex] = pNew;
if (QUERY_IS_JOIN_QUERY(pQueryInfo->type)) {
addGroupInfoForSubquery(pSql, pNew, 0, tableIndex);
@@ -1590,6 +1692,19 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
int32_t code = TSDB_CODE_SUCCESS;
pSql->subState.numOfSub = pQueryInfo->numOfTables;
+ if (pSql->subState.states == NULL) {
+ pSql->subState.states = calloc(pSql->subState.numOfSub, sizeof(*pSql->subState.states));
+ if (pSql->subState.states == NULL) {
+ code = TSDB_CODE_TSC_OUT_OF_MEMORY;
+ goto _error;
+ }
+
+ pthread_mutex_init(&pSql->subState.mutex, NULL);
+ }
+
+ memset(pSql->subState.states, 0, sizeof(*pSql->subState.states) * pSql->subState.numOfSub);
+ tscDebug("%p reset all sub states to 0", pSql);
+
bool hasEmptySub = false;
tscDebug("%p start subquery, total:%d", pSql, pQueryInfo->numOfTables);
@@ -1622,12 +1737,23 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) {
pSql->cmd.command = TSDB_SQL_RETRIEVE_EMPTY_RESULT;
(*pSql->fp)(pSql->param, pSql, 0);
} else {
+ int fail = 0;
for (int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
SSqlObj* pSub = pSql->pSubs[i];
- if ((code = tscProcessSql(pSub)) != TSDB_CODE_SUCCESS) {
- pSql->subState.numOfRemain = i - 1; // the already sent request will continue and do not go to the error process routine
- break;
+ if (fail) {
+ (*pSub->fp)(pSub->param, pSub, 0);
+ continue;
}
+
+ if ((code = tscProcessSql(pSub)) != TSDB_CODE_SUCCESS) {
+ pRes->code = code;
+ (*pSub->fp)(pSub->param, pSub, 0);
+ fail = 1;
+ }
+ }
+
+ if(fail) {
+ return;
}
pSql->cmd.command = TSDB_SQL_TABLE_JOIN_RETRIEVE;
@@ -1728,7 +1854,21 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
return ret;
}
- pState->numOfRemain = pState->numOfSub;
+ if (pState->states == NULL) {
+ pState->states = calloc(pState->numOfSub, sizeof(*pState->states));
+ if (pState->states == NULL) {
+ pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY;
+ tscAsyncResultOnError(pSql);
+ tfree(pMemoryBuf);
+ return ret;
+ }
+
+ pthread_mutex_init(&pState->mutex, NULL);
+ }
+
+ memset(pState->states, 0, sizeof(*pState->states) * pState->numOfSub);
+ tscDebug("%p reset all sub states to 0", pSql);
+
pRes->code = TSDB_CODE_SUCCESS;
int32_t i = 0;
@@ -1877,7 +2017,6 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
assert(pSql != NULL);
SSubqueryState* pState = &pParentSql->subState;
- assert(pState->numOfRemain <= pState->numOfSub && pState->numOfRemain >= 0);
// retrieved in subquery failed. OR query cancelled in retrieve phase.
if (taos_errno(pSql) == TSDB_CODE_SUCCESS && pParentSql->res.code != TSDB_CODE_SUCCESS) {
@@ -1908,14 +2047,12 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
}
}
- int32_t remain = -1;
- if ((remain = atomic_sub_fetch_32(&pState->numOfRemain, 1)) > 0) {
- tscDebug("%p sub:%p orderOfSub:%d freed, finished subqueries:%d", pParentSql, pSql, trsupport->subqueryIndex,
- pState->numOfSub - remain);
+ if (!subAndCheckDone(pSql, pParentSql, subqueryIndex)) {
+ tscDebug("%p sub:%p,%d freed, not finished, total:%d", pParentSql, pSql, trsupport->subqueryIndex, pState->numOfSub);
tscFreeRetrieveSup(pSql);
return;
- }
+ }
// all subqueries are failed
tscError("%p retrieve from %d vnode(s) completed,code:%s.FAILED.", pParentSql, pState->numOfSub,
@@ -1980,14 +2117,12 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
return;
}
- int32_t remain = -1;
- if ((remain = atomic_sub_fetch_32(&pParentSql->subState.numOfRemain, 1)) > 0) {
- tscDebug("%p sub:%p orderOfSub:%d freed, finished subqueries:%d", pParentSql, pSql, trsupport->subqueryIndex,
- pState->numOfSub - remain);
+ if (!subAndCheckDone(pSql, pParentSql, idx)) {
+ tscDebug("%p sub:%p orderOfSub:%d freed, not finished", pParentSql, pSql, trsupport->subqueryIndex);
tscFreeRetrieveSup(pSql);
return;
- }
+ }
// all sub-queries are returned, start to local merge process
pDesc->pColumnModel->capacity = trsupport->pExtMemBuffer[idx]->numOfElemsPerPage;
@@ -2033,7 +2168,6 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
SSqlObj * pParentSql = trsupport->pParentSql;
SSubqueryState* pState = &pParentSql->subState;
- assert(pState->numOfRemain <= pState->numOfSub && pState->numOfRemain >= 0);
STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(&pSql->cmd, 0, 0);
SVgroupInfo *pVgroup = &pTableMetaInfo->vgroupList->vgroups[0];
@@ -2254,7 +2388,8 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
}
}
- if (atomic_sub_fetch_32(&pParentObj->subState.numOfRemain, 1) > 0) {
+ if (!subAndCheckDone(tres, pParentObj, pSupporter->index)) {
+ tscDebug("%p insert:%p,%d completed, total:%d", pParentObj, tres, pSupporter->index, pParentObj->subState.numOfSub);
return;
}
@@ -2288,6 +2423,8 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
STableMetaInfo* pMasterTableMetaInfo = tscGetTableMetaInfoFromCmd(&pParentObj->cmd, pSql->cmd.clauseIndex, 0);
tscAddTableMetaInfo(pQueryInfo, pMasterTableMetaInfo->name, NULL, NULL, NULL, NULL);
+ subquerySetState(pSql, &pParentObj->subState, i, 0);
+
tscDebug("%p, failed sub:%d, %p", pParentObj, i, pSql);
}
}
@@ -2302,7 +2439,6 @@ static void multiVnodeInsertFinalize(void* param, TAOS_RES* tres, int numOfRows)
}
pParentObj->cmd.parseFinished = false;
- pParentObj->subState.numOfRemain = numOfFailed;
tscResetSqlCmdObj(&pParentObj->cmd);
@@ -2378,7 +2514,19 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
// the number of already initialized subqueries
int32_t numOfSub = 0;
- pSql->subState.numOfRemain = pSql->subState.numOfSub;
+ if (pSql->subState.states == NULL) {
+ pSql->subState.states = calloc(pSql->subState.numOfSub, sizeof(*pSql->subState.states));
+ if (pSql->subState.states == NULL) {
+ pRes->code = TSDB_CODE_TSC_OUT_OF_MEMORY;
+ goto _error;
+ }
+
+ pthread_mutex_init(&pSql->subState.mutex, NULL);
+ }
+
+ memset(pSql->subState.states, 0, sizeof(*pSql->subState.states) * pSql->subState.numOfSub);
+ tscDebug("%p reset all sub states to 0", pSql);
+
pSql->pSubs = calloc(pSql->subState.numOfSub, POINTER_BYTES);
if (pSql->pSubs == NULL) {
goto _error;
diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c
index 96cfb4df9a..19a1e99c33 100644
--- a/src/client/src/tscUtil.c
+++ b/src/client/src/tscUtil.c
@@ -441,6 +441,12 @@ static void tscFreeSubobj(SSqlObj* pSql) {
pSql->pSubs[i] = NULL;
}
+ if (pSql->subState.states) {
+ pthread_mutex_destroy(&pSql->subState.mutex);
+ }
+
+ tfree(pSql->subState.states);
+
pSql->subState.numOfSub = 0;
}
@@ -603,6 +609,7 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) {
assert(pCmd->numOfClause == 1);
STableMetaInfo* pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0);
+ // todo refactor
// set the correct table meta object, the table meta has been locked in pDataBlocks, so it must be in the cache
if (pTableMetaInfo->pTableMeta != pDataBlock->pTableMeta) {
tstrncpy(pTableMetaInfo->name, pDataBlock->tableName, sizeof(pTableMetaInfo->name));
@@ -689,7 +696,6 @@ int32_t tscCreateDataBlock(size_t initialSize, int32_t rowSize, int32_t startOff
int32_t tscGetDataBlockFromList(SHashObj* pHashList, int64_t id, int32_t size, int32_t startOffset, int32_t rowSize, const char* tableId, STableMeta* pTableMeta,
STableDataBlocks** dataBlocks, SArray* pBlockList) {
*dataBlocks = NULL;
-
STableDataBlocks** t1 = (STableDataBlocks**)taosHashGet(pHashList, (const char*)&id, sizeof(id));
if (t1 != NULL) {
*dataBlocks = *t1;
@@ -785,9 +791,13 @@ static int32_t getRowExpandSize(STableMeta* pTableMeta) {
return result;
}
-static void extractTableNameList(SSqlCmd* pCmd) {
+static void extractTableNameList(SSqlCmd* pCmd, bool freeBlockMap) {
pCmd->numOfTables = (int32_t) taosHashGetSize(pCmd->pTableBlockHashList);
- pCmd->pTableNameList = calloc(pCmd->numOfTables, POINTER_BYTES);
+ if (pCmd->pTableNameList == NULL) {
+ pCmd->pTableNameList = calloc(pCmd->numOfTables, POINTER_BYTES);
+ } else {
+ memset(pCmd->pTableNameList, 0, pCmd->numOfTables * POINTER_BYTES);
+ }
STableDataBlocks **p1 = taosHashIterate(pCmd->pTableBlockHashList, NULL);
int32_t i = 0;
@@ -797,10 +807,12 @@ static void extractTableNameList(SSqlCmd* pCmd) {
p1 = taosHashIterate(pCmd->pTableBlockHashList, p1);
}
- pCmd->pTableBlockHashList = tscDestroyBlockHashTable(pCmd->pTableBlockHashList);
+ if (freeBlockMap) {
+ pCmd->pTableBlockHashList = tscDestroyBlockHashTable(pCmd->pTableBlockHashList);
+ }
}
-int32_t tscMergeTableDataBlocks(SSqlObj* pSql) {
+int32_t tscMergeTableDataBlocks(SSqlObj* pSql, bool freeBlockMap) {
const int INSERT_HEAD_SIZE = sizeof(SMsgDesc) + sizeof(SSubmitMsg);
SSqlCmd* pCmd = &pSql->cmd;
@@ -880,7 +892,7 @@ int32_t tscMergeTableDataBlocks(SSqlObj* pSql) {
pOneTableBlock = *p;
}
- extractTableNameList(pCmd);
+ extractTableNameList(pCmd, freeBlockMap);
// free the table data blocks;
pCmd->pDataBlocks = pVnodeDataBlockList;
@@ -1915,7 +1927,7 @@ void registerSqlObj(SSqlObj* pSql) {
tscDebug("%p new SqlObj from %p, total in tscObj:%d, total:%d", pSql, pSql->pTscObj, num, total);
}
-SSqlObj* createSimpleSubObj(SSqlObj* pSql, void (*fp)(), void* param, int32_t cmd) {
+SSqlObj* createSimpleSubObj(SSqlObj* pSql, __async_cb_func_t fp, void* param, int32_t cmd) {
SSqlObj* pNew = (SSqlObj*)calloc(1, sizeof(SSqlObj));
if (pNew == NULL) {
tscError("%p new subquery failed, tableIndex:%d", pSql, 0);
@@ -2000,7 +2012,7 @@ static void doSetSqlExprAndResultFieldInfo(SQueryInfo* pNewQueryInfo, int64_t ui
tscFieldInfoUpdateOffset(pNewQueryInfo);
}
-SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void* param, int32_t cmd, SSqlObj* pPrevSql) {
+SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t fp, void* param, int32_t cmd, SSqlObj* pPrevSql) {
SSqlCmd* pCmd = &pSql->cmd;
SSqlObj* pNew = (SSqlObj*)calloc(1, sizeof(SSqlObj));
@@ -2196,7 +2208,7 @@ void tscDoQuery(SSqlObj* pSql) {
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex);
uint16_t type = pQueryInfo->type;
- if (pSql->fp == (void(*)())tscHandleMultivnodeInsert) { // multi-vnodes insertion
+ if (TSDB_QUERY_HAS_TYPE(type, TSDB_QUERY_TYPE_INSERT)) { // multi-vnodes insertion
tscHandleMultivnodeInsert(pSql);
return;
}
diff --git a/src/client/tests/resultFieldTest.cpp b/src/client/tests/cliTest.cpp
similarity index 58%
rename from src/client/tests/resultFieldTest.cpp
rename to src/client/tests/cliTest.cpp
index c917f0ebaf..5cfe61d92a 100644
--- a/src/client/tests/resultFieldTest.cpp
+++ b/src/client/tests/cliTest.cpp
@@ -2,15 +2,117 @@
#include
#include "taos.h"
+#include "tglobal.h"
namespace {
static int64_t start_ts = 1433955661000;
-}
-/* test parse time function */
-TEST(testCase, result_field_test) {
- taos_options(TSDB_OPTION_CONFIGDIR, "~/first/cfg");
- taos_init();
+void stmtInsertTest() {
+ TAOS* conn = taos_connect("ubuntu", "root", "taosdata", 0, 0);
+ if (conn == NULL) {
+ printf("Failed to connect to DB, reason:%s", taos_errstr(conn));
+ exit(-1);
+ }
+
+ TAOS_RES* res = taos_query(conn, "use test");
+ taos_free_result(res);
+
+ const char* sql = "insert into t1 values(?, ?, ?, ?)";
+ TAOS_STMT* stmt = taos_stmt_init(conn);
+
+ int32_t ret = taos_stmt_prepare(stmt, sql, 0);
+ ASSERT_EQ(ret, 0);
+
+ //ts timestamp, k int, a binary(11), b nchar(4)
+ struct {
+ int64_t ts;
+ int k;
+ char* a;
+ char* b;
+ } v = {0};
+
+ TAOS_BIND params[4];
+ params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
+ params[0].buffer_length = sizeof(v.ts);
+ params[0].buffer = &v.ts;
+ params[0].length = ¶ms[0].buffer_length;
+ params[0].is_null = NULL;
+
+ params[1].buffer_type = TSDB_DATA_TYPE_INT;
+ params[1].buffer_length = sizeof(v.k);
+ params[1].buffer = &v.k;
+ params[1].length = ¶ms[1].buffer_length;
+ params[1].is_null = NULL;
+
+ params[2].buffer_type = TSDB_DATA_TYPE_BINARY;
+ params[2].buffer_length = sizeof(v.a);
+ params[2].buffer = &v.a;
+ params[2].is_null = NULL;
+
+ params[3].buffer_type = TSDB_DATA_TYPE_NCHAR;
+ params[3].buffer_length = sizeof(v.b);
+ params[3].buffer = &v.b;
+ params[3].is_null = NULL;
+
+ v.ts = start_ts + 20;
+ v.k = 123;
+
+ char* str = "abc";
+ uintptr_t len = strlen(str);
+
+ v.a = str;
+ params[2].length = &len;
+ params[2].buffer_length = len;
+ params[2].buffer = str;
+
+ char* nstr = "999";
+ uintptr_t len1 = strlen(nstr);
+
+ v.b = nstr;
+ params[3].buffer_length = len1;
+ params[3].buffer = nstr;
+ params[3].length = &len1;
+
+ taos_stmt_bind_param(stmt, params);
+ taos_stmt_add_batch(stmt);
+
+ if (taos_stmt_execute(stmt) != 0) {
+ printf("\033[31mfailed to execute insert statement.\033[0m\n");
+ return;
+ }
+
+ v.ts = start_ts + 30;
+ v.k = 911;
+
+ str = "92";
+ len = strlen(str);
+
+ params[2].length = &len;
+ params[2].buffer_length = len;
+ params[2].buffer = str;
+
+ nstr = "1920";
+ len1 = strlen(nstr);
+
+ params[3].buffer_length = len1;
+ params[3].buffer = nstr;
+ params[3].length = &len1;
+
+ taos_stmt_bind_param(stmt, params);
+ taos_stmt_add_batch(stmt);
+
+ ret = taos_stmt_execute(stmt);
+ if (ret != 0) {
+ printf("%p\n", ret);
+ printf("\033[31mfailed to execute insert statement.\033[0m\n");
+ return;
+ }
+
+ taos_stmt_close(stmt);
+ taos_close(conn);
+}
+
+void validateResultFields() {
TAOS* conn = taos_connect("ubuntu", "root", "taosdata", 0, 0);
if (conn == NULL) {
printf("Failed to connect to DB, reason:%s", taos_errstr(conn));
@@ -134,5 +236,31 @@ TEST(testCase, result_field_test) {
ASSERT_STREQ(fields[6].name, "first(ts)");
taos_free_result(res);
+
+ // update the configure parameter, the result field name will be changed
+ tsKeepOriginalColumnName = 1;
+ res = taos_query(conn, "select first(ts, a, k, k, b, b, ts) from t1");
+ ASSERT_EQ(taos_num_fields(res), 7);
+
+ fields = taos_fetch_fields(res);
+ ASSERT_EQ(fields[0].bytes, 8);
+ ASSERT_EQ(fields[0].type, TSDB_DATA_TYPE_TIMESTAMP);
+ ASSERT_STREQ(fields[0].name, "ts");
+
+ ASSERT_EQ(fields[2].bytes, 4);
+ ASSERT_EQ(fields[2].type, TSDB_DATA_TYPE_INT);
+ ASSERT_STREQ(fields[2].name, "k");
+
+ taos_free_result(res);
+
taos_close(conn);
}
+}
+/* test parse time function */
+TEST(testCase, result_field_test) {
+ taos_options(TSDB_OPTION_CONFIGDIR, "~/first/cfg");
+ taos_init();
+
+ validateResultFields();
+ stmtInsertTest();
+}
diff --git a/src/common/inc/tdataformat.h b/src/common/inc/tdataformat.h
index 8d4949d9b4..43208e0e47 100644
--- a/src/common/inc/tdataformat.h
+++ b/src/common/inc/tdataformat.h
@@ -20,7 +20,7 @@
#include
#include "talgo.h"
-#include "taosdef.h"
+#include "ttype.h"
#include "tutil.h"
#ifdef __cplusplus
diff --git a/src/common/inc/tglobal.h b/src/common/inc/tglobal.h
index c54d519637..54334d49f3 100644
--- a/src/common/inc/tglobal.h
+++ b/src/common/inc/tglobal.h
@@ -180,7 +180,7 @@ extern int32_t tsLogKeepDays;
extern int32_t dDebugFlag;
extern int32_t vDebugFlag;
extern int32_t mDebugFlag;
-extern int32_t cDebugFlag;
+extern uint32_t cDebugFlag;
extern int32_t jniDebugFlag;
extern int32_t tmrDebugFlag;
extern int32_t sdbDebugFlag;
diff --git a/src/common/inc/tname.h b/src/common/inc/tname.h
index 9e0093ebfe..44f1047543 100644
--- a/src/common/inc/tname.h
+++ b/src/common/inc/tname.h
@@ -39,4 +39,18 @@ SColumnFilterInfo* tscFilterInfoClone(const SColumnFilterInfo* src, int32_t numO
SSchema tscGetTbnameColumnSchema();
+/**
+ * check if the schema is valid or not, including following aspects:
+ * 1. number of columns
+ * 2. column types
+ * 3. column length
+ * 4. column names
+ * 5. total length
+ *
+ * @param pSchema
+ * @param numOfCols
+ * @return
+ */
+bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags);
+
#endif // TDENGINE_NAME_H
diff --git a/src/common/src/tglobal.c b/src/common/src/tglobal.c
index 125e805642..cfe91d3519 100644
--- a/src/common/src/tglobal.c
+++ b/src/common/src/tglobal.c
@@ -212,7 +212,7 @@ int32_t mDebugFlag = 131;
int32_t sdbDebugFlag = 131;
int32_t dDebugFlag = 135;
int32_t vDebugFlag = 135;
-int32_t cDebugFlag = 131;
+uint32_t cDebugFlag = 131;
int32_t jniDebugFlag = 131;
int32_t odbcDebugFlag = 131;
int32_t httpDebugFlag = 131;
diff --git a/src/common/src/tname.c b/src/common/src/tname.c
index 5c351edf48..f35867ede3 100644
--- a/src/common/src/tname.c
+++ b/src/common/src/tname.c
@@ -6,6 +6,10 @@
#include "ttokendef.h"
#include "tvariant.h"
+#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS)
+
+#define VALIDNUMOFTAGS(x) ((x) >= 0 && (x) <= TSDB_MAX_TAGS)
+
// todo refactor
UNUSED_FUNC static FORCE_INLINE const char* skipSegments(const char* input, char delim, int32_t num) {
for (int32_t i = 0; i < num; ++i) {
@@ -62,7 +66,7 @@ SSchema tGetUserSpecifiedColumnSchema(tVariant* pVal, SStrToken* exprStr, const
if (s.type == TSDB_DATA_TYPE_BINARY || s.type == TSDB_DATA_TYPE_NCHAR) {
s.bytes = (int16_t)(pVal->nLen + VARSTR_HEADER_SIZE);
} else {
- s.bytes = tDataTypeDesc[pVal->nType].nSize;
+ s.bytes = tDataTypes[pVal->nType].bytes;
}
s.colId = TSDB_UD_COLUMN_INDEX;
@@ -206,3 +210,65 @@ SSchema tscGetTbnameColumnSchema() {
strcpy(s.name, TSQL_TBNAME_L);
return s;
}
+
+static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen) {
+ int32_t rowLen = 0;
+
+ for (int32_t i = 0; i < numOfCols; ++i) {
+ // 1. valid types
+ if (!isValidDataType(pSchema[i].type)) {
+ return false;
+ }
+
+ // 2. valid length for each type
+ if (pSchema[i].type == TSDB_DATA_TYPE_BINARY) {
+ if (pSchema[i].bytes > TSDB_MAX_BINARY_LEN) {
+ return false;
+ }
+ } else if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR) {
+ if (pSchema[i].bytes > TSDB_MAX_NCHAR_LEN) {
+ return false;
+ }
+ } else {
+ if (pSchema[i].bytes != tDataTypes[pSchema[i].type].bytes) {
+ return false;
+ }
+ }
+
+ // 3. valid column names
+ for (int32_t j = i + 1; j < numOfCols; ++j) {
+ if (strncasecmp(pSchema[i].name, pSchema[j].name, sizeof(pSchema[i].name) - 1) == 0) {
+ return false;
+ }
+ }
+
+ rowLen += pSchema[i].bytes;
+ }
+
+ return rowLen <= maxLen;
+}
+
+bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags) {
+ if (!VALIDNUMOFCOLS(numOfCols)) {
+ return false;
+ }
+
+ if (!VALIDNUMOFTAGS(numOfTags)) {
+ return false;
+ }
+
+ /* first column must be the timestamp, which is a primary key */
+ if (pSchema[0].type != TSDB_DATA_TYPE_TIMESTAMP) {
+ return false;
+ }
+
+ if (!doValidateSchema(pSchema, numOfCols, TSDB_MAX_BYTES_PER_ROW)) {
+ return false;
+ }
+
+ if (!doValidateSchema(&pSchema[numOfCols], numOfTags, TSDB_MAX_TAGS_LEN)) {
+ return false;
+ }
+
+ return true;
+}
diff --git a/src/common/src/ttypes.c b/src/common/src/ttypes.c
index 8197fb1042..0d5910ea38 100644
--- a/src/common/src/ttypes.c
+++ b/src/common/src/ttypes.c
@@ -14,7 +14,7 @@
*/
#include "os.h"
-#include "taosdef.h"
+#include "ttype.h"
#include "ttokendef.h"
#include "tscompression.h"
@@ -367,7 +367,7 @@ static void getStatics_nchr(const void *pData, int32_t numOfRow, int64_t *min, i
*maxIndex = 0;
}
-tDataTypeDescriptor tDataTypeDesc[15] = {
+tDataTypeDescriptor tDataTypes[15] = {
{TSDB_DATA_TYPE_NULL, 6,1, "NOTYPE", NULL, NULL, NULL},
{TSDB_DATA_TYPE_BOOL, 4, CHAR_BYTES, "BOOL", tsCompressBool, tsDecompressBool, getStatics_bool},
{TSDB_DATA_TYPE_TINYINT, 7, CHAR_BYTES, "TINYINT", tsCompressTinyint, tsDecompressTinyint, getStatics_i8},
@@ -423,58 +423,58 @@ void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems) {
switch (type) {
case TSDB_DATA_TYPE_BOOL:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint8_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_BOOL_NULL;
+ *(uint8_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_BOOL_NULL;
}
break;
case TSDB_DATA_TYPE_TINYINT:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint8_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_TINYINT_NULL;
+ *(uint8_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_TINYINT_NULL;
}
break;
case TSDB_DATA_TYPE_SMALLINT:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint16_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_SMALLINT_NULL;
+ *(uint16_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_SMALLINT_NULL;
}
break;
case TSDB_DATA_TYPE_INT:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint32_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_INT_NULL;
+ *(uint32_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_INT_NULL;
}
break;
case TSDB_DATA_TYPE_BIGINT:
case TSDB_DATA_TYPE_TIMESTAMP:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint64_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_BIGINT_NULL;
+ *(uint64_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_BIGINT_NULL;
}
break;
case TSDB_DATA_TYPE_UTINYINT:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint8_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_UTINYINT_NULL;
+ *(uint8_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_UTINYINT_NULL;
}
break;
case TSDB_DATA_TYPE_USMALLINT:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint16_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_USMALLINT_NULL;
+ *(uint16_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_USMALLINT_NULL;
}
break;
case TSDB_DATA_TYPE_UINT:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint32_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_UINT_NULL;
+ *(uint32_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_UINT_NULL;
}
break;
case TSDB_DATA_TYPE_UBIGINT:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint64_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_UBIGINT_NULL;
+ *(uint64_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_UBIGINT_NULL;
}
break;
case TSDB_DATA_TYPE_FLOAT:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint32_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_FLOAT_NULL;
+ *(uint32_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_FLOAT_NULL;
}
break;
case TSDB_DATA_TYPE_DOUBLE:
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint64_t *)(val + i * tDataTypeDesc[type].nSize) = TSDB_DATA_DOUBLE_NULL;
+ *(uint64_t *)(val + i * tDataTypes[type].bytes) = TSDB_DATA_DOUBLE_NULL;
}
break;
case TSDB_DATA_TYPE_NCHAR:
@@ -485,7 +485,7 @@ void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems) {
break;
default: {
for (int32_t i = 0; i < numOfElems; ++i) {
- *(uint32_t *)(val + i * tDataTypeDesc[TSDB_DATA_TYPE_INT].nSize) = TSDB_DATA_INT_NULL;
+ *(uint32_t *)(val + i * tDataTypes[TSDB_DATA_TYPE_INT].bytes) = TSDB_DATA_INT_NULL;
}
break;
}
@@ -524,15 +524,18 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) {
switch (type) {
case TSDB_DATA_TYPE_BOOL:
case TSDB_DATA_TYPE_TINYINT:
+ case TSDB_DATA_TYPE_UTINYINT:
*((int8_t *)val) = GET_INT8_VAL(src);
break;
case TSDB_DATA_TYPE_SMALLINT:
+ case TSDB_DATA_TYPE_USMALLINT:
*((int16_t *)val) = GET_INT16_VAL(src);
break;
- case TSDB_DATA_TYPE_INT: {
+ case TSDB_DATA_TYPE_INT:
+ case TSDB_DATA_TYPE_UINT:
*((int32_t *)val) = GET_INT32_VAL(src);
break;
- }
+
case TSDB_DATA_TYPE_FLOAT:
SET_FLOAT_VAL(val, GET_FLOAT_VAL(src));
break;
@@ -540,6 +543,7 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) {
SET_DOUBLE_VAL(val, GET_DOUBLE_VAL(src));
break;
case TSDB_DATA_TYPE_BIGINT:
+ case TSDB_DATA_TYPE_UBIGINT:
case TSDB_DATA_TYPE_TIMESTAMP:
*((int64_t *)val) = GET_INT64_VAL(src);
break;
diff --git a/src/common/src/tvariant.c b/src/common/src/tvariant.c
index 09c5c76163..95aa576889 100644
--- a/src/common/src/tvariant.c
+++ b/src/common/src/tvariant.c
@@ -205,7 +205,7 @@ void tVariantAssign(tVariant *pDst, const tVariant *pSrc) {
}
if (pDst->nType != TSDB_DATA_TYPE_ARRAY) {
- pDst->nLen = tDataTypeDesc[pDst->nType].nSize;
+ pDst->nLen = tDataTypes[pDst->nType].bytes;
}
}
@@ -425,7 +425,7 @@ static FORCE_INLINE int32_t convertToDouble(char *pStr, int32_t len, double *val
static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result, int32_t type, bool issigned, bool releaseVariantPtr) {
if (pVariant->nType == TSDB_DATA_TYPE_NULL) {
- setNull((char *)result, type, tDataTypeDesc[type].nSize);
+ setNull((char *)result, type, tDataTypes[type].bytes);
return 0;
}
@@ -446,7 +446,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
pVariant->nLen = 0;
}
- setNull((char *)result, type, tDataTypeDesc[type].nSize);
+ setNull((char *)result, type, tDataTypes[type].bytes);
return 0;
}
@@ -496,7 +496,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
free(pVariant->pz);
pVariant->nLen = 0;
}
- setNull((char *)result, type, tDataTypeDesc[type].nSize);
+ setNull((char *)result, type, tDataTypes[type].bytes);
return 0;
} else {
int64_t val = wcstoll(pVariant->wpz, &endPtr, 10);
diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c
index 79cc70005b..fbdf7f7b40 100644
--- a/src/dnode/src/dnodeShell.c
+++ b/src/dnode/src/dnodeShell.c
@@ -216,7 +216,7 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t tid) {
int16_t numOfTags = htons(pTable->numOfTags);
int32_t tableId = htonl(pTable->tid);
uint64_t uid = htobe64(pTable->uid);
- dInfo("table:%s, numOfColumns:%d numOfTags:%d tid:%d uid:%" PRIu64, pTable->tableId, numOfColumns, numOfTags, tableId, uid);
+ dInfo("table:%s, numOfColumns:%d numOfTags:%d tid:%d uid:%" PRIu64, pTable->tableFname, numOfColumns, numOfTags, tableId, uid);
return rpcRsp.pCont;
}
diff --git a/src/inc/taos.h b/src/inc/taos.h
index 5e4f50e31d..05d390ffd0 100644
--- a/src/inc/taos.h
+++ b/src/inc/taos.h
@@ -140,7 +140,7 @@ DLL_EXPORT int taos_errno(TAOS_RES *tres);
DLL_EXPORT void taos_query_a(TAOS *taos, const char *sql, void (*fp)(void *param, TAOS_RES *, int code), void *param);
DLL_EXPORT void taos_fetch_rows_a(TAOS_RES *res, void (*fp)(void *param, TAOS_RES *, int numOfRows), void *param);
-DLL_EXPORT void taos_fetch_row_a(TAOS_RES *res, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row), void *param);
+//DLL_EXPORT void taos_fetch_row_a(TAOS_RES *res, void (*fp)(void *param, TAOS_RES *, TAOS_ROW row), void *param);
typedef void (*TAOS_SUBSCRIBE_CALLBACK)(TAOS_SUB* tsub, TAOS_RES *res, void* param, int code);
DLL_EXPORT TAOS_SUB *taos_subscribe(TAOS* taos, int restart, const char* topic, const char *sql, TAOS_SUBSCRIBE_CALLBACK fp, void *param, int interval);
diff --git a/src/inc/taosdef.h b/src/inc/taosdef.h
index 7ccb7db935..d751dbb969 100644
--- a/src/inc/taosdef.h
+++ b/src/inc/taosdef.h
@@ -36,29 +36,6 @@ extern "C" {
#define TSWINDOW_INITIALIZER ((STimeWindow) {INT64_MIN, INT64_MAX})
#define TSKEY_INITIAL_VAL INT64_MIN
-// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
-typedef int32_t VarDataOffsetT;
-typedef int16_t VarDataLenT;
-
-typedef struct tstr {
- VarDataLenT len;
- char data[];
-} tstr;
-
-#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
-
-#define varDataLen(v) ((VarDataLenT *)(v))[0]
-#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v))
-#define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE))
-#define varDataCopy(dst, v) memcpy((dst), (void*) (v), varDataTLen(v))
-#define varDataLenByData(v) (*(VarDataLenT *)(((char*)(v)) - VARSTR_HEADER_SIZE))
-#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT) (_len))
-#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_BINARY) || ((t) == TSDB_DATA_TYPE_NCHAR))
-
-// this data type is internally used only in 'in' query to hold the values
-#define TSDB_DATA_TYPE_ARRAY (TSDB_DATA_TYPE_NCHAR + 1)
-
-
// Bytes for each type.
extern const int32_t TYPE_BYTES[15];
@@ -164,70 +141,6 @@ do { \
#define SET_DOUBLE_PTR(x, y) { (*(double *)(x)) = (*(double *)(y)); }
#endif
-typedef struct tDataTypeDescriptor {
- int16_t nType;
- int16_t nameLen;
- int32_t nSize;
- char * aName;
- int (*compFunc)(const char *const input, int inputSize, const int nelements, char *const output, int outputSize,
- char algorithm, char *const buffer, int bufferSize);
- int (*decompFunc)(const char *const input, int compressedSize, const int nelements, char *const output,
- int outputSize, char algorithm, char *const buffer, int bufferSize);
- void (*getStatisFunc)(const void *pData, int32_t numofrow, int64_t *min, int64_t *max, int64_t *sum,
- int16_t *minindex, int16_t *maxindex, int16_t *numofnull);
-} tDataTypeDescriptor;
-
-extern tDataTypeDescriptor tDataTypeDesc[15];
-
-bool isValidDataType(int32_t type);
-
-static FORCE_INLINE bool isNull(const char *val, int32_t type) {
- switch (type) {
- case TSDB_DATA_TYPE_BOOL:
- return *(uint8_t *)val == TSDB_DATA_BOOL_NULL;
- case TSDB_DATA_TYPE_TINYINT:
- return *(uint8_t *)val == TSDB_DATA_TINYINT_NULL;
- case TSDB_DATA_TYPE_SMALLINT:
- return *(uint16_t *)val == TSDB_DATA_SMALLINT_NULL;
- case TSDB_DATA_TYPE_INT:
- return *(uint32_t *)val == TSDB_DATA_INT_NULL;
- case TSDB_DATA_TYPE_BIGINT:
- case TSDB_DATA_TYPE_TIMESTAMP:
- return *(uint64_t *)val == TSDB_DATA_BIGINT_NULL;
- case TSDB_DATA_TYPE_FLOAT:
- return *(uint32_t *)val == TSDB_DATA_FLOAT_NULL;
- case TSDB_DATA_TYPE_DOUBLE:
- return *(uint64_t *)val == TSDB_DATA_DOUBLE_NULL;
- case TSDB_DATA_TYPE_NCHAR:
- return varDataLen(val) == sizeof(int32_t) && *(uint32_t*) varDataVal(val) == TSDB_DATA_NCHAR_NULL;
- case TSDB_DATA_TYPE_BINARY:
- return varDataLen(val) == sizeof(int8_t) && *(uint8_t *) varDataVal(val) == TSDB_DATA_BINARY_NULL;
- case TSDB_DATA_TYPE_UTINYINT:
- return *(uint8_t*) val == TSDB_DATA_UTINYINT_NULL;
- case TSDB_DATA_TYPE_USMALLINT:
- return *(uint16_t*) val == TSDB_DATA_USMALLINT_NULL;
- case TSDB_DATA_TYPE_UINT:
- return *(uint32_t*) val == TSDB_DATA_UINT_NULL;
- case TSDB_DATA_TYPE_UBIGINT:
- return *(uint64_t*) val == TSDB_DATA_UBIGINT_NULL;
-
- default:
- return false;
- };
-}
-
-void setVardataNull(char* val, int32_t type);
-void setNull(char *val, int32_t type, int32_t bytes);
-void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems);
-void* getNullValue(int32_t type);
-
-void assignVal(char *val, const char *src, int32_t len, int32_t type);
-void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf);
-
-int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bool issigned);
-
-#define SET_DOUBLE_NULL(v) (*(uint64_t *)(v) = TSDB_DATA_DOUBLE_NULL)
-
// TODO: check if below is necessary
#define TSDB_RELATION_INVALID 0
#define TSDB_RELATION_LESS 1
@@ -270,7 +183,7 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_MAX_SAVED_SQL_LEN TSDB_MAX_COLUMNS * 64
#define TSDB_MAX_SQL_LEN TSDB_PAYLOAD_SIZE
#define TSDB_MAX_SQL_SHOW_LEN 512
-#define TSDB_MAX_ALLOWED_SQL_LEN (1*1024*1024U) // sql length should be less than 1mb
+#define TSDB_MAX_ALLOWED_SQL_LEN (1*1024*1024u) // sql length should be less than 1mb
#define TSDB_APPNAME_LEN TSDB_UNI_LEN
@@ -399,8 +312,8 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_MAX_RPC_THREADS 5
-#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
-#define TSDB_QUERY_TYPE_FREE_RESOURCE 0x01u // free qhandle at vnode
+#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
+#define TSDB_QUERY_TYPE_FREE_RESOURCE 0x01u // free qhandle at vnode
/*
* 1. ordinary sub query for select * from super_table
@@ -420,29 +333,29 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_QUERY_TYPE_MULTITABLE_QUERY 0x200u
#define TSDB_QUERY_TYPE_STMT_INSERT 0x800u // stmt insert type
-#define TSDB_QUERY_HAS_TYPE(x, _type) (((x) & (_type)) != 0)
-#define TSDB_QUERY_SET_TYPE(x, _type) ((x) |= (_type))
-#define TSDB_QUERY_CLEAR_TYPE(x, _type) ((x) &= (~_type))
-#define TSDB_QUERY_RESET_TYPE(x) ((x) = TSDB_QUERY_TYPE_NON_TYPE)
+#define TSDB_QUERY_HAS_TYPE(x, _type) (((x) & (_type)) != 0)
+#define TSDB_QUERY_SET_TYPE(x, _type) ((x) |= (_type))
+#define TSDB_QUERY_CLEAR_TYPE(x, _type) ((x) &= (~_type))
+#define TSDB_QUERY_RESET_TYPE(x) ((x) = TSDB_QUERY_TYPE_NON_TYPE)
-#define TSDB_ORDER_ASC 1
-#define TSDB_ORDER_DESC 2
+#define TSDB_ORDER_ASC 1
+#define TSDB_ORDER_DESC 2
+
+#define TSDB_DEFAULT_CLUSTER_HASH_SIZE 1
+#define TSDB_DEFAULT_MNODES_HASH_SIZE 5
+#define TSDB_DEFAULT_DNODES_HASH_SIZE 10
+#define TSDB_DEFAULT_ACCOUNTS_HASH_SIZE 10
+#define TSDB_DEFAULT_USERS_HASH_SIZE 20
+#define TSDB_DEFAULT_DBS_HASH_SIZE 100
+#define TSDB_DEFAULT_VGROUPS_HASH_SIZE 100
+#define TSDB_DEFAULT_STABLES_HASH_SIZE 100
+#define TSDB_DEFAULT_CTABLES_HASH_SIZE 20000
-#define TSDB_DEFAULT_CLUSTER_HASH_SIZE 1
-#define TSDB_DEFAULT_MNODES_HASH_SIZE 5
-#define TSDB_DEFAULT_DNODES_HASH_SIZE 10
-#define TSDB_DEFAULT_ACCOUNTS_HASH_SIZE 10
-#define TSDB_DEFAULT_USERS_HASH_SIZE 20
-#define TSDB_DEFAULT_DBS_HASH_SIZE 100
-#define TSDB_DEFAULT_VGROUPS_HASH_SIZE 100
-#define TSDB_DEFAULT_STABLES_HASH_SIZE 100
-#define TSDB_DEFAULT_CTABLES_HASH_SIZE 20000
-
-#define TSDB_PORT_DNODESHELL 0
-#define TSDB_PORT_DNODEDNODE 5
-#define TSDB_PORT_SYNC 10
-#define TSDB_PORT_HTTP 11
-#define TSDB_PORT_ARBITRATOR 12
+#define TSDB_PORT_DNODESHELL 0
+#define TSDB_PORT_DNODEDNODE 5
+#define TSDB_PORT_SYNC 10
+#define TSDB_PORT_HTTP 11
+#define TSDB_PORT_ARBITRATOR 12
#define TSDB_MAX_WAL_SIZE (1024*1024*3)
diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h
index 905867fbc7..4582efbc40 100644
--- a/src/inc/taosmsg.h
+++ b/src/inc/taosmsg.h
@@ -153,30 +153,31 @@ enum _mgmt_table {
#define TSDB_ALTER_TABLE_DROP_COLUMN 6
#define TSDB_ALTER_TABLE_CHANGE_COLUMN 7
-#define TSDB_FILL_NONE 0
-#define TSDB_FILL_NULL 1
-#define TSDB_FILL_SET_VALUE 2
-#define TSDB_FILL_LINEAR 3
-#define TSDB_FILL_PREV 4
+#define TSDB_FILL_NONE 0
+#define TSDB_FILL_NULL 1
+#define TSDB_FILL_SET_VALUE 2
+#define TSDB_FILL_LINEAR 3
+#define TSDB_FILL_PREV 4
+#define TSDB_FILL_NEXT 5
-#define TSDB_ALTER_USER_PASSWD 0x1
+#define TSDB_ALTER_USER_PASSWD 0x1
#define TSDB_ALTER_USER_PRIVILEGES 0x2
-#define TSDB_KILL_MSG_LEN 30
+#define TSDB_KILL_MSG_LEN 30
-#define TSDB_VN_READ_ACCCESS ((char)0x1)
-#define TSDB_VN_WRITE_ACCCESS ((char)0x2)
+#define TSDB_VN_READ_ACCCESS ((char)0x1)
+#define TSDB_VN_WRITE_ACCCESS ((char)0x2)
#define TSDB_VN_ALL_ACCCESS (TSDB_VN_READ_ACCCESS | TSDB_VN_WRITE_ACCCESS)
-#define TSDB_COL_NORMAL 0x0u // the normal column of the table
-#define TSDB_COL_TAG 0x1u // the tag column type
-#define TSDB_COL_UDC 0x2u // the user specified normal string column, it is a dummy column
-#define TSDB_COL_NULL 0x4u // the column filter NULL or not
+#define TSDB_COL_NORMAL 0x0u // the normal column of the table
+#define TSDB_COL_TAG 0x1u // the tag column type
+#define TSDB_COL_UDC 0x2u // the user specified normal string column, it is a dummy column
+#define TSDB_COL_NULL 0x4u // the column filter NULL or not
-#define TSDB_COL_IS_TAG(f) (((f&(~(TSDB_COL_NULL)))&TSDB_COL_TAG) != 0)
-#define TSDB_COL_IS_NORMAL_COL(f) ((f&(~(TSDB_COL_NULL))) == TSDB_COL_NORMAL)
-#define TSDB_COL_IS_UD_COL(f) ((f&(~(TSDB_COL_NULL))) == TSDB_COL_UDC)
-#define TSDB_COL_REQ_NULL(f) (((f)&TSDB_COL_NULL) != 0)
+#define TSDB_COL_IS_TAG(f) (((f&(~(TSDB_COL_NULL)))&TSDB_COL_TAG) != 0)
+#define TSDB_COL_IS_NORMAL_COL(f) ((f&(~(TSDB_COL_NULL))) == TSDB_COL_NORMAL)
+#define TSDB_COL_IS_UD_COL(f) ((f&(~(TSDB_COL_NULL))) == TSDB_COL_UDC)
+#define TSDB_COL_REQ_NULL(f) (((f)&TSDB_COL_NULL) != 0)
extern char *taosMsg[];
@@ -260,14 +261,14 @@ typedef struct {
uint64_t uid;
uint64_t superTableUid;
uint64_t createdTime;
- char tableId[TSDB_TABLE_FNAME_LEN];
- char superTableId[TSDB_TABLE_FNAME_LEN];
+ char tableFname[TSDB_TABLE_FNAME_LEN];
+ char stableFname[TSDB_TABLE_FNAME_LEN];
char data[];
} SMDCreateTableMsg;
typedef struct {
int32_t len; // one create table message
- char tableId[TSDB_TABLE_FNAME_LEN];
+ char tableFname[TSDB_TABLE_FNAME_LEN];
char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN];
int8_t igExists;
int8_t getMeta;
@@ -284,12 +285,12 @@ typedef struct {
} SCMCreateTableMsg;
typedef struct {
- char tableId[TSDB_TABLE_FNAME_LEN];
+ char tableFname[TSDB_TABLE_FNAME_LEN];
int8_t igNotExists;
} SCMDropTableMsg;
typedef struct {
- char tableId[TSDB_TABLE_FNAME_LEN];
+ char tableFname[TSDB_TABLE_FNAME_LEN];
char db[TSDB_ACCT_ID_LEN + TSDB_DB_NAME_LEN];
int16_t type; /* operation type */
int16_t numOfCols; /* number of schema */
@@ -369,14 +370,14 @@ typedef struct {
int32_t vgId;
int32_t tid;
uint64_t uid;
- char tableId[TSDB_TABLE_FNAME_LEN];
+ char tableFname[TSDB_TABLE_FNAME_LEN];
} SMDDropTableMsg;
typedef struct {
int32_t contLen;
int32_t vgId;
uint64_t uid;
- char tableId[TSDB_TABLE_FNAME_LEN];
+ char tableFname[TSDB_TABLE_FNAME_LEN];
} SDropSTableMsg;
typedef struct {
@@ -688,7 +689,7 @@ typedef struct {
} SCreateVnodeMsg, SAlterVnodeMsg;
typedef struct {
- char tableId[TSDB_TABLE_FNAME_LEN];
+ char tableFname[TSDB_TABLE_FNAME_LEN];
int16_t createFlag;
char tags[];
} STableInfoMsg;
@@ -726,7 +727,7 @@ typedef struct {
typedef struct STableMetaMsg {
int32_t contLen;
- char tableId[TSDB_TABLE_FNAME_LEN]; // table id
+ char tableFname[TSDB_TABLE_FNAME_LEN]; // table id
uint8_t numOfTags;
uint8_t precision;
uint8_t tableType;
@@ -847,7 +848,7 @@ typedef struct {
uint64_t uid;
uint64_t stime; // stream starting time
int32_t status;
- char tableId[TSDB_TABLE_FNAME_LEN];
+ char tableFname[TSDB_TABLE_FNAME_LEN];
} SAlterStreamMsg;
typedef struct {
diff --git a/src/inc/ttokendef.h b/src/inc/ttokendef.h
index 09500fc8c5..c877ccfb72 100644
--- a/src/inc/ttokendef.h
+++ b/src/inc/ttokendef.h
@@ -82,151 +82,154 @@
#define TK_STABLES 64
#define TK_VGROUPS 65
#define TK_DROP 66
-#define TK_DNODE 67
-#define TK_USER 68
-#define TK_ACCOUNT 69
-#define TK_USE 70
-#define TK_DESCRIBE 71
-#define TK_ALTER 72
-#define TK_PASS 73
-#define TK_PRIVILEGE 74
-#define TK_LOCAL 75
-#define TK_IF 76
-#define TK_EXISTS 77
-#define TK_PPS 78
-#define TK_TSERIES 79
-#define TK_DBS 80
-#define TK_STORAGE 81
-#define TK_QTIME 82
-#define TK_CONNS 83
-#define TK_STATE 84
-#define TK_KEEP 85
-#define TK_CACHE 86
-#define TK_REPLICA 87
-#define TK_QUORUM 88
-#define TK_DAYS 89
-#define TK_MINROWS 90
-#define TK_MAXROWS 91
-#define TK_BLOCKS 92
-#define TK_CTIME 93
-#define TK_WAL 94
-#define TK_FSYNC 95
-#define TK_COMP 96
-#define TK_PRECISION 97
-#define TK_UPDATE 98
-#define TK_CACHELAST 99
-#define TK_LP 100
-#define TK_RP 101
-#define TK_UNSIGNED 102
-#define TK_TAGS 103
-#define TK_USING 104
-#define TK_AS 105
-#define TK_COMMA 106
-#define TK_NULL 107
-#define TK_SELECT 108
-#define TK_UNION 109
-#define TK_ALL 110
-#define TK_FROM 111
-#define TK_VARIABLE 112
-#define TK_INTERVAL 113
-#define TK_FILL 114
-#define TK_SLIDING 115
-#define TK_ORDER 116
-#define TK_BY 117
-#define TK_ASC 118
-#define TK_DESC 119
-#define TK_GROUP 120
-#define TK_HAVING 121
-#define TK_LIMIT 122
-#define TK_OFFSET 123
-#define TK_SLIMIT 124
-#define TK_SOFFSET 125
-#define TK_WHERE 126
-#define TK_NOW 127
-#define TK_RESET 128
-#define TK_QUERY 129
-#define TK_ADD 130
-#define TK_COLUMN 131
-#define TK_TAG 132
-#define TK_CHANGE 133
-#define TK_SET 134
-#define TK_KILL 135
-#define TK_CONNECTION 136
-#define TK_STREAM 137
-#define TK_COLON 138
-#define TK_ABORT 139
-#define TK_AFTER 140
-#define TK_ATTACH 141
-#define TK_BEFORE 142
-#define TK_BEGIN 143
-#define TK_CASCADE 144
-#define TK_CLUSTER 145
-#define TK_CONFLICT 146
-#define TK_COPY 147
-#define TK_DEFERRED 148
-#define TK_DELIMITERS 149
-#define TK_DETACH 150
-#define TK_EACH 151
-#define TK_END 152
-#define TK_EXPLAIN 153
-#define TK_FAIL 154
-#define TK_FOR 155
-#define TK_IGNORE 156
-#define TK_IMMEDIATE 157
-#define TK_INITIALLY 158
-#define TK_INSTEAD 159
-#define TK_MATCH 160
-#define TK_KEY 161
-#define TK_OF 162
-#define TK_RAISE 163
-#define TK_REPLACE 164
-#define TK_RESTRICT 165
-#define TK_ROW 166
-#define TK_STATEMENT 167
-#define TK_TRIGGER 168
-#define TK_VIEW 169
-#define TK_COUNT 170
-#define TK_SUM 171
-#define TK_AVG 172
-#define TK_MIN 173
-#define TK_MAX 174
-#define TK_FIRST 175
-#define TK_LAST 176
-#define TK_TOP 177
-#define TK_BOTTOM 178
-#define TK_STDDEV 179
-#define TK_PERCENTILE 180
-#define TK_APERCENTILE 181
-#define TK_LEASTSQUARES 182
-#define TK_HISTOGRAM 183
-#define TK_DIFF 184
-#define TK_SPREAD 185
-#define TK_TWA 186
-#define TK_INTERP 187
-#define TK_LAST_ROW 188
-#define TK_RATE 189
-#define TK_IRATE 190
-#define TK_SUM_RATE 191
-#define TK_SUM_IRATE 192
-#define TK_AVG_RATE 193
-#define TK_AVG_IRATE 194
-#define TK_TBID 195
-#define TK_SEMI 196
-#define TK_NONE 197
-#define TK_PREV 198
-#define TK_LINEAR 199
-#define TK_IMPORT 200
-#define TK_METRIC 201
-#define TK_TBNAME 202
-#define TK_JOIN 203
-#define TK_METRICS 204
-#define TK_STABLE 205
+#define TK_STABLE 67
+#define TK_DNODE 68
+#define TK_USER 69
+#define TK_ACCOUNT 70
+#define TK_USE 71
+#define TK_DESCRIBE 72
+#define TK_ALTER 73
+#define TK_PASS 74
+#define TK_PRIVILEGE 75
+#define TK_LOCAL 76
+#define TK_IF 77
+#define TK_EXISTS 78
+#define TK_PPS 79
+#define TK_TSERIES 80
+#define TK_DBS 81
+#define TK_STORAGE 82
+#define TK_QTIME 83
+#define TK_CONNS 84
+#define TK_STATE 85
+#define TK_KEEP 86
+#define TK_CACHE 87
+#define TK_REPLICA 88
+#define TK_QUORUM 89
+#define TK_DAYS 90
+#define TK_MINROWS 91
+#define TK_MAXROWS 92
+#define TK_BLOCKS 93
+#define TK_CTIME 94
+#define TK_WAL 95
+#define TK_FSYNC 96
+#define TK_COMP 97
+#define TK_PRECISION 98
+#define TK_UPDATE 99
+#define TK_CACHELAST 100
+#define TK_LP 101
+#define TK_RP 102
+#define TK_UNSIGNED 103
+#define TK_TAGS 104
+#define TK_USING 105
+#define TK_AS 106
+#define TK_COMMA 107
+#define TK_NULL 108
+#define TK_SELECT 109
+#define TK_UNION 110
+#define TK_ALL 111
+#define TK_FROM 112
+#define TK_VARIABLE 113
+#define TK_INTERVAL 114
+#define TK_FILL 115
+#define TK_SLIDING 116
+#define TK_ORDER 117
+#define TK_BY 118
+#define TK_ASC 119
+#define TK_DESC 120
+#define TK_GROUP 121
+#define TK_HAVING 122
+#define TK_LIMIT 123
+#define TK_OFFSET 124
+#define TK_SLIMIT 125
+#define TK_SOFFSET 126
+#define TK_WHERE 127
+#define TK_NOW 128
+#define TK_RESET 129
+#define TK_QUERY 130
+#define TK_ADD 131
+#define TK_COLUMN 132
+#define TK_TAG 133
+#define TK_CHANGE 134
+#define TK_SET 135
+#define TK_KILL 136
+#define TK_CONNECTION 137
+#define TK_STREAM 138
+#define TK_COLON 139
+#define TK_ABORT 140
+#define TK_AFTER 141
+#define TK_ATTACH 142
+#define TK_BEFORE 143
+#define TK_BEGIN 144
+#define TK_CASCADE 145
+#define TK_CLUSTER 146
+#define TK_CONFLICT 147
+#define TK_COPY 148
+#define TK_DEFERRED 149
+#define TK_DELIMITERS 150
+#define TK_DETACH 151
+#define TK_EACH 152
+#define TK_END 153
+#define TK_EXPLAIN 154
+#define TK_FAIL 155
+#define TK_FOR 156
+#define TK_IGNORE 157
+#define TK_IMMEDIATE 158
+#define TK_INITIALLY 159
+#define TK_INSTEAD 160
+#define TK_MATCH 161
+#define TK_KEY 162
+#define TK_OF 163
+#define TK_RAISE 164
+#define TK_REPLACE 165
+#define TK_RESTRICT 166
+#define TK_ROW 167
+#define TK_STATEMENT 168
+#define TK_TRIGGER 169
+#define TK_VIEW 170
+#define TK_COUNT 171
+#define TK_SUM 172
+#define TK_AVG 173
+#define TK_MIN 174
+#define TK_MAX 175
+#define TK_FIRST 176
+#define TK_LAST 177
+#define TK_TOP 178
+#define TK_BOTTOM 179
+#define TK_STDDEV 180
+#define TK_PERCENTILE 181
+#define TK_APERCENTILE 182
+#define TK_LEASTSQUARES 183
+#define TK_HISTOGRAM 184
+#define TK_DIFF 185
+#define TK_SPREAD 186
+#define TK_TWA 187
+#define TK_INTERP 188
+#define TK_LAST_ROW 189
+#define TK_RATE 190
+#define TK_IRATE 191
+#define TK_SUM_RATE 192
+#define TK_SUM_IRATE 193
+#define TK_AVG_RATE 194
+#define TK_AVG_IRATE 195
+#define TK_TBID 196
+#define TK_SEMI 197
+#define TK_NONE 198
+#define TK_PREV 199
+#define TK_LINEAR 200
+#define TK_IMPORT 201
+#define TK_METRIC 202
+#define TK_TBNAME 203
+#define TK_JOIN 204
+#define TK_METRICS 205
#define TK_INSERT 206
#define TK_INTO 207
#define TK_VALUES 208
+
+
+
#define TK_SPACE 300
#define TK_COMMENT 301
#define TK_ILLEGAL 302
diff --git a/src/inc/ttype.h b/src/inc/ttype.h
index 1849139df1..686c986f5b 100644
--- a/src/inc/ttype.h
+++ b/src/inc/ttype.h
@@ -7,6 +7,28 @@ extern "C" {
#include "taosdef.h"
+// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
+typedef int32_t VarDataOffsetT;
+typedef int16_t VarDataLenT;
+
+typedef struct tstr {
+ VarDataLenT len;
+ char data[];
+} tstr;
+
+#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
+
+#define varDataLen(v) ((VarDataLenT *)(v))[0]
+#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v))
+#define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE))
+#define varDataCopy(dst, v) memcpy((dst), (void*) (v), varDataTLen(v))
+#define varDataLenByData(v) (*(VarDataLenT *)(((char*)(v)) - VARSTR_HEADER_SIZE))
+#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT) (_len))
+#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_BINARY) || ((t) == TSDB_DATA_TYPE_NCHAR))
+
+// this data type is internally used only in 'in' query to hold the values
+#define TSDB_DATA_TYPE_ARRAY (TSDB_DATA_TYPE_NCHAR + 1)
+
#define GET_TYPED_DATA(_v, _finalType, _type, _data) \
do { \
switch (_type) { \
@@ -59,6 +81,70 @@ extern "C" {
#define IS_VALID_UINT(_t) ((_t) >= 0 && (_t) < UINT32_MAX)
#define IS_VALID_UBIGINT(_t) ((_t) >= 0 && (_t) < UINT64_MAX)
+static FORCE_INLINE bool isNull(const char *val, int32_t type) {
+ switch (type) {
+ case TSDB_DATA_TYPE_BOOL:
+ return *(uint8_t *)val == TSDB_DATA_BOOL_NULL;
+ case TSDB_DATA_TYPE_TINYINT:
+ return *(uint8_t *)val == TSDB_DATA_TINYINT_NULL;
+ case TSDB_DATA_TYPE_SMALLINT:
+ return *(uint16_t *)val == TSDB_DATA_SMALLINT_NULL;
+ case TSDB_DATA_TYPE_INT:
+ return *(uint32_t *)val == TSDB_DATA_INT_NULL;
+ case TSDB_DATA_TYPE_BIGINT:
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ return *(uint64_t *)val == TSDB_DATA_BIGINT_NULL;
+ case TSDB_DATA_TYPE_FLOAT:
+ return *(uint32_t *)val == TSDB_DATA_FLOAT_NULL;
+ case TSDB_DATA_TYPE_DOUBLE:
+ return *(uint64_t *)val == TSDB_DATA_DOUBLE_NULL;
+ case TSDB_DATA_TYPE_NCHAR:
+ return varDataLen(val) == sizeof(int32_t) && *(uint32_t*) varDataVal(val) == TSDB_DATA_NCHAR_NULL;
+ case TSDB_DATA_TYPE_BINARY:
+ return varDataLen(val) == sizeof(int8_t) && *(uint8_t *) varDataVal(val) == TSDB_DATA_BINARY_NULL;
+ case TSDB_DATA_TYPE_UTINYINT:
+ return *(uint8_t*) val == TSDB_DATA_UTINYINT_NULL;
+ case TSDB_DATA_TYPE_USMALLINT:
+ return *(uint16_t*) val == TSDB_DATA_USMALLINT_NULL;
+ case TSDB_DATA_TYPE_UINT:
+ return *(uint32_t*) val == TSDB_DATA_UINT_NULL;
+ case TSDB_DATA_TYPE_UBIGINT:
+ return *(uint64_t*) val == TSDB_DATA_UBIGINT_NULL;
+
+ default:
+ return false;
+ };
+}
+
+typedef struct tDataTypeDescriptor {
+ int16_t type;
+ int16_t nameLen;
+ int32_t bytes;
+ char * name;
+ int (*compFunc)(const char *const input, int inputSize, const int nelements, char *const output, int outputSize,
+ char algorithm, char *const buffer, int bufferSize);
+ int (*decompFunc)(const char *const input, int compressedSize, const int nelements, char *const output,
+ int outputSize, char algorithm, char *const buffer, int bufferSize);
+ void (*statisFunc)(const void *pData, int32_t numofrow, int64_t *min, int64_t *max, int64_t *sum,
+ int16_t *minindex, int16_t *maxindex, int16_t *numofnull);
+} tDataTypeDescriptor;
+
+extern tDataTypeDescriptor tDataTypes[15];
+
+bool isValidDataType(int32_t type);
+
+void setVardataNull(char* val, int32_t type);
+void setNull(char *val, int32_t type, int32_t bytes);
+void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems);
+void* getNullValue(int32_t type);
+
+void assignVal(char *val, const char *src, int32_t len, int32_t type);
+void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size, void* buf);
+
+int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bool issigned);
+
+#define SET_DOUBLE_NULL(v) (*(uint64_t *)(v) = TSDB_DATA_DOUBLE_NULL)
+
#ifdef __cplusplus
}
#endif
diff --git a/src/kit/taosdemox/taosdemox.c b/src/kit/taosdemox/taosdemox.c
index 5c187030c5..2968d65331 100644
--- a/src/kit/taosdemox/taosdemox.c
+++ b/src/kit/taosdemox/taosdemox.c
@@ -1085,8 +1085,8 @@ static void printfQueryMeta() {
printf("database name: \033[33m%s\033[0m\n", g_queryInfo.dbName);
printf("\n");
- printf("super table query info: \n");
- printf("rate: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.rate);
+ printf("specified table query info: \n");
+ printf("query interval: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.rate);
printf("concurrent: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.concurrent);
printf("sqlCount: \033[33m%d\033[0m\n", g_queryInfo.superQueryInfo.sqlCount);
@@ -1102,11 +1102,11 @@ static void printfQueryMeta() {
printf(" sql[%d]: \033[33m%s\033[0m\n", i, g_queryInfo.superQueryInfo.sql[i]);
}
printf("\n");
- printf("sub table query info: \n");
- printf("rate: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.rate);
+ printf("super table query info: \n");
+ printf("query interval: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.rate);
printf("threadCnt: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.threadCnt);
printf("childTblCount: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.childTblCount);
- printf("childTblPrefix: \033[33m%s\033[0m\n", g_queryInfo.subQueryInfo.childTblPrefix);
+ printf("stable name: \033[33m%s\033[0m\n", g_queryInfo.subQueryInfo.sTblName);
if (SUBSCRIBE_MODE == g_jsonType) {
printf("mod: \033[33m%d\033[0m\n", g_queryInfo.subQueryInfo.subscribeMode);
@@ -4020,23 +4020,23 @@ void *superQueryProcess(void *sarg) {
}
selectAndGetResult(winfo->taos, g_queryInfo.superQueryInfo.sql[i], tmpFile);
int64_t t2 = taosGetTimestampUs();
- printf("taosc select sql return, Spent %f s\n", (t2 - t1)/1000000.0);
+ printf("=[taosc] thread[%"PRIu64"] complete one sql, Spent %f s\n", (uint64_t)pthread_self(), (t2 - t1)/1000000.0);
} else {
#ifdef TD_LOWA_CURL
int64_t t1 = taosGetTimestampUs();
int retCode = curlProceSql(g_queryInfo.host, g_queryInfo.port, g_queryInfo.superQueryInfo.sql[i], winfo->curl_handle);
int64_t t2 = taosGetTimestampUs();
- printf("http select sql return, Spent %f s \n", (t2 - t1)/1000000.0);
+ printf("=[restful] thread[%"PRIu64"] complete one sql, Spent %f s\n", (uint64_t)pthread_self(), (t2 - t1)/1000000.0);
if (0 != retCode) {
- printf("========curl return fail, threadID[%d]\n", winfo->threadID);
+ printf("====curl return fail, threadID[%d]\n", winfo->threadID);
return NULL;
}
#endif
}
}
et = taosGetTimestampMs();
- printf("========thread[%"PRIu64"] complete all sqls to super table once queries duration:%.6fs\n\n", (uint64_t)pthread_self(), (double)(et - st)/1000.0);
+ printf("==thread[%"PRIu64"] complete all sqls to specify tables once queries duration:%.6fs\n\n", (uint64_t)pthread_self(), (double)(et - st)/1000.0);
}
return NULL;
}
@@ -4065,7 +4065,7 @@ void *subQueryProcess(void *sarg) {
char sqlstr[1024];
threadInfo *winfo = (threadInfo *)sarg;
int64_t st = 0;
- int64_t et = 0;
+ int64_t et = g_queryInfo.subQueryInfo.rate*1000;
while (1) {
if (g_queryInfo.subQueryInfo.rate && (et - st) < g_queryInfo.subQueryInfo.rate*1000) {
taosMsleep(g_queryInfo.subQueryInfo.rate*1000 - (et - st)); // ms
@@ -4085,17 +4085,12 @@ void *subQueryProcess(void *sarg) {
}
}
et = taosGetTimestampMs();
- printf("========thread[%"PRIu64"] complete all sqls to allocate all sub-tables once queries duration:%.4fs\n\n", (uint64_t)pthread_self(), (double)(et - st)/1000.0);
+ printf("####thread[%"PRIu64"] complete all sqls to allocate all sub-tables[%d - %d] once queries duration:%.4fs\n\n", (uint64_t)pthread_self(), winfo->start_table_id, winfo->end_table_id, (double)(et - st)/1000.0);
}
return NULL;
}
int queryTestProcess() {
- printfQueryMeta();
-
- printf("Press enter key to continue\n\n");
- (void)getchar();
-
TAOS * taos = NULL;
taos_init();
taos = taos_connect(g_queryInfo.host, g_queryInfo.user, g_queryInfo.password, g_queryInfo.dbName, g_queryInfo.port);
@@ -4108,9 +4103,13 @@ int queryTestProcess() {
(void)getAllChildNameOfSuperTable(taos, g_queryInfo.dbName, g_queryInfo.subQueryInfo.sTblName, &g_queryInfo.subQueryInfo.childTblName, &g_queryInfo.subQueryInfo.childTblCount);
}
+ printfQueryMeta();
+ printf("Press enter key to continue\n\n");
+ (void)getchar();
+
pthread_t *pids = NULL;
threadInfo *infos = NULL;
- //==== create sub threads for query from super table
+ //==== create sub threads for query from specify table
if (g_queryInfo.superQueryInfo.sqlCount > 0 && g_queryInfo.superQueryInfo.concurrent > 0) {
pids = malloc(g_queryInfo.superQueryInfo.concurrent * sizeof(pthread_t));
@@ -4146,7 +4145,7 @@ int queryTestProcess() {
pthread_t *pidsOfSub = NULL;
threadInfo *infosOfSub = NULL;
- //==== create sub threads for query from sub table
+ //==== create sub threads for query from all sub table of the super table
if ((g_queryInfo.subQueryInfo.sqlCount > 0) && (g_queryInfo.subQueryInfo.threadCnt > 0)) {
pidsOfSub = malloc(g_queryInfo.subQueryInfo.threadCnt * sizeof(pthread_t));
infosOfSub = malloc(g_queryInfo.subQueryInfo.threadCnt * sizeof(threadInfo));
@@ -4177,6 +4176,7 @@ int queryTestProcess() {
t_info->start_table_id = last;
t_info->end_table_id = i < b ? last + a : last + a - 1;
+ last = t_info->end_table_id + 1;
t_info->taos = taos;
pthread_create(pidsOfSub + i, NULL, subQueryProcess, t_info);
}
diff --git a/src/mnode/src/mnodeCluster.c b/src/mnode/src/mnodeCluster.c
index 08bf20e1a8..1b153247f0 100644
--- a/src/mnode/src/mnodeCluster.c
+++ b/src/mnode/src/mnodeCluster.c
@@ -202,7 +202,7 @@ static int32_t mnodeGetClusterMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *
cols++;
pMeta->numOfColumns = htons(cols);
- strcpy(pMeta->tableId, "show cluster");
+ strcpy(pMeta->tableFname, "show cluster");
pShow->numOfColumns = cols;
pShow->offset[0] = 0;
diff --git a/src/mnode/src/mnodeProfile.c b/src/mnode/src/mnodeProfile.c
index 7c35829f88..89dc32f03a 100644
--- a/src/mnode/src/mnodeProfile.c
+++ b/src/mnode/src/mnodeProfile.c
@@ -385,12 +385,22 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
SConnObj *pConnObj = NULL;
int32_t cols = 0;
char * pWrite;
+ void * pIter;
char str[TSDB_IPv4ADDR_LEN + 6] = {0};
while (numOfRows < rows) {
- pShow->pIter = mnodeGetNextConn(pShow->pIter, &pConnObj);
- if (pConnObj == NULL) break;
+ pIter = mnodeGetNextConn(pShow->pIter, &pConnObj);
+ if (pConnObj == NULL) {
+ pShow->pIter = pIter;
+ break;
+ }
+ if (numOfRows + pConnObj->numOfQueries >= rows) {
+ mnodeCancelGetNextConn(pIter);
+ break;
+ }
+
+ pShow->pIter = pIter;
for (int32_t i = 0; i < pConnObj->numOfQueries; ++i) {
SQueryDesc *pDesc = pConnObj->pQueries + i;
cols = 0;
@@ -518,12 +528,22 @@ static int32_t mnodeRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, v
SConnObj *pConnObj = NULL;
int32_t cols = 0;
char * pWrite;
+ void * pIter;
char ipStr[TSDB_IPv4ADDR_LEN + 6];
while (numOfRows < rows) {
- pShow->pIter = mnodeGetNextConn(pShow->pIter, &pConnObj);
- if (pConnObj == NULL) break;
+ pIter = mnodeGetNextConn(pShow->pIter, &pConnObj);
+ if (pConnObj == NULL) {
+ pShow->pIter = pIter;
+ break;
+ }
+ if (numOfRows + pConnObj->numOfStreams >= rows) {
+ mnodeCancelGetNextConn(pIter);
+ break;
+ }
+
+ pShow->pIter = pIter;
for (int32_t i = 0; i < pConnObj->numOfStreams; ++i) {
SStreamDesc *pDesc = pConnObj->pStreams + i;
cols = 0;
diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c
index de37b09345..bdf5a7fb8b 100644
--- a/src/mnode/src/mnodeTable.c
+++ b/src/mnode/src/mnodeTable.c
@@ -68,7 +68,7 @@ static int32_t mnodeGetShowSuperTableMeta(STableMetaMsg *pMeta, SShowObj *pShow,
static int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows, void *pConn);
static int32_t mnodeGetStreamTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t rows, void *pConn);
-
+
static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg);
static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg);
static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg);
@@ -164,7 +164,7 @@ static int32_t mnodeChildTableActionDelete(SSdbRow *pRow) {
SVgObj *pVgroup = NULL;
SDbObj *pDb = NULL;
SAcctObj *pAcct = NULL;
-
+
pVgroup = mnodeGetVgroup(pTable->vgId);
if (pVgroup != NULL) pDb = mnodeGetDb(pVgroup->dbName);
if (pDb != NULL) pAcct = mnodeGetAcct(pDb->acct);
@@ -180,14 +180,14 @@ static int32_t mnodeChildTableActionDelete(SSdbRow *pRow) {
grantRestore(TSDB_GRANT_TIMESERIES, pTable->numOfColumns - 1);
if (pAcct != NULL) pAcct->acctInfo.numOfTimeSeries -= (pTable->numOfColumns - 1);
}
-
+
if (pDb != NULL) mnodeRemoveTableFromDb(pDb);
if (pVgroup != NULL) mnodeRemoveTableFromVgroup(pVgroup, pTable);
mnodeDecVgroupRef(pVgroup);
mnodeDecDbRef(pDb);
mnodeDecAcctRef(pAcct);
-
+
return TSDB_CODE_SUCCESS;
}
@@ -195,19 +195,19 @@ static int32_t mnodeChildTableActionUpdate(SSdbRow *pRow) {
SCTableObj *pNew = pRow->pObj;
SCTableObj *pTable = mnodeGetChildTable(pNew->info.tableId);
if (pTable != pNew) {
- void *oldTableId = pTable->info.tableId;
+ void *oldTableId = pTable->info.tableId;
void *oldSql = pTable->sql;
void *oldSchema = pTable->schema;
void *oldSTable = pTable->superTable;
int32_t oldRefCount = pTable->refCount;
-
+
memcpy(pTable, pNew, sizeof(SCTableObj));
-
+
pTable->refCount = oldRefCount;
pTable->sql = pNew->sql;
pTable->schema = pNew->schema;
pTable->superTable = oldSTable;
-
+
free(pNew);
free(oldSql);
free(oldSchema);
@@ -544,7 +544,7 @@ static int32_t mnodeSuperTableActionDecode(SSdbRow *pRow) {
}
memcpy(pStable->schema, pRow->rowData + len, schemaSize);
-
+
pRow->pObj = pStable;
return TSDB_CODE_SUCCESS;
@@ -611,7 +611,7 @@ int32_t mnodeInitTables() {
mnodeAddWriteMsgHandle(TSDB_MSG_TYPE_CM_ALTER_TABLE, mnodeProcessAlterTableMsg);
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_TABLE_META, mnodeProcessTableMetaMsg);
mnodeAddReadMsgHandle(TSDB_MSG_TYPE_CM_STABLE_VGROUP, mnodeProcessSuperTableVgroupMsg);
-
+
mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_CREATE_TABLE_RSP, mnodeProcessCreateChildTableRsp);
mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_DROP_TABLE_RSP, mnodeProcessDropChildTableRsp);
mnodeAddPeerRspHandle(TSDB_MSG_TYPE_MD_DROP_STABLE_RSP, mnodeProcessDropSuperTableRsp);
@@ -750,7 +750,7 @@ void mnodeDestroySubMsg(SMnodeMsg *pSubMsg) {
static int32_t mnodeValidateCreateTableMsg(SCreateTableMsg *pCreateTable, SMnodeMsg *pMsg) {
if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDb(pCreateTable->db);
if (pMsg->pDb == NULL) {
- mError("msg:%p, app:%p table:%s, failed to create, db not selected", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableId);
+ mError("msg:%p, app:%p table:%s, failed to create, db not selected", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableFname);
return TSDB_CODE_MND_DB_NOT_SELECTED;
}
@@ -759,28 +759,28 @@ static int32_t mnodeValidateCreateTableMsg(SCreateTableMsg *pCreateTable, SMnode
return TSDB_CODE_MND_DB_IN_DROPPING;
}
- if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreateTable->tableId);
+ if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreateTable->tableFname);
if (pMsg->pTable != NULL && pMsg->retry == 0) {
if (pCreateTable->getMeta) {
- mDebug("msg:%p, app:%p table:%s, continue to get meta", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableId);
+ mDebug("msg:%p, app:%p table:%s, continue to get meta", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableFname);
return mnodeGetChildTableMeta(pMsg);
} else if (pCreateTable->igExists) {
- mDebug("msg:%p, app:%p table:%s, is already exist", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableId);
+ mDebug("msg:%p, app:%p table:%s, is already exist", pMsg, pMsg->rpcMsg.ahandle, pCreateTable->tableFname);
return TSDB_CODE_SUCCESS;
} else {
mError("msg:%p, app:%p table:%s, failed to create, table already exist", pMsg, pMsg->rpcMsg.ahandle,
- pCreateTable->tableId);
+ pCreateTable->tableFname);
return TSDB_CODE_MND_TABLE_ALREADY_EXIST;
}
}
if (pCreateTable->numOfTags != 0) {
mDebug("msg:%p, app:%p table:%s, create stable msg is received from thandle:%p", pMsg, pMsg->rpcMsg.ahandle,
- pCreateTable->tableId, pMsg->rpcMsg.handle);
+ pCreateTable->tableFname, pMsg->rpcMsg.handle);
return mnodeProcessCreateSuperTableMsg(pMsg);
} else {
mDebug("msg:%p, app:%p table:%s, create ctable msg is received from thandle:%p", pMsg, pMsg->rpcMsg.ahandle,
- pCreateTable->tableId, pMsg->rpcMsg.handle);
+ pCreateTable->tableFname, pMsg->rpcMsg.handle);
return mnodeProcessCreateChildTableMsg(pMsg);
}
}
@@ -862,47 +862,46 @@ static int32_t mnodeProcessCreateTableMsg(SMnodeMsg *pMsg) {
SCreateTableMsg *p = (SCreateTableMsg*)((char*) pCreate + sizeof(SCMCreateTableMsg));
if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDb(p->db);
if (pMsg->pDb == NULL) {
- mError("msg:%p, app:%p table:%s, failed to create, db not selected", pMsg, pMsg->rpcMsg.ahandle, p->tableId);
+ mError("msg:%p, app:%p table:%s, failed to create, db not selected", pMsg, pMsg->rpcMsg.ahandle, p->tableFname);
return TSDB_CODE_MND_DB_NOT_SELECTED;
}
-
+
if (pMsg->pDb->status != TSDB_DB_STATUS_READY) {
mError("db:%s, status:%d, in dropping", pMsg->pDb->name, pMsg->pDb->status);
return TSDB_CODE_MND_DB_IN_DROPPING;
}
- if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(p->tableId);
+ if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(p->tableFname);
if (pMsg->pTable != NULL && pMsg->retry == 0) {
if (p->getMeta) {
- mDebug("msg:%p, app:%p table:%s, continue to get meta", pMsg, pMsg->rpcMsg.ahandle, p->tableId);
+ mDebug("msg:%p, app:%p table:%s, continue to get meta", pMsg, pMsg->rpcMsg.ahandle, p->tableFname);
return mnodeGetChildTableMeta(pMsg);
} else if (p->igExists) {
- mDebug("msg:%p, app:%p table:%s, is already exist", pMsg, pMsg->rpcMsg.ahandle, p->tableId);
+ mDebug("msg:%p, app:%p table:%s, is already exist", pMsg, pMsg->rpcMsg.ahandle, p->tableFname);
return TSDB_CODE_SUCCESS;
} else {
- mError("msg:%p, app:%p table:%s, failed to create, table already exist", pMsg, pMsg->rpcMsg.ahandle,
- p->tableId);
+ mError("msg:%p, app:%p table:%s, failed to create, table already exist", pMsg, pMsg->rpcMsg.ahandle, p->tableFname);
return TSDB_CODE_MND_TABLE_ALREADY_EXIST;
}
}
if (p->numOfTags != 0) {
mDebug("msg:%p, app:%p table:%s, create stable msg is received from thandle:%p", pMsg, pMsg->rpcMsg.ahandle,
- p->tableId, pMsg->rpcMsg.handle);
+ p->tableFname, pMsg->rpcMsg.handle);
return mnodeProcessCreateSuperTableMsg(pMsg);
} else {
mDebug("msg:%p, app:%p table:%s, create ctable msg is received from thandle:%p", pMsg, pMsg->rpcMsg.ahandle,
- p->tableId, pMsg->rpcMsg.handle);
+ p->tableFname, pMsg->rpcMsg.handle);
return mnodeProcessCreateChildTableMsg(pMsg);
}
}
static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
SCMDropTableMsg *pDrop = pMsg->rpcMsg.pCont;
- if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pDrop->tableId);
+ if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pDrop->tableFname);
if (pMsg->pDb == NULL) {
mError("msg:%p, app:%p table:%s, failed to drop table, db not selected or db in dropping", pMsg,
- pMsg->rpcMsg.ahandle, pDrop->tableId);
+ pMsg->rpcMsg.ahandle, pDrop->tableFname);
return TSDB_CODE_MND_DB_NOT_SELECTED;
}
@@ -913,17 +912,17 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
if (mnodeCheckIsMonitorDB(pMsg->pDb->name, tsMonitorDbName)) {
mError("msg:%p, app:%p table:%s, failed to drop table, in monitor database", pMsg, pMsg->rpcMsg.ahandle,
- pDrop->tableId);
+ pDrop->tableFname);
return TSDB_CODE_MND_MONITOR_DB_FORBIDDEN;
}
- if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pDrop->tableId);
+ if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pDrop->tableFname);
if (pMsg->pTable == NULL) {
if (pDrop->igNotExists) {
- mDebug("msg:%p, app:%p table:%s is not exist, treat as success", pMsg, pMsg->rpcMsg.ahandle, pDrop->tableId);
+ mDebug("msg:%p, app:%p table:%s is not exist, treat as success", pMsg, pMsg->rpcMsg.ahandle, pDrop->tableFname);
return TSDB_CODE_SUCCESS;
} else {
- mError("msg:%p, app:%p table:%s, failed to drop, table not exist", pMsg, pMsg->rpcMsg.ahandle, pDrop->tableId);
+ mError("msg:%p, app:%p table:%s, failed to drop, table not exist", pMsg, pMsg->rpcMsg.ahandle, pDrop->tableFname);
return TSDB_CODE_MND_INVALID_TABLE_NAME;
}
}
@@ -931,12 +930,12 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) {
if (pMsg->pTable->type == TSDB_SUPER_TABLE) {
SSTableObj *pSTable = (SSTableObj *)pMsg->pTable;
mInfo("msg:%p, app:%p table:%s, start to drop stable, uid:%" PRIu64 ", numOfChildTables:%d, sizeOfVgList:%d", pMsg,
- pMsg->rpcMsg.ahandle, pDrop->tableId, pSTable->uid, pSTable->numOfTables, taosHashGetSize(pSTable->vgHash));
+ pMsg->rpcMsg.ahandle, pDrop->tableFname, pSTable->uid, pSTable->numOfTables, taosHashGetSize(pSTable->vgHash));
return mnodeProcessDropSuperTableMsg(pMsg);
} else {
SCTableObj *pCTable = (SCTableObj *)pMsg->pTable;
mInfo("msg:%p, app:%p table:%s, start to drop ctable, vgId:%d tid:%d uid:%" PRIu64, pMsg, pMsg->rpcMsg.ahandle,
- pDrop->tableId, pCTable->vgId, pCTable->tid, pCTable->uid);
+ pDrop->tableFname, pCTable->vgId, pCTable->tid, pCTable->uid);
return mnodeProcessDropChildTableMsg(pMsg);
}
}
@@ -945,29 +944,29 @@ static int32_t mnodeProcessTableMetaMsg(SMnodeMsg *pMsg) {
STableInfoMsg *pInfo = pMsg->rpcMsg.pCont;
pInfo->createFlag = htons(pInfo->createFlag);
mDebug("msg:%p, app:%p table:%s, table meta msg is received from thandle:%p, createFlag:%d", pMsg, pMsg->rpcMsg.ahandle,
- pInfo->tableId, pMsg->rpcMsg.handle, pInfo->createFlag);
+ pInfo->tableFname, pMsg->rpcMsg.handle, pInfo->createFlag);
- if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pInfo->tableId);
+ if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pInfo->tableFname);
if (pMsg->pDb == NULL) {
mError("msg:%p, app:%p table:%s, failed to get table meta, db not selected", pMsg, pMsg->rpcMsg.ahandle,
- pInfo->tableId);
+ pInfo->tableFname);
return TSDB_CODE_MND_DB_NOT_SELECTED;
}
-
+
if (pMsg->pDb->status != TSDB_DB_STATUS_READY) {
mError("db:%s, status:%d, in dropping", pMsg->pDb->name, pMsg->pDb->status);
return TSDB_CODE_MND_DB_IN_DROPPING;
}
- if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pInfo->tableId);
+ if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pInfo->tableFname);
if (pMsg->pTable == NULL) {
if (!pInfo->createFlag) {
mError("msg:%p, app:%p table:%s, failed to get table meta, table not exist", pMsg, pMsg->rpcMsg.ahandle,
- pInfo->tableId);
+ pInfo->tableFname);
return TSDB_CODE_MND_INVALID_TABLE_NAME;
} else {
mDebug("msg:%p, app:%p table:%s, failed to get table meta, start auto create table ", pMsg, pMsg->rpcMsg.ahandle,
- pInfo->tableId);
+ pInfo->tableFname);
return mnodeAutoCreateChildTable(pMsg);
}
} else {
@@ -1007,12 +1006,12 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
SSTableObj * pStable = calloc(1, sizeof(SSTableObj));
if (pStable == NULL) {
- mError("msg:%p, app:%p table:%s, failed to create, no enough memory", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableId);
+ mError("msg:%p, app:%p table:%s, failed to create, no enough memory", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname);
return TSDB_CODE_MND_OUT_OF_MEMORY;
}
int64_t us = taosGetTimestampUs();
- pStable->info.tableId = strdup(pCreate->tableId);
+ pStable->info.tableId = strdup(pCreate->tableFname);
pStable->info.type = TSDB_SUPER_TABLE;
pStable->createdTime = taosGetTimestampMs();
pStable->uid = (us << 24) + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul));
@@ -1026,41 +1025,27 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
pStable->schema = (SSchema *)calloc(1, schemaSize);
if (pStable->schema == NULL) {
free(pStable);
- mError("msg:%p, app:%p table:%s, failed to create, no schema input", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableId);
+ mError("msg:%p, app:%p table:%s, failed to create, no schema input", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname);
return TSDB_CODE_MND_INVALID_TABLE_NAME;
}
memcpy(pStable->schema, pCreate->schema, numOfCols * sizeof(SSchema));
if (pStable->numOfColumns > TSDB_MAX_COLUMNS || pStable->numOfTags > TSDB_MAX_TAGS) {
- mError("msg:%p, app:%p table:%s, failed to create, too many columns", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableId);
+ mError("msg:%p, app:%p table:%s, failed to create, too many columns", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname);
return TSDB_CODE_MND_INVALID_TABLE_NAME;
}
pStable->nextColId = 0;
- // TODO extract method to valid the schema
- int32_t schemaLen = 0;
- int32_t tagLen = 0;
for (int32_t col = 0; col < numOfCols; col++) {
SSchema *tschema = pStable->schema;
tschema[col].colId = pStable->nextColId++;
tschema[col].bytes = htons(tschema[col].bytes);
-
- if (col < pStable->numOfTables) {
- schemaLen += tschema[col].bytes;
- } else {
- tagLen += tschema[col].bytes;
- }
-
- if (!isValidDataType(tschema[col].type)) {
- mError("msg:%p, app:%p table:%s, failed to create, invalid data type in schema", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableId);
- return TSDB_CODE_MND_INVALID_CREATE_TABLE_MSG;
- }
}
- if (schemaLen > (TSDB_MAX_BYTES_PER_ROW || tagLen > TSDB_MAX_TAGS_LEN)) {
- mError("msg:%p, app:%p table:%s, failed to create, schema is too long", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableId);
+ if (!isValidSchema(pStable->schema, pStable->numOfColumns, pStable->numOfTags)) {
+ mError("msg:%p, app:%p table:%s, failed to create table, invalid schema", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname);
return TSDB_CODE_MND_INVALID_CREATE_TABLE_MSG;
}
@@ -1080,7 +1065,7 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
mnodeDestroySuperTable(pStable);
pMsg->pTable = NULL;
- mError("msg:%p, app:%p table:%s, failed to create, sdb error", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableId);
+ mError("msg:%p, app:%p table:%s, failed to create, sdb error", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname);
}
return code;
@@ -1115,7 +1100,7 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
pDrop->contLen = htonl(sizeof(SDropSTableMsg));
pDrop->vgId = htonl(pVgroup->vgId);
pDrop->uid = htobe64(pStable->uid);
- mnodeExtractTableName(pStable->info.tableId, pDrop->tableId);
+ mnodeExtractTableName(pStable->info.tableId, pDrop->tableFname);
mInfo("msg:%p, app:%p stable:%s, send drop stable msg to vgId:%d, hash:%p sizeOfVgList:%d", pMsg,
pMsg->rpcMsg.ahandle, pStable->info.tableId, pVgroup->vgId, pStable->vgHash,
@@ -1129,8 +1114,8 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
taosHashCancelIterate(pStable->vgHash, pVgId);
mnodeDropAllChildTablesInStable(pStable);
- }
-
+ }
+
SSdbRow row = {
.type = SDB_OPER_GLOBAL,
.pTable = tsSuperTableSdb,
@@ -1274,7 +1259,7 @@ static int32_t mnodeModifySuperTableTagName(SMnodeMsg *pMsg, char *oldTagName, c
if (mnodeFindSuperTableTagIndex(pStable, newTagName) >= 0) {
return TSDB_CODE_MND_TAG_ALREAY_EXIST;
}
-
+
// update
SSchema *schema = (SSchema *) (pStable->schema + pStable->numOfColumns + col);
tstrncpy(schema->name, newTagName, sizeof(schema->name));
@@ -1437,7 +1422,7 @@ static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg, char *oldName, char
if (mnodeFindSuperTableColumnIndex(pStable, newName) >= 0) {
return TSDB_CODE_MND_FIELD_ALREAY_EXIST;
}
-
+
// update
SSchema *schema = (SSchema *) (pStable->schema + col);
tstrncpy(schema->name, newName, sizeof(schema->name));
@@ -1460,7 +1445,7 @@ static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg, char *oldName, char
static int32_t mnodeGetShowSuperTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
SDbObj *pDb = mnodeGetDb(pShow->db);
if (pDb == NULL) return TSDB_CODE_MND_DB_NOT_SELECTED;
-
+
if (pDb->status != TSDB_DB_STATUS_READY) {
mError("db:%s, status:%d, in dropping", pDb->name, pDb->status);
mnodeDecDbRef(pDb);
@@ -1525,7 +1510,7 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows,
SDbObj *pDb = mnodeGetDb(pShow->db);
if (pDb == NULL) return 0;
-
+
if (pDb->status != TSDB_DB_STATUS_READY) {
mError("db:%s, status:%d, in dropping", pDb->name, pDb->status);
mnodeDecDbRef(pDb);
@@ -1539,7 +1524,7 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows,
SPatternCompareInfo info = PATTERN_COMPARE_INFO_INITIALIZER;
char stableName[TSDB_TABLE_NAME_LEN] = {0};
- while (numOfRows < rows) {
+ while (numOfRows < rows) {
pShow->pIter = mnodeGetNextSuperTable(pShow->pIter, &pTable);
if (pTable == NULL) break;
if (strncmp(pTable->info.tableId, prefix, prefixLen)) {
@@ -1558,11 +1543,11 @@ int32_t mnodeRetrieveShowSuperTables(SShowObj *pShow, char *data, int32_t rows,
cols = 0;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
-
+
int16_t len = strnlen(stableName, TSDB_TABLE_NAME_LEN - 1);
*(int16_t*) pWrite = len;
pWrite += sizeof(int16_t); // todo refactor
-
+
strncpy(pWrite, stableName, len);
cols++;
@@ -1629,7 +1614,7 @@ void mnodeDropAllSuperTables(SDbObj *pDropDb) {
static int32_t mnodeSetSchemaFromSuperTable(SSchema *pSchema, SSTableObj *pTable) {
int32_t numOfCols = pTable->numOfColumns + pTable->numOfTags;
assert(numOfCols <= TSDB_MAX_COLUMNS);
-
+
for (int32_t i = 0; i < numOfCols; ++i) {
tstrncpy(pSchema->name, pTable->schema[i].name, sizeof(pSchema->name));
pSchema->type = pTable->schema[i].type;
@@ -1655,7 +1640,7 @@ static int32_t mnodeGetSuperTableMeta(SMnodeMsg *pMsg) {
pMeta->numOfColumns = htons((int16_t)pTable->numOfColumns);
pMeta->tableType = pTable->info.type;
pMeta->contLen = sizeof(STableMetaMsg) + mnodeSetSchemaFromSuperTable(pMeta->schema, pTable);
- tstrncpy(pMeta->tableId, pTable->info.tableId, sizeof(pMeta->tableId));
+ tstrncpy(pMeta->tableFname, pTable->info.tableId, sizeof(pMeta->tableFname));
pMsg->rpcRsp.len = pMeta->contLen;
pMeta->contLen = htons(pMeta->contLen);
@@ -1709,7 +1694,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
SVgroupsMsg *pVgroupMsg = (SVgroupsMsg *)msg;
pVgroupMsg->numOfVgroups = 0;
-
+
msg += sizeof(SVgroupsMsg);
} else {
SVgroupsMsg *pVgroupMsg = (SVgroupsMsg *)msg;
@@ -1798,7 +1783,7 @@ static void *mnodeBuildCreateChildTableMsg(SCMCreateTableMsg *pCreateMsg, SCTabl
return NULL;
}
- mnodeExtractTableName(pTable->info.tableId, pCreate->tableId);
+ mnodeExtractTableName(pTable->info.tableId, pCreate->tableFname);
pCreate->contLen = htonl(contLen);
pCreate->vgId = htonl(pTable->vgId);
pCreate->tableType = pTable->info.type;
@@ -1806,9 +1791,9 @@ static void *mnodeBuildCreateChildTableMsg(SCMCreateTableMsg *pCreateMsg, SCTabl
pCreate->tid = htonl(pTable->tid);
pCreate->sqlDataLen = htonl(pTable->sqlLen);
pCreate->uid = htobe64(pTable->uid);
-
+
if (pTable->info.type == TSDB_CHILD_TABLE) {
- mnodeExtractTableName(pTable->superTable->info.tableId, pCreate->superTableId);
+ mnodeExtractTableName(pTable->superTable->info.tableId, pCreate->stableFname);
pCreate->numOfColumns = htons(pTable->superTable->numOfColumns);
pCreate->numOfTags = htons(pTable->superTable->numOfTags);
pCreate->sversion = htonl(pTable->superTable->sversion);
@@ -1823,7 +1808,7 @@ static void *mnodeBuildCreateChildTableMsg(SCMCreateTableMsg *pCreateMsg, SCTabl
pCreate->tagDataLen = 0;
pCreate->superTableUid = 0;
}
-
+
SSchema *pSchema = (SSchema *) pCreate->data;
if (pTable->info.type == TSDB_CHILD_TABLE) {
memcpy(pSchema, pTable->superTable->schema, totalCols * sizeof(SSchema));
@@ -1922,12 +1907,12 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
SCTableObj *pTable = calloc(1, sizeof(SCTableObj));
if (pTable == NULL) {
- mError("msg:%p, app:%p table:%s, failed to alloc memory", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableId);
+ mError("msg:%p, app:%p table:%s, failed to alloc memory", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname);
return TSDB_CODE_MND_OUT_OF_MEMORY;
}
pTable->info.type = (pCreate->numOfColumns == 0)? TSDB_CHILD_TABLE:TSDB_NORMAL_TABLE;
- pTable->info.tableId = strdup(pCreate->tableId);
+ pTable->info.tableId = strdup(pCreate->tableFname);
pTable->createdTime = taosGetTimestampMs();
pTable->tid = tid;
pTable->vgId = pVgroup->vgId;
@@ -1943,7 +1928,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
size_t prefixLen = tableIdPrefix(pMsg->pDb->name, prefix, 64);
if (0 != strncasecmp(prefix, stableName, prefixLen)) {
mError("msg:%p, app:%p table:%s, corresponding super table:%s not in this db", pMsg, pMsg->rpcMsg.ahandle,
- pCreate->tableId, stableName);
+ pCreate->tableFname, stableName);
mnodeDestroyChildTable(pTable);
return TSDB_CODE_TDB_INVALID_CREATE_TB_MSG;
}
@@ -1951,7 +1936,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
if (pMsg->pSTable == NULL) pMsg->pSTable = mnodeGetSuperTable(stableName);
if (pMsg->pSTable == NULL) {
mError("msg:%p, app:%p table:%s, corresponding super table:%s does not exist", pMsg, pMsg->rpcMsg.ahandle,
- pCreate->tableId, stableName);
+ pCreate->tableFname, stableName);
mnodeDestroyChildTable(pTable);
return TSDB_CODE_MND_INVALID_TABLE_NAME;
}
@@ -2013,12 +1998,12 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
.pMsg = pMsg,
.fpReq = mnodeDoCreateChildTableFp
};
-
+
int32_t code = sdbInsertRow(&desc);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
mnodeDestroyChildTable(pTable);
pMsg->pTable = NULL;
- mError("msg:%p, app:%p table:%s, failed to create, reason:%s", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableId,
+ mError("msg:%p, app:%p table:%s, failed to create, reason:%s", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname,
tstrerror(code));
} else {
mDebug("msg:%p, app:%p table:%s, allocated in vgroup, vgId:%d sid:%d uid:%" PRIu64, pMsg, pMsg->rpcMsg.ahandle,
@@ -2035,7 +2020,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
int32_t code = grantCheck(TSDB_GRANT_TIMESERIES);
if (code != TSDB_CODE_SUCCESS) {
mError("msg:%p, app:%p table:%s, failed to create, grant timeseries failed", pMsg, pMsg->rpcMsg.ahandle,
- pCreate->tableId);
+ pCreate->tableFname);
return code;
}
@@ -2046,7 +2031,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
code = mnodeGetAvailableVgroup(pMsg, &pVgroup, &tid);
if (code != TSDB_CODE_SUCCESS) {
mDebug("msg:%p, app:%p table:%s, failed to get available vgroup, reason:%s", pMsg, pMsg->rpcMsg.ahandle,
- pCreate->tableId, tstrerror(code));
+ pCreate->tableFname, tstrerror(code));
return code;
}
@@ -2060,15 +2045,15 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) {
return mnodeDoCreateChildTable(pMsg, tid);
}
} else {
- if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreate->tableId);
+ if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreate->tableFname);
}
if (pMsg->pTable == NULL) {
- mError("msg:%p, app:%p table:%s, object not found, retry:%d reason:%s", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableId, pMsg->retry,
+ mError("msg:%p, app:%p table:%s, object not found, retry:%d reason:%s", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname, pMsg->retry,
tstrerror(terrno));
return terrno;
} else {
- mDebug("msg:%p, app:%p table:%s, send create msg to vnode again", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableId);
+ mDebug("msg:%p, app:%p table:%s, send create msg to vnode again", pMsg, pMsg->rpcMsg.ahandle, pCreate->tableFname);
return mnodeDoCreateChildTableFp(pMsg);
}
}
@@ -2084,7 +2069,7 @@ static int32_t mnodeSendDropChildTableMsg(SMnodeMsg *pMsg, bool needReturn) {
return TSDB_CODE_MND_OUT_OF_MEMORY;
}
- tstrncpy(pDrop->tableId, pTable->info.tableId, TSDB_TABLE_FNAME_LEN);
+ tstrncpy(pDrop->tableFname, pTable->info.tableId, TSDB_TABLE_FNAME_LEN);
pDrop->vgId = htonl(pTable->vgId);
pDrop->contLen = htonl(sizeof(SMDDropTableMsg));
pDrop->tid = htonl(pTable->tid);
@@ -2093,7 +2078,7 @@ static int32_t mnodeSendDropChildTableMsg(SMnodeMsg *pMsg, bool needReturn) {
SRpcEpSet epSet = mnodeGetEpSetFromVgroup(pMsg->pVgroup);
mInfo("msg:%p, app:%p ctable:%s, send drop ctable msg, vgId:%d sid:%d uid:%" PRIu64, pMsg, pMsg->rpcMsg.ahandle,
- pDrop->tableId, pTable->vgId, pTable->tid, pTable->uid);
+ pDrop->tableFname, pTable->vgId, pTable->tid, pTable->uid);
SRpcMsg rpcMsg = {
.ahandle = pMsg,
@@ -2115,7 +2100,7 @@ static int32_t mnodeDropChildTableCb(SMnodeMsg *pMsg, int32_t code) {
SCTableObj *pTable = (SCTableObj *)pMsg->pTable;
mError("msg:%p, app:%p ctable:%s, failed to drop, sdb error", pMsg, pMsg->rpcMsg.ahandle, pTable->info.tableId);
return code;
- }
+ }
return mnodeSendDropChildTableMsg(pMsg, true);
}
@@ -2224,7 +2209,7 @@ static int32_t mnodeAddNormalTableColumn(SMnodeMsg *pMsg, SSchema schema[], int3
pTable->numOfColumns += ncols;
pTable->sversion++;
-
+
SAcctObj *pAcct = mnodeGetAcct(pDb->acct);
if (pAcct != NULL) {
pAcct->acctInfo.numOfTimeSeries += ncols;
@@ -2295,7 +2280,7 @@ static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg, char *oldName, char
if (mnodeFindNormalTableColumnIndex(pTable, newName) >= 0) {
return TSDB_CODE_MND_FIELD_ALREAY_EXIST;
}
-
+
// update
SSchema *schema = (SSchema *) (pTable->schema + col);
tstrncpy(schema->name, newName, sizeof(schema->name));
@@ -2335,7 +2320,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) {
pMeta->tid = htonl(pTable->tid);
pMeta->precision = pDb->cfg.precision;
pMeta->tableType = pTable->info.type;
- tstrncpy(pMeta->tableId, pTable->info.tableId, TSDB_TABLE_FNAME_LEN);
+ tstrncpy(pMeta->tableFname, pTable->info.tableId, TSDB_TABLE_FNAME_LEN);
if (pTable->info.type == TSDB_CHILD_TABLE) {
assert(pTable->superTable != NULL);
@@ -2352,7 +2337,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) {
pMeta->tversion = 0;
pMeta->numOfTags = 0;
pMeta->numOfColumns = htons((int16_t)pTable->numOfColumns);
- pMeta->contLen = sizeof(STableMetaMsg) + mnodeSetSchemaFromNormalTable(pMeta->schema, pTable);
+ pMeta->contLen = sizeof(STableMetaMsg) + mnodeSetSchemaFromNormalTable(pMeta->schema, pTable);
}
if (pMsg->pVgroup == NULL) pMsg->pVgroup = mnodeGetVgroup(pTable->vgId);
@@ -2383,7 +2368,7 @@ static int32_t mnodeAutoCreateChildTable(SMnodeMsg *pMsg) {
if (pMsg->rpcMsg.contLen <= sizeof(*pInfo)) {
mError("msg:%p, app:%p table:%s, failed to auto create child table, tags not exist", pMsg, pMsg->rpcMsg.ahandle,
- pInfo->tableId);
+ pInfo->tableFname);
return TSDB_CODE_MND_TAG_NOT_EXIST;
}
@@ -2398,7 +2383,7 @@ static int32_t mnodeAutoCreateChildTable(SMnodeMsg *pMsg) {
int32_t totalLen = nameLen + tagLen + sizeof(int32_t)*2;
if (tagLen == 0 || nameLen == 0) {
mError("msg:%p, app:%p table:%s, failed to create table on demand for super table is empty, tagLen:%d", pMsg,
- pMsg->rpcMsg.ahandle, pInfo->tableId, tagLen);
+ pMsg->rpcMsg.ahandle, pInfo->tableFname, tagLen);
return TSDB_CODE_MND_INVALID_STABLE_NAME;
}
@@ -2406,14 +2391,14 @@ static int32_t mnodeAutoCreateChildTable(SMnodeMsg *pMsg) {
SCMCreateTableMsg *pCreateMsg = calloc(1, contLen);
if (pCreateMsg == NULL) {
mError("msg:%p, app:%p table:%s, failed to create table while get meta info, no enough memory", pMsg,
- pMsg->rpcMsg.ahandle, pInfo->tableId);
+ pMsg->rpcMsg.ahandle, pInfo->tableFname);
return TSDB_CODE_MND_OUT_OF_MEMORY;
}
SCreateTableMsg* pCreate = (SCreateTableMsg*) ((char*) pCreateMsg + sizeof(SCMCreateTableMsg));
- size_t size = tListLen(pInfo->tableId);
- tstrncpy(pCreate->tableId, pInfo->tableId, size);
+ size_t size = tListLen(pInfo->tableFname);
+ tstrncpy(pCreate->tableFname, pInfo->tableFname, size);
tstrncpy(pCreate->db, pMsg->pDb->name, sizeof(pCreate->db));
pCreate->igExists = 1;
pCreate->getMeta = 1;
@@ -2427,7 +2412,7 @@ static int32_t mnodeAutoCreateChildTable(SMnodeMsg *pMsg) {
memcpy(name, pInfo->tags + sizeof(int32_t), nameLen);
mDebug("msg:%p, app:%p table:%s, start to create on demand, tagLen:%d stable:%s", pMsg, pMsg->rpcMsg.ahandle,
- pInfo->tableId, tagLen, name);
+ pInfo->tableFname, tagLen, name);
if (pMsg->rpcMsg.pCont != pMsg->pCont) {
tfree(pMsg->rpcMsg.pCont);
@@ -2557,7 +2542,7 @@ static SCTableObj* mnodeGetTableByPos(int32_t vnode, int32_t tid) {
static int32_t mnodeProcessTableCfgMsg(SMnodeMsg *pMsg) {
return TSDB_CODE_COM_OPS_NOT_SUPPORT;
-#if 0
+#if 0
SConfigTableMsg *pCfg = pMsg->rpcMsg.pCont;
pCfg->dnodeId = htonl(pCfg->dnodeId);
pCfg->vgId = htonl(pCfg->vgId);
@@ -2575,13 +2560,13 @@ static int32_t mnodeProcessTableCfgMsg(SMnodeMsg *pMsg) {
SMDCreateTableMsg *pCreate = NULL;
pCreate = mnodeBuildCreateChildTableMsg(NULL, (SCTableObj *)pTable);
mnodeDecTableRef(pTable);
-
+
if (pCreate == NULL) return terrno;
-
+
pMsg->rpcRsp.rsp = pCreate;
pMsg->rpcRsp.len = htonl(pCreate->contLen);
return TSDB_CODE_SUCCESS;
-#endif
+#endif
}
// handle drop child response
@@ -2674,7 +2659,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) {
.pMsg = pMsg,
.fpRsp = mnodeDoCreateChildTableCb
};
-
+
int32_t code = sdbInsertRowToQueue(&desc);
if (code != TSDB_CODE_SUCCESS && code != TSDB_CODE_MND_ACTION_IN_PROGRESS) {
pMsg->pTable = NULL;
@@ -2821,7 +2806,7 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) {
static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
SDbObj *pDb = mnodeGetDb(pShow->db);
if (pDb == NULL) return TSDB_CODE_MND_DB_NOT_SELECTED;
-
+
if (pDb->status != TSDB_DB_STATUS_READY) {
mError("db:%s, status:%d, in dropping", pDb->name, pDb->status);
mnodeDecDbRef(pDb);
@@ -2894,7 +2879,7 @@ static int32_t mnodeGetShowTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void
static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows, void *pConn) {
SDbObj *pDb = mnodeGetDb(pShow->db);
if (pDb == NULL) return 0;
-
+
if (pDb->status != TSDB_DB_STATUS_READY) {
mError("db:%s, status:%d, in dropping", pDb->name, pDb->status);
mnodeDecDbRef(pDb);
@@ -2931,7 +2916,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
}
char tableName[TSDB_TABLE_NAME_LEN] = {0};
-
+
// pattern compare for table name
mnodeExtractTableName(pTable->info.tableId, tableName);
@@ -2960,13 +2945,13 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
-
+
memset(tableName, 0, sizeof(tableName));
if (pTable->info.type == TSDB_CHILD_TABLE) {
mnodeExtractTableName(pTable->superTable->info.tableId, tableName);
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, tableName, pShow->bytes[cols]);
}
-
+
cols++;
// uid
@@ -3001,27 +2986,27 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows
static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
SAlterTableMsg *pAlter = pMsg->rpcMsg.pCont;
mDebug("msg:%p, app:%p table:%s, alter table msg is received from thandle:%p", pMsg, pMsg->rpcMsg.ahandle,
- pAlter->tableId, pMsg->rpcMsg.handle);
+ pAlter->tableFname, pMsg->rpcMsg.handle);
- if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pAlter->tableId);
+ if (pMsg->pDb == NULL) pMsg->pDb = mnodeGetDbByTableId(pAlter->tableFname);
if (pMsg->pDb == NULL) {
- mError("msg:%p, app:%p table:%s, failed to alter table, db not selected", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableId);
+ mError("msg:%p, app:%p table:%s, failed to alter table, db not selected", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableFname);
return TSDB_CODE_MND_DB_NOT_SELECTED;
}
-
+
if (pMsg->pDb->status != TSDB_DB_STATUS_READY) {
mError("db:%s, status:%d, in dropping", pMsg->pDb->name, pMsg->pDb->status);
return TSDB_CODE_MND_DB_IN_DROPPING;
}
if (mnodeCheckIsMonitorDB(pMsg->pDb->name, tsMonitorDbName)) {
- mError("msg:%p, app:%p table:%s, failed to alter table, its log db", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableId);
+ mError("msg:%p, app:%p table:%s, failed to alter table, its log db", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableFname);
return TSDB_CODE_MND_MONITOR_DB_FORBIDDEN;
}
- if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pAlter->tableId);
+ if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pAlter->tableFname);
if (pMsg->pTable == NULL) {
- mError("msg:%p, app:%p table:%s, failed to alter table, table not exist", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableId);
+ mError("msg:%p, app:%p table:%s, failed to alter table, table not exist", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableFname);
return TSDB_CODE_MND_INVALID_TABLE_NAME;
}
@@ -3030,7 +3015,7 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
pAlter->tagValLen = htonl(pAlter->tagValLen);
if (pAlter->numOfCols > 2) {
- mError("msg:%p, app:%p table:%s, error numOfCols:%d in alter table", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableId,
+ mError("msg:%p, app:%p table:%s, error numOfCols:%d in alter table", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableFname,
pAlter->numOfCols);
return TSDB_CODE_MND_APP_ERROR;
}
@@ -3041,7 +3026,7 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
int32_t code = TSDB_CODE_COM_OPS_NOT_SUPPORT;
if (pMsg->pTable->type == TSDB_SUPER_TABLE) {
- mDebug("msg:%p, app:%p table:%s, start to alter stable", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableId);
+ mDebug("msg:%p, app:%p table:%s, start to alter stable", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableFname);
if (pAlter->type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN) {
code = mnodeAddSuperTableTag(pMsg, pAlter->schema, 1);
} else if (pAlter->type == TSDB_ALTER_TABLE_DROP_TAG_COLUMN) {
@@ -3057,7 +3042,7 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
} else {
}
} else {
- mDebug("msg:%p, app:%p table:%s, start to alter ctable", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableId);
+ mDebug("msg:%p, app:%p table:%s, start to alter ctable", pMsg, pMsg->rpcMsg.ahandle, pAlter->tableFname);
if (pAlter->type == TSDB_ALTER_TABLE_UPDATE_TAG_VAL) {
return TSDB_CODE_COM_OPS_NOT_SUPPORT;
} else if (pAlter->type == TSDB_ALTER_TABLE_ADD_COLUMN) {
@@ -3076,7 +3061,7 @@ static int32_t mnodeProcessAlterTableMsg(SMnodeMsg *pMsg) {
static int32_t mnodeGetStreamTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn) {
SDbObj *pDb = mnodeGetDb(pShow->db);
if (pDb == NULL) return TSDB_CODE_MND_DB_NOT_SELECTED;
-
+
if (pDb->status != TSDB_DB_STATUS_READY) {
mError("db:%s, status:%d, in dropping", pDb->name, pDb->status);
mnodeDecDbRef(pDb);
@@ -3129,13 +3114,13 @@ static int32_t mnodeGetStreamTableMeta(STableMetaMsg *pMeta, SShowObj *pShow, vo
static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t rows, void *pConn) {
SDbObj *pDb = mnodeGetDb(pShow->db);
if (pDb == NULL) return 0;
-
+
if (pDb->status != TSDB_DB_STATUS_READY) {
mError("db:%s, status:%d, in dropping", pDb->name, pDb->status);
mnodeDecDbRef(pDb);
return 0;
}
-
+
int32_t numOfRows = 0;
SCTableObj *pTable = NULL;
SPatternCompareInfo info = PATTERN_COMPARE_INFO_INITIALIZER;
@@ -3148,7 +3133,7 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro
while (numOfRows < rows) {
pShow->pIter = mnodeGetNextChildTable(pShow->pIter, &pTable);
if (pTable == NULL) break;
-
+
// not belong to current db
if (strncmp(pTable->info.tableId, prefix, prefixLen) || pTable->info.type != TSDB_STREAM_TABLE) {
mnodeDecTableRef(pTable);
@@ -3156,7 +3141,7 @@ static int32_t mnodeRetrieveStreamTables(SShowObj *pShow, char *data, int32_t ro
}
char tableName[TSDB_TABLE_NAME_LEN] = {0};
-
+
// pattern compare for table name
mnodeExtractTableName(pTable->info.tableId, tableName);
diff --git a/src/mnode/src/mnodeUser.c b/src/mnode/src/mnodeUser.c
index fb26086d04..fbee8a42b8 100644
--- a/src/mnode/src/mnodeUser.c
+++ b/src/mnode/src/mnodeUser.c
@@ -337,7 +337,7 @@ static int32_t mnodeGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
cols++;
pMeta->numOfColumns = htons(cols);
- strcpy(pMeta->tableId, "show users");
+ strcpy(pMeta->tableFname, "show users");
pShow->numOfColumns = cols;
pShow->offset[0] = 0;
diff --git a/src/query/inc/qFill.h b/src/query/inc/qFill.h
index 385ae88543..93537ec3da 100644
--- a/src/query/inc/qFill.h
+++ b/src/query/inc/qFill.h
@@ -82,9 +82,9 @@ void taosFillCopyInputDataFromFilePage(SFillInfo* pFillInfo, const tFilePage** p
void taosFillCopyInputDataFromOneFilePage(SFillInfo* pFillInfo, const tFilePage* pInput);
-int64_t getNumOfResWithFill(SFillInfo* pFillInfo, int64_t ekey, int32_t maxNumOfRows);
+bool taosFillHasMoreResults(SFillInfo* pFillInfo);
-int32_t taosNumOfRemainRows(SFillInfo *pFillInfo);
+int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, int64_t ekey, int32_t maxNumOfRows);
int32_t taosGetLinearInterpolationVal(int32_t type, SPoint *point1, SPoint *point2, SPoint *point);
diff --git a/src/query/inc/qSqlparser.h b/src/query/inc/qSqlparser.h
index 56e676ef16..be79bc55e6 100644
--- a/src/query/inc/qSqlparser.h
+++ b/src/query/inc/qSqlparser.h
@@ -98,6 +98,7 @@ typedef struct SCreateTableSQL {
typedef struct SAlterTableSQL {
SStrToken name;
+ int16_t tableType;
int16_t type;
STagData tagData;
SArray *pAddColumns; // SArray
@@ -156,6 +157,7 @@ typedef struct tDCLSQL {
int32_t nAlloc; /* Number of entries allocated below */
SStrToken *a; /* one entry for element */
bool existsCheck;
+ int16_t tableType;
union {
SCreateDBInfo dbOpt;
@@ -250,7 +252,7 @@ SCreateTableSQL *tSetCreateSqlElems(SArray *pCols, SArray *pTags, SQuerySQL *pSe
void tSqlExprNodeDestroy(tSQLExpr *pExpr);
-SAlterTableSQL * tAlterTableSqlElems(SStrToken *pTableName, SArray *pCols, SArray *pVals, int32_t type);
+SAlterTableSQL * tAlterTableSqlElems(SStrToken *pTableName, SArray *pCols, SArray *pVals, int32_t type, int16_t tableTable);
SCreatedTableInfo createNewChildTableInfo(SStrToken *pTableName, SArray *pTagVals, SStrToken *pToken, SStrToken* igExists);
void destroyAllSelectClause(SSubclauseInfo *pSql);
@@ -267,7 +269,7 @@ void setCreatedTableName(SSqlInfo *pInfo, SStrToken *pTableNameToken, SStrToken
void SqlInfoDestroy(SSqlInfo *pInfo);
void setDCLSQLElems(SSqlInfo *pInfo, int32_t type, int32_t nParams, ...);
-void setDropDbTableInfo(SSqlInfo *pInfo, int32_t type, SStrToken* pToken, SStrToken* existsCheck);
+void setDropDbTableInfo(SSqlInfo *pInfo, int32_t type, SStrToken* pToken, SStrToken* existsCheck,int16_t tableType);
void setShowOptions(SSqlInfo *pInfo, int32_t type, SStrToken* prefix, SStrToken* pPatterns);
tDCLSQL *tTokenListAppend(tDCLSQL *pTokenList, SStrToken *pToken);
diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y
index 1fa1369bb5..f224d26551 100644
--- a/src/query/inc/sql.y
+++ b/src/query/inc/sql.y
@@ -131,10 +131,16 @@ cmd ::= SHOW dbPrefix(X) VGROUPS ids(Y). {
//drop configure for tables
cmd ::= DROP TABLE ifexists(Y) ids(X) cpxName(Z). {
X.n += Z.n;
- setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &X, &Y);
+ setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &X, &Y, -1);
}
-cmd ::= DROP DATABASE ifexists(Y) ids(X). { setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &X, &Y); }
+//drop stable
+cmd ::= DROP STABLE ifexists(Y) ids(X) cpxName(Z). {
+ X.n += Z.n;
+ setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &X, &Y, TSDB_SUPER_TABLE);
+}
+
+cmd ::= DROP DATABASE ifexists(Y) ids(X). { setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &X, &Y, -1); }
cmd ::= DROP DNODE ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &X); }
cmd ::= DROP USER ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_USER, 1, &X); }
cmd ::= DROP ACCOUNT ids(X). { setDCLSQLElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &X); }
@@ -305,6 +311,8 @@ signed(A) ::= MINUS INTEGER(X). { A = -strtol(X.z, NULL, 10);}
////////////////////////////////// The CREATE TABLE statement ///////////////////////////////
cmd ::= CREATE TABLE create_table_args. {}
+cmd ::= CREATE TABLE create_stable_args. {}
+cmd ::= CREATE STABLE create_stable_args. {}
cmd ::= CREATE TABLE create_table_list(Z). { pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = Z;}
%type create_table_list{SCreateTableSQL*}
@@ -333,7 +341,8 @@ create_table_args(A) ::= ifnotexists(U) ids(V) cpxName(Z) LP columnlist(X) RP. {
}
// create super table
-create_table_args(A) ::= ifnotexists(U) ids(V) cpxName(Z) LP columnlist(X) RP TAGS LP columnlist(Y) RP. {
+%type create_stable_args{SCreateTableSQL*}
+create_stable_args(A) ::= ifnotexists(U) ids(V) cpxName(Z) LP columnlist(X) RP TAGS LP columnlist(Y) RP. {
A = tSetCreateSqlElems(X, Y, NULL, TSQL_CREATE_STABLE);
setSqlInfo(pInfo, A, NULL, TSDB_SQL_CREATE_TABLE);
@@ -683,7 +692,7 @@ cmd ::= RESET QUERY CACHE. { setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
///////////////////////////////////ALTER TABLE statement//////////////////////////////////
cmd ::= ALTER TABLE ids(X) cpxName(F) ADD COLUMN columnlist(A). {
X.n += F.n;
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_COLUMN);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
@@ -693,14 +702,14 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) DROP COLUMN ids(A). {
toTSDBType(A.type);
SArray* K = tVariantListAppendToken(NULL, &A, -1);
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
//////////////////////////////////ALTER TAGS statement/////////////////////////////////////
cmd ::= ALTER TABLE ids(X) cpxName(Y) ADD TAG columnlist(A). {
X.n += Y.n;
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
cmd ::= ALTER TABLE ids(X) cpxName(Z) DROP TAG ids(Y). {
@@ -709,7 +718,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(Z) DROP TAG ids(Y). {
toTSDBType(Y.type);
SArray* A = tVariantListAppendToken(NULL, &Y, -1);
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
@@ -722,7 +731,7 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). {
toTSDBType(Z.type);
A = tVariantListAppendToken(A, &Z, -1);
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
@@ -733,7 +742,54 @@ cmd ::= ALTER TABLE ids(X) cpxName(F) SET TAG ids(Y) EQ tagitem(Z). {
SArray* A = tVariantListAppendToken(NULL, &Y, -1);
A = tVariantListAppend(A, &Z, -1);
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1);
+ setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
+}
+
+
+///////////////////////////////////ALTER STABLE statement//////////////////////////////////
+cmd ::= ALTER STABLE ids(X) cpxName(F) ADD COLUMN columnlist(A). {
+ X.n += F.n;
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
+ setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
+}
+
+cmd ::= ALTER STABLE ids(X) cpxName(F) DROP COLUMN ids(A). {
+ X.n += F.n;
+
+ toTSDBType(A.type);
+ SArray* K = tVariantListAppendToken(NULL, &A, -1);
+
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE);
+ setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
+}
+
+//////////////////////////////////ALTER TAGS statement/////////////////////////////////////
+cmd ::= ALTER STABLE ids(X) cpxName(Y) ADD TAG columnlist(A). {
+ X.n += Y.n;
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, A, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
+ setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
+}
+cmd ::= ALTER STABLE ids(X) cpxName(Z) DROP TAG ids(Y). {
+ X.n += Z.n;
+
+ toTSDBType(Y.type);
+ SArray* A = tVariantListAppendToken(NULL, &Y, -1);
+
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE);
+ setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
+}
+
+cmd ::= ALTER STABLE ids(X) cpxName(F) CHANGE TAG ids(Y) ids(Z). {
+ X.n += F.n;
+
+ toTSDBType(Y.type);
+ SArray* A = tVariantListAppendToken(NULL, &Y, -1);
+
+ toTSDBType(Z.type);
+ A = tVariantListAppendToken(A, &Z, -1);
+
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&X, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c
index 3c7fd794bf..543b205112 100644
--- a/src/query/src/qAggMain.c
+++ b/src/query/src/qAggMain.c
@@ -1901,7 +1901,7 @@ static void valuePairAssign(tValuePair *dst, int16_t type, const char *val, int6
static void do_top_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pData, int64_t ts, uint16_t type,
SExtTagsInfo *pTagInfo, char *pTags, int16_t stage) {
tVariant val = {0};
- tVariantCreateFromBinary(&val, pData, tDataTypeDesc[type].nSize, type);
+ tVariantCreateFromBinary(&val, pData, tDataTypes[type].bytes, type);
tValuePair **pList = pInfo->res;
assert(pList != NULL);
@@ -1958,7 +1958,7 @@ static void do_top_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pData,
static void do_bottom_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pData, int64_t ts, uint16_t type,
SExtTagsInfo *pTagInfo, char *pTags, int16_t stage) {
tVariant val = {0};
- tVariantCreateFromBinary(&val, pData, tDataTypeDesc[type].nSize, type);
+ tVariantCreateFromBinary(&val, pData, tDataTypes[type].bytes, type);
tValuePair **pList = pInfo->res;
assert(pList != NULL);
diff --git a/src/query/src/qArithmeticOperator.c b/src/query/src/qArithmeticOperator.c
index 27bdd4372b..677951bd07 100644
--- a/src/query/src/qArithmeticOperator.c
+++ b/src/query/src/qArithmeticOperator.c
@@ -16,7 +16,7 @@
#include "os.h"
#include "qArithmeticOperator.h"
-#include "taosdef.h"
+#include "ttype.h"
#include "tutil.h"
#define ARRAY_LIST_OP(left, right, _left_type, _right_type, len1, len2, out, op, _res_type, _ord) \
@@ -145,7 +145,7 @@ void calc_i32_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight
if (numLeft == numRight) {
for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)(pOutput), TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
+ SET_DOUBLE_NULL(pOutput);
continue;
}
@@ -154,7 +154,7 @@ void calc_i32_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight
} else if (numLeft == 1) {
for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
if (isNull((char *)(pLeft), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)pOutput, TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
+ SET_DOUBLE_NULL(pOutput);
continue;
}
@@ -163,7 +163,7 @@ void calc_i32_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight
} else if (numRight == 1) {
for (; i >= 0 && i < numLeft; i += step, pOutput += 1) {
if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)(pRight), TSDB_DATA_TYPE_INT)) {
- setNull((char *)pOutput, TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
+ SET_DOUBLE_NULL(pOutput);
continue;
}
*pOutput = (double)pLeft[i] + pRight[0];
@@ -2556,1123 +2556,6 @@ void vectorRemainder(void *left, int32_t numLeft, int32_t leftType, void *right,
}
}
-/*
-void calc_i32_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int8_t)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int16_t)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int64_t);
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, float)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, double)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int8_t)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_u8_u8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, uint8_t, uint8_t)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_UTINYINT, TSDB_DATA_TYPE_UTINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_u8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, uint8_t)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_UTINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_u8_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i8_u8_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i8_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int16_t)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i32_i8_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i8_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int64_t)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, float)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, double)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i8_i16_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i16_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int16_t)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i32_i16_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i16_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int64_t)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, float)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, double)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i8_i64_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i64_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i16_i64_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i64_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i32_i64_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i64_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int64_t)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, float)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, double)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i8_f_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_f_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i16_f_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_f_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i32_f_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_f_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i64_f_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_f_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, float)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, double)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i8_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i8_d_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_d_i16_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i16_d_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_d_i32_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i32_d_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_d_i64_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i64_d_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_d_f_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_f_d_add(right, left, numRight, numLeft, output, order);
-}
-
-void calc_d_d_add(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, double)
- ARRAY_LIST_ADD(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-void calc_i32_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- int32_t *pLeft = (int32_t *)left;
- int32_t *pRight = (int32_t *)right;
- double * pOutput = (double *)output;
-
- int32_t i = (order == TSDB_ORDER_ASC) ? 0 : MAX(numLeft, numRight) - 1;
- int32_t step = (order == TSDB_ORDER_ASC) ? 1 : -1;
-
- if (numLeft == numRight) {
- for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
- if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)(pOutput), TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
- *pOutput = (double)pLeft[i] - pRight[i];
- }
- } else if (numLeft == 1) {
- for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
- if (isNull((char *)(pLeft), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)(pOutput), TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
- *pOutput = (double)pLeft[0] - pRight[i];
- }
- } else if (numRight == 1) {
- for (; i >= 0 && i < numLeft; i += step, pOutput += 1) {
- if (isNull((char *)&pLeft[i], TSDB_DATA_TYPE_INT) || isNull((char *)(pRight), TSDB_DATA_TYPE_INT)) {
- setNull((char *)(pOutput), TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
- *pOutput = (double)pLeft[i] - pRight[0];
- }
- }
-}
-
-void calc_i32_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int8_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int16_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int64_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, float)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, double)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int8_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int16_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int32_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int64_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, float)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, double)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int8_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int16_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int32_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int64_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, float)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, double)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int8_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int16_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int32_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int64_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, float)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, double)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int8_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int16_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int32_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int64_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, float)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, double)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i8_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int8_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i16_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int16_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i32_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int32_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i64_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int64_t)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_f_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, float)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_d_sub(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, double)
- ARRAY_LIST_SUB(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////
-void calc_i32_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- int32_t *pLeft = (int32_t *)left;
- int32_t *pRight = (int32_t *)right;
- double * pOutput = (double *)output;
-
- int32_t i = (order == TSDB_ORDER_ASC) ? 0 : MAX(numLeft, numRight) - 1;
- int32_t step = (order == TSDB_ORDER_ASC) ? 1 : -1;
-
- if (numLeft == numRight) {
- for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
- if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)(pOutput), TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
-
- *pOutput = (double)pLeft[i] * pRight[i];
- }
- } else if (numLeft == 1) {
- for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
- if (isNull((char *)(pLeft), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)pOutput, TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
-
- *pOutput = (double)pLeft[0] * pRight[i];
- }
- } else if (numRight == 1) {
- for (; i >= 0 && i < numLeft; i += step, pOutput += 1) {
- if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)(pRight), TSDB_DATA_TYPE_INT)) {
- setNull((char *)pOutput, TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
- *pOutput = (double)pLeft[i] * pRight[0];
- }
- }
-}
-
-void calc_i32_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int8_t)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int16_t)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int64_t)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, float)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, double)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int8_t)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int16_t)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i32_i8_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i8_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int64_t)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, float)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, double)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i8_i16_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i16_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int16_t)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i32_i16_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i16_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int64_t)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, float)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, double)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i8_i64_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i64_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i16_i64_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i64_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i32_i64_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_i64_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int64_t)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, float)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, double)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i8_f_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_f_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i16_f_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_f_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i32_f_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_f_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i64_f_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_f_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, float)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, double)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i8_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i8_d_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_d_i16_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i16_d_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_d_i32_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i32_d_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_d_i64_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_i64_d_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_d_f_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- calc_f_d_multi(right, left, numRight, numLeft, output, order);
-}
-
-void calc_d_d_multi(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, double)
- ARRAY_LIST_MULTI(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void calc_i32_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- int32_t *pLeft = (int32_t *)left;
- int32_t *pRight = (int32_t *)right;
- double * pOutput = (double *)output;
-
- int32_t i = (order == TSDB_ORDER_ASC) ? 0 : MAX(numLeft, numRight) - 1;
- int32_t step = (order == TSDB_ORDER_ASC) ? 1 : -1;
-
- if (numLeft == numRight) {
- for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
- if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)(pOutput), TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
-
- *pOutput = (double)pLeft[i] / pRight[i];
- }
- } else if (numLeft == 1) {
- for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
- if (isNull((char *)(pLeft), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)pOutput, TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
-
- *pOutput = (double)pLeft[0] / pRight[i];
- }
- } else if (numRight == 1) {
- for (; i >= 0 && i < numLeft; i += step, pOutput += 1) {
- if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)(pRight), TSDB_DATA_TYPE_INT)) {
- setNull((char *)pOutput, TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
- *pOutput = (double)pLeft[i] / pRight[0];
- }
- }
-}
-
-void calc_i32_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int8_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int16_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int64_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, float)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, double)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int8_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int16_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int32_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int64_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, float)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, double)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int8_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int16_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int32_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int64_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, float)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, double)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int8_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int16_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int32_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int64_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, float)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, double)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int8_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int16_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int32_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int64_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, float)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, double)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i8_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int8_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i16_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int16_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i32_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int32_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i64_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int64_t)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_f_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, float)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_d_div(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, double)
- ARRAY_LIST_DIV(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void calc_i32_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- int32_t *pLeft = (int32_t *)left;
- int32_t *pRight = (int32_t *)right;
- double * pOutput = (double *)output;
-
- int32_t i = (order == TSDB_ORDER_ASC) ? 0 : MAX(numLeft, numRight) - 1;
- int32_t step = (order == TSDB_ORDER_ASC) ? 1 : -1;
-
- if (numLeft == numRight) {
- for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
- if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)(pOutput), TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
-
- *pOutput = (double)pLeft[i] - ((int64_t)(((double)pLeft[i]) / pRight[i])) * pRight[i];
- }
- } else if (numLeft == 1) {
- for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
- if (isNull((char *)(pLeft), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)pOutput, TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
-
- *pOutput = (double)pLeft[0] - ((int64_t)(((double)pLeft[0]) / pRight[i])) * pRight[i];
- }
- } else if (numRight == 1) {
- for (; i >= 0 && i < numLeft; i += step, pOutput += 1) {
- if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)(pRight), TSDB_DATA_TYPE_INT)) {
- setNull((char *)pOutput, TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
-
- *pOutput = (double)pLeft[i] - ((int64_t)(((double)pLeft[i]) / pRight[0])) * pRight[0];
- }
- }
-}
-
-void calc_i32_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int8_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int16_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, int64_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int32_t, float)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i32_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- int32_t *pLeft = (int32_t *)left;
- double * pRight = (double *)right;
- double * pOutput = (double *)output;
-
- int32_t i = (order == TSDB_ORDER_ASC) ? 0 : MAX(numLeft, numRight) - 1;
- int32_t step = (order == TSDB_ORDER_ASC) ? 1 : -1;
-
- if (numLeft == numRight) {
- for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
- if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)(pOutput), TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
-
- *pOutput = (double)pLeft[i] - ((int64_t)(((double)pLeft[i]) / pRight[i])) * pRight[i];
- }
- } else if (numLeft == 1) {
- for (; i >= 0 && i < numRight; i += step, pOutput += 1) {
- if (isNull((char *)(pLeft), TSDB_DATA_TYPE_INT) || isNull((char *)&(pRight[i]), TSDB_DATA_TYPE_INT)) {
- setNull((char *)pOutput, TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
-
- *pOutput = (double)pLeft[0] - ((int64_t)(((double)pLeft[0]) / pRight[i])) * pRight[i];
- }
- } else if (numRight == 1) {
- for (; i >= 0 && i < numLeft; i += step, pOutput += 1) {
- if (isNull((char *)&(pLeft[i]), TSDB_DATA_TYPE_INT) || isNull((char *)(pRight), TSDB_DATA_TYPE_INT)) {
- setNull((char *)pOutput, TSDB_DATA_TYPE_DOUBLE, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
- continue;
- }
-
- *pOutput = (double)pLeft[i] - ((int64_t)(((double)pLeft[i]) / pRight[0])) * pRight[0];
- }
- }
-}
-
-void calc_i8_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int8_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int16_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int32_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, int64_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, float)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i8_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int8_t, double)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_TINYINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int8_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int16_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int32_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, int64_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, float)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i16_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int16_t, double)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_SMALLINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int8_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int16_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int32_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, int64_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, float)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_i64_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, int64_t, double)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_BIGINT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int8_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int16_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int32_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, int64_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, float)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_f_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, float, double)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i8_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int8_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_TINYINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i16_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int16_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_SMALLINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i32_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int32_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_INT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_i64_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, int64_t)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_BIGINT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_f_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, float)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_FLOAT, numLeft, numRight, pOutput, order);
-}
-
-void calc_d_d_rem(void *left, void *right, int32_t numLeft, int32_t numRight, void *output, int32_t order) {
- TYPE_CONVERT(left, right, output, double, double)
- ARRAY_LIST_REM(pLeft, pRight, TSDB_DATA_TYPE_DOUBLE, TSDB_DATA_TYPE_DOUBLE, numLeft, numRight, pOutput, order);
-}
-
-*
- * the following are two-dimensional array list of callback function .
- */
-//_arithmetic_operator_fn_t add_function_arraylist[15][15] = {
-// /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/
-// {0}, // EMPTY,
-// {0}, // TSDB_DATA_TYPE_BOOL,
-// {NULL, NULL, calc_i8_i8_add, calc_i8_i16_add, calc_i8_i32_add, calc_i8_i64_add, calc_i8_f_add, calc_i8_d_add, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT
-// {NULL, NULL, calc_i16_i8_add, calc_i16_i16_add, calc_i16_i32_add, calc_i16_i64_add, calc_i16_f_add, calc_i16_d_add, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT
-// {NULL, NULL, calc_i32_i8_add, calc_i32_i16_add, calc_i32_i32_add, calc_i32_i64_add, calc_i32_f_add, calc_i32_d_add, NULL, NULL}, // TSDB_DATA_TYPE_INT
-// {NULL, NULL, calc_i64_i8_add, calc_i64_i16_add, calc_i64_i32_add, calc_i64_i64_add, calc_i64_f_add, calc_i64_d_add, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT
-// {NULL, NULL, calc_f_i8_add, calc_f_i16_add, calc_f_i32_add, calc_f_i64_add, calc_f_f_add, calc_f_d_add, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT
-// {NULL, NULL, calc_d_i8_add, calc_d_i16_add, calc_d_i32_add, calc_d_i64_add, calc_d_f_add, calc_d_d_add, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE
-// {0}, // TSDB_DATA_TYPE_BINARY,
-// {0}, // TSDB_DATA_TYPE_NCHAR,
-// {NULL, NULL, calc_u8_i8_add, calc_u8_i16_add, calc_u8_i32_add, calc_u8_i64_add, calc_u8_f_add, calc_u8_d_add, NULL, NULL, calc_u8_u8_add, calc_u8_u16_add, calc_u8_u32_add, calc_u8_u64_add, NULL}, // TSDB_DATA_TYPE_UTINYINT,
-// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_USMALLINT,
-// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_UINT,
-// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_UBIGINT,
-//
-//};
-//
-//_arithmetic_operator_fn_t sub_function_arraylist[8][15] = {
-// /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/
-// {0}, // EMPTY,
-// {0}, // TSDB_DATA_TYPE_BOOL,
-// {NULL, NULL, calc_i8_i8_sub, calc_i8_i16_sub, calc_i8_i32_sub, calc_i8_i64_sub, calc_i8_f_sub, calc_i8_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT
-// {NULL, NULL, calc_i16_i8_sub, calc_i16_i16_sub, calc_i16_i32_sub, calc_i16_i64_sub, calc_i16_f_sub, calc_i16_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT
-// {NULL, NULL, calc_i32_i8_sub, calc_i32_i16_sub, calc_i32_i32_sub, calc_i32_i64_sub, calc_i32_f_sub, calc_i32_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_INT
-// {NULL, NULL, calc_i64_i8_sub, calc_i64_i16_sub, calc_i64_i32_sub, calc_i64_i64_sub, calc_i64_f_sub, calc_i64_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT
-// {NULL, NULL, calc_f_i8_sub, calc_f_i16_sub, calc_f_i32_sub, calc_f_i64_sub, calc_f_f_sub, calc_f_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT
-// {NULL, NULL, calc_d_i8_sub, calc_d_i16_sub, calc_d_i32_sub, calc_d_i64_sub, calc_d_f_sub, calc_d_d_sub, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE
-//};
-//
-//_arithmetic_operator_fn_t multi_function_arraylist[][15] = {
-// /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/
-// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY,
-// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL,
-// {NULL, NULL, calc_i8_i8_multi, calc_i8_i16_multi, calc_i8_i32_multi, calc_i8_i64_multi, calc_i8_f_multi, calc_i8_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT
-// {NULL, NULL, calc_i16_i8_multi, calc_i16_i16_multi, calc_i16_i32_multi, calc_i16_i64_multi, calc_i16_f_multi, calc_i16_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT
-// {NULL, NULL, calc_i32_i8_multi, calc_i32_i16_multi, calc_i32_i32_multi, calc_i32_i64_multi, calc_i32_f_multi, calc_i32_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_INT
-// {NULL, NULL, calc_i64_i8_multi, calc_i64_i16_multi, calc_i64_i32_multi, calc_i64_i64_multi, calc_i64_f_multi, calc_i64_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT
-// {NULL, NULL, calc_f_i8_multi, calc_f_i16_multi, calc_f_i32_multi, calc_f_i64_multi, calc_f_f_multi, calc_f_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT
-// {NULL, NULL, calc_d_i8_multi, calc_d_i16_multi, calc_d_i32_multi, calc_d_i64_multi, calc_d_f_multi, calc_d_d_multi, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE
-//};
-//
-//_arithmetic_operator_fn_t div_function_arraylist[8][15] = {
-// /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary*/
-// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY,
-// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL,
-// {NULL, NULL, calc_i8_i8_div, calc_i8_i16_div, calc_i8_i32_div, calc_i8_i64_div, calc_i8_f_div, calc_i8_d_div, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT
-// {NULL, NULL, calc_i16_i8_div, calc_i16_i16_div, calc_i16_i32_div, calc_i16_i64_div, calc_i16_f_div, calc_i16_d_div, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT
-// {NULL, NULL, calc_i32_i8_div, calc_i32_i16_div, calc_i32_i32_div, calc_i32_i64_div, calc_i32_f_div, calc_i32_d_div, NULL, NULL}, // TSDB_DATA_TYPE_INT
-// {NULL, NULL, calc_i64_i8_div, calc_i64_i16_div, calc_i64_i32_div, calc_i64_i64_div, calc_i64_f_div, calc_i64_d_div, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT
-// {NULL, NULL, calc_f_i8_div, calc_f_i16_div, calc_f_i32_div, calc_f_i64_div, calc_f_f_div, calc_f_d_div, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT
-// {NULL, NULL, calc_d_i8_div, calc_d_i16_div, calc_d_i32_div, calc_d_i64_div, calc_d_f_div, calc_d_d_div, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE
-//};
-//
-//_arithmetic_operator_fn_t rem_function_arraylist[8][15] = {
-// /*NULL, bool, tinyint, smallint, int, bigint, float, double, timestamp, binary, nchar, unsigned tinyint, unsigned smallint, unsigned int, unsigned bigint*/
-// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // EMPTY,
-// {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}, // TSDB_DATA_TYPE_BOOL,
-// {NULL, NULL, calc_i8_i8_rem, calc_i8_i16_rem, calc_i8_i32_rem, calc_i8_i64_rem, calc_i8_f_rem, calc_i8_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_TINYINT
-// {NULL, NULL, calc_i16_i8_rem, calc_i16_i16_rem, calc_i16_i32_rem, calc_i16_i64_rem, calc_i16_f_rem, calc_i16_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_SMALLINT
-// {NULL, NULL, calc_i32_i8_rem, calc_i32_i16_rem, calc_i32_i32_rem, calc_i32_i64_rem, calc_i32_f_rem, calc_i32_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_INT
-// {NULL, NULL, calc_i64_i8_rem, calc_i64_i16_rem, calc_i64_i32_rem, calc_i64_i64_rem, calc_i64_f_rem, calc_i64_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_BIGINT
-// {NULL, NULL, calc_f_i8_rem, calc_f_i16_rem, calc_f_i32_rem, calc_f_i64_rem, calc_f_f_rem, calc_f_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_FLOAT
-// {NULL, NULL, calc_d_i8_rem, calc_d_i16_rem, calc_d_i32_rem, calc_d_i64_rem, calc_d_f_rem, calc_d_d_rem, NULL, NULL}, // TSDB_DATA_TYPE_DOUBLE
-//};
-
-////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
_arithmetic_operator_fn_t getArithmeticOperatorFn(int32_t arithmeticOptr) {
switch (arithmeticOptr) {
case TSDB_BINARY_OP_ADD:
diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c
index 90cd74de72..110b0d198c 100644
--- a/src/query/src/qExecutor.c
+++ b/src/query/src/qExecutor.c
@@ -4180,7 +4180,7 @@ static void stableApplyFunctionsOnBlock(SQueryRuntimeEnv *pRuntimeEnv, SDataBloc
}
}
-bool queryHasRemainResForTableQuery(SQueryRuntimeEnv* pRuntimeEnv) {
+bool hasNotReturnedResults(SQueryRuntimeEnv* pRuntimeEnv) {
SQuery *pQuery = pRuntimeEnv->pQuery;
SFillInfo *pFillInfo = pRuntimeEnv->pFillInfo;
@@ -4190,8 +4190,7 @@ bool queryHasRemainResForTableQuery(SQueryRuntimeEnv* pRuntimeEnv) {
if (pQuery->fillType != TSDB_FILL_NONE && !isPointInterpoQuery(pQuery)) {
// There are results not returned to client yet, so filling applied to the remain result is required firstly.
- int32_t remain = taosNumOfRemainRows(pFillInfo);
- if (remain > 0) {
+ if (taosFillHasMoreResults(pFillInfo)) {
return true;
}
@@ -4205,7 +4204,7 @@ bool queryHasRemainResForTableQuery(SQueryRuntimeEnv* pRuntimeEnv) {
* first result row in the actual result set will fill nothing.
*/
if (Q_STATUS_EQUAL(pQuery->status, QUERY_COMPLETED)) {
- int32_t numOfTotal = (int32_t)getNumOfResWithFill(pFillInfo, pQuery->window.ekey, (int32_t)pQuery->rec.capacity);
+ int32_t numOfTotal = (int32_t)getNumOfResultsAfterFillGap(pFillInfo, pQuery->window.ekey, (int32_t)pQuery->rec.capacity);
return numOfTotal > 0;
}
@@ -4273,7 +4272,7 @@ static void doCopyQueryResultToMsg(SQInfo *pQInfo, int32_t numOfRows, char *data
setQueryStatus(pQuery, QUERY_OVER);
}
} else {
- if (!queryHasRemainResForTableQuery(&pQInfo->runtimeEnv)) {
+ if (!hasNotReturnedResults(&pQInfo->runtimeEnv)) {
setQueryStatus(pQuery, QUERY_OVER);
}
}
@@ -4300,7 +4299,6 @@ int32_t doFillGapsInResults(SQueryRuntimeEnv* pRuntimeEnv, tFilePage **pDst, int
pQInfo, pFillInfo->numOfRows, ret, pQuery->limit.offset, ret - pQuery->limit.offset, 0);
ret -= (int32_t)pQuery->limit.offset;
- // todo !!!!there exactly number of interpo is not valid.
for (int32_t i = 0; i < pQuery->numOfOutput; ++i) {
memmove(pDst[i]->data, pDst[i]->data + pQuery->pExpr1[i].bytes * pQuery->limit.offset,
ret * pQuery->pExpr1[i].bytes);
@@ -4318,7 +4316,7 @@ int32_t doFillGapsInResults(SQueryRuntimeEnv* pRuntimeEnv, tFilePage **pDst, int
ret = 0;
}
- if (!queryHasRemainResForTableQuery(pRuntimeEnv)) {
+ if (!hasNotReturnedResults(pRuntimeEnv)) {
return ret;
}
}
@@ -5778,7 +5776,7 @@ static void tableQueryImpl(SQInfo *pQInfo) {
SQueryRuntimeEnv *pRuntimeEnv = &pQInfo->runtimeEnv;
SQuery * pQuery = pRuntimeEnv->pQuery;
- if (queryHasRemainResForTableQuery(pRuntimeEnv)) {
+ if (hasNotReturnedResults(pRuntimeEnv)) {
if (pQuery->fillType != TSDB_FILL_NONE) {
/*
* There are remain results that are not returned due to result interpolation
@@ -6318,7 +6316,7 @@ static int32_t createQueryFuncExprFromMsg(SQueryTableMsg *pQueryMsg, int32_t num
}
type = TSDB_DATA_TYPE_DOUBLE;
- bytes = tDataTypeDesc[type].nSize;
+ bytes = tDataTypes[type].bytes;
} else if (pExprs[i].base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX && pExprs[i].base.functionId == TSDB_FUNC_TAGPRJ) { // parse the normal column
SSchema s = tGetTableNameColumnSchema();
type = s.type;
diff --git a/src/query/src/qFill.c b/src/query/src/qFill.c
index ca1203cb17..65b58467b7 100644
--- a/src/query/src/qFill.c
+++ b/src/query/src/qFill.c
@@ -25,6 +25,251 @@
#include "queryLog.h"
#define FILL_IS_ASC_FILL(_f) ((_f)->order == TSDB_ORDER_ASC)
+#define DO_INTERPOLATION(_v1, _v2, _k1, _k2, _k) ((_v1) + ((_v2) - (_v1)) * (((double)(_k)) - ((double)(_k1))) / (((double)(_k2)) - ((double)(_k1))))
+
+static void setTagsValue(SFillInfo* pFillInfo, tFilePage** data, int32_t genRows) {
+ for(int32_t j = 0; j < pFillInfo->numOfCols; ++j) {
+ SFillColInfo* pCol = &pFillInfo->pFillCol[j];
+ if (TSDB_COL_IS_NORMAL_COL(pCol->flag)) {
+ continue;
+ }
+
+ char* val1 = elePtrAt(data[j]->data, pCol->col.bytes, genRows);
+
+ assert(pCol->tagIndex >= 0 && pCol->tagIndex < pFillInfo->numOfTags);
+ SFillTagColInfo* pTag = &pFillInfo->pTags[pCol->tagIndex];
+
+ assert (pTag->col.colId == pCol->col.colId);
+ assignVal(val1, pTag->tagVal, pCol->col.bytes, pCol->col.type);
+ }
+}
+
+static void setNullValueForRow(SFillInfo* pFillInfo, tFilePage** data, int32_t numOfCol, int32_t rowIndex) {
+ // the first are always the timestamp column, so start from the second column.
+ for (int32_t i = 1; i < numOfCol; ++i) {
+ SFillColInfo* pCol = &pFillInfo->pFillCol[i];
+
+ char* output = elePtrAt(data[i]->data, pCol->col.bytes, rowIndex);
+ setNull(output, pCol->col.type, pCol->col.bytes);
+ }
+}
+
+static void doFillOneRowResult(SFillInfo* pFillInfo, tFilePage** data, char** srcData, int64_t ts, bool outOfBound) {
+ char* prev = pFillInfo->prevValues;
+ char* next = pFillInfo->nextValues;
+
+ SPoint point1, point2, point;
+ int32_t step = GET_FORWARD_DIRECTION_FACTOR(pFillInfo->order);
+
+ // set the primary timestamp column value
+ int32_t index = pFillInfo->numOfCurrent;
+ char* val = elePtrAt(data[0]->data, TSDB_KEYSIZE, index);
+ *(TSKEY*) val = pFillInfo->currentKey;
+
+ // set the other values
+ if (pFillInfo->type == TSDB_FILL_PREV) {
+ char* p = FILL_IS_ASC_FILL(pFillInfo) ? prev : next;
+
+ if (p != NULL) {
+ for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) {
+ SFillColInfo* pCol = &pFillInfo->pFillCol[i];
+ if (TSDB_COL_IS_TAG(pCol->flag)) {
+ continue;
+ }
+
+ char* output = elePtrAt(data[i]->data, pCol->col.bytes, index);
+ assignVal(output, p + pCol->col.offset, pCol->col.bytes, pCol->col.type);
+ }
+ } else { // no prev value yet, set the value for NULL
+ setNullValueForRow(pFillInfo, data, pFillInfo->numOfCols, index);
+ }
+ } else if (pFillInfo->type == TSDB_FILL_NEXT) {
+ char* p = FILL_IS_ASC_FILL(pFillInfo)? next : prev;
+
+ if (p != NULL) {
+ for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) {
+ SFillColInfo* pCol = &pFillInfo->pFillCol[i];
+ if (TSDB_COL_IS_TAG(pCol->flag)) {
+ continue;
+ }
+
+ char* output = elePtrAt(data[i]->data, pCol->col.bytes, index);
+ assignVal(output, p + pCol->col.offset, pCol->col.bytes, pCol->col.type);
+ }
+ } else { // no prev value yet, set the value for NULL
+ setNullValueForRow(pFillInfo, data, pFillInfo->numOfCols, index);
+ }
+ } else if (pFillInfo->type == TSDB_FILL_LINEAR) {
+ // TODO : linear interpolation supports NULL value
+ if (prev != NULL && !outOfBound) {
+ for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) {
+ SFillColInfo* pCol = &pFillInfo->pFillCol[i];
+ if (TSDB_COL_IS_TAG(pCol->flag)) {
+ continue;
+ }
+
+ int16_t type = pCol->col.type;
+ int16_t bytes = pCol->col.bytes;
+
+ char *val1 = elePtrAt(data[i]->data, pCol->col.bytes, index);
+ if (type == TSDB_DATA_TYPE_BINARY|| type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BOOL) {
+ setNull(val1, pCol->col.type, bytes);
+ continue;
+ }
+
+ point1 = (SPoint){.key = *(TSKEY*)(prev), .val = prev + pCol->col.offset};
+ point2 = (SPoint){.key = ts, .val = srcData[i] + pFillInfo->index * bytes};
+ point = (SPoint){.key = pFillInfo->currentKey, .val = val1};
+ taosGetLinearInterpolationVal(type, &point1, &point2, &point);
+ }
+ } else {
+ setNullValueForRow(pFillInfo, data, pFillInfo->numOfCols, index);
+ }
+ } else { /* fill the default value */
+ for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) {
+ SFillColInfo* pCol = &pFillInfo->pFillCol[i];
+ if (TSDB_COL_IS_TAG(pCol->flag)) {
+ continue;
+ }
+
+ char* val1 = elePtrAt(data[i]->data, pCol->col.bytes, index);
+ assignVal(val1, (char*)&pCol->fillVal.i, pCol->col.bytes, pCol->col.type);
+ }
+ }
+
+ setTagsValue(pFillInfo, data, index);
+ pFillInfo->currentKey = taosTimeAdd(pFillInfo->currentKey, pFillInfo->interval.sliding * step, pFillInfo->interval.slidingUnit, pFillInfo->precision);
+ pFillInfo->numOfCurrent++;
+}
+
+static void initBeforeAfterDataBuf(SFillInfo* pFillInfo, char** next) {
+ if (*next != NULL) {
+ return;
+ }
+
+ *next = calloc(1, pFillInfo->rowSize);
+ for (int i = 1; i < pFillInfo->numOfCols; i++) {
+ SFillColInfo* pCol = &pFillInfo->pFillCol[i];
+ setNull(*next + pCol->col.offset, pCol->col.type, pCol->col.bytes);
+ }
+}
+
+static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, char** srcData, char* buf) {
+ int32_t rowIndex = pFillInfo->index;
+ for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
+ SFillColInfo* pCol = &pFillInfo->pFillCol[i];
+ memcpy(buf + pCol->col.offset, srcData[i] + rowIndex * pCol->col.bytes, pCol->col.bytes);
+ }
+}
+
+static int32_t fillResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t outputRows) {
+ pFillInfo->numOfCurrent = 0;
+
+ char** srcData = pFillInfo->pData;
+ char** prev = &pFillInfo->prevValues;
+ char** next = &pFillInfo->nextValues;
+
+ int32_t step = GET_FORWARD_DIRECTION_FACTOR(pFillInfo->order);
+
+ if (FILL_IS_ASC_FILL(pFillInfo)) {
+ assert(pFillInfo->currentKey >= pFillInfo->start);
+ } else {
+ assert(pFillInfo->currentKey <= pFillInfo->start);
+ }
+
+ while (pFillInfo->numOfCurrent < outputRows) {
+ int64_t ts = ((int64_t*)pFillInfo->pData[0])[pFillInfo->index];
+
+ // set the next value for interpolation
+ if ((pFillInfo->currentKey < ts && FILL_IS_ASC_FILL(pFillInfo)) ||
+ (pFillInfo->currentKey > ts && !FILL_IS_ASC_FILL(pFillInfo))) {
+ initBeforeAfterDataBuf(pFillInfo, next);
+ copyCurrentRowIntoBuf(pFillInfo, srcData, *next);
+ }
+
+ if (((pFillInfo->currentKey < ts && FILL_IS_ASC_FILL(pFillInfo)) || (pFillInfo->currentKey > ts && !FILL_IS_ASC_FILL(pFillInfo))) &&
+ pFillInfo->numOfCurrent < outputRows) {
+
+ // fill the gap between two actual input rows
+ while (((pFillInfo->currentKey < ts && FILL_IS_ASC_FILL(pFillInfo)) ||
+ (pFillInfo->currentKey > ts && !FILL_IS_ASC_FILL(pFillInfo))) &&
+ pFillInfo->numOfCurrent < outputRows) {
+ doFillOneRowResult(pFillInfo, data, srcData, ts, false);
+ }
+
+ // output buffer is full, abort
+ if (pFillInfo->numOfCurrent == outputRows) {
+ pFillInfo->numOfTotal += pFillInfo->numOfCurrent;
+ return outputRows;
+ }
+ } else {
+ assert(pFillInfo->currentKey == ts);
+ initBeforeAfterDataBuf(pFillInfo, prev);
+
+ // assign rows to dst buffer
+ for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
+ SFillColInfo* pCol = &pFillInfo->pFillCol[i];
+ if (TSDB_COL_IS_TAG(pCol->flag)) {
+ continue;
+ }
+
+ char* output = elePtrAt(data[i]->data, pCol->col.bytes, pFillInfo->numOfCurrent);
+ char* src = elePtrAt(srcData[i], pCol->col.bytes, pFillInfo->index);
+
+ if (i == 0 || (pCol->functionId != TSDB_FUNC_COUNT && !isNull(src, pCol->col.type)) ||
+ (pCol->functionId == TSDB_FUNC_COUNT && GET_INT64_VAL(src) != 0)) {
+ assignVal(output, src, pCol->col.bytes, pCol->col.type);
+ memcpy(*prev + pCol->col.offset, src, pCol->col.bytes);
+ } else { // i > 0 and data is null , do interpolation
+ if (pFillInfo->type == TSDB_FILL_PREV) {
+ assignVal(output, *prev + pCol->col.offset, pCol->col.bytes, pCol->col.type);
+ } else if (pFillInfo->type == TSDB_FILL_LINEAR) {
+ assignVal(output, src, pCol->col.bytes, pCol->col.type);
+ memcpy(*prev + pCol->col.offset, src, pCol->col.bytes);
+ } else {
+ assignVal(output, (char*)&pCol->fillVal.i, pCol->col.bytes, pCol->col.type);
+ }
+ }
+ }
+
+ // set the tag value for final result
+ setTagsValue(pFillInfo, data, pFillInfo->numOfCurrent);
+
+ pFillInfo->currentKey = taosTimeAdd(pFillInfo->currentKey, pFillInfo->interval.sliding * step,
+ pFillInfo->interval.slidingUnit, pFillInfo->precision);
+ pFillInfo->index += 1;
+ pFillInfo->numOfCurrent += 1;
+ }
+
+ if (pFillInfo->index >= pFillInfo->numOfRows || pFillInfo->numOfCurrent >= outputRows) {
+ /* the raw data block is exhausted, next value does not exists */
+ if (pFillInfo->index >= pFillInfo->numOfRows) {
+ tfree(*next);
+ }
+
+ pFillInfo->numOfTotal += pFillInfo->numOfCurrent;
+ return pFillInfo->numOfCurrent;
+ }
+ }
+
+ return pFillInfo->numOfCurrent;
+}
+
+static int64_t appendFilledResult(SFillInfo* pFillInfo, tFilePage** output, int64_t resultCapacity) {
+ /*
+ * These data are generated according to fill strategy, since the current timestamp is out of the time window of
+ * real result set. Note that we need to keep the direct previous result rows, to generated the filled data.
+ */
+ pFillInfo->numOfCurrent = 0;
+ while (pFillInfo->numOfCurrent < resultCapacity) {
+ doFillOneRowResult(pFillInfo, output, pFillInfo->pData, pFillInfo->start, true);
+ }
+
+ pFillInfo->numOfTotal += pFillInfo->numOfCurrent;
+
+ assert(pFillInfo->numOfCurrent == resultCapacity);
+ return resultCapacity;
+}
// there are no duplicated tags in the SFillTagColInfo list
static int32_t setTagColumnInfo(SFillInfo* pFillInfo, int32_t numOfCols, int32_t capacity) {
@@ -68,6 +313,14 @@ static int32_t setTagColumnInfo(SFillInfo* pFillInfo, int32_t numOfCols, int32_t
return rowsize;
}
+static int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) {
+ if (pFillInfo->numOfRows == 0 || (pFillInfo->numOfRows > 0 && pFillInfo->index >= pFillInfo->numOfRows)) {
+ return 0;
+ }
+
+ return pFillInfo->numOfRows - pFillInfo->index;
+}
+
SFillInfo* taosInitFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_t capacity, int32_t numOfCols,
int64_t slidingTime, int8_t slidingUnit, int8_t precision, int32_t fillType,
SFillColInfo* pCol, void* handle) {
@@ -76,22 +329,21 @@ SFillInfo* taosInitFillInfo(int32_t order, TSKEY skey, int32_t numOfTags, int32_
}
SFillInfo* pFillInfo = calloc(1, sizeof(SFillInfo));
-
taosResetFillInfo(pFillInfo, skey);
- pFillInfo->order = order;
- pFillInfo->type = fillType;
- pFillInfo->pFillCol = pCol;
+ pFillInfo->order = order;
+ pFillInfo->type = fillType;
+ pFillInfo->pFillCol = pCol;
pFillInfo->numOfTags = numOfTags;
pFillInfo->numOfCols = numOfCols;
pFillInfo->precision = precision;
pFillInfo->alloc = capacity;
pFillInfo->handle = handle;
- pFillInfo->interval.interval = slidingTime;
+ pFillInfo->interval.interval = slidingTime;
pFillInfo->interval.intervalUnit = slidingUnit;
- pFillInfo->interval.sliding = slidingTime;
- pFillInfo->interval.slidingUnit = slidingUnit;
+ pFillInfo->interval.sliding = slidingTime;
+ pFillInfo->interval.slidingUnit = slidingUnit;
pFillInfo->pData = malloc(POINTER_BYTES * numOfCols);
if (numOfTags > 0) {
@@ -185,7 +437,11 @@ void taosFillCopyInputDataFromOneFilePage(SFillInfo* pFillInfo, const tFilePage*
}
}
-int64_t getNumOfResWithFill(SFillInfo* pFillInfo, TSKEY ekey, int32_t maxNumOfRows) {
+bool taosFillHasMoreResults(SFillInfo* pFillInfo) {
+ return taosNumOfRemainRows(pFillInfo) > 0;
+}
+
+int64_t getNumOfResultsAfterFillGap(SFillInfo* pFillInfo, TSKEY ekey, int32_t maxNumOfRows) {
int64_t* tsList = (int64_t*) pFillInfo->pData[0];
int32_t numOfRows = taosNumOfRemainRows(pFillInfo);
@@ -223,16 +479,6 @@ int64_t getNumOfResWithFill(SFillInfo* pFillInfo, TSKEY ekey, int32_t maxNumOfRo
return (numOfRes > maxNumOfRows) ? maxNumOfRows : numOfRes;
}
-int32_t taosNumOfRemainRows(SFillInfo* pFillInfo) {
- if (pFillInfo->numOfRows == 0 || (pFillInfo->numOfRows > 0 && pFillInfo->index >= pFillInfo->numOfRows)) {
- return 0;
- }
-
- return pFillInfo->numOfRows - pFillInfo->index;
-}
-
-#define DO_INTERPOLATION(_v1, _v2, _k1, _k2, _k) ((_v1) + ((_v2) - (_v1)) * (((double)(_k)) - ((double)(_k1))) / (((double)(_k2)) - ((double)(_k1))))
-
int32_t taosGetLinearInterpolationVal(int32_t type, SPoint* point1, SPoint* point2, SPoint* point) {
double v1 = -1;
double v2 = -1;
@@ -256,243 +502,15 @@ int32_t taosGetLinearInterpolationVal(int32_t type, SPoint* point1, SPoint* poin
return TSDB_CODE_SUCCESS;
}
-static void setTagsValue(SFillInfo* pFillInfo, tFilePage** data, int32_t genRows) {
- for(int32_t j = 0; j < pFillInfo->numOfCols; ++j) {
- SFillColInfo* pCol = &pFillInfo->pFillCol[j];
- if (TSDB_COL_IS_NORMAL_COL(pCol->flag)) {
- continue;
- }
-
- char* val1 = elePtrAt(data[j]->data, pCol->col.bytes, genRows);
-
- assert(pCol->tagIndex >= 0 && pCol->tagIndex < pFillInfo->numOfTags);
- SFillTagColInfo* pTag = &pFillInfo->pTags[pCol->tagIndex];
-
- assert (pTag->col.colId == pCol->col.colId);
- assignVal(val1, pTag->tagVal, pCol->col.bytes, pCol->col.type);
- }
-}
-
-static void setNullValueForRow(SFillInfo* pFillInfo, tFilePage** data, int32_t numOfCol, int32_t rowIndex) {
- // the first are always the timestamp column, so start from the second column.
- for (int32_t i = 1; i < numOfCol; ++i) {
- SFillColInfo* pCol = &pFillInfo->pFillCol[i];
-
- char* output = elePtrAt(data[i]->data, pCol->col.bytes, rowIndex);
- setNull(output, pCol->col.type, pCol->col.bytes);
- }
-}
-
-static void doFillOneRowResult(SFillInfo* pFillInfo, tFilePage** data, char** srcData, int64_t ts, bool outOfBound) {
- char* prev = pFillInfo->prevValues;
- char* next = pFillInfo->nextValues;
-
- SPoint point1, point2, point;
- int32_t step = GET_FORWARD_DIRECTION_FACTOR(pFillInfo->order);
-
- // set the primary timestamp column value
- int32_t index = pFillInfo->numOfCurrent;
- char* val = elePtrAt(data[0]->data, TSDB_KEYSIZE, index);
- *(TSKEY*) val = pFillInfo->currentKey;
-
- // set the other values
- if (pFillInfo->type == TSDB_FILL_PREV) {
- char* p = FILL_IS_ASC_FILL(pFillInfo) ? prev : next;
-
- if (p != NULL) {
- for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) {
- SFillColInfo* pCol = &pFillInfo->pFillCol[i];
- if (TSDB_COL_IS_TAG(pCol->flag)) {
- continue;
- }
-
- char* output = elePtrAt(data[i]->data, pCol->col.bytes, index);
- assignVal(output, p + pCol->col.offset, pCol->col.bytes, pCol->col.type);
- }
- } else { // no prev value yet, set the value for NULL
- setNullValueForRow(pFillInfo, data, pFillInfo->numOfCols, index);
- }
- } else if (pFillInfo->type == TSDB_FILL_LINEAR) {
- // TODO : linear interpolation supports NULL value
- if (prev != NULL && !outOfBound) {
- for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) {
- SFillColInfo* pCol = &pFillInfo->pFillCol[i];
- if (TSDB_COL_IS_TAG(pCol->flag)) {
- continue;
- }
-
- int16_t type = pCol->col.type;
- int16_t bytes = pCol->col.bytes;
-
- char *val1 = elePtrAt(data[i]->data, pCol->col.bytes, index);
- if (type == TSDB_DATA_TYPE_BINARY|| type == TSDB_DATA_TYPE_NCHAR || type == TSDB_DATA_TYPE_BOOL) {
- setNull(val1, pCol->col.type, bytes);
- continue;
- }
-
- point1 = (SPoint){.key = *(TSKEY*)(prev), .val = prev + pCol->col.offset};
- point2 = (SPoint){.key = ts, .val = srcData[i] + pFillInfo->index * bytes};
- point = (SPoint){.key = pFillInfo->currentKey, .val = val1};
- taosGetLinearInterpolationVal(type, &point1, &point2, &point);
- }
- } else {
- setNullValueForRow(pFillInfo, data, pFillInfo->numOfCols, index);
- }
- } else { /* fill the default value */
- for (int32_t i = 1; i < pFillInfo->numOfCols; ++i) {
- SFillColInfo* pCol = &pFillInfo->pFillCol[i];
- if (TSDB_COL_IS_TAG(pCol->flag)) {
- continue;
- }
-
- char* val1 = elePtrAt(data[i]->data, pCol->col.bytes, index);
- assignVal(val1, (char*)&pCol->fillVal.i, pCol->col.bytes, pCol->col.type);
- }
- }
-
- setTagsValue(pFillInfo, data, index);
- pFillInfo->currentKey = taosTimeAdd(pFillInfo->currentKey, pFillInfo->interval.sliding * step, pFillInfo->interval.slidingUnit, pFillInfo->precision);
- pFillInfo->numOfCurrent++;
-}
-
-static void initBeforeAfterDataBuf(SFillInfo* pFillInfo, char** next) {
- if (*next != NULL) {
- return;
- }
-
- *next = calloc(1, pFillInfo->rowSize);
- for (int i = 1; i < pFillInfo->numOfCols; i++) {
- SFillColInfo* pCol = &pFillInfo->pFillCol[i];
- setNull(*next + pCol->col.offset, pCol->col.type, pCol->col.bytes);
- }
-}
-
-static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, char** srcData, char* buf) {
- int32_t rowIndex = pFillInfo->index;
- for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
- SFillColInfo* pCol = &pFillInfo->pFillCol[i];
- memcpy(buf + pCol->col.offset, srcData[i] + rowIndex * pCol->col.bytes, pCol->col.bytes);
- }
-}
-
-static int32_t fillResultImpl(SFillInfo* pFillInfo, tFilePage** data, int32_t outputRows) {
- pFillInfo->numOfCurrent = 0;
-
- char** srcData = pFillInfo->pData;
- char** prev = &pFillInfo->prevValues;
- char** next = &pFillInfo->nextValues;
-
- int32_t step = GET_FORWARD_DIRECTION_FACTOR(pFillInfo->order);
-
- if (FILL_IS_ASC_FILL(pFillInfo)) {
- assert(pFillInfo->currentKey >= pFillInfo->start);
- } else {
- assert(pFillInfo->currentKey <= pFillInfo->start);
- }
-
- while (pFillInfo->numOfCurrent < outputRows) {
- int64_t ts = ((int64_t*)pFillInfo->pData[0])[pFillInfo->index];
-
- if ((pFillInfo->currentKey < ts && FILL_IS_ASC_FILL(pFillInfo)) ||
- (pFillInfo->currentKey > ts && !FILL_IS_ASC_FILL(pFillInfo))) {
- /* set the next value for interpolation */
- initBeforeAfterDataBuf(pFillInfo, next);
- copyCurrentRowIntoBuf(pFillInfo, srcData, *next);
- }
-
- if (((pFillInfo->currentKey < ts && FILL_IS_ASC_FILL(pFillInfo)) || (pFillInfo->currentKey > ts && !FILL_IS_ASC_FILL(pFillInfo))) &&
- pFillInfo->numOfCurrent < outputRows) {
-
- // fill the gap between two actual input rows
- while (((pFillInfo->currentKey < ts && FILL_IS_ASC_FILL(pFillInfo)) ||
- (pFillInfo->currentKey > ts && !FILL_IS_ASC_FILL(pFillInfo))) &&
- pFillInfo->numOfCurrent < outputRows) {
- doFillOneRowResult(pFillInfo, data, srcData, ts, false);
- }
-
- // output buffer is full, abort
- if (pFillInfo->numOfCurrent == outputRows) {
- pFillInfo->numOfTotal += pFillInfo->numOfCurrent;
- return outputRows;
- }
- } else {
- assert(pFillInfo->currentKey == ts);
- initBeforeAfterDataBuf(pFillInfo, prev);
-
- // assign rows to dst buffer
- for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
- SFillColInfo* pCol = &pFillInfo->pFillCol[i];
- if (TSDB_COL_IS_TAG(pCol->flag)) {
- continue;
- }
-
- char* output = elePtrAt(data[i]->data, pCol->col.bytes, pFillInfo->numOfCurrent);
- char* src = elePtrAt(srcData[i], pCol->col.bytes, pFillInfo->index);
-
- if (i == 0 || (pCol->functionId != TSDB_FUNC_COUNT && !isNull(src, pCol->col.type)) ||
- (pCol->functionId == TSDB_FUNC_COUNT && GET_INT64_VAL(src) != 0)) {
- assignVal(output, src, pCol->col.bytes, pCol->col.type);
- memcpy(*prev + pCol->col.offset, src, pCol->col.bytes);
- } else { // i > 0 and data is null , do interpolation
- if (pFillInfo->type == TSDB_FILL_PREV) {
- assignVal(output, *prev + pCol->col.offset, pCol->col.bytes, pCol->col.type);
- } else if (pFillInfo->type == TSDB_FILL_LINEAR) {
- assignVal(output, src, pCol->col.bytes, pCol->col.type);
- memcpy(*prev + pCol->col.offset, src, pCol->col.bytes);
- } else {
- assignVal(output, (char*)&pCol->fillVal.i, pCol->col.bytes, pCol->col.type);
- }
- }
- }
-
- // set the tag value for final result
- setTagsValue(pFillInfo, data, pFillInfo->numOfCurrent);
-
- pFillInfo->currentKey = taosTimeAdd(pFillInfo->currentKey, pFillInfo->interval.sliding * step,
- pFillInfo->interval.slidingUnit, pFillInfo->precision);
- pFillInfo->index += 1;
- pFillInfo->numOfCurrent += 1;
- }
-
- if (pFillInfo->index >= pFillInfo->numOfRows || pFillInfo->numOfCurrent >= outputRows) {
- /* the raw data block is exhausted, next value does not exists */
- if (pFillInfo->index >= pFillInfo->numOfRows) {
- tfree(*next);
- }
-
- pFillInfo->numOfTotal += pFillInfo->numOfCurrent;
- return pFillInfo->numOfCurrent;
- }
- }
-
- return pFillInfo->numOfCurrent;
-}
-
-static int64_t fillExternalResults(SFillInfo* pFillInfo, tFilePage** output, int64_t resultCapacity) {
- /*
- * These data are generated according to fill strategy, since the current timestamp is out of the time window of
- * real result set. Note that we need to keep the direct previous result rows, to generated the filled data.
- */
- pFillInfo->numOfCurrent = 0;
- while (pFillInfo->numOfCurrent < resultCapacity) {
- doFillOneRowResult(pFillInfo, output, pFillInfo->pData, pFillInfo->start, true);
- }
-
- pFillInfo->numOfTotal += pFillInfo->numOfCurrent;
-
- assert(pFillInfo->numOfCurrent == resultCapacity);
- return resultCapacity;
-}
-
int64_t taosFillResultDataBlock(SFillInfo* pFillInfo, tFilePage** output, int32_t capacity) {
int32_t remain = taosNumOfRemainRows(pFillInfo);
- int64_t numOfRes = getNumOfResWithFill(pFillInfo, pFillInfo->end, capacity);
+ int64_t numOfRes = getNumOfResultsAfterFillGap(pFillInfo, pFillInfo->end, capacity);
assert(numOfRes <= capacity);
// no data existed for fill operation now, append result according to the fill strategy
if (remain == 0) {
- fillExternalResults(pFillInfo, output, numOfRes);
+ appendFilledResult(pFillInfo, output, numOfRes);
} else {
fillResultImpl(pFillInfo, output, (int32_t) numOfRes);
assert(numOfRes == pFillInfo->numOfCurrent);
diff --git a/src/query/src/qHistogram.c b/src/query/src/qHistogram.c
index bdc071060c..ae25a75234 100644
--- a/src/query/src/qHistogram.c
+++ b/src/query/src/qHistogram.c
@@ -184,7 +184,7 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
histogramCreateBin(*pHisto, idx, val);
}
#else
- tSkipListKey key = tSkipListCreateKey(TSDB_DATA_TYPE_DOUBLE, &val, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
+ tSkipListKey key = tSkipListCreateKey(TSDB_DATA_TYPE_DOUBLE, &val, tDataTypes[TSDB_DATA_TYPE_DOUBLE].nSize);
SHistBin* entry = calloc(1, sizeof(SHistBin));
entry->val = val;
@@ -217,7 +217,7 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
}
tSkipListKey kx =
- tSkipListCreateKey(TSDB_DATA_TYPE_DOUBLE, &(*pHisto)->max, tDataTypeDesc[TSDB_DATA_TYPE_DOUBLE].nSize);
+ tSkipListCreateKey(TSDB_DATA_TYPE_DOUBLE, &(*pHisto)->max, tDataTypes[TSDB_DATA_TYPE_DOUBLE].nSize);
pLast = tSkipListGetOne((*pHisto)->pList, &kx);
}
} else {
diff --git a/src/query/src/qParserImpl.c b/src/query/src/qParserImpl.c
index d311cb3557..62e221ff4e 100644
--- a/src/query/src/qParserImpl.c
+++ b/src/query/src/qParserImpl.c
@@ -398,21 +398,21 @@ void tSqlSetColumnType(TAOS_FIELD *pField, SStrToken *type) {
pField->name[0] = 0;
int32_t i = 0;
- while (i < tListLen(tDataTypeDesc)) {
- if ((type->n == tDataTypeDesc[i].nameLen) &&
- (strncasecmp(type->z, tDataTypeDesc[i].aName, tDataTypeDesc[i].nameLen) == 0)) {
+ while (i < tListLen(tDataTypes)) {
+ if ((type->n == tDataTypes[i].nameLen) &&
+ (strncasecmp(type->z, tDataTypes[i].name, tDataTypes[i].nameLen) == 0)) {
break;
}
i += 1;
}
- if (i == tListLen(tDataTypeDesc)) {
+ if (i == tListLen(tDataTypes)) {
return;
}
pField->type = i;
- pField->bytes = tDataTypeDesc[i].nSize;
+ pField->bytes = tDataTypes[i].bytes;
if (i == TSDB_DATA_TYPE_NCHAR) {
/*
@@ -585,11 +585,12 @@ SCreatedTableInfo createNewChildTableInfo(SStrToken *pTableName, SArray *pTagVal
return info;
}
-SAlterTableSQL *tAlterTableSqlElems(SStrToken *pTableName, SArray *pCols, SArray *pVals, int32_t type) {
+SAlterTableSQL *tAlterTableSqlElems(SStrToken *pTableName, SArray *pCols, SArray *pVals, int32_t type, int16_t tableType) {
SAlterTableSQL *pAlterTable = calloc(1, sizeof(SAlterTableSQL));
pAlterTable->name = *pTableName;
pAlterTable->type = type;
+ pAlterTable->tableType = tableType;
if (type == TSDB_ALTER_TABLE_ADD_COLUMN || type == TSDB_ALTER_TABLE_ADD_TAG_COLUMN) {
pAlterTable->pAddColumns = pCols;
@@ -733,9 +734,10 @@ void setDCLSQLElems(SSqlInfo *pInfo, int32_t type, int32_t nParam, ...) {
va_end(va);
}
-void setDropDbTableInfo(SSqlInfo *pInfo, int32_t type, SStrToken* pToken, SStrToken* existsCheck) {
+void setDropDbTableInfo(SSqlInfo *pInfo, int32_t type, SStrToken* pToken, SStrToken* existsCheck, int16_t tableType) {
pInfo->type = type;
pInfo->pDCLInfo = tTokenListAppend(pInfo->pDCLInfo, pToken);
+ pInfo->pDCLInfo->tableType = tableType;
pInfo->pDCLInfo->existsCheck = (existsCheck->n == 1);
}
diff --git a/src/query/src/sql.c b/src/query/src/sql.c
index 6c59a51074..0f03499974 100644
--- a/src/query/src/sql.c
+++ b/src/query/src/sql.c
@@ -23,6 +23,7 @@
** input grammar file:
*/
#include
+#include
/************ Begin %include sections from the grammar ************************/
#include
@@ -76,8 +77,10 @@
** zero the stack is dynamically sized using realloc()
** ParseARG_SDECL A static variable declaration for the %extra_argument
** ParseARG_PDECL A parameter declaration for the %extra_argument
+** ParseARG_PARAM Code to pass %extra_argument as a subroutine parameter
** ParseARG_STORE Code to store %extra_argument into yypParser
** ParseARG_FETCH Code to extract %extra_argument from yypParser
+** ParseCTX_* As ParseARG_ except for %extra_context
** YYERRORSYMBOL is the code number of the error symbol. If not
** defined, then do no error processing.
** YYNSTATE the combined number of states.
@@ -97,7 +100,7 @@
#endif
/************* Begin control #defines *****************************************/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 279
+#define YYNOCODE 278
#define YYACTIONTYPE unsigned short int
#define ParseTOKENTYPE SStrToken
typedef union {
@@ -124,21 +127,29 @@ typedef union {
#endif
#define ParseARG_SDECL SSqlInfo* pInfo;
#define ParseARG_PDECL ,SSqlInfo* pInfo
-#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo
-#define ParseARG_STORE yypParser->pInfo = pInfo
+#define ParseARG_PARAM ,pInfo
+#define ParseARG_FETCH SSqlInfo* pInfo=yypParser->pInfo;
+#define ParseARG_STORE yypParser->pInfo=pInfo;
+#define ParseCTX_SDECL
+#define ParseCTX_PDECL
+#define ParseCTX_PARAM
+#define ParseCTX_FETCH
+#define ParseCTX_STORE
#define YYFALLBACK 1
-#define YYNSTATE 258
-#define YYNRULE 240
+#define YYNSTATE 282
+#define YYNRULE 248
+#define YYNRULE_WITH_ACTION 248
#define YYNTOKEN 209
-#define YY_MAX_SHIFT 257
-#define YY_MIN_SHIFTREDUCE 431
-#define YY_MAX_SHIFTREDUCE 670
-#define YY_ERROR_ACTION 671
-#define YY_ACCEPT_ACTION 672
-#define YY_NO_ACTION 673
-#define YY_MIN_REDUCE 674
-#define YY_MAX_REDUCE 913
+#define YY_MAX_SHIFT 281
+#define YY_MIN_SHIFTREDUCE 461
+#define YY_MAX_SHIFTREDUCE 708
+#define YY_ERROR_ACTION 709
+#define YY_ACCEPT_ACTION 710
+#define YY_NO_ACTION 711
+#define YY_MIN_REDUCE 712
+#define YY_MAX_REDUCE 959
/************* End control #defines *******************************************/
+#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
/* Define the yytestcase() macro to be a no-op if is not already defined
** otherwise.
@@ -203,132 +214,136 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
-#define YY_ACTTAB_COUNT (586)
+#define YY_ACTTAB_COUNT (623)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 143, 474, 143, 23, 672, 257, 165, 547, 827, 475,
- /* 10 */ 900, 168, 901, 37, 38, 12, 39, 40, 816, 23,
- /* 20 */ 173, 31, 474, 474, 210, 43, 41, 45, 42, 805,
- /* 30 */ 475, 475, 163, 36, 35, 232, 231, 34, 33, 32,
- /* 40 */ 37, 38, 801, 39, 40, 816, 110, 173, 31, 162,
- /* 50 */ 255, 210, 43, 41, 45, 42, 176, 66, 802, 195,
- /* 60 */ 36, 35, 178, 824, 34, 33, 32, 432, 433, 434,
- /* 70 */ 435, 436, 437, 438, 439, 440, 441, 442, 443, 256,
- /* 80 */ 179, 225, 185, 37, 38, 805, 39, 40, 796, 242,
- /* 90 */ 173, 31, 143, 180, 210, 43, 41, 45, 42, 110,
- /* 100 */ 110, 167, 901, 36, 35, 57, 853, 34, 33, 32,
- /* 110 */ 17, 223, 250, 249, 222, 221, 220, 248, 219, 247,
- /* 120 */ 246, 245, 218, 244, 243, 803, 142, 774, 624, 762,
- /* 130 */ 763, 764, 765, 766, 767, 768, 769, 770, 771, 772,
- /* 140 */ 773, 775, 776, 38, 181, 39, 40, 229, 228, 173,
- /* 150 */ 31, 605, 606, 210, 43, 41, 45, 42, 207, 854,
- /* 160 */ 61, 205, 36, 35, 23, 110, 34, 33, 32, 188,
- /* 170 */ 39, 40, 23, 251, 173, 31, 192, 191, 210, 43,
- /* 180 */ 41, 45, 42, 34, 33, 32, 105, 36, 35, 104,
- /* 190 */ 147, 34, 33, 32, 172, 637, 805, 28, 628, 897,
- /* 200 */ 631, 177, 634, 802, 172, 637, 896, 13, 628, 230,
- /* 210 */ 631, 802, 634, 18, 172, 637, 794, 895, 628, 63,
- /* 220 */ 631, 28, 634, 155, 574, 62, 169, 170, 23, 156,
- /* 230 */ 209, 29, 197, 92, 91, 150, 169, 170, 77, 76,
- /* 240 */ 582, 17, 198, 250, 249, 159, 169, 170, 248, 626,
- /* 250 */ 247, 246, 245, 715, 244, 243, 133, 211, 780, 80,
- /* 260 */ 160, 778, 779, 18, 242, 234, 781, 802, 783, 784,
- /* 270 */ 782, 28, 785, 786, 43, 41, 45, 42, 724, 579,
- /* 280 */ 64, 133, 36, 35, 19, 627, 34, 33, 32, 3,
- /* 290 */ 124, 194, 225, 44, 910, 72, 68, 71, 158, 11,
- /* 300 */ 10, 566, 592, 44, 563, 636, 564, 107, 565, 793,
- /* 310 */ 22, 795, 630, 44, 633, 636, 716, 36, 35, 133,
- /* 320 */ 635, 34, 33, 32, 171, 636, 596, 49, 78, 82,
- /* 330 */ 635, 48, 182, 183, 87, 90, 81, 137, 135, 629,
- /* 340 */ 635, 632, 84, 95, 94, 93, 50, 9, 145, 640,
- /* 350 */ 52, 65, 120, 254, 253, 98, 597, 656, 638, 555,
- /* 360 */ 146, 15, 14, 14, 24, 4, 55, 53, 546, 213,
- /* 370 */ 556, 570, 148, 571, 24, 48, 568, 149, 569, 89,
- /* 380 */ 88, 103, 101, 153, 154, 152, 141, 151, 144, 804,
- /* 390 */ 864, 863, 818, 174, 860, 859, 175, 233, 826, 846,
- /* 400 */ 831, 833, 106, 121, 845, 122, 567, 119, 123, 726,
- /* 410 */ 217, 139, 26, 226, 102, 723, 28, 227, 909, 74,
- /* 420 */ 908, 906, 125, 744, 27, 25, 196, 140, 713, 591,
- /* 430 */ 83, 711, 85, 86, 199, 709, 708, 184, 54, 134,
- /* 440 */ 706, 164, 705, 704, 703, 702, 136, 700, 698, 696,
- /* 450 */ 694, 692, 138, 203, 58, 59, 51, 847, 815, 46,
- /* 460 */ 208, 206, 204, 202, 200, 30, 79, 235, 236, 237,
- /* 470 */ 238, 239, 240, 241, 161, 215, 216, 252, 670, 187,
- /* 480 */ 186, 669, 69, 189, 157, 190, 668, 193, 661, 707,
- /* 490 */ 197, 576, 60, 56, 593, 96, 128, 97, 127, 745,
- /* 500 */ 126, 130, 129, 131, 132, 701, 693, 113, 111, 118,
- /* 510 */ 116, 114, 112, 115, 800, 1, 117, 2, 166, 20,
- /* 520 */ 108, 201, 6, 598, 109, 7, 639, 5, 8, 21,
- /* 530 */ 16, 67, 212, 641, 214, 515, 65, 511, 509, 508,
- /* 540 */ 507, 504, 478, 224, 70, 47, 73, 75, 24, 549,
- /* 550 */ 548, 545, 499, 497, 489, 495, 491, 493, 487, 485,
- /* 560 */ 517, 516, 514, 513, 512, 510, 506, 505, 48, 476,
- /* 570 */ 447, 445, 674, 673, 673, 673, 673, 673, 673, 673,
- /* 580 */ 673, 673, 673, 673, 99, 100,
+ /* 0 */ 158, 505, 158, 710, 281, 857, 659, 578, 182, 506,
+ /* 10 */ 941, 185, 942, 41, 42, 15, 43, 44, 26, 179,
+ /* 20 */ 190, 35, 505, 505, 231, 47, 45, 49, 46, 868,
+ /* 30 */ 506, 506, 846, 40, 39, 256, 255, 38, 37, 36,
+ /* 40 */ 41, 42, 660, 43, 44, 857, 951, 190, 35, 178,
+ /* 50 */ 279, 231, 47, 45, 49, 46, 180, 195, 843, 214,
+ /* 60 */ 40, 39, 157, 61, 38, 37, 36, 462, 463, 464,
+ /* 70 */ 465, 466, 467, 468, 469, 470, 471, 472, 473, 280,
+ /* 80 */ 198, 846, 204, 41, 42, 865, 43, 44, 246, 266,
+ /* 90 */ 190, 35, 158, 834, 231, 47, 45, 49, 46, 122,
+ /* 100 */ 122, 184, 942, 40, 39, 122, 62, 38, 37, 36,
+ /* 110 */ 20, 244, 274, 273, 243, 242, 241, 272, 240, 271,
+ /* 120 */ 270, 269, 239, 268, 267, 38, 37, 36, 813, 657,
+ /* 130 */ 801, 802, 803, 804, 805, 806, 807, 808, 809, 810,
+ /* 140 */ 811, 812, 814, 815, 42, 200, 43, 44, 253, 252,
+ /* 150 */ 190, 35, 835, 275, 231, 47, 45, 49, 46, 228,
+ /* 160 */ 895, 66, 226, 40, 39, 115, 894, 38, 37, 36,
+ /* 170 */ 26, 43, 44, 32, 26, 190, 35, 846, 207, 231,
+ /* 180 */ 47, 45, 49, 46, 26, 211, 210, 162, 40, 39,
+ /* 190 */ 196, 845, 38, 37, 36, 189, 670, 117, 938, 661,
+ /* 200 */ 71, 664, 26, 667, 122, 189, 670, 188, 193, 661,
+ /* 210 */ 843, 664, 194, 667, 843, 189, 670, 16, 21, 661,
+ /* 220 */ 90, 664, 249, 667, 843, 266, 32, 186, 187, 246,
+ /* 230 */ 26, 230, 837, 166, 278, 277, 109, 186, 187, 167,
+ /* 240 */ 250, 615, 843, 199, 102, 101, 165, 186, 187, 4,
+ /* 250 */ 20, 26, 274, 273, 219, 197, 26, 272, 248, 271,
+ /* 260 */ 270, 269, 10, 268, 267, 67, 70, 132, 254, 819,
+ /* 270 */ 843, 217, 817, 818, 21, 844, 27, 820, 905, 822,
+ /* 280 */ 823, 821, 32, 824, 825, 47, 45, 49, 46, 258,
+ /* 290 */ 663, 843, 666, 40, 39, 48, 842, 38, 37, 36,
+ /* 300 */ 754, 232, 213, 146, 69, 48, 904, 669, 763, 173,
+ /* 310 */ 755, 146, 68, 146, 662, 48, 665, 669, 599, 638,
+ /* 320 */ 639, 596, 668, 597, 33, 598, 612, 669, 603, 607,
+ /* 330 */ 604, 22, 668, 832, 833, 25, 836, 216, 625, 88,
+ /* 340 */ 92, 937, 668, 119, 936, 82, 97, 100, 91, 201,
+ /* 350 */ 202, 191, 588, 629, 94, 3, 136, 27, 52, 152,
+ /* 360 */ 148, 29, 77, 73, 76, 150, 105, 104, 103, 40,
+ /* 370 */ 39, 630, 689, 38, 37, 36, 18, 17, 671, 53,
+ /* 380 */ 56, 174, 234, 17, 589, 81, 80, 27, 175, 52,
+ /* 390 */ 12, 11, 99, 98, 673, 87, 86, 57, 54, 160,
+ /* 400 */ 59, 161, 577, 14, 13, 163, 601, 164, 602, 114,
+ /* 410 */ 112, 170, 171, 901, 169, 900, 156, 168, 159, 192,
+ /* 420 */ 257, 116, 867, 859, 600, 872, 32, 874, 118, 133,
+ /* 430 */ 887, 886, 131, 134, 135, 765, 238, 154, 30, 215,
+ /* 440 */ 247, 762, 956, 78, 955, 953, 137, 251, 113, 950,
+ /* 450 */ 84, 949, 947, 138, 783, 31, 28, 155, 752, 93,
+ /* 460 */ 750, 95, 624, 220, 96, 181, 748, 747, 203, 147,
+ /* 470 */ 58, 745, 224, 744, 743, 856, 742, 741, 149, 151,
+ /* 480 */ 738, 55, 50, 123, 229, 227, 736, 734, 225, 732,
+ /* 490 */ 223, 730, 221, 153, 89, 34, 218, 63, 259, 260,
+ /* 500 */ 64, 888, 261, 262, 263, 264, 265, 276, 708, 176,
+ /* 510 */ 205, 206, 707, 208, 236, 237, 209, 177, 172, 706,
+ /* 520 */ 74, 694, 212, 216, 609, 746, 60, 106, 233, 6,
+ /* 530 */ 120, 141, 140, 784, 139, 142, 143, 740, 144, 145,
+ /* 540 */ 107, 739, 2, 108, 841, 731, 65, 626, 1, 129,
+ /* 550 */ 126, 124, 125, 183, 127, 128, 130, 222, 7, 631,
+ /* 560 */ 121, 23, 24, 672, 8, 5, 674, 9, 19, 235,
+ /* 570 */ 72, 546, 542, 70, 540, 539, 538, 535, 509, 245,
+ /* 580 */ 79, 27, 75, 580, 51, 83, 85, 579, 576, 530,
+ /* 590 */ 528, 520, 526, 522, 524, 518, 516, 548, 547, 545,
+ /* 600 */ 544, 543, 541, 537, 536, 52, 507, 477, 475, 712,
+ /* 610 */ 711, 711, 711, 711, 711, 711, 711, 711, 711, 711,
+ /* 620 */ 711, 110, 111,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 267, 1, 267, 213, 210, 211, 230, 5, 213, 9,
- /* 10 */ 277, 276, 277, 13, 14, 267, 16, 17, 251, 213,
- /* 20 */ 20, 21, 1, 1, 24, 25, 26, 27, 28, 253,
- /* 30 */ 9, 9, 265, 33, 34, 33, 34, 37, 38, 39,
- /* 40 */ 13, 14, 252, 16, 17, 251, 213, 20, 21, 212,
- /* 50 */ 213, 24, 25, 26, 27, 28, 250, 218, 252, 265,
- /* 60 */ 33, 34, 230, 268, 37, 38, 39, 45, 46, 47,
+ /* 0 */ 267, 1, 267, 209, 210, 251, 1, 5, 229, 9,
+ /* 10 */ 277, 276, 277, 13, 14, 267, 16, 17, 212, 265,
+ /* 20 */ 20, 21, 1, 1, 24, 25, 26, 27, 28, 212,
+ /* 30 */ 9, 9, 253, 33, 34, 33, 34, 37, 38, 39,
+ /* 40 */ 13, 14, 37, 16, 17, 251, 253, 20, 21, 211,
+ /* 50 */ 212, 24, 25, 26, 27, 28, 250, 229, 252, 265,
+ /* 60 */ 33, 34, 267, 217, 37, 38, 39, 45, 46, 47,
/* 70 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- /* 80 */ 66, 76, 60, 13, 14, 253, 16, 17, 249, 78,
- /* 90 */ 20, 21, 267, 213, 24, 25, 26, 27, 28, 213,
- /* 100 */ 213, 276, 277, 33, 34, 105, 273, 37, 38, 39,
- /* 110 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- /* 120 */ 95, 96, 97, 98, 99, 245, 267, 229, 101, 231,
- /* 130 */ 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
- /* 140 */ 242, 243, 244, 14, 130, 16, 17, 133, 134, 20,
- /* 150 */ 21, 118, 119, 24, 25, 26, 27, 28, 271, 273,
- /* 160 */ 273, 275, 33, 34, 213, 213, 37, 38, 39, 129,
- /* 170 */ 16, 17, 213, 230, 20, 21, 136, 137, 24, 25,
- /* 180 */ 26, 27, 28, 37, 38, 39, 213, 33, 34, 100,
- /* 190 */ 267, 37, 38, 39, 1, 2, 253, 108, 5, 267,
- /* 200 */ 7, 250, 9, 252, 1, 2, 267, 44, 5, 250,
- /* 210 */ 7, 252, 9, 100, 1, 2, 0, 267, 5, 254,
- /* 220 */ 7, 108, 9, 60, 101, 273, 33, 34, 213, 66,
- /* 230 */ 37, 266, 109, 70, 71, 72, 33, 34, 131, 132,
- /* 240 */ 37, 85, 269, 87, 88, 267, 33, 34, 92, 1,
- /* 250 */ 94, 95, 96, 217, 98, 99, 220, 15, 229, 73,
- /* 260 */ 267, 232, 233, 100, 78, 250, 237, 252, 239, 240,
- /* 270 */ 241, 108, 243, 244, 25, 26, 27, 28, 217, 106,
- /* 280 */ 218, 220, 33, 34, 111, 37, 37, 38, 39, 61,
- /* 290 */ 62, 128, 76, 100, 253, 67, 68, 69, 135, 131,
- /* 300 */ 132, 2, 101, 100, 5, 112, 7, 106, 9, 247,
- /* 310 */ 248, 249, 5, 100, 7, 112, 217, 33, 34, 220,
- /* 320 */ 127, 37, 38, 39, 59, 112, 101, 106, 61, 62,
- /* 330 */ 127, 106, 33, 34, 67, 68, 69, 61, 62, 5,
- /* 340 */ 127, 7, 75, 67, 68, 69, 125, 100, 267, 107,
- /* 350 */ 106, 104, 105, 63, 64, 65, 101, 101, 101, 101,
- /* 360 */ 267, 106, 106, 106, 106, 100, 100, 123, 102, 101,
- /* 370 */ 101, 5, 267, 7, 106, 106, 5, 267, 7, 73,
- /* 380 */ 74, 61, 62, 267, 267, 267, 267, 267, 267, 253,
- /* 390 */ 246, 246, 251, 246, 246, 246, 246, 246, 213, 274,
- /* 400 */ 213, 213, 213, 213, 274, 213, 107, 255, 213, 213,
- /* 410 */ 213, 213, 213, 213, 59, 213, 108, 213, 213, 213,
- /* 420 */ 213, 213, 213, 213, 213, 213, 251, 213, 213, 112,
- /* 430 */ 213, 213, 213, 213, 270, 213, 213, 213, 122, 213,
- /* 440 */ 213, 270, 213, 213, 213, 213, 213, 213, 213, 213,
- /* 450 */ 213, 213, 213, 270, 214, 214, 124, 214, 264, 121,
- /* 460 */ 116, 120, 115, 114, 113, 126, 84, 83, 49, 80,
- /* 470 */ 82, 53, 81, 79, 214, 214, 214, 76, 5, 5,
- /* 480 */ 138, 5, 218, 138, 214, 5, 5, 129, 86, 214,
- /* 490 */ 109, 101, 106, 110, 101, 215, 222, 215, 226, 228,
- /* 500 */ 227, 223, 225, 224, 221, 214, 214, 261, 263, 256,
- /* 510 */ 258, 260, 262, 259, 251, 219, 257, 216, 1, 106,
- /* 520 */ 100, 100, 117, 101, 100, 117, 101, 100, 100, 106,
- /* 530 */ 100, 73, 103, 107, 103, 9, 104, 5, 5, 5,
- /* 540 */ 5, 5, 77, 15, 73, 16, 132, 132, 106, 5,
- /* 550 */ 5, 101, 5, 5, 5, 5, 5, 5, 5, 5,
- /* 560 */ 5, 5, 5, 5, 5, 5, 5, 5, 106, 77,
- /* 570 */ 59, 58, 0, 278, 278, 278, 278, 278, 278, 278,
- /* 580 */ 278, 278, 278, 278, 21, 21, 278, 278, 278, 278,
- /* 590 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
- /* 600 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
+ /* 80 */ 66, 253, 60, 13, 14, 268, 16, 17, 77, 79,
+ /* 90 */ 20, 21, 267, 247, 24, 25, 26, 27, 28, 212,
+ /* 100 */ 212, 276, 277, 33, 34, 212, 106, 37, 38, 39,
+ /* 110 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
+ /* 120 */ 96, 97, 98, 99, 100, 37, 38, 39, 228, 102,
+ /* 130 */ 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
+ /* 140 */ 240, 241, 242, 243, 14, 131, 16, 17, 134, 135,
+ /* 150 */ 20, 21, 0, 229, 24, 25, 26, 27, 28, 271,
+ /* 160 */ 273, 273, 275, 33, 34, 101, 273, 37, 38, 39,
+ /* 170 */ 212, 16, 17, 109, 212, 20, 21, 253, 130, 24,
+ /* 180 */ 25, 26, 27, 28, 212, 137, 138, 267, 33, 34,
+ /* 190 */ 66, 253, 37, 38, 39, 1, 2, 212, 267, 5,
+ /* 200 */ 217, 7, 212, 9, 212, 1, 2, 59, 250, 5,
+ /* 210 */ 252, 7, 250, 9, 252, 1, 2, 44, 101, 5,
+ /* 220 */ 74, 7, 250, 9, 252, 79, 109, 33, 34, 77,
+ /* 230 */ 212, 37, 249, 60, 63, 64, 65, 33, 34, 66,
+ /* 240 */ 250, 37, 252, 212, 71, 72, 73, 33, 34, 101,
+ /* 250 */ 86, 212, 88, 89, 269, 131, 212, 93, 134, 95,
+ /* 260 */ 96, 97, 101, 99, 100, 273, 105, 106, 250, 228,
+ /* 270 */ 252, 102, 231, 232, 101, 244, 107, 236, 245, 238,
+ /* 280 */ 239, 240, 109, 242, 243, 25, 26, 27, 28, 250,
+ /* 290 */ 5, 252, 7, 33, 34, 101, 252, 37, 38, 39,
+ /* 300 */ 216, 15, 129, 219, 217, 101, 245, 113, 216, 136,
+ /* 310 */ 216, 219, 254, 219, 5, 101, 7, 113, 2, 119,
+ /* 320 */ 120, 5, 128, 7, 266, 9, 107, 113, 5, 102,
+ /* 330 */ 7, 112, 128, 246, 247, 248, 249, 110, 102, 61,
+ /* 340 */ 62, 267, 128, 107, 267, 67, 68, 69, 70, 33,
+ /* 350 */ 34, 245, 102, 102, 76, 61, 62, 107, 107, 61,
+ /* 360 */ 62, 67, 68, 69, 70, 67, 68, 69, 70, 33,
+ /* 370 */ 34, 102, 102, 37, 38, 39, 107, 107, 102, 107,
+ /* 380 */ 107, 267, 102, 107, 102, 132, 133, 107, 267, 107,
+ /* 390 */ 132, 133, 74, 75, 108, 132, 133, 124, 126, 267,
+ /* 400 */ 101, 267, 103, 132, 133, 267, 5, 267, 7, 61,
+ /* 410 */ 62, 267, 267, 245, 267, 245, 267, 267, 267, 245,
+ /* 420 */ 245, 212, 212, 251, 108, 212, 109, 212, 212, 212,
+ /* 430 */ 274, 274, 255, 212, 212, 212, 212, 212, 212, 251,
+ /* 440 */ 212, 212, 212, 212, 212, 212, 212, 212, 59, 212,
+ /* 450 */ 212, 212, 212, 212, 212, 212, 212, 212, 212, 212,
+ /* 460 */ 212, 212, 113, 270, 212, 270, 212, 212, 212, 212,
+ /* 470 */ 123, 212, 270, 212, 212, 264, 212, 212, 212, 212,
+ /* 480 */ 212, 125, 122, 263, 117, 121, 212, 212, 116, 212,
+ /* 490 */ 115, 212, 114, 212, 85, 127, 213, 213, 84, 49,
+ /* 500 */ 213, 213, 81, 83, 53, 82, 80, 77, 5, 213,
+ /* 510 */ 139, 5, 5, 139, 213, 213, 5, 213, 213, 5,
+ /* 520 */ 217, 87, 130, 110, 102, 213, 111, 214, 104, 101,
+ /* 530 */ 101, 221, 225, 227, 226, 224, 222, 213, 223, 220,
+ /* 540 */ 214, 213, 215, 214, 251, 213, 107, 102, 218, 257,
+ /* 550 */ 260, 262, 261, 1, 259, 258, 256, 101, 118, 102,
+ /* 560 */ 101, 107, 107, 102, 118, 101, 108, 101, 101, 104,
+ /* 570 */ 74, 9, 5, 105, 5, 5, 5, 5, 78, 15,
+ /* 580 */ 133, 107, 74, 5, 16, 133, 133, 5, 102, 5,
+ /* 590 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ /* 600 */ 5, 5, 5, 5, 5, 107, 78, 59, 58, 0,
/* 610 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
- /* 620 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
+ /* 620 */ 278, 21, 21, 278, 278, 278, 278, 278, 278, 278,
/* 630 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 640 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 650 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
@@ -345,86 +360,97 @@ static const YYCODETYPE yy_lookahead[] = {
/* 760 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 770 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
/* 780 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
- /* 790 */ 278, 278, 278, 278, 278,
+ /* 790 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
+ /* 800 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
+ /* 810 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
+ /* 820 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278,
+ /* 830 */ 278, 278,
};
-#define YY_SHIFT_COUNT (257)
+#define YY_SHIFT_COUNT (281)
#define YY_SHIFT_MIN (0)
-#define YY_SHIFT_MAX (572)
+#define YY_SHIFT_MAX (609)
static const unsigned short int yy_shift_ofst[] = {
- /* 0 */ 163, 25, 156, 5, 193, 213, 21, 21, 21, 21,
- /* 10 */ 21, 21, 0, 22, 213, 299, 299, 299, 113, 21,
- /* 20 */ 21, 21, 216, 21, 21, 186, 11, 11, 586, 203,
- /* 30 */ 213, 213, 213, 213, 213, 213, 213, 213, 213, 213,
- /* 40 */ 213, 213, 213, 213, 213, 213, 213, 299, 299, 2,
- /* 50 */ 2, 2, 2, 2, 2, 2, 89, 21, 21, 21,
- /* 60 */ 21, 33, 33, 173, 21, 21, 21, 21, 21, 21,
+ /* 0 */ 173, 24, 164, 11, 194, 214, 21, 21, 21, 21,
+ /* 10 */ 21, 21, 21, 21, 21, 0, 22, 214, 316, 316,
+ /* 20 */ 316, 117, 21, 21, 21, 152, 21, 21, 146, 11,
+ /* 30 */ 10, 10, 623, 204, 214, 214, 214, 214, 214, 214,
+ /* 40 */ 214, 214, 214, 214, 214, 214, 214, 214, 214, 214,
+ /* 50 */ 214, 316, 316, 2, 2, 2, 2, 2, 2, 2,
+ /* 60 */ 64, 21, 21, 21, 21, 21, 200, 200, 219, 21,
/* 70 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
/* 80 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
/* 90 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
- /* 100 */ 21, 21, 21, 21, 308, 355, 355, 317, 317, 317,
- /* 110 */ 355, 316, 332, 338, 344, 341, 347, 349, 351, 339,
- /* 120 */ 308, 355, 355, 355, 5, 355, 382, 384, 419, 389,
- /* 130 */ 388, 418, 391, 394, 355, 401, 355, 401, 355, 586,
- /* 140 */ 586, 27, 70, 70, 70, 129, 154, 249, 249, 249,
- /* 150 */ 267, 284, 284, 284, 284, 228, 276, 14, 40, 146,
- /* 160 */ 146, 247, 290, 123, 201, 225, 255, 256, 257, 307,
- /* 170 */ 334, 248, 265, 242, 221, 244, 258, 268, 269, 107,
- /* 180 */ 266, 168, 366, 371, 306, 320, 473, 342, 474, 476,
- /* 190 */ 345, 480, 481, 402, 358, 381, 390, 383, 386, 393,
- /* 200 */ 420, 517, 421, 422, 424, 413, 405, 423, 408, 425,
- /* 210 */ 427, 426, 428, 429, 430, 431, 432, 458, 526, 532,
- /* 220 */ 533, 534, 535, 536, 465, 528, 471, 529, 414, 415,
- /* 230 */ 442, 544, 545, 450, 442, 547, 548, 549, 550, 551,
- /* 240 */ 552, 553, 554, 555, 556, 557, 558, 559, 560, 561,
- /* 250 */ 562, 462, 492, 563, 564, 511, 513, 572,
+ /* 100 */ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ /* 110 */ 21, 21, 21, 21, 21, 317, 389, 389, 389, 349,
+ /* 120 */ 349, 349, 389, 347, 356, 360, 367, 364, 372, 375,
+ /* 130 */ 378, 368, 317, 389, 389, 389, 11, 389, 389, 409,
+ /* 140 */ 414, 450, 421, 420, 451, 423, 426, 389, 430, 389,
+ /* 150 */ 430, 389, 430, 389, 623, 623, 27, 70, 70, 70,
+ /* 160 */ 130, 155, 260, 260, 260, 278, 294, 298, 336, 336,
+ /* 170 */ 336, 336, 14, 48, 88, 88, 161, 124, 171, 227,
+ /* 180 */ 169, 236, 251, 269, 270, 276, 285, 309, 5, 148,
+ /* 190 */ 286, 272, 273, 250, 280, 282, 253, 258, 263, 299,
+ /* 200 */ 271, 323, 401, 318, 348, 503, 371, 506, 507, 374,
+ /* 210 */ 511, 514, 434, 392, 413, 422, 415, 424, 428, 439,
+ /* 220 */ 445, 429, 552, 456, 457, 459, 454, 440, 455, 446,
+ /* 230 */ 461, 464, 458, 466, 424, 467, 465, 468, 496, 562,
+ /* 240 */ 567, 569, 570, 571, 572, 500, 564, 508, 447, 474,
+ /* 250 */ 474, 568, 452, 453, 474, 578, 582, 486, 474, 584,
+ /* 260 */ 585, 586, 587, 588, 589, 590, 591, 592, 593, 594,
+ /* 270 */ 595, 596, 597, 598, 599, 498, 528, 600, 601, 548,
+ /* 280 */ 550, 609,
};
-#define YY_REDUCE_COUNT (140)
+#define YY_REDUCE_COUNT (155)
#define YY_REDUCE_MIN (-267)
-#define YY_REDUCE_MAX (301)
+#define YY_REDUCE_MAX (332)
static const short yy_reduce_ofst[] = {
- /* 0 */ -206, -102, 29, 62, -265, -175, -114, -113, -194, -49,
- /* 10 */ -41, 15, -205, -163, -267, -224, -168, -57, -233, -27,
- /* 20 */ -167, -48, -161, -120, -210, 36, 61, 99, -35, -252,
- /* 30 */ -141, -77, -68, -61, -50, -22, -7, 81, 93, 105,
- /* 40 */ 110, 116, 117, 118, 119, 120, 121, 41, 136, 144,
- /* 50 */ 145, 147, 148, 149, 150, 151, 141, 185, 187, 188,
- /* 60 */ 189, 125, 130, 152, 190, 192, 195, 196, 197, 198,
- /* 70 */ 199, 200, 202, 204, 205, 206, 207, 208, 209, 210,
- /* 80 */ 211, 212, 214, 215, 217, 218, 219, 220, 222, 223,
- /* 90 */ 224, 226, 227, 229, 230, 231, 232, 233, 234, 235,
- /* 100 */ 236, 237, 238, 239, 175, 240, 241, 164, 171, 183,
- /* 110 */ 243, 194, 245, 250, 246, 251, 254, 252, 259, 253,
- /* 120 */ 263, 260, 261, 262, 264, 270, 271, 273, 272, 274,
- /* 130 */ 277, 278, 279, 283, 275, 280, 291, 282, 292, 296,
- /* 140 */ 301,
+ /* 0 */ -206, -100, 41, 87, -265, -175, -194, -113, -112, -42,
+ /* 10 */ -38, -28, -10, 18, 39, -183, -162, -267, -221, -172,
+ /* 20 */ -76, -246, -15, -107, -8, -17, 31, 44, 84, -154,
+ /* 30 */ 92, 94, 58, -252, -205, -80, -69, 74, 77, 114,
+ /* 40 */ 121, 132, 134, 138, 140, 144, 145, 147, 149, 150,
+ /* 50 */ 151, -207, -62, 33, 61, 106, 168, 170, 174, 175,
+ /* 60 */ 172, 209, 210, 213, 215, 216, 156, 157, 177, 217,
+ /* 70 */ 221, 222, 223, 224, 225, 226, 228, 229, 230, 231,
+ /* 80 */ 232, 233, 234, 235, 237, 238, 239, 240, 241, 242,
+ /* 90 */ 243, 244, 245, 246, 247, 248, 249, 252, 254, 255,
+ /* 100 */ 256, 257, 259, 261, 262, 264, 265, 266, 267, 268,
+ /* 110 */ 274, 275, 277, 279, 281, 188, 283, 284, 287, 193,
+ /* 120 */ 195, 202, 288, 211, 220, 289, 291, 290, 295, 297,
+ /* 130 */ 292, 300, 293, 296, 301, 302, 303, 304, 305, 306,
+ /* 140 */ 308, 307, 310, 311, 314, 315, 319, 312, 313, 324,
+ /* 150 */ 326, 328, 329, 332, 330, 327,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 671, 725, 714, 722, 903, 903, 671, 671, 671, 671,
- /* 10 */ 671, 671, 828, 689, 903, 671, 671, 671, 671, 671,
- /* 20 */ 671, 671, 722, 671, 671, 727, 727, 727, 823, 671,
- /* 30 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671,
- /* 40 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671,
- /* 50 */ 671, 671, 671, 671, 671, 671, 671, 671, 830, 832,
- /* 60 */ 671, 850, 850, 821, 671, 671, 671, 671, 671, 671,
- /* 70 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671,
- /* 80 */ 671, 671, 671, 712, 671, 710, 671, 671, 671, 671,
- /* 90 */ 671, 671, 671, 671, 671, 671, 671, 671, 699, 671,
- /* 100 */ 671, 671, 671, 671, 671, 691, 691, 671, 671, 671,
- /* 110 */ 691, 857, 861, 855, 843, 851, 842, 838, 837, 865,
- /* 120 */ 671, 691, 691, 691, 722, 691, 743, 741, 739, 731,
- /* 130 */ 737, 733, 735, 729, 691, 720, 691, 720, 691, 761,
- /* 140 */ 777, 671, 866, 902, 856, 892, 891, 898, 890, 889,
- /* 150 */ 671, 885, 886, 888, 887, 671, 671, 671, 671, 894,
- /* 160 */ 893, 671, 671, 671, 671, 671, 671, 671, 671, 671,
- /* 170 */ 671, 671, 868, 671, 862, 858, 671, 671, 671, 671,
- /* 180 */ 787, 671, 671, 671, 671, 671, 671, 671, 671, 671,
- /* 190 */ 671, 671, 671, 671, 671, 820, 671, 671, 829, 671,
- /* 200 */ 671, 671, 671, 671, 671, 852, 671, 844, 671, 671,
- /* 210 */ 671, 671, 671, 797, 671, 671, 671, 671, 671, 671,
- /* 220 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671,
- /* 230 */ 907, 671, 671, 671, 905, 671, 671, 671, 671, 671,
- /* 240 */ 671, 671, 671, 671, 671, 671, 671, 671, 671, 671,
- /* 250 */ 671, 746, 671, 697, 695, 671, 687, 671,
+ /* 0 */ 709, 764, 753, 761, 944, 944, 709, 709, 709, 709,
+ /* 10 */ 709, 709, 709, 709, 709, 869, 727, 944, 709, 709,
+ /* 20 */ 709, 709, 709, 709, 709, 761, 709, 709, 766, 761,
+ /* 30 */ 766, 766, 864, 709, 709, 709, 709, 709, 709, 709,
+ /* 40 */ 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
+ /* 50 */ 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
+ /* 60 */ 709, 709, 709, 871, 873, 709, 891, 891, 862, 709,
+ /* 70 */ 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
+ /* 80 */ 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
+ /* 90 */ 709, 709, 709, 751, 709, 749, 709, 709, 709, 709,
+ /* 100 */ 709, 709, 709, 709, 709, 709, 709, 709, 709, 737,
+ /* 110 */ 709, 709, 709, 709, 709, 709, 729, 729, 729, 709,
+ /* 120 */ 709, 709, 729, 898, 902, 896, 884, 892, 883, 879,
+ /* 130 */ 878, 906, 709, 729, 729, 729, 761, 729, 729, 782,
+ /* 140 */ 780, 778, 770, 776, 772, 774, 768, 729, 759, 729,
+ /* 150 */ 759, 729, 759, 729, 800, 816, 709, 907, 943, 897,
+ /* 160 */ 933, 932, 939, 931, 930, 709, 709, 709, 926, 927,
+ /* 170 */ 929, 928, 709, 709, 935, 934, 709, 709, 709, 709,
+ /* 180 */ 709, 709, 709, 709, 709, 709, 709, 709, 709, 909,
+ /* 190 */ 709, 903, 899, 709, 709, 709, 709, 709, 709, 826,
+ /* 200 */ 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
+ /* 210 */ 709, 709, 709, 709, 861, 709, 709, 709, 709, 870,
+ /* 220 */ 709, 709, 709, 709, 709, 709, 893, 709, 885, 709,
+ /* 230 */ 709, 709, 709, 709, 838, 709, 709, 709, 709, 709,
+ /* 240 */ 709, 709, 709, 709, 709, 709, 709, 709, 709, 954,
+ /* 250 */ 952, 709, 709, 709, 948, 709, 709, 709, 946, 709,
+ /* 260 */ 709, 709, 709, 709, 709, 709, 709, 709, 709, 709,
+ /* 270 */ 709, 709, 709, 709, 709, 785, 709, 735, 733, 709,
+ /* 280 */ 725, 709,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -511,6 +537,7 @@ static const YYCODETYPE yyFallback[] = {
0, /* STABLES => nothing */
0, /* VGROUPS => nothing */
0, /* DROP => nothing */
+ 1, /* STABLE => ID */
0, /* DNODE => nothing */
0, /* USER => nothing */
0, /* ACCOUNT => nothing */
@@ -649,7 +676,6 @@ static const YYCODETYPE yyFallback[] = {
1, /* TBNAME => ID */
1, /* JOIN => ID */
1, /* METRICS => ID */
- 1, /* STABLE => ID */
1, /* INSERT => ID */
1, /* INTO => ID */
1, /* VALUES => ID */
@@ -692,6 +718,7 @@ struct yyParser {
int yyerrcnt; /* Shifts left before out of the error */
#endif
ParseARG_SDECL /* A place to hold %extra_argument */
+ ParseCTX_SDECL /* A place to hold %extra_context */
#if YYSTACKDEPTH<=0
int yystksz; /* Current side of the stack */
yyStackEntry *yystack; /* The parser's stack */
@@ -806,187 +833,187 @@ static const char *const yyTokenName[] = {
/* 64 */ "STABLES",
/* 65 */ "VGROUPS",
/* 66 */ "DROP",
- /* 67 */ "DNODE",
- /* 68 */ "USER",
- /* 69 */ "ACCOUNT",
- /* 70 */ "USE",
- /* 71 */ "DESCRIBE",
- /* 72 */ "ALTER",
- /* 73 */ "PASS",
- /* 74 */ "PRIVILEGE",
- /* 75 */ "LOCAL",
- /* 76 */ "IF",
- /* 77 */ "EXISTS",
- /* 78 */ "PPS",
- /* 79 */ "TSERIES",
- /* 80 */ "DBS",
- /* 81 */ "STORAGE",
- /* 82 */ "QTIME",
- /* 83 */ "CONNS",
- /* 84 */ "STATE",
- /* 85 */ "KEEP",
- /* 86 */ "CACHE",
- /* 87 */ "REPLICA",
- /* 88 */ "QUORUM",
- /* 89 */ "DAYS",
- /* 90 */ "MINROWS",
- /* 91 */ "MAXROWS",
- /* 92 */ "BLOCKS",
- /* 93 */ "CTIME",
- /* 94 */ "WAL",
- /* 95 */ "FSYNC",
- /* 96 */ "COMP",
- /* 97 */ "PRECISION",
- /* 98 */ "UPDATE",
- /* 99 */ "CACHELAST",
- /* 100 */ "LP",
- /* 101 */ "RP",
- /* 102 */ "UNSIGNED",
- /* 103 */ "TAGS",
- /* 104 */ "USING",
- /* 105 */ "AS",
- /* 106 */ "COMMA",
- /* 107 */ "NULL",
- /* 108 */ "SELECT",
- /* 109 */ "UNION",
- /* 110 */ "ALL",
- /* 111 */ "FROM",
- /* 112 */ "VARIABLE",
- /* 113 */ "INTERVAL",
- /* 114 */ "FILL",
- /* 115 */ "SLIDING",
- /* 116 */ "ORDER",
- /* 117 */ "BY",
- /* 118 */ "ASC",
- /* 119 */ "DESC",
- /* 120 */ "GROUP",
- /* 121 */ "HAVING",
- /* 122 */ "LIMIT",
- /* 123 */ "OFFSET",
- /* 124 */ "SLIMIT",
- /* 125 */ "SOFFSET",
- /* 126 */ "WHERE",
- /* 127 */ "NOW",
- /* 128 */ "RESET",
- /* 129 */ "QUERY",
- /* 130 */ "ADD",
- /* 131 */ "COLUMN",
- /* 132 */ "TAG",
- /* 133 */ "CHANGE",
- /* 134 */ "SET",
- /* 135 */ "KILL",
- /* 136 */ "CONNECTION",
- /* 137 */ "STREAM",
- /* 138 */ "COLON",
- /* 139 */ "ABORT",
- /* 140 */ "AFTER",
- /* 141 */ "ATTACH",
- /* 142 */ "BEFORE",
- /* 143 */ "BEGIN",
- /* 144 */ "CASCADE",
- /* 145 */ "CLUSTER",
- /* 146 */ "CONFLICT",
- /* 147 */ "COPY",
- /* 148 */ "DEFERRED",
- /* 149 */ "DELIMITERS",
- /* 150 */ "DETACH",
- /* 151 */ "EACH",
- /* 152 */ "END",
- /* 153 */ "EXPLAIN",
- /* 154 */ "FAIL",
- /* 155 */ "FOR",
- /* 156 */ "IGNORE",
- /* 157 */ "IMMEDIATE",
- /* 158 */ "INITIALLY",
- /* 159 */ "INSTEAD",
- /* 160 */ "MATCH",
- /* 161 */ "KEY",
- /* 162 */ "OF",
- /* 163 */ "RAISE",
- /* 164 */ "REPLACE",
- /* 165 */ "RESTRICT",
- /* 166 */ "ROW",
- /* 167 */ "STATEMENT",
- /* 168 */ "TRIGGER",
- /* 169 */ "VIEW",
- /* 170 */ "COUNT",
- /* 171 */ "SUM",
- /* 172 */ "AVG",
- /* 173 */ "MIN",
- /* 174 */ "MAX",
- /* 175 */ "FIRST",
- /* 176 */ "LAST",
- /* 177 */ "TOP",
- /* 178 */ "BOTTOM",
- /* 179 */ "STDDEV",
- /* 180 */ "PERCENTILE",
- /* 181 */ "APERCENTILE",
- /* 182 */ "LEASTSQUARES",
- /* 183 */ "HISTOGRAM",
- /* 184 */ "DIFF",
- /* 185 */ "SPREAD",
- /* 186 */ "TWA",
- /* 187 */ "INTERP",
- /* 188 */ "LAST_ROW",
- /* 189 */ "RATE",
- /* 190 */ "IRATE",
- /* 191 */ "SUM_RATE",
- /* 192 */ "SUM_IRATE",
- /* 193 */ "AVG_RATE",
- /* 194 */ "AVG_IRATE",
- /* 195 */ "TBID",
- /* 196 */ "SEMI",
- /* 197 */ "NONE",
- /* 198 */ "PREV",
- /* 199 */ "LINEAR",
- /* 200 */ "IMPORT",
- /* 201 */ "METRIC",
- /* 202 */ "TBNAME",
- /* 203 */ "JOIN",
- /* 204 */ "METRICS",
- /* 205 */ "STABLE",
+ /* 67 */ "STABLE",
+ /* 68 */ "DNODE",
+ /* 69 */ "USER",
+ /* 70 */ "ACCOUNT",
+ /* 71 */ "USE",
+ /* 72 */ "DESCRIBE",
+ /* 73 */ "ALTER",
+ /* 74 */ "PASS",
+ /* 75 */ "PRIVILEGE",
+ /* 76 */ "LOCAL",
+ /* 77 */ "IF",
+ /* 78 */ "EXISTS",
+ /* 79 */ "PPS",
+ /* 80 */ "TSERIES",
+ /* 81 */ "DBS",
+ /* 82 */ "STORAGE",
+ /* 83 */ "QTIME",
+ /* 84 */ "CONNS",
+ /* 85 */ "STATE",
+ /* 86 */ "KEEP",
+ /* 87 */ "CACHE",
+ /* 88 */ "REPLICA",
+ /* 89 */ "QUORUM",
+ /* 90 */ "DAYS",
+ /* 91 */ "MINROWS",
+ /* 92 */ "MAXROWS",
+ /* 93 */ "BLOCKS",
+ /* 94 */ "CTIME",
+ /* 95 */ "WAL",
+ /* 96 */ "FSYNC",
+ /* 97 */ "COMP",
+ /* 98 */ "PRECISION",
+ /* 99 */ "UPDATE",
+ /* 100 */ "CACHELAST",
+ /* 101 */ "LP",
+ /* 102 */ "RP",
+ /* 103 */ "UNSIGNED",
+ /* 104 */ "TAGS",
+ /* 105 */ "USING",
+ /* 106 */ "AS",
+ /* 107 */ "COMMA",
+ /* 108 */ "NULL",
+ /* 109 */ "SELECT",
+ /* 110 */ "UNION",
+ /* 111 */ "ALL",
+ /* 112 */ "FROM",
+ /* 113 */ "VARIABLE",
+ /* 114 */ "INTERVAL",
+ /* 115 */ "FILL",
+ /* 116 */ "SLIDING",
+ /* 117 */ "ORDER",
+ /* 118 */ "BY",
+ /* 119 */ "ASC",
+ /* 120 */ "DESC",
+ /* 121 */ "GROUP",
+ /* 122 */ "HAVING",
+ /* 123 */ "LIMIT",
+ /* 124 */ "OFFSET",
+ /* 125 */ "SLIMIT",
+ /* 126 */ "SOFFSET",
+ /* 127 */ "WHERE",
+ /* 128 */ "NOW",
+ /* 129 */ "RESET",
+ /* 130 */ "QUERY",
+ /* 131 */ "ADD",
+ /* 132 */ "COLUMN",
+ /* 133 */ "TAG",
+ /* 134 */ "CHANGE",
+ /* 135 */ "SET",
+ /* 136 */ "KILL",
+ /* 137 */ "CONNECTION",
+ /* 138 */ "STREAM",
+ /* 139 */ "COLON",
+ /* 140 */ "ABORT",
+ /* 141 */ "AFTER",
+ /* 142 */ "ATTACH",
+ /* 143 */ "BEFORE",
+ /* 144 */ "BEGIN",
+ /* 145 */ "CASCADE",
+ /* 146 */ "CLUSTER",
+ /* 147 */ "CONFLICT",
+ /* 148 */ "COPY",
+ /* 149 */ "DEFERRED",
+ /* 150 */ "DELIMITERS",
+ /* 151 */ "DETACH",
+ /* 152 */ "EACH",
+ /* 153 */ "END",
+ /* 154 */ "EXPLAIN",
+ /* 155 */ "FAIL",
+ /* 156 */ "FOR",
+ /* 157 */ "IGNORE",
+ /* 158 */ "IMMEDIATE",
+ /* 159 */ "INITIALLY",
+ /* 160 */ "INSTEAD",
+ /* 161 */ "MATCH",
+ /* 162 */ "KEY",
+ /* 163 */ "OF",
+ /* 164 */ "RAISE",
+ /* 165 */ "REPLACE",
+ /* 166 */ "RESTRICT",
+ /* 167 */ "ROW",
+ /* 168 */ "STATEMENT",
+ /* 169 */ "TRIGGER",
+ /* 170 */ "VIEW",
+ /* 171 */ "COUNT",
+ /* 172 */ "SUM",
+ /* 173 */ "AVG",
+ /* 174 */ "MIN",
+ /* 175 */ "MAX",
+ /* 176 */ "FIRST",
+ /* 177 */ "LAST",
+ /* 178 */ "TOP",
+ /* 179 */ "BOTTOM",
+ /* 180 */ "STDDEV",
+ /* 181 */ "PERCENTILE",
+ /* 182 */ "APERCENTILE",
+ /* 183 */ "LEASTSQUARES",
+ /* 184 */ "HISTOGRAM",
+ /* 185 */ "DIFF",
+ /* 186 */ "SPREAD",
+ /* 187 */ "TWA",
+ /* 188 */ "INTERP",
+ /* 189 */ "LAST_ROW",
+ /* 190 */ "RATE",
+ /* 191 */ "IRATE",
+ /* 192 */ "SUM_RATE",
+ /* 193 */ "SUM_IRATE",
+ /* 194 */ "AVG_RATE",
+ /* 195 */ "AVG_IRATE",
+ /* 196 */ "TBID",
+ /* 197 */ "SEMI",
+ /* 198 */ "NONE",
+ /* 199 */ "PREV",
+ /* 200 */ "LINEAR",
+ /* 201 */ "IMPORT",
+ /* 202 */ "METRIC",
+ /* 203 */ "TBNAME",
+ /* 204 */ "JOIN",
+ /* 205 */ "METRICS",
/* 206 */ "INSERT",
/* 207 */ "INTO",
/* 208 */ "VALUES",
- /* 209 */ "error",
- /* 210 */ "program",
- /* 211 */ "cmd",
- /* 212 */ "dbPrefix",
- /* 213 */ "ids",
- /* 214 */ "cpxName",
- /* 215 */ "ifexists",
- /* 216 */ "alter_db_optr",
- /* 217 */ "acct_optr",
- /* 218 */ "ifnotexists",
- /* 219 */ "db_optr",
- /* 220 */ "pps",
- /* 221 */ "tseries",
- /* 222 */ "dbs",
- /* 223 */ "streams",
- /* 224 */ "storage",
- /* 225 */ "qtime",
- /* 226 */ "users",
- /* 227 */ "conns",
- /* 228 */ "state",
- /* 229 */ "keep",
- /* 230 */ "tagitemlist",
- /* 231 */ "cache",
- /* 232 */ "replica",
- /* 233 */ "quorum",
- /* 234 */ "days",
- /* 235 */ "minrows",
- /* 236 */ "maxrows",
- /* 237 */ "blocks",
- /* 238 */ "ctime",
- /* 239 */ "wal",
- /* 240 */ "fsync",
- /* 241 */ "comp",
- /* 242 */ "prec",
- /* 243 */ "update",
- /* 244 */ "cachelast",
- /* 245 */ "typename",
- /* 246 */ "signed",
- /* 247 */ "create_table_args",
+ /* 209 */ "program",
+ /* 210 */ "cmd",
+ /* 211 */ "dbPrefix",
+ /* 212 */ "ids",
+ /* 213 */ "cpxName",
+ /* 214 */ "ifexists",
+ /* 215 */ "alter_db_optr",
+ /* 216 */ "acct_optr",
+ /* 217 */ "ifnotexists",
+ /* 218 */ "db_optr",
+ /* 219 */ "pps",
+ /* 220 */ "tseries",
+ /* 221 */ "dbs",
+ /* 222 */ "streams",
+ /* 223 */ "storage",
+ /* 224 */ "qtime",
+ /* 225 */ "users",
+ /* 226 */ "conns",
+ /* 227 */ "state",
+ /* 228 */ "keep",
+ /* 229 */ "tagitemlist",
+ /* 230 */ "cache",
+ /* 231 */ "replica",
+ /* 232 */ "quorum",
+ /* 233 */ "days",
+ /* 234 */ "minrows",
+ /* 235 */ "maxrows",
+ /* 236 */ "blocks",
+ /* 237 */ "ctime",
+ /* 238 */ "wal",
+ /* 239 */ "fsync",
+ /* 240 */ "comp",
+ /* 241 */ "prec",
+ /* 242 */ "update",
+ /* 243 */ "cachelast",
+ /* 244 */ "typename",
+ /* 245 */ "signed",
+ /* 246 */ "create_table_args",
+ /* 247 */ "create_stable_args",
/* 248 */ "create_table_list",
/* 249 */ "create_from_stable",
/* 250 */ "columnlist",
@@ -1052,218 +1079,226 @@ static const char *const yyRuleName[] = {
/* 25 */ "cmd ::= SHOW dbPrefix VGROUPS",
/* 26 */ "cmd ::= SHOW dbPrefix VGROUPS ids",
/* 27 */ "cmd ::= DROP TABLE ifexists ids cpxName",
- /* 28 */ "cmd ::= DROP DATABASE ifexists ids",
- /* 29 */ "cmd ::= DROP DNODE ids",
- /* 30 */ "cmd ::= DROP USER ids",
- /* 31 */ "cmd ::= DROP ACCOUNT ids",
- /* 32 */ "cmd ::= USE ids",
- /* 33 */ "cmd ::= DESCRIBE ids cpxName",
- /* 34 */ "cmd ::= ALTER USER ids PASS ids",
- /* 35 */ "cmd ::= ALTER USER ids PRIVILEGE ids",
- /* 36 */ "cmd ::= ALTER DNODE ids ids",
- /* 37 */ "cmd ::= ALTER DNODE ids ids ids",
- /* 38 */ "cmd ::= ALTER LOCAL ids",
- /* 39 */ "cmd ::= ALTER LOCAL ids ids",
- /* 40 */ "cmd ::= ALTER DATABASE ids alter_db_optr",
- /* 41 */ "cmd ::= ALTER ACCOUNT ids acct_optr",
- /* 42 */ "cmd ::= ALTER ACCOUNT ids PASS ids acct_optr",
- /* 43 */ "ids ::= ID",
- /* 44 */ "ids ::= STRING",
- /* 45 */ "ifexists ::= IF EXISTS",
- /* 46 */ "ifexists ::=",
- /* 47 */ "ifnotexists ::= IF NOT EXISTS",
- /* 48 */ "ifnotexists ::=",
- /* 49 */ "cmd ::= CREATE DNODE ids",
- /* 50 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr",
- /* 51 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr",
- /* 52 */ "cmd ::= CREATE USER ids PASS ids",
- /* 53 */ "pps ::=",
- /* 54 */ "pps ::= PPS INTEGER",
- /* 55 */ "tseries ::=",
- /* 56 */ "tseries ::= TSERIES INTEGER",
- /* 57 */ "dbs ::=",
- /* 58 */ "dbs ::= DBS INTEGER",
- /* 59 */ "streams ::=",
- /* 60 */ "streams ::= STREAMS INTEGER",
- /* 61 */ "storage ::=",
- /* 62 */ "storage ::= STORAGE INTEGER",
- /* 63 */ "qtime ::=",
- /* 64 */ "qtime ::= QTIME INTEGER",
- /* 65 */ "users ::=",
- /* 66 */ "users ::= USERS INTEGER",
- /* 67 */ "conns ::=",
- /* 68 */ "conns ::= CONNS INTEGER",
- /* 69 */ "state ::=",
- /* 70 */ "state ::= STATE ids",
- /* 71 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state",
- /* 72 */ "keep ::= KEEP tagitemlist",
- /* 73 */ "cache ::= CACHE INTEGER",
- /* 74 */ "replica ::= REPLICA INTEGER",
- /* 75 */ "quorum ::= QUORUM INTEGER",
- /* 76 */ "days ::= DAYS INTEGER",
- /* 77 */ "minrows ::= MINROWS INTEGER",
- /* 78 */ "maxrows ::= MAXROWS INTEGER",
- /* 79 */ "blocks ::= BLOCKS INTEGER",
- /* 80 */ "ctime ::= CTIME INTEGER",
- /* 81 */ "wal ::= WAL INTEGER",
- /* 82 */ "fsync ::= FSYNC INTEGER",
- /* 83 */ "comp ::= COMP INTEGER",
- /* 84 */ "prec ::= PRECISION STRING",
- /* 85 */ "update ::= UPDATE INTEGER",
- /* 86 */ "cachelast ::= CACHELAST INTEGER",
- /* 87 */ "db_optr ::=",
- /* 88 */ "db_optr ::= db_optr cache",
- /* 89 */ "db_optr ::= db_optr replica",
- /* 90 */ "db_optr ::= db_optr quorum",
- /* 91 */ "db_optr ::= db_optr days",
- /* 92 */ "db_optr ::= db_optr minrows",
- /* 93 */ "db_optr ::= db_optr maxrows",
- /* 94 */ "db_optr ::= db_optr blocks",
- /* 95 */ "db_optr ::= db_optr ctime",
- /* 96 */ "db_optr ::= db_optr wal",
- /* 97 */ "db_optr ::= db_optr fsync",
- /* 98 */ "db_optr ::= db_optr comp",
- /* 99 */ "db_optr ::= db_optr prec",
- /* 100 */ "db_optr ::= db_optr keep",
- /* 101 */ "db_optr ::= db_optr update",
- /* 102 */ "db_optr ::= db_optr cachelast",
- /* 103 */ "alter_db_optr ::=",
- /* 104 */ "alter_db_optr ::= alter_db_optr replica",
- /* 105 */ "alter_db_optr ::= alter_db_optr quorum",
- /* 106 */ "alter_db_optr ::= alter_db_optr keep",
- /* 107 */ "alter_db_optr ::= alter_db_optr blocks",
- /* 108 */ "alter_db_optr ::= alter_db_optr comp",
- /* 109 */ "alter_db_optr ::= alter_db_optr wal",
- /* 110 */ "alter_db_optr ::= alter_db_optr fsync",
- /* 111 */ "alter_db_optr ::= alter_db_optr update",
- /* 112 */ "alter_db_optr ::= alter_db_optr cachelast",
- /* 113 */ "typename ::= ids",
- /* 114 */ "typename ::= ids LP signed RP",
- /* 115 */ "typename ::= ids UNSIGNED",
- /* 116 */ "signed ::= INTEGER",
- /* 117 */ "signed ::= PLUS INTEGER",
- /* 118 */ "signed ::= MINUS INTEGER",
- /* 119 */ "cmd ::= CREATE TABLE create_table_args",
- /* 120 */ "cmd ::= CREATE TABLE create_table_list",
- /* 121 */ "create_table_list ::= create_from_stable",
- /* 122 */ "create_table_list ::= create_table_list create_from_stable",
- /* 123 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP",
- /* 124 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP",
- /* 125 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP",
- /* 126 */ "create_table_args ::= ifnotexists ids cpxName AS select",
- /* 127 */ "columnlist ::= columnlist COMMA column",
- /* 128 */ "columnlist ::= column",
- /* 129 */ "column ::= ids typename",
- /* 130 */ "tagitemlist ::= tagitemlist COMMA tagitem",
- /* 131 */ "tagitemlist ::= tagitem",
- /* 132 */ "tagitem ::= INTEGER",
- /* 133 */ "tagitem ::= FLOAT",
- /* 134 */ "tagitem ::= STRING",
- /* 135 */ "tagitem ::= BOOL",
- /* 136 */ "tagitem ::= NULL",
- /* 137 */ "tagitem ::= MINUS INTEGER",
- /* 138 */ "tagitem ::= MINUS FLOAT",
- /* 139 */ "tagitem ::= PLUS INTEGER",
- /* 140 */ "tagitem ::= PLUS FLOAT",
- /* 141 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt",
- /* 142 */ "union ::= select",
- /* 143 */ "union ::= LP union RP",
- /* 144 */ "union ::= union UNION ALL select",
- /* 145 */ "union ::= union UNION ALL LP select RP",
- /* 146 */ "cmd ::= union",
- /* 147 */ "select ::= SELECT selcollist",
- /* 148 */ "sclp ::= selcollist COMMA",
- /* 149 */ "sclp ::=",
- /* 150 */ "selcollist ::= sclp expr as",
- /* 151 */ "selcollist ::= sclp STAR",
- /* 152 */ "as ::= AS ids",
- /* 153 */ "as ::= ids",
- /* 154 */ "as ::=",
- /* 155 */ "from ::= FROM tablelist",
- /* 156 */ "tablelist ::= ids cpxName",
- /* 157 */ "tablelist ::= ids cpxName ids",
- /* 158 */ "tablelist ::= tablelist COMMA ids cpxName",
- /* 159 */ "tablelist ::= tablelist COMMA ids cpxName ids",
- /* 160 */ "tmvar ::= VARIABLE",
- /* 161 */ "interval_opt ::= INTERVAL LP tmvar RP",
- /* 162 */ "interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP",
- /* 163 */ "interval_opt ::=",
- /* 164 */ "fill_opt ::=",
- /* 165 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
- /* 166 */ "fill_opt ::= FILL LP ID RP",
- /* 167 */ "sliding_opt ::= SLIDING LP tmvar RP",
- /* 168 */ "sliding_opt ::=",
- /* 169 */ "orderby_opt ::=",
- /* 170 */ "orderby_opt ::= ORDER BY sortlist",
- /* 171 */ "sortlist ::= sortlist COMMA item sortorder",
- /* 172 */ "sortlist ::= item sortorder",
- /* 173 */ "item ::= ids cpxName",
- /* 174 */ "sortorder ::= ASC",
- /* 175 */ "sortorder ::= DESC",
- /* 176 */ "sortorder ::=",
- /* 177 */ "groupby_opt ::=",
- /* 178 */ "groupby_opt ::= GROUP BY grouplist",
- /* 179 */ "grouplist ::= grouplist COMMA item",
- /* 180 */ "grouplist ::= item",
- /* 181 */ "having_opt ::=",
- /* 182 */ "having_opt ::= HAVING expr",
- /* 183 */ "limit_opt ::=",
- /* 184 */ "limit_opt ::= LIMIT signed",
- /* 185 */ "limit_opt ::= LIMIT signed OFFSET signed",
- /* 186 */ "limit_opt ::= LIMIT signed COMMA signed",
- /* 187 */ "slimit_opt ::=",
- /* 188 */ "slimit_opt ::= SLIMIT signed",
- /* 189 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
- /* 190 */ "slimit_opt ::= SLIMIT signed COMMA signed",
- /* 191 */ "where_opt ::=",
- /* 192 */ "where_opt ::= WHERE expr",
- /* 193 */ "expr ::= LP expr RP",
- /* 194 */ "expr ::= ID",
- /* 195 */ "expr ::= ID DOT ID",
- /* 196 */ "expr ::= ID DOT STAR",
- /* 197 */ "expr ::= INTEGER",
- /* 198 */ "expr ::= MINUS INTEGER",
- /* 199 */ "expr ::= PLUS INTEGER",
- /* 200 */ "expr ::= FLOAT",
- /* 201 */ "expr ::= MINUS FLOAT",
- /* 202 */ "expr ::= PLUS FLOAT",
- /* 203 */ "expr ::= STRING",
- /* 204 */ "expr ::= NOW",
- /* 205 */ "expr ::= VARIABLE",
- /* 206 */ "expr ::= BOOL",
- /* 207 */ "expr ::= ID LP exprlist RP",
- /* 208 */ "expr ::= ID LP STAR RP",
- /* 209 */ "expr ::= expr IS NULL",
- /* 210 */ "expr ::= expr IS NOT NULL",
- /* 211 */ "expr ::= expr LT expr",
- /* 212 */ "expr ::= expr GT expr",
- /* 213 */ "expr ::= expr LE expr",
- /* 214 */ "expr ::= expr GE expr",
- /* 215 */ "expr ::= expr NE expr",
- /* 216 */ "expr ::= expr EQ expr",
- /* 217 */ "expr ::= expr AND expr",
- /* 218 */ "expr ::= expr OR expr",
- /* 219 */ "expr ::= expr PLUS expr",
- /* 220 */ "expr ::= expr MINUS expr",
- /* 221 */ "expr ::= expr STAR expr",
- /* 222 */ "expr ::= expr SLASH expr",
- /* 223 */ "expr ::= expr REM expr",
- /* 224 */ "expr ::= expr LIKE expr",
- /* 225 */ "expr ::= expr IN LP exprlist RP",
- /* 226 */ "exprlist ::= exprlist COMMA expritem",
- /* 227 */ "exprlist ::= expritem",
- /* 228 */ "expritem ::= expr",
- /* 229 */ "expritem ::=",
- /* 230 */ "cmd ::= RESET QUERY CACHE",
- /* 231 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
- /* 232 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
- /* 233 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
- /* 234 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
- /* 235 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
- /* 236 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
- /* 237 */ "cmd ::= KILL CONNECTION INTEGER",
- /* 238 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
- /* 239 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
+ /* 28 */ "cmd ::= DROP STABLE ifexists ids cpxName",
+ /* 29 */ "cmd ::= DROP DATABASE ifexists ids",
+ /* 30 */ "cmd ::= DROP DNODE ids",
+ /* 31 */ "cmd ::= DROP USER ids",
+ /* 32 */ "cmd ::= DROP ACCOUNT ids",
+ /* 33 */ "cmd ::= USE ids",
+ /* 34 */ "cmd ::= DESCRIBE ids cpxName",
+ /* 35 */ "cmd ::= ALTER USER ids PASS ids",
+ /* 36 */ "cmd ::= ALTER USER ids PRIVILEGE ids",
+ /* 37 */ "cmd ::= ALTER DNODE ids ids",
+ /* 38 */ "cmd ::= ALTER DNODE ids ids ids",
+ /* 39 */ "cmd ::= ALTER LOCAL ids",
+ /* 40 */ "cmd ::= ALTER LOCAL ids ids",
+ /* 41 */ "cmd ::= ALTER DATABASE ids alter_db_optr",
+ /* 42 */ "cmd ::= ALTER ACCOUNT ids acct_optr",
+ /* 43 */ "cmd ::= ALTER ACCOUNT ids PASS ids acct_optr",
+ /* 44 */ "ids ::= ID",
+ /* 45 */ "ids ::= STRING",
+ /* 46 */ "ifexists ::= IF EXISTS",
+ /* 47 */ "ifexists ::=",
+ /* 48 */ "ifnotexists ::= IF NOT EXISTS",
+ /* 49 */ "ifnotexists ::=",
+ /* 50 */ "cmd ::= CREATE DNODE ids",
+ /* 51 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr",
+ /* 52 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr",
+ /* 53 */ "cmd ::= CREATE USER ids PASS ids",
+ /* 54 */ "pps ::=",
+ /* 55 */ "pps ::= PPS INTEGER",
+ /* 56 */ "tseries ::=",
+ /* 57 */ "tseries ::= TSERIES INTEGER",
+ /* 58 */ "dbs ::=",
+ /* 59 */ "dbs ::= DBS INTEGER",
+ /* 60 */ "streams ::=",
+ /* 61 */ "streams ::= STREAMS INTEGER",
+ /* 62 */ "storage ::=",
+ /* 63 */ "storage ::= STORAGE INTEGER",
+ /* 64 */ "qtime ::=",
+ /* 65 */ "qtime ::= QTIME INTEGER",
+ /* 66 */ "users ::=",
+ /* 67 */ "users ::= USERS INTEGER",
+ /* 68 */ "conns ::=",
+ /* 69 */ "conns ::= CONNS INTEGER",
+ /* 70 */ "state ::=",
+ /* 71 */ "state ::= STATE ids",
+ /* 72 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state",
+ /* 73 */ "keep ::= KEEP tagitemlist",
+ /* 74 */ "cache ::= CACHE INTEGER",
+ /* 75 */ "replica ::= REPLICA INTEGER",
+ /* 76 */ "quorum ::= QUORUM INTEGER",
+ /* 77 */ "days ::= DAYS INTEGER",
+ /* 78 */ "minrows ::= MINROWS INTEGER",
+ /* 79 */ "maxrows ::= MAXROWS INTEGER",
+ /* 80 */ "blocks ::= BLOCKS INTEGER",
+ /* 81 */ "ctime ::= CTIME INTEGER",
+ /* 82 */ "wal ::= WAL INTEGER",
+ /* 83 */ "fsync ::= FSYNC INTEGER",
+ /* 84 */ "comp ::= COMP INTEGER",
+ /* 85 */ "prec ::= PRECISION STRING",
+ /* 86 */ "update ::= UPDATE INTEGER",
+ /* 87 */ "cachelast ::= CACHELAST INTEGER",
+ /* 88 */ "db_optr ::=",
+ /* 89 */ "db_optr ::= db_optr cache",
+ /* 90 */ "db_optr ::= db_optr replica",
+ /* 91 */ "db_optr ::= db_optr quorum",
+ /* 92 */ "db_optr ::= db_optr days",
+ /* 93 */ "db_optr ::= db_optr minrows",
+ /* 94 */ "db_optr ::= db_optr maxrows",
+ /* 95 */ "db_optr ::= db_optr blocks",
+ /* 96 */ "db_optr ::= db_optr ctime",
+ /* 97 */ "db_optr ::= db_optr wal",
+ /* 98 */ "db_optr ::= db_optr fsync",
+ /* 99 */ "db_optr ::= db_optr comp",
+ /* 100 */ "db_optr ::= db_optr prec",
+ /* 101 */ "db_optr ::= db_optr keep",
+ /* 102 */ "db_optr ::= db_optr update",
+ /* 103 */ "db_optr ::= db_optr cachelast",
+ /* 104 */ "alter_db_optr ::=",
+ /* 105 */ "alter_db_optr ::= alter_db_optr replica",
+ /* 106 */ "alter_db_optr ::= alter_db_optr quorum",
+ /* 107 */ "alter_db_optr ::= alter_db_optr keep",
+ /* 108 */ "alter_db_optr ::= alter_db_optr blocks",
+ /* 109 */ "alter_db_optr ::= alter_db_optr comp",
+ /* 110 */ "alter_db_optr ::= alter_db_optr wal",
+ /* 111 */ "alter_db_optr ::= alter_db_optr fsync",
+ /* 112 */ "alter_db_optr ::= alter_db_optr update",
+ /* 113 */ "alter_db_optr ::= alter_db_optr cachelast",
+ /* 114 */ "typename ::= ids",
+ /* 115 */ "typename ::= ids LP signed RP",
+ /* 116 */ "typename ::= ids UNSIGNED",
+ /* 117 */ "signed ::= INTEGER",
+ /* 118 */ "signed ::= PLUS INTEGER",
+ /* 119 */ "signed ::= MINUS INTEGER",
+ /* 120 */ "cmd ::= CREATE TABLE create_table_args",
+ /* 121 */ "cmd ::= CREATE TABLE create_stable_args",
+ /* 122 */ "cmd ::= CREATE STABLE create_stable_args",
+ /* 123 */ "cmd ::= CREATE TABLE create_table_list",
+ /* 124 */ "create_table_list ::= create_from_stable",
+ /* 125 */ "create_table_list ::= create_table_list create_from_stable",
+ /* 126 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP",
+ /* 127 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP",
+ /* 128 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP",
+ /* 129 */ "create_table_args ::= ifnotexists ids cpxName AS select",
+ /* 130 */ "columnlist ::= columnlist COMMA column",
+ /* 131 */ "columnlist ::= column",
+ /* 132 */ "column ::= ids typename",
+ /* 133 */ "tagitemlist ::= tagitemlist COMMA tagitem",
+ /* 134 */ "tagitemlist ::= tagitem",
+ /* 135 */ "tagitem ::= INTEGER",
+ /* 136 */ "tagitem ::= FLOAT",
+ /* 137 */ "tagitem ::= STRING",
+ /* 138 */ "tagitem ::= BOOL",
+ /* 139 */ "tagitem ::= NULL",
+ /* 140 */ "tagitem ::= MINUS INTEGER",
+ /* 141 */ "tagitem ::= MINUS FLOAT",
+ /* 142 */ "tagitem ::= PLUS INTEGER",
+ /* 143 */ "tagitem ::= PLUS FLOAT",
+ /* 144 */ "select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt",
+ /* 145 */ "union ::= select",
+ /* 146 */ "union ::= LP union RP",
+ /* 147 */ "union ::= union UNION ALL select",
+ /* 148 */ "union ::= union UNION ALL LP select RP",
+ /* 149 */ "cmd ::= union",
+ /* 150 */ "select ::= SELECT selcollist",
+ /* 151 */ "sclp ::= selcollist COMMA",
+ /* 152 */ "sclp ::=",
+ /* 153 */ "selcollist ::= sclp expr as",
+ /* 154 */ "selcollist ::= sclp STAR",
+ /* 155 */ "as ::= AS ids",
+ /* 156 */ "as ::= ids",
+ /* 157 */ "as ::=",
+ /* 158 */ "from ::= FROM tablelist",
+ /* 159 */ "tablelist ::= ids cpxName",
+ /* 160 */ "tablelist ::= ids cpxName ids",
+ /* 161 */ "tablelist ::= tablelist COMMA ids cpxName",
+ /* 162 */ "tablelist ::= tablelist COMMA ids cpxName ids",
+ /* 163 */ "tmvar ::= VARIABLE",
+ /* 164 */ "interval_opt ::= INTERVAL LP tmvar RP",
+ /* 165 */ "interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP",
+ /* 166 */ "interval_opt ::=",
+ /* 167 */ "fill_opt ::=",
+ /* 168 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
+ /* 169 */ "fill_opt ::= FILL LP ID RP",
+ /* 170 */ "sliding_opt ::= SLIDING LP tmvar RP",
+ /* 171 */ "sliding_opt ::=",
+ /* 172 */ "orderby_opt ::=",
+ /* 173 */ "orderby_opt ::= ORDER BY sortlist",
+ /* 174 */ "sortlist ::= sortlist COMMA item sortorder",
+ /* 175 */ "sortlist ::= item sortorder",
+ /* 176 */ "item ::= ids cpxName",
+ /* 177 */ "sortorder ::= ASC",
+ /* 178 */ "sortorder ::= DESC",
+ /* 179 */ "sortorder ::=",
+ /* 180 */ "groupby_opt ::=",
+ /* 181 */ "groupby_opt ::= GROUP BY grouplist",
+ /* 182 */ "grouplist ::= grouplist COMMA item",
+ /* 183 */ "grouplist ::= item",
+ /* 184 */ "having_opt ::=",
+ /* 185 */ "having_opt ::= HAVING expr",
+ /* 186 */ "limit_opt ::=",
+ /* 187 */ "limit_opt ::= LIMIT signed",
+ /* 188 */ "limit_opt ::= LIMIT signed OFFSET signed",
+ /* 189 */ "limit_opt ::= LIMIT signed COMMA signed",
+ /* 190 */ "slimit_opt ::=",
+ /* 191 */ "slimit_opt ::= SLIMIT signed",
+ /* 192 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
+ /* 193 */ "slimit_opt ::= SLIMIT signed COMMA signed",
+ /* 194 */ "where_opt ::=",
+ /* 195 */ "where_opt ::= WHERE expr",
+ /* 196 */ "expr ::= LP expr RP",
+ /* 197 */ "expr ::= ID",
+ /* 198 */ "expr ::= ID DOT ID",
+ /* 199 */ "expr ::= ID DOT STAR",
+ /* 200 */ "expr ::= INTEGER",
+ /* 201 */ "expr ::= MINUS INTEGER",
+ /* 202 */ "expr ::= PLUS INTEGER",
+ /* 203 */ "expr ::= FLOAT",
+ /* 204 */ "expr ::= MINUS FLOAT",
+ /* 205 */ "expr ::= PLUS FLOAT",
+ /* 206 */ "expr ::= STRING",
+ /* 207 */ "expr ::= NOW",
+ /* 208 */ "expr ::= VARIABLE",
+ /* 209 */ "expr ::= BOOL",
+ /* 210 */ "expr ::= ID LP exprlist RP",
+ /* 211 */ "expr ::= ID LP STAR RP",
+ /* 212 */ "expr ::= expr IS NULL",
+ /* 213 */ "expr ::= expr IS NOT NULL",
+ /* 214 */ "expr ::= expr LT expr",
+ /* 215 */ "expr ::= expr GT expr",
+ /* 216 */ "expr ::= expr LE expr",
+ /* 217 */ "expr ::= expr GE expr",
+ /* 218 */ "expr ::= expr NE expr",
+ /* 219 */ "expr ::= expr EQ expr",
+ /* 220 */ "expr ::= expr AND expr",
+ /* 221 */ "expr ::= expr OR expr",
+ /* 222 */ "expr ::= expr PLUS expr",
+ /* 223 */ "expr ::= expr MINUS expr",
+ /* 224 */ "expr ::= expr STAR expr",
+ /* 225 */ "expr ::= expr SLASH expr",
+ /* 226 */ "expr ::= expr REM expr",
+ /* 227 */ "expr ::= expr LIKE expr",
+ /* 228 */ "expr ::= expr IN LP exprlist RP",
+ /* 229 */ "exprlist ::= exprlist COMMA expritem",
+ /* 230 */ "exprlist ::= expritem",
+ /* 231 */ "expritem ::= expr",
+ /* 232 */ "expritem ::=",
+ /* 233 */ "cmd ::= RESET QUERY CACHE",
+ /* 234 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
+ /* 235 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
+ /* 236 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
+ /* 237 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
+ /* 238 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
+ /* 239 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
+ /* 240 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
+ /* 241 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
+ /* 242 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
+ /* 243 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
+ /* 244 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
+ /* 245 */ "cmd ::= KILL CONNECTION INTEGER",
+ /* 246 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
+ /* 247 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
};
#endif /* NDEBUG */
@@ -1312,28 +1347,29 @@ static int yyGrowStack(yyParser *p){
/* Initialize a new parser that has already been allocated.
*/
-void ParseInit(void *yypParser){
- yyParser *pParser = (yyParser*)yypParser;
+void ParseInit(void *yypRawParser ParseCTX_PDECL){
+ yyParser *yypParser = (yyParser*)yypRawParser;
+ ParseCTX_STORE
#ifdef YYTRACKMAXSTACKDEPTH
- pParser->yyhwm = 0;
+ yypParser->yyhwm = 0;
#endif
#if YYSTACKDEPTH<=0
- pParser->yytos = NULL;
- pParser->yystack = NULL;
- pParser->yystksz = 0;
- if( yyGrowStack(pParser) ){
- pParser->yystack = &pParser->yystk0;
- pParser->yystksz = 1;
+ yypParser->yytos = NULL;
+ yypParser->yystack = NULL;
+ yypParser->yystksz = 0;
+ if( yyGrowStack(yypParser) ){
+ yypParser->yystack = &yypParser->yystk0;
+ yypParser->yystksz = 1;
}
#endif
#ifndef YYNOERRORRECOVERY
- pParser->yyerrcnt = -1;
+ yypParser->yyerrcnt = -1;
#endif
- pParser->yytos = pParser->yystack;
- pParser->yystack[0].stateno = 0;
- pParser->yystack[0].major = 0;
+ yypParser->yytos = yypParser->yystack;
+ yypParser->yystack[0].stateno = 0;
+ yypParser->yystack[0].major = 0;
#if YYSTACKDEPTH>0
- pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
+ yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
#endif
}
@@ -1350,11 +1386,14 @@ void ParseInit(void *yypParser){
** A pointer to a parser. This pointer is used in subsequent calls
** to Parse and ParseFree.
*/
-void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){
- yyParser *pParser;
- pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
- if( pParser ) ParseInit(pParser);
- return pParser;
+void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){
+ yyParser *yypParser;
+ yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
+ if( yypParser ){
+ ParseCTX_STORE
+ ParseInit(yypParser ParseCTX_PARAM);
+ }
+ return (void*)yypParser;
}
#endif /* Parse_ENGINEALWAYSONSTACK */
@@ -1371,7 +1410,8 @@ static void yy_destructor(
YYCODETYPE yymajor, /* Type code for object to destroy */
YYMINORTYPE *yypminor /* The object to be destroyed */
){
- ParseARG_FETCH;
+ ParseARG_FETCH
+ ParseCTX_FETCH
switch( yymajor ){
/* Here is inserted the actions which take place when a
** terminal or non-terminal is destroyed. This can happen
@@ -1384,8 +1424,8 @@ static void yy_destructor(
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
- case 229: /* keep */
- case 230: /* tagitemlist */
+ case 228: /* keep */
+ case 229: /* tagitemlist */
case 250: /* columnlist */
case 258: /* fill_opt */
case 260: /* groupby_opt */
@@ -1540,13 +1580,12 @@ int ParseCoverage(FILE *out){
** Find the appropriate action for a parser given the terminal
** look-ahead token iLookAhead.
*/
-static unsigned int yy_find_shift_action(
- yyParser *pParser, /* The parser */
- YYCODETYPE iLookAhead /* The look-ahead token */
+static YYACTIONTYPE yy_find_shift_action(
+ YYCODETYPE iLookAhead, /* The look-ahead token */
+ YYACTIONTYPE stateno /* Current state number */
){
int i;
- int stateno = pParser->yytos->stateno;
-
+
if( stateno>YY_MAX_SHIFT ) return stateno;
assert( stateno <= YY_SHIFT_COUNT );
#if defined(YYCOVERAGE)
@@ -1554,15 +1593,19 @@ static unsigned int yy_find_shift_action(
#endif
do{
i = yy_shift_ofst[stateno];
- assert( i>=0 && i+YYNTOKEN<=sizeof(yy_lookahead)/sizeof(yy_lookahead[0]) );
+ assert( i>=0 );
+ assert( i<=YY_ACTTAB_COUNT );
+ assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD );
assert( iLookAhead!=YYNOCODE );
assert( iLookAhead < YYNTOKEN );
i += iLookAhead;
+ assert( i<(int)YY_NLOOKAHEAD );
if( yy_lookahead[i]!=iLookAhead ){
#ifdef YYFALLBACK
YYCODETYPE iFallback; /* Fallback token */
- if( iLookAhead %s\n",
@@ -1577,15 +1620,8 @@ static unsigned int yy_find_shift_action(
#ifdef YYWILDCARD
{
int j = i - iLookAhead + YYWILDCARD;
- if(
-#if YY_SHIFT_MIN+YYWILDCARD<0
- j>=0 &&
-#endif
-#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
- j0
- ){
+ assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) );
+ if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){
#ifndef NDEBUG
if( yyTraceFILE ){
fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
@@ -1599,6 +1635,7 @@ static unsigned int yy_find_shift_action(
#endif /* YYWILDCARD */
return yy_default[stateno];
}else{
+ assert( i>=0 && iyytos;
- yytos->stateno = (YYACTIONTYPE)yyNewState;
- yytos->major = (YYCODETYPE)yyMajor;
+ yytos->stateno = yyNewState;
+ yytos->major = yyMajor;
yytos->minor.yy0 = yyMinor;
yyTraceShift(yypParser, yyNewState, "Shift");
}
-/* The following table contains information about every rule that
-** is used during the reduce.
-*/
-static const struct {
- YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
- signed char nrhs; /* Negative of the number of RHS symbols in the rule */
-} yyRuleInfo[] = {
- { 210, -1 }, /* (0) program ::= cmd */
- { 211, -2 }, /* (1) cmd ::= SHOW DATABASES */
- { 211, -2 }, /* (2) cmd ::= SHOW MNODES */
- { 211, -2 }, /* (3) cmd ::= SHOW DNODES */
- { 211, -2 }, /* (4) cmd ::= SHOW ACCOUNTS */
- { 211, -2 }, /* (5) cmd ::= SHOW USERS */
- { 211, -2 }, /* (6) cmd ::= SHOW MODULES */
- { 211, -2 }, /* (7) cmd ::= SHOW QUERIES */
- { 211, -2 }, /* (8) cmd ::= SHOW CONNECTIONS */
- { 211, -2 }, /* (9) cmd ::= SHOW STREAMS */
- { 211, -2 }, /* (10) cmd ::= SHOW VARIABLES */
- { 211, -2 }, /* (11) cmd ::= SHOW SCORES */
- { 211, -2 }, /* (12) cmd ::= SHOW GRANTS */
- { 211, -2 }, /* (13) cmd ::= SHOW VNODES */
- { 211, -3 }, /* (14) cmd ::= SHOW VNODES IPTOKEN */
- { 212, 0 }, /* (15) dbPrefix ::= */
- { 212, -2 }, /* (16) dbPrefix ::= ids DOT */
- { 214, 0 }, /* (17) cpxName ::= */
- { 214, -2 }, /* (18) cpxName ::= DOT ids */
- { 211, -5 }, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */
- { 211, -4 }, /* (20) cmd ::= SHOW CREATE DATABASE ids */
- { 211, -3 }, /* (21) cmd ::= SHOW dbPrefix TABLES */
- { 211, -5 }, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */
- { 211, -3 }, /* (23) cmd ::= SHOW dbPrefix STABLES */
- { 211, -5 }, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */
- { 211, -3 }, /* (25) cmd ::= SHOW dbPrefix VGROUPS */
- { 211, -4 }, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */
- { 211, -5 }, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */
- { 211, -4 }, /* (28) cmd ::= DROP DATABASE ifexists ids */
- { 211, -3 }, /* (29) cmd ::= DROP DNODE ids */
- { 211, -3 }, /* (30) cmd ::= DROP USER ids */
- { 211, -3 }, /* (31) cmd ::= DROP ACCOUNT ids */
- { 211, -2 }, /* (32) cmd ::= USE ids */
- { 211, -3 }, /* (33) cmd ::= DESCRIBE ids cpxName */
- { 211, -5 }, /* (34) cmd ::= ALTER USER ids PASS ids */
- { 211, -5 }, /* (35) cmd ::= ALTER USER ids PRIVILEGE ids */
- { 211, -4 }, /* (36) cmd ::= ALTER DNODE ids ids */
- { 211, -5 }, /* (37) cmd ::= ALTER DNODE ids ids ids */
- { 211, -3 }, /* (38) cmd ::= ALTER LOCAL ids */
- { 211, -4 }, /* (39) cmd ::= ALTER LOCAL ids ids */
- { 211, -4 }, /* (40) cmd ::= ALTER DATABASE ids alter_db_optr */
- { 211, -4 }, /* (41) cmd ::= ALTER ACCOUNT ids acct_optr */
- { 211, -6 }, /* (42) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
- { 213, -1 }, /* (43) ids ::= ID */
- { 213, -1 }, /* (44) ids ::= STRING */
- { 215, -2 }, /* (45) ifexists ::= IF EXISTS */
- { 215, 0 }, /* (46) ifexists ::= */
- { 218, -3 }, /* (47) ifnotexists ::= IF NOT EXISTS */
- { 218, 0 }, /* (48) ifnotexists ::= */
- { 211, -3 }, /* (49) cmd ::= CREATE DNODE ids */
- { 211, -6 }, /* (50) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
- { 211, -5 }, /* (51) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
- { 211, -5 }, /* (52) cmd ::= CREATE USER ids PASS ids */
- { 220, 0 }, /* (53) pps ::= */
- { 220, -2 }, /* (54) pps ::= PPS INTEGER */
- { 221, 0 }, /* (55) tseries ::= */
- { 221, -2 }, /* (56) tseries ::= TSERIES INTEGER */
- { 222, 0 }, /* (57) dbs ::= */
- { 222, -2 }, /* (58) dbs ::= DBS INTEGER */
- { 223, 0 }, /* (59) streams ::= */
- { 223, -2 }, /* (60) streams ::= STREAMS INTEGER */
- { 224, 0 }, /* (61) storage ::= */
- { 224, -2 }, /* (62) storage ::= STORAGE INTEGER */
- { 225, 0 }, /* (63) qtime ::= */
- { 225, -2 }, /* (64) qtime ::= QTIME INTEGER */
- { 226, 0 }, /* (65) users ::= */
- { 226, -2 }, /* (66) users ::= USERS INTEGER */
- { 227, 0 }, /* (67) conns ::= */
- { 227, -2 }, /* (68) conns ::= CONNS INTEGER */
- { 228, 0 }, /* (69) state ::= */
- { 228, -2 }, /* (70) state ::= STATE ids */
- { 217, -9 }, /* (71) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
- { 229, -2 }, /* (72) keep ::= KEEP tagitemlist */
- { 231, -2 }, /* (73) cache ::= CACHE INTEGER */
- { 232, -2 }, /* (74) replica ::= REPLICA INTEGER */
- { 233, -2 }, /* (75) quorum ::= QUORUM INTEGER */
- { 234, -2 }, /* (76) days ::= DAYS INTEGER */
- { 235, -2 }, /* (77) minrows ::= MINROWS INTEGER */
- { 236, -2 }, /* (78) maxrows ::= MAXROWS INTEGER */
- { 237, -2 }, /* (79) blocks ::= BLOCKS INTEGER */
- { 238, -2 }, /* (80) ctime ::= CTIME INTEGER */
- { 239, -2 }, /* (81) wal ::= WAL INTEGER */
- { 240, -2 }, /* (82) fsync ::= FSYNC INTEGER */
- { 241, -2 }, /* (83) comp ::= COMP INTEGER */
- { 242, -2 }, /* (84) prec ::= PRECISION STRING */
- { 243, -2 }, /* (85) update ::= UPDATE INTEGER */
- { 244, -2 }, /* (86) cachelast ::= CACHELAST INTEGER */
- { 219, 0 }, /* (87) db_optr ::= */
- { 219, -2 }, /* (88) db_optr ::= db_optr cache */
- { 219, -2 }, /* (89) db_optr ::= db_optr replica */
- { 219, -2 }, /* (90) db_optr ::= db_optr quorum */
- { 219, -2 }, /* (91) db_optr ::= db_optr days */
- { 219, -2 }, /* (92) db_optr ::= db_optr minrows */
- { 219, -2 }, /* (93) db_optr ::= db_optr maxrows */
- { 219, -2 }, /* (94) db_optr ::= db_optr blocks */
- { 219, -2 }, /* (95) db_optr ::= db_optr ctime */
- { 219, -2 }, /* (96) db_optr ::= db_optr wal */
- { 219, -2 }, /* (97) db_optr ::= db_optr fsync */
- { 219, -2 }, /* (98) db_optr ::= db_optr comp */
- { 219, -2 }, /* (99) db_optr ::= db_optr prec */
- { 219, -2 }, /* (100) db_optr ::= db_optr keep */
- { 219, -2 }, /* (101) db_optr ::= db_optr update */
- { 219, -2 }, /* (102) db_optr ::= db_optr cachelast */
- { 216, 0 }, /* (103) alter_db_optr ::= */
- { 216, -2 }, /* (104) alter_db_optr ::= alter_db_optr replica */
- { 216, -2 }, /* (105) alter_db_optr ::= alter_db_optr quorum */
- { 216, -2 }, /* (106) alter_db_optr ::= alter_db_optr keep */
- { 216, -2 }, /* (107) alter_db_optr ::= alter_db_optr blocks */
- { 216, -2 }, /* (108) alter_db_optr ::= alter_db_optr comp */
- { 216, -2 }, /* (109) alter_db_optr ::= alter_db_optr wal */
- { 216, -2 }, /* (110) alter_db_optr ::= alter_db_optr fsync */
- { 216, -2 }, /* (111) alter_db_optr ::= alter_db_optr update */
- { 216, -2 }, /* (112) alter_db_optr ::= alter_db_optr cachelast */
- { 245, -1 }, /* (113) typename ::= ids */
- { 245, -4 }, /* (114) typename ::= ids LP signed RP */
- { 245, -2 }, /* (115) typename ::= ids UNSIGNED */
- { 246, -1 }, /* (116) signed ::= INTEGER */
- { 246, -2 }, /* (117) signed ::= PLUS INTEGER */
- { 246, -2 }, /* (118) signed ::= MINUS INTEGER */
- { 211, -3 }, /* (119) cmd ::= CREATE TABLE create_table_args */
- { 211, -3 }, /* (120) cmd ::= CREATE TABLE create_table_list */
- { 248, -1 }, /* (121) create_table_list ::= create_from_stable */
- { 248, -2 }, /* (122) create_table_list ::= create_table_list create_from_stable */
- { 247, -6 }, /* (123) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
- { 247, -10 }, /* (124) create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
- { 249, -10 }, /* (125) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
- { 247, -5 }, /* (126) create_table_args ::= ifnotexists ids cpxName AS select */
- { 250, -3 }, /* (127) columnlist ::= columnlist COMMA column */
- { 250, -1 }, /* (128) columnlist ::= column */
- { 252, -2 }, /* (129) column ::= ids typename */
- { 230, -3 }, /* (130) tagitemlist ::= tagitemlist COMMA tagitem */
- { 230, -1 }, /* (131) tagitemlist ::= tagitem */
- { 253, -1 }, /* (132) tagitem ::= INTEGER */
- { 253, -1 }, /* (133) tagitem ::= FLOAT */
- { 253, -1 }, /* (134) tagitem ::= STRING */
- { 253, -1 }, /* (135) tagitem ::= BOOL */
- { 253, -1 }, /* (136) tagitem ::= NULL */
- { 253, -2 }, /* (137) tagitem ::= MINUS INTEGER */
- { 253, -2 }, /* (138) tagitem ::= MINUS FLOAT */
- { 253, -2 }, /* (139) tagitem ::= PLUS INTEGER */
- { 253, -2 }, /* (140) tagitem ::= PLUS FLOAT */
- { 251, -12 }, /* (141) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
- { 265, -1 }, /* (142) union ::= select */
- { 265, -3 }, /* (143) union ::= LP union RP */
- { 265, -4 }, /* (144) union ::= union UNION ALL select */
- { 265, -6 }, /* (145) union ::= union UNION ALL LP select RP */
- { 211, -1 }, /* (146) cmd ::= union */
- { 251, -2 }, /* (147) select ::= SELECT selcollist */
- { 266, -2 }, /* (148) sclp ::= selcollist COMMA */
- { 266, 0 }, /* (149) sclp ::= */
- { 254, -3 }, /* (150) selcollist ::= sclp expr as */
- { 254, -2 }, /* (151) selcollist ::= sclp STAR */
- { 268, -2 }, /* (152) as ::= AS ids */
- { 268, -1 }, /* (153) as ::= ids */
- { 268, 0 }, /* (154) as ::= */
- { 255, -2 }, /* (155) from ::= FROM tablelist */
- { 269, -2 }, /* (156) tablelist ::= ids cpxName */
- { 269, -3 }, /* (157) tablelist ::= ids cpxName ids */
- { 269, -4 }, /* (158) tablelist ::= tablelist COMMA ids cpxName */
- { 269, -5 }, /* (159) tablelist ::= tablelist COMMA ids cpxName ids */
- { 270, -1 }, /* (160) tmvar ::= VARIABLE */
- { 257, -4 }, /* (161) interval_opt ::= INTERVAL LP tmvar RP */
- { 257, -6 }, /* (162) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
- { 257, 0 }, /* (163) interval_opt ::= */
- { 258, 0 }, /* (164) fill_opt ::= */
- { 258, -6 }, /* (165) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
- { 258, -4 }, /* (166) fill_opt ::= FILL LP ID RP */
- { 259, -4 }, /* (167) sliding_opt ::= SLIDING LP tmvar RP */
- { 259, 0 }, /* (168) sliding_opt ::= */
- { 261, 0 }, /* (169) orderby_opt ::= */
- { 261, -3 }, /* (170) orderby_opt ::= ORDER BY sortlist */
- { 271, -4 }, /* (171) sortlist ::= sortlist COMMA item sortorder */
- { 271, -2 }, /* (172) sortlist ::= item sortorder */
- { 273, -2 }, /* (173) item ::= ids cpxName */
- { 274, -1 }, /* (174) sortorder ::= ASC */
- { 274, -1 }, /* (175) sortorder ::= DESC */
- { 274, 0 }, /* (176) sortorder ::= */
- { 260, 0 }, /* (177) groupby_opt ::= */
- { 260, -3 }, /* (178) groupby_opt ::= GROUP BY grouplist */
- { 275, -3 }, /* (179) grouplist ::= grouplist COMMA item */
- { 275, -1 }, /* (180) grouplist ::= item */
- { 262, 0 }, /* (181) having_opt ::= */
- { 262, -2 }, /* (182) having_opt ::= HAVING expr */
- { 264, 0 }, /* (183) limit_opt ::= */
- { 264, -2 }, /* (184) limit_opt ::= LIMIT signed */
- { 264, -4 }, /* (185) limit_opt ::= LIMIT signed OFFSET signed */
- { 264, -4 }, /* (186) limit_opt ::= LIMIT signed COMMA signed */
- { 263, 0 }, /* (187) slimit_opt ::= */
- { 263, -2 }, /* (188) slimit_opt ::= SLIMIT signed */
- { 263, -4 }, /* (189) slimit_opt ::= SLIMIT signed SOFFSET signed */
- { 263, -4 }, /* (190) slimit_opt ::= SLIMIT signed COMMA signed */
- { 256, 0 }, /* (191) where_opt ::= */
- { 256, -2 }, /* (192) where_opt ::= WHERE expr */
- { 267, -3 }, /* (193) expr ::= LP expr RP */
- { 267, -1 }, /* (194) expr ::= ID */
- { 267, -3 }, /* (195) expr ::= ID DOT ID */
- { 267, -3 }, /* (196) expr ::= ID DOT STAR */
- { 267, -1 }, /* (197) expr ::= INTEGER */
- { 267, -2 }, /* (198) expr ::= MINUS INTEGER */
- { 267, -2 }, /* (199) expr ::= PLUS INTEGER */
- { 267, -1 }, /* (200) expr ::= FLOAT */
- { 267, -2 }, /* (201) expr ::= MINUS FLOAT */
- { 267, -2 }, /* (202) expr ::= PLUS FLOAT */
- { 267, -1 }, /* (203) expr ::= STRING */
- { 267, -1 }, /* (204) expr ::= NOW */
- { 267, -1 }, /* (205) expr ::= VARIABLE */
- { 267, -1 }, /* (206) expr ::= BOOL */
- { 267, -4 }, /* (207) expr ::= ID LP exprlist RP */
- { 267, -4 }, /* (208) expr ::= ID LP STAR RP */
- { 267, -3 }, /* (209) expr ::= expr IS NULL */
- { 267, -4 }, /* (210) expr ::= expr IS NOT NULL */
- { 267, -3 }, /* (211) expr ::= expr LT expr */
- { 267, -3 }, /* (212) expr ::= expr GT expr */
- { 267, -3 }, /* (213) expr ::= expr LE expr */
- { 267, -3 }, /* (214) expr ::= expr GE expr */
- { 267, -3 }, /* (215) expr ::= expr NE expr */
- { 267, -3 }, /* (216) expr ::= expr EQ expr */
- { 267, -3 }, /* (217) expr ::= expr AND expr */
- { 267, -3 }, /* (218) expr ::= expr OR expr */
- { 267, -3 }, /* (219) expr ::= expr PLUS expr */
- { 267, -3 }, /* (220) expr ::= expr MINUS expr */
- { 267, -3 }, /* (221) expr ::= expr STAR expr */
- { 267, -3 }, /* (222) expr ::= expr SLASH expr */
- { 267, -3 }, /* (223) expr ::= expr REM expr */
- { 267, -3 }, /* (224) expr ::= expr LIKE expr */
- { 267, -5 }, /* (225) expr ::= expr IN LP exprlist RP */
- { 276, -3 }, /* (226) exprlist ::= exprlist COMMA expritem */
- { 276, -1 }, /* (227) exprlist ::= expritem */
- { 277, -1 }, /* (228) expritem ::= expr */
- { 277, 0 }, /* (229) expritem ::= */
- { 211, -3 }, /* (230) cmd ::= RESET QUERY CACHE */
- { 211, -7 }, /* (231) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
- { 211, -7 }, /* (232) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
- { 211, -7 }, /* (233) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
- { 211, -7 }, /* (234) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
- { 211, -8 }, /* (235) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
- { 211, -9 }, /* (236) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
- { 211, -3 }, /* (237) cmd ::= KILL CONNECTION INTEGER */
- { 211, -5 }, /* (238) cmd ::= KILL STREAM INTEGER COLON INTEGER */
- { 211, -5 }, /* (239) cmd ::= KILL QUERY INTEGER COLON INTEGER */
+/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
+** of that rule */
+static const YYCODETYPE yyRuleInfoLhs[] = {
+ 209, /* (0) program ::= cmd */
+ 210, /* (1) cmd ::= SHOW DATABASES */
+ 210, /* (2) cmd ::= SHOW MNODES */
+ 210, /* (3) cmd ::= SHOW DNODES */
+ 210, /* (4) cmd ::= SHOW ACCOUNTS */
+ 210, /* (5) cmd ::= SHOW USERS */
+ 210, /* (6) cmd ::= SHOW MODULES */
+ 210, /* (7) cmd ::= SHOW QUERIES */
+ 210, /* (8) cmd ::= SHOW CONNECTIONS */
+ 210, /* (9) cmd ::= SHOW STREAMS */
+ 210, /* (10) cmd ::= SHOW VARIABLES */
+ 210, /* (11) cmd ::= SHOW SCORES */
+ 210, /* (12) cmd ::= SHOW GRANTS */
+ 210, /* (13) cmd ::= SHOW VNODES */
+ 210, /* (14) cmd ::= SHOW VNODES IPTOKEN */
+ 211, /* (15) dbPrefix ::= */
+ 211, /* (16) dbPrefix ::= ids DOT */
+ 213, /* (17) cpxName ::= */
+ 213, /* (18) cpxName ::= DOT ids */
+ 210, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */
+ 210, /* (20) cmd ::= SHOW CREATE DATABASE ids */
+ 210, /* (21) cmd ::= SHOW dbPrefix TABLES */
+ 210, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */
+ 210, /* (23) cmd ::= SHOW dbPrefix STABLES */
+ 210, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */
+ 210, /* (25) cmd ::= SHOW dbPrefix VGROUPS */
+ 210, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */
+ 210, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */
+ 210, /* (28) cmd ::= DROP STABLE ifexists ids cpxName */
+ 210, /* (29) cmd ::= DROP DATABASE ifexists ids */
+ 210, /* (30) cmd ::= DROP DNODE ids */
+ 210, /* (31) cmd ::= DROP USER ids */
+ 210, /* (32) cmd ::= DROP ACCOUNT ids */
+ 210, /* (33) cmd ::= USE ids */
+ 210, /* (34) cmd ::= DESCRIBE ids cpxName */
+ 210, /* (35) cmd ::= ALTER USER ids PASS ids */
+ 210, /* (36) cmd ::= ALTER USER ids PRIVILEGE ids */
+ 210, /* (37) cmd ::= ALTER DNODE ids ids */
+ 210, /* (38) cmd ::= ALTER DNODE ids ids ids */
+ 210, /* (39) cmd ::= ALTER LOCAL ids */
+ 210, /* (40) cmd ::= ALTER LOCAL ids ids */
+ 210, /* (41) cmd ::= ALTER DATABASE ids alter_db_optr */
+ 210, /* (42) cmd ::= ALTER ACCOUNT ids acct_optr */
+ 210, /* (43) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
+ 212, /* (44) ids ::= ID */
+ 212, /* (45) ids ::= STRING */
+ 214, /* (46) ifexists ::= IF EXISTS */
+ 214, /* (47) ifexists ::= */
+ 217, /* (48) ifnotexists ::= IF NOT EXISTS */
+ 217, /* (49) ifnotexists ::= */
+ 210, /* (50) cmd ::= CREATE DNODE ids */
+ 210, /* (51) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
+ 210, /* (52) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
+ 210, /* (53) cmd ::= CREATE USER ids PASS ids */
+ 219, /* (54) pps ::= */
+ 219, /* (55) pps ::= PPS INTEGER */
+ 220, /* (56) tseries ::= */
+ 220, /* (57) tseries ::= TSERIES INTEGER */
+ 221, /* (58) dbs ::= */
+ 221, /* (59) dbs ::= DBS INTEGER */
+ 222, /* (60) streams ::= */
+ 222, /* (61) streams ::= STREAMS INTEGER */
+ 223, /* (62) storage ::= */
+ 223, /* (63) storage ::= STORAGE INTEGER */
+ 224, /* (64) qtime ::= */
+ 224, /* (65) qtime ::= QTIME INTEGER */
+ 225, /* (66) users ::= */
+ 225, /* (67) users ::= USERS INTEGER */
+ 226, /* (68) conns ::= */
+ 226, /* (69) conns ::= CONNS INTEGER */
+ 227, /* (70) state ::= */
+ 227, /* (71) state ::= STATE ids */
+ 216, /* (72) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
+ 228, /* (73) keep ::= KEEP tagitemlist */
+ 230, /* (74) cache ::= CACHE INTEGER */
+ 231, /* (75) replica ::= REPLICA INTEGER */
+ 232, /* (76) quorum ::= QUORUM INTEGER */
+ 233, /* (77) days ::= DAYS INTEGER */
+ 234, /* (78) minrows ::= MINROWS INTEGER */
+ 235, /* (79) maxrows ::= MAXROWS INTEGER */
+ 236, /* (80) blocks ::= BLOCKS INTEGER */
+ 237, /* (81) ctime ::= CTIME INTEGER */
+ 238, /* (82) wal ::= WAL INTEGER */
+ 239, /* (83) fsync ::= FSYNC INTEGER */
+ 240, /* (84) comp ::= COMP INTEGER */
+ 241, /* (85) prec ::= PRECISION STRING */
+ 242, /* (86) update ::= UPDATE INTEGER */
+ 243, /* (87) cachelast ::= CACHELAST INTEGER */
+ 218, /* (88) db_optr ::= */
+ 218, /* (89) db_optr ::= db_optr cache */
+ 218, /* (90) db_optr ::= db_optr replica */
+ 218, /* (91) db_optr ::= db_optr quorum */
+ 218, /* (92) db_optr ::= db_optr days */
+ 218, /* (93) db_optr ::= db_optr minrows */
+ 218, /* (94) db_optr ::= db_optr maxrows */
+ 218, /* (95) db_optr ::= db_optr blocks */
+ 218, /* (96) db_optr ::= db_optr ctime */
+ 218, /* (97) db_optr ::= db_optr wal */
+ 218, /* (98) db_optr ::= db_optr fsync */
+ 218, /* (99) db_optr ::= db_optr comp */
+ 218, /* (100) db_optr ::= db_optr prec */
+ 218, /* (101) db_optr ::= db_optr keep */
+ 218, /* (102) db_optr ::= db_optr update */
+ 218, /* (103) db_optr ::= db_optr cachelast */
+ 215, /* (104) alter_db_optr ::= */
+ 215, /* (105) alter_db_optr ::= alter_db_optr replica */
+ 215, /* (106) alter_db_optr ::= alter_db_optr quorum */
+ 215, /* (107) alter_db_optr ::= alter_db_optr keep */
+ 215, /* (108) alter_db_optr ::= alter_db_optr blocks */
+ 215, /* (109) alter_db_optr ::= alter_db_optr comp */
+ 215, /* (110) alter_db_optr ::= alter_db_optr wal */
+ 215, /* (111) alter_db_optr ::= alter_db_optr fsync */
+ 215, /* (112) alter_db_optr ::= alter_db_optr update */
+ 215, /* (113) alter_db_optr ::= alter_db_optr cachelast */
+ 244, /* (114) typename ::= ids */
+ 244, /* (115) typename ::= ids LP signed RP */
+ 244, /* (116) typename ::= ids UNSIGNED */
+ 245, /* (117) signed ::= INTEGER */
+ 245, /* (118) signed ::= PLUS INTEGER */
+ 245, /* (119) signed ::= MINUS INTEGER */
+ 210, /* (120) cmd ::= CREATE TABLE create_table_args */
+ 210, /* (121) cmd ::= CREATE TABLE create_stable_args */
+ 210, /* (122) cmd ::= CREATE STABLE create_stable_args */
+ 210, /* (123) cmd ::= CREATE TABLE create_table_list */
+ 248, /* (124) create_table_list ::= create_from_stable */
+ 248, /* (125) create_table_list ::= create_table_list create_from_stable */
+ 246, /* (126) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
+ 247, /* (127) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
+ 249, /* (128) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
+ 246, /* (129) create_table_args ::= ifnotexists ids cpxName AS select */
+ 250, /* (130) columnlist ::= columnlist COMMA column */
+ 250, /* (131) columnlist ::= column */
+ 252, /* (132) column ::= ids typename */
+ 229, /* (133) tagitemlist ::= tagitemlist COMMA tagitem */
+ 229, /* (134) tagitemlist ::= tagitem */
+ 253, /* (135) tagitem ::= INTEGER */
+ 253, /* (136) tagitem ::= FLOAT */
+ 253, /* (137) tagitem ::= STRING */
+ 253, /* (138) tagitem ::= BOOL */
+ 253, /* (139) tagitem ::= NULL */
+ 253, /* (140) tagitem ::= MINUS INTEGER */
+ 253, /* (141) tagitem ::= MINUS FLOAT */
+ 253, /* (142) tagitem ::= PLUS INTEGER */
+ 253, /* (143) tagitem ::= PLUS FLOAT */
+ 251, /* (144) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
+ 265, /* (145) union ::= select */
+ 265, /* (146) union ::= LP union RP */
+ 265, /* (147) union ::= union UNION ALL select */
+ 265, /* (148) union ::= union UNION ALL LP select RP */
+ 210, /* (149) cmd ::= union */
+ 251, /* (150) select ::= SELECT selcollist */
+ 266, /* (151) sclp ::= selcollist COMMA */
+ 266, /* (152) sclp ::= */
+ 254, /* (153) selcollist ::= sclp expr as */
+ 254, /* (154) selcollist ::= sclp STAR */
+ 268, /* (155) as ::= AS ids */
+ 268, /* (156) as ::= ids */
+ 268, /* (157) as ::= */
+ 255, /* (158) from ::= FROM tablelist */
+ 269, /* (159) tablelist ::= ids cpxName */
+ 269, /* (160) tablelist ::= ids cpxName ids */
+ 269, /* (161) tablelist ::= tablelist COMMA ids cpxName */
+ 269, /* (162) tablelist ::= tablelist COMMA ids cpxName ids */
+ 270, /* (163) tmvar ::= VARIABLE */
+ 257, /* (164) interval_opt ::= INTERVAL LP tmvar RP */
+ 257, /* (165) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
+ 257, /* (166) interval_opt ::= */
+ 258, /* (167) fill_opt ::= */
+ 258, /* (168) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+ 258, /* (169) fill_opt ::= FILL LP ID RP */
+ 259, /* (170) sliding_opt ::= SLIDING LP tmvar RP */
+ 259, /* (171) sliding_opt ::= */
+ 261, /* (172) orderby_opt ::= */
+ 261, /* (173) orderby_opt ::= ORDER BY sortlist */
+ 271, /* (174) sortlist ::= sortlist COMMA item sortorder */
+ 271, /* (175) sortlist ::= item sortorder */
+ 273, /* (176) item ::= ids cpxName */
+ 274, /* (177) sortorder ::= ASC */
+ 274, /* (178) sortorder ::= DESC */
+ 274, /* (179) sortorder ::= */
+ 260, /* (180) groupby_opt ::= */
+ 260, /* (181) groupby_opt ::= GROUP BY grouplist */
+ 275, /* (182) grouplist ::= grouplist COMMA item */
+ 275, /* (183) grouplist ::= item */
+ 262, /* (184) having_opt ::= */
+ 262, /* (185) having_opt ::= HAVING expr */
+ 264, /* (186) limit_opt ::= */
+ 264, /* (187) limit_opt ::= LIMIT signed */
+ 264, /* (188) limit_opt ::= LIMIT signed OFFSET signed */
+ 264, /* (189) limit_opt ::= LIMIT signed COMMA signed */
+ 263, /* (190) slimit_opt ::= */
+ 263, /* (191) slimit_opt ::= SLIMIT signed */
+ 263, /* (192) slimit_opt ::= SLIMIT signed SOFFSET signed */
+ 263, /* (193) slimit_opt ::= SLIMIT signed COMMA signed */
+ 256, /* (194) where_opt ::= */
+ 256, /* (195) where_opt ::= WHERE expr */
+ 267, /* (196) expr ::= LP expr RP */
+ 267, /* (197) expr ::= ID */
+ 267, /* (198) expr ::= ID DOT ID */
+ 267, /* (199) expr ::= ID DOT STAR */
+ 267, /* (200) expr ::= INTEGER */
+ 267, /* (201) expr ::= MINUS INTEGER */
+ 267, /* (202) expr ::= PLUS INTEGER */
+ 267, /* (203) expr ::= FLOAT */
+ 267, /* (204) expr ::= MINUS FLOAT */
+ 267, /* (205) expr ::= PLUS FLOAT */
+ 267, /* (206) expr ::= STRING */
+ 267, /* (207) expr ::= NOW */
+ 267, /* (208) expr ::= VARIABLE */
+ 267, /* (209) expr ::= BOOL */
+ 267, /* (210) expr ::= ID LP exprlist RP */
+ 267, /* (211) expr ::= ID LP STAR RP */
+ 267, /* (212) expr ::= expr IS NULL */
+ 267, /* (213) expr ::= expr IS NOT NULL */
+ 267, /* (214) expr ::= expr LT expr */
+ 267, /* (215) expr ::= expr GT expr */
+ 267, /* (216) expr ::= expr LE expr */
+ 267, /* (217) expr ::= expr GE expr */
+ 267, /* (218) expr ::= expr NE expr */
+ 267, /* (219) expr ::= expr EQ expr */
+ 267, /* (220) expr ::= expr AND expr */
+ 267, /* (221) expr ::= expr OR expr */
+ 267, /* (222) expr ::= expr PLUS expr */
+ 267, /* (223) expr ::= expr MINUS expr */
+ 267, /* (224) expr ::= expr STAR expr */
+ 267, /* (225) expr ::= expr SLASH expr */
+ 267, /* (226) expr ::= expr REM expr */
+ 267, /* (227) expr ::= expr LIKE expr */
+ 267, /* (228) expr ::= expr IN LP exprlist RP */
+ 276, /* (229) exprlist ::= exprlist COMMA expritem */
+ 276, /* (230) exprlist ::= expritem */
+ 277, /* (231) expritem ::= expr */
+ 277, /* (232) expritem ::= */
+ 210, /* (233) cmd ::= RESET QUERY CACHE */
+ 210, /* (234) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ 210, /* (235) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ 210, /* (236) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ 210, /* (237) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ 210, /* (238) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ 210, /* (239) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ 210, /* (240) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+ 210, /* (241) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+ 210, /* (242) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+ 210, /* (243) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+ 210, /* (244) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+ 210, /* (245) cmd ::= KILL CONNECTION INTEGER */
+ 210, /* (246) cmd ::= KILL STREAM INTEGER COLON INTEGER */
+ 210, /* (247) cmd ::= KILL QUERY INTEGER COLON INTEGER */
+};
+
+/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
+** of symbols on the right-hand side of that rule. */
+static const signed char yyRuleInfoNRhs[] = {
+ -1, /* (0) program ::= cmd */
+ -2, /* (1) cmd ::= SHOW DATABASES */
+ -2, /* (2) cmd ::= SHOW MNODES */
+ -2, /* (3) cmd ::= SHOW DNODES */
+ -2, /* (4) cmd ::= SHOW ACCOUNTS */
+ -2, /* (5) cmd ::= SHOW USERS */
+ -2, /* (6) cmd ::= SHOW MODULES */
+ -2, /* (7) cmd ::= SHOW QUERIES */
+ -2, /* (8) cmd ::= SHOW CONNECTIONS */
+ -2, /* (9) cmd ::= SHOW STREAMS */
+ -2, /* (10) cmd ::= SHOW VARIABLES */
+ -2, /* (11) cmd ::= SHOW SCORES */
+ -2, /* (12) cmd ::= SHOW GRANTS */
+ -2, /* (13) cmd ::= SHOW VNODES */
+ -3, /* (14) cmd ::= SHOW VNODES IPTOKEN */
+ 0, /* (15) dbPrefix ::= */
+ -2, /* (16) dbPrefix ::= ids DOT */
+ 0, /* (17) cpxName ::= */
+ -2, /* (18) cpxName ::= DOT ids */
+ -5, /* (19) cmd ::= SHOW CREATE TABLE ids cpxName */
+ -4, /* (20) cmd ::= SHOW CREATE DATABASE ids */
+ -3, /* (21) cmd ::= SHOW dbPrefix TABLES */
+ -5, /* (22) cmd ::= SHOW dbPrefix TABLES LIKE ids */
+ -3, /* (23) cmd ::= SHOW dbPrefix STABLES */
+ -5, /* (24) cmd ::= SHOW dbPrefix STABLES LIKE ids */
+ -3, /* (25) cmd ::= SHOW dbPrefix VGROUPS */
+ -4, /* (26) cmd ::= SHOW dbPrefix VGROUPS ids */
+ -5, /* (27) cmd ::= DROP TABLE ifexists ids cpxName */
+ -5, /* (28) cmd ::= DROP STABLE ifexists ids cpxName */
+ -4, /* (29) cmd ::= DROP DATABASE ifexists ids */
+ -3, /* (30) cmd ::= DROP DNODE ids */
+ -3, /* (31) cmd ::= DROP USER ids */
+ -3, /* (32) cmd ::= DROP ACCOUNT ids */
+ -2, /* (33) cmd ::= USE ids */
+ -3, /* (34) cmd ::= DESCRIBE ids cpxName */
+ -5, /* (35) cmd ::= ALTER USER ids PASS ids */
+ -5, /* (36) cmd ::= ALTER USER ids PRIVILEGE ids */
+ -4, /* (37) cmd ::= ALTER DNODE ids ids */
+ -5, /* (38) cmd ::= ALTER DNODE ids ids ids */
+ -3, /* (39) cmd ::= ALTER LOCAL ids */
+ -4, /* (40) cmd ::= ALTER LOCAL ids ids */
+ -4, /* (41) cmd ::= ALTER DATABASE ids alter_db_optr */
+ -4, /* (42) cmd ::= ALTER ACCOUNT ids acct_optr */
+ -6, /* (43) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
+ -1, /* (44) ids ::= ID */
+ -1, /* (45) ids ::= STRING */
+ -2, /* (46) ifexists ::= IF EXISTS */
+ 0, /* (47) ifexists ::= */
+ -3, /* (48) ifnotexists ::= IF NOT EXISTS */
+ 0, /* (49) ifnotexists ::= */
+ -3, /* (50) cmd ::= CREATE DNODE ids */
+ -6, /* (51) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
+ -5, /* (52) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
+ -5, /* (53) cmd ::= CREATE USER ids PASS ids */
+ 0, /* (54) pps ::= */
+ -2, /* (55) pps ::= PPS INTEGER */
+ 0, /* (56) tseries ::= */
+ -2, /* (57) tseries ::= TSERIES INTEGER */
+ 0, /* (58) dbs ::= */
+ -2, /* (59) dbs ::= DBS INTEGER */
+ 0, /* (60) streams ::= */
+ -2, /* (61) streams ::= STREAMS INTEGER */
+ 0, /* (62) storage ::= */
+ -2, /* (63) storage ::= STORAGE INTEGER */
+ 0, /* (64) qtime ::= */
+ -2, /* (65) qtime ::= QTIME INTEGER */
+ 0, /* (66) users ::= */
+ -2, /* (67) users ::= USERS INTEGER */
+ 0, /* (68) conns ::= */
+ -2, /* (69) conns ::= CONNS INTEGER */
+ 0, /* (70) state ::= */
+ -2, /* (71) state ::= STATE ids */
+ -9, /* (72) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
+ -2, /* (73) keep ::= KEEP tagitemlist */
+ -2, /* (74) cache ::= CACHE INTEGER */
+ -2, /* (75) replica ::= REPLICA INTEGER */
+ -2, /* (76) quorum ::= QUORUM INTEGER */
+ -2, /* (77) days ::= DAYS INTEGER */
+ -2, /* (78) minrows ::= MINROWS INTEGER */
+ -2, /* (79) maxrows ::= MAXROWS INTEGER */
+ -2, /* (80) blocks ::= BLOCKS INTEGER */
+ -2, /* (81) ctime ::= CTIME INTEGER */
+ -2, /* (82) wal ::= WAL INTEGER */
+ -2, /* (83) fsync ::= FSYNC INTEGER */
+ -2, /* (84) comp ::= COMP INTEGER */
+ -2, /* (85) prec ::= PRECISION STRING */
+ -2, /* (86) update ::= UPDATE INTEGER */
+ -2, /* (87) cachelast ::= CACHELAST INTEGER */
+ 0, /* (88) db_optr ::= */
+ -2, /* (89) db_optr ::= db_optr cache */
+ -2, /* (90) db_optr ::= db_optr replica */
+ -2, /* (91) db_optr ::= db_optr quorum */
+ -2, /* (92) db_optr ::= db_optr days */
+ -2, /* (93) db_optr ::= db_optr minrows */
+ -2, /* (94) db_optr ::= db_optr maxrows */
+ -2, /* (95) db_optr ::= db_optr blocks */
+ -2, /* (96) db_optr ::= db_optr ctime */
+ -2, /* (97) db_optr ::= db_optr wal */
+ -2, /* (98) db_optr ::= db_optr fsync */
+ -2, /* (99) db_optr ::= db_optr comp */
+ -2, /* (100) db_optr ::= db_optr prec */
+ -2, /* (101) db_optr ::= db_optr keep */
+ -2, /* (102) db_optr ::= db_optr update */
+ -2, /* (103) db_optr ::= db_optr cachelast */
+ 0, /* (104) alter_db_optr ::= */
+ -2, /* (105) alter_db_optr ::= alter_db_optr replica */
+ -2, /* (106) alter_db_optr ::= alter_db_optr quorum */
+ -2, /* (107) alter_db_optr ::= alter_db_optr keep */
+ -2, /* (108) alter_db_optr ::= alter_db_optr blocks */
+ -2, /* (109) alter_db_optr ::= alter_db_optr comp */
+ -2, /* (110) alter_db_optr ::= alter_db_optr wal */
+ -2, /* (111) alter_db_optr ::= alter_db_optr fsync */
+ -2, /* (112) alter_db_optr ::= alter_db_optr update */
+ -2, /* (113) alter_db_optr ::= alter_db_optr cachelast */
+ -1, /* (114) typename ::= ids */
+ -4, /* (115) typename ::= ids LP signed RP */
+ -2, /* (116) typename ::= ids UNSIGNED */
+ -1, /* (117) signed ::= INTEGER */
+ -2, /* (118) signed ::= PLUS INTEGER */
+ -2, /* (119) signed ::= MINUS INTEGER */
+ -3, /* (120) cmd ::= CREATE TABLE create_table_args */
+ -3, /* (121) cmd ::= CREATE TABLE create_stable_args */
+ -3, /* (122) cmd ::= CREATE STABLE create_stable_args */
+ -3, /* (123) cmd ::= CREATE TABLE create_table_list */
+ -1, /* (124) create_table_list ::= create_from_stable */
+ -2, /* (125) create_table_list ::= create_table_list create_from_stable */
+ -6, /* (126) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
+ -10, /* (127) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
+ -10, /* (128) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
+ -5, /* (129) create_table_args ::= ifnotexists ids cpxName AS select */
+ -3, /* (130) columnlist ::= columnlist COMMA column */
+ -1, /* (131) columnlist ::= column */
+ -2, /* (132) column ::= ids typename */
+ -3, /* (133) tagitemlist ::= tagitemlist COMMA tagitem */
+ -1, /* (134) tagitemlist ::= tagitem */
+ -1, /* (135) tagitem ::= INTEGER */
+ -1, /* (136) tagitem ::= FLOAT */
+ -1, /* (137) tagitem ::= STRING */
+ -1, /* (138) tagitem ::= BOOL */
+ -1, /* (139) tagitem ::= NULL */
+ -2, /* (140) tagitem ::= MINUS INTEGER */
+ -2, /* (141) tagitem ::= MINUS FLOAT */
+ -2, /* (142) tagitem ::= PLUS INTEGER */
+ -2, /* (143) tagitem ::= PLUS FLOAT */
+ -12, /* (144) select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
+ -1, /* (145) union ::= select */
+ -3, /* (146) union ::= LP union RP */
+ -4, /* (147) union ::= union UNION ALL select */
+ -6, /* (148) union ::= union UNION ALL LP select RP */
+ -1, /* (149) cmd ::= union */
+ -2, /* (150) select ::= SELECT selcollist */
+ -2, /* (151) sclp ::= selcollist COMMA */
+ 0, /* (152) sclp ::= */
+ -3, /* (153) selcollist ::= sclp expr as */
+ -2, /* (154) selcollist ::= sclp STAR */
+ -2, /* (155) as ::= AS ids */
+ -1, /* (156) as ::= ids */
+ 0, /* (157) as ::= */
+ -2, /* (158) from ::= FROM tablelist */
+ -2, /* (159) tablelist ::= ids cpxName */
+ -3, /* (160) tablelist ::= ids cpxName ids */
+ -4, /* (161) tablelist ::= tablelist COMMA ids cpxName */
+ -5, /* (162) tablelist ::= tablelist COMMA ids cpxName ids */
+ -1, /* (163) tmvar ::= VARIABLE */
+ -4, /* (164) interval_opt ::= INTERVAL LP tmvar RP */
+ -6, /* (165) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
+ 0, /* (166) interval_opt ::= */
+ 0, /* (167) fill_opt ::= */
+ -6, /* (168) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+ -4, /* (169) fill_opt ::= FILL LP ID RP */
+ -4, /* (170) sliding_opt ::= SLIDING LP tmvar RP */
+ 0, /* (171) sliding_opt ::= */
+ 0, /* (172) orderby_opt ::= */
+ -3, /* (173) orderby_opt ::= ORDER BY sortlist */
+ -4, /* (174) sortlist ::= sortlist COMMA item sortorder */
+ -2, /* (175) sortlist ::= item sortorder */
+ -2, /* (176) item ::= ids cpxName */
+ -1, /* (177) sortorder ::= ASC */
+ -1, /* (178) sortorder ::= DESC */
+ 0, /* (179) sortorder ::= */
+ 0, /* (180) groupby_opt ::= */
+ -3, /* (181) groupby_opt ::= GROUP BY grouplist */
+ -3, /* (182) grouplist ::= grouplist COMMA item */
+ -1, /* (183) grouplist ::= item */
+ 0, /* (184) having_opt ::= */
+ -2, /* (185) having_opt ::= HAVING expr */
+ 0, /* (186) limit_opt ::= */
+ -2, /* (187) limit_opt ::= LIMIT signed */
+ -4, /* (188) limit_opt ::= LIMIT signed OFFSET signed */
+ -4, /* (189) limit_opt ::= LIMIT signed COMMA signed */
+ 0, /* (190) slimit_opt ::= */
+ -2, /* (191) slimit_opt ::= SLIMIT signed */
+ -4, /* (192) slimit_opt ::= SLIMIT signed SOFFSET signed */
+ -4, /* (193) slimit_opt ::= SLIMIT signed COMMA signed */
+ 0, /* (194) where_opt ::= */
+ -2, /* (195) where_opt ::= WHERE expr */
+ -3, /* (196) expr ::= LP expr RP */
+ -1, /* (197) expr ::= ID */
+ -3, /* (198) expr ::= ID DOT ID */
+ -3, /* (199) expr ::= ID DOT STAR */
+ -1, /* (200) expr ::= INTEGER */
+ -2, /* (201) expr ::= MINUS INTEGER */
+ -2, /* (202) expr ::= PLUS INTEGER */
+ -1, /* (203) expr ::= FLOAT */
+ -2, /* (204) expr ::= MINUS FLOAT */
+ -2, /* (205) expr ::= PLUS FLOAT */
+ -1, /* (206) expr ::= STRING */
+ -1, /* (207) expr ::= NOW */
+ -1, /* (208) expr ::= VARIABLE */
+ -1, /* (209) expr ::= BOOL */
+ -4, /* (210) expr ::= ID LP exprlist RP */
+ -4, /* (211) expr ::= ID LP STAR RP */
+ -3, /* (212) expr ::= expr IS NULL */
+ -4, /* (213) expr ::= expr IS NOT NULL */
+ -3, /* (214) expr ::= expr LT expr */
+ -3, /* (215) expr ::= expr GT expr */
+ -3, /* (216) expr ::= expr LE expr */
+ -3, /* (217) expr ::= expr GE expr */
+ -3, /* (218) expr ::= expr NE expr */
+ -3, /* (219) expr ::= expr EQ expr */
+ -3, /* (220) expr ::= expr AND expr */
+ -3, /* (221) expr ::= expr OR expr */
+ -3, /* (222) expr ::= expr PLUS expr */
+ -3, /* (223) expr ::= expr MINUS expr */
+ -3, /* (224) expr ::= expr STAR expr */
+ -3, /* (225) expr ::= expr SLASH expr */
+ -3, /* (226) expr ::= expr REM expr */
+ -3, /* (227) expr ::= expr LIKE expr */
+ -5, /* (228) expr ::= expr IN LP exprlist RP */
+ -3, /* (229) exprlist ::= exprlist COMMA expritem */
+ -1, /* (230) exprlist ::= expritem */
+ -1, /* (231) expritem ::= expr */
+ 0, /* (232) expritem ::= */
+ -3, /* (233) cmd ::= RESET QUERY CACHE */
+ -7, /* (234) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ -7, /* (235) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ -7, /* (236) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ -7, /* (237) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ -8, /* (238) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ -9, /* (239) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ -7, /* (240) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+ -7, /* (241) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+ -7, /* (242) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+ -7, /* (243) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+ -8, /* (244) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+ -3, /* (245) cmd ::= KILL CONNECTION INTEGER */
+ -5, /* (246) cmd ::= KILL STREAM INTEGER COLON INTEGER */
+ -5, /* (247) cmd ::= KILL QUERY INTEGER COLON INTEGER */
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -1976,30 +2272,34 @@ static void yy_accept(yyParser*); /* Forward Declaration */
** only called from one place, optimizing compilers will in-line it, which
** means that the extra parameters have no performance impact.
*/
-static void yy_reduce(
+static YYACTIONTYPE yy_reduce(
yyParser *yypParser, /* The parser */
unsigned int yyruleno, /* Number of the rule by which to reduce */
int yyLookahead, /* Lookahead token, or YYNOCODE if none */
ParseTOKENTYPE yyLookaheadToken /* Value of the lookahead token */
+ ParseCTX_PDECL /* %extra_context */
){
int yygoto; /* The next state */
- int yyact; /* The next action */
+ YYACTIONTYPE yyact; /* The next action */
yyStackEntry *yymsp; /* The top of the parser's stack */
int yysize; /* Amount to pop the stack */
- ParseARG_FETCH;
+ ParseARG_FETCH
(void)yyLookahead;
(void)yyLookaheadToken;
yymsp = yypParser->yytos;
#ifndef NDEBUG
if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
- yysize = yyRuleInfo[yyruleno].nrhs;
+ yysize = yyRuleInfoNRhs[yyruleno];
if( yysize ){
- fprintf(yyTraceFILE, "%sReduce %d [%s], go to state %d.\n",
+ fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
yyTracePrompt,
- yyruleno, yyRuleName[yyruleno], yymsp[yysize].stateno);
+ yyruleno, yyRuleName[yyruleno],
+ yyrulenoyytos - yypParser->yystack)>yypParser->yyhwm ){
yypParser->yyhwm++;
@@ -2017,13 +2317,19 @@ static void yy_reduce(
#if YYSTACKDEPTH>0
if( yypParser->yytos>=yypParser->yystackEnd ){
yyStackOverflow(yypParser);
- return;
+ /* The call to yyStackOverflow() above pops the stack until it is
+ ** empty, causing the main parser loop to exit. So the return value
+ ** is never used and does not matter. */
+ return 0;
}
#else
if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
if( yyGrowStack(yypParser) ){
yyStackOverflow(yypParser);
- return;
+ /* The call to yyStackOverflow() above pops the stack until it is
+ ** empty, causing the main parser loop to exit. So the return value
+ ** is never used and does not matter. */
+ return 0;
}
yymsp = yypParser->yytos;
}
@@ -2042,7 +2348,9 @@ static void yy_reduce(
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* program ::= cmd */
- case 119: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==119);
+ case 120: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==120);
+ case 121: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==121);
+ case 122: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==122);
{}
break;
case 1: /* cmd ::= SHOW DATABASES */
@@ -2150,107 +2458,113 @@ static void yy_reduce(
case 27: /* cmd ::= DROP TABLE ifexists ids cpxName */
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
- setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0);
+ setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0, -1);
}
break;
- case 28: /* cmd ::= DROP DATABASE ifexists ids */
-{ setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0); }
+ case 28: /* cmd ::= DROP STABLE ifexists ids cpxName */
+{
+ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
+ setDropDbTableInfo(pInfo, TSDB_SQL_DROP_TABLE, &yymsp[-1].minor.yy0, &yymsp[-2].minor.yy0, TSDB_SUPER_TABLE);
+}
break;
- case 29: /* cmd ::= DROP DNODE ids */
+ case 29: /* cmd ::= DROP DATABASE ifexists ids */
+{ setDropDbTableInfo(pInfo, TSDB_SQL_DROP_DB, &yymsp[0].minor.yy0, &yymsp[-1].minor.yy0, -1); }
+ break;
+ case 30: /* cmd ::= DROP DNODE ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_DROP_DNODE, 1, &yymsp[0].minor.yy0); }
break;
- case 30: /* cmd ::= DROP USER ids */
+ case 31: /* cmd ::= DROP USER ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_DROP_USER, 1, &yymsp[0].minor.yy0); }
break;
- case 31: /* cmd ::= DROP ACCOUNT ids */
+ case 32: /* cmd ::= DROP ACCOUNT ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_DROP_ACCT, 1, &yymsp[0].minor.yy0); }
break;
- case 32: /* cmd ::= USE ids */
+ case 33: /* cmd ::= USE ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_USE_DB, 1, &yymsp[0].minor.yy0);}
break;
- case 33: /* cmd ::= DESCRIBE ids cpxName */
+ case 34: /* cmd ::= DESCRIBE ids cpxName */
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
setDCLSQLElems(pInfo, TSDB_SQL_DESCRIBE_TABLE, 1, &yymsp[-1].minor.yy0);
}
break;
- case 34: /* cmd ::= ALTER USER ids PASS ids */
+ case 35: /* cmd ::= ALTER USER ids PASS ids */
{ setAlterUserSql(pInfo, TSDB_ALTER_USER_PASSWD, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, NULL); }
break;
- case 35: /* cmd ::= ALTER USER ids PRIVILEGE ids */
+ case 36: /* cmd ::= ALTER USER ids PRIVILEGE ids */
{ setAlterUserSql(pInfo, TSDB_ALTER_USER_PRIVILEGES, &yymsp[-2].minor.yy0, NULL, &yymsp[0].minor.yy0);}
break;
- case 36: /* cmd ::= ALTER DNODE ids ids */
+ case 37: /* cmd ::= ALTER DNODE ids ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 37: /* cmd ::= ALTER DNODE ids ids ids */
+ case 38: /* cmd ::= ALTER DNODE ids ids ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_DNODE, 3, &yymsp[-2].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 38: /* cmd ::= ALTER LOCAL ids */
+ case 39: /* cmd ::= ALTER LOCAL ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 1, &yymsp[0].minor.yy0); }
break;
- case 39: /* cmd ::= ALTER LOCAL ids ids */
+ case 40: /* cmd ::= ALTER LOCAL ids ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_CFG_LOCAL, 2, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); }
break;
- case 40: /* cmd ::= ALTER DATABASE ids alter_db_optr */
+ case 41: /* cmd ::= ALTER DATABASE ids alter_db_optr */
{ SStrToken t = {0}; setCreateDBSQL(pInfo, TSDB_SQL_ALTER_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy234, &t);}
break;
- case 41: /* cmd ::= ALTER ACCOUNT ids acct_optr */
+ case 42: /* cmd ::= ALTER ACCOUNT ids acct_optr */
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-1].minor.yy0, NULL, &yymsp[0].minor.yy71);}
break;
- case 42: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
+ case 43: /* cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
{ setCreateAcctSql(pInfo, TSDB_SQL_ALTER_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy71);}
break;
- case 43: /* ids ::= ID */
- case 44: /* ids ::= STRING */ yytestcase(yyruleno==44);
+ case 44: /* ids ::= ID */
+ case 45: /* ids ::= STRING */ yytestcase(yyruleno==45);
{yylhsminor.yy0 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
- case 45: /* ifexists ::= IF EXISTS */
+ case 46: /* ifexists ::= IF EXISTS */
{ yymsp[-1].minor.yy0.n = 1;}
break;
- case 46: /* ifexists ::= */
- case 48: /* ifnotexists ::= */ yytestcase(yyruleno==48);
+ case 47: /* ifexists ::= */
+ case 49: /* ifnotexists ::= */ yytestcase(yyruleno==49);
{ yymsp[1].minor.yy0.n = 0;}
break;
- case 47: /* ifnotexists ::= IF NOT EXISTS */
+ case 48: /* ifnotexists ::= IF NOT EXISTS */
{ yymsp[-2].minor.yy0.n = 1;}
break;
- case 49: /* cmd ::= CREATE DNODE ids */
+ case 50: /* cmd ::= CREATE DNODE ids */
{ setDCLSQLElems(pInfo, TSDB_SQL_CREATE_DNODE, 1, &yymsp[0].minor.yy0);}
break;
- case 50: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
+ case 51: /* cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &yymsp[-3].minor.yy0, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy71);}
break;
- case 51: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
+ case 52: /* cmd ::= CREATE DATABASE ifnotexists ids db_optr */
{ setCreateDBSQL(pInfo, TSDB_SQL_CREATE_DB, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy234, &yymsp[-2].minor.yy0);}
break;
- case 52: /* cmd ::= CREATE USER ids PASS ids */
+ case 53: /* cmd ::= CREATE USER ids PASS ids */
{ setCreateUserSql(pInfo, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);}
break;
- case 53: /* pps ::= */
- case 55: /* tseries ::= */ yytestcase(yyruleno==55);
- case 57: /* dbs ::= */ yytestcase(yyruleno==57);
- case 59: /* streams ::= */ yytestcase(yyruleno==59);
- case 61: /* storage ::= */ yytestcase(yyruleno==61);
- case 63: /* qtime ::= */ yytestcase(yyruleno==63);
- case 65: /* users ::= */ yytestcase(yyruleno==65);
- case 67: /* conns ::= */ yytestcase(yyruleno==67);
- case 69: /* state ::= */ yytestcase(yyruleno==69);
+ case 54: /* pps ::= */
+ case 56: /* tseries ::= */ yytestcase(yyruleno==56);
+ case 58: /* dbs ::= */ yytestcase(yyruleno==58);
+ case 60: /* streams ::= */ yytestcase(yyruleno==60);
+ case 62: /* storage ::= */ yytestcase(yyruleno==62);
+ case 64: /* qtime ::= */ yytestcase(yyruleno==64);
+ case 66: /* users ::= */ yytestcase(yyruleno==66);
+ case 68: /* conns ::= */ yytestcase(yyruleno==68);
+ case 70: /* state ::= */ yytestcase(yyruleno==70);
{ yymsp[1].minor.yy0.n = 0; }
break;
- case 54: /* pps ::= PPS INTEGER */
- case 56: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==56);
- case 58: /* dbs ::= DBS INTEGER */ yytestcase(yyruleno==58);
- case 60: /* streams ::= STREAMS INTEGER */ yytestcase(yyruleno==60);
- case 62: /* storage ::= STORAGE INTEGER */ yytestcase(yyruleno==62);
- case 64: /* qtime ::= QTIME INTEGER */ yytestcase(yyruleno==64);
- case 66: /* users ::= USERS INTEGER */ yytestcase(yyruleno==66);
- case 68: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==68);
- case 70: /* state ::= STATE ids */ yytestcase(yyruleno==70);
+ case 55: /* pps ::= PPS INTEGER */
+ case 57: /* tseries ::= TSERIES INTEGER */ yytestcase(yyruleno==57);
+ case 59: /* dbs ::= DBS INTEGER */ yytestcase(yyruleno==59);
+ case 61: /* streams ::= STREAMS INTEGER */ yytestcase(yyruleno==61);
+ case 63: /* storage ::= STORAGE INTEGER */ yytestcase(yyruleno==63);
+ case 65: /* qtime ::= QTIME INTEGER */ yytestcase(yyruleno==65);
+ case 67: /* users ::= USERS INTEGER */ yytestcase(yyruleno==67);
+ case 69: /* conns ::= CONNS INTEGER */ yytestcase(yyruleno==69);
+ case 71: /* state ::= STATE ids */ yytestcase(yyruleno==71);
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
- case 71: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
+ case 72: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{
yylhsminor.yy71.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
yylhsminor.yy71.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
@@ -2264,108 +2578,108 @@ static void yy_reduce(
}
yymsp[-8].minor.yy71 = yylhsminor.yy71;
break;
- case 72: /* keep ::= KEEP tagitemlist */
+ case 73: /* keep ::= KEEP tagitemlist */
{ yymsp[-1].minor.yy421 = yymsp[0].minor.yy421; }
break;
- case 73: /* cache ::= CACHE INTEGER */
- case 74: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==74);
- case 75: /* quorum ::= QUORUM INTEGER */ yytestcase(yyruleno==75);
- case 76: /* days ::= DAYS INTEGER */ yytestcase(yyruleno==76);
- case 77: /* minrows ::= MINROWS INTEGER */ yytestcase(yyruleno==77);
- case 78: /* maxrows ::= MAXROWS INTEGER */ yytestcase(yyruleno==78);
- case 79: /* blocks ::= BLOCKS INTEGER */ yytestcase(yyruleno==79);
- case 80: /* ctime ::= CTIME INTEGER */ yytestcase(yyruleno==80);
- case 81: /* wal ::= WAL INTEGER */ yytestcase(yyruleno==81);
- case 82: /* fsync ::= FSYNC INTEGER */ yytestcase(yyruleno==82);
- case 83: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==83);
- case 84: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==84);
- case 85: /* update ::= UPDATE INTEGER */ yytestcase(yyruleno==85);
- case 86: /* cachelast ::= CACHELAST INTEGER */ yytestcase(yyruleno==86);
+ case 74: /* cache ::= CACHE INTEGER */
+ case 75: /* replica ::= REPLICA INTEGER */ yytestcase(yyruleno==75);
+ case 76: /* quorum ::= QUORUM INTEGER */ yytestcase(yyruleno==76);
+ case 77: /* days ::= DAYS INTEGER */ yytestcase(yyruleno==77);
+ case 78: /* minrows ::= MINROWS INTEGER */ yytestcase(yyruleno==78);
+ case 79: /* maxrows ::= MAXROWS INTEGER */ yytestcase(yyruleno==79);
+ case 80: /* blocks ::= BLOCKS INTEGER */ yytestcase(yyruleno==80);
+ case 81: /* ctime ::= CTIME INTEGER */ yytestcase(yyruleno==81);
+ case 82: /* wal ::= WAL INTEGER */ yytestcase(yyruleno==82);
+ case 83: /* fsync ::= FSYNC INTEGER */ yytestcase(yyruleno==83);
+ case 84: /* comp ::= COMP INTEGER */ yytestcase(yyruleno==84);
+ case 85: /* prec ::= PRECISION STRING */ yytestcase(yyruleno==85);
+ case 86: /* update ::= UPDATE INTEGER */ yytestcase(yyruleno==86);
+ case 87: /* cachelast ::= CACHELAST INTEGER */ yytestcase(yyruleno==87);
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
- case 87: /* db_optr ::= */
+ case 88: /* db_optr ::= */
{setDefaultCreateDbOption(&yymsp[1].minor.yy234);}
break;
- case 88: /* db_optr ::= db_optr cache */
+ case 89: /* db_optr ::= db_optr cache */
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 89: /* db_optr ::= db_optr replica */
- case 104: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==104);
+ case 90: /* db_optr ::= db_optr replica */
+ case 105: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==105);
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 90: /* db_optr ::= db_optr quorum */
- case 105: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==105);
+ case 91: /* db_optr ::= db_optr quorum */
+ case 106: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==106);
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 91: /* db_optr ::= db_optr days */
+ case 92: /* db_optr ::= db_optr days */
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 92: /* db_optr ::= db_optr minrows */
+ case 93: /* db_optr ::= db_optr minrows */
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 93: /* db_optr ::= db_optr maxrows */
+ case 94: /* db_optr ::= db_optr maxrows */
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 94: /* db_optr ::= db_optr blocks */
- case 107: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==107);
+ case 95: /* db_optr ::= db_optr blocks */
+ case 108: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==108);
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 95: /* db_optr ::= db_optr ctime */
+ case 96: /* db_optr ::= db_optr ctime */
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 96: /* db_optr ::= db_optr wal */
- case 109: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==109);
+ case 97: /* db_optr ::= db_optr wal */
+ case 110: /* alter_db_optr ::= alter_db_optr wal */ yytestcase(yyruleno==110);
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 97: /* db_optr ::= db_optr fsync */
- case 110: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==110);
+ case 98: /* db_optr ::= db_optr fsync */
+ case 111: /* alter_db_optr ::= alter_db_optr fsync */ yytestcase(yyruleno==111);
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 98: /* db_optr ::= db_optr comp */
- case 108: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==108);
+ case 99: /* db_optr ::= db_optr comp */
+ case 109: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==109);
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 99: /* db_optr ::= db_optr prec */
+ case 100: /* db_optr ::= db_optr prec */
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.precision = yymsp[0].minor.yy0; }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 100: /* db_optr ::= db_optr keep */
- case 106: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==106);
+ case 101: /* db_optr ::= db_optr keep */
+ case 107: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==107);
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.keep = yymsp[0].minor.yy421; }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 101: /* db_optr ::= db_optr update */
- case 111: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==111);
+ case 102: /* db_optr ::= db_optr update */
+ case 112: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==112);
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 102: /* db_optr ::= db_optr cachelast */
- case 112: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==112);
+ case 103: /* db_optr ::= db_optr cachelast */
+ case 113: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==113);
{ yylhsminor.yy234 = yymsp[-1].minor.yy234; yylhsminor.yy234.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[-1].minor.yy234 = yylhsminor.yy234;
break;
- case 103: /* alter_db_optr ::= */
+ case 104: /* alter_db_optr ::= */
{ setDefaultCreateDbOption(&yymsp[1].minor.yy234);}
break;
- case 113: /* typename ::= ids */
+ case 114: /* typename ::= ids */
{
yymsp[0].minor.yy0.type = 0;
tSqlSetColumnType (&yylhsminor.yy183, &yymsp[0].minor.yy0);
}
yymsp[0].minor.yy183 = yylhsminor.yy183;
break;
- case 114: /* typename ::= ids LP signed RP */
+ case 115: /* typename ::= ids LP signed RP */
{
if (yymsp[-1].minor.yy325 <= 0) {
yymsp[-3].minor.yy0.type = 0;
@@ -2377,7 +2691,7 @@ static void yy_reduce(
}
yymsp[-3].minor.yy183 = yylhsminor.yy183;
break;
- case 115: /* typename ::= ids UNSIGNED */
+ case 116: /* typename ::= ids UNSIGNED */
{
yymsp[-1].minor.yy0.type = 0;
yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z);
@@ -2385,20 +2699,20 @@ static void yy_reduce(
}
yymsp[-1].minor.yy183 = yylhsminor.yy183;
break;
- case 116: /* signed ::= INTEGER */
+ case 117: /* signed ::= INTEGER */
{ yylhsminor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[0].minor.yy325 = yylhsminor.yy325;
break;
- case 117: /* signed ::= PLUS INTEGER */
+ case 118: /* signed ::= PLUS INTEGER */
{ yymsp[-1].minor.yy325 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
break;
- case 118: /* signed ::= MINUS INTEGER */
+ case 119: /* signed ::= MINUS INTEGER */
{ yymsp[-1].minor.yy325 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
break;
- case 120: /* cmd ::= CREATE TABLE create_table_list */
+ case 123: /* cmd ::= CREATE TABLE create_table_list */
{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy38;}
break;
- case 121: /* create_table_list ::= create_from_stable */
+ case 124: /* create_table_list ::= create_from_stable */
{
SCreateTableSQL* pCreateTable = calloc(1, sizeof(SCreateTableSQL));
pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo));
@@ -2409,14 +2723,14 @@ static void yy_reduce(
}
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
- case 122: /* create_table_list ::= create_table_list create_from_stable */
+ case 125: /* create_table_list ::= create_table_list create_from_stable */
{
taosArrayPush(yymsp[-1].minor.yy38->childTableInfo, &yymsp[0].minor.yy152);
yylhsminor.yy38 = yymsp[-1].minor.yy38;
}
yymsp[-1].minor.yy38 = yylhsminor.yy38;
break;
- case 123: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
+ case 126: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
{
yylhsminor.yy38 = tSetCreateSqlElems(yymsp[-1].minor.yy421, NULL, NULL, TSQL_CREATE_TABLE);
setSqlInfo(pInfo, yylhsminor.yy38, NULL, TSDB_SQL_CREATE_TABLE);
@@ -2426,7 +2740,7 @@ static void yy_reduce(
}
yymsp[-5].minor.yy38 = yylhsminor.yy38;
break;
- case 124: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
+ case 127: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
{
yylhsminor.yy38 = tSetCreateSqlElems(yymsp[-5].minor.yy421, yymsp[-1].minor.yy421, NULL, TSQL_CREATE_STABLE);
setSqlInfo(pInfo, yylhsminor.yy38, NULL, TSDB_SQL_CREATE_TABLE);
@@ -2436,7 +2750,7 @@ static void yy_reduce(
}
yymsp[-9].minor.yy38 = yylhsminor.yy38;
break;
- case 125: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
+ case 128: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
@@ -2444,7 +2758,7 @@ static void yy_reduce(
}
yymsp[-9].minor.yy152 = yylhsminor.yy152;
break;
- case 126: /* create_table_args ::= ifnotexists ids cpxName AS select */
+ case 129: /* create_table_args ::= ifnotexists ids cpxName AS select */
{
yylhsminor.yy38 = tSetCreateSqlElems(NULL, NULL, yymsp[0].minor.yy148, TSQL_CREATE_STREAM);
setSqlInfo(pInfo, yylhsminor.yy38, NULL, TSDB_SQL_CREATE_TABLE);
@@ -2454,43 +2768,43 @@ static void yy_reduce(
}
yymsp[-4].minor.yy38 = yylhsminor.yy38;
break;
- case 127: /* columnlist ::= columnlist COMMA column */
+ case 130: /* columnlist ::= columnlist COMMA column */
{taosArrayPush(yymsp[-2].minor.yy421, &yymsp[0].minor.yy183); yylhsminor.yy421 = yymsp[-2].minor.yy421; }
yymsp[-2].minor.yy421 = yylhsminor.yy421;
break;
- case 128: /* columnlist ::= column */
+ case 131: /* columnlist ::= column */
{yylhsminor.yy421 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy421, &yymsp[0].minor.yy183);}
yymsp[0].minor.yy421 = yylhsminor.yy421;
break;
- case 129: /* column ::= ids typename */
+ case 132: /* column ::= ids typename */
{
tSqlSetColumnInfo(&yylhsminor.yy183, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy183);
}
yymsp[-1].minor.yy183 = yylhsminor.yy183;
break;
- case 130: /* tagitemlist ::= tagitemlist COMMA tagitem */
+ case 133: /* tagitemlist ::= tagitemlist COMMA tagitem */
{ yylhsminor.yy421 = tVariantListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy430, -1); }
yymsp[-2].minor.yy421 = yylhsminor.yy421;
break;
- case 131: /* tagitemlist ::= tagitem */
+ case 134: /* tagitemlist ::= tagitem */
{ yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[0].minor.yy430, -1); }
yymsp[0].minor.yy421 = yylhsminor.yy421;
break;
- case 132: /* tagitem ::= INTEGER */
- case 133: /* tagitem ::= FLOAT */ yytestcase(yyruleno==133);
- case 134: /* tagitem ::= STRING */ yytestcase(yyruleno==134);
- case 135: /* tagitem ::= BOOL */ yytestcase(yyruleno==135);
+ case 135: /* tagitem ::= INTEGER */
+ case 136: /* tagitem ::= FLOAT */ yytestcase(yyruleno==136);
+ case 137: /* tagitem ::= STRING */ yytestcase(yyruleno==137);
+ case 138: /* tagitem ::= BOOL */ yytestcase(yyruleno==138);
{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy430 = yylhsminor.yy430;
break;
- case 136: /* tagitem ::= NULL */
+ case 139: /* tagitem ::= NULL */
{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy430, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy430 = yylhsminor.yy430;
break;
- case 137: /* tagitem ::= MINUS INTEGER */
- case 138: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==138);
- case 139: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==139);
- case 140: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==140);
+ case 140: /* tagitem ::= MINUS INTEGER */
+ case 141: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==141);
+ case 142: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==142);
+ case 143: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==143);
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type;
@@ -2499,70 +2813,70 @@ static void yy_reduce(
}
yymsp[-1].minor.yy430 = yylhsminor.yy430;
break;
- case 141: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
+ case 144: /* select ::= SELECT selcollist from where_opt interval_opt fill_opt sliding_opt groupby_opt orderby_opt having_opt slimit_opt limit_opt */
{
yylhsminor.yy148 = tSetQuerySqlElems(&yymsp[-11].minor.yy0, yymsp[-10].minor.yy166, yymsp[-9].minor.yy421, yymsp[-8].minor.yy78, yymsp[-4].minor.yy421, yymsp[-3].minor.yy421, &yymsp[-7].minor.yy400, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy421, &yymsp[0].minor.yy167, &yymsp[-1].minor.yy167);
}
yymsp[-11].minor.yy148 = yylhsminor.yy148;
break;
- case 142: /* union ::= select */
+ case 145: /* union ::= select */
{ yylhsminor.yy153 = setSubclause(NULL, yymsp[0].minor.yy148); }
yymsp[0].minor.yy153 = yylhsminor.yy153;
break;
- case 143: /* union ::= LP union RP */
+ case 146: /* union ::= LP union RP */
{ yymsp[-2].minor.yy153 = yymsp[-1].minor.yy153; }
break;
- case 144: /* union ::= union UNION ALL select */
+ case 147: /* union ::= union UNION ALL select */
{ yylhsminor.yy153 = appendSelectClause(yymsp[-3].minor.yy153, yymsp[0].minor.yy148); }
yymsp[-3].minor.yy153 = yylhsminor.yy153;
break;
- case 145: /* union ::= union UNION ALL LP select RP */
+ case 148: /* union ::= union UNION ALL LP select RP */
{ yylhsminor.yy153 = appendSelectClause(yymsp[-5].minor.yy153, yymsp[-1].minor.yy148); }
yymsp[-5].minor.yy153 = yylhsminor.yy153;
break;
- case 146: /* cmd ::= union */
+ case 149: /* cmd ::= union */
{ setSqlInfo(pInfo, yymsp[0].minor.yy153, NULL, TSDB_SQL_SELECT); }
break;
- case 147: /* select ::= SELECT selcollist */
+ case 150: /* select ::= SELECT selcollist */
{
yylhsminor.yy148 = tSetQuerySqlElems(&yymsp[-1].minor.yy0, yymsp[0].minor.yy166, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
yymsp[-1].minor.yy148 = yylhsminor.yy148;
break;
- case 148: /* sclp ::= selcollist COMMA */
+ case 151: /* sclp ::= selcollist COMMA */
{yylhsminor.yy166 = yymsp[-1].minor.yy166;}
yymsp[-1].minor.yy166 = yylhsminor.yy166;
break;
- case 149: /* sclp ::= */
+ case 152: /* sclp ::= */
{yymsp[1].minor.yy166 = 0;}
break;
- case 150: /* selcollist ::= sclp expr as */
+ case 153: /* selcollist ::= sclp expr as */
{
yylhsminor.yy166 = tSqlExprListAppend(yymsp[-2].minor.yy166, yymsp[-1].minor.yy78, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
}
yymsp[-2].minor.yy166 = yylhsminor.yy166;
break;
- case 151: /* selcollist ::= sclp STAR */
+ case 154: /* selcollist ::= sclp STAR */
{
tSQLExpr *pNode = tSqlExprIdValueCreate(NULL, TK_ALL);
yylhsminor.yy166 = tSqlExprListAppend(yymsp[-1].minor.yy166, pNode, 0);
}
yymsp[-1].minor.yy166 = yylhsminor.yy166;
break;
- case 152: /* as ::= AS ids */
+ case 155: /* as ::= AS ids */
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
- case 153: /* as ::= ids */
+ case 156: /* as ::= ids */
{ yylhsminor.yy0 = yymsp[0].minor.yy0; }
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
- case 154: /* as ::= */
+ case 157: /* as ::= */
{ yymsp[1].minor.yy0.n = 0; }
break;
- case 155: /* from ::= FROM tablelist */
+ case 158: /* from ::= FROM tablelist */
{yymsp[-1].minor.yy421 = yymsp[0].minor.yy421;}
break;
- case 156: /* tablelist ::= ids cpxName */
+ case 159: /* tablelist ::= ids cpxName */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
@@ -2571,7 +2885,7 @@ static void yy_reduce(
}
yymsp[-1].minor.yy421 = yylhsminor.yy421;
break;
- case 157: /* tablelist ::= ids cpxName ids */
+ case 160: /* tablelist ::= ids cpxName ids */
{
toTSDBType(yymsp[-2].minor.yy0.type);
toTSDBType(yymsp[0].minor.yy0.type);
@@ -2581,7 +2895,7 @@ static void yy_reduce(
}
yymsp[-2].minor.yy421 = yylhsminor.yy421;
break;
- case 158: /* tablelist ::= tablelist COMMA ids cpxName */
+ case 161: /* tablelist ::= tablelist COMMA ids cpxName */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
@@ -2590,7 +2904,7 @@ static void yy_reduce(
}
yymsp[-3].minor.yy421 = yylhsminor.yy421;
break;
- case 159: /* tablelist ::= tablelist COMMA ids cpxName ids */
+ case 162: /* tablelist ::= tablelist COMMA ids cpxName ids */
{
toTSDBType(yymsp[-2].minor.yy0.type);
toTSDBType(yymsp[0].minor.yy0.type);
@@ -2600,23 +2914,23 @@ static void yy_reduce(
}
yymsp[-4].minor.yy421 = yylhsminor.yy421;
break;
- case 160: /* tmvar ::= VARIABLE */
+ case 163: /* tmvar ::= VARIABLE */
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
- case 161: /* interval_opt ::= INTERVAL LP tmvar RP */
+ case 164: /* interval_opt ::= INTERVAL LP tmvar RP */
{yymsp[-3].minor.yy400.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy400.offset.n = 0; yymsp[-3].minor.yy400.offset.z = NULL; yymsp[-3].minor.yy400.offset.type = 0;}
break;
- case 162: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
+ case 165: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
{yymsp[-5].minor.yy400.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy400.offset = yymsp[-1].minor.yy0;}
break;
- case 163: /* interval_opt ::= */
+ case 166: /* interval_opt ::= */
{memset(&yymsp[1].minor.yy400, 0, sizeof(yymsp[1].minor.yy400));}
break;
- case 164: /* fill_opt ::= */
+ case 167: /* fill_opt ::= */
{yymsp[1].minor.yy421 = 0; }
break;
- case 165: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+ case 168: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{
tVariant A = {0};
toTSDBType(yymsp[-3].minor.yy0.type);
@@ -2626,37 +2940,37 @@ static void yy_reduce(
yymsp[-5].minor.yy421 = yymsp[-1].minor.yy421;
}
break;
- case 166: /* fill_opt ::= FILL LP ID RP */
+ case 169: /* fill_opt ::= FILL LP ID RP */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-3].minor.yy421 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
}
break;
- case 167: /* sliding_opt ::= SLIDING LP tmvar RP */
+ case 170: /* sliding_opt ::= SLIDING LP tmvar RP */
{yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; }
break;
- case 168: /* sliding_opt ::= */
+ case 171: /* sliding_opt ::= */
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; }
break;
- case 169: /* orderby_opt ::= */
+ case 172: /* orderby_opt ::= */
{yymsp[1].minor.yy421 = 0;}
break;
- case 170: /* orderby_opt ::= ORDER BY sortlist */
+ case 173: /* orderby_opt ::= ORDER BY sortlist */
{yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;}
break;
- case 171: /* sortlist ::= sortlist COMMA item sortorder */
+ case 174: /* sortlist ::= sortlist COMMA item sortorder */
{
yylhsminor.yy421 = tVariantListAppend(yymsp[-3].minor.yy421, &yymsp[-1].minor.yy430, yymsp[0].minor.yy96);
}
yymsp[-3].minor.yy421 = yylhsminor.yy421;
break;
- case 172: /* sortlist ::= item sortorder */
+ case 175: /* sortlist ::= item sortorder */
{
yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[-1].minor.yy430, yymsp[0].minor.yy96);
}
yymsp[-1].minor.yy421 = yylhsminor.yy421;
break;
- case 173: /* item ::= ids cpxName */
+ case 176: /* item ::= ids cpxName */
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
@@ -2665,240 +2979,240 @@ static void yy_reduce(
}
yymsp[-1].minor.yy430 = yylhsminor.yy430;
break;
- case 174: /* sortorder ::= ASC */
+ case 177: /* sortorder ::= ASC */
{ yymsp[0].minor.yy96 = TSDB_ORDER_ASC; }
break;
- case 175: /* sortorder ::= DESC */
+ case 178: /* sortorder ::= DESC */
{ yymsp[0].minor.yy96 = TSDB_ORDER_DESC;}
break;
- case 176: /* sortorder ::= */
+ case 179: /* sortorder ::= */
{ yymsp[1].minor.yy96 = TSDB_ORDER_ASC; }
break;
- case 177: /* groupby_opt ::= */
+ case 180: /* groupby_opt ::= */
{ yymsp[1].minor.yy421 = 0;}
break;
- case 178: /* groupby_opt ::= GROUP BY grouplist */
+ case 181: /* groupby_opt ::= GROUP BY grouplist */
{ yymsp[-2].minor.yy421 = yymsp[0].minor.yy421;}
break;
- case 179: /* grouplist ::= grouplist COMMA item */
+ case 182: /* grouplist ::= grouplist COMMA item */
{
yylhsminor.yy421 = tVariantListAppend(yymsp[-2].minor.yy421, &yymsp[0].minor.yy430, -1);
}
yymsp[-2].minor.yy421 = yylhsminor.yy421;
break;
- case 180: /* grouplist ::= item */
+ case 183: /* grouplist ::= item */
{
yylhsminor.yy421 = tVariantListAppend(NULL, &yymsp[0].minor.yy430, -1);
}
yymsp[0].minor.yy421 = yylhsminor.yy421;
break;
- case 181: /* having_opt ::= */
- case 191: /* where_opt ::= */ yytestcase(yyruleno==191);
- case 229: /* expritem ::= */ yytestcase(yyruleno==229);
+ case 184: /* having_opt ::= */
+ case 194: /* where_opt ::= */ yytestcase(yyruleno==194);
+ case 232: /* expritem ::= */ yytestcase(yyruleno==232);
{yymsp[1].minor.yy78 = 0;}
break;
- case 182: /* having_opt ::= HAVING expr */
- case 192: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==192);
+ case 185: /* having_opt ::= HAVING expr */
+ case 195: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==195);
{yymsp[-1].minor.yy78 = yymsp[0].minor.yy78;}
break;
- case 183: /* limit_opt ::= */
- case 187: /* slimit_opt ::= */ yytestcase(yyruleno==187);
+ case 186: /* limit_opt ::= */
+ case 190: /* slimit_opt ::= */ yytestcase(yyruleno==190);
{yymsp[1].minor.yy167.limit = -1; yymsp[1].minor.yy167.offset = 0;}
break;
- case 184: /* limit_opt ::= LIMIT signed */
- case 188: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==188);
+ case 187: /* limit_opt ::= LIMIT signed */
+ case 191: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==191);
{yymsp[-1].minor.yy167.limit = yymsp[0].minor.yy325; yymsp[-1].minor.yy167.offset = 0;}
break;
- case 185: /* limit_opt ::= LIMIT signed OFFSET signed */
+ case 188: /* limit_opt ::= LIMIT signed OFFSET signed */
{ yymsp[-3].minor.yy167.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[0].minor.yy325;}
break;
- case 186: /* limit_opt ::= LIMIT signed COMMA signed */
+ case 189: /* limit_opt ::= LIMIT signed COMMA signed */
{ yymsp[-3].minor.yy167.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[-2].minor.yy325;}
break;
- case 189: /* slimit_opt ::= SLIMIT signed SOFFSET signed */
+ case 192: /* slimit_opt ::= SLIMIT signed SOFFSET signed */
{yymsp[-3].minor.yy167.limit = yymsp[-2].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[0].minor.yy325;}
break;
- case 190: /* slimit_opt ::= SLIMIT signed COMMA signed */
+ case 193: /* slimit_opt ::= SLIMIT signed COMMA signed */
{yymsp[-3].minor.yy167.limit = yymsp[0].minor.yy325; yymsp[-3].minor.yy167.offset = yymsp[-2].minor.yy325;}
break;
- case 193: /* expr ::= LP expr RP */
+ case 196: /* expr ::= LP expr RP */
{yylhsminor.yy78 = yymsp[-1].minor.yy78; yylhsminor.yy78->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy78->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 194: /* expr ::= ID */
+ case 197: /* expr ::= ID */
{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_ID);}
yymsp[0].minor.yy78 = yylhsminor.yy78;
break;
- case 195: /* expr ::= ID DOT ID */
+ case 198: /* expr ::= ID DOT ID */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ID);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 196: /* expr ::= ID DOT STAR */
+ case 199: /* expr ::= ID DOT STAR */
{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-2].minor.yy0, TK_ALL);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 197: /* expr ::= INTEGER */
+ case 200: /* expr ::= INTEGER */
{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_INTEGER);}
yymsp[0].minor.yy78 = yylhsminor.yy78;
break;
- case 198: /* expr ::= MINUS INTEGER */
- case 199: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==199);
+ case 201: /* expr ::= MINUS INTEGER */
+ case 202: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==202);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_INTEGER);}
yymsp[-1].minor.yy78 = yylhsminor.yy78;
break;
- case 200: /* expr ::= FLOAT */
+ case 203: /* expr ::= FLOAT */
{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_FLOAT);}
yymsp[0].minor.yy78 = yylhsminor.yy78;
break;
- case 201: /* expr ::= MINUS FLOAT */
- case 202: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==202);
+ case 204: /* expr ::= MINUS FLOAT */
+ case 205: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==205);
{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[-1].minor.yy0, TK_FLOAT);}
yymsp[-1].minor.yy78 = yylhsminor.yy78;
break;
- case 203: /* expr ::= STRING */
+ case 206: /* expr ::= STRING */
{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_STRING);}
yymsp[0].minor.yy78 = yylhsminor.yy78;
break;
- case 204: /* expr ::= NOW */
+ case 207: /* expr ::= NOW */
{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_NOW); }
yymsp[0].minor.yy78 = yylhsminor.yy78;
break;
- case 205: /* expr ::= VARIABLE */
+ case 208: /* expr ::= VARIABLE */
{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_VARIABLE);}
yymsp[0].minor.yy78 = yylhsminor.yy78;
break;
- case 206: /* expr ::= BOOL */
+ case 209: /* expr ::= BOOL */
{ yylhsminor.yy78 = tSqlExprIdValueCreate(&yymsp[0].minor.yy0, TK_BOOL);}
yymsp[0].minor.yy78 = yylhsminor.yy78;
break;
- case 207: /* expr ::= ID LP exprlist RP */
+ case 210: /* expr ::= ID LP exprlist RP */
{ yylhsminor.yy78 = tSqlExprCreateFunction(yymsp[-1].minor.yy166, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy78 = yylhsminor.yy78;
break;
- case 208: /* expr ::= ID LP STAR RP */
+ case 211: /* expr ::= ID LP STAR RP */
{ yylhsminor.yy78 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
yymsp[-3].minor.yy78 = yylhsminor.yy78;
break;
- case 209: /* expr ::= expr IS NULL */
+ case 212: /* expr ::= expr IS NULL */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, NULL, TK_ISNULL);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 210: /* expr ::= expr IS NOT NULL */
+ case 213: /* expr ::= expr IS NOT NULL */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-3].minor.yy78, NULL, TK_NOTNULL);}
yymsp[-3].minor.yy78 = yylhsminor.yy78;
break;
- case 211: /* expr ::= expr LT expr */
+ case 214: /* expr ::= expr LT expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_LT);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 212: /* expr ::= expr GT expr */
+ case 215: /* expr ::= expr GT expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_GT);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 213: /* expr ::= expr LE expr */
+ case 216: /* expr ::= expr LE expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_LE);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 214: /* expr ::= expr GE expr */
+ case 217: /* expr ::= expr GE expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_GE);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 215: /* expr ::= expr NE expr */
+ case 218: /* expr ::= expr NE expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_NE);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 216: /* expr ::= expr EQ expr */
+ case 219: /* expr ::= expr EQ expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_EQ);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 217: /* expr ::= expr AND expr */
+ case 220: /* expr ::= expr AND expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_AND);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 218: /* expr ::= expr OR expr */
+ case 221: /* expr ::= expr OR expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_OR); }
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 219: /* expr ::= expr PLUS expr */
+ case 222: /* expr ::= expr PLUS expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_PLUS); }
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 220: /* expr ::= expr MINUS expr */
+ case 223: /* expr ::= expr MINUS expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_MINUS); }
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 221: /* expr ::= expr STAR expr */
+ case 224: /* expr ::= expr STAR expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_STAR); }
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 222: /* expr ::= expr SLASH expr */
+ case 225: /* expr ::= expr SLASH expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_DIVIDE);}
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 223: /* expr ::= expr REM expr */
+ case 226: /* expr ::= expr REM expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_REM); }
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 224: /* expr ::= expr LIKE expr */
+ case 227: /* expr ::= expr LIKE expr */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-2].minor.yy78, yymsp[0].minor.yy78, TK_LIKE); }
yymsp[-2].minor.yy78 = yylhsminor.yy78;
break;
- case 225: /* expr ::= expr IN LP exprlist RP */
+ case 228: /* expr ::= expr IN LP exprlist RP */
{yylhsminor.yy78 = tSqlExprCreate(yymsp[-4].minor.yy78, (tSQLExpr*)yymsp[-1].minor.yy166, TK_IN); }
yymsp[-4].minor.yy78 = yylhsminor.yy78;
break;
- case 226: /* exprlist ::= exprlist COMMA expritem */
+ case 229: /* exprlist ::= exprlist COMMA expritem */
{yylhsminor.yy166 = tSqlExprListAppend(yymsp[-2].minor.yy166,yymsp[0].minor.yy78,0);}
yymsp[-2].minor.yy166 = yylhsminor.yy166;
break;
- case 227: /* exprlist ::= expritem */
+ case 230: /* exprlist ::= expritem */
{yylhsminor.yy166 = tSqlExprListAppend(0,yymsp[0].minor.yy78,0);}
yymsp[0].minor.yy166 = yylhsminor.yy166;
break;
- case 228: /* expritem ::= expr */
+ case 231: /* expritem ::= expr */
{yylhsminor.yy78 = yymsp[0].minor.yy78;}
yymsp[0].minor.yy78 = yylhsminor.yy78;
break;
- case 230: /* cmd ::= RESET QUERY CACHE */
+ case 233: /* cmd ::= RESET QUERY CACHE */
{ setDCLSQLElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
break;
- case 231: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ case 234: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 232: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ case 235: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
toTSDBType(yymsp[0].minor.yy0.type);
SArray* K = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1);
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 233: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ case 236: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 234: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ case 237: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
toTSDBType(yymsp[0].minor.yy0.type);
SArray* A = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1);
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 235: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ case 238: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
@@ -2908,11 +3222,11 @@ static void yy_reduce(
toTSDBType(yymsp[0].minor.yy0.type);
A = tVariantListAppendToken(A, &yymsp[0].minor.yy0, -1);
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 236: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ case 239: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
{
yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
@@ -2920,26 +3234,76 @@ static void yy_reduce(
SArray* A = tVariantListAppendToken(NULL, &yymsp[-2].minor.yy0, -1);
A = tVariantListAppend(A, &yymsp[0].minor.yy430, -1);
- SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL);
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-6].minor.yy0, NULL, A, TSDB_ALTER_TABLE_UPDATE_TAG_VAL, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
- case 237: /* cmd ::= KILL CONNECTION INTEGER */
+ case 240: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+{
+ yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
+ setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
+}
+ break;
+ case 241: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+{
+ yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
+
+ toTSDBType(yymsp[0].minor.yy0.type);
+ SArray* K = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1);
+
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, K, TSDB_ALTER_TABLE_DROP_COLUMN, TSDB_SUPER_TABLE);
+ setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
+}
+ break;
+ case 242: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+{
+ yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, yymsp[0].minor.yy421, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
+ setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
+}
+ break;
+ case 243: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+{
+ yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
+
+ toTSDBType(yymsp[0].minor.yy0.type);
+ SArray* A = tVariantListAppendToken(NULL, &yymsp[0].minor.yy0, -1);
+
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-4].minor.yy0, NULL, A, TSDB_ALTER_TABLE_DROP_TAG_COLUMN, TSDB_SUPER_TABLE);
+ setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
+}
+ break;
+ case 244: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+{
+ yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
+
+ toTSDBType(yymsp[-1].minor.yy0.type);
+ SArray* A = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
+
+ toTSDBType(yymsp[0].minor.yy0.type);
+ A = tVariantListAppendToken(A, &yymsp[0].minor.yy0, -1);
+
+ SAlterTableSQL* pAlterTable = tAlterTableSqlElems(&yymsp[-5].minor.yy0, NULL, A, TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN, TSDB_SUPER_TABLE);
+ setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
+}
+ break;
+ case 245: /* cmd ::= KILL CONNECTION INTEGER */
{setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);}
break;
- case 238: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
+ case 246: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);}
break;
- case 239: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
+ case 247: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);}
break;
default:
break;
/********** End reduce actions ************************************************/
};
- assert( yyrulenostateno = (YYACTIONTYPE)yyact;
yymsp->major = (YYCODETYPE)yygoto;
yyTraceShift(yypParser, yyact, "... then shift");
+ return yyact;
}
/*
@@ -2963,7 +3328,8 @@ static void yy_reduce(
static void yy_parse_failed(
yyParser *yypParser /* The parser */
){
- ParseARG_FETCH;
+ ParseARG_FETCH
+ ParseCTX_FETCH
#ifndef NDEBUG
if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
@@ -2974,7 +3340,8 @@ static void yy_parse_failed(
** parser fails */
/************ Begin %parse_failure code ***************************************/
/************ End %parse_failure code *****************************************/
- ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
+ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
+ ParseCTX_STORE
}
#endif /* YYNOERRORRECOVERY */
@@ -2986,7 +3353,8 @@ static void yy_syntax_error(
int yymajor, /* The major type of the error token */
ParseTOKENTYPE yyminor /* The minor type of the error token */
){
- ParseARG_FETCH;
+ ParseARG_FETCH
+ ParseCTX_FETCH
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
@@ -3012,7 +3380,8 @@ static void yy_syntax_error(
assert(len <= outputBufLen);
/************ End %syntax_error code ******************************************/
- ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
+ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
+ ParseCTX_STORE
}
/*
@@ -3021,7 +3390,8 @@ static void yy_syntax_error(
static void yy_accept(
yyParser *yypParser /* The parser */
){
- ParseARG_FETCH;
+ ParseARG_FETCH
+ ParseCTX_FETCH
#ifndef NDEBUG
if( yyTraceFILE ){
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
@@ -3036,7 +3406,8 @@ static void yy_accept(
/*********** Begin %parse_accept code *****************************************/
/*********** End %parse_accept code *******************************************/
- ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
+ ParseARG_STORE /* Suppress warning about unused %extra_argument variable */
+ ParseCTX_STORE
}
/* The main parser program.
@@ -3065,45 +3436,47 @@ void Parse(
ParseARG_PDECL /* Optional %extra_argument parameter */
){
YYMINORTYPE yyminorunion;
- unsigned int yyact; /* The parser action. */
+ YYACTIONTYPE yyact; /* The parser action. */
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
int yyendofinput; /* True if we are at the end of input */
#endif
#ifdef YYERRORSYMBOL
int yyerrorhit = 0; /* True if yymajor has invoked an error */
#endif
- yyParser *yypParser; /* The parser */
+ yyParser *yypParser = (yyParser*)yyp; /* The parser */
+ ParseCTX_FETCH
+ ParseARG_STORE
- yypParser = (yyParser*)yyp;
assert( yypParser->yytos!=0 );
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
yyendofinput = (yymajor==0);
#endif
- ParseARG_STORE;
+ yyact = yypParser->yytos->stateno;
#ifndef NDEBUG
if( yyTraceFILE ){
- int stateno = yypParser->yytos->stateno;
- if( stateno < YY_MIN_REDUCE ){
+ if( yyact < YY_MIN_REDUCE ){
fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
- yyTracePrompt,yyTokenName[yymajor],stateno);
+ yyTracePrompt,yyTokenName[yymajor],yyact);
}else{
fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
- yyTracePrompt,yyTokenName[yymajor],stateno-YY_MIN_REDUCE);
+ yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
}
}
#endif
do{
- yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
+ assert( yyact==yypParser->yytos->stateno );
+ yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
if( yyact >= YY_MIN_REDUCE ){
- yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,yyminor);
+ yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor,
+ yyminor ParseCTX_PARAM);
}else if( yyact <= YY_MAX_SHIFTREDUCE ){
- yy_shift(yypParser,yyact,yymajor,yyminor);
+ yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
#ifndef YYNOERRORRECOVERY
yypParser->yyerrcnt--;
#endif
- yymajor = YYNOCODE;
+ break;
}else if( yyact==YY_ACCEPT_ACTION ){
yypParser->yytos--;
yy_accept(yypParser);
@@ -3154,10 +3527,9 @@ void Parse(
yymajor = YYNOCODE;
}else{
while( yypParser->yytos >= yypParser->yystack
- && yymx != YYERRORSYMBOL
&& (yyact = yy_find_reduce_action(
yypParser->yytos->stateno,
- YYERRORSYMBOL)) >= YY_MIN_REDUCE
+ YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE
){
yy_pop_parser_stack(yypParser);
}
@@ -3174,6 +3546,8 @@ void Parse(
}
yypParser->yyerrcnt = 3;
yyerrorhit = 1;
+ if( yymajor==YYNOCODE ) break;
+ yyact = yypParser->yytos->stateno;
#elif defined(YYNOERRORRECOVERY)
/* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
** do any kind of error recovery. Instead, simply invoke the syntax
@@ -3184,8 +3558,7 @@ void Parse(
*/
yy_syntax_error(yypParser,yymajor, yyminor);
yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
- yymajor = YYNOCODE;
-
+ break;
#else /* YYERRORSYMBOL is not defined */
/* This is what we do if the grammar does not define ERROR:
**
@@ -3207,10 +3580,10 @@ void Parse(
yypParser->yyerrcnt = -1;
#endif
}
- yymajor = YYNOCODE;
+ break;
#endif
}
- }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack );
+ }while( yypParser->yytos>yypParser->yystack );
#ifndef NDEBUG
if( yyTraceFILE ){
yyStackEntry *i;
@@ -3225,3 +3598,17 @@ void Parse(
#endif
return;
}
+
+/*
+** Return the fallback token corresponding to canonical token iToken, or
+** 0 if iToken has no fallback.
+*/
+int ParseFallback(int iToken){
+#ifdef YYFALLBACK
+ assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) );
+ return yyFallback[iToken];
+#else
+ (void)iToken;
+ return 0;
+#endif
+}
diff --git a/src/query/tests/percentileTest.cpp b/src/query/tests/percentileTest.cpp
index f1fc458501..f2b457e7dd 100644
--- a/src/query/tests/percentileTest.cpp
+++ b/src/query/tests/percentileTest.cpp
@@ -43,7 +43,7 @@ tMemBucket *createDoubleDataBucket(int32_t start, int32_t end) {
}
tMemBucket *createUnsignedDataBucket(int32_t start, int32_t end, int32_t type) {
- tMemBucket *pBucket = tMemBucketCreate(tDataTypeDesc[type].nSize, type, start, end);
+ tMemBucket *pBucket = tMemBucketCreate(tDataTypes[type].bytes, type, start, end);
for (int32_t i = start; i <= end; ++i) {
uint64_t k = i;
int32_t ret = tMemBucketPut(pBucket, &k, 1);
diff --git a/src/sync/src/syncMain.c b/src/sync/src/syncMain.c
index 98100fbdd8..1981196525 100644
--- a/src/sync/src/syncMain.c
+++ b/src/sync/src/syncMain.c
@@ -568,7 +568,7 @@ static void syncStartCheckPeerConn(SSyncPeer *pPeer) {
int32_t ret = strcmp(pPeer->fqdn, tsNodeFqdn);
if (pPeer->nodeId == 0 || (ret > 0) || (ret == 0 && pPeer->port > tsSyncPort)) {
int32_t checkMs = 100 + (pNode->vgId * 10) % 100;
- if (pNode->vgId > 1) checkMs = tsStatusInterval * 1000 + checkMs;
+
sDebug("%s, check peer connection after %d ms", pPeer->id, checkMs);
taosTmrReset(syncCheckPeerConnection, checkMs, (void *)pPeer->rid, tsSyncTmrCtrl, &pPeer->timer);
}
diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c
index 7b08178f49..2bc387c3cd 100644
--- a/src/tsdb/src/tsdbMeta.c
+++ b/src/tsdb/src/tsdbMeta.c
@@ -253,7 +253,7 @@ STableCfg *tsdbCreateTableCfgFromMsg(SMDCreateTableMsg *pMsg) {
}
}
if (tsdbTableSetSchema(pCfg, tdGetSchemaFromBuilder(&schemaBuilder), false) < 0) goto _err;
- if (tsdbTableSetName(pCfg, pMsg->tableId, true) < 0) goto _err;
+ if (tsdbTableSetName(pCfg, pMsg->tableFname, true) < 0) goto _err;
if (numOfTags > 0) {
// Decode tag schema
@@ -265,7 +265,7 @@ STableCfg *tsdbCreateTableCfgFromMsg(SMDCreateTableMsg *pMsg) {
}
}
if (tsdbTableSetTagSchema(pCfg, tdGetSchemaFromBuilder(&schemaBuilder), false) < 0) goto _err;
- if (tsdbTableSetSName(pCfg, pMsg->superTableId, true) < 0) goto _err;
+ if (tsdbTableSetSName(pCfg, pMsg->stableFname, true) < 0) goto _err;
if (tsdbTableSetSuperUid(pCfg, htobe64(pMsg->superTableUid)) < 0) goto _err;
int32_t tagDataLen = htonl(pMsg->tagDataLen);
diff --git a/src/tsdb/src/tsdbRWHelper.c b/src/tsdb/src/tsdbRWHelper.c
index b53b8ed5b4..4a44784cc2 100644
--- a/src/tsdb/src/tsdbRWHelper.c
+++ b/src/tsdb/src/tsdbRWHelper.c
@@ -751,8 +751,8 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
pCompCol->colId = pDataCol->colId;
pCompCol->type = pDataCol->type;
- if (tDataTypeDesc[pDataCol->type].getStatisFunc) {
- (*tDataTypeDesc[pDataCol->type].getStatisFunc)(
+ if (tDataTypes[pDataCol->type].statisFunc) {
+ (*tDataTypes[pDataCol->type].statisFunc)(
pDataCol->pData, rowsToWrite, &(pCompCol->min), &(pCompCol->max), &(pCompCol->sum), &(pCompCol->minIndex),
&(pCompCol->maxIndex), &(pCompCol->numOfNull));
}
@@ -788,7 +788,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
}
}
- flen = (*(tDataTypeDesc[pDataCol->type].compFunc))((char *)pDataCol->pData, tlen, rowsToWrite, tptr,
+ flen = (*(tDataTypes[pDataCol->type].compFunc))((char *)pDataCol->pData, tlen, rowsToWrite, tptr,
(int32_t)taosTSizeof(pHelper->pBuffer) - lsize, pCfg->compression,
pHelper->compBuffer, (int32_t)taosTSizeof(pHelper->compBuffer));
} else {
@@ -1208,7 +1208,7 @@ static int tsdbCheckAndDecodeColumnData(SDataCol *pDataCol, char *content, int32
// Decode the data
if (comp) {
// // Need to decompress
- int tlen = (*(tDataTypeDesc[pDataCol->type].decompFunc))(content, len - sizeof(TSCKSUM), numOfRows, pDataCol->pData,
+ int tlen = (*(tDataTypes[pDataCol->type].decompFunc))(content, len - sizeof(TSCKSUM), numOfRows, pDataCol->pData,
pDataCol->spaceSize, comp, buffer, bufferSize);
if (tlen <= 0) {
tsdbError("Failed to decompress column, file corrupted, len:%d comp:%d numOfRows:%d maxPoints:%d bufferSize:%d",
diff --git a/src/util/src/tcompare.c b/src/util/src/tcompare.c
index 75ac930723..01e61987c6 100644
--- a/src/util/src/tcompare.c
+++ b/src/util/src/tcompare.c
@@ -1,4 +1,4 @@
-#include "taosdef.h"
+#include "ttype.h"
#include "tcompare.h"
#include "tarray.h"
diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c
index 801d51b3c8..b1df7bc19f 100644
--- a/src/vnode/src/vnodeWrite.c
+++ b/src/vnode/src/vnodeWrite.c
@@ -174,7 +174,7 @@ static int32_t vnodeProcessDropTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet
SMDDropTableMsg *pTable = pCont;
int32_t code = TSDB_CODE_SUCCESS;
- vDebug("vgId:%d, table:%s, start to drop", pVnode->vgId, pTable->tableId);
+ vDebug("vgId:%d, table:%s, start to drop", pVnode->vgId, pTable->tableFname);
STableId tableId = {.uid = htobe64(pTable->uid), .tid = htonl(pTable->tid)};
if (tsdbDropTable(pVnode->tsdb, tableId) < 0) code = terrno;
@@ -197,13 +197,13 @@ static int32_t vnodeProcessDropStableMsg(SVnodeObj *pVnode, void *pCont, SRspRet
SDropSTableMsg *pTable = pCont;
int32_t code = TSDB_CODE_SUCCESS;
- vDebug("vgId:%d, stable:%s, start to drop", pVnode->vgId, pTable->tableId);
+ vDebug("vgId:%d, stable:%s, start to drop", pVnode->vgId, pTable->tableFname);
STableId stableId = {.uid = htobe64(pTable->uid), .tid = -1};
if (tsdbDropTable(pVnode->tsdb, stableId) < 0) code = terrno;
- vDebug("vgId:%d, stable:%s, drop stable result:%s", pVnode->vgId, pTable->tableId, tstrerror(code));
+ vDebug("vgId:%d, stable:%s, drop stable result:%s", pVnode->vgId, pTable->tableFname, tstrerror(code));
return code;
}
diff --git a/tests/examples/c/asyncdemo.c b/tests/examples/c/asyncdemo.c
index c6cc89b31d..be3a908f11 100644
--- a/tests/examples/c/asyncdemo.c
+++ b/tests/examples/c/asyncdemo.c
@@ -261,9 +261,6 @@ void taos_select_call_back(void *param, TAOS_RES *tres, int code)
if (code == 0 && tres) {
// asynchronous API to fetch a batch of records
taos_fetch_rows_a(tres, taos_retrieve_call_back, pTable);
-
- // taos_fetch_row_a is a less efficient way to retrieve records since it call back app for every row
- // taos_fetch_row_a(tres, taos_fetch_row_call_back, pTable);
}
else {
printf("%s select failed, code:%d\n", pTable->name, code);
diff --git a/tests/examples/c/demo.c b/tests/examples/c/demo.c
index 9ad3e6f902..45ec546803 100644
--- a/tests/examples/c/demo.c
+++ b/tests/examples/c/demo.c
@@ -93,15 +93,15 @@ void Test(TAOS *taos, char *qstr, int index) {
// if (taos_query(taos, qstr)) {
// printf("insert row: %i, reason:%s\n", i, taos_errstr(taos));
// }
- TAOS_RES *result = taos_query(taos, qstr);
- if (result) {
+ TAOS_RES *result1 = taos_query(taos, qstr);
+ if (result1) {
printf("insert row: %i\n", i);
} else {
printf("failed to insert row: %i, reason:%s\n", i, "null result"/*taos_errstr(result)*/);
- taos_free_result(result);
+ taos_free_result(result1);
exit(1);
}
- taos_free_result(result);
+ taos_free_result(result1);
}
printf("success to insert rows, total %d rows\n", i);
diff --git a/tests/perftest-scripts/perftest-taosdemo.sh b/tests/perftest-scripts/perftest-taosdemo.sh
index ae9e8dd737..dffa251ef7 100755
--- a/tests/perftest-scripts/perftest-taosdemo.sh
+++ b/tests/perftest-scripts/perftest-taosdemo.sh
@@ -16,6 +16,9 @@ fi
logDir=`grep "^logDir" /etc/taos/taos.cfg | awk '{print $2}'`
dataDir=`grep "^dataDir" /etc/taos/taos.cfg | awk '{print $2}'`
+[ -z "$logDir" ] && logDir="/var/log/taos"
+[ -z "$dataDir" ] && dataDir="/var/lib/taos"
+
# Coloured Echoes
function red_echo { echo -e "\033[31m$@\033[0m"; }
function green_echo { echo -e "\033[32m$@\033[0m"; }
diff --git a/tests/perftest-scripts/perftest-tsdb-compare-13d.sh b/tests/perftest-scripts/perftest-tsdb-compare-13d.sh
index 110ab9e5fa..3f56a048e9 100755
--- a/tests/perftest-scripts/perftest-tsdb-compare-13d.sh
+++ b/tests/perftest-scripts/perftest-tsdb-compare-13d.sh
@@ -16,6 +16,9 @@ fi
logDir=`grep "^logDir" /etc/taos/taos.cfg | awk '{print $2}'`
dataDir=`grep "^dataDir" /etc/taos/taos.cfg | awk '{print $2}'`
+[ -z "$logDir" ] && logDir="/var/log/taos"
+[ -z "$dataDir" ] && dataDir="/var/lib/taos"
+
# Coloured Echoes #
function red_echo { echo -e "\033[31m$@\033[0m"; } #
function green_echo { echo -e "\033[32m$@\033[0m"; } #
diff --git a/tests/perftest-scripts/perftest-tsdb-compare-1d.sh b/tests/perftest-scripts/perftest-tsdb-compare-1d.sh
index 9e8bc697bc..29e72d7b3f 100755
--- a/tests/perftest-scripts/perftest-tsdb-compare-1d.sh
+++ b/tests/perftest-scripts/perftest-tsdb-compare-1d.sh
@@ -16,6 +16,9 @@ fi
logDir=`grep "^logDir" /etc/taos/taos.cfg | awk '{print $2}'`
dataDir=`grep "^dataDir" /etc/taos/taos.cfg | awk '{print $2}'`
+[ -z "$logDir" ] && logDir="/var/log/taos"
+[ -z "$dataDir" ] && dataDir="/var/lib/taos"
+
# Coloured Echoes #
function red_echo { echo -e "\033[31m$@\033[0m"; } #
function green_echo { echo -e "\033[32m$@\033[0m"; } #
diff --git a/tests/perftest-scripts/perftest-tsdb-compare-var10k-int100s.sh b/tests/perftest-scripts/perftest-tsdb-compare-var10k-int100s.sh
index 5fc5b9d03a..3bc63b831b 100755
--- a/tests/perftest-scripts/perftest-tsdb-compare-var10k-int100s.sh
+++ b/tests/perftest-scripts/perftest-tsdb-compare-var10k-int100s.sh
@@ -16,6 +16,9 @@ fi
logDir=`grep "^logDir" /etc/taos/taos.cfg | awk '{print $2}'`
dataDir=`grep "^dataDir" /etc/taos/taos.cfg | awk '{print $2}'`
+[ -z "$logDir" ] && logDir="/var/log/taos"
+[ -z "$dataDir" ] && dataDir="/var/lib/taos"
+
# Coloured Echoes #
function red_echo { echo -e "\033[31m$@\033[0m"; } #
function green_echo { echo -e "\033[32m$@\033[0m"; } #
diff --git a/tests/perftest-scripts/perftest-tsdb-compare-var10k-int10s.sh b/tests/perftest-scripts/perftest-tsdb-compare-var10k-int10s.sh
index bafa04f174..566479c967 100755
--- a/tests/perftest-scripts/perftest-tsdb-compare-var10k-int10s.sh
+++ b/tests/perftest-scripts/perftest-tsdb-compare-var10k-int10s.sh
@@ -16,6 +16,9 @@ fi
logDir=`grep "^logDir" /etc/taos/taos.cfg | awk '{print $2}'`
dataDir=`grep "^dataDir" /etc/taos/taos.cfg | awk '{print $2}'`
+[ -z "$logDir" ] && logDir="/var/log/taos"
+[ -z "$dataDir" ] && dataDir="/var/lib/taos"
+
# Coloured Echoes #
function red_echo { echo -e "\033[31m$@\033[0m"; } #
function green_echo { echo -e "\033[32m$@\033[0m"; } #
diff --git a/tests/pytest/cluster/clusterEnvSetup/Dockerfile b/tests/pytest/cluster/clusterEnvSetup/Dockerfile
new file mode 100644
index 0000000000..b699e8a23f
--- /dev/null
+++ b/tests/pytest/cluster/clusterEnvSetup/Dockerfile
@@ -0,0 +1,36 @@
+FROM ubuntu:latest AS builder
+
+ARG PACKAGE=TDengine-server-1.6.5.10-Linux-x64.tar.gz
+ARG EXTRACTDIR=TDengine-enterprise-server
+ARG CONTENT=taos.tar.gz
+
+WORKDIR /root
+
+COPY ${PACKAGE} .
+
+RUN tar -zxf ${PACKAGE}
+RUN mv ${EXTRACTDIR}/driver ./lib
+RUN tar -zxf ${EXTRACTDIR}/${CONTENT}
+
+FROM ubuntu:latest
+
+WORKDIR /root
+
+RUN apt-get update
+RUN apt-get install -y vim tmux net-tools
+RUN echo 'alias ll="ls -l --color=auto"' >> /root/.bashrc
+
+COPY --from=builder /root/bin/taosd /usr/bin
+COPY --from=builder /root/bin/taos /usr/bin
+COPY --from=builder /root/cfg/taos.cfg /etc/taos/
+COPY --from=builder /root/lib/libtaos.so.* /usr/lib/libtaos.so.1
+
+ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib"
+ENV LC_CTYPE=en_US.UTF-8
+ENV LANG=en_US.UTF-8
+
+EXPOSE 6030-6041/tcp 6060/tcp 6030-6039/udp
+
+# VOLUME [ "/var/lib/taos", "/var/log/taos", "/etc/taos" ]
+
+CMD [ "bash" ]
diff --git a/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh
new file mode 100755
index 0000000000..e0788ef329
--- /dev/null
+++ b/tests/pytest/cluster/clusterEnvSetup/buildClusterEnv.sh
@@ -0,0 +1,102 @@
+#!/bin/bash
+echo "Executing buildClusterEnv.sh"
+DOCKER_DIR=/data
+CURR_DIR=`pwd`
+
+if [ $# != 4 ]; then
+ echo "argument list need input : "
+ echo " -n numOfNodes"
+ echo " -v version"
+ exit 1
+fi
+
+NUM_OF_NODES=
+VERSION=
+while getopts "n:v:" arg
+do
+ case $arg in
+ n)
+ NUM_OF_NODES=$OPTARG
+ ;;
+ v)
+ VERSION=$OPTARG
+ ;;
+ ?)
+ echo "unkonwn argument"
+ ;;
+ esac
+done
+
+
+function createDIR {
+ for i in {1.. $2}
+ do
+ mkdir -p /data/node$i/data
+ mkdir -p /data/node$i/log
+ mkdir -p /data/node$i/cfg
+ done
+}
+
+function cleanEnv {
+ for i in {1..3}
+ do
+ echo /data/node$i/data/*
+ rm -rf /data/node$i/data/*
+ echo /data/node$i/log/*
+ rm -rf /data/node$i/log/*
+ done
+}
+
+function prepareBuild {
+
+ if [ -d $CURR_DIR/../../../../release ]; then
+ echo release exists
+ rm -rf $CURR_DIR/../../../../release/*
+ fi
+
+ cd $CURR_DIR/../../../../packaging
+ ./release.sh -v edge -n $VERSION >> /dev/null
+
+ if [ ! -f $CURR_DIR/../../../../release/TDengine-server-$VERSION-Linux-x64.tar.gz ]; then
+ echo "no TDengine install package found"
+ exit 1
+ fi
+
+ cd $CURR_DIR/../../../../release
+ mv TDengine-server-$VERSION-Linux-x64.tar.gz $DOCKER_DIR
+
+ rm -rf $DOCKER_DIR/*.yml
+ cd $CURR_DIR
+
+ cp docker-compose.yml $DOCKER_DIR
+ cp Dockerfile $DOCKER_DIR
+
+ if [ $NUM_OF_NODES -eq 4 ]; then
+ cp ../node4.yml $DOCKER_DIR
+ fi
+
+ if [ $NUM_OF_NODES -eq 5 ]; then
+ cp ../node5.yml $DOCKER_DIR
+ fi
+}
+
+function clusterUp {
+
+ cd $DOCKER_DIR
+
+ if [ $NUM_OF_NODES -eq 3 ]; then
+ PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION docker-compose up -d
+ fi
+
+ if [ $NUM_OF_NODES -eq 4 ]; then
+ PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION docker-compose -f docker-compose.yml -f node4.yml up -d
+ fi
+
+ if [ $NUM_OF_NODES -eq 5 ]; then
+ PACKAGE=TDengine-server-$VERSION-Linux-x64.tar.gz DIR=TDengine-server-$VERSION docker-compose -f docker-compose.yml -f node4.yml -f node5.yml up -d
+ fi
+}
+
+cleanEnv
+# prepareBuild
+# clusterUp
\ No newline at end of file
diff --git a/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml
new file mode 100644
index 0000000000..c8498b36d4
--- /dev/null
+++ b/tests/pytest/cluster/clusterEnvSetup/docker-compose.yml
@@ -0,0 +1,127 @@
+version: '3.7'
+
+services:
+ td2.0-node1:
+ build:
+ context: .
+ args:
+ - PACKAGE=${PACKAGE}
+ - EXTRACTDIR=${DIR}
+ image: 'tdengine:2.0.13.1'
+ container_name: 'td2.0-node1'
+ cap_add:
+ - ALL
+ stdin_open: true
+ tty: true
+ environment:
+ TZ: "Asia/Shanghai"
+ command: >
+ sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
+ echo $TZ > /etc/timezone &&
+ exec my-main-application"
+ volumes:
+ # bind data directory
+ - type: bind
+ source: /data/node1/data
+ target: /var/lib/taos
+ # bind log directory
+ - type: bind
+ source: /data/node1/log
+ target: /var/log/taos
+ # bind configuration
+ - type: bind
+ source: /data/node1/cfg
+ target: /etc/taos
+ - type: bind
+ source: /data
+ target: /root
+ networks:
+ taos_update_net:
+ ipv4_address: 172.27.0.7
+ command: taosd
+
+ td2.0-node2:
+ build:
+ context: .
+ args:
+ - PACKAGE=${PACKAGE}
+ - EXTRACTDIR=${DIR}
+ image: 'tdengine:2.0.13.1'
+ container_name: 'td2.0-node2'
+ cap_add:
+ - ALL
+ stdin_open: true
+ tty: true
+ environment:
+ TZ: "Asia/Shanghai"
+ command: >
+ sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
+ echo $TZ > /etc/timezone &&
+ exec my-main-application"
+ volumes:
+ # bind data directory
+ - type: bind
+ source: /data/node2/data
+ target: /var/lib/taos
+ # bind log directory
+ - type: bind
+ source: /data/node2/log
+ target: /var/log/taos
+ # bind configuration
+ - type: bind
+ source: /data/node2/cfg
+ target: /etc/taos
+ - type: bind
+ source: /data
+ target: /root
+ networks:
+ taos_update_net:
+ ipv4_address: 172.27.0.8
+ command: taosd
+
+ td2.0-node3:
+ build:
+ context: .
+ args:
+ - PACKAGE=${PACKAGE}
+ - EXTRACTDIR=${DIR}
+ image: 'tdengine:2.0.13.1'
+ container_name: 'td2.0-node3'
+ cap_add:
+ - ALL
+ stdin_open: true
+ tty: true
+ environment:
+ TZ: "Asia/Shanghai"
+ command: >
+ sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
+ echo $TZ > /etc/timezone &&
+ exec my-main-application"
+ volumes:
+ # bind data directory
+ - type: bind
+ source: /data/node3/data
+ target: /var/lib/taos
+ # bind log directory
+ - type: bind
+ source: /data/node3/log
+ target: /var/log/taos
+ # bind configuration
+ - type: bind
+ source: /data/node3/cfg
+ target: /etc/taos
+ - type: bind
+ source: /data
+ target: /root
+ networks:
+ taos_update_net:
+ ipv4_address: 172.27.0.9
+ command: taosd
+
+networks:
+ taos_update_net:
+# external: true
+ ipam:
+ driver: default
+ config:
+ - subnet: "172.27.0.0/24"
diff --git a/tests/pytest/cluster/clusterEnvSetup/node4.yml b/tests/pytest/cluster/clusterEnvSetup/node4.yml
new file mode 100644
index 0000000000..542dc4cac1
--- /dev/null
+++ b/tests/pytest/cluster/clusterEnvSetup/node4.yml
@@ -0,0 +1,41 @@
+version: '3.7'
+
+services:
+ td2.0-node4:
+ build:
+ context: .
+ args:
+ - PACKAGE=${PACKAGE}
+ - EXTRACTDIR=${DIR}
+ image: 'tdengine:2.0.13.1'
+ container_name: 'td2.0-node4'
+ cap_add:
+ - ALL
+ stdin_open: true
+ tty: true
+ environment:
+ TZ: "Asia/Shanghai"
+ command: >
+ sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
+ echo $TZ > /etc/timezone &&
+ exec my-main-application"
+ volumes:
+ # bind data directory
+ - type: bind
+ source: /data/node4/data
+ target: /var/lib/taos
+ # bind log directory
+ - type: bind
+ source: /data/node4/log
+ target: /var/log/taos
+ # bind configuration
+ - type: bind
+ source: /data/node4/cfg
+ target: /etc/taos
+ - type: bind
+ source: /data
+ target: /root
+ networks:
+ taos_update_net:
+ ipv4_address: 172.27.0.10
+ command: taosd
\ No newline at end of file
diff --git a/tests/pytest/cluster/clusterEnvSetup/node5.yml b/tests/pytest/cluster/clusterEnvSetup/node5.yml
new file mode 100644
index 0000000000..832cc65e08
--- /dev/null
+++ b/tests/pytest/cluster/clusterEnvSetup/node5.yml
@@ -0,0 +1,41 @@
+version: '3.7'
+
+services:
+ td2.0-node5:
+ build:
+ context: .
+ args:
+ - PACKAGE=${PACKAGE}
+ - EXTRACTDIR=${DIR}
+ image: 'tdengine:2.0.13.1'
+ container_name: 'td2.0-node5'
+ cap_add:
+ - ALL
+ stdin_open: true
+ tty: true
+ environment:
+ TZ: "Asia/Shanghai"
+ command: >
+ sh -c "ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &&
+ echo $TZ > /etc/timezone &&
+ exec my-main-application"
+ volumes:
+ # bind data directory
+ - type: bind
+ source: /data/node5/data
+ target: /var/lib/taos
+ # bind log directory
+ - type: bind
+ source: /data/node5/log
+ target: /var/log/taos
+ # bind configuration
+ - type: bind
+ source: /data/node5/cfg
+ target: /etc/taos
+ - type: bind
+ source: /data
+ target: /root
+ networks:
+ taos_update_net:
+ ipv4_address: 172.27.0.11
+ command: taosd
\ No newline at end of file
diff --git a/tests/script/general/http/restful_full.sim b/tests/script/general/http/restful_full.sim
index 7e12d30ac9..645ebd2788 100644
--- a/tests/script/general/http/restful_full.sim
+++ b/tests/script/general/http/restful_full.sim
@@ -15,6 +15,7 @@ print =============== step1 - login
system_content curl 127.0.0.1:7111/rest/
print 1-> $system_content
if $system_content != @{"status":"error","code":4357,"desc":"no auth info input"}@ then
+ print $system_content
return -1
endi
diff --git a/tests/script/general/parser/columnValue_unsign.sim b/tests/script/general/parser/columnValue_unsign.sim
index 895b13961e..6e9a37fdb6 100644
--- a/tests/script/general/parser/columnValue_unsign.sim
+++ b/tests/script/general/parser/columnValue_unsign.sim
@@ -111,7 +111,8 @@ if $rows != 1 then
return -1
endi
-if $data00 != 6.000000000 then
+if $data00 != NULL then
+ print expect NULL, actual:$data00
return -1
endi
@@ -167,7 +168,7 @@ if $data01 != 4 then
return -1
endi
-// todo insert more rows and chec it
+## todo insert more rows and chec it
sql select first(a),count(b),last(c),sum(b),spread(d),avg(c),min(b),max(a),stddev(a) from mt_unsigned_1;
if $rows != 1 then
return -1
diff --git a/tests/script/general/parser/join.sim b/tests/script/general/parser/join.sim
index d18a3d7676..56f115051c 100644
--- a/tests/script/general/parser/join.sim
+++ b/tests/script/general/parser/join.sim
@@ -415,6 +415,7 @@ sql select count(join_mt0.c1), sum(join_mt1.c2), first(join_mt0.c5), last(join_m
$val = 100
if $rows != $val then
+ print $rows
return -1
endi
@@ -514,4 +515,4 @@ sql drop table tm2;
sql select count(*) from m1, m2 where m1.ts=m2.ts and m1.b=m2.a;
sql drop database ux1;
-system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
+system sh/exec.sh -n dnode1 -s stop -x SIGINT
diff --git a/tests/script/general/parser/testSuite.sim b/tests/script/general/parser/testSuite.sim
index 2d77cb15d2..90cccb80e5 100644
--- a/tests/script/general/parser/testSuite.sim
+++ b/tests/script/general/parser/testSuite.sim
@@ -1,64 +1,64 @@
-#run general/parser/alter.sim
-#sleep 100
-#run general/parser/alter1.sim
-#sleep 100
-#run general/parser/alter_stable.sim
-#sleep 100
-#run general/parser/auto_create_tb.sim
-#sleep 100
-#run general/parser/auto_create_tb_drop_tb.sim
-#sleep 100
-#run general/parser/col_arithmetic_operation.sim
-#sleep 100
-#run general/parser/columnValue.sim
-#sleep 100
-#run general/parser/commit.sim
-#sleep 100
-#run general/parser/create_db.sim
-#sleep 100
-#run general/parser/create_mt.sim
-#sleep 100
-#run general/parser/create_tb.sim
-#sleep 100
-#run general/parser/dbtbnameValidate.sim
-#sleep 100
-#run general/parser/fill.sim
-#sleep 100
-#run general/parser/fill_stb.sim
-#sleep 100
-##run general/parser/fill_us.sim #
-#sleep 100
-#run general/parser/first_last.sim
-#sleep 100
-#run general/parser/import_commit1.sim
-#sleep 100
-#run general/parser/import_commit2.sim
-#sleep 100
-#run general/parser/import_commit3.sim
-#sleep 100
-##run general/parser/import_file.sim
-#sleep 100
-#run general/parser/insert_tb.sim
-#sleep 100
-#run general/parser/tags_dynamically_specifiy.sim
-#sleep 100
-#run general/parser/interp.sim
-#sleep 100
-#run general/parser/lastrow.sim
-#sleep 100
-#run general/parser/limit.sim
-#sleep 100
-#run general/parser/limit1.sim
-#sleep 100
-#run general/parser/limit1_tblocks100.sim
-#sleep 100
-#run general/parser/limit2.sim
-#sleep 100
-#run general/parser/mixed_blocks.sim
-#sleep 100
-#run general/parser/nchar.sim
-#sleep 100
-#run general/parser/null_char.sim
+run general/parser/alter.sim
+sleep 100
+run general/parser/alter1.sim
+sleep 100
+run general/parser/alter_stable.sim
+sleep 100
+run general/parser/auto_create_tb.sim
+sleep 100
+run general/parser/auto_create_tb_drop_tb.sim
+sleep 100
+run general/parser/col_arithmetic_operation.sim
+sleep 100
+run general/parser/columnValue.sim
+sleep 100
+run general/parser/commit.sim
+sleep 100
+run general/parser/create_db.sim
+sleep 100
+run general/parser/create_mt.sim
+sleep 100
+run general/parser/create_tb.sim
+sleep 100
+run general/parser/dbtbnameValidate.sim
+sleep 100
+run general/parser/fill.sim
+sleep 100
+run general/parser/fill_stb.sim
+sleep 100
+#run general/parser/fill_us.sim #
+sleep 100
+run general/parser/first_last.sim
+sleep 100
+run general/parser/import_commit1.sim
+sleep 100
+run general/parser/import_commit2.sim
+sleep 100
+run general/parser/import_commit3.sim
+sleep 100
+#run general/parser/import_file.sim
+sleep 100
+run general/parser/insert_tb.sim
+sleep 100
+run general/parser/tags_dynamically_specifiy.sim
+sleep 100
+run general/parser/interp.sim
+sleep 100
+run general/parser/lastrow.sim
+sleep 100
+run general/parser/limit.sim
+sleep 100
+run general/parser/limit1.sim
+sleep 100
+run general/parser/limit1_tblocks100.sim
+sleep 100
+run general/parser/limit2.sim
+sleep 100
+run general/parser/mixed_blocks.sim
+sleep 100
+run general/parser/nchar.sim
+sleep 100
+run general/parser/null_char.sim
sleep 100
run general/parser/selectResNum.sim
sleep 100