Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6f48fa5f
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6f48fa5f
编写于
5月 14, 2022
作者:
S
slzhou
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of github.com:taosdata/TDengine into feature/udf
上级
911cd1fe
0c111d33
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
678 addition
and
210 deletion
+678
-210
include/common/ttime.h
include/common/ttime.h
+8
-7
include/libs/qcom/query.h
include/libs/qcom/query.h
+71
-48
include/util/taoserror.h
include/util/taoserror.h
+2
-0
packaging/release.sh
packaging/release.sh
+0
-1
packaging/tools/install.sh
packaging/tools/install.sh
+0
-6
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+3
-3
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+0
-12
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+39
-25
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+1
-1
source/libs/executor/src/indexoperator.c
source/libs/executor/src/indexoperator.c
+4
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+12
-8
source/libs/executor/test/index_executor_tests.cpp
source/libs/executor/test/index_executor_tests.cpp
+2
-2
source/libs/index/inc/indexComm.h
source/libs/index/inc/indexComm.h
+2
-0
source/libs/index/inc/indexInt.h
source/libs/index/inc/indexInt.h
+6
-3
source/libs/index/src/index.c
source/libs/index/src/index.c
+72
-20
source/libs/index/src/indexCache.c
source/libs/index/src/indexCache.c
+3
-0
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+110
-4
source/libs/index/src/indexFstUtil.c
source/libs/index/src/indexFstUtil.c
+4
-1
source/libs/index/src/indexTfile.c
source/libs/index/src/indexTfile.c
+10
-3
source/libs/index/test/jsonUT.cc
source/libs/index/test/jsonUT.cc
+20
-0
source/libs/nodes/src/nodesCodeFuncs.c
source/libs/nodes/src/nodesCodeFuncs.c
+162
-42
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+17
-0
source/libs/parser/src/parAuthenticator.c
source/libs/parser/src/parAuthenticator.c
+11
-2
source/libs/parser/src/parCalcConst.c
source/libs/parser/src/parCalcConst.c
+2
-2
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+30
-5
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+4
-0
source/libs/parser/test/parSelectTest.cpp
source/libs/parser/test/parSelectTest.cpp
+5
-3
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+7
-3
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+18
-0
source/libs/planner/test/planJoinTest.cpp
source/libs/planner/test/planJoinTest.cpp
+10
-4
source/libs/planner/test/planSubqueryTest.cpp
source/libs/planner/test/planSubqueryTest.cpp
+6
-2
source/libs/planner/test/planTestMain.cpp
source/libs/planner/test/planTestMain.cpp
+31
-1
source/libs/planner/test/planTestUtil.cpp
source/libs/planner/test/planTestUtil.cpp
+1
-0
source/libs/planner/test/planTestUtil.h
source/libs/planner/test/planTestUtil.h
+2
-0
source/libs/tdb/CMakeLists.txt
source/libs/tdb/CMakeLists.txt
+1
-1
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+1
-0
未找到文件。
include/common/ttime.h
浏览文件 @
6f48fa5f
...
@@ -59,10 +59,11 @@ static FORCE_INLINE int64_t taosGetTimestamp(int32_t precision) {
...
@@ -59,10 +59,11 @@ static FORCE_INLINE int64_t taosGetTimestamp(int32_t precision) {
* precision == TSDB_TIME_PRECISION_NANO, it returns timestamp in nanosecond.
* precision == TSDB_TIME_PRECISION_NANO, it returns timestamp in nanosecond.
*/
*/
static
FORCE_INLINE
int64_t
taosGetTimestampToday
(
int32_t
precision
)
{
static
FORCE_INLINE
int64_t
taosGetTimestampToday
(
int32_t
precision
)
{
int64_t
factor
=
(
precision
==
TSDB_TIME_PRECISION_MILLI
)
?
1000
:
int64_t
factor
=
(
precision
==
TSDB_TIME_PRECISION_MILLI
)
?
1000
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
?
1000000
:
1000000000
;
:
(
precision
==
TSDB_TIME_PRECISION_MICRO
)
?
1000000
time_t
t
=
taosTime
(
NULL
);
:
1000000000
;
struct
tm
*
tm
=
taosLocalTime
(
&
t
,
NULL
);
time_t
t
=
taosTime
(
NULL
);
struct
tm
*
tm
=
taosLocalTime
(
&
t
,
NULL
);
tm
->
tm_hour
=
0
;
tm
->
tm_hour
=
0
;
tm
->
tm_min
=
0
;
tm
->
tm_min
=
0
;
tm
->
tm_sec
=
0
;
tm
->
tm_sec
=
0
;
...
@@ -79,13 +80,13 @@ int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* durati
...
@@ -79,13 +80,13 @@ int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* durati
int32_t
taosParseTime
(
const
char
*
timestr
,
int64_t
*
time
,
int32_t
len
,
int32_t
timePrec
,
int8_t
dayligth
);
int32_t
taosParseTime
(
const
char
*
timestr
,
int64_t
*
time
,
int32_t
len
,
int32_t
timePrec
,
int8_t
dayligth
);
void
deltaToUtcInitOnce
();
void
deltaToUtcInitOnce
();
char
getPrecisionUnit
(
int32_t
precision
);
char
getPrecisionUnit
(
int32_t
precision
);
int64_t
convertTimePrecision
(
int64_t
time
,
int32_t
fromPrecision
,
int32_t
toPrecision
);
int64_t
convertTimePrecision
(
int64_t
time
,
int32_t
fromPrecision
,
int32_t
toPrecision
);
int64_t
convertTimeFromPrecisionToUnit
(
int64_t
time
,
int32_t
fromPrecision
,
char
toUnit
);
int64_t
convertTimeFromPrecisionToUnit
(
int64_t
time
,
int32_t
fromPrecision
,
char
toUnit
);
int32_t
convertStringToTimestamp
(
int16_t
type
,
char
*
inputData
,
int64_t
timePrec
,
int64_t
*
timeVal
);
int32_t
convertStringToTimestamp
(
int16_t
type
,
char
*
inputData
,
int64_t
timePrec
,
int64_t
*
timeVal
);
void
taosFormatUtcTime
(
char
*
buf
,
int32_t
bufLen
,
int64_t
time
,
int32_t
precision
);
void
taosFormatUtcTime
(
char
*
buf
,
int32_t
bufLen
,
int64_t
time
,
int32_t
precision
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/libs/qcom/query.h
浏览文件 @
6f48fa5f
...
@@ -51,14 +51,12 @@ typedef struct STableComInfo {
...
@@ -51,14 +51,12 @@ typedef struct STableComInfo {
}
STableComInfo
;
}
STableComInfo
;
typedef
struct
SIndexMeta
{
typedef
struct
SIndexMeta
{
#ifdef WINDOWS
#ifdef WINDOWS
size_t
avoidCompilationErrors
;
size_t
avoidCompilationErrors
;
#endif
#endif
}
SIndexMeta
;
}
SIndexMeta
;
/*
/*
* ASSERT(sizeof(SCTableMeta) == 24)
* ASSERT(sizeof(SCTableMeta) == 24)
* ASSERT(tableType == TSDB_CHILD_TABLE)
* ASSERT(tableType == TSDB_CHILD_TABLE)
...
@@ -95,7 +93,7 @@ typedef struct SDBVgInfo {
...
@@ -95,7 +93,7 @@ typedef struct SDBVgInfo {
int32_t
vgVersion
;
int32_t
vgVersion
;
int8_t
hashMethod
;
int8_t
hashMethod
;
int32_t
numOfTable
;
// DB's table num, unit is TSDB_TABLE_NUM_UNIT
int32_t
numOfTable
;
// DB's table num, unit is TSDB_TABLE_NUM_UNIT
SHashObj
*
vgHash
;
//
key:vgId, value:SVgroupInfo
SHashObj
*
vgHash
;
//
key:vgId, value:SVgroupInfo
}
SDBVgInfo
;
}
SDBVgInfo
;
typedef
struct
SUseDbOutput
{
typedef
struct
SUseDbOutput
{
...
@@ -135,7 +133,7 @@ typedef struct SMsgSendInfo {
...
@@ -135,7 +133,7 @@ typedef struct SMsgSendInfo {
}
SMsgSendInfo
;
}
SMsgSendInfo
;
typedef
struct
SQueryNodeStat
{
typedef
struct
SQueryNodeStat
{
int32_t
tableNum
;
// vg table number, unit is TSDB_TABLE_NUM_UNIT
int32_t
tableNum
;
// vg table number, unit is TSDB_TABLE_NUM_UNIT
}
SQueryNodeStat
;
}
SQueryNodeStat
;
int32_t
initTaskQueue
();
int32_t
initTaskQueue
();
...
@@ -172,7 +170,7 @@ const SSchema* tGetTbnameColumnSchema();
...
@@ -172,7 +170,7 @@ const SSchema* tGetTbnameColumnSchema();
bool
tIsValidSchema
(
struct
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
numOfTags
);
bool
tIsValidSchema
(
struct
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
numOfTags
);
int32_t
queryCreateTableMetaFromMsg
(
STableMetaRsp
*
msg
,
bool
isSuperTable
,
STableMeta
**
pMeta
);
int32_t
queryCreateTableMetaFromMsg
(
STableMetaRsp
*
msg
,
bool
isSuperTable
,
STableMeta
**
pMeta
);
char
*
jobTaskStatusStr
(
int32_t
status
);
char
*
jobTaskStatusStr
(
int32_t
status
);
SSchema
createSchema
(
int8_t
type
,
int32_t
bytes
,
col_id_t
colId
,
const
char
*
name
);
SSchema
createSchema
(
int8_t
type
,
int32_t
bytes
,
col_id_t
colId
,
const
char
*
name
);
...
@@ -184,62 +182,87 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
...
@@ -184,62 +182,87 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t
#define SET_META_TYPE_TABLE(t) (t) = META_TYPE_TABLE
#define SET_META_TYPE_TABLE(t) (t) = META_TYPE_TABLE
#define SET_META_TYPE_BOTH_TABLE(t) (t) = META_TYPE_BOTH_TABLE
#define SET_META_TYPE_BOTH_TABLE(t) (t) = META_TYPE_BOTH_TABLE
#define NEED_CLIENT_RM_TBLMETA_ERROR(_code) ((_code) == TSDB_CODE_PAR_TABLE_NOT_EXIST || (_code) == TSDB_CODE_VND_TB_NOT_EXIST)
#define NEED_CLIENT_RM_TBLMETA_ERROR(_code) \
#define NEED_CLIENT_REFRESH_VG_ERROR(_code) ((_code) == TSDB_CODE_VND_HASH_MISMATCH || (_code) == TSDB_CODE_VND_INVALID_VGROUP_ID)
((_code) == TSDB_CODE_PAR_TABLE_NOT_EXIST || (_code) == TSDB_CODE_VND_TB_NOT_EXIST)
#define NEED_CLIENT_REFRESH_VG_ERROR(_code) \
((_code) == TSDB_CODE_VND_HASH_MISMATCH || (_code) == TSDB_CODE_VND_INVALID_VGROUP_ID)
#define NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code) ((_code) == TSDB_CODE_TDB_TABLE_RECREATED)
#define NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code) ((_code) == TSDB_CODE_TDB_TABLE_RECREATED)
#define NEED_CLIENT_HANDLE_ERROR(_code) (NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code))
#define NEED_CLIENT_HANDLE_ERROR(_code) \
(NEED_CLIENT_RM_TBLMETA_ERROR(_code) || NEED_CLIENT_REFRESH_VG_ERROR(_code) || \
NEED_CLIENT_REFRESH_TBLMETA_ERROR(_code))
#define NEED_SCHEDULER_RETRY_ERROR(_code) ((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL)
#define NEED_SCHEDULER_RETRY_ERROR(_code) \
((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_RPC_NETWORK_UNAVAIL)
#define REQUEST_MAX_TRY_TIMES 5
#define REQUEST_MAX_TRY_TIMES 5
#define qFatal(...) \
#define qFatal(...)
\
do { \
do {
\
if (qDebugFlag & DEBUG_FATAL) { \
if (qDebugFlag & DEBUG_FATAL) {
\
taosPrintLog("QRY FATAL ", DEBUG_FATAL, qDebugFlag, __VA_ARGS__); \
taosPrintLog("QRY FATAL ", DEBUG_FATAL,
tsLogEmbedded ? 255 :
qDebugFlag, __VA_ARGS__); \
} \
}
\
} while (0)
} while (0)
#define qError(...) \
#define qError(...)
\
do { \
do {
\
if (qDebugFlag & DEBUG_ERROR) { \
if (qDebugFlag & DEBUG_ERROR) {
\
taosPrintLog("QRY ERROR ", DEBUG_ERROR, qDebugFlag, __VA_ARGS__); \
taosPrintLog("QRY ERROR ", DEBUG_ERROR,
tsLogEmbedded ? 255 :
qDebugFlag, __VA_ARGS__); \
} \
}
\
} while (0)
} while (0)
#define qWarn(...) \
#define qWarn(...)
\
do { \
do {
\
if (qDebugFlag & DEBUG_WARN) { \
if (qDebugFlag & DEBUG_WARN) {
\
taosPrintLog("QRY WARN ", DEBUG_WARN, qDebugFlag, __VA_ARGS__); \
taosPrintLog("QRY WARN ", DEBUG_WARN,
tsLogEmbedded ? 255 :
qDebugFlag, __VA_ARGS__); \
} \
}
\
} while (0)
} while (0)
#define qInfo(...) \
#define qInfo(...)
\
do { \
do {
\
if (qDebugFlag & DEBUG_INFO) { \
if (qDebugFlag & DEBUG_INFO) {
\
taosPrintLog("QRY ", DEBUG_INFO, qDebugFlag, __VA_ARGS__); \
taosPrintLog("QRY ", DEBUG_INFO,
tsLogEmbedded ? 255 :
qDebugFlag, __VA_ARGS__); \
} \
}
\
} while (0)
} while (0)
#define qDebug(...) \
#define qDebug(...)
\
do { \
do {
\
if (qDebugFlag & DEBUG_DEBUG) { \
if (qDebugFlag & DEBUG_DEBUG) {
\
taosPrintLog("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
taosPrintLog("QRY ", DEBUG_DEBUG,
tsLogEmbedded ? 255 :
qDebugFlag, __VA_ARGS__); \
} \
}
\
} while (0)
} while (0)
#define qTrace(...) \
#define qTrace(...)
\
do { \
do {
\
if (qDebugFlag & DEBUG_TRACE) { \
if (qDebugFlag & DEBUG_TRACE) {
\
taosPrintLog("QRY ", DEBUG_TRACE, qDebugFlag, __VA_ARGS__); \
taosPrintLog("QRY ", DEBUG_TRACE,
tsLogEmbedded ? 255 :
qDebugFlag, __VA_ARGS__); \
} \
}
\
} while (0)
} while (0)
#define qDebugL(...) \
#define qDebugL(...)
\
do { \
do {
\
if (qDebugFlag & DEBUG_DEBUG) { \
if (qDebugFlag & DEBUG_DEBUG) {
\
taosPrintLongString("QRY ", DEBUG_DEBUG, qDebugFlag, __VA_ARGS__); \
taosPrintLongString("QRY ", DEBUG_DEBUG,
tsLogEmbedded ? 255 :
qDebugFlag, __VA_ARGS__); \
} \
}
\
} while (0)
} while (0)
#define QRY_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
#define QRY_ERR_RET(c) \
#define QRY_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
do { \
#define QRY_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
return _code; \
} \
} while (0)
#define QRY_RET(c) \
do { \
int32_t _code = c; \
if (_code != TSDB_CODE_SUCCESS) { \
terrno = _code; \
} \
return _code; \
} while (0)
#define QRY_ERR_JRET(c) \
do { \
code = c; \
if (code != TSDB_CODE_SUCCESS) { \
terrno = code; \
goto _return; \
} \
} while (0)
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/taoserror.h
浏览文件 @
6f48fa5f
...
@@ -636,6 +636,8 @@ int32_t* taosGetErrno();
...
@@ -636,6 +636,8 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_PERMISSION_DENIED TAOS_DEF_ERROR_CODE(0, 0x2644)
#define TSDB_CODE_PAR_PERMISSION_DENIED TAOS_DEF_ERROR_CODE(0, 0x2644)
#define TSDB_CODE_PAR_INVALID_STREAM_QUERY TAOS_DEF_ERROR_CODE(0, 0x2645)
#define TSDB_CODE_PAR_INVALID_STREAM_QUERY TAOS_DEF_ERROR_CODE(0, 0x2645)
#define TSDB_CODE_PAR_INVALID_INTERNAL_PK TAOS_DEF_ERROR_CODE(0, 0x2646)
#define TSDB_CODE_PAR_INVALID_INTERNAL_PK TAOS_DEF_ERROR_CODE(0, 0x2646)
#define TSDB_CODE_PAR_INVALID_TIMELINE_FUNC TAOS_DEF_ERROR_CODE(0, 0x2647)
#define TSDB_CODE_PAR_INVALID_PASSWD TAOS_DEF_ERROR_CODE(0, 0x2648)
//planner
//planner
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
...
...
packaging/release.sh
浏览文件 @
6f48fa5f
...
@@ -67,7 +67,6 @@ bin_files="${compile_dir}/build/bin/taosd ${compile_dir}/build/bin/taos ${compi
...
@@ -67,7 +67,6 @@ bin_files="${compile_dir}/build/bin/taosd ${compile_dir}/build/bin/taos ${compi
cp
-rf
${
bin_files
}
${
install_dir
}
/bin
&&
chmod
a+x
${
install_dir
}
/bin/
*
||
:
cp
-rf
${
bin_files
}
${
install_dir
}
/bin
&&
chmod
a+x
${
install_dir
}
/bin/
*
||
:
cp
${
compile_dir
}
/build/lib/libtaos.so
${
install_dir
}
/lib/
cp
${
compile_dir
}
/build/lib/libtaos.so
${
install_dir
}
/lib/
cp
${
compile_dir
}
/build/lib/libtdb.so
${
install_dir
}
/lib/
cp
${
compile_dir
}
/build/lib/libavro
*
${
install_dir
}
/lib/
>
/dev/null
||
echo
-e
"failed to copy avro libraries"
cp
${
compile_dir
}
/build/lib/libavro
*
${
install_dir
}
/lib/
>
/dev/null
||
echo
-e
"failed to copy avro libraries"
cp
-rf
${
compile_dir
}
/build/lib/pkgconfig
${
install_dir
}
/lib/
>
/dev/null
||
echo
-e
"failed to copy pkgconfig directory"
cp
-rf
${
compile_dir
}
/build/lib/pkgconfig
${
install_dir
}
/lib/
>
/dev/null
||
echo
-e
"failed to copy pkgconfig directory"
...
...
packaging/tools/install.sh
浏览文件 @
6f48fa5f
...
@@ -215,15 +215,9 @@ function install_lib() {
...
@@ -215,15 +215,9 @@ function install_lib() {
${
csudo
}
ln
-s
${
install_main_dir
}
/lib/libtaos.
*
${
lib_link_dir
}
/libtaos.so.1
${
csudo
}
ln
-s
${
install_main_dir
}
/lib/libtaos.
*
${
lib_link_dir
}
/libtaos.so.1
${
csudo
}
ln
-s
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
${
csudo
}
ln
-s
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
${
csudo
}
ln
-s
${
install_main_dir
}
/lib/libtdb.
*
${
lib_link_dir
}
/libtdb.so.1
${
csudo
}
ln
-s
${
lib_link_dir
}
/libtdb.so.1
${
lib_link_dir
}
/libtdb.so
if
[[
-d
${
lib64_link_dir
}
&&
!
-e
${
lib64_link_dir
}
/libtaos.so
]]
;
then
if
[[
-d
${
lib64_link_dir
}
&&
!
-e
${
lib64_link_dir
}
/libtaos.so
]]
;
then
${
csudo
}
ln
-s
${
install_main_dir
}
/lib/libtaos.
*
${
lib64_link_dir
}
/libtaos.so.1
||
:
${
csudo
}
ln
-s
${
install_main_dir
}
/lib/libtaos.
*
${
lib64_link_dir
}
/libtaos.so.1
||
:
${
csudo
}
ln
-s
${
lib64_link_dir
}
/libtaos.so.1
${
lib64_link_dir
}
/libtaos.so
||
:
${
csudo
}
ln
-s
${
lib64_link_dir
}
/libtaos.so.1
${
lib64_link_dir
}
/libtaos.so
||
:
${
csudo
}
ln
-s
${
install_main_dir
}
/lib/libtdb.
*
${
lib64_link_dir
}
/libtdb.so.1
||
:
${
csudo
}
ln
-s
${
lib64_link_dir
}
/libtdb.so.1
${
lib64_link_dir
}
/libtdb.so
||
:
fi
fi
${
csudo
}
ldconfig
${
csudo
}
ldconfig
...
...
source/client/src/clientImpl.c
浏览文件 @
6f48fa5f
...
@@ -172,7 +172,8 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
...
@@ -172,7 +172,8 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
pStmtCb
=
pStmtCb
,
.
pStmtCb
=
pStmtCb
,
.
pUser
=
pTscObj
->
user
};
.
pUser
=
pTscObj
->
user
,
.
isSuperUser
=
(
0
==
strcmp
(
pTscObj
->
user
,
TSDB_DEFAULT_USER
))};
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
cxt
.
mgmtEpSet
=
getEpSet_s
(
&
pTscObj
->
pAppInfo
->
mgmtEp
);
int32_t
code
=
catalogGetHandle
(
pTscObj
->
pAppInfo
->
clusterId
,
&
cxt
.
pCatalog
);
int32_t
code
=
catalogGetHandle
(
pTscObj
->
pAppInfo
->
clusterId
,
&
cxt
.
pCatalog
);
...
@@ -947,8 +948,7 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR
...
@@ -947,8 +948,7 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR
// TODO handle the compressed case
// TODO handle the compressed case
pResultInfo
->
totalRows
+=
pResultInfo
->
numOfRows
;
pResultInfo
->
totalRows
+=
pResultInfo
->
numOfRows
;
return
setResultDataPtr
(
pResultInfo
,
pResultInfo
->
fields
,
pResultInfo
->
numOfCols
,
pResultInfo
->
numOfRows
,
return
setResultDataPtr
(
pResultInfo
,
pResultInfo
->
fields
,
pResultInfo
->
numOfCols
,
pResultInfo
->
numOfRows
,
convertUcs4
);
convertUcs4
);
}
}
TSDB_SERVER_STATUS
taos_check_server_status
(
const
char
*
fqdn
,
int
port
,
char
*
details
,
int
maxlen
)
{
TSDB_SERVER_STATUS
taos_check_server_status
(
const
char
*
fqdn
,
int
port
,
char
*
details
,
int
maxlen
)
{
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
6f48fa5f
...
@@ -2769,20 +2769,8 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
...
@@ -2769,20 +2769,8 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
}
while
(
moveToNextRowInMem
(
pCheckInfo
));
}
while
(
moveToNextRowInMem
(
pCheckInfo
));
taosMemoryFreeClear
(
pSchema
);
// free the STSChema
taosMemoryFreeClear
(
pSchema
);
// free the STSChema
assert
(
numOfRows
<=
maxRowsToRead
);
assert
(
numOfRows
<=
maxRowsToRead
);
// if the buffer is not full in case of descending order query, move the data in the front of the buffer
if
(
!
ASCENDING_TRAVERSE
(
pTsdbReadHandle
->
order
)
&&
numOfRows
<
maxRowsToRead
)
{
int32_t
emptySize
=
maxRowsToRead
-
numOfRows
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
pColumns
,
i
);
memmove
((
char
*
)
pColInfo
->
pData
,
(
char
*
)
pColInfo
->
pData
+
emptySize
*
pColInfo
->
info
.
bytes
,
numOfRows
*
pColInfo
->
info
.
bytes
);
}
}
int64_t
elapsedTime
=
taosGetTimestampUs
()
-
st
;
int64_t
elapsedTime
=
taosGetTimestampUs
()
-
st
;
tsdbDebug
(
"%p build data block from cache completed, elapsed time:%"
PRId64
" us, numOfRows:%d, numOfCols:%d, %s"
,
tsdbDebug
(
"%p build data block from cache completed, elapsed time:%"
PRId64
" us, numOfRows:%d, numOfCols:%d, %s"
,
pTsdbReadHandle
,
elapsedTime
,
numOfRows
,
numOfCols
,
pTsdbReadHandle
->
idStr
);
pTsdbReadHandle
,
elapsedTime
,
numOfRows
,
numOfCols
,
pTsdbReadHandle
->
idStr
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
6f48fa5f
...
@@ -651,7 +651,7 @@ void getAlignQueryTimeWindow(SInterval* pInterval, int32_t precision, int64_t
...
@@ -651,7 +651,7 @@ void getAlignQueryTimeWindow(SInterval* pInterval, int32_t precision, int64_t
int32_t
getTableScanInfo
(
SOperatorInfo
*
pOperator
,
int32_t
*
order
,
int32_t
*
scanFlag
);
int32_t
getTableScanInfo
(
SOperatorInfo
*
pOperator
,
int32_t
*
order
,
int32_t
*
scanFlag
);
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
);
void
doSetOperatorCompleted
(
SOperatorInfo
*
pOperator
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
,
SArray
*
pColMatchInfo
);
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowCellInfoOffset
);
SqlFunctionCtx
*
createSqlFunctionCtx
(
SExprInfo
*
pExprInfo
,
int32_t
numOfOutput
,
int32_t
**
rowCellInfoOffset
);
void
relocateColumnData
(
SSDataBlock
*
pBlock
,
const
SArray
*
pColMatchInfo
,
SArray
*
pCols
);
void
relocateColumnData
(
SSDataBlock
*
pBlock
,
const
SArray
*
pColMatchInfo
,
SArray
*
pCols
);
void
initExecTimeWindowInfo
(
SColumnInfoData
*
pColData
,
STimeWindow
*
pQueryWindow
);
void
initExecTimeWindowInfo
(
SColumnInfoData
*
pColData
,
STimeWindow
*
pQueryWindow
);
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
6f48fa5f
...
@@ -2114,7 +2114,8 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO
...
@@ -2114,7 +2114,8 @@ void setResultRowInitCtx(SResultRow* pResult, SqlFunctionCtx* pCtx, int32_t numO
}
}
}
}
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
)
{
static
void
extractQualifiedTupleByFilterResult
(
SSDataBlock
*
pBlock
,
const
int8_t
*
rowRes
,
bool
keep
);
void
doFilter
(
const
SNode
*
pFilterNode
,
SSDataBlock
*
pBlock
,
SArray
*
pColMatchInfo
)
{
if
(
pFilterNode
==
NULL
)
{
if
(
pFilterNode
==
NULL
)
{
return
;
return
;
}
}
...
@@ -2128,43 +2129,56 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) {
...
@@ -2128,43 +2129,56 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) {
code
=
filterSetDataFromSlotId
(
filter
,
&
param1
);
code
=
filterSetDataFromSlotId
(
filter
,
&
param1
);
int8_t
*
rowRes
=
NULL
;
int8_t
*
rowRes
=
NULL
;
bool
keep
=
filterExecute
(
filter
,
pBlock
,
&
rowRes
,
NULL
,
param1
.
numOfCols
);
// todo the keep seems never to be True??
bool
keep
=
filterExecute
(
filter
,
pBlock
,
&
rowRes
,
NULL
,
param1
.
numOfCols
);
filterFreeInfo
(
filter
);
filterFreeInfo
(
filter
);
SSDataBlock
*
px
=
createOneDataBlock
(
pBlock
,
false
);
extractQualifiedTupleByFilterResult
(
pBlock
,
rowRes
,
keep
);
blockDataEnsureCapacity
(
px
,
pBlock
->
info
.
rows
);
blockDataUpdateTsWindow
(
pBlock
);
}
// todo extract method
void
extractQualifiedTupleByFilterResult
(
SSDataBlock
*
pBlock
,
const
int8_t
*
rowRes
,
bool
keep
)
{
int32_t
numOfRow
=
0
;
if
(
keep
)
{
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
numOfCols
;
++
i
)
{
return
;
SColumnInfoData
*
pDst
=
taosArrayGet
(
px
->
pDataBlock
,
i
);
}
SColumnInfoData
*
pSrc
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
if
(
keep
)
{
if
(
rowRes
!=
NULL
)
{
colDataAssign
(
pDst
,
pSrc
,
pBlock
->
info
.
rows
);
SSDataBlock
*
px
=
createOneDataBlock
(
pBlock
,
false
);
numOfRow
=
pBlock
->
info
.
rows
;
blockDataEnsureCapacity
(
px
,
pBlock
->
info
.
rows
);
}
else
if
(
NULL
!=
rowRes
)
{
numOfRow
=
0
;
int32_t
totalRows
=
pBlock
->
info
.
rows
;
for
(
int32_t
j
=
0
;
j
<
pBlock
->
info
.
rows
;
++
j
)
{
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
numOfCols
;
++
i
)
{
SColumnInfoData
*
pDst
=
taosArrayGet
(
px
->
pDataBlock
,
i
);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
int32_t
numOfRows
=
0
;
for
(
int32_t
j
=
0
;
j
<
totalRows
;
++
j
)
{
if
(
rowRes
[
j
]
==
0
)
{
if
(
rowRes
[
j
]
==
0
)
{
continue
;
continue
;
}
}
if
(
colDataIsNull_s
(
pSrc
,
j
))
{
if
(
colDataIsNull_s
(
pSrc
,
j
))
{
colDataAppendNULL
(
pDst
,
numOfRow
);
colDataAppendNULL
(
pDst
,
numOfRow
s
);
}
else
{
}
else
{
colDataAppend
(
pDst
,
numOfRow
,
colDataGetData
(
pSrc
,
j
),
false
);
colDataAppend
(
pDst
,
numOfRow
s
,
colDataGetData
(
pSrc
,
j
),
false
);
}
}
numOfRow
+=
1
;
numOfRow
s
+=
1
;
}
}
}
else
{
numOfRow
=
0
;
}
*
pSrc
=
*
pDst
;
if
(
pBlock
->
info
.
rows
==
totalRows
)
{
}
pBlock
->
info
.
rows
=
numOfRows
;
}
else
{
ASSERT
(
pBlock
->
info
.
rows
==
numOfRows
);
}
pBlock
->
info
.
rows
=
numOfRow
;
*
pSrc
=
*
pDst
;
blockDataUpdateTsWindow
(
pBlock
);
}
}
else
{
// do nothing
pBlock
->
info
.
rows
=
0
;
}
}
}
void
doSetTableGroupOutputBuf
(
SAggOperatorInfo
*
pAggInfo
,
int32_t
numOfOutput
,
uint64_t
groupId
,
void
doSetTableGroupOutputBuf
(
SAggOperatorInfo
*
pAggInfo
,
int32_t
numOfOutput
,
uint64_t
groupId
,
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
6f48fa5f
...
@@ -318,7 +318,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
...
@@ -318,7 +318,7 @@ static SSDataBlock* hashGroupbyAggregate(SOperatorInfo* pOperator) {
while
(
1
)
{
while
(
1
)
{
doBuildResultDatablock
(
pOperator
,
&
pInfo
->
binfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
aggSup
.
pResultBuf
);
doBuildResultDatablock
(
pOperator
,
&
pInfo
->
binfo
,
&
pInfo
->
groupResInfo
,
pInfo
->
aggSup
.
pResultBuf
);
doFilter
(
pInfo
->
pCondition
,
pRes
);
doFilter
(
pInfo
->
pCondition
,
pRes
,
NULL
);
bool
hasRemain
=
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
);
bool
hasRemain
=
hasRemainDataInCurrentGroup
(
&
pInfo
->
groupResInfo
);
if
(
!
hasRemain
)
{
if
(
!
hasRemain
)
{
...
...
source/libs/executor/src/indexoperator.c
浏览文件 @
6f48fa5f
...
@@ -398,6 +398,10 @@ static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) {
...
@@ -398,6 +398,10 @@ static int32_t sifExecOper(SOperatorNode *node, SIFCtx *ctx, SIFParam *output) {
output
->
status
=
SFLT_ACCURATE_INDEX
;
output
->
status
=
SFLT_ACCURATE_INDEX
;
}
}
if
(
ctx
->
noExec
)
{
SIF_RET
(
code
);
}
return
operFn
(
&
params
[
0
],
nParam
>
1
?
&
params
[
1
]
:
NULL
,
output
);
return
operFn
(
&
params
[
0
],
nParam
>
1
?
&
params
[
1
]
:
NULL
,
output
);
_return:
_return:
taosMemoryFree
(
params
);
taosMemoryFree
(
params
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
6f48fa5f
...
@@ -159,6 +159,8 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
...
@@ -159,6 +159,8 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
return
false
;
return
false
;
}
}
static
void
addTagPseudoColumnData
(
STableScanInfo
*
pTableScanInfo
,
SSDataBlock
*
pBlock
);
static
int32_t
loadDataBlock
(
SOperatorInfo
*
pOperator
,
STableScanInfo
*
pTableScanInfo
,
SSDataBlock
*
pBlock
,
static
int32_t
loadDataBlock
(
SOperatorInfo
*
pOperator
,
STableScanInfo
*
pTableScanInfo
,
SSDataBlock
*
pBlock
,
uint32_t
*
status
)
{
uint32_t
*
status
)
{
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
...
@@ -238,8 +240,15 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
...
@@ -238,8 +240,15 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
}
}
relocateColumnData
(
pBlock
,
pTableScanInfo
->
pColMatchInfo
,
pCols
);
relocateColumnData
(
pBlock
,
pTableScanInfo
->
pColMatchInfo
,
pCols
);
// currently only the tbname pseudo column
if
(
pTableScanInfo
->
numOfPseudoExpr
>
0
)
{
addTagPseudoColumnData
(
pTableScanInfo
,
pBlock
);
}
// todo record the filter time cost
// todo record the filter time cost
doFilter
(
pTableScanInfo
->
pFilterNode
,
pBlock
);
doFilter
(
pTableScanInfo
->
pFilterNode
,
pBlock
,
pTableScanInfo
->
pColMatchInfo
);
if
(
pBlock
->
info
.
rows
==
0
)
{
if
(
pBlock
->
info
.
rows
==
0
)
{
pCost
->
filterOutBlocks
+=
1
;
pCost
->
filterOutBlocks
+=
1
;
qDebug
(
"%s data block filter out, brange:%"
PRId64
"-%"
PRId64
", rows:%d"
,
GET_TASKID
(
pTaskInfo
),
qDebug
(
"%s data block filter out, brange:%"
PRId64
"-%"
PRId64
", rows:%d"
,
GET_TASKID
(
pTaskInfo
),
...
@@ -260,7 +269,7 @@ static void prepareForDescendingScan(STableScanInfo* pTableScanInfo, SqlFunction
...
@@ -260,7 +269,7 @@ static void prepareForDescendingScan(STableScanInfo* pTableScanInfo, SqlFunction
pTableScanInfo
->
cond
.
order
=
TSDB_ORDER_DESC
;
pTableScanInfo
->
cond
.
order
=
TSDB_ORDER_DESC
;
}
}
static
void
addTagPseudoColumnData
(
STableScanInfo
*
pTableScanInfo
,
SSDataBlock
*
pBlock
)
{
void
addTagPseudoColumnData
(
STableScanInfo
*
pTableScanInfo
,
SSDataBlock
*
pBlock
)
{
// currently only the tbname pseudo column
// currently only the tbname pseudo column
if
(
pTableScanInfo
->
numOfPseudoExpr
==
0
)
{
if
(
pTableScanInfo
->
numOfPseudoExpr
==
0
)
{
return
;
return
;
...
@@ -330,11 +339,6 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
...
@@ -330,11 +339,6 @@ static SSDataBlock* doTableScanImpl(SOperatorInfo* pOperator) {
continue
;
continue
;
}
}
// currently only the tbname pseudo column
if
(
pTableScanInfo
->
numOfPseudoExpr
>
0
)
{
addTagPseudoColumnData
(
pTableScanInfo
,
pBlock
);
}
return
pBlock
;
return
pBlock
;
}
}
...
@@ -750,7 +754,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
...
@@ -750,7 +754,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
return
NULL
;
return
NULL
;
}
}
rows
=
pBlockInfo
->
rows
;
rows
=
pBlockInfo
->
rows
;
doFilter
(
pInfo
->
pCondition
,
pInfo
->
pRes
);
doFilter
(
pInfo
->
pCondition
,
pInfo
->
pRes
,
NULL
);
break
;
break
;
}
}
...
...
source/libs/executor/test/index_executor_tests.cpp
浏览文件 @
6f48fa5f
...
@@ -249,7 +249,7 @@ TEST(testCase, index_filter_varify) {
...
@@ -249,7 +249,7 @@ TEST(testCase, index_filter_varify) {
sifMakeOpNode
(
&
opNode
,
OP_TYPE_LOWER_THAN
,
TSDB_DATA_TYPE_DOUBLE
,
pLeft
,
pRight
);
sifMakeOpNode
(
&
opNode
,
OP_TYPE_LOWER_THAN
,
TSDB_DATA_TYPE_DOUBLE
,
pLeft
,
pRight
);
SIdxFltStatus
st
=
idxGetFltStatus
(
opNode
);
SIdxFltStatus
st
=
idxGetFltStatus
(
opNode
);
EXPECT_EQ
(
st
,
SFLT_
COARS
E_INDEX
);
EXPECT_EQ
(
st
,
SFLT_
ACCURAT
E_INDEX
);
nodesDestroyNode
(
res
);
nodesDestroyNode
(
res
);
}
}
{
{
...
@@ -269,7 +269,7 @@ TEST(testCase, index_filter_varify) {
...
@@ -269,7 +269,7 @@ TEST(testCase, index_filter_varify) {
sifMakeOpNode
(
&
opNode
,
OP_TYPE_GREATER_THAN
,
TSDB_DATA_TYPE_DOUBLE
,
pLeft
,
pRight
);
sifMakeOpNode
(
&
opNode
,
OP_TYPE_GREATER_THAN
,
TSDB_DATA_TYPE_DOUBLE
,
pLeft
,
pRight
);
SIdxFltStatus
st
=
idxGetFltStatus
(
opNode
);
SIdxFltStatus
st
=
idxGetFltStatus
(
opNode
);
EXPECT_EQ
(
st
,
SFLT_
COARS
E_INDEX
);
EXPECT_EQ
(
st
,
SFLT_
ACCURAT
E_INDEX
);
nodesDestroyNode
(
res
);
nodesDestroyNode
(
res
);
}
}
}
}
...
...
source/libs/index/inc/indexComm.h
浏览文件 @
6f48fa5f
...
@@ -37,6 +37,8 @@ TExeCond tDoCommpare(__compar_fn_t func, int8_t comType, void* a, void* b);
...
@@ -37,6 +37,8 @@ TExeCond tDoCommpare(__compar_fn_t func, int8_t comType, void* a, void* b);
_cache_range_compare
indexGetCompare
(
RangeType
ty
);
_cache_range_compare
indexGetCompare
(
RangeType
ty
);
int32_t
indexConvertData
(
void
*
src
,
int8_t
type
,
void
**
dst
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/libs/index/inc/indexInt.h
浏览文件 @
6f48fa5f
...
@@ -46,9 +46,7 @@ typedef struct SIndexStat {
...
@@ -46,9 +46,7 @@ typedef struct SIndexStat {
}
SIndexStat
;
}
SIndexStat
;
struct
SIndex
{
struct
SIndex
{
#ifdef USE_LUCENE
int64_t
refId
;
index_t
*
index
;
#endif
void
*
cache
;
void
*
cache
;
void
*
tindex
;
void
*
tindex
;
SHashObj
*
colObj
;
// < field name, field id>
SHashObj
*
colObj
;
// < field name, field id>
...
@@ -124,6 +122,11 @@ typedef struct TFileCacheKey {
...
@@ -124,6 +122,11 @@ typedef struct TFileCacheKey {
int
indexFlushCacheToTFile
(
SIndex
*
sIdx
,
void
*
);
int
indexFlushCacheToTFile
(
SIndex
*
sIdx
,
void
*
);
int64_t
indexAddRef
(
void
*
p
);
int32_t
indexRemoveRef
(
int64_t
ref
);
void
indexAcquireRef
(
int64_t
ref
);
void
indexReleaseRef
(
int64_t
ref
);
int32_t
indexSerialCacheKey
(
ICacheKey
*
key
,
char
*
buf
);
int32_t
indexSerialCacheKey
(
ICacheKey
*
key
,
char
*
buf
);
// int32_t indexSerialKey(ICacheKey* key, char* buf);
// int32_t indexSerialKey(ICacheKey* key, char* buf);
// int32_t indexSerialTermKey(SIndexTerm* itm, char* buf);
// int32_t indexSerialTermKey(SIndexTerm* itm, char* buf);
...
...
source/libs/index/src/index.c
浏览文件 @
6f48fa5f
...
@@ -19,7 +19,10 @@
...
@@ -19,7 +19,10 @@
#include "indexInt.h"
#include "indexInt.h"
#include "indexTfile.h"
#include "indexTfile.h"
#include "indexUtil.h"
#include "indexUtil.h"
#include "tcoding.h"
#include "tdataformat.h"
#include "tdef.h"
#include "tdef.h"
#include "tref.h"
#include "tsched.h"
#include "tsched.h"
#ifdef USE_LUCENE
#ifdef USE_LUCENE
...
@@ -27,36 +30,40 @@
...
@@ -27,36 +30,40 @@
#endif
#endif
#define INDEX_NUM_OF_THREADS 4
#define INDEX_NUM_OF_THREADS 4
#define INDEX_QUEUE_SIZE 200
#define INDEX_QUEUE_SIZE
200
void
*
indexQhandle
=
NULL
;
#define INDEX_DATA_BOOL_NULL 0x02
#define INDEX_DATA_TINYINT_NULL 0x80
#define INDEX_DATA_BOOL_NULL 0x02
#define INDEX_DATA_SMALLINT_NULL 0x8000
#define INDEX_DATA_TINYINT_NULL 0x80
#define INDEX_DATA_INT_NULL 0x80000000L
#define INDEX_DATA_SMALLINT_NULL 0x8000
#define INDEX_DATA_BIGINT_NULL 0x8000000000000000L
#define INDEX_DATA_INT_NULL 0x80000000L
#define INDEX_DATA_BIGINT_NULL 0x8000000000000000L
#define INDEX_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL
#define INDEX_DATA_TIMESTAMP_NULL TSDB_DATA_BIGINT_NULL
#define INDEX_DATA_FLOAT_NULL
0x7FF00000
// it is an NAN
#define INDEX_DATA_FLOAT_NULL
0x7FF00000
// it is an NAN
#define INDEX_DATA_DOUBLE_NULL 0x7FFFFF0000000000L // an NAN
#define INDEX_DATA_DOUBLE_NULL
0x7FFFFF0000000000L // an NAN
#define INDEX_DATA_NCHAR_NULL 0xFFFFFFFF
#define INDEX_DATA_NCHAR_NULL
0xFFFFFFFF
#define INDEX_DATA_BINARY_NULL 0xFF
#define INDEX_DATA_BINARY_NULL
0xFF
#define INDEX_DATA_JSON_NULL 0xFFFFFFFF
#define INDEX_DATA_JSON_NULL
0xFFFFFFFF
#define INDEX_DATA_JSON_null 0xFFFFFFFE
#define INDEX_DATA_JSON_null
0xFFFFFFFE
#define INDEX_DATA_JSON_NOT_NULL 0x01
#define INDEX_DATA_JSON_NOT_NULL 0x01
#define INDEX_DATA_UTINYINT_NULL 0xFF
#define INDEX_DATA_UTINYINT_NULL
0xFF
#define INDEX_DATA_USMALLINT_NULL 0xFFFF
#define INDEX_DATA_USMALLINT_NULL 0xFFFF
#define INDEX_DATA_UINT_NULL 0xFFFFFFFF
#define INDEX_DATA_UINT_NULL
0xFFFFFFFF
#define INDEX_DATA_UBIGINT_NULL 0xFFFFFFFFFFFFFFFFL
#define INDEX_DATA_UBIGINT_NULL
0xFFFFFFFFFFFFFFFFL
#define INDEX_DATA_NULL_STR "NULL"
#define INDEX_DATA_NULL_STR
"NULL"
#define INDEX_DATA_NULL_STR_L "null"
#define INDEX_DATA_NULL_STR_L "null"
void
*
indexQhandle
=
NULL
;
int32_t
indexRefMgt
;
static
void
indexDestroy
(
void
*
sIdx
);
void
indexInit
()
{
void
indexInit
()
{
// refactor later
// refactor later
indexQhandle
=
taosInitScheduler
(
INDEX_QUEUE_SIZE
,
INDEX_NUM_OF_THREADS
,
"index"
);
indexQhandle
=
taosInitScheduler
(
INDEX_QUEUE_SIZE
,
INDEX_NUM_OF_THREADS
,
"index"
);
indexRefMgt
=
taosOpenRef
(
10
,
indexDestroy
);
}
}
void
indexCleanUp
()
{
void
indexCleanUp
()
{
// refacto later
// refacto later
...
@@ -100,7 +107,12 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
...
@@ -100,7 +107,12 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
sIdx
->
cVersion
=
1
;
sIdx
->
cVersion
=
1
;
sIdx
->
path
=
tstrdup
(
path
);
sIdx
->
path
=
tstrdup
(
path
);
taosThreadMutexInit
(
&
sIdx
->
mtx
,
NULL
);
taosThreadMutexInit
(
&
sIdx
->
mtx
,
NULL
);
sIdx
->
refId
=
indexAddRef
(
sIdx
);
taosAcquireRef
(
indexRefMgt
,
sIdx
->
refId
);
*
index
=
sIdx
;
*
index
=
sIdx
;
return
0
;
return
0
;
END:
END:
...
@@ -112,8 +124,9 @@ END:
...
@@ -112,8 +124,9 @@ END:
return
-
1
;
return
-
1
;
}
}
void
indexClose
(
SIndex
*
sIdx
)
{
void
indexDestroy
(
void
*
handle
)
{
void
*
iter
=
taosHashIterate
(
sIdx
->
colObj
,
NULL
);
SIndex
*
sIdx
=
handle
;
void
*
iter
=
taosHashIterate
(
sIdx
->
colObj
,
NULL
);
while
(
iter
)
{
while
(
iter
)
{
IndexCache
**
pCache
=
iter
;
IndexCache
**
pCache
=
iter
;
if
(
*
pCache
)
{
if
(
*
pCache
)
{
...
@@ -128,6 +141,27 @@ void indexClose(SIndex* sIdx) {
...
@@ -128,6 +141,27 @@ void indexClose(SIndex* sIdx) {
taosMemoryFree
(
sIdx
);
taosMemoryFree
(
sIdx
);
return
;
return
;
}
}
void
indexClose
(
SIndex
*
sIdx
)
{
indexReleaseRef
(
sIdx
->
refId
);
indexRemoveRef
(
sIdx
->
refId
);
}
int64_t
indexAddRef
(
void
*
p
)
{
// impl
return
taosAddRef
(
indexRefMgt
,
p
);
}
int32_t
indexRemoveRef
(
int64_t
ref
)
{
// impl later
return
taosRemoveRef
(
indexRefMgt
,
ref
);
}
void
indexAcquireRef
(
int64_t
ref
)
{
// impl
taosAcquireRef
(
indexRefMgt
,
ref
);
}
void
indexReleaseRef
(
int64_t
ref
)
{
// impl
taosReleaseRef
(
indexRefMgt
,
ref
);
}
int
indexPut
(
SIndex
*
index
,
SIndexMultiTerm
*
fVals
,
uint64_t
uid
)
{
int
indexPut
(
SIndex
*
index
,
SIndexMultiTerm
*
fVals
,
uint64_t
uid
)
{
// TODO(yihao): reduce the lock range
// TODO(yihao): reduce the lock range
...
@@ -222,6 +256,7 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy
...
@@ -222,6 +256,7 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy
tm
->
operType
=
oper
;
tm
->
operType
=
oper
;
tm
->
colType
=
colType
;
tm
->
colType
=
colType
;
#if 0
tm->colName = (char*)taosMemoryCalloc(1, nColName + 1);
tm->colName = (char*)taosMemoryCalloc(1, nColName + 1);
memcpy(tm->colName, colName, nColName);
memcpy(tm->colName, colName, nColName);
tm->nColName = nColName;
tm->nColName = nColName;
...
@@ -229,6 +264,22 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy
...
@@ -229,6 +264,22 @@ SIndexTerm* indexTermCreate(int64_t suid, SIndexOperOnColumn oper, uint8_t colTy
tm->colVal = (char*)taosMemoryCalloc(1, nColVal + 1);
tm->colVal = (char*)taosMemoryCalloc(1, nColVal + 1);
memcpy(tm->colVal, colVal, nColVal);
memcpy(tm->colVal, colVal, nColVal);
tm->nColVal = nColVal;
tm->nColVal = nColVal;
#endif
#if 1
tm
->
colName
=
(
char
*
)
taosMemoryCalloc
(
1
,
nColName
+
1
);
memcpy
(
tm
->
colName
,
colName
,
nColName
);
tm
->
nColName
=
nColName
;
char
*
buf
=
NULL
;
int32_t
len
=
indexConvertData
((
void
*
)
colVal
,
INDEX_TYPE_GET_TYPE
(
colType
),
(
void
**
)
&
buf
);
assert
(
len
!=
-
1
);
tm
->
colVal
=
buf
;
tm
->
nColVal
=
len
;
#endif
return
tm
;
return
tm
;
}
}
...
@@ -457,6 +508,7 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
...
@@ -457,6 +508,7 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
}
else
{
}
else
{
indexInfo
(
"success to merge , time cost: %"
PRId64
"ms"
,
cost
/
1000
);
indexInfo
(
"success to merge , time cost: %"
PRId64
"ms"
,
cost
/
1000
);
}
}
indexReleaseRef
(
sIdx
->
refId
);
return
ret
;
return
ret
;
}
}
void
iterateValueDestroy
(
IterateValue
*
value
,
bool
destroy
)
{
void
iterateValueDestroy
(
IterateValue
*
value
,
bool
destroy
)
{
...
...
source/libs/index/src/indexCache.c
浏览文件 @
6f48fa5f
...
@@ -460,8 +460,11 @@ int indexCacheSchedToMerge(IndexCache* pCache) {
...
@@ -460,8 +460,11 @@ int indexCacheSchedToMerge(IndexCache* pCache) {
schedMsg
.
fp
=
doMergeWork
;
schedMsg
.
fp
=
doMergeWork
;
schedMsg
.
ahandle
=
pCache
;
schedMsg
.
ahandle
=
pCache
;
schedMsg
.
thandle
=
NULL
;
schedMsg
.
thandle
=
NULL
;
// schedMsg.thandle = taosMemoryCalloc(1, sizeof(int64_t));
// memcpy((char*)(schedMsg.thandle), (char*)&(pCache->index->refId), sizeof(int64_t));
schedMsg
.
msg
=
NULL
;
schedMsg
.
msg
=
NULL
;
indexAcquireRef
(
pCache
->
index
->
refId
);
taosScheduleTask
(
indexQhandle
,
&
schedMsg
);
taosScheduleTask
(
indexQhandle
,
&
schedMsg
);
return
0
;
return
0
;
...
...
source/libs/index/src/indexComm.c
浏览文件 @
6f48fa5f
...
@@ -16,25 +16,33 @@
...
@@ -16,25 +16,33 @@
#include "indexComm.h"
#include "indexComm.h"
#include "index.h"
#include "index.h"
#include "indexInt.h"
#include "indexInt.h"
#include "tcoding.h"
#include "tcompare.h"
#include "tcompare.h"
#include "tdataformat.h"
char
JSON_COLUMN
[]
=
"JSON"
;
char
JSON_COLUMN
[]
=
"JSON"
;
char
JSON_VALUE_DELIM
=
'&'
;
char
JSON_VALUE_DELIM
=
'&'
;
static
__compar_fn_t
indexGetCompar
(
int8_t
type
)
{
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
return
(
__compar_fn_t
)
strcmp
;
}
return
getComparFunc
(
type
,
0
);
}
static
TExeCond
tCompareLessThan
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
static
TExeCond
tCompareLessThan
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
getComparFunc
(
type
,
0
);
__compar_fn_t
func
=
indexGetCompar
(
type
);
return
tDoCommpare
(
func
,
QUERY_LESS_THAN
,
a
,
b
);
return
tDoCommpare
(
func
,
QUERY_LESS_THAN
,
a
,
b
);
}
}
static
TExeCond
tCompareLessEqual
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
static
TExeCond
tCompareLessEqual
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
getComparFunc
(
type
,
0
);
__compar_fn_t
func
=
indexGetCompar
(
type
);
return
tDoCommpare
(
func
,
QUERY_LESS_EQUAL
,
a
,
b
);
return
tDoCommpare
(
func
,
QUERY_LESS_EQUAL
,
a
,
b
);
}
}
static
TExeCond
tCompareGreaterThan
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
static
TExeCond
tCompareGreaterThan
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
getComparFunc
(
type
,
0
);
__compar_fn_t
func
=
indexGetCompar
(
type
);
return
tDoCommpare
(
func
,
QUERY_GREATER_THAN
,
a
,
b
);
return
tDoCommpare
(
func
,
QUERY_GREATER_THAN
,
a
,
b
);
}
}
static
TExeCond
tCompareGreaterEqual
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
static
TExeCond
tCompareGreaterEqual
(
void
*
a
,
void
*
b
,
int8_t
type
)
{
__compar_fn_t
func
=
getComparFunc
(
type
,
0
);
__compar_fn_t
func
=
indexGetCompar
(
type
);
return
tDoCommpare
(
func
,
QUERY_GREATER_EQUAL
,
a
,
b
);
return
tDoCommpare
(
func
,
QUERY_GREATER_EQUAL
,
a
,
b
);
}
}
...
@@ -120,3 +128,101 @@ char* indexPackJsonDataPrefix(SIndexTerm* itm, int32_t* skip) {
...
@@ -120,3 +128,101 @@ char* indexPackJsonDataPrefix(SIndexTerm* itm, int32_t* skip) {
return
buf
;
return
buf
;
}
}
int32_t
indexConvertData
(
void
*
src
,
int8_t
type
,
void
**
dst
)
{
int
tlen
=
-
1
;
switch
(
type
)
{
case
TSDB_DATA_TYPE_TIMESTAMP
:
tlen
=
taosEncodeFixedI64
(
NULL
,
*
(
int64_t
*
)
src
);
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeFixedI64
(
dst
,
*
(
int64_t
*
)
src
);
break
;
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_UTINYINT
:
tlen
=
taosEncodeFixedU8
(
NULL
,
*
(
uint8_t
*
)
src
);
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeFixedU8
(
dst
,
*
(
uint8_t
*
)
src
);
break
;
case
TSDB_DATA_TYPE_TINYINT
:
tlen
=
taosEncodeFixedI8
(
NULL
,
*
(
uint8_t
*
)
src
);
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeFixedI8
(
dst
,
*
(
uint8_t
*
)
src
);
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
tlen
=
taosEncodeFixedI16
(
NULL
,
*
(
int16_t
*
)
src
);
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeFixedI16
(
dst
,
*
(
int16_t
*
)
src
);
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
tlen
=
taosEncodeFixedU16
(
NULL
,
*
(
uint16_t
*
)
src
);
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeFixedU16
(
dst
,
*
(
uint16_t
*
)
src
);
break
;
case
TSDB_DATA_TYPE_INT
:
tlen
=
taosEncodeFixedI32
(
NULL
,
*
(
int32_t
*
)
src
);
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeFixedI32
(
dst
,
*
(
int32_t
*
)
src
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
tlen
=
taosEncodeBinary
(
NULL
,
src
,
sizeof
(
float
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
src
,
sizeof
(
float
));
break
;
case
TSDB_DATA_TYPE_UINT
:
tlen
=
taosEncodeFixedU32
(
NULL
,
*
(
uint32_t
*
)
src
);
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeFixedU32
(
dst
,
*
(
uint32_t
*
)
src
);
break
;
case
TSDB_DATA_TYPE_BIGINT
:
tlen
=
taosEncodeFixedI64
(
NULL
,
*
(
uint32_t
*
)
src
);
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeFixedI64
(
dst
,
*
(
uint32_t
*
)
src
);
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
tlen
=
taosEncodeBinary
(
NULL
,
src
,
sizeof
(
double
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
src
,
sizeof
(
double
));
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
tlen
=
taosEncodeFixedU64
(
NULL
,
*
(
uint32_t
*
)
src
);
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeFixedU64
(
dst
,
*
(
uint32_t
*
)
src
);
break
;
case
TSDB_DATA_TYPE_NCHAR
:
{
tlen
=
taosEncodeBinary
(
NULL
,
varDataVal
(
src
),
varDataLen
(
src
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
varDataVal
(
src
),
varDataLen
(
src
));
break
;
}
case
TSDB_DATA_TYPE_VARCHAR
:
{
// TSDB_DATA_TYPE_BINARY
#if 1
tlen
=
taosEncodeBinary
(
NULL
,
src
,
strlen
(
src
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
src
,
strlen
(
src
));
break
;
#endif
}
case
TSDB_DATA_TYPE_VARBINARY
:
#if 1
tlen
=
taosEncodeBinary
(
NULL
,
src
,
strlen
(
src
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
src
,
strlen
(
src
));
break
;
#endif
default:
TASSERT
(
0
);
break
;
}
*
dst
=
*
dst
-
tlen
;
if
(
type
!=
TSDB_DATA_TYPE_BINARY
&&
type
!=
TSDB_DATA_TYPE_NCHAR
&&
type
!=
TSDB_DATA_TYPE_VARBINARY
&&
type
==
TSDB_DATA_TYPE_VARCHAR
)
{
uint8_t
*
p
=
*
dst
;
for
(
int
i
=
0
;
i
<
tlen
;
i
++
)
{
if
(
p
[
i
]
==
0
)
{
p
[
i
]
=
(
uint8_t
)
'0'
;
}
}
}
return
tlen
;
}
source/libs/index/src/indexFstUtil.c
浏览文件 @
6f48fa5f
...
@@ -82,7 +82,10 @@ FstSlice fstSliceCreate(uint8_t* data, uint64_t len) {
...
@@ -82,7 +82,10 @@ FstSlice fstSliceCreate(uint8_t* data, uint64_t len) {
str
->
ref
=
1
;
str
->
ref
=
1
;
str
->
len
=
len
;
str
->
len
=
len
;
str
->
data
=
taosMemoryMalloc
(
len
*
sizeof
(
uint8_t
));
str
->
data
=
taosMemoryMalloc
(
len
*
sizeof
(
uint8_t
));
memcpy
(
str
->
data
,
data
,
len
);
if
(
data
!=
NULL
)
{
memcpy
(
str
->
data
,
data
,
len
);
}
FstSlice
s
=
{.
str
=
str
,
.
start
=
0
,
.
end
=
len
-
1
};
FstSlice
s
=
{.
str
=
str
,
.
start
=
0
,
.
end
=
len
-
1
};
return
s
;
return
s
;
...
...
source/libs/index/src/indexTfile.c
浏览文件 @
6f48fa5f
...
@@ -469,13 +469,19 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTempR
...
@@ -469,13 +469,19 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTempR
while
((
rt
=
streamWithStateNextWith
(
st
,
NULL
))
!=
NULL
)
{
while
((
rt
=
streamWithStateNextWith
(
st
,
NULL
))
!=
NULL
)
{
FstSlice
*
s
=
&
rt
->
data
;
FstSlice
*
s
=
&
rt
->
data
;
char
*
ch
=
(
char
*
)
fstSliceData
(
s
,
NULL
);
int32_t
sz
=
0
;
if
(
0
!=
strncmp
(
ch
,
p
,
skip
))
{
char
*
ch
=
(
char
*
)
fstSliceData
(
s
,
&
sz
);
char
*
tmp
=
taosMemoryCalloc
(
1
,
sz
+
1
);
memcpy
(
tmp
,
ch
,
sz
);
if
(
0
!=
strncmp
(
tmp
,
p
,
skip
))
{
swsResultDestroy
(
rt
);
swsResultDestroy
(
rt
);
taosMemoryFree
(
tmp
);
break
;
break
;
}
}
TExeCond
cond
=
cmpFn
(
ch
+
skip
,
tem
->
colVal
,
tem
->
colType
);
TExeCond
cond
=
cmpFn
(
tmp
+
skip
,
tem
->
colVal
,
INDEX_TYPE_GET_TYPE
(
tem
->
colType
));
if
(
MATCH
==
cond
)
{
if
(
MATCH
==
cond
)
{
tfileReaderLoadTableIds
((
TFileReader
*
)
reader
,
rt
->
out
.
out
,
tr
->
total
);
tfileReaderLoadTableIds
((
TFileReader
*
)
reader
,
rt
->
out
.
out
,
tr
->
total
);
}
else
if
(
CONTINUE
==
cond
)
{
}
else
if
(
CONTINUE
==
cond
)
{
...
@@ -483,6 +489,7 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTempR
...
@@ -483,6 +489,7 @@ static int32_t tfSearchCompareFunc_JSON(void* reader, SIndexTerm* tem, SIdxTempR
swsResultDestroy
(
rt
);
swsResultDestroy
(
rt
);
break
;
break
;
}
}
taosMemoryFree
(
tmp
);
swsResultDestroy
(
rt
);
swsResultDestroy
(
rt
);
}
}
streamWithStateDestroy
(
st
);
streamWithStateDestroy
(
st
);
...
...
source/libs/index/test/jsonUT.cc
浏览文件 @
6f48fa5f
...
@@ -17,12 +17,32 @@
...
@@ -17,12 +17,32 @@
#include "tutil.h"
#include "tutil.h"
static
std
::
string
dir
=
"/tmp/json"
;
static
std
::
string
dir
=
"/tmp/json"
;
static
std
::
string
logDir
=
"/tmp/log"
;
static
void
initLog
()
{
const
char
*
defaultLogFileNamePrefix
=
"taoslog"
;
const
int32_t
maxLogFileNum
=
10
;
tsAsyncLog
=
0
;
sDebugFlag
=
143
;
strcpy
(
tsLogDir
,
logDir
.
c_str
());
taosRemoveDir
(
tsLogDir
);
taosMkDir
(
tsLogDir
);
if
(
taosInitLog
(
defaultLogFileNamePrefix
,
maxLogFileNum
)
<
0
)
{
printf
(
"failed to open log file in directory:%s
\n
"
,
tsLogDir
);
}
}
class
JsonEnv
:
public
::
testing
::
Test
{
class
JsonEnv
:
public
::
testing
::
Test
{
protected:
protected:
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
taosRemoveDir
(
logDir
.
c_str
());
taosMkDir
(
logDir
.
c_str
());
taosRemoveDir
(
dir
.
c_str
());
taosRemoveDir
(
dir
.
c_str
());
taosMkDir
(
dir
.
c_str
());
taosMkDir
(
dir
.
c_str
());
printf
(
"set up
\n
"
);
printf
(
"set up
\n
"
);
initLog
();
opts
=
indexOptsCreate
();
opts
=
indexOptsCreate
();
int
ret
=
tIndexJsonOpen
(
opts
,
dir
.
c_str
(),
&
index
);
int
ret
=
tIndexJsonOpen
(
opts
,
dir
.
c_str
(),
&
index
);
assert
(
ret
==
0
);
assert
(
ret
==
0
);
...
...
source/libs/nodes/src/nodesCodeFuncs.c
浏览文件 @
6f48fa5f
...
@@ -318,15 +318,19 @@ static int32_t jsonToTableComInfo(const SJson* pJson, void* pObj) {
...
@@ -318,15 +318,19 @@ static int32_t jsonToTableComInfo(const SJson* pJson, void* pObj) {
STableComInfo
*
pNode
=
(
STableComInfo
*
)
pObj
;
STableComInfo
*
pNode
=
(
STableComInfo
*
)
pObj
;
int32_t
code
;
int32_t
code
;
tjsonGetNumberValue
(
pJson
,
jkTableComInfoNumOfTags
,
pNode
->
numOfTags
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableComInfoNumOfTags
,
pNode
->
numOfTags
,
code
);
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableComInfoPrecision
,
pNode
->
precision
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableComInfoPrecision
,
pNode
->
precision
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableComInfoNumOfColumns
,
pNode
->
numOfColumns
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableComInfoNumOfColumns
,
pNode
->
numOfColumns
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableComInfoRowSize
,
pNode
->
rowSize
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableComInfoRowSize
,
pNode
->
rowSize
,
code
);
;
}
}
return
code
;
return
code
;
...
@@ -358,12 +362,15 @@ static int32_t jsonToSchema(const SJson* pJson, void* pObj) {
...
@@ -358,12 +362,15 @@ static int32_t jsonToSchema(const SJson* pJson, void* pObj) {
SSchema
*
pNode
=
(
SSchema
*
)
pObj
;
SSchema
*
pNode
=
(
SSchema
*
)
pObj
;
int32_t
code
;
int32_t
code
;
tjsonGetNumberValue
(
pJson
,
jkSchemaType
,
pNode
->
type
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkSchemaType
,
pNode
->
type
,
code
);
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkSchemaColId
,
pNode
->
colId
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkSchemaColId
,
pNode
->
colId
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkSchemaBytes
,
pNode
->
bytes
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkSchemaBytes
,
pNode
->
bytes
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetStringValue
(
pJson
,
jkSchemaName
,
pNode
->
name
);
code
=
tjsonGetStringValue
(
pJson
,
jkSchemaName
,
pNode
->
name
);
...
@@ -415,21 +422,27 @@ static int32_t jsonToTableMeta(const SJson* pJson, void* pObj) {
...
@@ -415,21 +422,27 @@ static int32_t jsonToTableMeta(const SJson* pJson, void* pObj) {
STableMeta
*
pNode
=
(
STableMeta
*
)
pObj
;
STableMeta
*
pNode
=
(
STableMeta
*
)
pObj
;
int32_t
code
;
int32_t
code
;
tjsonGetNumberValue
(
pJson
,
jkTableMetaVgId
,
pNode
->
vgId
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableMetaVgId
,
pNode
->
vgId
,
code
);
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableMetaTableType
,
pNode
->
tableType
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableMetaTableType
,
pNode
->
tableType
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableMetaUid
,
pNode
->
uid
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableMetaUid
,
pNode
->
uid
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableMetaSuid
,
pNode
->
suid
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableMetaSuid
,
pNode
->
suid
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableMetaSversion
,
pNode
->
sversion
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableMetaSversion
,
pNode
->
sversion
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableMetaTversion
,
pNode
->
tversion
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableMetaTversion
,
pNode
->
tversion
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonToObject
(
pJson
,
jkTableMetaComInfo
,
jsonToTableComInfo
,
&
pNode
->
tableInfo
);
code
=
tjsonToObject
(
pJson
,
jkTableMetaComInfo
,
jsonToTableComInfo
,
&
pNode
->
tableInfo
);
...
@@ -605,7 +618,8 @@ static int32_t jsonToLogicFillNode(const SJson* pJson, void* pObj) {
...
@@ -605,7 +618,8 @@ static int32_t jsonToLogicFillNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToLogicPlanNode
(
pJson
,
pObj
);
int32_t
code
=
jsonToLogicPlanNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkFillLogicPlanMode
,
pNode
->
mode
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkFillLogicPlanMode
,
pNode
->
mode
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkFillLogicPlanWStartTs
,
&
pNode
->
pWStartTs
);
code
=
jsonToNodeObject
(
pJson
,
jkFillLogicPlanWStartTs
,
&
pNode
->
pWStartTs
);
...
@@ -881,7 +895,8 @@ static int32_t jsonToLogicSubplan(const SJson* pJson, void* pObj) {
...
@@ -881,7 +895,8 @@ static int32_t jsonToLogicSubplan(const SJson* pJson, void* pObj) {
code
=
jsonToNodeObject
(
pJson
,
jkLogicSubplanRootNode
,
(
SNode
**
)
&
pNode
->
pNode
);
code
=
jsonToNodeObject
(
pJson
,
jkLogicSubplanRootNode
,
(
SNode
**
)
&
pNode
->
pNode
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkLogicSubplanType
,
pNode
->
subplanType
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkLogicSubplanType
,
pNode
->
subplanType
,
code
);
;
}
}
int32_t
objSize
=
0
;
int32_t
objSize
=
0
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
@@ -1121,33 +1136,43 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) {
...
@@ -1121,33 +1136,43 @@ static int32_t jsonToPhysiTableScanNode(const SJson* pJson, void* pObj) {
code
=
tjsonGetDoubleValue
(
pJson
,
jkTableScanPhysiPlanRatio
,
&
pNode
->
ratio
);
code
=
tjsonGetDoubleValue
(
pJson
,
jkTableScanPhysiPlanRatio
,
&
pNode
->
ratio
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanDataRequired
,
pNode
->
dataRequired
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanDataRequired
,
pNode
->
dataRequired
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeList
(
pJson
,
jkTableScanPhysiPlanDynamicScanFuncs
,
&
pNode
->
pDynamicScanFuncs
);
code
=
jsonToNodeList
(
pJson
,
jkTableScanPhysiPlanDynamicScanFuncs
,
&
pNode
->
pDynamicScanFuncs
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanInterval
,
pNode
->
interval
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanInterval
,
pNode
->
interval
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanOffset
,
pNode
->
offset
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanOffset
,
pNode
->
offset
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanSliding
,
pNode
->
sliding
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanSliding
,
pNode
->
sliding
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanIntervalUnit
,
pNode
->
intervalUnit
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanIntervalUnit
,
pNode
->
intervalUnit
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanSlidingUnit
,
pNode
->
slidingUnit
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkTableScanPhysiPlanSlidingUnit
,
pNode
->
slidingUnit
,
code
);
;
}
}
return
code
;
return
code
;
}
}
static
int32_t
physiStreamScanNodeToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
return
physiTableScanNodeToJson
(
pObj
,
pJson
);
}
static
int32_t
physiStreamScanNodeToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
return
physiTableScanNodeToJson
(
pObj
,
pJson
);
}
static
int32_t
jsonToPhysiStreamScanNode
(
const
SJson
*
pJson
,
void
*
pObj
)
{
return
jsonToPhysiTableScanNode
(
pJson
,
pObj
);
}
static
int32_t
jsonToPhysiStreamScanNode
(
const
SJson
*
pJson
,
void
*
pObj
)
{
return
jsonToPhysiTableScanNode
(
pJson
,
pObj
);
}
static
const
char
*
jkSysTableScanPhysiPlanMnodeEpSet
=
"MnodeEpSet"
;
static
const
char
*
jkSysTableScanPhysiPlanMnodeEpSet
=
"MnodeEpSet"
;
static
const
char
*
jkSysTableScanPhysiPlanShowRewrite
=
"ShowRewrite"
;
static
const
char
*
jkSysTableScanPhysiPlanShowRewrite
=
"ShowRewrite"
;
...
@@ -1181,7 +1206,8 @@ static int32_t jsonToPhysiSysTableScanNode(const SJson* pJson, void* pObj) {
...
@@ -1181,7 +1206,8 @@ static int32_t jsonToPhysiSysTableScanNode(const SJson* pJson, void* pObj) {
code
=
tjsonGetBoolValue
(
pJson
,
jkSysTableScanPhysiPlanShowRewrite
,
&
pNode
->
showRewrite
);
code
=
tjsonGetBoolValue
(
pJson
,
jkSysTableScanPhysiPlanShowRewrite
,
&
pNode
->
showRewrite
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkSysTableScanPhysiPlanAccountId
,
pNode
->
accountId
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkSysTableScanPhysiPlanAccountId
,
pNode
->
accountId
,
code
);
;
}
}
return
code
;
return
code
;
...
@@ -1265,7 +1291,8 @@ static int32_t jsonToPhysiJoinNode(const SJson* pJson, void* pObj) {
...
@@ -1265,7 +1291,8 @@ static int32_t jsonToPhysiJoinNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToPhysicPlanNode
(
pJson
,
pObj
);
int32_t
code
=
jsonToPhysicPlanNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkJoinPhysiPlanJoinType
,
pNode
->
joinType
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkJoinPhysiPlanJoinType
,
pNode
->
joinType
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkJoinPhysiPlanOnConditions
,
&
pNode
->
pOnConditions
);
code
=
jsonToNodeObject
(
pJson
,
jkJoinPhysiPlanOnConditions
,
&
pNode
->
pOnConditions
);
...
@@ -1427,10 +1454,12 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) {
...
@@ -1427,10 +1454,12 @@ static int32_t jsonToPhysiWindowNode(const SJson* pJson, void* pObj) {
code
=
jsonToNodeObject
(
pJson
,
jkWindowPhysiPlanTsPk
,
(
SNode
**
)
&
pNode
->
pTspk
);
code
=
jsonToNodeObject
(
pJson
,
jkWindowPhysiPlanTsPk
,
(
SNode
**
)
&
pNode
->
pTspk
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkWindowPhysiPlanTriggerType
,
pNode
->
triggerType
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkWindowPhysiPlanTriggerType
,
pNode
->
triggerType
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkWindowPhysiPlanWatermark
,
pNode
->
watermark
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkWindowPhysiPlanWatermark
,
pNode
->
watermark
,
code
);
;
}
}
return
code
;
return
code
;
...
@@ -1526,7 +1555,8 @@ static int32_t jsonToPhysiFillNode(const SJson* pJson, void* pObj) {
...
@@ -1526,7 +1555,8 @@ static int32_t jsonToPhysiFillNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToPhysicPlanNode
(
pJson
,
pObj
);
int32_t
code
=
jsonToPhysicPlanNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkFillPhysiPlanMode
,
pNode
->
mode
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkFillPhysiPlanMode
,
pNode
->
mode
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkFillPhysiPlanWStartTs
,
&
pNode
->
pWStartTs
);
code
=
jsonToNodeObject
(
pJson
,
jkFillPhysiPlanWStartTs
,
&
pNode
->
pWStartTs
);
...
@@ -1565,7 +1595,8 @@ static int32_t jsonToPhysiSessionWindowNode(const SJson* pJson, void* pObj) {
...
@@ -1565,7 +1595,8 @@ static int32_t jsonToPhysiSessionWindowNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToPhysiWindowNode
(
pJson
,
pObj
);
int32_t
code
=
jsonToPhysiWindowNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkSessionWindowPhysiPlanGap
,
pNode
->
gap
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkSessionWindowPhysiPlanGap
,
pNode
->
gap
,
code
);
;
}
}
return
code
;
return
code
;
...
@@ -1727,7 +1758,8 @@ static int32_t jsonToSubplan(const SJson* pJson, void* pObj) {
...
@@ -1727,7 +1758,8 @@ static int32_t jsonToSubplan(const SJson* pJson, void* pObj) {
int32_t
code
=
tjsonToObject
(
pJson
,
jkSubplanId
,
jsonToSubplanId
,
&
pNode
->
id
);
int32_t
code
=
tjsonToObject
(
pJson
,
jkSubplanId
,
jsonToSubplanId
,
&
pNode
->
id
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkSubplanType
,
pNode
->
subplanType
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkSubplanType
,
pNode
->
subplanType
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetIntValue
(
pJson
,
jkSubplanMsgType
,
&
pNode
->
msgType
);
code
=
tjsonGetIntValue
(
pJson
,
jkSubplanMsgType
,
&
pNode
->
msgType
);
...
@@ -1917,7 +1949,8 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) {
...
@@ -1917,7 +1949,8 @@ static int32_t jsonToColumnNode(const SJson* pJson, void* pObj) {
code
=
tjsonGetSmallIntValue
(
pJson
,
jkColumnColId
,
&
pNode
->
colId
);
code
=
tjsonGetSmallIntValue
(
pJson
,
jkColumnColId
,
&
pNode
->
colId
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkColumnColType
,
pNode
->
colType
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkColumnColType
,
pNode
->
colType
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonGetStringValue
(
pJson
,
jkColumnDbName
,
pNode
->
dbName
);
code
=
tjsonGetStringValue
(
pJson
,
jkColumnDbName
,
pNode
->
dbName
);
...
@@ -2171,7 +2204,8 @@ static int32_t jsonToOperatorNode(const SJson* pJson, void* pObj) {
...
@@ -2171,7 +2204,8 @@ static int32_t jsonToOperatorNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToExprNode
(
pJson
,
pObj
);
int32_t
code
=
jsonToExprNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkOperatorType
,
pNode
->
opType
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkOperatorType
,
pNode
->
opType
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkOperatorLeft
,
&
pNode
->
pLeft
);
code
=
jsonToNodeObject
(
pJson
,
jkOperatorLeft
,
&
pNode
->
pLeft
);
...
@@ -2205,7 +2239,8 @@ static int32_t jsonToLogicConditionNode(const SJson* pJson, void* pObj) {
...
@@ -2205,7 +2239,8 @@ static int32_t jsonToLogicConditionNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToExprNode
(
pJson
,
pObj
);
int32_t
code
=
jsonToExprNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkLogicCondType
,
pNode
->
condType
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkLogicCondType
,
pNode
->
condType
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeList
(
pJson
,
jkLogicCondParameters
,
&
pNode
->
pParameterList
);
code
=
jsonToNodeList
(
pJson
,
jkLogicCondParameters
,
&
pNode
->
pParameterList
);
...
@@ -2350,6 +2385,30 @@ static int32_t jsonToRealTableNode(const SJson* pJson, void* pObj) {
...
@@ -2350,6 +2385,30 @@ static int32_t jsonToRealTableNode(const SJson* pJson, void* pObj) {
return
code
;
return
code
;
}
}
static
const
char
*
jkTempTableSubquery
=
"Subquery"
;
static
int32_t
tempTableNodeToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
STempTableNode
*
pNode
=
(
const
STempTableNode
*
)
pObj
;
int32_t
code
=
tableNodeToJson
(
pObj
,
pJson
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkTempTableSubquery
,
nodeToJson
,
pNode
->
pSubquery
);
}
return
code
;
}
static
int32_t
jsonToTempTableNode
(
const
SJson
*
pJson
,
void
*
pObj
)
{
STempTableNode
*
pNode
=
(
STempTableNode
*
)
pObj
;
int32_t
code
=
jsonToTableNode
(
pJson
,
pObj
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkTempTableSubquery
,
&
pNode
->
pSubquery
);
}
return
code
;
}
static
const
char
*
jkGroupingSetType
=
"GroupingSetType"
;
static
const
char
*
jkGroupingSetType
=
"GroupingSetType"
;
static
const
char
*
jkGroupingSetParameter
=
"Parameters"
;
static
const
char
*
jkGroupingSetParameter
=
"Parameters"
;
...
@@ -2387,10 +2446,12 @@ static int32_t jsonToOrderByExprNode(const SJson* pJson, void* pObj) {
...
@@ -2387,10 +2446,12 @@ static int32_t jsonToOrderByExprNode(const SJson* pJson, void* pObj) {
int32_t
code
=
jsonToNodeObject
(
pJson
,
jkOrderByExprExpr
,
&
pNode
->
pExpr
);
int32_t
code
=
jsonToNodeObject
(
pJson
,
jkOrderByExprExpr
,
&
pNode
->
pExpr
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkOrderByExprOrder
,
pNode
->
order
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkOrderByExprOrder
,
pNode
->
order
,
code
);
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
tjsonGetNumberValue
(
pJson
,
jkOrderByExprNullOrder
,
pNode
->
nullOrder
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkOrderByExprNullOrder
,
pNode
->
nullOrder
,
code
);
;
}
}
return
code
;
return
code
;
...
@@ -2497,7 +2558,8 @@ static int32_t jsonToFillNode(const SJson* pJson, void* pObj) {
...
@@ -2497,7 +2558,8 @@ static int32_t jsonToFillNode(const SJson* pJson, void* pObj) {
SFillNode
*
pNode
=
(
SFillNode
*
)
pObj
;
SFillNode
*
pNode
=
(
SFillNode
*
)
pObj
;
int32_t
code
;
int32_t
code
;
tjsonGetNumberValue
(
pJson
,
jkFillMode
,
pNode
->
mode
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkFillMode
,
pNode
->
mode
,
code
);
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkFillValues
,
&
pNode
->
pValues
);
code
=
jsonToNodeObject
(
pJson
,
jkFillValues
,
&
pNode
->
pValues
);
}
}
...
@@ -2663,6 +2725,60 @@ static int32_t jsonToDataBlockDescNode(const SJson* pJson, void* pObj) {
...
@@ -2663,6 +2725,60 @@ static int32_t jsonToDataBlockDescNode(const SJson* pJson, void* pObj) {
return
code
;
return
code
;
}
}
static
const
char
*
jkSetOperatorOpType
=
"OpType"
;
static
const
char
*
jkSetOperatorProjections
=
"Projections"
;
static
const
char
*
jkSetOperatorLeft
=
"Left"
;
static
const
char
*
jkSetOperatorRight
=
"Right"
;
static
const
char
*
jkSetOperatorOrderByList
=
"OrderByList"
;
static
const
char
*
jkSetOperatorLimit
=
"Limit"
;
static
int32_t
setOperatorToJson
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SSetOperator
*
pNode
=
(
const
SSetOperator
*
)
pObj
;
int32_t
code
=
tjsonAddIntegerToObject
(
pJson
,
jkSetOperatorOpType
,
pNode
->
opType
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodeListToJson
(
pJson
,
jkSetOperatorProjections
,
pNode
->
pProjectionList
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkSetOperatorLeft
,
nodeToJson
,
pNode
->
pLeft
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkSetOperatorRight
,
nodeToJson
,
pNode
->
pRight
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodeListToJson
(
pJson
,
jkSetOperatorOrderByList
,
pNode
->
pOrderByList
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonAddObject
(
pJson
,
jkSetOperatorLimit
,
nodeToJson
,
pNode
->
pLimit
);
}
return
code
;
}
static
int32_t
jsonToSetOperator
(
const
SJson
*
pJson
,
void
*
pObj
)
{
SSetOperator
*
pNode
=
(
SSetOperator
*
)
pObj
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
tjsonGetNumberValue
(
pJson
,
jkSetOperatorOpType
,
pNode
->
opType
,
code
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeList
(
pJson
,
jkSetOperatorProjections
,
&
pNode
->
pProjectionList
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkSetOperatorLeft
,
&
pNode
->
pLeft
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkSetOperatorRight
,
&
pNode
->
pRight
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeList
(
pJson
,
jkSetOperatorOrderByList
,
&
pNode
->
pOrderByList
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
jsonToNodeObject
(
pJson
,
jkSetOperatorLimit
,
&
pNode
->
pLimit
);
}
return
code
;
}
static
const
char
*
jkSelectStmtDistinct
=
"Distinct"
;
static
const
char
*
jkSelectStmtDistinct
=
"Distinct"
;
static
const
char
*
jkSelectStmtProjections
=
"Projections"
;
static
const
char
*
jkSelectStmtProjections
=
"Projections"
;
static
const
char
*
jkSelectStmtFrom
=
"From"
;
static
const
char
*
jkSelectStmtFrom
=
"From"
;
...
@@ -2677,7 +2793,7 @@ static const char* jkSelectStmtSlimit = "Slimit";
...
@@ -2677,7 +2793,7 @@ static const char* jkSelectStmtSlimit = "Slimit";
static
const
char
*
jkSelectStmtStmtName
=
"StmtName"
;
static
const
char
*
jkSelectStmtStmtName
=
"StmtName"
;
static
const
char
*
jkSelectStmtHasAggFuncs
=
"HasAggFuncs"
;
static
const
char
*
jkSelectStmtHasAggFuncs
=
"HasAggFuncs"
;
static
int32_t
selectStmtTo
j
son
(
const
void
*
pObj
,
SJson
*
pJson
)
{
static
int32_t
selectStmtTo
J
son
(
const
void
*
pObj
,
SJson
*
pJson
)
{
const
SSelectStmt
*
pNode
=
(
const
SSelectStmt
*
)
pObj
;
const
SSelectStmt
*
pNode
=
(
const
SSelectStmt
*
)
pObj
;
int32_t
code
=
tjsonAddBoolToObject
(
pJson
,
jkSelectStmtDistinct
,
pNode
->
isDistinct
);
int32_t
code
=
tjsonAddBoolToObject
(
pJson
,
jkSelectStmtDistinct
,
pNode
->
isDistinct
);
...
@@ -2819,6 +2935,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
...
@@ -2819,6 +2935,7 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
case
QUERY_NODE_REAL_TABLE
:
case
QUERY_NODE_REAL_TABLE
:
return
realTableNodeToJson
(
pObj
,
pJson
);
return
realTableNodeToJson
(
pObj
,
pJson
);
case
QUERY_NODE_TEMP_TABLE
:
case
QUERY_NODE_TEMP_TABLE
:
return
tempTableNodeToJson
(
pObj
,
pJson
);
case
QUERY_NODE_JOIN_TABLE
:
case
QUERY_NODE_JOIN_TABLE
:
break
;
break
;
case
QUERY_NODE_GROUPING_SET
:
case
QUERY_NODE_GROUPING_SET
:
...
@@ -2848,9 +2965,9 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
...
@@ -2848,9 +2965,9 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
case
QUERY_NODE_DOWNSTREAM_SOURCE
:
case
QUERY_NODE_DOWNSTREAM_SOURCE
:
return
downstreamSourceNodeToJson
(
pObj
,
pJson
);
return
downstreamSourceNodeToJson
(
pObj
,
pJson
);
case
QUERY_NODE_SET_OPERATOR
:
case
QUERY_NODE_SET_OPERATOR
:
break
;
return
setOperatorToJson
(
pObj
,
pJson
)
;
case
QUERY_NODE_SELECT_STMT
:
case
QUERY_NODE_SELECT_STMT
:
return
selectStmtTo
j
son
(
pObj
,
pJson
);
return
selectStmtTo
J
son
(
pObj
,
pJson
);
case
QUERY_NODE_VNODE_MODIF_STMT
:
case
QUERY_NODE_VNODE_MODIF_STMT
:
case
QUERY_NODE_CREATE_DATABASE_STMT
:
case
QUERY_NODE_CREATE_DATABASE_STMT
:
case
QUERY_NODE_CREATE_TABLE_STMT
:
case
QUERY_NODE_CREATE_TABLE_STMT
:
...
@@ -2918,7 +3035,6 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
...
@@ -2918,7 +3035,6 @@ static int32_t specificNodeToJson(const void* pObj, SJson* pJson) {
case
QUERY_NODE_PHYSICAL_PLAN
:
case
QUERY_NODE_PHYSICAL_PLAN
:
return
planToJson
(
pObj
,
pJson
);
return
planToJson
(
pObj
,
pJson
);
default:
default:
// assert(0);
break
;
break
;
}
}
nodesWarn
(
"specificNodeToJson unknown node = %s"
,
nodesNodeName
(
nodeType
(
pObj
)));
nodesWarn
(
"specificNodeToJson unknown node = %s"
,
nodesNodeName
(
nodeType
(
pObj
)));
...
@@ -2939,6 +3055,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
...
@@ -2939,6 +3055,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return
jsonToFunctionNode
(
pJson
,
pObj
);
return
jsonToFunctionNode
(
pJson
,
pObj
);
case
QUERY_NODE_REAL_TABLE
:
case
QUERY_NODE_REAL_TABLE
:
return
jsonToRealTableNode
(
pJson
,
pObj
);
return
jsonToRealTableNode
(
pJson
,
pObj
);
case
QUERY_NODE_TEMP_TABLE
:
return
jsonToTempTableNode
(
pJson
,
pObj
);
case
QUERY_NODE_ORDER_BY_EXPR
:
case
QUERY_NODE_ORDER_BY_EXPR
:
return
jsonToOrderByExprNode
(
pJson
,
pObj
);
return
jsonToOrderByExprNode
(
pJson
,
pObj
);
case
QUERY_NODE_INTERVAL_WINDOW
:
case
QUERY_NODE_INTERVAL_WINDOW
:
...
@@ -2955,6 +3073,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
...
@@ -2955,6 +3073,8 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
return
jsonToSlotDescNode
(
pJson
,
pObj
);
return
jsonToSlotDescNode
(
pJson
,
pObj
);
case
QUERY_NODE_DOWNSTREAM_SOURCE
:
case
QUERY_NODE_DOWNSTREAM_SOURCE
:
return
jsonToDownstreamSourceNode
(
pJson
,
pObj
);
return
jsonToDownstreamSourceNode
(
pJson
,
pObj
);
case
QUERY_NODE_SET_OPERATOR
:
return
jsonToSetOperator
(
pJson
,
pObj
);
case
QUERY_NODE_SELECT_STMT
:
case
QUERY_NODE_SELECT_STMT
:
return
jsonToSelectStmt
(
pJson
,
pObj
);
return
jsonToSelectStmt
(
pJson
,
pObj
);
case
QUERY_NODE_CREATE_TOPIC_STMT
:
case
QUERY_NODE_CREATE_TOPIC_STMT
:
...
@@ -3007,7 +3127,6 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
...
@@ -3007,7 +3127,6 @@ static int32_t jsonToSpecificNode(const SJson* pJson, void* pObj) {
case
QUERY_NODE_PHYSICAL_PLAN
:
case
QUERY_NODE_PHYSICAL_PLAN
:
return
jsonToPlan
(
pJson
,
pObj
);
return
jsonToPlan
(
pJson
,
pObj
);
default:
default:
assert
(
0
);
break
;
break
;
}
}
nodesWarn
(
"jsonToSpecificNode unknown node = %s"
,
nodesNodeName
(
nodeType
(
pObj
)));
nodesWarn
(
"jsonToSpecificNode unknown node = %s"
,
nodesNodeName
(
nodeType
(
pObj
)));
...
@@ -3038,7 +3157,8 @@ static int32_t jsonToNode(const SJson* pJson, void* pObj) {
...
@@ -3038,7 +3157,8 @@ static int32_t jsonToNode(const SJson* pJson, void* pObj) {
SNode
*
pNode
=
(
SNode
*
)
pObj
;
SNode
*
pNode
=
(
SNode
*
)
pObj
;
int32_t
code
;
int32_t
code
;
tjsonGetNumberValue
(
pJson
,
jkNodeType
,
pNode
->
type
,
code
);;
tjsonGetNumberValue
(
pJson
,
jkNodeType
,
pNode
->
type
,
code
);
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
tjsonToObject
(
pJson
,
nodesNodeName
(
pNode
->
type
),
jsonToSpecificNode
,
pNode
);
code
=
tjsonToObject
(
pJson
,
nodesNodeName
(
pNode
->
type
),
jsonToSpecificNode
,
pNode
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
6f48fa5f
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include <regex.h>
#include "parAst.h"
#include "parAst.h"
#include "parUtil.h"
#include "parUtil.h"
#include "ttime.h"
#include "ttime.h"
...
@@ -76,6 +78,19 @@ static bool checkUserName(SAstCreateContext* pCxt, SToken* pUserName) {
...
@@ -76,6 +78,19 @@ static bool checkUserName(SAstCreateContext* pCxt, SToken* pUserName) {
return
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
;
return
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
;
}
}
static
bool
invalidPassword
(
const
char
*
pPassword
)
{
regex_t
regex
;
if
(
regcomp
(
&
regex
,
"[ '
\"
`
\\
]"
,
REG_EXTENDED
|
REG_ICASE
)
!=
0
)
{
return
false
;
}
/* Execute regular expression */
int32_t
res
=
regexec
(
&
regex
,
pPassword
,
0
,
NULL
,
0
);
regfree
(
&
regex
);
return
0
==
res
;
}
static
bool
checkPassword
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pPasswordToken
,
char
*
pPassword
)
{
static
bool
checkPassword
(
SAstCreateContext
*
pCxt
,
const
SToken
*
pPasswordToken
,
char
*
pPassword
)
{
if
(
NULL
==
pPasswordToken
)
{
if
(
NULL
==
pPasswordToken
)
{
pCxt
->
errCode
=
TSDB_CODE_PAR_SYNTAX_ERROR
;
pCxt
->
errCode
=
TSDB_CODE_PAR_SYNTAX_ERROR
;
...
@@ -86,6 +101,8 @@ static bool checkPassword(SAstCreateContext* pCxt, const SToken* pPasswordToken,
...
@@ -86,6 +101,8 @@ static bool checkPassword(SAstCreateContext* pCxt, const SToken* pPasswordToken,
strdequote
(
pPassword
);
strdequote
(
pPassword
);
if
(
strtrim
(
pPassword
)
<=
0
)
{
if
(
strtrim
(
pPassword
)
<=
0
)
{
pCxt
->
errCode
=
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_PASSWD_EMPTY
);
pCxt
->
errCode
=
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_PASSWD_EMPTY
);
}
else
if
(
invalidPassword
(
pPassword
))
{
pCxt
->
errCode
=
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_PASSWD
);
}
}
}
}
return
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
;
return
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
;
...
...
source/libs/parser/src/parAuthenticator.c
浏览文件 @
6f48fa5f
...
@@ -65,13 +65,19 @@ static int32_t authSetOperator(SAuthCxt* pCxt, SSetOperator* pSetOper) {
...
@@ -65,13 +65,19 @@ static int32_t authSetOperator(SAuthCxt* pCxt, SSetOperator* pSetOper) {
return
code
;
return
code
;
}
}
static
int32_t
authDropUser
(
SAuthCxt
*
pCxt
,
SDropUserReq
*
pStmt
)
{
if
(
!
pCxt
->
pParseCxt
->
isSuperUser
||
0
==
strcmp
(
pStmt
->
user
,
TSDB_DEFAULT_USER
))
{
return
TSDB_CODE_PAR_PERMISSION_DENIED
;
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
authQuery
(
SAuthCxt
*
pCxt
,
SNode
*
pStmt
)
{
static
int32_t
authQuery
(
SAuthCxt
*
pCxt
,
SNode
*
pStmt
)
{
switch
(
nodeType
(
pStmt
))
{
switch
(
nodeType
(
pStmt
))
{
case
QUERY_NODE_SET_OPERATOR
:
case
QUERY_NODE_SET_OPERATOR
:
return
authSetOperator
(
pCxt
,
(
SSetOperator
*
)
pStmt
);
return
authSetOperator
(
pCxt
,
(
SSetOperator
*
)
pStmt
);
case
QUERY_NODE_SELECT_STMT
:
case
QUERY_NODE_SELECT_STMT
:
return
authSelect
(
pCxt
,
(
SSelectStmt
*
)
pStmt
);
return
authSelect
(
pCxt
,
(
SSelectStmt
*
)
pStmt
);
case
QUERY_NODE_VNODE_MODIF_STMT
:
case
QUERY_NODE_CREATE_DATABASE_STMT
:
case
QUERY_NODE_CREATE_DATABASE_STMT
:
case
QUERY_NODE_DROP_DATABASE_STMT
:
case
QUERY_NODE_DROP_DATABASE_STMT
:
case
QUERY_NODE_ALTER_DATABASE_STMT
:
case
QUERY_NODE_ALTER_DATABASE_STMT
:
...
@@ -84,7 +90,10 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
...
@@ -84,7 +90,10 @@ static int32_t authQuery(SAuthCxt* pCxt, SNode* pStmt) {
case
QUERY_NODE_ALTER_TABLE_STMT
:
case
QUERY_NODE_ALTER_TABLE_STMT
:
case
QUERY_NODE_CREATE_USER_STMT
:
case
QUERY_NODE_CREATE_USER_STMT
:
case
QUERY_NODE_ALTER_USER_STMT
:
case
QUERY_NODE_ALTER_USER_STMT
:
case
QUERY_NODE_DROP_USER_STMT
:
break
;
case
QUERY_NODE_DROP_USER_STMT
:
{
return
authDropUser
(
pCxt
,
(
SDropUserReq
*
)
pStmt
);
}
case
QUERY_NODE_USE_DATABASE_STMT
:
case
QUERY_NODE_USE_DATABASE_STMT
:
case
QUERY_NODE_CREATE_DNODE_STMT
:
case
QUERY_NODE_CREATE_DNODE_STMT
:
case
QUERY_NODE_DROP_DNODE_STMT
:
case
QUERY_NODE_DROP_DNODE_STMT
:
...
...
source/libs/parser/src/parCalcConst.c
浏览文件 @
6f48fa5f
...
@@ -262,9 +262,9 @@ static int32_t calcConstQuery(SCalcConstContext* pCxt, SNode* pStmt, bool subque
...
@@ -262,9 +262,9 @@ static int32_t calcConstQuery(SCalcConstContext* pCxt, SNode* pStmt, bool subque
break
;
break
;
case
QUERY_NODE_SET_OPERATOR
:
{
case
QUERY_NODE_SET_OPERATOR
:
{
SSetOperator
*
pSetOp
=
(
SSetOperator
*
)
pStmt
;
SSetOperator
*
pSetOp
=
(
SSetOperator
*
)
pStmt
;
code
=
calcConstQuery
(
pCxt
,
pSetOp
->
pLeft
,
subquery
);
code
=
calcConstQuery
(
pCxt
,
pSetOp
->
pLeft
,
false
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
calcConstQuery
(
pCxt
,
pSetOp
->
pRight
,
subquery
);
code
=
calcConstQuery
(
pCxt
,
pSetOp
->
pRight
,
false
);
}
}
break
;
break
;
}
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
6f48fa5f
...
@@ -480,6 +480,31 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode* pCol) {
...
@@ -480,6 +480,31 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode* pCol) {
return
res
;
return
res
;
}
}
static
int32_t
parseTimeFromValueNode
(
SValueNode
*
pVal
)
{
if
(
IS_SIGNED_NUMERIC_TYPE
(
pVal
->
node
.
resType
.
type
))
{
return
TSDB_CODE_SUCCESS
;
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
pVal
->
node
.
resType
.
type
))
{
pVal
->
datum
.
i
=
pVal
->
datum
.
u
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
IS_FLOAT_TYPE
(
pVal
->
node
.
resType
.
type
))
{
pVal
->
datum
.
i
=
pVal
->
datum
.
d
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
TSDB_DATA_TYPE_BOOL
==
pVal
->
node
.
resType
.
type
)
{
pVal
->
datum
.
i
=
pVal
->
datum
.
b
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
IS_VAR_DATA_TYPE
(
pVal
->
node
.
resType
.
type
)
||
TSDB_DATA_TYPE_TIMESTAMP
==
pVal
->
node
.
resType
.
type
)
{
if
(
TSDB_CODE_SUCCESS
==
taosParseTime
(
pVal
->
literal
,
&
pVal
->
datum
.
i
,
pVal
->
node
.
resType
.
bytes
,
pVal
->
node
.
resType
.
precision
,
tsDaylight
))
{
return
TSDB_CODE_SUCCESS
;
}
char
*
pEnd
=
NULL
;
pVal
->
datum
.
i
=
strtoll
(
pVal
->
literal
,
&
pEnd
,
10
);
return
(
NULL
!=
pEnd
&&
'\0'
==
*
pEnd
)
?
TSDB_CODE_SUCCESS
:
TSDB_CODE_FAILED
;
}
else
{
return
TSDB_CODE_FAILED
;
}
}
static
EDealRes
translateValueImpl
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
,
SDataType
targetDt
)
{
static
EDealRes
translateValueImpl
(
STranslateContext
*
pCxt
,
SValueNode
*
pVal
,
SDataType
targetDt
)
{
uint8_t
precision
=
(
NULL
!=
pCxt
->
pCurrStmt
?
pCxt
->
pCurrStmt
->
precision
:
targetDt
.
precision
);
uint8_t
precision
=
(
NULL
!=
pCxt
->
pCurrStmt
?
pCxt
->
pCurrStmt
->
precision
:
targetDt
.
precision
);
pVal
->
node
.
resType
.
precision
=
precision
;
pVal
->
node
.
resType
.
precision
=
precision
;
...
@@ -571,7 +596,7 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD
...
@@ -571,7 +596,7 @@ static EDealRes translateValueImpl(STranslateContext* pCxt, SValueNode* pVal, SD
break
;
break
;
}
}
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
if
(
taosParseTime
(
pVal
->
literal
,
&
pVal
->
datum
.
i
,
targetDt
.
bytes
,
precision
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
TSDB_CODE_SUCCESS
!=
parseTimeFromValueNode
(
pVal
)
)
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
pVal
->
literal
);
}
}
*
(
int64_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
*
(
int64_t
*
)
&
pVal
->
typeData
=
pVal
->
datum
.
i
;
...
@@ -1660,10 +1685,10 @@ static int32_t createPrimaryKeyColByTable(STranslateContext* pCxt, STableNode* p
...
@@ -1660,10 +1685,10 @@ static int32_t createPrimaryKeyColByTable(STranslateContext* pCxt, STableNode* p
if
(
NULL
==
pCol
)
{
if
(
NULL
==
pCol
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
if
(
QUERY_NODE_REAL_TABLE
==
nodeType
(
pTable
))
{
pCol
->
colId
=
PRIMARYKEY_TIMESTAMP_COL_ID
;
setColumnInfoBySchema
((
SRealTableNode
*
)
pTable
,
((
SRealTableNode
*
)
pTable
)
->
pMeta
->
schema
,
false
,
pCol
);
strcpy
(
pCol
->
colName
,
PK_TS_COL_INTERNAL_NAME
);
}
else
{
if
(
!
findAndSetColumn
(
pCol
,
pTable
))
{
// todo
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INVALID_TIMELINE_FUNC
);
}
}
*
pPrimaryKey
=
(
SNode
*
)
pCol
;
*
pPrimaryKey
=
(
SNode
*
)
pCol
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
6f48fa5f
...
@@ -148,6 +148,10 @@ static char* getSyntaxErrFormat(int32_t errCode) {
...
@@ -148,6 +148,10 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"Invalid number of tag columns"
;
return
"Invalid number of tag columns"
;
case
TSDB_CODE_PAR_INVALID_INTERNAL_PK
:
case
TSDB_CODE_PAR_INVALID_INTERNAL_PK
:
return
"Invalid _c0 or _rowts expression"
;
return
"Invalid _c0 or _rowts expression"
;
case
TSDB_CODE_PAR_INVALID_TIMELINE_FUNC
:
return
"Invalid timeline function"
;
case
TSDB_CODE_PAR_INVALID_PASSWD
:
return
"Invalid password"
;
case
TSDB_CODE_OUT_OF_MEMORY
:
case
TSDB_CODE_OUT_OF_MEMORY
:
return
"Out of memory"
;
return
"Out of memory"
;
default:
default:
...
...
source/libs/parser/test/parSelectTest.cpp
浏览文件 @
6f48fa5f
...
@@ -187,7 +187,7 @@ TEST_F(ParserSelectTest, semanticError) {
...
@@ -187,7 +187,7 @@ TEST_F(ParserSelectTest, semanticError) {
run
(
"SELECT c2 FROM t1 tt1, t1 tt2 WHERE tt1.c1 = tt2.c1"
,
TSDB_CODE_PAR_AMBIGUOUS_COLUMN
,
PARSER_STAGE_TRANSLATE
);
run
(
"SELECT c2 FROM t1 tt1, t1 tt2 WHERE tt1.c1 = tt2.c1"
,
TSDB_CODE_PAR_AMBIGUOUS_COLUMN
,
PARSER_STAGE_TRANSLATE
);
// TSDB_CODE_PAR_WRONG_VALUE_TYPE
// TSDB_CODE_PAR_WRONG_VALUE_TYPE
run
(
"SELECT timestamp '2010' FROM t1"
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
PARSER_STAGE_TRANSLATE
);
run
(
"SELECT timestamp '2010
a
' FROM t1"
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
PARSER_STAGE_TRANSLATE
);
// TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION
// TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION
run
(
"SELECT c2 FROM t1 tt1 join t1 tt2 on COUNT(*) > 0"
,
TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION
,
run
(
"SELECT c2 FROM t1 tt1 join t1 tt2 on COUNT(*) > 0"
,
TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION
,
...
@@ -235,9 +235,11 @@ TEST_F(ParserSelectTest, semanticError) {
...
@@ -235,9 +235,11 @@ TEST_F(ParserSelectTest, semanticError) {
TEST_F
(
ParserSelectTest
,
setOperator
)
{
TEST_F
(
ParserSelectTest
,
setOperator
)
{
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
run
(
"SELECT * FROM t1 UNION ALL SELECT * FROM t1"
);
//
run("SELECT * FROM t1 UNION ALL SELECT * FROM t1");
run
(
"(SELECT * FROM t1) UNION ALL (SELECT * FROM t1)"
);
// run("(SELECT * FROM t1) UNION ALL (SELECT * FROM t1)");
run
(
"SELECT c1 FROM (SELECT c1 FROM t1 UNION ALL SELECT c1 FROM t1)"
);
}
}
}
// namespace ParserTest
}
// namespace ParserTest
source/libs/planner/src/planOptimizer.c
浏览文件 @
6f48fa5f
...
@@ -582,7 +582,7 @@ static bool cpdIsPrimaryKeyEqualCond(SJoinLogicNode* pJoin, SNode* pCond) {
...
@@ -582,7 +582,7 @@ static bool cpdIsPrimaryKeyEqualCond(SJoinLogicNode* pJoin, SNode* pCond) {
return
false
;
return
false
;
}
}
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
p
Join
->
pOnConditions
;
SOperatorNode
*
pOper
=
(
SOperatorNode
*
)
p
Cond
;
if
(
OP_TYPE_EQUAL
!=
pOper
->
opType
)
{
if
(
OP_TYPE_EQUAL
!=
pOper
->
opType
)
{
return
false
;
return
false
;
}
}
...
@@ -608,12 +608,16 @@ static int32_t cpdCheckLogicCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin,
...
@@ -608,12 +608,16 @@ static int32_t cpdCheckLogicCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin,
if
(
LOGIC_COND_TYPE_AND
!=
pOnCond
->
condType
)
{
if
(
LOGIC_COND_TYPE_AND
!=
pOnCond
->
condType
)
{
return
generateUsageErrMsg
(
pCxt
->
pPlanCxt
->
pMsg
,
pCxt
->
pPlanCxt
->
msgLen
,
TSDB_CODE_PLAN_EXPECTED_TS_EQUAL
);
return
generateUsageErrMsg
(
pCxt
->
pPlanCxt
->
pMsg
,
pCxt
->
pPlanCxt
->
msgLen
,
TSDB_CODE_PLAN_EXPECTED_TS_EQUAL
);
}
}
bool
hasPrimaryKeyEqualCond
=
false
;
SNode
*
pCond
=
NULL
;
SNode
*
pCond
=
NULL
;
FOREACH
(
pCond
,
pOnCond
->
pParameterList
)
{
FOREACH
(
pCond
,
pOnCond
->
pParameterList
)
{
if
(
!
cpdIsPrimaryKeyEqualCond
(
pJoin
,
pCond
))
{
if
(
cpdIsPrimaryKeyEqualCond
(
pJoin
,
pCond
))
{
return
generateUsageErrMsg
(
pCxt
->
pPlanCxt
->
pMsg
,
pCxt
->
pPlanCxt
->
msgLen
,
TSDB_CODE_PLAN_EXPECTED_TS_EQUAL
)
;
hasPrimaryKeyEqualCond
=
true
;
}
}
}
}
if
(
!
hasPrimaryKeyEqualCond
)
{
return
generateUsageErrMsg
(
pCxt
->
pPlanCxt
->
pMsg
,
pCxt
->
pPlanCxt
->
msgLen
,
TSDB_CODE_PLAN_EXPECTED_TS_EQUAL
);
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
6f48fa5f
...
@@ -261,6 +261,22 @@ typedef struct SSetSlotIdCxt {
...
@@ -261,6 +261,22 @@ typedef struct SSetSlotIdCxt {
SHashObj
*
pRightHash
;
SHashObj
*
pRightHash
;
}
SSetSlotIdCxt
;
}
SSetSlotIdCxt
;
static
void
dumpSlots
(
const
char
*
pName
,
SHashObj
*
pHash
)
{
if
(
NULL
==
pHash
)
{
return
;
}
planDebug
(
"%s"
,
pName
);
void
*
pIt
=
taosHashIterate
(
pHash
,
NULL
);
while
(
NULL
!=
pIt
)
{
size_t
len
=
0
;
char
*
pKey
=
taosHashGetKey
(
pIt
,
&
len
);
char
name
[
TSDB_TABLE_NAME_LEN
+
TSDB_COL_NAME_LEN
]
=
{
0
};
strncpy
(
name
,
pKey
,
len
);
planDebug
(
"
\t
slot name = %s"
,
name
);
pIt
=
taosHashIterate
(
pHash
,
pIt
);
}
}
static
EDealRes
doSetSlotId
(
SNode
*
pNode
,
void
*
pContext
)
{
static
EDealRes
doSetSlotId
(
SNode
*
pNode
,
void
*
pContext
)
{
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
)
&&
0
!=
strcmp
(((
SColumnNode
*
)
pNode
)
->
colName
,
"*"
))
{
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
)
&&
0
!=
strcmp
(((
SColumnNode
*
)
pNode
)
->
colName
,
"*"
))
{
SSetSlotIdCxt
*
pCxt
=
(
SSetSlotIdCxt
*
)
pContext
;
SSetSlotIdCxt
*
pCxt
=
(
SSetSlotIdCxt
*
)
pContext
;
...
@@ -273,6 +289,8 @@ static EDealRes doSetSlotId(SNode* pNode, void* pContext) {
...
@@ -273,6 +289,8 @@ static EDealRes doSetSlotId(SNode* pNode, void* pContext) {
// pIndex is definitely not NULL, otherwise it is a bug
// pIndex is definitely not NULL, otherwise it is a bug
if
(
NULL
==
pIndex
)
{
if
(
NULL
==
pIndex
)
{
planError
(
"doSetSlotId failed, invalid slot name %s"
,
name
);
planError
(
"doSetSlotId failed, invalid slot name %s"
,
name
);
dumpSlots
(
"left datablock desc"
,
pCxt
->
pLeftHash
);
dumpSlots
(
"right datablock desc"
,
pCxt
->
pRightHash
);
pCxt
->
errCode
=
TSDB_CODE_PLAN_INTERNAL_ERROR
;
pCxt
->
errCode
=
TSDB_CODE_PLAN_INTERNAL_ERROR
;
return
DEAL_RES_ERROR
;
return
DEAL_RES_ERROR
;
}
}
...
...
source/libs/planner/test/planJoinTest.cpp
浏览文件 @
6f48fa5f
...
@@ -23,10 +23,16 @@ class PlanJoinTest : public PlannerTestBase {};
...
@@ -23,10 +23,16 @@ class PlanJoinTest : public PlannerTestBase {};
TEST_F
(
PlanJoinTest
,
basic
)
{
TEST_F
(
PlanJoinTest
,
basic
)
{
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
run
(
"
select t1.c1, t2.c2 from st1s1 t1, st1s2 t2 where
t1.ts = t2.ts"
);
run
(
"
SELECT t1.c1, t2.c2 FROM st1s1 t1, st1s2 t2 WHERE
t1.ts = t2.ts"
);
run
(
"
select t1.*, t2.* from st1s1 t1, st1s2 t2 where
t1.ts = t2.ts"
);
run
(
"
SELECT t1.*, t2.* FROM st1s1 t1, st1s2 t2 WHERE
t1.ts = t2.ts"
);
// run("select t1.c1, t2.c1 from st1s1 t1 join st1s2 t2 on t1.ts = t2.ts where t1.c1 > t2.c1 and t1.c2 = 'abc' and "
run
(
"SELECT t1.c1, t2.c1 FROM st1s1 t1 JOIN st1s2 t2 ON t1.ts = t2.ts"
);
// "t2.c2 = 'qwe'");
}
TEST_F
(
PlanJoinTest
,
withWhere
)
{
useDb
(
"root"
,
"test"
);
run
(
"SELECT t1.c1, t2.c1 FROM st1s1 t1 JOIN st1s2 t2 ON t1.ts = t2.ts "
"WHERE t1.c1 > t2.c1 AND t1.c2 = 'abc' AND t2.c2 = 'qwe'"
);
}
}
source/libs/planner/test/planSubqueryTest.cpp
浏览文件 @
6f48fa5f
...
@@ -23,9 +23,13 @@ class PlanSubqeuryTest : public PlannerTestBase {};
...
@@ -23,9 +23,13 @@ class PlanSubqeuryTest : public PlannerTestBase {};
TEST_F
(
PlanSubqeuryTest
,
basic
)
{
TEST_F
(
PlanSubqeuryTest
,
basic
)
{
useDb
(
"root"
,
"test"
);
useDb
(
"root"
,
"test"
);
run
(
"SELECT * FROM (SELECT * FROM t1)"
);
if
(
0
==
g_skipSql
)
{
run
(
"SELECT * FROM (SELECT * FROM t1)"
);
// run("SELECT LAST(c1) FROM ( SELECT * FROM t1)");
run
(
"SELECT LAST(c1) FROM (SELECT * FROM t1)"
);
}
run
(
"SELECT c1 FROM (SELECT c1 FROM t1 UNION ALL SELECT c1 FROM t1)"
);
}
}
TEST_F
(
PlanSubqeuryTest
,
doubleGroupBy
)
{
TEST_F
(
PlanSubqeuryTest
,
doubleGroupBy
)
{
...
...
source/libs/planner/test/planTestMain.cpp
浏览文件 @
6f48fa5f
...
@@ -25,23 +25,53 @@ class PlannerEnv : public testing::Environment {
...
@@ -25,23 +25,53 @@ class PlannerEnv : public testing::Environment {
virtual
void
SetUp
()
{
virtual
void
SetUp
()
{
initMetaDataEnv
();
initMetaDataEnv
();
generateMetaData
();
generateMetaData
();
initLog
(
"/tmp/td"
);
}
}
virtual
void
TearDown
()
{
destroyMetaDataEnv
();
}
virtual
void
TearDown
()
{
destroyMetaDataEnv
();
}
PlannerEnv
()
{}
PlannerEnv
()
{}
virtual
~
PlannerEnv
()
{}
virtual
~
PlannerEnv
()
{}
private:
void
initLog
(
const
char
*
path
)
{
dDebugFlag
=
143
;
vDebugFlag
=
0
;
mDebugFlag
=
143
;
cDebugFlag
=
0
;
jniDebugFlag
=
0
;
tmrDebugFlag
=
135
;
uDebugFlag
=
135
;
rpcDebugFlag
=
143
;
qDebugFlag
=
143
;
wDebugFlag
=
0
;
sDebugFlag
=
0
;
tsdbDebugFlag
=
0
;
tsLogEmbedded
=
1
;
tsAsyncLog
=
0
;
taosRemoveDir
(
path
);
taosMkDir
(
path
);
tstrncpy
(
tsLogDir
,
path
,
PATH_MAX
);
if
(
taosInitLog
(
"taoslog"
,
1
)
!=
0
)
{
std
::
cout
<<
"failed to init log file"
<<
std
::
endl
;
}
}
};
};
static
void
parseArg
(
int
argc
,
char
*
argv
[])
{
static
void
parseArg
(
int
argc
,
char
*
argv
[])
{
int
opt
=
0
;
int
opt
=
0
;
const
char
*
optstring
=
""
;
const
char
*
optstring
=
""
;
static
struct
option
long_options
[]
=
{{
"dump"
,
optional_argument
,
NULL
,
'd'
},
{
0
,
0
,
0
,
0
}};
static
struct
option
long_options
[]
=
{
{
"dump"
,
optional_argument
,
NULL
,
'd'
},
{
"skipSql"
,
optional_argument
,
NULL
,
's'
},
{
0
,
0
,
0
,
0
}};
while
((
opt
=
getopt_long
(
argc
,
argv
,
optstring
,
long_options
,
NULL
))
!=
-
1
)
{
while
((
opt
=
getopt_long
(
argc
,
argv
,
optstring
,
long_options
,
NULL
))
!=
-
1
)
{
switch
(
opt
)
{
switch
(
opt
)
{
case
'd'
:
case
'd'
:
setDumpModule
(
optarg
);
setDumpModule
(
optarg
);
break
;
break
;
case
's'
:
g_skipSql
=
1
;
break
;
default:
default:
break
;
break
;
}
}
...
...
source/libs/planner/test/planTestUtil.cpp
浏览文件 @
6f48fa5f
...
@@ -47,6 +47,7 @@ enum DumpModule {
...
@@ -47,6 +47,7 @@ enum DumpModule {
};
};
DumpModule
g_dumpModule
=
DUMP_MODULE_NOTHING
;
DumpModule
g_dumpModule
=
DUMP_MODULE_NOTHING
;
int32_t
g_skipSql
=
0
;
void
setDumpModule
(
const
char
*
pModule
)
{
void
setDumpModule
(
const
char
*
pModule
)
{
if
(
NULL
==
pModule
)
{
if
(
NULL
==
pModule
)
{
...
...
source/libs/planner/test/planTestUtil.h
浏览文件 @
6f48fa5f
...
@@ -32,6 +32,8 @@ class PlannerTestBase : public testing::Test {
...
@@ -32,6 +32,8 @@ class PlannerTestBase : public testing::Test {
std
::
unique_ptr
<
PlannerTestBaseImpl
>
impl_
;
std
::
unique_ptr
<
PlannerTestBaseImpl
>
impl_
;
};
};
extern
int32_t
g_skipSql
;
extern
void
setDumpModule
(
const
char
*
pModule
);
extern
void
setDumpModule
(
const
char
*
pModule
);
#endif // PLAN_TEST_UTIL_H
#endif // PLAN_TEST_UTIL_H
source/libs/tdb/CMakeLists.txt
浏览文件 @
6f48fa5f
# tdb
# tdb
add_library
(
tdb S
HARED
""
)
add_library
(
tdb S
TATIC
""
)
target_sources
(
tdb
target_sources
(
tdb
PRIVATE
PRIVATE
"src/db/tdbPCache.c"
"src/db/tdbPCache.c"
...
...
tools/shell/src/shellEngine.c
浏览文件 @
6f48fa5f
...
@@ -604,6 +604,7 @@ int32_t shellCalcColWidth(TAOS_FIELD *field, int32_t precision) {
...
@@ -604,6 +604,7 @@ int32_t shellCalcColWidth(TAOS_FIELD *field, int32_t precision) {
case
TSDB_DATA_TYPE_DOUBLE
:
case
TSDB_DATA_TYPE_DOUBLE
:
return
TMAX
(
25
,
width
);
return
TMAX
(
25
,
width
);
case
TSDB_DATA_TYPE_JSON
:
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_BINARY
:
if
(
field
->
bytes
>
shell
.
args
.
displayWidth
)
{
if
(
field
->
bytes
>
shell
.
args
.
displayWidth
)
{
return
TMAX
(
shell
.
args
.
displayWidth
,
width
);
return
TMAX
(
shell
.
args
.
displayWidth
,
width
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录