提交 ea5597b3 编写于 作者: Y yihaoDeng

merge develop

...@@ -698,7 +698,7 @@ Query OK, 1 row(s) in set (0.001091s) ...@@ -698,7 +698,7 @@ Query OK, 1 row(s) in set (0.001091s)
- 输出结果缺省按首列时间戳升序排序,但可以指定按降序排序( _c0 指首列时间戳)。使用 ORDER BY 对其他字段进行排序为非法操作。 - 输出结果缺省按首列时间戳升序排序,但可以指定按降序排序( _c0 指首列时间戳)。使用 ORDER BY 对其他字段进行排序为非法操作。
- 参数 LIMIT 控制输出条数,OFFSET 指定从第几条开始输出。LIMIT/OFFSET 对结果集的执行顺序在 ORDER BY 之后。且 `LIMIT 5 OFFSET 2` 可以简写为 `LIMIT 2, 5`。 - 参数 LIMIT 控制输出条数,OFFSET 指定从第几条开始输出。LIMIT/OFFSET 对结果集的执行顺序在 ORDER BY 之后。且 `LIMIT 5 OFFSET 2` 可以简写为 `LIMIT 2, 5`。
* 在有 GROUP BY 子句的情况下,LIMIT 参数控制的是每个分组中至多允许输出的条数。 * 在有 GROUP BY 子句的情况下,LIMIT 参数控制的是每个分组中至多允许输出的条数。
- 参数 SLIMIT 控制由 GROUP BY 指令划分的分组中,至多允许输出几个分组的数据。且 `SLIMIT 5 OFFSET 2` 可以简写为 `SLIMIT 2, 5`。 - 参数 SLIMIT 控制由 GROUP BY 指令划分的分组中,至多允许输出几个分组的数据。且 `SLIMIT 5 SOFFSET 2` 可以简写为 `SLIMIT 2, 5`。
- 通过 “>>” 输出结果可以导出到指定文件。 - 通过 “>>” 输出结果可以导出到指定文件。
### 支持的条件过滤操作 ### 支持的条件过滤操作
...@@ -1342,7 +1342,7 @@ SELECT function_list FROM stb_name ...@@ -1342,7 +1342,7 @@ SELECT function_list FROM stb_name
- 在聚合查询中,function_list 位置允许使用聚合和选择函数,并要求每个函数仅输出单个结果(例如:COUNT、AVG、SUM、STDDEV、LEASTSQUARES、PERCENTILE、MIN、MAX、FIRST、LAST),而不能使用具有多行输出结果的函数(例如:TOP、BOTTOM、DIFF 以及四则运算)。 - 在聚合查询中,function_list 位置允许使用聚合和选择函数,并要求每个函数仅输出单个结果(例如:COUNT、AVG、SUM、STDDEV、LEASTSQUARES、PERCENTILE、MIN、MAX、FIRST、LAST),而不能使用具有多行输出结果的函数(例如:TOP、BOTTOM、DIFF 以及四则运算)。
- 查询过滤、聚合等操作按照每个切分窗口为独立的单位执行。聚合查询目前支持三种窗口的划分方式: - 查询过滤、聚合等操作按照每个切分窗口为独立的单位执行。聚合查询目前支持三种窗口的划分方式:
1. 时间窗口:聚合时间段的窗口宽度由关键词 INTERVAL 指定,最短时间间隔 10 毫秒(10a);并且支持偏移 offset(偏移必须小于间隔),也即时间窗口划分与“UTC 时刻 0”相比的偏移量。SLIDING 语句用于指定聚合时间段的前向增量,也即每次窗口向前滑动的时长。当 SLIDING 与 INTERVAL 取值相等的时候,滑动窗口即为翻转窗口。 1. 时间窗口:聚合时间段的窗口宽度由关键词 INTERVAL 指定,最短时间间隔 10 毫秒(10a);并且支持偏移 offset(偏移必须小于间隔),也即时间窗口划分与“UTC 时刻 0”相比的偏移量。SLIDING 语句用于指定聚合时间段的前向增量,也即每次窗口向前滑动的时长。当 SLIDING 与 INTERVAL 取值相等的时候,滑动窗口即为翻转窗口。
2. 状态窗口:使用整数(布尔值)或字符串来标识产生记录时设备的状态量,产生的记录如果具有相同的状态量取值则归属于同一个状态窗口,数值改变后该窗口关闭。状态量所对应的列作为 STAT_WINDOW 语句的参数来指定。 2. 状态窗口:使用整数(布尔值)或字符串来标识产生记录时设备的状态量,产生的记录如果具有相同的状态量取值则归属于同一个状态窗口,数值改变后该窗口关闭。状态量所对应的列作为 STATE_WINDOW 语句的参数来指定。
3. 会话窗口:时间戳所在的列由 SESSION 语句的 ts_col 参数指定,会话窗口根据相邻两条记录的时间戳差值来确定是否属于同一个会话——如果时间戳差异在 tol_val 以内,则认为记录仍属于同一个窗口;如果时间变化超过 tol_val,则自动开启下一个窗口。 3. 会话窗口:时间戳所在的列由 SESSION 语句的 ts_col 参数指定,会话窗口根据相邻两条记录的时间戳差值来确定是否属于同一个会话——如果时间戳差异在 tol_val 以内,则认为记录仍属于同一个窗口;如果时间变化超过 tol_val,则自动开启下一个窗口。
- WHERE 语句可以指定查询的起止时间和其他过滤条件。 - WHERE 语句可以指定查询的起止时间和其他过滤条件。
- FILL 语句指定某一窗口区间数据缺失的情况下的填充模式。填充模式包括以下几种: - FILL 语句指定某一窗口区间数据缺失的情况下的填充模式。填充模式包括以下几种:
......
...@@ -270,6 +270,13 @@ function install_jemalloc() { ...@@ -270,6 +270,13 @@ function install_jemalloc() {
${csudo} /usr/bin/install -c -d /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi fi
if [ -d /etc/ld.so.conf.d ]; then
${csudo} echo "/usr/local/lib" > /etc/ld.so.conf.d/jemalloc.conf
${csudo} ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
fi fi
} }
...@@ -783,7 +790,6 @@ function update_TDengine() { ...@@ -783,7 +790,6 @@ function update_TDengine() {
echo "File taos.tar.gz does not exist" echo "File taos.tar.gz does not exist"
exit 1 exit 1
fi fi
install_jemalloc
tar -zxf taos.tar.gz tar -zxf taos.tar.gz
install_jemalloc install_jemalloc
......
...@@ -165,6 +165,13 @@ function install_jemalloc() { ...@@ -165,6 +165,13 @@ function install_jemalloc() {
${csudo} /usr/bin/install -c -d /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi fi
if [ -d /etc/ld.so.conf.d ]; then
${csudo} echo "/usr/local/lib" > /etc/ld.so.conf.d/jemalloc.conf
${csudo} ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
fi fi
} }
......
...@@ -158,6 +158,13 @@ function install_jemalloc() { ...@@ -158,6 +158,13 @@ function install_jemalloc() {
${csudo} /usr/bin/install -c -d /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi fi
if [ -d /etc/ld.so.conf.d ]; then
${csudo} echo "/usr/local/lib" > /etc/ld.so.conf.d/jemalloc.conf
${csudo} ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
fi fi
} }
......
...@@ -182,6 +182,7 @@ function install_jemalloc() { ...@@ -182,6 +182,7 @@ function install_jemalloc() {
${csudo} /usr/bin/install -c -d /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi fi
${csudo} ldconfig
fi fi
} }
......
...@@ -182,6 +182,13 @@ function install_jemalloc() { ...@@ -182,6 +182,13 @@ function install_jemalloc() {
${csudo} /usr/bin/install -c -d /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi fi
if [ -d /etc/ld.so.conf.d ]; then
${csudo} echo "/usr/local/lib" > /etc/ld.so.conf.d/jemalloc.conf
${csudo} ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
fi fi
} }
...@@ -227,6 +234,7 @@ function update_PowerDB() { ...@@ -227,6 +234,7 @@ function update_PowerDB() {
exit 1 exit 1
fi fi
tar -zxf power.tar.gz tar -zxf power.tar.gz
install_jemalloc
echo -e "${GREEN}Start to update PowerDB client...${NC}" echo -e "${GREEN}Start to update PowerDB client...${NC}"
# Stop the client shell if running # Stop the client shell if running
...@@ -240,7 +248,6 @@ function update_PowerDB() { ...@@ -240,7 +248,6 @@ function update_PowerDB() {
install_log install_log
install_header install_header
install_lib install_lib
install_jemalloc
if [ "$pagMode" != "lite" ]; then if [ "$pagMode" != "lite" ]; then
install_connector install_connector
fi fi
......
...@@ -263,6 +263,13 @@ function install_jemalloc() { ...@@ -263,6 +263,13 @@ function install_jemalloc() {
${csudo} /usr/bin/install -c -d /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi fi
if [ -d /etc/ld.so.conf.d ]; then
${csudo} echo "/usr/local/lib" > /etc/ld.so.conf.d/jemalloc.conf
${csudo} ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
fi fi
} }
...@@ -752,7 +759,6 @@ function update_PowerDB() { ...@@ -752,7 +759,6 @@ function update_PowerDB() {
echo "File power.tar.gz does not exist" echo "File power.tar.gz does not exist"
exit 1 exit 1
fi fi
install_jemalloc
tar -zxf power.tar.gz tar -zxf power.tar.gz
install_jemalloc install_jemalloc
......
...@@ -270,6 +270,13 @@ function install_jemalloc() { ...@@ -270,6 +270,13 @@ function install_jemalloc() {
${csudo} /usr/bin/install -c -d /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -d /usr/local/share/man/man3
${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3 ${csudo} /usr/bin/install -c -m 644 ${jemalloc_dir}/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi fi
if [ -d /etc/ld.so.conf.d ]; then
${csudo} echo "/usr/local/lib" > /etc/ld.so.conf.d/jemalloc.conf
${csudo} ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
fi fi
} }
...@@ -752,7 +759,6 @@ function update_tq() { ...@@ -752,7 +759,6 @@ function update_tq() {
echo "File tq.tar.gz does not exist" echo "File tq.tar.gz does not exist"
exit 1 exit 1
fi fi
install_jemalloc
tar -zxf tq.tar.gz tar -zxf tq.tar.gz
install_jemalloc install_jemalloc
......
...@@ -176,6 +176,7 @@ function install_bin() { ...@@ -176,6 +176,7 @@ function install_bin() {
[ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/rmtaos || : [ -x ${install_main_dir}/bin/remove_client.sh ] && ${csudo} ln -s ${install_main_dir}/bin/remove_client.sh ${bin_link_dir}/rmtaos || :
fi fi
} }
function install_jemalloc() { function install_jemalloc() {
if [ "$osType" != "Darwin" ]; then if [ "$osType" != "Darwin" ]; then
/usr/bin/install -c -d /usr/local/bin /usr/bin/install -c -d /usr/local/bin
...@@ -217,6 +218,13 @@ function install_jemalloc() { ...@@ -217,6 +218,13 @@ function install_jemalloc() {
/usr/bin/install -c -d /usr/local/share/man/man3 /usr/bin/install -c -d /usr/local/share/man/man3
/usr/bin/install -c -m 644 ${binary_dir}/build/share/man/man3/jemalloc.3 /usr/local/share/man/man3 /usr/bin/install -c -m 644 ${binary_dir}/build/share/man/man3/jemalloc.3 /usr/local/share/man/man3
fi fi
if [ -d /etc/ld.so.conf.d ]; then
${csudo} echo "/usr/local/lib" > /etc/ld.so.conf.d/jemalloc.conf
${csudo} ldconfig
else
echo "/etc/ld.so.conf.d not found!"
fi
fi fi
} }
......
...@@ -188,7 +188,7 @@ int32_t tscGetResRowLength(SArray* pExprList); ...@@ -188,7 +188,7 @@ int32_t tscGetResRowLength(SArray* pExprList);
SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t index, int16_t functionId, SColumnIndex* pColIndex, int16_t type, SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t index, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t resColId, int16_t interSize, bool isTagCol); int16_t size, int16_t resColId, int16_t interSize, bool isTagCol);
SExprInfo* tscExprCreate(SQueryInfo* pQueryInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type, SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t resColId, int16_t interSize, int32_t colType); int16_t size, int16_t resColId, int16_t interSize, int32_t colType);
void tscExprAddParams(SSqlExpr* pExpr, char* argument, int32_t type, int32_t bytes); void tscExprAddParams(SSqlExpr* pExpr, char* argument, int32_t type, int32_t bytes);
......
此差异已折叠。
...@@ -693,7 +693,7 @@ void tscSetResRawPtrRv(SSqlRes* pRes, SQueryInfo* pQueryInfo, SSDataBlock* pBloc ...@@ -693,7 +693,7 @@ void tscSetResRawPtrRv(SSqlRes* pRes, SQueryInfo* pQueryInfo, SSDataBlock* pBloc
setResRawPtrImpl(pRes, pInfo, i, convertNchar); setResRawPtrImpl(pRes, pInfo, i, convertNchar);
/* /*
// generated the user-defined column result // generated the user-defined column result
if (pInfo->pExpr->pExpr == NULL && TSDB_COL_IS_UD_COL(pInfo->pExpr->base.colInfo.flag)) { if (pInfo->pExpr->pExpr == NULL && TSDB_COL_IS_UD_COL(pInfo->pExpr->base.ColName.flag)) {
if (pInfo->pExpr->base.param[1].nType == TSDB_DATA_TYPE_NULL) { if (pInfo->pExpr->base.param[1].nType == TSDB_DATA_TYPE_NULL) {
setNullN(pRes->urow[i], pInfo->field.type, pInfo->field.bytes, (int32_t) pRes->numOfRows); setNullN(pRes->urow[i], pInfo->field.type, pInfo->field.bytes, (int32_t) pRes->numOfRows);
} else { } else {
...@@ -2175,10 +2175,8 @@ void tscFieldInfoCopy(SFieldInfo* pFieldInfo, const SFieldInfo* pSrc, const SArr ...@@ -2175,10 +2175,8 @@ void tscFieldInfoCopy(SFieldInfo* pFieldInfo, const SFieldInfo* pSrc, const SArr
} }
SExprInfo* tscExprCreate(SQueryInfo* pQueryInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type, SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t resColId, int16_t interSize, int32_t colType) { int16_t size, int16_t resColId, int16_t interSize, int32_t colType) {
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, pColIndex->tableIndex);
SExprInfo* pExpr = calloc(1, sizeof(SExprInfo)); SExprInfo* pExpr = calloc(1, sizeof(SExprInfo));
if (pExpr == NULL) { if (pExpr == NULL) {
return NULL; return NULL;
...@@ -2202,19 +2200,20 @@ SExprInfo* tscExprCreate(SQueryInfo* pQueryInfo, int16_t functionId, SColumnInde ...@@ -2202,19 +2200,20 @@ SExprInfo* tscExprCreate(SQueryInfo* pQueryInfo, int16_t functionId, SColumnInde
p->colBytes = TSDB_MAX_BINARY_LEN; p->colBytes = TSDB_MAX_BINARY_LEN;
p->colType = TSDB_DATA_TYPE_BINARY; p->colType = TSDB_DATA_TYPE_BINARY;
} else { } else {
int32_t len = tListLen(p->colInfo.name);
if (TSDB_COL_IS_TAG(colType)) { if (TSDB_COL_IS_TAG(colType)) {
SSchema* pSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); SSchema* pSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta);
p->colInfo.colId = pSchema[pColIndex->columnIndex].colId; p->colInfo.colId = pSchema[pColIndex->columnIndex].colId;
p->colBytes = pSchema[pColIndex->columnIndex].bytes; p->colBytes = pSchema[pColIndex->columnIndex].bytes;
p->colType = pSchema[pColIndex->columnIndex].type; p->colType = pSchema[pColIndex->columnIndex].type;
tstrncpy(p->colInfo.name, pSchema[pColIndex->columnIndex].name, sizeof(p->colInfo.name)); snprintf(p->colInfo.name, len, "%s.%s", pTableMetaInfo->aliasName, pSchema[pColIndex->columnIndex].name);
} else if (pTableMetaInfo->pTableMeta != NULL) { } else if (pTableMetaInfo->pTableMeta != NULL) {
// in handling select database/version/server_status(), the pTableMeta is NULL // in handling select database/version/server_status(), the pTableMeta is NULL
SSchema* pSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, pColIndex->columnIndex); SSchema* pSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, pColIndex->columnIndex);
p->colInfo.colId = pSchema->colId; p->colInfo.colId = pSchema->colId;
p->colBytes = pSchema->bytes; p->colBytes = pSchema->bytes;
p->colType = pSchema->type; p->colType = pSchema->type;
tstrncpy(p->colInfo.name, pSchema->name, sizeof(p->colInfo.name)); snprintf(p->colInfo.name, len, "%s.%s", pTableMetaInfo->aliasName, pSchema->name);
} }
} }
...@@ -2240,14 +2239,16 @@ SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t index, int16_t function ...@@ -2240,14 +2239,16 @@ SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t index, int16_t function
return tscExprAppend(pQueryInfo, functionId, pColIndex, type, size, resColId, interSize, isTagCol); return tscExprAppend(pQueryInfo, functionId, pColIndex, type, size, resColId, interSize, isTagCol);
} }
SExprInfo* pExpr = tscExprCreate(pQueryInfo, functionId, pColIndex, type, size, resColId, interSize, isTagCol); STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, pColIndex->tableIndex);
SExprInfo* pExpr = tscExprCreate(pTableMetaInfo, functionId, pColIndex, type, size, resColId, interSize, isTagCol);
taosArrayInsert(pQueryInfo->exprList, index, &pExpr); taosArrayInsert(pQueryInfo->exprList, index, &pExpr);
return pExpr; return pExpr;
} }
SExprInfo* tscExprAppend(SQueryInfo* pQueryInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type, SExprInfo* tscExprAppend(SQueryInfo* pQueryInfo, int16_t functionId, SColumnIndex* pColIndex, int16_t type,
int16_t size, int16_t resColId, int16_t interSize, bool isTagCol) { int16_t size, int16_t resColId, int16_t interSize, bool isTagCol) {
SExprInfo* pExpr = tscExprCreate(pQueryInfo, functionId, pColIndex, type, size, resColId, interSize, isTagCol); STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, pColIndex->tableIndex);
SExprInfo* pExpr = tscExprCreate(pTableMetaInfo, functionId, pColIndex, type, size, resColId, interSize, isTagCol);
taosArrayPush(pQueryInfo->exprList, &pExpr); taosArrayPush(pQueryInfo->exprList, &pExpr);
return pExpr; return pExpr;
} }
......
...@@ -46,7 +46,7 @@ typedef struct SSqlExpr { ...@@ -46,7 +46,7 @@ typedef struct SSqlExpr {
char aliasName[TSDB_COL_NAME_LEN]; // as aliasName char aliasName[TSDB_COL_NAME_LEN]; // as aliasName
char token[TSDB_COL_NAME_LEN]; // original token char token[TSDB_COL_NAME_LEN]; // original token
SColIndex colInfo; SColIndex colInfo;
uint64_t uid; // refactor use the pointer uint64_t uid; // table uid, todo refactor use the pointer
int16_t functionId; // function id in aAgg array int16_t functionId; // function id in aAgg array
......
...@@ -180,15 +180,15 @@ int8_t tsEnableStream = 1; ...@@ -180,15 +180,15 @@ int8_t tsEnableStream = 1;
int8_t tsCompactMnodeWal = 0; int8_t tsCompactMnodeWal = 0;
int8_t tsPrintAuth = 0; int8_t tsPrintAuth = 0;
int8_t tscEmbedded = 0; int8_t tscEmbedded = 0;
char configDir[TSDB_FILENAME_LEN] = {0}; char configDir[PATH_MAX] = {0};
char tsVnodeDir[TSDB_FILENAME_LEN] = {0}; char tsVnodeDir[PATH_MAX] = {0};
char tsDnodeDir[TSDB_FILENAME_LEN] = {0}; char tsDnodeDir[PATH_MAX] = {0};
char tsMnodeDir[TSDB_FILENAME_LEN] = {0}; char tsMnodeDir[PATH_MAX] = {0};
char tsMnodeTmpDir[TSDB_FILENAME_LEN] = {0}; char tsMnodeTmpDir[PATH_MAX] = {0};
char tsMnodeBakDir[TSDB_FILENAME_LEN] = {0}; char tsMnodeBakDir[PATH_MAX] = {0};
char tsDataDir[TSDB_FILENAME_LEN] = {0}; char tsDataDir[PATH_MAX] = {0};
char tsScriptDir[TSDB_FILENAME_LEN] = {0}; char tsScriptDir[PATH_MAX] = {0};
char tsTempDir[TSDB_FILENAME_LEN] = "/tmp/"; char tsTempDir[PATH_MAX] = "/tmp/";
int32_t tsDiskCfgNum = 0; int32_t tsDiskCfgNum = 0;
......
...@@ -405,7 +405,7 @@ typedef struct SColIndex { ...@@ -405,7 +405,7 @@ typedef struct SColIndex {
int16_t colId; // column id int16_t colId; // column id
int16_t colIndex; // column index in colList if it is a normal column or index in tagColList if a tag int16_t colIndex; // column index in colList if it is a normal column or index in tagColList if a tag
uint16_t flag; // denote if it is a tag or a normal column uint16_t flag; // denote if it is a tag or a normal column
char name[TSDB_COL_NAME_LEN]; // TODO remove it char name[TSDB_COL_NAME_LEN + TSDB_DB_NAME_LEN + 1];
} SColIndex; } SColIndex;
typedef struct SColumnFilterInfo { typedef struct SColumnFilterInfo {
......
...@@ -3216,6 +3216,13 @@ static int readTagFromCsvFileToMem(SSuperTable * superTblInfo) { ...@@ -3216,6 +3216,13 @@ static int readTagFromCsvFileToMem(SSuperTable * superTblInfo) {
return 0; return 0;
} }
#if 0
int readSampleFromJsonFileToMem(SSuperTable * superTblInfo) {
// TODO
return 0;
}
#endif
/* /*
Read 10000 lines at most. If more than 10000 lines, continue to read after using Read 10000 lines at most. If more than 10000 lines, continue to read after using
*/ */
...@@ -5331,7 +5338,7 @@ static int64_t generateInterlaceDataWithoutStb( ...@@ -5331,7 +5338,7 @@ static int64_t generateInterlaceDataWithoutStb(
#if STMT_IFACE_ENABLED == 1 #if STMT_IFACE_ENABLED == 1
static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
char *dataType, int32_t dataLen, char **ptr, char *value) char *dataType, int32_t dataLen, char **ptr)
{ {
if (0 == strncasecmp(dataType, if (0 == strncasecmp(dataType,
"BINARY", strlen("BINARY"))) { "BINARY", strlen("BINARY"))) {
...@@ -5341,18 +5348,12 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, ...@@ -5341,18 +5348,12 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
return -1; return -1;
} }
char *bind_binary = (char *)*ptr; char *bind_binary = (char *)*ptr;
rand_string(bind_binary, dataLen);
bind->buffer_type = TSDB_DATA_TYPE_BINARY; bind->buffer_type = TSDB_DATA_TYPE_BINARY;
if (value) {
strncpy(bind_binary, value, strlen(value));
bind->buffer_length = strlen(bind_binary);
} else {
rand_string(bind_binary, dataLen);
bind->buffer_length = dataLen; bind->buffer_length = dataLen;
}
bind->length = &bind->buffer_length;
bind->buffer = bind_binary; bind->buffer = bind_binary;
bind->length = &bind->buffer_length;
bind->is_null = NULL; bind->is_null = NULL;
*ptr += bind->buffer_length; *ptr += bind->buffer_length;
...@@ -5364,14 +5365,9 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, ...@@ -5364,14 +5365,9 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
return -1; return -1;
} }
char *bind_nchar = (char *)*ptr; char *bind_nchar = (char *)*ptr;
bind->buffer_type = TSDB_DATA_TYPE_NCHAR;
if (value) {
strncpy(bind_nchar, value, strlen(value));
} else {
rand_string(bind_nchar, dataLen); rand_string(bind_nchar, dataLen);
}
bind->buffer_type = TSDB_DATA_TYPE_NCHAR;
bind->buffer_length = strlen(bind_nchar); bind->buffer_length = strlen(bind_nchar);
bind->buffer = bind_nchar; bind->buffer = bind_nchar;
bind->length = &bind->buffer_length; bind->length = &bind->buffer_length;
...@@ -5382,11 +5378,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, ...@@ -5382,11 +5378,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
"INT", strlen("INT"))) { "INT", strlen("INT"))) {
int32_t *bind_int = (int32_t *)*ptr; int32_t *bind_int = (int32_t *)*ptr;
if (value) {
*bind_int = atoi(value);
} else {
*bind_int = rand_int(); *bind_int = rand_int();
}
bind->buffer_type = TSDB_DATA_TYPE_INT; bind->buffer_type = TSDB_DATA_TYPE_INT;
bind->buffer_length = sizeof(int32_t); bind->buffer_length = sizeof(int32_t);
bind->buffer = bind_int; bind->buffer = bind_int;
...@@ -5398,11 +5390,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, ...@@ -5398,11 +5390,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
"BIGINT", strlen("BIGINT"))) { "BIGINT", strlen("BIGINT"))) {
int64_t *bind_bigint = (int64_t *)*ptr; int64_t *bind_bigint = (int64_t *)*ptr;
if (value) {
*bind_bigint = atoll(value);
} else {
*bind_bigint = rand_bigint(); *bind_bigint = rand_bigint();
}
bind->buffer_type = TSDB_DATA_TYPE_BIGINT; bind->buffer_type = TSDB_DATA_TYPE_BIGINT;
bind->buffer_length = sizeof(int64_t); bind->buffer_length = sizeof(int64_t);
bind->buffer = bind_bigint; bind->buffer = bind_bigint;
...@@ -5414,11 +5402,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, ...@@ -5414,11 +5402,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
"FLOAT", strlen("FLOAT"))) { "FLOAT", strlen("FLOAT"))) {
float *bind_float = (float *) *ptr; float *bind_float = (float *) *ptr;
if (value) {
*bind_float = (float)atof(value);
} else {
*bind_float = rand_float(); *bind_float = rand_float();
}
bind->buffer_type = TSDB_DATA_TYPE_FLOAT; bind->buffer_type = TSDB_DATA_TYPE_FLOAT;
bind->buffer_length = sizeof(float); bind->buffer_length = sizeof(float);
bind->buffer = bind_float; bind->buffer = bind_float;
...@@ -5430,11 +5414,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, ...@@ -5430,11 +5414,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
"DOUBLE", strlen("DOUBLE"))) { "DOUBLE", strlen("DOUBLE"))) {
double *bind_double = (double *)*ptr; double *bind_double = (double *)*ptr;
if (value) {
*bind_double = atof(value);
} else {
*bind_double = rand_double(); *bind_double = rand_double();
}
bind->buffer_type = TSDB_DATA_TYPE_DOUBLE; bind->buffer_type = TSDB_DATA_TYPE_DOUBLE;
bind->buffer_length = sizeof(double); bind->buffer_length = sizeof(double);
bind->buffer = bind_double; bind->buffer = bind_double;
...@@ -5446,11 +5426,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, ...@@ -5446,11 +5426,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
"SMALLINT", strlen("SMALLINT"))) { "SMALLINT", strlen("SMALLINT"))) {
int16_t *bind_smallint = (int16_t *)*ptr; int16_t *bind_smallint = (int16_t *)*ptr;
if (value) {
*bind_smallint = (int16_t)atoi(value);
} else {
*bind_smallint = rand_smallint(); *bind_smallint = rand_smallint();
}
bind->buffer_type = TSDB_DATA_TYPE_SMALLINT; bind->buffer_type = TSDB_DATA_TYPE_SMALLINT;
bind->buffer_length = sizeof(int16_t); bind->buffer_length = sizeof(int16_t);
bind->buffer = bind_smallint; bind->buffer = bind_smallint;
...@@ -5462,11 +5438,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, ...@@ -5462,11 +5438,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
"TINYINT", strlen("TINYINT"))) { "TINYINT", strlen("TINYINT"))) {
int8_t *bind_tinyint = (int8_t *)*ptr; int8_t *bind_tinyint = (int8_t *)*ptr;
if (value) {
*bind_tinyint = (int8_t)atoi(value);
} else {
*bind_tinyint = rand_tinyint(); *bind_tinyint = rand_tinyint();
}
bind->buffer_type = TSDB_DATA_TYPE_TINYINT; bind->buffer_type = TSDB_DATA_TYPE_TINYINT;
bind->buffer_length = sizeof(int8_t); bind->buffer_length = sizeof(int8_t);
bind->buffer = bind_tinyint; bind->buffer = bind_tinyint;
...@@ -5489,11 +5461,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind, ...@@ -5489,11 +5461,7 @@ static int32_t prepareStmtBindArrayByType(TAOS_BIND *bind,
"TIMESTAMP", strlen("TIMESTAMP"))) { "TIMESTAMP", strlen("TIMESTAMP"))) {
int64_t *bind_ts2 = (int64_t *) *ptr; int64_t *bind_ts2 = (int64_t *) *ptr;
if (value) {
*bind_ts2 = atoll(value);
} else {
*bind_ts2 = rand_bigint(); *bind_ts2 = rand_bigint();
}
bind->buffer_type = TSDB_DATA_TYPE_TIMESTAMP; bind->buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
bind->buffer_length = sizeof(int64_t); bind->buffer_length = sizeof(int64_t);
bind->buffer = bind_ts2; bind->buffer = bind_ts2;
...@@ -5559,13 +5527,12 @@ static int32_t prepareStmtWithoutStb( ...@@ -5559,13 +5527,12 @@ static int32_t prepareStmtWithoutStb(
ptr += bind->buffer_length; ptr += bind->buffer_length;
for (int i = 0; i < g_args.num_of_CPR; i ++) { for (int i = 0; i < g_args.num_of_CPR; i ++) {
bind = (TAOS_BIND *)((char *)bindArray bind = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * (i + 1)));
+ (sizeof(TAOS_BIND) * (i + 1)));
if ( -1 == prepareStmtBindArrayByType( if ( -1 == prepareStmtBindArrayByType(
bind, bind,
data_type[i], data_type[i],
g_args.len_of_binary, g_args.len_of_binary,
&ptr, NULL)) { &ptr)) {
return -1; return -1;
} }
} }
...@@ -5584,14 +5551,12 @@ static int32_t prepareStmtWithoutStb( ...@@ -5584,14 +5551,12 @@ static int32_t prepareStmtWithoutStb(
return k; return k;
} }
static int32_t prepareStbStmt( static int32_t prepareStbStmt(SSuperTable *stbInfo,
SSuperTable *stbInfo,
TAOS_STMT *stmt, TAOS_STMT *stmt,
char *tableName, uint32_t batch, char *tableName, uint32_t batch,
uint64_t insertRows, uint64_t insertRows,
uint64_t recordFrom, uint64_t recordFrom,
int64_t startTime, int64_t startTime, char *buffer)
int64_t *pSamplePos)
{ {
int ret = taos_stmt_set_tbname(stmt, tableName); int ret = taos_stmt_set_tbname(stmt, tableName);
if (ret != 0) { if (ret != 0) {
...@@ -5602,24 +5567,16 @@ static int32_t prepareStbStmt( ...@@ -5602,24 +5567,16 @@ static int32_t prepareStbStmt(
char *bindArray = malloc(sizeof(TAOS_BIND) * (stbInfo->columnCount + 1)); char *bindArray = malloc(sizeof(TAOS_BIND) * (stbInfo->columnCount + 1));
if (bindArray == NULL) { if (bindArray == NULL) {
errorPrint("%s() LN%d, Failed to allocate %d bind params\n", errorPrint("Failed to allocate %d bind params\n",
__func__, __LINE__, (stbInfo->columnCount + 1)); (stbInfo->columnCount + 1));
return -1; return -1;
} }
bool sourceRand; bool tsRand;
if (0 == strncasecmp(stbInfo->dataSource, "rand", strlen("rand"))) { if (0 == strncasecmp(stbInfo->dataSource, "rand", strlen("rand"))) {
sourceRand = true; tsRand = true;
} else { } else {
sourceRand = false; // from sample data file tsRand = false;
}
char *bindBuffer = malloc(g_args.len_of_binary);
if (bindBuffer == NULL) {
errorPrint("%s() LN%d, Failed to allocate %d bind buffer\n",
__func__, __LINE__, g_args.len_of_binary);
free(bindArray);
return -1;
} }
uint32_t k; uint32_t k;
...@@ -5635,7 +5592,7 @@ static int32_t prepareStbStmt( ...@@ -5635,7 +5592,7 @@ static int32_t prepareStbStmt(
bind_ts = (int64_t *)ptr; bind_ts = (int64_t *)ptr;
bind->buffer_type = TSDB_DATA_TYPE_TIMESTAMP; bind->buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
if (sourceRand) { if (tsRand) {
*bind_ts = startTime + getTSRandTail( *bind_ts = startTime + getTSRandTail(
stbInfo->timeStampStep, k, stbInfo->timeStampStep, k,
stbInfo->disorderRatio, stbInfo->disorderRatio,
...@@ -5650,64 +5607,27 @@ static int32_t prepareStbStmt( ...@@ -5650,64 +5607,27 @@ static int32_t prepareStbStmt(
ptr += bind->buffer_length; ptr += bind->buffer_length;
int cursor = 0;
for (int i = 0; i < stbInfo->columnCount; i ++) { for (int i = 0; i < stbInfo->columnCount; i ++) {
bind = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * (i + 1))); bind = (TAOS_BIND *)((char *)bindArray + (sizeof(TAOS_BIND) * (i + 1)));
if (sourceRand) {
if ( -1 == prepareStmtBindArrayByType(
bind,
stbInfo->columns[i].dataType,
stbInfo->columns[i].dataLen,
&ptr,
NULL)) {
free(bindArray);
free(bindBuffer);
return -1;
}
} else {
char *restStr = stbInfo->sampleDataBuf + cursor;
int lengthOfRest = strlen(restStr);
int index = 0;
for (index = 0; index < lengthOfRest; index ++) {
if (restStr[index] == ',') {
break;
}
}
memset(bindBuffer, 0, g_args.len_of_binary);
strncpy(bindBuffer, restStr, index);
cursor += index + 1; // skip ',' too
if ( -1 == prepareStmtBindArrayByType( if ( -1 == prepareStmtBindArrayByType(
bind, bind,
stbInfo->columns[i].dataType, stbInfo->columns[i].dataType,
stbInfo->columns[i].dataLen, stbInfo->columns[i].dataLen,
&ptr, &ptr)) {
bindBuffer)) {
free(bindArray);
free(bindBuffer);
return -1; return -1;
} }
} }
}
taos_stmt_bind_param(stmt, (TAOS_BIND *)bindArray); taos_stmt_bind_param(stmt, (TAOS_BIND *)bindArray);
// if msg > 3MB, break // if msg > 3MB, break
taos_stmt_add_batch(stmt); taos_stmt_add_batch(stmt);
k++; k++;
recordFrom ++; recordFrom ++;
if (!sourceRand) {
(*pSamplePos) ++;
}
if (recordFrom >= insertRows) { if (recordFrom >= insertRows) {
break; break;
} }
} }
free(bindBuffer);
free(bindArray); free(bindArray);
return k; return k;
} }
...@@ -5900,14 +5820,13 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) { ...@@ -5900,14 +5820,13 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
if (superTblInfo) { if (superTblInfo) {
if (superTblInfo->iface == STMT_IFACE) { if (superTblInfo->iface == STMT_IFACE) {
#if STMT_IFACE_ENABLED == 1 #if STMT_IFACE_ENABLED == 1
generated = prepareStbStmt( generated = prepareStbStmt(superTblInfo,
superTblInfo,
pThreadInfo->stmt, pThreadInfo->stmt,
tableName, tableName,
batchPerTbl, batchPerTbl,
insertRows, i, insertRows, i,
startTime, startTime,
&(pThreadInfo->samplePos)); pThreadInfo->buffer);
#else #else
generated = -1; generated = -1;
#endif #endif
...@@ -6132,8 +6051,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) { ...@@ -6132,8 +6051,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
pThreadInfo->stmt, pThreadInfo->stmt,
tableName, tableName,
g_args.num_of_RPR, g_args.num_of_RPR,
insertRows, i, start_time, insertRows, i, start_time, pstr);
&(pThreadInfo->samplePos));
#else #else
generated = -1; generated = -1;
#endif #endif
......
...@@ -226,15 +226,16 @@ static struct argp_option options[] = { ...@@ -226,15 +226,16 @@ static struct argp_option options[] = {
{"schemaonly", 's', 0, 0, "Only dump schema.", 2}, {"schemaonly", 's', 0, 0, "Only dump schema.", 2},
{"without-property", 'N', 0, 0, "Dump schema without properties.", 2}, {"without-property", 'N', 0, 0, "Dump schema without properties.", 2},
{"avro", 'V', 0, 0, "Dump apache avro format data file. By default, dump sql command sequence.", 2}, {"avro", 'V', 0, 0, "Dump apache avro format data file. By default, dump sql command sequence.", 2},
{"start-time", 'S', "START_TIME", 0, "Start time to dump. Either Epoch or ISO8601/RFC3339 format is acceptable. Epoch precision millisecond. ISO8601 format example: 2017-10-01T18:00:00.000+0800 or 2017-10-0100:00:00.000+0800 or '2017-10-01 00:00:00.000+0800'", 3}, {"start-time", 'S', "START_TIME", 0, "Start time to dump. Either epoch or ISO8601/RFC3339 format is acceptable. ISO8601 format example: 2017-10-01T18:00:00.000+0800 or 2017-10-0100:00:00.000+0800 or '2017-10-01 00:00:00.000+0800'", 4},
{"end-time", 'E', "END_TIME", 0, "End time to dump. Either Epoch or ISO8601/RFC3339 format is acceptable. Epoch precision millisecond. ISO8601 format example: 2017-10-01T18:00:00.000+0800 or 2017-10-0100:00:00.000+0800 or '2017-10-01 00:00:00.000+0800'", 3}, {"end-time", 'E', "END_TIME", 0, "End time to dump. Either epoch or ISO8601/RFC3339 format is acceptable. ISO8601 format example: 2017-10-01T18:00:00.000+0800 or 2017-10-0100:00:00.000+0800 or '2017-10-01 00:00:00.000+0800'", 5},
{"precision", 'C', "PRECISION", 0, "Epoch precision. Valid value is one of ms, us, and ns. Default is ms.", 6},
{"data-batch", 'B', "DATA_BATCH", 0, "Number of data point per insert statement. Max value is 32766. Default is 1.", 3}, {"data-batch", 'B', "DATA_BATCH", 0, "Number of data point per insert statement. Max value is 32766. Default is 1.", 3},
{"max-sql-len", 'L', "SQL_LEN", 0, "Max length of one sql. Default is 65480.", 3}, {"max-sql-len", 'L', "SQL_LEN", 0, "Max length of one sql. Default is 65480.", 3},
{"table-batch", 't', "TABLE_BATCH", 0, "Number of table dumpout into one output file. Default is 1.", 3}, {"table-batch", 't', "TABLE_BATCH", 0, "Number of table dumpout into one output file. Default is 1.", 3},
{"thread_num", 'T', "THREAD_NUM", 0, "Number of thread for dump in file. Default is 5.", 3}, {"thread_num", 'T', "THREAD_NUM", 0, "Number of thread for dump in file. Default is 5.", 3},
{"debug", 'g', 0, 0, "Print debug info.", 4}, {"debug", 'g', 0, 0, "Print debug info.", 8},
{"verbose", 'b', 0, 0, "Print verbose debug info.", 5}, {"verbose", 'b', 0, 0, "Print verbose debug info.", 9},
{"performanceprint", 'm', 0, 0, "Print performance debug info.", 5}, {"performanceprint", 'm', 0, 0, "Print performance debug info.", 10},
{0} {0}
}; };
...@@ -262,6 +263,7 @@ typedef struct arguments { ...@@ -262,6 +263,7 @@ typedef struct arguments {
bool avro; bool avro;
int64_t start_time; int64_t start_time;
int64_t end_time; int64_t end_time;
char precision[8];
int32_t data_batch; int32_t data_batch;
int32_t max_sql_len; int32_t max_sql_len;
int32_t table_batch; // num of table which will be dump into one output file. int32_t table_batch; // num of table which will be dump into one output file.
...@@ -329,8 +331,9 @@ struct arguments g_args = { ...@@ -329,8 +331,9 @@ struct arguments g_args = {
false, // schemeonly false, // schemeonly
true, // with_property true, // with_property
false, // avro format false, // avro format
0, // start_time -INT64_MAX, // start_time
INT64_MAX, // end_time INT64_MAX, // end_time
"ms", // precision
1, // data_batch 1, // data_batch
TSDB_MAX_SQL_LEN, // max_sql_len TSDB_MAX_SQL_LEN, // max_sql_len
1, // table_batch 1, // table_batch
...@@ -508,18 +511,72 @@ static int queryDbImpl(TAOS *taos, char *command) { ...@@ -508,18 +511,72 @@ static int queryDbImpl(TAOS *taos, char *command) {
return 0; return 0;
} }
static void parse_args(int argc, char *argv[], SArguments *arguments) { static void parse_precision_first(
int argc, char *argv[], SArguments *arguments) {
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-C") == 0) {
if (NULL == argv[i+1]) {
errorPrint("%s need a valid value following!\n", argv[i]);
exit(-1);
}
char *tmp = strdup(argv[i+1]);
if (tmp == NULL) {
errorPrint("%s() LN%d, strdup() cannot allocate memory\n",
__func__, __LINE__);
exit(-1);
}
if ((0 != strncasecmp(tmp, "ms", strlen("ms")))
&& (0 != strncasecmp(tmp, "us", strlen("us")))
&& (0 != strncasecmp(tmp, "ns", strlen("ns")))) {
//
errorPrint("input precision: %s is invalid value\n", tmp);
free(tmp);
exit(-1);
}
strncpy(g_args.precision, tmp, strlen(tmp));
free(tmp);
}
}
}
static void parse_timestamp(
int argc, char *argv[], SArguments *arguments) {
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
if ((strcmp(argv[i], "-S") == 0) if ((strcmp(argv[i], "-S") == 0)
|| (strcmp(argv[i], "-E") == 0)) { || (strcmp(argv[i], "-E") == 0)) {
if (argv[i+1]) { if (NULL == argv[i+1]) {
char *tmp = strdup(argv[++i]); errorPrint("%s need a valid value following!\n", argv[i]);
exit(-1);
}
char *tmp = strdup(argv[i+1]);
if (NULL == tmp) {
errorPrint("%s() LN%d, strdup() cannot allocate memory\n",
__func__, __LINE__);
exit(-1);
}
if (tmp) {
int64_t tmpEpoch; int64_t tmpEpoch;
if (strchr(tmp, ':') && strchr(tmp, '-')) { if (strchr(tmp, ':') && strchr(tmp, '-')) {
int32_t timePrec;
if (0 == strncasecmp(arguments->precision,
"ms", strlen("ms"))) {
timePrec = TSDB_TIME_PRECISION_MILLI;
} else if (0 == strncasecmp(arguments->precision,
"us", strlen("us"))) {
timePrec = TSDB_TIME_PRECISION_MICRO;
} else if (0 == strncasecmp(arguments->precision,
"ns", strlen("ns"))) {
timePrec = TSDB_TIME_PRECISION_NANO;
} else {
errorPrint("Invalid time precision: %s",
arguments->precision);
free(tmp);
return;
}
if (TSDB_CODE_SUCCESS != taosParseTime( if (TSDB_CODE_SUCCESS != taosParseTime(
tmp, &tmpEpoch, strlen(tmp), TSDB_TIME_PRECISION_MILLI, 0)) { tmp, &tmpEpoch, strlen(tmp),
timePrec, 0)) {
errorPrint("Input %s, end time error!\n", tmp); errorPrint("Input %s, end time error!\n", tmp);
free(tmp); free(tmp);
return; return;
...@@ -531,18 +588,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) { ...@@ -531,18 +588,7 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
sprintf(argv[i], "%"PRId64"", tmpEpoch); sprintf(argv[i], "%"PRId64"", tmpEpoch);
debugPrint("%s() LN%d, tmp is: %s, argv[%d]: %s\n", debugPrint("%s() LN%d, tmp is: %s, argv[%d]: %s\n",
__func__, __LINE__, tmp, i, argv[i]); __func__, __LINE__, tmp, i, argv[i]);
free(tmp); free(tmp);
} else {
errorPrint("%s() LN%d, strdup() cannot allocate memory\n", __func__, __LINE__);
exit(-1);
}
} else {
errorPrint("%s need a valid value following!\n", argv[i]);
exit(-1);
}
} else if (strcmp(argv[i], "-g") == 0) {
g_args.debug_print = true;
} }
} }
} }
...@@ -552,8 +598,10 @@ int main(int argc, char *argv[]) { ...@@ -552,8 +598,10 @@ int main(int argc, char *argv[]) {
int ret = 0; int ret = 0;
/* Parse our arguments; every option seen by parse_opt will be /* Parse our arguments; every option seen by parse_opt will be
reflected in arguments. */ reflected in arguments. */
if (argc > 2) if (argc > 2) {
parse_args(argc, argv, &g_args); parse_precision_first(argc, argv, &g_args);
parse_timestamp(argc, argv, &g_args);
}
argp_parse(&argp, argc, argv, 0, 0, &g_args); argp_parse(&argp, argc, argv, 0, 0, &g_args);
...@@ -584,6 +632,7 @@ int main(int argc, char *argv[]) { ...@@ -584,6 +632,7 @@ int main(int argc, char *argv[]) {
printf("avro format: %s\n", g_args.avro?"true":"false"); printf("avro format: %s\n", g_args.avro?"true":"false");
printf("start_time: %" PRId64 "\n", g_args.start_time); printf("start_time: %" PRId64 "\n", g_args.start_time);
printf("end_time: %" PRId64 "\n", g_args.end_time); printf("end_time: %" PRId64 "\n", g_args.end_time);
printf("precision: %s\n", g_args.precision);
printf("data_batch: %d\n", g_args.data_batch); printf("data_batch: %d\n", g_args.data_batch);
printf("max_sql_len: %d\n", g_args.max_sql_len); printf("max_sql_len: %d\n", g_args.max_sql_len);
printf("table_batch: %d\n", g_args.table_batch); printf("table_batch: %d\n", g_args.table_batch);
...@@ -634,6 +683,7 @@ int main(int argc, char *argv[]) { ...@@ -634,6 +683,7 @@ int main(int argc, char *argv[]) {
fprintf(g_fpOfResult, "avro format: %s\n", g_args.avro?"true":"false"); fprintf(g_fpOfResult, "avro format: %s\n", g_args.avro?"true":"false");
fprintf(g_fpOfResult, "start_time: %" PRId64 "\n", g_args.start_time); fprintf(g_fpOfResult, "start_time: %" PRId64 "\n", g_args.start_time);
fprintf(g_fpOfResult, "end_time: %" PRId64 "\n", g_args.end_time); fprintf(g_fpOfResult, "end_time: %" PRId64 "\n", g_args.end_time);
fprintf(g_fpOfResult, "precision: %s\n", g_args.precision);
fprintf(g_fpOfResult, "data_batch: %d\n", g_args.data_batch); fprintf(g_fpOfResult, "data_batch: %d\n", g_args.data_batch);
fprintf(g_fpOfResult, "max_sql_len: %d\n", g_args.max_sql_len); fprintf(g_fpOfResult, "max_sql_len: %d\n", g_args.max_sql_len);
fprintf(g_fpOfResult, "table_batch: %d\n", g_args.table_batch); fprintf(g_fpOfResult, "table_batch: %d\n", g_args.table_batch);
......
...@@ -1036,6 +1036,20 @@ static int32_t mnodeCreateSuperTableCb(SMnodeMsg *pMsg, int32_t code) { ...@@ -1036,6 +1036,20 @@ static int32_t mnodeCreateSuperTableCb(SMnodeMsg *pMsg, int32_t code) {
return code; return code;
} }
static uint64_t mnodeCreateSuperTableUid() {
int64_t us = taosGetTimestampUs();
uint64_t x = (us & ((((uint64_t)1)<<40) - 1));
x = x << 24;
return x + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul));
}
static uint64_t mnodeCreateTableUid(int32_t vgId, int32_t tid) {
uint64_t uid = (((uint64_t)vgId) << 48) + ((((uint64_t)tid) & ((1ul << 24) - 1ul)) << 24) +
((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul));
return uid;
}
static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) { static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
if (pMsg == NULL) return TSDB_CODE_MND_APP_ERROR; if (pMsg == NULL) return TSDB_CODE_MND_APP_ERROR;
...@@ -1065,15 +1079,10 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) { ...@@ -1065,15 +1079,10 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
return TSDB_CODE_MND_OUT_OF_MEMORY; return TSDB_CODE_MND_OUT_OF_MEMORY;
} }
int64_t us = taosGetTimestampUs();
pStable->info.tableId = strdup(pCreate->tableName); pStable->info.tableId = strdup(pCreate->tableName);
pStable->info.type = TSDB_SUPER_TABLE; pStable->info.type = TSDB_SUPER_TABLE;
pStable->createdTime = taosGetTimestampMs(); pStable->createdTime = taosGetTimestampMs();
pStable->uid = mnodeCreateSuperTableUid();
uint64_t x = (us & ((((uint64_t)1)<<40) - 1)); // todo refactor
x = x << 24;
pStable->uid = x + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul));
pStable->sversion = 0; pStable->sversion = 0;
pStable->tversion = 0; pStable->tversion = 0;
pStable->numOfColumns = numOfColumns; pStable->numOfColumns = numOfColumns;
...@@ -2076,20 +2085,13 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { ...@@ -2076,20 +2085,13 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
} }
pTable->suid = pMsg->pSTable->uid; pTable->suid = pMsg->pSTable->uid;
pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->tid) & ((1ul << 24) - 1ul)) << 24) + pTable->uid = mnodeCreateTableUid(pTable->vgId, pTable->tid);
((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul));
pTable->superTable = pMsg->pSTable; pTable->superTable = pMsg->pSTable;
} else { } else {
if (pTable->info.type == TSDB_SUPER_TABLE) { if (pTable->info.type == TSDB_SUPER_TABLE) {
uint64_t us = (uint64_t) taosGetTimestampUs(); pTable->uid = mnodeCreateSuperTableUid();
uint64_t x = (us & ((((uint64_t)1)<<40) - 1));
x = x << 24;
pTable->uid = x + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul));
} else { } else {
pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->tid) & ((1ul << 24) - 1ul)) << 24) + pTable->uid = mnodeCreateTableUid(pTable->vgId, pTable->tid);
((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul));
} }
pTable->sversion = 0; pTable->sversion = 0;
......
...@@ -248,18 +248,20 @@ typedef struct tSqlExpr { ...@@ -248,18 +248,20 @@ typedef struct tSqlExpr {
uint16_t type; // sql node type uint16_t type; // sql node type
uint32_t tokenId; // TK_LE: less than(binary expr) uint32_t tokenId; // TK_LE: less than(binary expr)
// the whole string of the function(col, param), while the function name is kept in token // the whole string of the function(col, param), while the function name is kept in exprToken
struct {
SStrToken operand; SStrToken operand;
int32_t functionId; // function id struct SArray *paramList; // function parameters list
} Expr;
SStrToken colInfo; // table column info uint32_t functionId; // function id, todo remove it
SStrToken columnName; // table column info
tVariant value; // the use input value tVariant value; // the use input value
SStrToken token; // original sql expr string SStrToken exprToken; // original sql expr string
uint32_t flags; uint32_t flags; // todo remove it
struct tSqlExpr *pLeft; // left child struct tSqlExpr *pLeft; // left child
struct tSqlExpr *pRight; // right child struct tSqlExpr *pRight; // right child
struct SArray *pParam; // function parameters list
} tSqlExpr; } tSqlExpr;
// used in select clause. select <SArray> from xxx // used in select clause. select <SArray> from xxx
......
...@@ -688,7 +688,7 @@ where_opt(A) ::= WHERE expr(X). {A = X;} ...@@ -688,7 +688,7 @@ where_opt(A) ::= WHERE expr(X). {A = X;}
%type expr {tSqlExpr*} %type expr {tSqlExpr*}
%destructor expr {tSqlExprDestroy($$);} %destructor expr {tSqlExprDestroy($$);}
expr(A) ::= LP(X) expr(Y) RP(Z). {A = Y; A->token.z = X.z; A->token.n = (Z.z - X.z + 1);} expr(A) ::= LP(X) expr(Y) RP(Z). {A = Y; A->exprToken.z = X.z; A->exprToken.n = (Z.z - X.z + 1);}
expr(A) ::= ID(X). { A = tSqlExprCreateIdValue(&X, TK_ID);} expr(A) ::= ID(X). { A = tSqlExprCreateIdValue(&X, TK_ID);}
expr(A) ::= ID(X) DOT ID(Y). { X.n += (1+Y.n); A = tSqlExprCreateIdValue(&X, TK_ID);} expr(A) ::= ID(X) DOT ID(Y). { X.n += (1+Y.n); A = tSqlExprCreateIdValue(&X, TK_ID);}
......
...@@ -127,7 +127,8 @@ static SQueryNode* doAddTableColumnNode(SQueryInfo* pQueryInfo, STableMetaInfo* ...@@ -127,7 +127,8 @@ static SQueryNode* doAddTableColumnNode(SQueryInfo* pQueryInfo, STableMetaInfo*
SColumn* pCol = taosArrayGetP(tableCols, i); SColumn* pCol = taosArrayGetP(tableCols, i);
SColumnIndex index = {.tableIndex = 0, .columnIndex = pCol->columnIndex}; SColumnIndex index = {.tableIndex = 0, .columnIndex = pCol->columnIndex};
SExprInfo* p = tscExprCreate(pQueryInfo, TSDB_FUNC_PRJ, &index, pCol->info.type, pCol->info.bytes, STableMetaInfo* pTableMetaInfo1 = tscGetMetaInfo(pQueryInfo, index.tableIndex);
SExprInfo* p = tscExprCreate(pTableMetaInfo1, TSDB_FUNC_PRJ, &index, pCol->info.type, pCol->info.bytes,
pCol->info.colId, 0, TSDB_COL_NORMAL); pCol->info.colId, 0, TSDB_COL_NORMAL);
strncpy(p->base.aliasName, pSchema[pCol->columnIndex].name, tListLen(p->base.aliasName)); strncpy(p->base.aliasName, pSchema[pCol->columnIndex].name, tListLen(p->base.aliasName));
......
...@@ -138,7 +138,7 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) { ...@@ -138,7 +138,7 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) {
tSqlExpr *pSqlExpr = calloc(1, sizeof(tSqlExpr)); tSqlExpr *pSqlExpr = calloc(1, sizeof(tSqlExpr));
if (pToken != NULL) { if (pToken != NULL) {
pSqlExpr->token = *pToken; pSqlExpr->exprToken = *pToken;
} }
if (optrType == TK_NULL) { if (optrType == TK_NULL) {
...@@ -175,7 +175,7 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) { ...@@ -175,7 +175,7 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) {
// Here it must be the column name (tk_id) if it is not a number or string. // Here it must be the column name (tk_id) if it is not a number or string.
assert(optrType == TK_ID || optrType == TK_ALL); assert(optrType == TK_ID || optrType == TK_ALL);
if (pToken != NULL) { if (pToken != NULL) {
pSqlExpr->colInfo = *pToken; pSqlExpr->columnName = *pToken;
} }
pSqlExpr->tokenId = optrType; pSqlExpr->tokenId = optrType;
...@@ -197,14 +197,14 @@ tSqlExpr *tSqlExprCreateFunction(SArray *pParam, SStrToken *pFuncToken, SStrToke ...@@ -197,14 +197,14 @@ tSqlExpr *tSqlExprCreateFunction(SArray *pParam, SStrToken *pFuncToken, SStrToke
tSqlExpr *pExpr = calloc(1, sizeof(tSqlExpr)); tSqlExpr *pExpr = calloc(1, sizeof(tSqlExpr));
pExpr->tokenId = optType; pExpr->tokenId = optType;
pExpr->type = SQL_NODE_SQLFUNCTION; pExpr->type = SQL_NODE_SQLFUNCTION;
pExpr->pParam = pParam; pExpr->Expr.paramList = pParam;
int32_t len = (int32_t)((endToken->z + endToken->n) - pFuncToken->z); int32_t len = (int32_t)((endToken->z + endToken->n) - pFuncToken->z);
pExpr->operand = (*pFuncToken); pExpr->Expr.operand = (*pFuncToken);
pExpr->token.n = len; pExpr->exprToken.n = len;
pExpr->token.z = pFuncToken->z; pExpr->exprToken.z = pFuncToken->z;
pExpr->token.type = pFuncToken->type; pExpr->exprToken.type = pFuncToken->type;
return pExpr; return pExpr;
} }
...@@ -218,16 +218,16 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) { ...@@ -218,16 +218,16 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) {
pExpr->type = SQL_NODE_EXPR; pExpr->type = SQL_NODE_EXPR;
if (pLeft != NULL && pRight != NULL && (optrType != TK_IN)) { if (pLeft != NULL && pRight != NULL && (optrType != TK_IN)) {
char* endPos = pRight->token.z + pRight->token.n; char* endPos = pRight->exprToken.z + pRight->exprToken.n;
pExpr->token.z = pLeft->token.z; pExpr->exprToken.z = pLeft->exprToken.z;
pExpr->token.n = (uint32_t)(endPos - pExpr->token.z); pExpr->exprToken.n = (uint32_t)(endPos - pExpr->exprToken.z);
pExpr->token.type = pLeft->token.type; pExpr->exprToken.type = pLeft->exprToken.type;
} }
if ((pLeft != NULL && pRight != NULL) && if ((pLeft != NULL && pRight != NULL) &&
(optrType == TK_PLUS || optrType == TK_MINUS || optrType == TK_STAR || optrType == TK_DIVIDE || optrType == TK_REM)) { (optrType == TK_PLUS || optrType == TK_MINUS || optrType == TK_STAR || optrType == TK_DIVIDE || optrType == TK_REM)) {
/* /*
* if a token is noted as the TK_TIMESTAMP, the time precision is microsecond * if a exprToken is noted as the TK_TIMESTAMP, the time precision is microsecond
* Otherwise, the time precision is adaptive, determined by the time precision from databases. * Otherwise, the time precision is adaptive, determined by the time precision from databases.
*/ */
if ((pLeft->tokenId == TK_INTEGER && pRight->tokenId == TK_INTEGER) || if ((pLeft->tokenId == TK_INTEGER && pRight->tokenId == TK_INTEGER) ||
...@@ -318,7 +318,7 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) { ...@@ -318,7 +318,7 @@ tSqlExpr *tSqlExprCreate(tSqlExpr *pLeft, tSqlExpr *pRight, int32_t optrType) {
tSqlExpr *pRSub = calloc(1, sizeof(tSqlExpr)); tSqlExpr *pRSub = calloc(1, sizeof(tSqlExpr));
pRSub->tokenId = TK_SET; // TODO refactor ..... pRSub->tokenId = TK_SET; // TODO refactor .....
pRSub->pParam = (SArray *)pRight; pRSub->Expr.paramList = (SArray *)pRight;
pExpr->pRight = pRSub; pExpr->pRight = pRSub;
} else { } else {
...@@ -360,8 +360,8 @@ int32_t tSqlExprCompare(tSqlExpr *left, tSqlExpr *right) { ...@@ -360,8 +360,8 @@ int32_t tSqlExprCompare(tSqlExpr *left, tSqlExpr *right) {
|| (left->pLeft == NULL && right->pLeft) || (left->pLeft == NULL && right->pLeft)
|| (left->pRight && right->pRight == NULL) || (left->pRight && right->pRight == NULL)
|| (left->pRight == NULL && right->pRight) || (left->pRight == NULL && right->pRight)
|| (left->pParam && right->pParam == NULL) || (left->Expr.paramList && right->Expr.paramList == NULL)
|| (left->pParam == NULL && right->pParam)) { || (left->Expr.paramList == NULL && right->Expr.paramList)) {
return 1; return 1;
} }
...@@ -369,20 +369,20 @@ int32_t tSqlExprCompare(tSqlExpr *left, tSqlExpr *right) { ...@@ -369,20 +369,20 @@ int32_t tSqlExprCompare(tSqlExpr *left, tSqlExpr *right) {
return 1; return 1;
} }
if (tStrTokenCompare(&left->colInfo, &right->colInfo)) { if (tStrTokenCompare(&left->columnName, &right->columnName)) {
return 1; return 1;
} }
if (right->pParam && left->pParam) { if (right->Expr.paramList && left->Expr.paramList) {
size_t size = taosArrayGetSize(right->pParam); size_t size = taosArrayGetSize(right->Expr.paramList);
if (left->pParam && taosArrayGetSize(left->pParam) != size) { if (left->Expr.paramList && taosArrayGetSize(left->Expr.paramList) != size) {
return 1; return 1;
} }
for (int32_t i = 0; i < size; i++) { for (int32_t i = 0; i < size; i++) {
tSqlExprItem* pLeftElem = taosArrayGet(left->pParam, i); tSqlExprItem* pLeftElem = taosArrayGet(left->Expr.paramList, i);
tSqlExpr* pSubLeft = pLeftElem->pNode; tSqlExpr* pSubLeft = pLeftElem->pNode;
tSqlExprItem* pRightElem = taosArrayGet(right->pParam, i); tSqlExprItem* pRightElem = taosArrayGet(right->Expr.paramList, i);
tSqlExpr* pSubRight = pRightElem->pNode; tSqlExpr* pSubRight = pRightElem->pNode;
if (tSqlExprCompare(pSubLeft, pSubRight)) { if (tSqlExprCompare(pSubLeft, pSubRight)) {
...@@ -415,8 +415,8 @@ tSqlExpr *tSqlExprClone(tSqlExpr *pSrc) { ...@@ -415,8 +415,8 @@ tSqlExpr *tSqlExprClone(tSqlExpr *pSrc) {
pExpr->pRight = tSqlExprClone(pSrc->pRight); pExpr->pRight = tSqlExprClone(pSrc->pRight);
} }
//we don't clone pParam now because clone is only used for between/and //we don't clone paramList now because clone is only used for between/and
assert(pSrc->pParam == NULL); assert(pSrc->Expr.paramList == NULL);
return pExpr; return pExpr;
} }
...@@ -474,7 +474,7 @@ static void doDestroySqlExprNode(tSqlExpr *pExpr) { ...@@ -474,7 +474,7 @@ static void doDestroySqlExprNode(tSqlExpr *pExpr) {
tVariantDestroy(&pExpr->value); tVariantDestroy(&pExpr->value);
} }
tSqlExprListDestroy(pExpr->pParam); tSqlExprListDestroy(pExpr->Expr.paramList);
free(pExpr); free(pExpr);
} }
......
...@@ -2967,9 +2967,9 @@ static void yy_reduce( ...@@ -2967,9 +2967,9 @@ static void yy_reduce(
case 226: /* slimit_opt ::= SLIMIT signed COMMA signed */ case 226: /* slimit_opt ::= SLIMIT signed COMMA signed */
{yymsp[-3].minor.yy126.limit = yymsp[0].minor.yy501; yymsp[-3].minor.yy126.offset = yymsp[-2].minor.yy501;} {yymsp[-3].minor.yy126.limit = yymsp[0].minor.yy501; yymsp[-3].minor.yy126.offset = yymsp[-2].minor.yy501;}
break; break;
case 229: /* expr ::= LP expr RP */ case 223: /* expr ::= LP expr RP */
{yylhsminor.yy370 = yymsp[-1].minor.yy370; yylhsminor.yy370->token.z = yymsp[-2].minor.yy0.z; yylhsminor.yy370->token.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);} {yylhsminor.yy166 = yymsp[-1].minor.yy166; yylhsminor.yy166->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy166->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
yymsp[-2].minor.yy370 = yylhsminor.yy370; yymsp[-2].minor.yy166 = yylhsminor.yy166;
break; break;
case 230: /* expr ::= ID */ case 230: /* expr ::= ID */
{ yylhsminor.yy370 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);} { yylhsminor.yy370 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);}
......
...@@ -86,7 +86,7 @@ char tsLogDir[TSDB_FILENAME_LEN] = "/var/log/power"; ...@@ -86,7 +86,7 @@ char tsLogDir[TSDB_FILENAME_LEN] = "/var/log/power";
#elif (_TD_TQ_ == true) #elif (_TD_TQ_ == true)
char tsLogDir[TSDB_FILENAME_LEN] = "/var/log/tq"; char tsLogDir[TSDB_FILENAME_LEN] = "/var/log/tq";
#else #else
char tsLogDir[TSDB_FILENAME_LEN] = "/var/log/taos"; char tsLogDir[PATH_MAX] = "/var/log/taos";
#endif #endif
static SLogObj tsLogObj = { .fileNum = 1 }; static SLogObj tsLogObj = { .fileNum = 1 };
......
...@@ -49,8 +49,8 @@ class TDTestCase: ...@@ -49,8 +49,8 @@ class TDTestCase:
tdSql.checkRows(10) tdSql.checkRows(10)
# bug: https://jira.taosdata.com:18080/browse/TD-5043 # bug: https://jira.taosdata.com:18080/browse/TD-5043
# tdSql.query("select * from (select * from st order by ts desc limit 10 offset 1000)") tdSql.query("select * from (select * from st order by ts desc limit 10 offset 1000)")
# tdSql.checkRows(0) tdSql.checkRows(0)
tdSql.query("select avg(value), sum(value) from st group by tbname") tdSql.query("select avg(value), sum(value) from st group by tbname")
tdSql.checkRows(self.tables) tdSql.checkRows(self.tables)
......
...@@ -1835,5 +1835,8 @@ if $data04 != 1 then ...@@ -1835,5 +1835,8 @@ if $data04 != 1 then
endi endi
sql_error select top(f1,2) from tb1 group by f1 having count(f1) > 0; sql_error select top(f1,2) from tb1 group by f1 having count(f1) > 0;
sql_error select count(*) from tb1 group by f1 having last(*) > 0;
print bug for select count(*) k from tb1 group by f1 having k > 0;
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册