Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
055e0516
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
055e0516
编写于
4月 21, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feature/vnode_refact1
上级
1fe0daaf
103af37e
变更
64
显示空白变更内容
内联
并排
Showing
64 changed file
with
2128 addition
and
2197 deletion
+2128
-2197
include/client/taos.h
include/client/taos.h
+1
-0
include/common/taosdef.h
include/common/taosdef.h
+0
-7
include/common/tmsg.h
include/common/tmsg.h
+49
-11
include/libs/catalog/catalog.h
include/libs/catalog/catalog.h
+2
-0
include/libs/function/functionMgt.h
include/libs/function/functionMgt.h
+8
-1
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+3
-0
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+0
-1
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+5
-3
include/libs/planner/planner.h
include/libs/planner/planner.h
+1
-0
include/util/taoserror.h
include/util/taoserror.h
+1
-0
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+0
-1
source/client/inc/clientStmt.h
source/client/inc/clientStmt.h
+1
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+31
-24
source/client/src/clientMain.c
source/client/src/clientMain.c
+4
-0
source/client/src/clientStmt.c
source/client/src/clientStmt.c
+2
-1
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+1
-1
source/common/src/tmsg.c
source/common/src/tmsg.c
+129
-77
source/dnode/mgmt/implement/src/dmTransport.c
source/dnode/mgmt/implement/src/dmTransport.c
+4
-4
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+23
-313
source/dnode/mnode/impl/inc/mndScheduler.h
source/dnode/mnode/impl/inc/mndScheduler.h
+2
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+2
-0
source/dnode/mnode/impl/src/mndDef.c
source/dnode/mnode/impl/src/mndDef.c
+18
-67
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+27
-18
source/dnode/mnode/impl/src/mndInfoSchema.c
source/dnode/mnode/impl/src/mndInfoSchema.c
+1
-1
source/dnode/mnode/impl/src/mndOffset.c
source/dnode/mnode/impl/src/mndOffset.c
+3
-3
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+49
-42
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+48
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+1
-0
source/dnode/mnode/impl/src/mndSubscribe.c
source/dnode/mnode/impl/src/mndSubscribe.c
+18
-568
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+44
-42
source/dnode/mnode/impl/test/func/func.cpp
source/dnode/mnode/impl/test/func/func.cpp
+2
-2
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+13
-0
source/dnode/mnode/impl/test/show/show.cpp
source/dnode/mnode/impl/test/show/show.cpp
+7
-1
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-2
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-0
source/dnode/vnode/src/meta/metaTDBImpl.c
source/dnode/vnode/src/meta/metaTDBImpl.c
+65
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+0
-121
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+21
-26
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+3
-0
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
+23
-17
source/dnode/vnode/src/tsdb/tsdbSma.c
source/dnode/vnode/src/tsdb/tsdbSma.c
+22
-15
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+67
-0
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+143
-129
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+20
-8
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+2
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+93
-8
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+2
-0
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+532
-526
source/libs/planner/src/planLogicCreater.c
source/libs/planner/src/planLogicCreater.c
+166
-8
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+2
-0
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+2
-2
source/libs/planner/src/planScaleOut.c
source/libs/planner/src/planScaleOut.c
+6
-7
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+177
-17
source/libs/planner/test/planSetOpTest.cpp
source/libs/planner/test/planSetOpTest.cpp
+35
-0
source/libs/planner/test/planTestMain.cpp
source/libs/planner/test/planTestMain.cpp
+0
-0
source/libs/planner/test/planTestUtil.cpp
source/libs/planner/test/planTestUtil.cpp
+19
-2
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+49
-0
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+2
-1
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+12
-11
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+3
-22
source/libs/transport/src/transSrv.c
source/libs/transport/src/transSrv.c
+33
-15
tests/script/runAllSimCases.sh
tests/script/runAllSimCases.sh
+1
-1
tests/system-test/2-query/cast.py
tests/system-test/2-query/cast.py
+121
-70
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+5
-1
未找到文件。
include/client/taos.h
浏览文件 @
055e0516
...
@@ -146,6 +146,7 @@ DLL_EXPORT TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt);
...
@@ -146,6 +146,7 @@ DLL_EXPORT TAOS_RES *taos_stmt_use_result(TAOS_STMT *stmt);
DLL_EXPORT
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_close
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
char
*
taos_stmt_errstr
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_affected_rows
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_affected_rows
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
int
taos_stmt_affected_rows_once
(
TAOS_STMT
*
stmt
);
DLL_EXPORT
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
TAOS_RES
*
taos_query
(
TAOS
*
taos
,
const
char
*
sql
);
DLL_EXPORT
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
);
DLL_EXPORT
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
);
...
...
include/common/taosdef.h
浏览文件 @
055e0516
...
@@ -78,13 +78,6 @@ typedef enum {
...
@@ -78,13 +78,6 @@ typedef enum {
TSDB_SMA_TYPE_ROLLUP
=
2
,
// Rollup SMA
TSDB_SMA_TYPE_ROLLUP
=
2
,
// Rollup SMA
}
ETsdbSmaType
;
}
ETsdbSmaType
;
typedef
enum
{
TSDB_BSMA_TYPE_NONE
=
0
,
// no block-wise SMA
TSDB_BSMA_TYPE_I
=
1
,
// sum/min/max(default)
}
ETsdbBSmaType
;
#define TSDB_BSMA_TYPE_LATEST TSDB_BSMA_TYPE_I
extern
char
*
qtypeStr
[];
extern
char
*
qtypeStr
[];
#define TSDB_PORT_HTTP 11
#define TSDB_PORT_HTTP 11
...
...
include/common/tmsg.h
浏览文件 @
055e0516
...
@@ -331,6 +331,8 @@ typedef struct {
...
@@ -331,6 +331,8 @@ typedef struct {
int32_t
pid
;
int32_t
pid
;
char
app
[
TSDB_APP_NAME_LEN
];
char
app
[
TSDB_APP_NAME_LEN
];
char
db
[
TSDB_DB_NAME_LEN
];
char
db
[
TSDB_DB_NAME_LEN
];
char
user
[
TSDB_USER_LEN
];
char
passwd
[
TSDB_PASSWORD_LEN
];
int64_t
startTime
;
int64_t
startTime
;
}
SConnectReq
;
}
SConnectReq
;
...
@@ -680,6 +682,7 @@ int32_t tDeserializeSDropFuncReq(void* buf, int32_t bufLen, SDropFuncReq* pReq);
...
@@ -680,6 +682,7 @@ int32_t tDeserializeSDropFuncReq(void* buf, int32_t bufLen, SDropFuncReq* pReq);
typedef
struct
{
typedef
struct
{
int32_t
numOfFuncs
;
int32_t
numOfFuncs
;
bool
ignoreCodeComment
;
SArray
*
pFuncNames
;
SArray
*
pFuncNames
;
}
SRetrieveFuncReq
;
}
SRetrieveFuncReq
;
...
@@ -708,6 +711,7 @@ typedef struct {
...
@@ -708,6 +711,7 @@ typedef struct {
int32_t
tSerializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
);
int32_t
tSerializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
);
int32_t
tDeserializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
);
int32_t
tDeserializeSRetrieveFuncRsp
(
void
*
buf
,
int32_t
bufLen
,
SRetrieveFuncRsp
*
pRsp
);
void
tFreeSFuncInfo
(
SFuncInfo
*
pInfo
);
void
tFreeSRetrieveFuncRsp
(
SRetrieveFuncRsp
*
pRsp
);
void
tFreeSRetrieveFuncRsp
(
SRetrieveFuncRsp
*
pRsp
);
typedef
struct
{
typedef
struct
{
...
@@ -1275,8 +1279,13 @@ typedef struct {
...
@@ -1275,8 +1279,13 @@ typedef struct {
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TOPIC_FNAME_LEN
];
char
name
[
TSDB_TOPIC_FNAME_LEN
];
int8_t
igExists
;
int8_t
igExists
;
int8_t
withTbName
;
int8_t
withSchema
;
int8_t
withTag
;
int8_t
withTagSchema
;
char
*
sql
;
char
*
sql
;
char
*
ast
;
char
*
ast
;
int64_t
subDbUid
;
char
subscribeDbName
[
TSDB_DB_NAME_LEN
];
char
subscribeDbName
[
TSDB_DB_NAME_LEN
];
}
SCMCreateTopicReq
;
}
SCMCreateTopicReq
;
...
@@ -1471,8 +1480,12 @@ typedef struct {
...
@@ -1471,8 +1480,12 @@ typedef struct {
typedef
struct
{
typedef
struct
{
float
xFilesFactor
;
float
xFilesFactor
;
int32_t
delay
;
int32_t
delay
;
int8_t
nFuncIds
;
int32_t
qmsg1Len
;
int32_t
qmsg2Len
;
func_id_t
*
pFuncIds
;
func_id_t
*
pFuncIds
;
char
*
qmsg1
;
// not null: pAst1:qmsg1:SRetention1 => trigger aggr task1
char
*
qmsg2
;
// not null: pAst2:qmsg2:SRetention2 => trigger aggr task2
int8_t
nFuncIds
;
}
SRSmaParam
;
}
SRSmaParam
;
int
tEncodeSRSmaParam
(
SCoder
*
pCoder
,
const
SRSmaParam
*
pRSmaParam
);
int
tEncodeSRSmaParam
(
SCoder
*
pCoder
,
const
SRSmaParam
*
pRSmaParam
);
...
@@ -1940,12 +1953,22 @@ static FORCE_INLINE void* taosDecodeSMqMsg(void* buf, SMqHbMsg* pMsg) {
...
@@ -1940,12 +1953,22 @@ static FORCE_INLINE void* taosDecodeSMqMsg(void* buf, SMqHbMsg* pMsg) {
return
buf
;
return
buf
;
}
}
enum
{
TOPIC_SUB_TYPE__DB
=
1
,
TOPIC_SUB_TYPE__TABLE
,
};
typedef
struct
{
typedef
struct
{
int64_t
leftForVer
;
int64_t
leftForVer
;
int32_t
vgId
;
int32_t
vgId
;
int64_t
oldConsumerId
;
int64_t
oldConsumerId
;
int64_t
newConsumerId
;
int64_t
newConsumerId
;
char
subKey
[
TSDB_SUBSCRIBE_KEY_LEN
];
char
subKey
[
TSDB_SUBSCRIBE_KEY_LEN
];
int8_t
subType
;
int8_t
withTbName
;
int8_t
withSchema
;
int8_t
withTag
;
int8_t
withTagSchema
;
char
*
qmsg
;
char
*
qmsg
;
}
SMqRebVgReq
;
}
SMqRebVgReq
;
...
@@ -1956,7 +1979,14 @@ static FORCE_INLINE int32_t tEncodeSMqRebVgReq(void** buf, const SMqRebVgReq* pR
...
@@ -1956,7 +1979,14 @@ static FORCE_INLINE int32_t tEncodeSMqRebVgReq(void** buf, const SMqRebVgReq* pR
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
oldConsumerId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
oldConsumerId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
newConsumerId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
newConsumerId
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
subKey
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
subKey
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
subType
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
withTbName
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
withSchema
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
withTag
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
withTagSchema
);
if
(
pReq
->
subType
==
TOPIC_SUB_TYPE__TABLE
)
{
tlen
+=
taosEncodeString
(
buf
,
pReq
->
qmsg
);
tlen
+=
taosEncodeString
(
buf
,
pReq
->
qmsg
);
}
return
tlen
;
return
tlen
;
}
}
...
@@ -1966,7 +1996,14 @@ static FORCE_INLINE void* tDecodeSMqRebVgReq(const void* buf, SMqRebVgReq* pReq)
...
@@ -1966,7 +1996,14 @@ static FORCE_INLINE void* tDecodeSMqRebVgReq(const void* buf, SMqRebVgReq* pReq)
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
oldConsumerId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
oldConsumerId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
newConsumerId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
newConsumerId
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
subKey
);
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
subKey
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pReq
->
subType
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pReq
->
withTbName
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pReq
->
withSchema
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pReq
->
withTag
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pReq
->
withTagSchema
);
if
(
pReq
->
subType
==
TOPIC_SUB_TYPE__TABLE
)
{
buf
=
taosDecodeString
(
buf
,
&
pReq
->
qmsg
);
buf
=
taosDecodeString
(
buf
,
&
pReq
->
qmsg
);
}
return
(
void
*
)
buf
;
return
(
void
*
)
buf
;
}
}
...
@@ -2306,9 +2343,10 @@ static FORCE_INLINE void tdDestroyTSmaWrapper(STSmaWrapper* pSW) {
...
@@ -2306,9 +2343,10 @@ static FORCE_INLINE void tdDestroyTSmaWrapper(STSmaWrapper* pSW) {
}
}
}
}
static
FORCE_INLINE
void
tdFreeTSmaWrapper
(
STSmaWrapper
*
pSW
)
{
static
FORCE_INLINE
void
*
tdFreeTSmaWrapper
(
STSmaWrapper
*
pSW
)
{
tdDestroyTSmaWrapper
(
pSW
);
tdDestroyTSmaWrapper
(
pSW
);
taosMemoryFreeClear
(
pSW
);
taosMemoryFree
(
pSW
);
return
NULL
;
}
}
static
FORCE_INLINE
int32_t
tEncodeTSma
(
void
**
buf
,
const
STSma
*
pSma
)
{
static
FORCE_INLINE
int32_t
tEncodeTSma
(
void
**
buf
,
const
STSma
*
pSma
)
{
...
...
include/libs/catalog/catalog.h
浏览文件 @
055e0516
...
@@ -224,6 +224,8 @@ int32_t catalogGetDBCfg(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
...
@@ -224,6 +224,8 @@ int32_t catalogGetDBCfg(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps, cons
int32_t
catalogGetIndexInfo
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
indexName
,
SIndexInfo
*
pInfo
);
int32_t
catalogGetIndexInfo
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
indexName
,
SIndexInfo
*
pInfo
);
int32_t
catalogGetUdfInfo
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
funcName
,
SFuncInfo
**
pInfo
);
/**
/**
* Destroy catalog and relase all resources
* Destroy catalog and relase all resources
...
...
include/libs/function/functionMgt.h
浏览文件 @
055e0516
...
@@ -119,12 +119,19 @@ typedef enum EFunctionType {
...
@@ -119,12 +119,19 @@ typedef enum EFunctionType {
struct
SqlFunctionCtx
;
struct
SqlFunctionCtx
;
struct
SResultRowEntryInfo
;
struct
SResultRowEntryInfo
;
struct
STimeWindow
;
struct
STimeWindow
;
struct
SCatalog
;
typedef
struct
SFmGetFuncInfoParam
{
struct
SCatalog
*
pCtg
;
void
*
pRpc
;
const
SEpSet
*
pMgmtEps
;
}
SFmGetFuncInfoParam
;
int32_t
fmFuncMgtInit
();
int32_t
fmFuncMgtInit
();
void
fmFuncMgtDestroy
();
void
fmFuncMgtDestroy
();
int32_t
fmGetFuncInfo
(
const
char
*
pFuncName
,
int32_t
*
pFuncId
,
int32_t
*
pFuncType
);
int32_t
fmGetFuncInfo
(
SFmGetFuncInfoParam
*
pParam
,
const
char
*
pFuncName
,
int32_t
*
pFuncId
,
int32_t
*
pFuncType
);
int32_t
fmGetFuncResultType
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
);
int32_t
fmGetFuncResultType
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
);
...
...
include/libs/nodes/nodes.h
浏览文件 @
055e0516
...
@@ -48,6 +48,9 @@ extern "C" {
...
@@ -48,6 +48,9 @@ extern "C" {
(NULL == cell1 ? (node1 = NULL, false) : (node1 = cell1->pNode, true)), (NULL == cell2 ? (node2 = NULL, false) : (node2 = cell2->pNode, true)), (node1 != NULL && node2 != NULL); \
(NULL == cell1 ? (node1 = NULL, false) : (node1 = cell1->pNode, true)), (NULL == cell2 ? (node2 = NULL, false) : (node2 = cell2->pNode, true)), (node1 != NULL && node2 != NULL); \
cell1 = cell1->pNext, cell2 = cell2->pNext)
cell1 = cell1->pNext, cell2 = cell2->pNext)
#define REPLACE_LIST1_NODE(newNode) cell1->pNode = (SNode*)(newNode)
#define REPLACE_LIST2_NODE(newNode) cell2->pNode = (SNode*)(newNode)
#define FOREACH_FOR_REWRITE(node, list) \
#define FOREACH_FOR_REWRITE(node, list) \
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); (NULL != cell ? (node = &(cell->pNode), true) : (node = NULL, false)); cell = cell->pNext)
for (SListCell* cell = (NULL != (list) ? (list)->pHead : NULL); (NULL != cell ? (node = &(cell->pNode), true) : (node = NULL, false)); cell = cell->pNext)
...
...
include/libs/nodes/plannodes.h
浏览文件 @
055e0516
...
@@ -155,7 +155,6 @@ typedef struct SLogicSubplan {
...
@@ -155,7 +155,6 @@ typedef struct SLogicSubplan {
typedef
struct
SQueryLogicPlan
{
typedef
struct
SQueryLogicPlan
{
ENodeType
type
;
ENodeType
type
;
int32_t
totalLevel
;
SNodeList
*
pTopSubplans
;
SNodeList
*
pTopSubplans
;
}
SQueryLogicPlan
;
}
SQueryLogicPlan
;
...
...
include/libs/nodes/querynodes.h
浏览文件 @
055e0516
...
@@ -229,10 +229,10 @@ typedef struct SFillNode {
...
@@ -229,10 +229,10 @@ typedef struct SFillNode {
typedef
struct
SSelectStmt
{
typedef
struct
SSelectStmt
{
ENodeType
type
;
// QUERY_NODE_SELECT_STMT
ENodeType
type
;
// QUERY_NODE_SELECT_STMT
bool
isDistinct
;
bool
isDistinct
;
SNodeList
*
pProjectionList
;
// SNode
SNodeList
*
pProjectionList
;
SNode
*
pFromTable
;
SNode
*
pFromTable
;
SNode
*
pWhere
;
SNode
*
pWhere
;
SNodeList
*
pPartitionByList
;
// SNode
SNodeList
*
pPartitionByList
;
SNode
*
pWindow
;
SNode
*
pWindow
;
SNodeList
*
pGroupByList
;
// SGroupingSetNode
SNodeList
*
pGroupByList
;
// SGroupingSetNode
SNode
*
pHaving
;
SNode
*
pHaving
;
...
@@ -245,12 +245,14 @@ typedef struct SSelectStmt {
...
@@ -245,12 +245,14 @@ typedef struct SSelectStmt {
}
SSelectStmt
;
}
SSelectStmt
;
typedef
enum
ESetOperatorType
{
typedef
enum
ESetOperatorType
{
SET_OP_TYPE_UNION_ALL
=
1
SET_OP_TYPE_UNION_ALL
=
1
,
SET_OP_TYPE_UNION
}
ESetOperatorType
;
}
ESetOperatorType
;
typedef
struct
SSetOperator
{
typedef
struct
SSetOperator
{
ENodeType
type
;
// QUERY_NODE_SET_OPERATOR
ENodeType
type
;
// QUERY_NODE_SET_OPERATOR
ESetOperatorType
opType
;
ESetOperatorType
opType
;
SNodeList
*
pProjectionList
;
SNode
*
pLeft
;
SNode
*
pLeft
;
SNode
*
pRight
;
SNode
*
pRight
;
SNodeList
*
pOrderByList
;
// SOrderByExprNode
SNodeList
*
pOrderByList
;
// SOrderByExprNode
...
...
include/libs/planner/planner.h
浏览文件 @
055e0516
...
@@ -30,6 +30,7 @@ typedef struct SPlanContext {
...
@@ -30,6 +30,7 @@ typedef struct SPlanContext {
SNode
*
pAstRoot
;
SNode
*
pAstRoot
;
bool
topicQuery
;
bool
topicQuery
;
bool
streamQuery
;
bool
streamQuery
;
bool
rSmaQuery
;
bool
showRewrite
;
bool
showRewrite
;
int8_t
triggerType
;
int8_t
triggerType
;
int64_t
watermark
;
int64_t
watermark
;
...
...
include/util/taoserror.h
浏览文件 @
055e0516
...
@@ -614,6 +614,7 @@ int32_t* taosGetErrno();
...
@@ -614,6 +614,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INTER_SLIDING_TOO_BIG TAOS_DEF_ERROR_CODE(0, 0x2631)
#define TSDB_CODE_PAR_INTER_SLIDING_TOO_BIG TAOS_DEF_ERROR_CODE(0, 0x2631)
#define TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL TAOS_DEF_ERROR_CODE(0, 0x2632)
#define TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL TAOS_DEF_ERROR_CODE(0, 0x2632)
#define TSDB_CODE_PAR_ONLY_ONE_JSON_TAG TAOS_DEF_ERROR_CODE(0, 0x2633)
#define TSDB_CODE_PAR_ONLY_ONE_JSON_TAG TAOS_DEF_ERROR_CODE(0, 0x2633)
#define TSDB_CODE_PAR_INCORRECT_NUM_OF_COL TAOS_DEF_ERROR_CODE(0, 0x2634)
//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)
...
...
source/client/inc/clientInt.h
浏览文件 @
055e0516
...
@@ -306,7 +306,6 @@ void hbMgrInitMqHbRspHandle();
...
@@ -306,7 +306,6 @@ void hbMgrInitMqHbRspHandle();
SRequestObj
*
launchQueryImpl
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
int32_t
code
,
bool
keepQuery
);
SRequestObj
*
launchQueryImpl
(
SRequestObj
*
pRequest
,
SQuery
*
pQuery
,
int32_t
code
,
bool
keepQuery
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/client/inc/clientStmt.h
浏览文件 @
055e0516
...
@@ -60,6 +60,7 @@ typedef struct SStmtBindInfo {
...
@@ -60,6 +60,7 @@ typedef struct SStmtBindInfo {
}
SStmtBindInfo
;
}
SStmtBindInfo
;
typedef
struct
SStmtExecInfo
{
typedef
struct
SStmtExecInfo
{
int32_t
affectedRows
;
SRequestObj
*
pRequest
;
SRequestObj
*
pRequest
;
SHashObj
*
pVgHash
;
SHashObj
*
pVgHash
;
SHashObj
*
pBlockHash
;
SHashObj
*
pBlockHash
;
...
...
source/client/src/clientImpl.c
浏览文件 @
055e0516
...
@@ -146,7 +146,8 @@ int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj*
...
@@ -146,7 +146,8 @@ int32_t buildRequest(STscObj* pTscObj, const char* sql, int sqlLen, SRequestObj*
(
*
pRequest
)
->
sqlstr
[
sqlLen
]
=
0
;
(
*
pRequest
)
->
sqlstr
[
sqlLen
]
=
0
;
(
*
pRequest
)
->
sqlLen
=
sqlLen
;
(
*
pRequest
)
->
sqlLen
=
sqlLen
;
if
(
taosHashPut
(
pTscObj
->
pRequests
,
&
(
*
pRequest
)
->
self
,
sizeof
((
*
pRequest
)
->
self
),
&
(
*
pRequest
)
->
self
,
sizeof
((
*
pRequest
)
->
self
)))
{
if
(
taosHashPut
(
pTscObj
->
pRequests
,
&
(
*
pRequest
)
->
self
,
sizeof
((
*
pRequest
)
->
self
),
&
(
*
pRequest
)
->
self
,
sizeof
((
*
pRequest
)
->
self
)))
{
destroyRequest
(
*
pRequest
);
destroyRequest
(
*
pRequest
);
*
pRequest
=
NULL
;
*
pRequest
=
NULL
;
tscError
(
"put request to request hash failed"
);
tscError
(
"put request to request hash failed"
);
...
@@ -263,7 +264,8 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t
...
@@ -263,7 +264,8 @@ void setResSchemaInfo(SReqResultInfo* pResInfo, const SSchema* pSchema, int32_t
}
}
void
setResPrecision
(
SReqResultInfo
*
pResInfo
,
int32_t
precision
)
{
void
setResPrecision
(
SReqResultInfo
*
pResInfo
,
int32_t
precision
)
{
if
(
precision
!=
TSDB_TIME_PRECISION_MILLI
&&
precision
!=
TSDB_TIME_PRECISION_MICRO
&&
precision
!=
TSDB_TIME_PRECISION_NANO
)
{
if
(
precision
!=
TSDB_TIME_PRECISION_MILLI
&&
precision
!=
TSDB_TIME_PRECISION_MICRO
&&
precision
!=
TSDB_TIME_PRECISION_NANO
)
{
return
;
return
;
}
}
...
@@ -336,7 +338,6 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, int32_t code
...
@@ -336,7 +338,6 @@ SRequestObj* launchQueryImpl(SRequestObj* pRequest, SQuery* pQuery, int32_t code
return
pRequest
;
return
pRequest
;
}
}
SRequestObj
*
launchQuery
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
)
{
SRequestObj
*
launchQuery
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
)
{
SRequestObj
*
pRequest
=
NULL
;
SRequestObj
*
pRequest
=
NULL
;
SQuery
*
pQuery
=
NULL
;
SQuery
*
pQuery
=
NULL
;
...
@@ -522,6 +523,8 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest, int8_t connType) {
...
@@ -522,6 +523,8 @@ static SMsgSendInfo* buildConnectMsg(SRequestObj* pRequest, int8_t connType) {
connectReq
.
pid
=
htonl
(
appInfo
.
pid
);
connectReq
.
pid
=
htonl
(
appInfo
.
pid
);
connectReq
.
startTime
=
htobe64
(
appInfo
.
startTime
);
connectReq
.
startTime
=
htobe64
(
appInfo
.
startTime
);
tstrncpy
(
connectReq
.
app
,
appInfo
.
appName
,
sizeof
(
connectReq
.
app
));
tstrncpy
(
connectReq
.
app
,
appInfo
.
appName
,
sizeof
(
connectReq
.
app
));
tstrncpy
(
connectReq
.
user
,
pObj
->
user
,
sizeof
(
connectReq
.
user
));
tstrncpy
(
connectReq
.
passwd
,
pObj
->
pass
,
sizeof
(
connectReq
.
passwd
));
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
void
*
pReq
=
taosMemoryMalloc
(
contLen
);
...
@@ -751,44 +754,48 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
...
@@ -751,44 +754,48 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int
char
*
pStart
=
pCol
->
offset
[
j
]
+
pCol
->
pData
;
char
*
pStart
=
pCol
->
offset
[
j
]
+
pCol
->
pData
;
int32_t
jsonInnerType
=
*
pStart
;
int32_t
jsonInnerType
=
*
pStart
;
char
*
jsonInnerData
=
pStart
+
CHAR_BYTES
;
char
*
jsonInnerData
=
pStart
+
CHAR_BYTES
;
char
dst
[
TSDB_MAX_JSON_TAG_LEN
]
=
{
0
};
char
dst
[
TSDB_MAX_JSON_TAG_LEN
]
=
{
0
};
if
(
jsonInnerType
==
TSDB_DATA_TYPE_NULL
)
{
if
(
jsonInnerType
==
TSDB_DATA_TYPE_NULL
)
{
sprintf
(
varDataVal
(
dst
),
"%s"
,
TSDB_DATA_NULL_STR_L
);
sprintf
(
varDataVal
(
dst
),
"%s"
,
TSDB_DATA_NULL_STR_L
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_JSON
){
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_JSON
)
{
int32_t
length
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
jsonInnerData
),
varDataLen
(
jsonInnerData
),
varDataVal
(
dst
));
int32_t
length
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
jsonInnerData
),
varDataLen
(
jsonInnerData
),
varDataVal
(
dst
));
if
(
length
<=
0
)
{
if
(
length
<=
0
)
{
tscError
(
"charset:%s to %s. val:%s convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
varDataVal
(
jsonInnerData
));
tscError
(
"charset:%s to %s. val:%s convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
varDataVal
(
jsonInnerData
));
length
=
0
;
length
=
0
;
}
}
varDataSetLen
(
dst
,
length
);
varDataSetLen
(
dst
,
length
);
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_NCHAR
)
{
// value -> "value"
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_NCHAR
)
{
// value -> "value"
*
(
char
*
)
varDataVal
(
dst
)
=
'\"'
;
*
(
char
*
)
varDataVal
(
dst
)
=
'\"'
;
int32_t
length
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
jsonInnerData
),
varDataLen
(
jsonInnerData
),
varDataVal
(
dst
)
+
CHAR_BYTES
);
int32_t
length
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
jsonInnerData
),
varDataLen
(
jsonInnerData
),
varDataVal
(
dst
)
+
CHAR_BYTES
);
if
(
length
<=
0
)
{
if
(
length
<=
0
)
{
tscError
(
"charset:%s to %s. val:%s convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
varDataVal
(
jsonInnerData
));
tscError
(
"charset:%s to %s. val:%s convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
varDataVal
(
jsonInnerData
));
length
=
0
;
length
=
0
;
}
}
varDataSetLen
(
dst
,
length
+
CHAR_BYTES
*
2
);
varDataSetLen
(
dst
,
length
+
CHAR_BYTES
*
2
);
*
(
char
*
)(
varDataVal
(
dst
),
length
+
CHAR_BYTES
)
=
'\"'
;
*
(
char
*
)(
varDataVal
(
dst
),
length
+
CHAR_BYTES
)
=
'\"'
;
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_DOUBLE
)
{
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
jsonVd
=
*
(
double
*
)(
jsonInnerData
);
double
jsonVd
=
*
(
double
*
)(
jsonInnerData
);
sprintf
(
varDataVal
(
dst
),
"%.9lf"
,
jsonVd
);
sprintf
(
varDataVal
(
dst
),
"%.9lf"
,
jsonVd
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_BIGINT
)
{
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_BIGINT
)
{
int64_t
jsonVd
=
*
(
int64_t
*
)(
jsonInnerData
);
int64_t
jsonVd
=
*
(
int64_t
*
)(
jsonInnerData
);
sprintf
(
varDataVal
(
dst
),
"%"
PRId64
,
jsonVd
);
sprintf
(
varDataVal
(
dst
),
"%"
PRId64
,
jsonVd
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_BOOL
)
{
}
else
if
(
jsonInnerType
==
TSDB_DATA_TYPE_BOOL
)
{
sprintf
(
varDataVal
(
dst
),
"%s"
,
(
*
((
char
*
)
jsonInnerData
)
==
1
)
?
"true"
:
"false"
);
sprintf
(
varDataVal
(
dst
),
"%s"
,
(
*
((
char
*
)
jsonInnerData
)
==
1
)
?
"true"
:
"false"
);
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
if
(
len
+
varDataTLen
(
dst
)
>
colLength
[
i
])
{
if
(
len
+
varDataTLen
(
dst
)
>
colLength
[
i
])
{
p
=
taosMemoryRealloc
(
pResultInfo
->
convertBuf
[
i
],
len
+
varDataTLen
(
dst
));
p
=
taosMemoryRealloc
(
pResultInfo
->
convertBuf
[
i
],
len
+
varDataTLen
(
dst
));
if
(
p
==
NULL
)
{
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
...
...
source/client/src/clientMain.c
浏览文件 @
055e0516
...
@@ -622,6 +622,10 @@ int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) {
...
@@ -622,6 +622,10 @@ int taos_stmt_set_tbname(TAOS_STMT *stmt, const char *name) {
return
stmtSetTbName
(
stmt
,
name
);
return
stmtSetTbName
(
stmt
,
name
);
}
}
int
taos_stmt_set_sub_tbname
(
TAOS_STMT
*
stmt
,
const
char
*
name
)
{
return
taos_stmt_set_tbname
(
stmt
,
name
);
}
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
bind
)
{
int
taos_stmt_bind_param
(
TAOS_STMT
*
stmt
,
TAOS_BIND_v2
*
bind
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
if
(
stmt
==
NULL
||
bind
==
NULL
)
{
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
tscError
(
"NULL parameter for %s"
,
__FUNCTION__
);
...
...
source/client/src/clientStmt.c
浏览文件 @
055e0516
...
@@ -486,7 +486,8 @@ int stmtExec(TAOS_STMT *stmt) {
...
@@ -486,7 +486,8 @@ int stmtExec(TAOS_STMT *stmt) {
STMT_ERR_JRET
(
pStmt
->
exec
.
pRequest
->
code
);
STMT_ERR_JRET
(
pStmt
->
exec
.
pRequest
->
code
);
pStmt
->
affectedRows
+=
taos_affected_rows
(
pStmt
->
exec
.
pRequest
);
pStmt
->
exec
.
affectedRows
=
taos_affected_rows
(
pStmt
->
exec
.
pRequest
);
pStmt
->
affectedRows
+=
pStmt
->
exec
.
affectedRows
;
_return:
_return:
...
...
source/common/src/tdataformat.c
浏览文件 @
055e0516
...
@@ -110,7 +110,7 @@ void *tdDecodeSchema(void *buf, STSchema **pRSchema) {
...
@@ -110,7 +110,7 @@ void *tdDecodeSchema(void *buf, STSchema **pRSchema) {
for
(
int
i
=
0
;
i
<
numOfCols
;
i
++
)
{
for
(
int
i
=
0
;
i
<
numOfCols
;
i
++
)
{
col_type_t
type
=
0
;
col_type_t
type
=
0
;
int8_t
sma
=
TSDB_BSMA_TYPE_NONE
;
int8_t
sma
=
0
;
col_id_t
colId
=
0
;
col_id_t
colId
=
0
;
col_bytes_t
bytes
=
0
;
col_bytes_t
bytes
=
0
;
buf
=
taosDecodeFixedI8
(
buf
,
&
type
);
buf
=
taosDecodeFixedI8
(
buf
,
&
type
);
...
...
source/common/src/tmsg.c
浏览文件 @
055e0516
...
@@ -482,34 +482,44 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
...
@@ -482,34 +482,44 @@ int32_t tSerializeSVCreateTbReq(void **buf, SVCreateTbReq *pReq) {
// tlen += taosEncodeFixedU8(buf, pReq->info);
// tlen += taosEncodeFixedU8(buf, pReq->info);
switch
(
pReq
->
type
)
{
switch
(
pReq
->
type
)
{
// case TD_SUPER_TABLE:
case
TD_SUPER_TABLE
:
// tlen += taosEncodeFixedI64(buf, pReq->stbCfg.suid);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
stbCfg
.
suid
);
// tlen += taosEncodeFixedI16(buf, pReq->stbCfg.nCols);
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
nCols
);
// for (col_id_t i = 0; i < pReq->stbCfg.nCols; ++i) {
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
nBSmaCols
);
// tlen += taosEncodeFixedI8(buf, pReq->stbCfg.pSchema[i].type);
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nCols
;
++
i
)
{
// tlen += taosEncodeFixedI8(buf, pReq->stbCfg.pSchema[i].flags);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
stbCfg
.
pSchema
[
i
].
type
);
// tlen += taosEncodeFixedI16(buf, pReq->stbCfg.pSchema[i].colId);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
stbCfg
.
pSchema
[
i
].
flags
);
// tlen += taosEncodeFixedI32(buf, pReq->stbCfg.pSchema[i].bytes);
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
pSchema
[
i
].
colId
);
// tlen += taosEncodeString(buf, pReq->stbCfg.pSchema[i].name);
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
stbCfg
.
pSchema
[
i
].
bytes
);
// }
tlen
+=
taosEncodeString
(
buf
,
pReq
->
stbCfg
.
pSchema
[
i
].
name
);
// tlen += taosEncodeFixedI16(buf, pReq->stbCfg.nTagCols);
}
// for (col_id_t i = 0; i < pReq->stbCfg.nTagCols; ++i) {
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
nTagCols
);
// tlen += taosEncodeFixedI8(buf, pReq->stbCfg.pTagSchema[i].type);
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nTagCols
;
++
i
)
{
// tlen += taosEncodeFixedI8(buf, pReq->stbCfg.pTagSchema[i].flags);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
stbCfg
.
pTagSchema
[
i
].
type
);
// tlen += taosEncodeFixedI16(buf, pReq->stbCfg.pTagSchema[i].colId);
tlen
+=
taosEncodeFixedI8
(
buf
,
pReq
->
stbCfg
.
pTagSchema
[
i
].
flags
);
// tlen += taosEncodeFixedI32(buf, pReq->stbCfg.pTagSchema[i].bytes);
tlen
+=
taosEncodeFixedI16
(
buf
,
pReq
->
stbCfg
.
pTagSchema
[
i
].
colId
);
// tlen += taosEncodeString(buf, pReq->stbCfg.pTagSchema[i].name);
tlen
+=
taosEncodeFixedI32
(
buf
,
pReq
->
stbCfg
.
pTagSchema
[
i
].
bytes
);
// }
tlen
+=
taosEncodeString
(
buf
,
pReq
->
stbCfg
.
pTagSchema
[
i
].
name
);
// if (pReq->rollup && pReq->stbCfg.pRSmaParam) {
}
// SRSmaParam *param = pReq->stbCfg.pRSmaParam;
if
(
pReq
->
rollup
&&
pReq
->
stbCfg
.
pRSmaParam
)
{
// tlen += taosEncodeBinary(buf, (const void *)¶m->xFilesFactor, sizeof(param->xFilesFactor));
SRSmaParam
*
param
=
pReq
->
stbCfg
.
pRSmaParam
;
// tlen += taosEncodeFixedI32(buf, param->delay);
tlen
+=
taosEncodeBinary
(
buf
,
(
const
void
*
)
&
param
->
xFilesFactor
,
sizeof
(
param
->
xFilesFactor
));
// tlen += taosEncodeFixedI8(buf, param->nFuncIds);
tlen
+=
taosEncodeFixedI32
(
buf
,
param
->
delay
);
// for (int8_t i = 0; i < param->nFuncIds; ++i) {
tlen
+=
taosEncodeFixedI8
(
buf
,
param
->
nFuncIds
);
// tlen += taosEncodeFixedI32(buf, param->pFuncIds[i]);
for
(
int8_t
i
=
0
;
i
<
param
->
nFuncIds
;
++
i
)
{
// }
tlen
+=
taosEncodeFixedI32
(
buf
,
param
->
pFuncIds
[
i
]);
// }
}
// break;
tlen
+=
taosEncodeFixedI32
(
buf
,
param
->
qmsg1Len
);
if
(
param
->
qmsg1Len
>
0
)
{
tlen
+=
taosEncodeString
(
buf
,
param
->
qmsg1
);
}
tlen
+=
taosEncodeFixedI32
(
buf
,
param
->
qmsg2Len
);
if
(
param
->
qmsg2Len
>
0
)
{
tlen
+=
taosEncodeString
(
buf
,
param
->
qmsg2
);
}
}
break
;
case
TD_CHILD_TABLE
:
case
TD_CHILD_TABLE
:
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
ctbCfg
.
suid
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pReq
->
ctbCfg
.
suid
);
tlen
+=
tdEncodeKVRow
(
buf
,
pReq
->
ctbCfg
.
pTag
);
tlen
+=
tdEncodeKVRow
(
buf
,
pReq
->
ctbCfg
.
pTag
);
...
@@ -539,44 +549,52 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
...
@@ -539,44 +549,52 @@ void *tDeserializeSVCreateTbReq(void *buf, SVCreateTbReq *pReq) {
// buf = taosDecodeFixedU8(buf, &(pReq->info));
// buf = taosDecodeFixedU8(buf, &(pReq->info));
switch
(
pReq
->
type
)
{
switch
(
pReq
->
type
)
{
// case TD_SUPER_TABLE:
case
TD_SUPER_TABLE
:
// buf = taosDecodeFixedI64(buf, &(pReq->stbCfg.suid));
buf
=
taosDecodeFixedI64
(
buf
,
&
(
pReq
->
stbCfg
.
suid
));
// buf = taosDecodeFixedI16(buf, &(pReq->stbCfg.nCols));
buf
=
taosDecodeFixedI16
(
buf
,
&
(
pReq
->
stbCfg
.
nCols
));
// pReq->stbCfg.pSchema = (SSchema *)taosMemoryMalloc(pReq->stbCfg.nCols * sizeof(SSchema));
buf
=
taosDecodeFixedI16
(
buf
,
&
(
pReq
->
stbCfg
.
nBSmaCols
));
// for (col_id_t i = 0; i < pReq->stbCfg.nCols; ++i) {
pReq
->
stbCfg
.
pSchema
=
(
SSchema
*
)
taosMemoryMalloc
(
pReq
->
stbCfg
.
nCols
*
sizeof
(
SSchema
));
// buf = taosDecodeFixedI8(buf, &(pReq->stbCfg.pSchema[i].type));
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nCols
;
++
i
)
{
// buf = taosDecodeFixedI8(buf, &(pReq->stbCfg.pSchema[i].flags));
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
stbCfg
.
pSchema
[
i
].
type
));
// buf = taosDecodeFixedI16(buf, &(pReq->stbCfg.pSchema[i].colId));
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
stbCfg
.
pSchema
[
i
].
flags
));
// buf = taosDecodeFixedI32(buf, &(pReq->stbCfg.pSchema[i].bytes));
buf
=
taosDecodeFixedI16
(
buf
,
&
(
pReq
->
stbCfg
.
pSchema
[
i
].
colId
));
// buf = taosDecodeStringTo(buf, pReq->stbCfg.pSchema[i].name);
buf
=
taosDecodeFixedI32
(
buf
,
&
(
pReq
->
stbCfg
.
pSchema
[
i
].
bytes
));
// }
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
stbCfg
.
pSchema
[
i
].
name
);
// buf = taosDecodeFixedI16(buf, &pReq->stbCfg.nTagCols);
}
// pReq->stbCfg.pTagSchema = (SSchema *)taosMemoryMalloc(pReq->stbCfg.nTagCols * sizeof(SSchema));
buf
=
taosDecodeFixedI16
(
buf
,
&
pReq
->
stbCfg
.
nTagCols
);
// for (col_id_t i = 0; i < pReq->stbCfg.nTagCols; ++i) {
pReq
->
stbCfg
.
pTagSchema
=
(
SSchema
*
)
taosMemoryMalloc
(
pReq
->
stbCfg
.
nTagCols
*
sizeof
(
SSchema
));
// buf = taosDecodeFixedI8(buf, &(pReq->stbCfg.pTagSchema[i].type));
for
(
col_id_t
i
=
0
;
i
<
pReq
->
stbCfg
.
nTagCols
;
++
i
)
{
// buf = taosDecodeFixedI8(buf, &(pReq->stbCfg.pTagSchema[i].flags));
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
stbCfg
.
pTagSchema
[
i
].
type
));
// buf = taosDecodeFixedI16(buf, &pReq->stbCfg.pTagSchema[i].colId);
buf
=
taosDecodeFixedI8
(
buf
,
&
(
pReq
->
stbCfg
.
pTagSchema
[
i
].
flags
));
// buf = taosDecodeFixedI32(buf, &pReq->stbCfg.pTagSchema[i].bytes);
buf
=
taosDecodeFixedI16
(
buf
,
&
pReq
->
stbCfg
.
pTagSchema
[
i
].
colId
);
// buf = taosDecodeStringTo(buf, pReq->stbCfg.pTagSchema[i].name);
buf
=
taosDecodeFixedI32
(
buf
,
&
pReq
->
stbCfg
.
pTagSchema
[
i
].
bytes
);
// }
buf
=
taosDecodeStringTo
(
buf
,
pReq
->
stbCfg
.
pTagSchema
[
i
].
name
);
// if (pReq->rollup) {
}
// pReq->stbCfg.pRSmaParam = (SRSmaParam *)taosMemoryMalloc(sizeof(SRSmaParam));
if
(
pReq
->
rollup
)
{
// SRSmaParam *param = pReq->stbCfg.pRSmaParam;
pReq
->
stbCfg
.
pRSmaParam
=
(
SRSmaParam
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SRSmaParam
));
// buf = taosDecodeBinaryTo(buf, (void *)¶m->xFilesFactor, sizeof(param->xFilesFactor));
SRSmaParam
*
param
=
pReq
->
stbCfg
.
pRSmaParam
;
// buf = taosDecodeFixedI32(buf, ¶m->delay);
buf
=
taosDecodeBinaryTo
(
buf
,
(
void
*
)
&
param
->
xFilesFactor
,
sizeof
(
param
->
xFilesFactor
));
// buf = taosDecodeFixedI8(buf, ¶m->nFuncIds);
buf
=
taosDecodeFixedI32
(
buf
,
&
param
->
delay
);
// if (param->nFuncIds > 0) {
buf
=
taosDecodeFixedI8
(
buf
,
&
param
->
nFuncIds
);
// param->pFuncIds = (func_id_t *)taosMemoryMalloc(param->nFuncIds * sizeof(func_id_t));
if
(
param
->
nFuncIds
>
0
)
{
// for (int8_t i = 0; i < param->nFuncIds; ++i) {
param
->
pFuncIds
=
(
func_id_t
*
)
taosMemoryCalloc
(
param
->
nFuncIds
,
sizeof
(
func_id_t
));
// buf = taosDecodeFixedI32(buf, param->pFuncIds + i);
for
(
int8_t
i
=
0
;
i
<
param
->
nFuncIds
;
++
i
)
{
// }
buf
=
taosDecodeFixedI32
(
buf
,
param
->
pFuncIds
+
i
);
// } else {
}
// param->pFuncIds = NULL;
}
// }
buf
=
taosDecodeFixedI32
(
buf
,
&
param
->
qmsg1Len
);
// } else {
if
(
param
->
qmsg1Len
>
0
)
{
// pReq->stbCfg.pRSmaParam = NULL;
buf
=
taosDecodeString
(
buf
,
&
param
->
qmsg1
);
// }
}
// break;
buf
=
taosDecodeFixedI32
(
buf
,
&
param
->
qmsg2Len
);
if
(
param
->
qmsg2Len
>
0
)
{
buf
=
taosDecodeString
(
buf
,
&
param
->
qmsg2
);
}
}
else
{
pReq
->
stbCfg
.
pRSmaParam
=
NULL
;
}
break
;
case
TD_CHILD_TABLE
:
case
TD_CHILD_TABLE
:
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
ctbCfg
.
suid
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pReq
->
ctbCfg
.
suid
);
buf
=
tdDecodeKVRow
(
buf
,
&
pReq
->
ctbCfg
.
pTag
);
buf
=
tdDecodeKVRow
(
buf
,
&
pReq
->
ctbCfg
.
pTag
);
...
@@ -1670,6 +1688,7 @@ int32_t tSerializeSRetrieveFuncReq(void *buf, int32_t bufLen, SRetrieveFuncReq *
...
@@ -1670,6 +1688,7 @@ int32_t tSerializeSRetrieveFuncReq(void *buf, int32_t bufLen, SRetrieveFuncReq *
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
numOfFuncs
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
numOfFuncs
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
ignoreCodeComment
)
<
0
)
return
-
1
;
if
(
pReq
->
numOfFuncs
!=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pFuncNames
))
return
-
1
;
if
(
pReq
->
numOfFuncs
!=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pFuncNames
))
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
pReq
->
numOfFuncs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pReq
->
numOfFuncs
;
++
i
)
{
...
@@ -1690,6 +1709,7 @@ int32_t tDeserializeSRetrieveFuncReq(void *buf, int32_t bufLen, SRetrieveFuncReq
...
@@ -1690,6 +1709,7 @@ int32_t tDeserializeSRetrieveFuncReq(void *buf, int32_t bufLen, SRetrieveFuncReq
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfFuncs
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfFuncs
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
(
int8_t
*
)
&
pReq
->
ignoreCodeComment
)
<
0
)
return
-
1
;
pReq
->
pFuncNames
=
taosArrayInit
(
pReq
->
numOfFuncs
,
TSDB_FUNC_NAME_LEN
);
pReq
->
pFuncNames
=
taosArrayInit
(
pReq
->
numOfFuncs
,
TSDB_FUNC_NAME_LEN
);
if
(
pReq
->
pFuncNames
==
NULL
)
return
-
1
;
if
(
pReq
->
pFuncNames
==
NULL
)
return
-
1
;
...
@@ -1727,9 +1747,13 @@ int32_t tSerializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp *
...
@@ -1727,9 +1747,13 @@ int32_t tSerializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp *
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
signature
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pInfo
->
signature
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pInfo
->
codeSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pInfo
->
codeSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pInfo
->
commentSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pInfo
->
commentSize
)
<
0
)
return
-
1
;
if
(
pInfo
->
codeSize
)
{
if
(
tEncodeCStr
(
&
encoder
,
pInfo
->
pCode
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pInfo
->
pCode
)
<
0
)
return
-
1
;
}
if
(
pInfo
->
commentSize
)
{
if
(
tEncodeCStr
(
&
encoder
,
pInfo
->
pComment
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pInfo
->
pComment
)
<
0
)
return
-
1
;
}
}
}
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
...
@@ -1759,15 +1783,23 @@ int32_t tDeserializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp
...
@@ -1759,15 +1783,23 @@ int32_t tDeserializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp
if
(
tDecodeI64
(
&
decoder
,
&
fInfo
.
signature
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
fInfo
.
signature
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
fInfo
.
codeSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
fInfo
.
codeSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
fInfo
.
commentSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
fInfo
.
commentSize
)
<
0
)
return
-
1
;
if
(
fInfo
.
codeSize
)
{
fInfo
.
pCode
=
taosMemoryCalloc
(
1
,
fInfo
.
codeSize
);
fInfo
.
pCode
=
taosMemoryCalloc
(
1
,
fInfo
.
codeSize
);
fInfo
.
pComment
=
taosMemoryCalloc
(
1
,
fInfo
.
commentSize
);
if
(
fInfo
.
pCode
==
NULL
)
{
if
(
fInfo
.
pCode
==
NULL
||
fInfo
.
pComment
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
return
-
1
;
}
}
if
(
tDecodeCStrTo
(
&
decoder
,
fInfo
.
pCode
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
fInfo
.
pCode
)
<
0
)
return
-
1
;
}
if
(
fInfo
.
commentSize
)
{
fInfo
.
pComment
=
taosMemoryCalloc
(
1
,
fInfo
.
commentSize
);
if
(
fInfo
.
pComment
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
if
(
tDecodeCStrTo
(
&
decoder
,
fInfo
.
pComment
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
fInfo
.
pComment
)
<
0
)
return
-
1
;
}
taosArrayPush
(
pRsp
->
pFuncInfos
,
&
fInfo
);
taosArrayPush
(
pRsp
->
pFuncInfos
,
&
fInfo
);
}
}
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
...
@@ -1776,12 +1808,20 @@ int32_t tDeserializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp
...
@@ -1776,12 +1808,20 @@ int32_t tDeserializeSRetrieveFuncRsp(void *buf, int32_t bufLen, SRetrieveFuncRsp
return
0
;
return
0
;
}
}
void
tFreeSFuncInfo
(
SFuncInfo
*
pInfo
)
{
if
(
NULL
==
pInfo
)
{
return
;
}
taosMemoryFree
(
pInfo
->
pCode
);
taosMemoryFree
(
pInfo
->
pComment
);
}
void
tFreeSRetrieveFuncRsp
(
SRetrieveFuncRsp
*
pRsp
)
{
void
tFreeSRetrieveFuncRsp
(
SRetrieveFuncRsp
*
pRsp
)
{
int32_t
size
=
taosArrayGetSize
(
pRsp
->
pFuncInfos
);
int32_t
size
=
taosArrayGetSize
(
pRsp
->
pFuncInfos
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SFuncInfo
*
pInfo
=
taosArrayGet
(
pRsp
->
pFuncInfos
,
i
);
SFuncInfo
*
pInfo
=
taosArrayGet
(
pRsp
->
pFuncInfos
,
i
);
taosMemoryFree
(
pInfo
->
pCode
);
tFreeSFuncInfo
(
pInfo
);
taosMemoryFree
(
pInfo
->
pComment
);
}
}
taosArrayDestroy
(
pRsp
->
pFuncInfos
);
taosArrayDestroy
(
pRsp
->
pFuncInfos
);
}
}
...
@@ -2720,6 +2760,10 @@ int32_t tSerializeSCMCreateTopicReq(void *buf, int32_t bufLen, const SCMCreateTo
...
@@ -2720,6 +2760,10 @@ int32_t tSerializeSCMCreateTopicReq(void *buf, int32_t bufLen, const SCMCreateTo
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
igExists
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
igExists
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
withTbName
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
withSchema
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
withTag
)
<
0
)
return
-
1
;
if
(
tEncodeI8
(
&
encoder
,
pReq
->
withTagSchema
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
sqlLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
sqlLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
astLen
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
astLen
)
<
0
)
return
-
1
;
if
(
sqlLen
>
0
&&
tEncodeCStr
(
&
encoder
,
pReq
->
sql
)
<
0
)
return
-
1
;
if
(
sqlLen
>
0
&&
tEncodeCStr
(
&
encoder
,
pReq
->
sql
)
<
0
)
return
-
1
;
...
@@ -2742,6 +2786,10 @@ int32_t tDeserializeSCMCreateTopicReq(void *buf, int32_t bufLen, SCMCreateTopicR
...
@@ -2742,6 +2786,10 @@ int32_t tDeserializeSCMCreateTopicReq(void *buf, int32_t bufLen, SCMCreateTopicR
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
name
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igExists
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
igExists
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
withTbName
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
withSchema
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
withTag
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pReq
->
withTagSchema
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
sqlLen
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
sqlLen
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
astLen
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
astLen
)
<
0
)
return
-
1
;
...
@@ -2802,6 +2850,8 @@ int32_t tSerializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) {
...
@@ -2802,6 +2850,8 @@ int32_t tSerializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) {
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pid
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pid
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
app
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
app
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
passwd
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
startTime
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
startTime
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
...
@@ -2819,6 +2869,8 @@ int32_t tDeserializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) {
...
@@ -2819,6 +2869,8 @@ int32_t tDeserializeSConnectReq(void *buf, int32_t bufLen, SConnectReq *pReq) {
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pid
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pid
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
app
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
app
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
passwd
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
startTime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
startTime
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tEndDecode
(
&
decoder
);
...
...
source/dnode/mgmt/implement/src/dmTransport.c
浏览文件 @
055e0516
...
@@ -119,10 +119,10 @@ _OVER:
...
@@ -119,10 +119,10 @@ _OVER:
}
}
static
void
dmProcessMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
static
void
dmProcessMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SDnodeTrans
*
pTrans
=
&
pDnode
->
trans
;
SDnodeTrans
*
pTrans
=
&
pDnode
->
trans
;
tmsg_t
msgType
=
pMsg
->
msgType
;
tmsg_t
msgType
=
pMsg
->
msgType
;
bool
isReq
=
msgType
&
1u
;
bool
isReq
=
msgType
&
1u
;
SMsgHandle
*
pHandle
=
&
pTrans
->
msgHandles
[
TMSG_INDEX
(
msgType
)];
SMsgHandle
*
pHandle
=
&
pTrans
->
msgHandles
[
TMSG_INDEX
(
msgType
)];
SMgmtWrapper
*
pWrapper
=
pHandle
->
pNdWrapper
;
SMgmtWrapper
*
pWrapper
=
pHandle
->
pNdWrapper
;
if
(
msgType
==
TDMT_DND_SERVER_STATUS
)
{
if
(
msgType
==
TDMT_DND_SERVER_STATUS
)
{
...
@@ -443,7 +443,7 @@ static inline int32_t dmRetrieveUserAuthInfo(SDnode *pDnode, char *user, char *s
...
@@ -443,7 +443,7 @@ static inline int32_t dmRetrieveUserAuthInfo(SDnode *pDnode, char *user, char *s
SAuthReq
authReq
=
{
0
};
SAuthReq
authReq
=
{
0
};
tstrncpy
(
authReq
.
user
,
user
,
TSDB_USER_LEN
);
tstrncpy
(
authReq
.
user
,
user
,
TSDB_USER_LEN
);
int32_t
contLen
=
tSerializeSAuthReq
(
NULL
,
0
,
&
authReq
);
int32_t
contLen
=
tSerializeSAuthReq
(
NULL
,
0
,
&
authReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
tSerializeSAuthReq
(
pReq
,
contLen
,
&
authReq
);
tSerializeSAuthReq
(
pReq
,
contLen
,
&
authReq
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pReq
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_AUTH
,
.
ahandle
=
(
void
*
)
9528
};
SRpcMsg
rpcMsg
=
{.
pCont
=
pReq
,
.
contLen
=
contLen
,
.
msgType
=
TDMT_MND_AUTH
,
.
ahandle
=
(
void
*
)
9528
};
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
055e0516
...
@@ -418,82 +418,6 @@ typedef struct {
...
@@ -418,82 +418,6 @@ typedef struct {
char
payload
[];
char
payload
[];
}
SSysTableRetrieveObj
;
}
SSysTableRetrieveObj
;
typedef
struct
{
int32_t
vgId
;
// -1 for unassigned
int32_t
status
;
int32_t
epoch
;
SEpSet
epSet
;
int64_t
oldConsumerId
;
int64_t
consumerId
;
// -1 for unassigned
char
*
qmsg
;
}
SMqConsumerEp
;
static
FORCE_INLINE
int32_t
tEncodeSMqConsumerEp
(
void
**
buf
,
const
SMqConsumerEp
*
pConsumerEp
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pConsumerEp
->
vgId
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pConsumerEp
->
status
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pConsumerEp
->
epoch
);
tlen
+=
taosEncodeSEpSet
(
buf
,
&
pConsumerEp
->
epSet
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pConsumerEp
->
oldConsumerId
);
tlen
+=
taosEncodeFixedI64
(
buf
,
pConsumerEp
->
consumerId
);
tlen
+=
taosEncodeString
(
buf
,
pConsumerEp
->
qmsg
);
return
tlen
;
}
static
FORCE_INLINE
void
*
tDecodeSMqConsumerEp
(
void
**
buf
,
SMqConsumerEp
*
pConsumerEp
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pConsumerEp
->
vgId
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pConsumerEp
->
status
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pConsumerEp
->
epoch
);
buf
=
taosDecodeSEpSet
(
buf
,
&
pConsumerEp
->
epSet
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pConsumerEp
->
oldConsumerId
);
buf
=
taosDecodeFixedI64
(
buf
,
&
pConsumerEp
->
consumerId
);
buf
=
taosDecodeString
(
buf
,
&
pConsumerEp
->
qmsg
);
return
buf
;
}
static
FORCE_INLINE
void
tDeleteSMqConsumerEp
(
SMqConsumerEp
*
pConsumerEp
)
{
if
(
pConsumerEp
)
{
taosMemoryFreeClear
(
pConsumerEp
->
qmsg
);
}
}
typedef
struct
{
int64_t
consumerId
;
SArray
*
vgInfo
;
// SArray<SMqConsumerEp>
}
SMqSubConsumer
;
static
FORCE_INLINE
int32_t
tEncodeSMqSubConsumer
(
void
**
buf
,
const
SMqSubConsumer
*
pConsumer
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pConsumer
->
consumerId
);
int32_t
sz
=
taosArrayGetSize
(
pConsumer
->
vgInfo
);
tlen
+=
taosEncodeFixedI32
(
buf
,
sz
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqConsumerEp
*
pCEp
=
taosArrayGet
(
pConsumer
->
vgInfo
,
i
);
tlen
+=
tEncodeSMqConsumerEp
(
buf
,
pCEp
);
}
return
tlen
;
}
static
FORCE_INLINE
void
*
tDecodeSMqSubConsumer
(
void
**
buf
,
SMqSubConsumer
*
pConsumer
)
{
int32_t
sz
;
buf
=
taosDecodeFixedI64
(
buf
,
&
pConsumer
->
consumerId
);
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pConsumer
->
vgInfo
=
taosArrayInit
(
sz
,
sizeof
(
SMqConsumerEp
));
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqConsumerEp
consumerEp
;
buf
=
tDecodeSMqConsumerEp
(
buf
,
&
consumerEp
);
taosArrayPush
(
pConsumer
->
vgInfo
,
&
consumerEp
);
}
return
buf
;
}
static
FORCE_INLINE
void
tDeleteSMqSubConsumer
(
SMqSubConsumer
*
pSubConsumer
)
{
if
(
pSubConsumer
->
vgInfo
)
{
taosArrayDestroyEx
(
pSubConsumer
->
vgInfo
,
(
void
(
*
)(
void
*
))
tDeleteSMqConsumerEp
);
pSubConsumer
->
vgInfo
=
NULL
;
}
}
typedef
struct
{
typedef
struct
{
char
key
[
TSDB_PARTITION_KEY_LEN
];
char
key
[
TSDB_PARTITION_KEY_LEN
];
int64_t
offset
;
int64_t
offset
;
...
@@ -512,147 +436,21 @@ static FORCE_INLINE void* tDecodeSMqOffsetObj(void* buf, SMqOffsetObj* pOffset)
...
@@ -512,147 +436,21 @@ static FORCE_INLINE void* tDecodeSMqOffsetObj(void* buf, SMqOffsetObj* pOffset)
return
buf
;
return
buf
;
}
}
#if 0
typedef struct {
char key[TSDB_SUBSCRIBE_KEY_LEN];
int32_t status;
int32_t vgNum;
SArray* consumers; // SArray<SMqSubConsumer>
SArray* lostConsumers; // SArray<SMqSubConsumer>
SArray* unassignedVg; // SArray<SMqConsumerEp>
} SMqSubscribeObj;
static FORCE_INLINE SMqSubscribeObj* tNewSubscribeObj() {
SMqSubscribeObj* pSub = taosMemoryCalloc(1, sizeof(SMqSubscribeObj));
if (pSub == NULL) {
return NULL;
}
pSub->consumers = taosArrayInit(0, sizeof(SMqSubConsumer));
if (pSub->consumers == NULL) {
goto _err;
}
pSub->lostConsumers = taosArrayInit(0, sizeof(SMqSubConsumer));
if (pSub->lostConsumers == NULL) {
goto _err;
}
pSub->unassignedVg = taosArrayInit(0, sizeof(SMqConsumerEp));
if (pSub->unassignedVg == NULL) {
goto _err;
}
pSub->key[0] = 0;
pSub->vgNum = 0;
pSub->status = 0;
return pSub;
_err:
taosMemoryFreeClear(pSub->consumers);
taosMemoryFreeClear(pSub->lostConsumers);
taosMemoryFreeClear(pSub->unassignedVg);
taosMemoryFreeClear(pSub);
return NULL;
}
static FORCE_INLINE int32_t tEncodeSubscribeObj(void** buf, const SMqSubscribeObj* pSub) {
int32_t tlen = 0;
tlen += taosEncodeString(buf, pSub->key);
tlen += taosEncodeFixedI32(buf, pSub->vgNum);
tlen += taosEncodeFixedI32(buf, pSub->status);
int32_t sz;
sz = taosArrayGetSize(pSub->consumers);
tlen += taosEncodeFixedI32(buf, sz);
for (int32_t i = 0; i < sz; i++) {
SMqSubConsumer* pSubConsumer = taosArrayGet(pSub->consumers, i);
tlen += tEncodeSMqSubConsumer(buf, pSubConsumer);
}
sz = taosArrayGetSize(pSub->lostConsumers);
tlen += taosEncodeFixedI32(buf, sz);
for (int32_t i = 0; i < sz; i++) {
SMqSubConsumer* pSubConsumer = taosArrayGet(pSub->lostConsumers, i);
tlen += tEncodeSMqSubConsumer(buf, pSubConsumer);
}
sz = taosArrayGetSize(pSub->unassignedVg);
tlen += taosEncodeFixedI32(buf, sz);
for (int32_t i = 0; i < sz; i++) {
SMqConsumerEp* pCEp = taosArrayGet(pSub->unassignedVg, i);
tlen += tEncodeSMqConsumerEp(buf, pCEp);
}
return tlen;
}
static FORCE_INLINE void* tDecodeSubscribeObj(void* buf, SMqSubscribeObj* pSub) {
buf = taosDecodeStringTo(buf, pSub->key);
buf = taosDecodeFixedI32(buf, &pSub->vgNum);
buf = taosDecodeFixedI32(buf, &pSub->status);
int32_t sz;
buf = taosDecodeFixedI32(buf, &sz);
pSub->consumers = taosArrayInit(sz, sizeof(SMqSubConsumer));
if (pSub->consumers == NULL) {
return NULL;
}
for (int32_t i = 0; i < sz; i++) {
SMqSubConsumer subConsumer = {0};
buf = tDecodeSMqSubConsumer(buf, &subConsumer);
taosArrayPush(pSub->consumers, &subConsumer);
}
buf = taosDecodeFixedI32(buf, &sz);
pSub->lostConsumers = taosArrayInit(sz, sizeof(SMqSubConsumer));
if (pSub->lostConsumers == NULL) {
return NULL;
}
for (int32_t i = 0; i < sz; i++) {
SMqSubConsumer subConsumer = {0};
buf = tDecodeSMqSubConsumer(buf, &subConsumer);
taosArrayPush(pSub->lostConsumers, &subConsumer);
}
buf = taosDecodeFixedI32(buf, &sz);
pSub->unassignedVg = taosArrayInit(sz, sizeof(SMqConsumerEp));
if (pSub->unassignedVg == NULL) {
return NULL;
}
for (int32_t i = 0; i < sz; i++) {
SMqConsumerEp consumerEp = {0};
buf = tDecodeSMqConsumerEp(buf, &consumerEp);
taosArrayPush(pSub->unassignedVg, &consumerEp);
}
return buf;
}
static FORCE_INLINE void tDeleteSMqSubscribeObj(SMqSubscribeObj* pSub) {
if (pSub->consumers) {
// taosArrayDestroyEx(pSub->consumers, (void (*)(void*))tDeleteSMqSubConsumer);
// taosArrayDestroy(pSub->consumers);
pSub->consumers = NULL;
}
if (pSub->unassignedVg) {
// taosArrayDestroyEx(pSub->unassignedVg, (void (*)(void*))tDeleteSMqConsumerEp);
// taosArrayDestroy(pSub->unassignedVg);
pSub->unassignedVg = NULL;
}
}
#endif
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TOPIC_FNAME_LEN
];
char
name
[
TSDB_TOPIC_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
int64_t
createTime
;
int64_t
createTime
;
int64_t
updateTime
;
int64_t
updateTime
;
int64_t
uid
;
int64_t
uid
;
// TODO: use subDbUid
int64_t
dbUid
;
int64_t
dbUid
;
int64_t
subDbUid
;
int32_t
version
;
int32_t
version
;
int8_t
subType
;
// db or table
int8_t
withTbName
;
int8_t
withSchema
;
int8_t
withTag
;
int8_t
withTagSchema
;
SRWLatch
lock
;
SRWLatch
lock
;
int32_t
sqlLen
;
int32_t
sqlLen
;
int32_t
astLen
;
int32_t
astLen
;
...
@@ -662,79 +460,6 @@ typedef struct {
...
@@ -662,79 +460,6 @@ typedef struct {
SSchemaWrapper
schema
;
SSchemaWrapper
schema
;
}
SMqTopicObj
;
}
SMqTopicObj
;
#if 0
typedef struct {
int64_t consumerId;
int64_t connId;
SRWLatch lock;
char cgroup[TSDB_CGROUP_LEN];
SArray* currentTopics; // SArray<char*>
SArray* recentRemovedTopics; // SArray<char*>
int32_t epoch;
// stat
int64_t pollCnt;
// status
int32_t status;
// heartbeat from the consumer reset hbStatus to 0
// each checkConsumerAlive msg add hbStatus by 1
// if checkConsumerAlive > CONSUMER_REBALANCE_CNT, mask to lost
int32_t hbStatus;
} SMqConsumerObj;
static FORCE_INLINE int32_t tEncodeSMqConsumerObj(void** buf, const SMqConsumerObj* pConsumer) {
int32_t sz;
int32_t tlen = 0;
tlen += taosEncodeFixedI64(buf, pConsumer->consumerId);
tlen += taosEncodeFixedI64(buf, pConsumer->connId);
tlen += taosEncodeFixedI32(buf, pConsumer->epoch);
tlen += taosEncodeFixedI64(buf, pConsumer->pollCnt);
tlen += taosEncodeFixedI32(buf, pConsumer->status);
tlen += taosEncodeString(buf, pConsumer->cgroup);
sz = taosArrayGetSize(pConsumer->currentTopics);
tlen += taosEncodeFixedI32(buf, sz);
for (int32_t i = 0; i < sz; i++) {
char* topic = taosArrayGetP(pConsumer->currentTopics, i);
tlen += taosEncodeString(buf, topic);
}
sz = taosArrayGetSize(pConsumer->recentRemovedTopics);
tlen += taosEncodeFixedI32(buf, sz);
for (int32_t i = 0; i < sz; i++) {
char* topic = taosArrayGetP(pConsumer->recentRemovedTopics, i);
tlen += taosEncodeString(buf, topic);
}
return tlen;
}
static FORCE_INLINE void* tDecodeSMqConsumerObj(void* buf, SMqConsumerObj* pConsumer) {
int32_t sz;
buf = taosDecodeFixedI64(buf, &pConsumer->consumerId);
buf = taosDecodeFixedI64(buf, &pConsumer->connId);
buf = taosDecodeFixedI32(buf, &pConsumer->epoch);
buf = taosDecodeFixedI64(buf, &pConsumer->pollCnt);
buf = taosDecodeFixedI32(buf, &pConsumer->status);
buf = taosDecodeStringTo(buf, pConsumer->cgroup);
buf = taosDecodeFixedI32(buf, &sz);
pConsumer->currentTopics = taosArrayInit(sz, sizeof(void*));
for (int32_t i = 0; i < sz; i++) {
char* topic;
buf = taosDecodeString(buf, &topic);
taosArrayPush(pConsumer->currentTopics, &topic);
}
buf = taosDecodeFixedI32(buf, &sz);
pConsumer->recentRemovedTopics = taosArrayInit(sz, sizeof(void*));
for (int32_t i = 0; i < sz; i++) {
char* topic;
buf = taosDecodeString(buf, &topic);
taosArrayPush(pConsumer->recentRemovedTopics, &topic);
}
return buf;
}
#endif
enum
{
enum
{
CONSUMER_UPDATE__TOUCH
=
1
,
CONSUMER_UPDATE__TOUCH
=
1
,
CONSUMER_UPDATE__ADD
,
CONSUMER_UPDATE__ADD
,
...
@@ -754,9 +479,6 @@ typedef struct {
...
@@ -754,9 +479,6 @@ typedef struct {
// lock is used for topics update
// lock is used for topics update
SRWLatch
lock
;
SRWLatch
lock
;
SArray
*
currentTopics
;
// SArray<char*>
SArray
*
currentTopics
;
// SArray<char*>
#if 0
SArray* waitingRebTopics; // SArray<char*>
#endif
SArray
*
rebNewTopics
;
// SArray<char*>
SArray
*
rebNewTopics
;
// SArray<char*>
SArray
*
rebRemovedTopics
;
// SArray<char*>
SArray
*
rebRemovedTopics
;
// SArray<char*>
}
SMqConsumerObj
;
}
SMqConsumerObj
;
...
@@ -769,7 +491,6 @@ void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer
...
@@ -769,7 +491,6 @@ void* tDecodeSMqConsumerObj(const void* buf, SMqConsumerObj* pConsumer
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
char
*
qmsg
;
char
*
qmsg
;
// char topic[TSDB_TOPIC_FNAME_LEN];
SEpSet
epSet
;
SEpSet
epSet
;
}
SMqVgEp
;
}
SMqVgEp
;
...
@@ -792,7 +513,14 @@ typedef struct {
...
@@ -792,7 +513,14 @@ typedef struct {
char
key
[
TSDB_SUBSCRIBE_KEY_LEN
];
char
key
[
TSDB_SUBSCRIBE_KEY_LEN
];
SRWLatch
lock
;
SRWLatch
lock
;
int32_t
vgNum
;
int32_t
vgNum
;
int8_t
subType
;
int8_t
withTbName
;
int8_t
withSchema
;
int8_t
withTag
;
int8_t
withTagSchema
;
SHashObj
*
consumerHash
;
// consumerId -> SMqConsumerEpInSub
SHashObj
*
consumerHash
;
// consumerId -> SMqConsumerEpInSub
// TODO put -1 into unassignVgs
// SArray* unassignedVgs;
}
SMqSubscribeObj
;
}
SMqSubscribeObj
;
SMqSubscribeObj
*
tNewSubscribeObj
(
const
char
key
[
TSDB_SUBSCRIBE_KEY_LEN
]);
SMqSubscribeObj
*
tNewSubscribeObj
(
const
char
key
[
TSDB_SUBSCRIBE_KEY_LEN
]);
...
@@ -821,18 +549,6 @@ void tDeleteSMqSubActionLogObj(SMqSubActionLogObj* pLog);
...
@@ -821,18 +549,6 @@ void tDeleteSMqSubActionLogObj(SMqSubActionLogObj* pLog);
int32_t
tEncodeSMqSubActionLogObj
(
void
**
buf
,
const
SMqSubActionLogObj
*
pLog
);
int32_t
tEncodeSMqSubActionLogObj
(
void
**
buf
,
const
SMqSubActionLogObj
*
pLog
);
void
*
tDecodeSMqSubActionLogObj
(
const
void
*
buf
,
SMqSubActionLogObj
*
pLog
);
void
*
tDecodeSMqSubActionLogObj
(
const
void
*
buf
,
SMqSubActionLogObj
*
pLog
);
typedef
struct
{
int64_t
consumerId
;
char
cgroup
[
TSDB_CGROUP_LEN
];
SRWLatch
lock
;
SArray
*
vgs
;
// SArray<SMqVgEp*>
}
SMqConsumerEpObj
;
SMqConsumerEpObj
*
tCloneSMqConsumerEpObj
(
const
SMqConsumerEpObj
*
pConsumerEp
);
void
tDeleteSMqConsumerEpObj
(
SMqConsumerEpObj
*
pConsumerEp
);
int32_t
tEncodeSMqConsumerEpObj
(
void
**
buf
,
const
SMqConsumerEpObj
*
pConsumerEp
);
void
*
tDecodeSMqConsumerEpObj
(
const
void
*
buf
,
SMqConsumerEpObj
*
pConsumerEp
);
typedef
struct
{
typedef
struct
{
const
SMqSubscribeObj
*
pOldSub
;
const
SMqSubscribeObj
*
pOldSub
;
const
SMqTopicObj
*
pTopic
;
const
SMqTopicObj
*
pTopic
;
...
@@ -845,12 +561,6 @@ typedef struct {
...
@@ -845,12 +561,6 @@ typedef struct {
SMqVgEp
*
pVgEp
;
SMqVgEp
*
pVgEp
;
}
SMqRebOutputVg
;
}
SMqRebOutputVg
;
#if 0
typedef struct {
int64_t consumerId;
} SMqRebOutputConsumer;
#endif
typedef
struct
{
typedef
struct
{
SArray
*
rebVgs
;
// SArray<SMqRebOutputVg>
SArray
*
rebVgs
;
// SArray<SMqRebOutputVg>
SArray
*
newConsumers
;
// SArray<int64_t>
SArray
*
newConsumers
;
// SArray<int64_t>
...
...
source/dnode/mnode/impl/inc/mndScheduler.h
浏览文件 @
055e0516
...
@@ -29,6 +29,8 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
...
@@ -29,6 +29,8 @@ int32_t mndSchedInitSubEp(SMnode* pMnode, const SMqTopicObj* pTopic, SMqSubscrib
int32_t
mndScheduleStream
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamObj
*
pStream
);
int32_t
mndScheduleStream
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SStreamObj
*
pStream
);
int32_t
mndConvertRSmaTask
(
const
char
*
ast
,
int8_t
triggerType
,
int64_t
watermark
,
char
**
pStr
,
int32_t
*
pLen
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
055e0516
...
@@ -851,6 +851,8 @@ static int32_t mndProcessGetDbCfgReq(SNodeMsg *pReq) {
...
@@ -851,6 +851,8 @@ static int32_t mndProcessGetDbCfgReq(SNodeMsg *pReq) {
cfgRsp
.
cacheLastRow
=
pDb
->
cfg
.
cacheLastRow
;
cfgRsp
.
cacheLastRow
=
pDb
->
cfg
.
cacheLastRow
;
cfgRsp
.
streamMode
=
pDb
->
cfg
.
streamMode
;
cfgRsp
.
streamMode
=
pDb
->
cfg
.
streamMode
;
cfgRsp
.
singleSTable
=
pDb
->
cfg
.
singleSTable
;
cfgRsp
.
singleSTable
=
pDb
->
cfg
.
singleSTable
;
cfgRsp
.
numOfRetensions
=
pDb
->
cfg
.
numOfRetensions
;
cfgRsp
.
pRetensions
=
pDb
->
cfg
.
pRetensions
;
int32_t
contLen
=
tSerializeSDbCfgRsp
(
NULL
,
0
,
&
cfgRsp
);
int32_t
contLen
=
tSerializeSDbCfgRsp
(
NULL
,
0
,
&
cfgRsp
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
void
*
pRsp
=
rpcMallocCont
(
contLen
);
...
...
source/dnode/mnode/impl/src/mndDef.c
浏览文件 @
055e0516
...
@@ -32,9 +32,6 @@ SMqConsumerObj *tNewSMqConsumerObj(int64_t consumerId, char cgroup[TSDB_CGROUP_L
...
@@ -32,9 +32,6 @@ SMqConsumerObj *tNewSMqConsumerObj(int64_t consumerId, char cgroup[TSDB_CGROUP_L
taosInitRWLatch
(
&
pConsumer
->
lock
);
taosInitRWLatch
(
&
pConsumer
->
lock
);
pConsumer
->
currentTopics
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
pConsumer
->
currentTopics
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
#if 0
pConsumer->waitingRebTopics = NULL;
#endif
pConsumer
->
rebNewTopics
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
pConsumer
->
rebNewTopics
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
pConsumer
->
rebRemovedTopics
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
pConsumer
->
rebRemovedTopics
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
...
@@ -53,11 +50,6 @@ void tDeleteSMqConsumerObj(SMqConsumerObj *pConsumer) {
...
@@ -53,11 +50,6 @@ void tDeleteSMqConsumerObj(SMqConsumerObj *pConsumer) {
if
(
pConsumer
->
currentTopics
)
{
if
(
pConsumer
->
currentTopics
)
{
taosArrayDestroyP
(
pConsumer
->
currentTopics
,
(
FDelete
)
taosMemoryFree
);
taosArrayDestroyP
(
pConsumer
->
currentTopics
,
(
FDelete
)
taosMemoryFree
);
}
}
#if 0
if (pConsumer->waitingRebTopics) {
taosArrayDestroyP(pConsumer->waitingRebTopics, taosMemoryFree);
}
#endif
if
(
pConsumer
->
rebNewTopics
)
{
if
(
pConsumer
->
rebNewTopics
)
{
taosArrayDestroyP
(
pConsumer
->
rebNewTopics
,
(
FDelete
)
taosMemoryFree
);
taosArrayDestroyP
(
pConsumer
->
rebNewTopics
,
(
FDelete
)
taosMemoryFree
);
}
}
...
@@ -87,20 +79,6 @@ int32_t tEncodeSMqConsumerObj(void **buf, const SMqConsumerObj *pConsumer) {
...
@@ -87,20 +79,6 @@ int32_t tEncodeSMqConsumerObj(void **buf, const SMqConsumerObj *pConsumer) {
tlen
+=
taosEncodeFixedI32
(
buf
,
0
);
tlen
+=
taosEncodeFixedI32
(
buf
,
0
);
}
}
#if 0
// waiting reb topics
if (pConsumer->waitingRebTopics) {
sz = taosArrayGetSize(pConsumer->waitingRebTopics);
tlen += taosEncodeFixedI32(buf, sz);
for (int32_t i = 0; i < sz; i++) {
char *topic = taosArrayGetP(pConsumer->waitingRebTopics, i);
tlen += taosEncodeString(buf, topic);
}
} else {
tlen += taosEncodeFixedI32(buf, 0);
}
#endif
// reb new topics
// reb new topics
if
(
pConsumer
->
rebNewTopics
)
{
if
(
pConsumer
->
rebNewTopics
)
{
sz
=
taosArrayGetSize
(
pConsumer
->
rebNewTopics
);
sz
=
taosArrayGetSize
(
pConsumer
->
rebNewTopics
);
...
@@ -145,17 +123,6 @@ void *tDecodeSMqConsumerObj(const void *buf, SMqConsumerObj *pConsumer) {
...
@@ -145,17 +123,6 @@ void *tDecodeSMqConsumerObj(const void *buf, SMqConsumerObj *pConsumer) {
taosArrayPush
(
pConsumer
->
currentTopics
,
&
topic
);
taosArrayPush
(
pConsumer
->
currentTopics
,
&
topic
);
}
}
#if 0
// waiting reb topics
buf = taosDecodeFixedI32(buf, &sz);
pConsumer->waitingRebTopics = taosArrayInit(sz, sizeof(void *));
for (int32_t i = 0; i < sz; i++) {
char *topic;
buf = taosDecodeString(buf, &topic);
taosArrayPush(pConsumer->waitingRebTopics, &topic);
}
#endif
// reb new topics
// reb new topics
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
pConsumer
->
rebNewTopics
=
taosArrayInit
(
sz
,
sizeof
(
void
*
));
pConsumer
->
rebNewTopics
=
taosArrayInit
(
sz
,
sizeof
(
void
*
));
...
@@ -182,7 +149,6 @@ SMqVgEp *tCloneSMqVgEp(const SMqVgEp *pVgEp) {
...
@@ -182,7 +149,6 @@ SMqVgEp *tCloneSMqVgEp(const SMqVgEp *pVgEp) {
if
(
pVgEpNew
==
NULL
)
return
NULL
;
if
(
pVgEpNew
==
NULL
)
return
NULL
;
pVgEpNew
->
vgId
=
pVgEp
->
vgId
;
pVgEpNew
->
vgId
=
pVgEp
->
vgId
;
pVgEpNew
->
qmsg
=
strdup
(
pVgEp
->
qmsg
);
pVgEpNew
->
qmsg
=
strdup
(
pVgEp
->
qmsg
);
/*memcpy(pVgEpNew->topic, pVgEp->topic, TSDB_TOPIC_FNAME_LEN);*/
pVgEpNew
->
epSet
=
pVgEp
->
epSet
;
pVgEpNew
->
epSet
=
pVgEp
->
epSet
;
return
pVgEpNew
;
return
pVgEpNew
;
}
}
...
@@ -193,7 +159,6 @@ int32_t tEncodeSMqVgEp(void **buf, const SMqVgEp *pVgEp) {
...
@@ -193,7 +159,6 @@ int32_t tEncodeSMqVgEp(void **buf, const SMqVgEp *pVgEp) {
int32_t
tlen
=
0
;
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI32
(
buf
,
pVgEp
->
vgId
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pVgEp
->
vgId
);
tlen
+=
taosEncodeString
(
buf
,
pVgEp
->
qmsg
);
tlen
+=
taosEncodeString
(
buf
,
pVgEp
->
qmsg
);
/*tlen += taosEncodeString(buf, pVgEp->topic);*/
tlen
+=
taosEncodeSEpSet
(
buf
,
&
pVgEp
->
epSet
);
tlen
+=
taosEncodeSEpSet
(
buf
,
&
pVgEp
->
epSet
);
return
tlen
;
return
tlen
;
}
}
...
@@ -201,40 +166,10 @@ int32_t tEncodeSMqVgEp(void **buf, const SMqVgEp *pVgEp) {
...
@@ -201,40 +166,10 @@ int32_t tEncodeSMqVgEp(void **buf, const SMqVgEp *pVgEp) {
void
*
tDecodeSMqVgEp
(
const
void
*
buf
,
SMqVgEp
*
pVgEp
)
{
void
*
tDecodeSMqVgEp
(
const
void
*
buf
,
SMqVgEp
*
pVgEp
)
{
buf
=
taosDecodeFixedI32
(
buf
,
&
pVgEp
->
vgId
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pVgEp
->
vgId
);
buf
=
taosDecodeString
(
buf
,
&
pVgEp
->
qmsg
);
buf
=
taosDecodeString
(
buf
,
&
pVgEp
->
qmsg
);
/*buf = taosDecodeStringTo(buf, pVgEp->topic);*/
buf
=
taosDecodeSEpSet
(
buf
,
&
pVgEp
->
epSet
);
buf
=
taosDecodeSEpSet
(
buf
,
&
pVgEp
->
epSet
);
return
(
void
*
)
buf
;
return
(
void
*
)
buf
;
}
}
SMqConsumerEpObj
*
tCloneSMqConsumerEpObj
(
const
SMqConsumerEpObj
*
pConsumerEp
)
{
SMqConsumerEpObj
*
pConsumerEpNew
=
taosMemoryMalloc
(
sizeof
(
SMqConsumerEpObj
));
if
(
pConsumerEpNew
==
NULL
)
return
NULL
;
pConsumerEpNew
->
consumerId
=
pConsumerEp
->
consumerId
;
memcpy
(
pConsumerEpNew
->
cgroup
,
pConsumerEp
->
cgroup
,
TSDB_CGROUP_LEN
);
taosInitRWLatch
(
&
pConsumerEpNew
->
lock
);
pConsumerEpNew
->
vgs
=
taosArrayDeepCopy
(
pConsumerEpNew
->
vgs
,
(
FCopy
)
tCloneSMqVgEp
);
return
pConsumerEpNew
;
}
void
tDeleteSMqConsumerEpObj
(
SMqConsumerEpObj
*
pConsumerEp
)
{
taosArrayDestroyEx
(
pConsumerEp
->
vgs
,
(
FDelete
)
tDeleteSMqVgEp
);
}
int32_t
tEncodeSMqConsumerEpObj
(
void
**
buf
,
const
SMqConsumerEpObj
*
pConsumerEp
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedI64
(
buf
,
pConsumerEp
->
consumerId
);
tlen
+=
taosEncodeString
(
buf
,
pConsumerEp
->
cgroup
);
tlen
+=
taosEncodeArray
(
buf
,
pConsumerEp
->
vgs
,
(
FEncode
)
tEncodeSMqVgEp
);
return
tlen
;
}
void
*
tDecodeSMqConsumerEpObj
(
const
void
*
buf
,
SMqConsumerEpObj
*
pConsumerEp
)
{
buf
=
taosDecodeFixedI64
(
buf
,
&
pConsumerEp
->
consumerId
);
buf
=
taosDecodeStringTo
(
buf
,
pConsumerEp
->
cgroup
);
buf
=
taosDecodeArray
(
buf
,
&
pConsumerEp
->
vgs
,
(
FDecode
)
tDecodeSMqVgEp
,
sizeof
(
SMqSubVgEp
));
return
(
void
*
)
buf
;
}
SMqConsumerEpInSub
*
tCloneSMqConsumerEpInSub
(
const
SMqConsumerEpInSub
*
pEpInSub
)
{
SMqConsumerEpInSub
*
tCloneSMqConsumerEpInSub
(
const
SMqConsumerEpInSub
*
pEpInSub
)
{
SMqConsumerEpInSub
*
pEpInSubNew
=
taosMemoryMalloc
(
sizeof
(
SMqConsumerEpInSub
));
SMqConsumerEpInSub
*
pEpInSubNew
=
taosMemoryMalloc
(
sizeof
(
SMqConsumerEpInSub
));
if
(
pEpInSubNew
==
NULL
)
return
NULL
;
if
(
pEpInSubNew
==
NULL
)
return
NULL
;
...
@@ -276,7 +211,7 @@ void *tDecodeSMqConsumerEpInSub(const void *buf, SMqConsumerEpInSub *pEpInSub) {
...
@@ -276,7 +211,7 @@ void *tDecodeSMqConsumerEpInSub(const void *buf, SMqConsumerEpInSub *pEpInSub) {
}
}
SMqSubscribeObj
*
tNewSubscribeObj
(
const
char
key
[
TSDB_SUBSCRIBE_KEY_LEN
])
{
SMqSubscribeObj
*
tNewSubscribeObj
(
const
char
key
[
TSDB_SUBSCRIBE_KEY_LEN
])
{
SMqSubscribeObj
*
pSubNew
=
taosMemory
Malloc
(
sizeof
(
SMqSubscribeObj
));
SMqSubscribeObj
*
pSubNew
=
taosMemory
Calloc
(
1
,
sizeof
(
SMqSubscribeObj
));
if
(
pSubNew
==
NULL
)
return
NULL
;
if
(
pSubNew
==
NULL
)
return
NULL
;
memcpy
(
pSubNew
->
key
,
key
,
TSDB_SUBSCRIBE_KEY_LEN
);
memcpy
(
pSubNew
->
key
,
key
,
TSDB_SUBSCRIBE_KEY_LEN
);
taosInitRWLatch
(
&
pSubNew
->
lock
);
taosInitRWLatch
(
&
pSubNew
->
lock
);
...
@@ -297,8 +232,14 @@ SMqSubscribeObj *tCloneSubscribeObj(const SMqSubscribeObj *pSub) {
...
@@ -297,8 +232,14 @@ SMqSubscribeObj *tCloneSubscribeObj(const SMqSubscribeObj *pSub) {
if
(
pSubNew
==
NULL
)
return
NULL
;
if
(
pSubNew
==
NULL
)
return
NULL
;
memcpy
(
pSubNew
->
key
,
pSub
->
key
,
TSDB_SUBSCRIBE_KEY_LEN
);
memcpy
(
pSubNew
->
key
,
pSub
->
key
,
TSDB_SUBSCRIBE_KEY_LEN
);
taosInitRWLatch
(
&
pSubNew
->
lock
);
taosInitRWLatch
(
&
pSubNew
->
lock
);
pSubNew
->
subType
=
pSub
->
subType
;
pSubNew
->
withTbName
=
pSub
->
withTbName
;
pSubNew
->
withSchema
=
pSub
->
withSchema
;
pSubNew
->
withTag
=
pSub
->
withTag
;
pSubNew
->
withTagSchema
=
pSub
->
withTagSchema
;
pSubNew
->
vgNum
=
pSub
->
vgNum
;
pSubNew
->
vgNum
=
pSub
->
vgNum
;
/*pSubNew->consumerEps = taosArrayDeepCopy(pSub->consumerEps, (FCopy)tCloneSMqConsumerEpInSub);*/
pSubNew
->
consumerHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
pSubNew
->
consumerHash
=
taosHashInit
(
64
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
false
,
HASH_NO_LOCK
);
/*taosHashSetFreeFp(pSubNew->consumerHash, taosArrayDestroy);*/
/*taosHashSetFreeFp(pSubNew->consumerHash, taosArrayDestroy);*/
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
...
@@ -325,6 +266,11 @@ int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) {
...
@@ -325,6 +266,11 @@ int32_t tEncodeSubscribeObj(void **buf, const SMqSubscribeObj *pSub) {
int32_t
tlen
=
0
;
int32_t
tlen
=
0
;
tlen
+=
taosEncodeString
(
buf
,
pSub
->
key
);
tlen
+=
taosEncodeString
(
buf
,
pSub
->
key
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pSub
->
vgNum
);
tlen
+=
taosEncodeFixedI32
(
buf
,
pSub
->
vgNum
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pSub
->
subType
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pSub
->
withTbName
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pSub
->
withSchema
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pSub
->
withTag
);
tlen
+=
taosEncodeFixedI8
(
buf
,
pSub
->
withTagSchema
);
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
int32_t
sz
=
taosHashGetSize
(
pSub
->
consumerHash
);
int32_t
sz
=
taosHashGetSize
(
pSub
->
consumerHash
);
...
@@ -347,6 +293,11 @@ void *tDecodeSubscribeObj(const void *buf, SMqSubscribeObj *pSub) {
...
@@ -347,6 +293,11 @@ void *tDecodeSubscribeObj(const void *buf, SMqSubscribeObj *pSub) {
//
//
buf
=
taosDecodeStringTo
(
buf
,
pSub
->
key
);
buf
=
taosDecodeStringTo
(
buf
,
pSub
->
key
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pSub
->
vgNum
);
buf
=
taosDecodeFixedI32
(
buf
,
&
pSub
->
vgNum
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pSub
->
subType
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pSub
->
withTbName
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pSub
->
withSchema
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pSub
->
withTag
);
buf
=
taosDecodeFixedI8
(
buf
,
&
pSub
->
withTagSchema
);
int32_t
sz
;
int32_t
sz
;
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
buf
=
taosDecodeFixedI32
(
buf
,
&
sz
);
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
055e0516
...
@@ -427,7 +427,6 @@ static int32_t mndProcessRetrieveFuncReq(SNodeMsg *pReq) {
...
@@ -427,7 +427,6 @@ static int32_t mndProcessRetrieveFuncReq(SNodeMsg *pReq) {
SFuncObj
*
pFunc
=
mndAcquireFunc
(
pMnode
,
funcName
);
SFuncObj
*
pFunc
=
mndAcquireFunc
(
pMnode
,
funcName
);
if
(
pFunc
==
NULL
)
{
if
(
pFunc
==
NULL
)
{
terrno
=
TSDB_CODE_MND_INVALID_FUNC
;
goto
RETRIEVE_FUNC_OVER
;
goto
RETRIEVE_FUNC_OVER
;
}
}
...
@@ -439,6 +438,10 @@ static int32_t mndProcessRetrieveFuncReq(SNodeMsg *pReq) {
...
@@ -439,6 +438,10 @@ static int32_t mndProcessRetrieveFuncReq(SNodeMsg *pReq) {
funcInfo
.
outputLen
=
pFunc
->
outputLen
;
funcInfo
.
outputLen
=
pFunc
->
outputLen
;
funcInfo
.
bufSize
=
pFunc
->
bufSize
;
funcInfo
.
bufSize
=
pFunc
->
bufSize
;
funcInfo
.
signature
=
pFunc
->
signature
;
funcInfo
.
signature
=
pFunc
->
signature
;
if
(
retrieveReq
.
ignoreCodeComment
)
{
funcInfo
.
commentSize
=
0
;
funcInfo
.
codeSize
=
0
;
}
else
{
funcInfo
.
commentSize
=
pFunc
->
commentSize
;
funcInfo
.
commentSize
=
pFunc
->
commentSize
;
funcInfo
.
codeSize
=
pFunc
->
codeSize
;
funcInfo
.
codeSize
=
pFunc
->
codeSize
;
funcInfo
.
pCode
=
taosMemoryCalloc
(
1
,
funcInfo
.
codeSize
);
funcInfo
.
pCode
=
taosMemoryCalloc
(
1
,
funcInfo
.
codeSize
);
...
@@ -455,6 +458,7 @@ static int32_t mndProcessRetrieveFuncReq(SNodeMsg *pReq) {
...
@@ -455,6 +458,7 @@ static int32_t mndProcessRetrieveFuncReq(SNodeMsg *pReq) {
}
}
memcpy
(
funcInfo
.
pComment
,
pFunc
->
pComment
,
pFunc
->
commentSize
);
memcpy
(
funcInfo
.
pComment
,
pFunc
->
pComment
,
pFunc
->
commentSize
);
}
}
}
taosArrayPush
(
retrieveRsp
.
pFuncInfos
,
&
funcInfo
);
taosArrayPush
(
retrieveRsp
.
pFuncInfos
,
&
funcInfo
);
mndReleaseFunc
(
pMnode
,
pFunc
);
mndReleaseFunc
(
pMnode
,
pFunc
);
}
}
...
@@ -518,11 +522,16 @@ static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
...
@@ -518,11 +522,16 @@ static int32_t mndRetrieveFuncs(SNodeMsg *pReq, SShowObj *pShow, SSDataBlock *pB
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b1
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b1
,
false
);
if
(
pFunc
->
pComment
)
{
char
*
b2
=
taosMemoryCalloc
(
1
,
pShow
->
bytes
[
cols
]);
char
*
b2
=
taosMemoryCalloc
(
1
,
pShow
->
bytes
[
cols
]);
STR_WITH_MAXSIZE_TO_VARSTR
(
b2
,
pFunc
->
pComment
,
pShow
->
bytes
[
cols
]);
STR_WITH_MAXSIZE_TO_VARSTR
(
b2
,
pFunc
->
pComment
,
pShow
->
bytes
[
cols
]);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
b2
,
false
);
}
else
{
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
NULL
,
true
);
}
int32_t
isAgg
=
(
pFunc
->
funcType
==
TSDB_FUNC_TYPE_AGGREGATE
)
?
1
:
0
;
int32_t
isAgg
=
(
pFunc
->
funcType
==
TSDB_FUNC_TYPE_AGGREGATE
)
?
1
:
0
;
...
...
source/dnode/mnode/impl/src/mndInfoSchema.c
浏览文件 @
055e0516
...
@@ -98,7 +98,7 @@ static const SInfosTableSchema userFuncSchema[] = {
...
@@ -98,7 +98,7 @@ static const SInfosTableSchema userFuncSchema[] = {
{.
name
=
"name"
,
.
bytes
=
TSDB_FUNC_NAME_LEN
-
1
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"name"
,
.
bytes
=
TSDB_FUNC_NAME_LEN
-
1
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"comment"
,
.
bytes
=
PATH_MAX
-
1
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"comment"
,
.
bytes
=
PATH_MAX
-
1
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"aggregate"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"aggregate"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"
comment
"
,
.
bytes
=
TSDB_TYPE_STR_MAX_LEN
-
1
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"
output_type
"
,
.
bytes
=
TSDB_TYPE_STR_MAX_LEN
-
1
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"create_time"
,
.
bytes
=
8
,
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
},
{.
name
=
"code_len"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"code_len"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"bufsize"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"bufsize"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
...
...
source/dnode/mnode/impl/src/mndOffset.c
浏览文件 @
055e0516
...
@@ -133,9 +133,9 @@ OFFSET_DECODE_OVER:
...
@@ -133,9 +133,9 @@ OFFSET_DECODE_OVER:
int32_t
mndCreateOffsets
(
STrans
*
pTrans
,
const
char
*
cgroup
,
const
char
*
topicName
,
const
SArray
*
vgs
)
{
int32_t
mndCreateOffsets
(
STrans
*
pTrans
,
const
char
*
cgroup
,
const
char
*
topicName
,
const
SArray
*
vgs
)
{
int32_t
sz
=
taosArrayGetSize
(
vgs
);
int32_t
sz
=
taosArrayGetSize
(
vgs
);
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
sz
;
i
++
)
{
SMqConsumerEp
*
pConsumerEp
=
taosArrayGet
(
vgs
,
i
);
int32_t
vgId
=
*
(
int32_t
*
)
taosArrayGet
(
vgs
,
i
);
SMqOffsetObj
offsetObj
;
SMqOffsetObj
offsetObj
;
if
(
mndMakePartitionKey
(
offsetObj
.
key
,
cgroup
,
topicName
,
pConsumerEp
->
vgId
)
<
0
)
{
if
(
mndMakePartitionKey
(
offsetObj
.
key
,
cgroup
,
topicName
,
vgId
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
offsetObj
.
offset
=
-
1
;
offsetObj
.
offset
=
-
1
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
055e0516
...
@@ -37,7 +37,7 @@ typedef struct {
...
@@ -37,7 +37,7 @@ typedef struct {
int64_t
lastAccessTimeMs
;
int64_t
lastAccessTimeMs
;
uint64_t
killId
;
uint64_t
killId
;
int32_t
numOfQueries
;
int32_t
numOfQueries
;
SArray
*
pQueries
;
//
SArray<SQueryDesc>
SArray
*
pQueries
;
//
SArray<SQueryDesc>
}
SConnObj
;
}
SConnObj
;
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
const
char
*
user
,
int8_t
connType
,
uint32_t
ip
,
uint16_t
port
,
static
SConnObj
*
mndCreateConn
(
SMnode
*
pMnode
,
const
char
*
user
,
int8_t
connType
,
uint32_t
ip
,
uint16_t
port
,
...
@@ -45,7 +45,7 @@ static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, int8_t connType
...
@@ -45,7 +45,7 @@ static SConnObj *mndCreateConn(SMnode *pMnode, const char *user, int8_t connType
static
void
mndFreeConn
(
SConnObj
*
pConn
);
static
void
mndFreeConn
(
SConnObj
*
pConn
);
static
SConnObj
*
mndAcquireConn
(
SMnode
*
pMnode
,
uint32_t
connId
);
static
SConnObj
*
mndAcquireConn
(
SMnode
*
pMnode
,
uint32_t
connId
);
static
void
mndReleaseConn
(
SMnode
*
pMnode
,
SConnObj
*
pConn
);
static
void
mndReleaseConn
(
SMnode
*
pMnode
,
SConnObj
*
pConn
);
static
void
*
mndGetNextConn
(
SMnode
*
pMnode
,
SCacheIter
*
pIter
);
static
void
*
mndGetNextConn
(
SMnode
*
pMnode
,
SCacheIter
*
pIter
);
static
void
mndCancelGetNextConn
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextConn
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndProcessHeartBeatReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessHeartBeatReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessConnectReq
(
SNodeMsg
*
pReq
);
static
int32_t
mndProcessConnectReq
(
SNodeMsg
*
pReq
);
...
@@ -71,9 +71,9 @@ int32_t mndInitProfile(SMnode *pMnode) {
...
@@ -71,9 +71,9 @@ int32_t mndInitProfile(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_QUERY
,
mndProcessKillQueryReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_QUERY
,
mndProcessKillQueryReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_CONN
,
mndProcessKillConnReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_KILL_CONN
,
mndProcessKillConnReq
);
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndRetrieveConns);
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_CONNS, mndRetrieveConns);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndCancelGetNextConn
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONNS
,
mndCancelGetNextConn
);
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndRetrieveQueries);
// mndAddShowRetrieveHandle(pMnode, TSDB_MGMT_TABLE_QUERIES, mndRetrieveQueries);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndCancelGetNextQuery
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_QUERIES
,
mndCancelGetNextQuery
);
return
0
;
return
0
;
...
@@ -174,10 +174,10 @@ static void mndCancelGetNextConn(SMnode *pMnode, void *pIter) {
...
@@ -174,10 +174,10 @@ static void mndCancelGetNextConn(SMnode *pMnode, void *pIter) {
}
}
static
int32_t
mndProcessConnectReq
(
SNodeMsg
*
pReq
)
{
static
int32_t
mndProcessConnectReq
(
SNodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SMnode
*
pMnode
=
pReq
->
pNode
;
SUserObj
*
pUser
=
NULL
;
SUserObj
*
pUser
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SDbObj
*
pDb
=
NULL
;
SConnObj
*
pConn
=
NULL
;
SConnObj
*
pConn
=
NULL
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SConnectReq
connReq
=
{
0
};
SConnectReq
connReq
=
{
0
};
char
ip
[
30
]
=
{
0
};
char
ip
[
30
]
=
{
0
};
...
@@ -194,6 +194,11 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
...
@@ -194,6 +194,11 @@ static int32_t mndProcessConnectReq(SNodeMsg *pReq) {
mError
(
"user:%s, failed to login while acquire user since %s"
,
pReq
->
user
,
terrstr
());
mError
(
"user:%s, failed to login while acquire user since %s"
,
pReq
->
user
,
terrstr
());
goto
CONN_OVER
;
goto
CONN_OVER
;
}
}
if
(
0
!=
strncmp
(
connReq
.
passwd
,
pUser
->
pass
,
TSDB_PASSWORD_LEN
-
1
))
{
mError
(
"user:%s, failed to auth while acquire user
\n
%s
\r\n
%s"
,
pReq
->
user
,
connReq
.
passwd
,
pUser
->
pass
);
code
=
TSDB_CODE_RPC_AUTH_FAILURE
;
goto
CONN_OVER
;
}
if
(
connReq
.
db
[
0
])
{
if
(
connReq
.
db
[
0
])
{
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
...
@@ -324,7 +329,8 @@ static SClientHbRsp *mndMqHbBuildRsp(SMnode *pMnode, SClientHbReq *pReq) {
...
@@ -324,7 +329,8 @@ static SClientHbRsp *mndMqHbBuildRsp(SMnode *pMnode, SClientHbReq *pReq) {
return
NULL
;
return
NULL
;
}
}
static
int32_t
mndProcessQueryHeartBeat
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
,
SClientHbReq
*
pHbReq
,
SClientHbBatchRsp
*
pBatchRsp
)
{
static
int32_t
mndProcessQueryHeartBeat
(
SMnode
*
pMnode
,
SRpcMsg
*
pMsg
,
SClientHbReq
*
pHbReq
,
SClientHbBatchRsp
*
pBatchRsp
)
{
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SClientHbRsp
hbRsp
=
{.
connKey
=
pHbReq
->
connKey
,
.
status
=
0
,
.
info
=
NULL
,
.
query
=
NULL
};
SClientHbRsp
hbRsp
=
{.
connKey
=
pHbReq
->
connKey
,
.
status
=
0
,
.
info
=
NULL
,
.
query
=
NULL
};
...
@@ -336,7 +342,8 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
...
@@ -336,7 +342,8 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
SConnObj
*
pConn
=
mndAcquireConn
(
pMnode
,
pBasic
->
connId
);
SConnObj
*
pConn
=
mndAcquireConn
(
pMnode
,
pBasic
->
connId
);
if
(
pConn
==
NULL
)
{
if
(
pConn
==
NULL
)
{
pConn
=
mndCreateConn
(
pMnode
,
connInfo
.
user
,
CONN_TYPE__QUERY
,
connInfo
.
clientIp
,
connInfo
.
clientPort
,
pBasic
->
pid
,
pBasic
->
app
,
0
);
pConn
=
mndCreateConn
(
pMnode
,
connInfo
.
user
,
CONN_TYPE__QUERY
,
connInfo
.
clientIp
,
connInfo
.
clientPort
,
pBasic
->
pid
,
pBasic
->
app
,
0
);
if
(
pConn
==
NULL
)
{
if
(
pConn
==
NULL
)
{
mError
(
"user:%s, conn:%u is freed and failed to create new since %s"
,
connInfo
.
user
,
pBasic
->
connId
,
terrstr
());
mError
(
"user:%s, conn:%u is freed and failed to create new since %s"
,
connInfo
.
user
,
pBasic
->
connId
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -369,8 +376,8 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
...
@@ -369,8 +376,8 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
}
}
rspBasic
->
connId
=
pConn
->
id
;
rspBasic
->
connId
=
pConn
->
id
;
rspBasic
->
totalDnodes
=
1
;
//
TODO
rspBasic
->
totalDnodes
=
1
;
//
TODO
rspBasic
->
onlineDnodes
=
1
;
//
TODO
rspBasic
->
onlineDnodes
=
1
;
//
TODO
mndGetMnodeEpSet
(
pMnode
,
&
rspBasic
->
epSet
);
mndGetMnodeEpSet
(
pMnode
,
&
rspBasic
->
epSet
);
mndReleaseConn
(
pMnode
,
pConn
);
mndReleaseConn
(
pMnode
,
pConn
);
...
@@ -396,7 +403,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
...
@@ -396,7 +403,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
switch
(
kv
->
key
)
{
switch
(
kv
->
key
)
{
case
HEARTBEAT_KEY_DBINFO
:
{
case
HEARTBEAT_KEY_DBINFO
:
{
void
*
rspMsg
=
NULL
;
void
*
rspMsg
=
NULL
;
int32_t
rspLen
=
0
;
int32_t
rspLen
=
0
;
mndValidateDbInfo
(
pMnode
,
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SDbVgVersion
),
&
rspMsg
,
&
rspLen
);
mndValidateDbInfo
(
pMnode
,
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SDbVgVersion
),
&
rspMsg
,
&
rspLen
);
if
(
rspMsg
&&
rspLen
>
0
)
{
if
(
rspMsg
&&
rspLen
>
0
)
{
...
@@ -406,7 +413,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
...
@@ -406,7 +413,7 @@ static int32_t mndProcessQueryHeartBeat(SMnode *pMnode, SRpcMsg *pMsg, SClientHb
break
;
break
;
}
}
case
HEARTBEAT_KEY_STBINFO
:
{
case
HEARTBEAT_KEY_STBINFO
:
{
void
*
rspMsg
=
NULL
;
void
*
rspMsg
=
NULL
;
int32_t
rspLen
=
0
;
int32_t
rspLen
=
0
;
mndValidateStbInfo
(
pMnode
,
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SSTableMetaVersion
),
&
rspMsg
,
&
rspLen
);
mndValidateStbInfo
(
pMnode
,
kv
->
value
,
kv
->
valueLen
/
sizeof
(
SSTableMetaVersion
),
&
rspMsg
,
&
rspLen
);
if
(
rspMsg
&&
rspLen
>
0
)
{
if
(
rspMsg
&&
rspLen
>
0
)
{
...
@@ -457,7 +464,7 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) {
...
@@ -457,7 +464,7 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) {
taosArrayDestroyEx
(
batchReq
.
reqs
,
tFreeClientHbReq
);
taosArrayDestroyEx
(
batchReq
.
reqs
,
tFreeClientHbReq
);
int32_t
tlen
=
tSerializeSClientHbBatchRsp
(
NULL
,
0
,
&
batchRsp
);
int32_t
tlen
=
tSerializeSClientHbBatchRsp
(
NULL
,
0
,
&
batchRsp
);
void
*
buf
=
rpcMallocCont
(
tlen
);
void
*
buf
=
rpcMallocCont
(
tlen
);
tSerializeSClientHbBatchRsp
(
buf
,
tlen
,
&
batchRsp
);
tSerializeSClientHbBatchRsp
(
buf
,
tlen
,
&
batchRsp
);
int32_t
rspNum
=
(
int32_t
)
taosArrayGetSize
(
batchRsp
.
rsps
);
int32_t
rspNum
=
(
int32_t
)
taosArrayGetSize
(
batchRsp
.
rsps
);
...
@@ -479,7 +486,7 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) {
...
@@ -479,7 +486,7 @@ static int32_t mndProcessHeartBeatReq(SNodeMsg *pReq) {
}
}
static
int32_t
mndProcessKillQueryReq
(
SNodeMsg
*
pReq
)
{
static
int32_t
mndProcessKillQueryReq
(
SNodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SMnode
*
pMnode
=
pReq
->
pNode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
...
@@ -513,7 +520,7 @@ static int32_t mndProcessKillQueryReq(SNodeMsg *pReq) {
...
@@ -513,7 +520,7 @@ static int32_t mndProcessKillQueryReq(SNodeMsg *pReq) {
}
}
static
int32_t
mndProcessKillConnReq
(
SNodeMsg
*
pReq
)
{
static
int32_t
mndProcessKillConnReq
(
SNodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SMnode
*
pMnode
=
pReq
->
pNode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
SUserObj
*
pUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
...
@@ -545,11 +552,11 @@ static int32_t mndProcessKillConnReq(SNodeMsg *pReq) {
...
@@ -545,11 +552,11 @@ static int32_t mndProcessKillConnReq(SNodeMsg *pReq) {
}
}
static
int32_t
mndRetrieveConns
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
static
int32_t
mndRetrieveConns
(
SNodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
pNode
;
SMnode
*
pMnode
=
pReq
->
pNode
;
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
SConnObj
*
pConn
=
NULL
;
SConnObj
*
pConn
=
NULL
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
char
*
pWrite
;
char
*
pWrite
;
char
ipStr
[
TSDB_IPv4ADDR_LEN
+
6
];
char
ipStr
[
TSDB_IPv4ADDR_LEN
+
6
];
if
(
pShow
->
pIter
==
NULL
)
{
if
(
pShow
->
pIter
==
NULL
)
{
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
055e0516
...
@@ -34,6 +34,54 @@
...
@@ -34,6 +34,54 @@
extern
bool
tsStreamSchedV
;
extern
bool
tsStreamSchedV
;
int32_t
mndConvertRSmaTask
(
const
char
*
ast
,
int8_t
triggerType
,
int64_t
watermark
,
char
**
pStr
,
int32_t
*
pLen
)
{
SNode
*
pAst
=
NULL
;
SQueryPlan
*
pPlan
=
NULL
;
terrno
=
TSDB_CODE_SUCCESS
;
if
(
nodesStringToNode
(
ast
,
&
pAst
)
<
0
)
{
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
goto
END
;
}
SPlanContext
cxt
=
{
.
pAstRoot
=
pAst
,
.
topicQuery
=
false
,
.
streamQuery
=
true
,
.
rSmaQuery
=
true
,
.
triggerType
=
triggerType
,
.
watermark
=
watermark
,
};
if
(
qCreateQueryPlan
(
&
cxt
,
&
pPlan
,
NULL
)
<
0
)
{
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
goto
END
;
}
int32_t
levelNum
=
LIST_LENGTH
(
pPlan
->
pSubplans
);
if
(
levelNum
!=
1
)
{
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
goto
END
;
}
SNodeListNode
*
inner
=
nodesListGetNode
(
pPlan
->
pSubplans
,
0
);
int32_t
opNum
=
LIST_LENGTH
(
inner
->
pNodeList
);
if
(
opNum
!=
1
)
{
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
goto
END
;
}
SSubplan
*
plan
=
nodesListGetNode
(
inner
->
pNodeList
,
0
);
if
(
qSubPlanToString
(
plan
,
pStr
,
pLen
)
<
0
)
{
terrno
=
TSDB_CODE_QRY_INVALID_INPUT
;
goto
END
;
}
END:
if
(
pAst
)
nodesDestroyNode
(
pAst
);
if
(
pPlan
)
nodesDestroyNode
(
pPlan
);
return
terrno
;
}
int32_t
mndPersistTaskDeployReq
(
STrans
*
pTrans
,
SStreamTask
*
pTask
,
const
SEpSet
*
pEpSet
,
tmsg_t
type
,
int32_t
nodeId
)
{
int32_t
mndPersistTaskDeployReq
(
STrans
*
pTrans
,
SStreamTask
*
pTask
,
const
SEpSet
*
pEpSet
,
tmsg_t
type
,
int32_t
nodeId
)
{
SCoder
encoder
;
SCoder
encoder
;
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
NULL
,
0
,
TD_ENCODER
);
tCoderInit
(
&
encoder
,
TD_LITTLE_ENDIAN
,
NULL
,
0
,
TD_ENCODER
);
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
055e0516
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "mndInfoSchema.h"
#include "mndInfoSchema.h"
#include "mndMnode.h"
#include "mndMnode.h"
#include "mndPerfSchema.h"
#include "mndPerfSchema.h"
#include "mndScheduler.h"
#include "mndShow.h"
#include "mndShow.h"
#include "mndTrans.h"
#include "mndTrans.h"
#include "mndUser.h"
#include "mndUser.h"
...
...
source/dnode/mnode/impl/src/mndSubscribe.c
浏览文件 @
055e0516
...
@@ -46,16 +46,8 @@ static int32_t mndSubActionInsert(SSdb *pSdb, SMqSubscribeObj *);
...
@@ -46,16 +46,8 @@ static int32_t mndSubActionInsert(SSdb *pSdb, SMqSubscribeObj *);
static
int32_t
mndSubActionDelete
(
SSdb
*
pSdb
,
SMqSubscribeObj
*
);
static
int32_t
mndSubActionDelete
(
SSdb
*
pSdb
,
SMqSubscribeObj
*
);
static
int32_t
mndSubActionUpdate
(
SSdb
*
pSdb
,
SMqSubscribeObj
*
pOldSub
,
SMqSubscribeObj
*
pNewSub
);
static
int32_t
mndSubActionUpdate
(
SSdb
*
pSdb
,
SMqSubscribeObj
*
pOldSub
,
SMqSubscribeObj
*
pNewSub
);
/*static int32_t mndProcessSubscribeReq(SNodeMsg *pMsg);*/
/*static int32_t mndProcessSubscribeRsp(SNodeMsg *pMsg);*/
static
int32_t
mndProcessSubscribeInternalReq
(
SNodeMsg
*
pMsg
);
static
int32_t
mndProcessSubscribeInternalRsp
(
SNodeMsg
*
pMsg
);
/*static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg);*/
/*static int32_t mndProcessGetSubEpReq(SNodeMsg *pMsg);*/
/*static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg);*/
/*static int32_t mndProcessResetOffsetReq(SNodeMsg *pMsg);*/
static
int32_t
mndProcessRebalanceReq
(
SNodeMsg
*
pMsg
);
static
int32_t
mndProcessRebalanceReq
(
SNodeMsg
*
pMsg
);
static
int32_t
mndProcessSubscribeInternalRsp
(
SNodeMsg
*
pMsg
);
static
int32_t
mndSetSubRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqSubscribeObj
*
pSub
)
{
static
int32_t
mndSetSubRedoLogs
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SMqSubscribeObj
*
pSub
)
{
SSdbRaw
*
pRedoRaw
=
mndSubActionEncode
(
pSub
);
SSdbRaw
*
pRedoRaw
=
mndSubActionEncode
(
pSub
);
...
@@ -73,15 +65,6 @@ static int32_t mndSetSubCommitLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeO
...
@@ -73,15 +65,6 @@ static int32_t mndSetSubCommitLogs(SMnode *pMnode, STrans *pTrans, SMqSubscribeO
return
0
;
return
0
;
}
}
/*static int32_t mndPersistMqSetConnReq(SMnode *pMnode, STrans *pTrans, const SMqTopicObj *pTopic, const char *cgroup,*/
/*const SMqConsumerEp *pConsumerEp);*/
/*static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp,*/
/*const char *topicName);*/
/*static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp,*/
/*const char *oldTopicName);*/
int32_t
mndInitSubscribe
(
SMnode
*
pMnode
)
{
int32_t
mndInitSubscribe
(
SMnode
*
pMnode
)
{
SSdbTable
table
=
{.
sdbType
=
SDB_SUBSCRIBE
,
SSdbTable
table
=
{.
sdbType
=
SDB_SUBSCRIBE
,
.
keyType
=
SDB_KEY_BINARY
,
.
keyType
=
SDB_KEY_BINARY
,
...
@@ -91,13 +74,6 @@ int32_t mndInitSubscribe(SMnode *pMnode) {
...
@@ -91,13 +74,6 @@ int32_t mndInitSubscribe(SMnode *pMnode) {
.
updateFp
=
(
SdbUpdateFp
)
mndSubActionUpdate
,
.
updateFp
=
(
SdbUpdateFp
)
mndSubActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndSubActionDelete
};
.
deleteFp
=
(
SdbDeleteFp
)
mndSubActionDelete
};
/*mndSetMsgHandle(pMnode, TDMT_MND_SUBSCRIBE, mndProcessSubscribeReq);*/
/*mndSetMsgHandle(pMnode, TDMT_VND_MQ_SET_CONN_RSP, mndProcessSubscribeInternalRsp);*/
/*mndSetMsgHandle(pMnode, TDMT_VND_MQ_REB_RSP, mndProcessSubscribeInternalRsp);*/
/*mndSetMsgHandle(pMnode, TDMT_VND_MQ_CANCEL_CONN_RSP, mndProcessSubscribeInternalRsp);*/
/*mndSetMsgHandle(pMnode, TDMT_MND_MQ_TIMER, mndProcessMqTimerMsg);*/
/*mndSetMsgHandle(pMnode, TDMT_MND_GET_SUB_EP, mndProcessGetSubEpReq);*/
/*mndSetMsgHandle(pMnode, TDMT_MND_MQ_DO_REBALANCE, mndProcessDoRebalanceMsg);*/
mndSetMsgHandle
(
pMnode
,
TDMT_VND_MQ_VG_CHANGE_RSP
,
mndProcessSubscribeInternalRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_MQ_VG_CHANGE_RSP
,
mndProcessSubscribeInternalRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_DO_REBALANCE
,
mndProcessRebalanceReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_MQ_DO_REBALANCE
,
mndProcessRebalanceReq
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
return
sdbSetTable
(
pMnode
->
pSdb
,
table
);
...
@@ -109,6 +85,12 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic,
...
@@ -109,6 +85,12 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic,
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
return
NULL
;
}
}
pSub
->
subType
=
pTopic
->
subType
;
pSub
->
withTbName
=
pTopic
->
withTbName
;
pSub
->
withSchema
=
pTopic
->
withSchema
;
pSub
->
withTag
=
pTopic
->
withTag
;
pSub
->
withTagSchema
=
pTopic
->
withTagSchema
;
ASSERT
(
taosHashGetSize
(
pSub
->
consumerHash
)
==
1
);
ASSERT
(
taosHashGetSize
(
pSub
->
consumerHash
)
==
1
);
if
(
mndSchedInitSubEp
(
pMnode
,
pTopic
,
pSub
)
<
0
)
{
if
(
mndSchedInitSubEp
(
pMnode
,
pTopic
,
pSub
)
<
0
)
{
...
@@ -122,144 +104,19 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic,
...
@@ -122,144 +104,19 @@ static SMqSubscribeObj *mndCreateSub(SMnode *pMnode, const SMqTopicObj *pTopic,
return
pSub
;
return
pSub
;
}
}
#if 0
static
int32_t
mndBuildSubChangeReq
(
void
**
pBuf
,
int32_t
*
pLen
,
const
SMqSubscribeObj
*
pSub
,
static SMqSubscribeObj *mndCreateSubscription(SMnode *pMnode, const SMqTopicObj *pTopic, const char *cgroup) {
const
SMqRebOutputVg
*
pRebVg
)
{
SMqSubscribeObj *pSub = tNewSubscribeObj();
if (pSub == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return NULL;
}
char key[TSDB_SUBSCRIBE_KEY_LEN];
mndMakeSubscribeKey(key, cgroup, pTopic->name);
strcpy(pSub->key, key);
if (mndSchedInitSubEp(pMnode, pTopic, pSub) < 0) {
tDeleteSMqSubscribeObj(pSub);
taosMemoryFree(pSub);
return NULL;
}
// TODO: disable alter subscribed table
return pSub;
}
static int32_t mndBuildRebalanceMsg(void **pBuf, int32_t *pLen, const SMqConsumerEp *pConsumerEp,
const char *topicName) {
SMqMVRebReq req = {
.vgId = pConsumerEp->vgId,
.oldConsumerId = pConsumerEp->oldConsumerId,
.newConsumerId = pConsumerEp->consumerId,
};
req.topic = strdup(topicName);
int32_t tlen = tEncodeSMqMVRebReq(NULL, &req);
void *buf = taosMemoryMalloc(sizeof(SMsgHead) + tlen);
if (buf == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
}
SMsgHead *pMsgHead = (SMsgHead *)buf;
pMsgHead->contLen = htonl(sizeof(SMsgHead) + tlen);
pMsgHead->vgId = htonl(pConsumerEp->vgId);
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
tEncodeSMqMVRebReq(&abuf, &req);
taosMemoryFree(req.topic);
*pBuf = buf;
*pLen = tlen;
return 0;
}
static int32_t mndPersistRebalanceMsg(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp,
const char *topicName) {
ASSERT(pConsumerEp->oldConsumerId != -1);
void *buf;
int32_t tlen;
if (mndBuildRebalanceMsg(&buf, &tlen, pConsumerEp, topicName) < 0) {
return -1;
}
int32_t vgId = pConsumerEp->vgId;
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
STransAction action = {0};
action.epSet = mndGetVgroupEpset(pMnode, pVgObj);
action.pCont = buf;
action.contLen = sizeof(SMsgHead) + tlen;
action.msgType = TDMT_VND_MQ_REB;
mndReleaseVgroup(pMnode, pVgObj);
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
taosMemoryFree(buf);
return -1;
}
return 0;
}
static int32_t mndBuildCancelConnReq(void **pBuf, int32_t *pLen, const SMqConsumerEp *pConsumerEp,
const char *oldTopicName) {
SMqCancelConnReq req = {0};
req.consumerId = pConsumerEp->consumerId;
req.vgId = pConsumerEp->vgId;
req.epoch = pConsumerEp->epoch;
strcpy(req.topicName, oldTopicName);
int32_t tlen = tEncodeSMqCancelConnReq(NULL, &req);
void *buf = taosMemoryMalloc(sizeof(SMsgHead) + tlen);
if (buf == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
}
SMsgHead *pMsgHead = (SMsgHead *)buf;
pMsgHead->contLen = htonl(sizeof(SMsgHead) + tlen);
pMsgHead->vgId = htonl(pConsumerEp->vgId);
void *abuf = POINTER_SHIFT(buf, sizeof(SMsgHead));
tEncodeSMqCancelConnReq(&abuf, &req);
*pBuf = buf;
*pLen = tlen;
return 0;
}
static int32_t mndPersistCancelConnReq(SMnode *pMnode, STrans *pTrans, const SMqConsumerEp *pConsumerEp,
const char *oldTopicName) {
void *buf;
int32_t tlen;
if (mndBuildCancelConnReq(&buf, &tlen, pConsumerEp, oldTopicName) < 0) {
return -1;
}
int32_t vgId = pConsumerEp->vgId;
SVgObj *pVgObj = mndAcquireVgroup(pMnode, vgId);
STransAction action = {0};
action.epSet = mndGetVgroupEpset(pMnode, pVgObj);
action.pCont = buf;
action.contLen = sizeof(SMsgHead) + tlen;
action.msgType = TDMT_VND_MQ_CANCEL_CONN;
mndReleaseVgroup(pMnode, pVgObj);
if (mndTransAppendRedoAction(pTrans, &action) != 0) {
taosMemoryFree(buf);
return -1;
}
return 0;
}
#endif
static
int32_t
mndBuildSubChangeReq
(
void
**
pBuf
,
int32_t
*
pLen
,
const
char
*
subKey
,
const
SMqRebOutputVg
*
pRebVg
)
{
SMqRebVgReq
req
=
{
0
};
SMqRebVgReq
req
=
{
0
};
req
.
oldConsumerId
=
pRebVg
->
oldConsumerId
;
req
.
oldConsumerId
=
pRebVg
->
oldConsumerId
;
req
.
newConsumerId
=
pRebVg
->
newConsumerId
;
req
.
newConsumerId
=
pRebVg
->
newConsumerId
;
req
.
vgId
=
pRebVg
->
pVgEp
->
vgId
;
req
.
vgId
=
pRebVg
->
pVgEp
->
vgId
;
req
.
qmsg
=
pRebVg
->
pVgEp
->
qmsg
;
req
.
qmsg
=
pRebVg
->
pVgEp
->
qmsg
;
strncpy
(
req
.
subKey
,
subKey
,
TSDB_SUBSCRIBE_KEY_LEN
);
req
.
subType
=
pSub
->
subType
;
req
.
withTbName
=
pSub
->
withTbName
;
req
.
withSchema
=
pSub
->
withSchema
;
req
.
withTag
=
pSub
->
withTag
;
req
.
withTagSchema
=
pSub
->
withTagSchema
;
strncpy
(
req
.
subKey
,
pSub
->
key
,
TSDB_SUBSCRIBE_KEY_LEN
);
int32_t
tlen
=
sizeof
(
SMsgHead
)
+
tEncodeSMqRebVgReq
(
NULL
,
&
req
);
int32_t
tlen
=
sizeof
(
SMsgHead
)
+
tEncodeSMqRebVgReq
(
NULL
,
&
req
);
void
*
buf
=
taosMemoryMalloc
(
tlen
);
void
*
buf
=
taosMemoryMalloc
(
tlen
);
...
@@ -280,13 +137,13 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, const char *subK
...
@@ -280,13 +137,13 @@ static int32_t mndBuildSubChangeReq(void **pBuf, int32_t *pLen, const char *subK
return
0
;
return
0
;
}
}
static
int32_t
mndPersistSubChangeVgReq
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
const
char
*
subKey
,
static
int32_t
mndPersistSubChangeVgReq
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
const
SMqSubscribeObj
*
pSub
,
const
SMqRebOutputVg
*
pRebVg
)
{
const
SMqRebOutputVg
*
pRebVg
)
{
ASSERT
(
pRebVg
->
oldConsumerId
!=
pRebVg
->
newConsumerId
);
ASSERT
(
pRebVg
->
oldConsumerId
!=
pRebVg
->
newConsumerId
);
void
*
buf
;
void
*
buf
;
int32_t
tlen
;
int32_t
tlen
;
if
(
mndBuildSubChangeReq
(
&
buf
,
&
tlen
,
subKey
,
pRebVg
)
<
0
)
{
if
(
mndBuildSubChangeReq
(
&
buf
,
&
tlen
,
pSub
,
pRebVg
)
<
0
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -307,108 +164,6 @@ static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, const ch
...
@@ -307,108 +164,6 @@ static int32_t mndPersistSubChangeVgReq(SMnode *pMnode, STrans *pTrans, const ch
return
0
;
return
0
;
}
}
#if 0
static int32_t mndProcessGetSubEpReq(SNodeMsg *pMsg) {
SMnode *pMnode = pMsg->pNode;
SMqCMGetSubEpReq *pReq = (SMqCMGetSubEpReq *)pMsg->rpcMsg.pCont;
SMqCMGetSubEpRsp rsp = {0};
int64_t consumerId = be64toh(pReq->consumerId);
int32_t epoch = ntohl(pReq->epoch);
SMqConsumerObj *pConsumer = mndAcquireConsumer(pMsg->pNode, consumerId);
if (pConsumer == NULL) {
terrno = TSDB_CODE_MND_CONSUMER_NOT_EXIST;
return -1;
}
// TODO add lock
ASSERT(strcmp(pReq->cgroup, pConsumer->cgroup) == 0);
int32_t serverEpoch = pConsumer->epoch;
// TODO
int32_t hbStatus = atomic_load_32(&pConsumer->hbStatus);
mDebug("consumer %ld epoch(%d) try to get sub ep, server epoch %d, old val: %d", consumerId, epoch, serverEpoch,
hbStatus);
atomic_store_32(&pConsumer->hbStatus, 0);
/*SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pConsumer);*/
/*sdbSetRawStatus(pConsumerRaw, SDB_STATUS_READY);*/
/*sdbWrite(pMnode->pSdb, pConsumerRaw);*/
strcpy(rsp.cgroup, pReq->cgroup);
if (epoch != serverEpoch) {
mInfo("send new assignment to consumer %ld, consumer epoch %d, server epoch %d", pConsumer->consumerId, epoch,
serverEpoch);
mDebug("consumer %ld try r lock", consumerId);
taosRLockLatch(&pConsumer->lock);
mDebug("consumer %ld r locked", consumerId);
SArray *pTopics = pConsumer->currentTopics;
int32_t sz = taosArrayGetSize(pTopics);
rsp.topics = taosArrayInit(sz, sizeof(SMqSubTopicEp));
for (int32_t i = 0; i < sz; i++) {
char *topicName = taosArrayGetP(pTopics, i);
SMqSubscribeObj *pSub = mndAcquireSubscribe(pMnode, pConsumer->cgroup, topicName);
ASSERT(pSub);
int32_t csz = taosArrayGetSize(pSub->consumers);
// TODO: change to bsearch
for (int32_t j = 0; j < csz; j++) {
SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, j);
if (consumerId == pSubConsumer->consumerId) {
int32_t vgsz = taosArrayGetSize(pSubConsumer->vgInfo);
mInfo("topic %s has %d vg", topicName, serverEpoch);
SMqSubTopicEp topicEp;
strcpy(topicEp.topic, topicName);
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topicName);
ASSERT(pTopic != NULL);
topicEp.schema = pTopic->schema;
mndReleaseTopic(pMnode, pTopic);
topicEp.vgs = taosArrayInit(vgsz, sizeof(SMqSubVgEp));
for (int32_t k = 0; k < vgsz; k++) {
char offsetKey[TSDB_PARTITION_KEY_LEN];
SMqConsumerEp *pConsumerEp = taosArrayGet(pSubConsumer->vgInfo, k);
SMqSubVgEp vgEp = {
.epSet = pConsumerEp->epSet,
.vgId = pConsumerEp->vgId,
.offset = -1,
};
mndMakePartitionKey(offsetKey, pConsumer->cgroup, topicName, pConsumerEp->vgId);
SMqOffsetObj *pOffsetObj = mndAcquireOffset(pMnode, offsetKey);
if (pOffsetObj != NULL) {
vgEp.offset = pOffsetObj->offset;
mndReleaseOffset(pMnode, pOffsetObj);
}
taosArrayPush(topicEp.vgs, &vgEp);
}
taosArrayPush(rsp.topics, &topicEp);
break;
}
}
mndReleaseSubscribe(pMnode, pSub);
}
taosRUnLockLatch(&pConsumer->lock);
mDebug("consumer %ld r unlock", consumerId);
}
int32_t tlen = sizeof(SMqRspHead) + tEncodeSMqCMGetSubEpRsp(NULL, &rsp);
void *buf = rpcMallocCont(tlen);
if (buf == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
}
((SMqRspHead *)buf)->mqMsgType = TMQ_MSG_TYPE__EP_RSP;
((SMqRspHead *)buf)->epoch = serverEpoch;
((SMqRspHead *)buf)->consumerId = pConsumer->consumerId;
void *abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead));
tEncodeSMqCMGetSubEpRsp(&abuf, &rsp);
tDeleteSMqCMGetSubEpRsp(&rsp);
mndReleaseConsumer(pMnode, pConsumer);
pMsg->pRsp = buf;
pMsg->rspLen = tlen;
return 0;
}
#endif
static
int32_t
mndSplitSubscribeKey
(
const
char
*
key
,
char
*
topic
,
char
*
cgroup
)
{
static
int32_t
mndSplitSubscribeKey
(
const
char
*
key
,
char
*
topic
,
char
*
cgroup
)
{
int32_t
i
=
0
;
int32_t
i
=
0
;
while
(
key
[
i
]
!=
TMQ_SEPARATOR
)
{
while
(
key
[
i
]
!=
TMQ_SEPARATOR
)
{
...
@@ -433,235 +188,6 @@ static SMqRebSubscribe *mndGetOrCreateRebSub(SHashObj *pHash, const char *key) {
...
@@ -433,235 +188,6 @@ static SMqRebSubscribe *mndGetOrCreateRebSub(SHashObj *pHash, const char *key) {
return
pRebSub
;
return
pRebSub
;
}
}
#if 0
static int32_t mndProcessMqTimerMsg(SNodeMsg *pMsg) {
SMnode *pMnode = pMsg->pNode;
SSdb *pSdb = pMnode->pSdb;
SMqConsumerObj *pConsumer;
void *pIter = NULL;
SMqDoRebalanceMsg *pRebMsg = rpcMallocCont(sizeof(SMqDoRebalanceMsg));
pRebMsg->rebSubHash = taosHashInit(64, MurmurHash3_32, true, HASH_NO_LOCK);
while (1) {
pIter = sdbFetch(pSdb, SDB_CONSUMER, pIter, (void **)&pConsumer);
if (pIter == NULL) break;
int32_t hbStatus = atomic_add_fetch_32(&pConsumer->hbStatus, 1);
if (hbStatus > MND_SUBSCRIBE_REBALANCE_CNT) {
int32_t old =
atomic_val_compare_exchange_32(&pConsumer->status, MQ_CONSUMER_STATUS__ACTIVE, MQ_CONSUMER_STATUS__LOST);
if (old == MQ_CONSUMER_STATUS__ACTIVE) {
// get all topics of that topic
int32_t sz = taosArrayGetSize(pConsumer->currentTopics);
for (int32_t i = 0; i < sz; i++) {
char *topic = taosArrayGetP(pConsumer->currentTopics, i);
char key[TSDB_SUBSCRIBE_KEY_LEN];
mndMakeSubscribeKey(key, pConsumer->cgroup, topic);
SMqRebSubscribe *pRebSub = mndGetOrCreateRebSub(pRebMsg->rebSubHash, key);
taosArrayPush(pRebSub->lostConsumers, &pConsumer->consumerId);
}
}
}
int32_t status = atomic_load_32(&pConsumer->status);
if (status == MQ_CONSUMER_STATUS__INIT || status == MQ_CONSUMER_STATUS__MODIFY) {
SArray *rebSubs;
if (status == MQ_CONSUMER_STATUS__INIT) {
rebSubs = pConsumer->currentTopics;
} else {
rebSubs = pConsumer->recentRemovedTopics;
}
int32_t sz = taosArrayGetSize(rebSubs);
for (int32_t i = 0; i < sz; i++) {
char *topic = taosArrayGetP(rebSubs, i);
char key[TSDB_SUBSCRIBE_KEY_LEN];
mndMakeSubscribeKey(key, pConsumer->cgroup, topic);
SMqRebSubscribe *pRebSub = mndGetOrCreateRebSub(pRebMsg->rebSubHash, key);
if (status == MQ_CONSUMER_STATUS__INIT) {
taosArrayPush(pRebSub->newConsumers, &pConsumer->consumerId);
} else if (status == MQ_CONSUMER_STATUS__MODIFY) {
taosArrayPush(pRebSub->removedConsumers, &pConsumer->consumerId);
}
}
if (status == MQ_CONSUMER_STATUS__MODIFY) {
int32_t removeSz = taosArrayGetSize(pConsumer->recentRemovedTopics);
for (int32_t i = 0; i < removeSz; i++) {
char *topicName = taosArrayGetP(pConsumer->recentRemovedTopics, i);
taosMemoryFree(topicName);
}
taosArrayClear(pConsumer->recentRemovedTopics);
}
}
}
if (taosHashGetSize(pRebMsg->rebSubHash) != 0) {
mInfo("mq rebalance will be triggered");
SRpcMsg rpcMsg = {
.msgType = TDMT_MND_MQ_DO_REBALANCE,
.pCont = pRebMsg,
.contLen = sizeof(SMqDoRebalanceMsg),
};
tmsgPutToQueue(&pMnode->msgCb, WRITE_QUEUE, &rpcMsg);
} else {
taosHashCleanup(pRebMsg->rebSubHash);
rpcFreeCont(pRebMsg);
}
return 0;
}
#endif
#if 0
static int32_t mndProcessDoRebalanceMsg(SNodeMsg *pMsg) {
SMnode *pMnode = pMsg->pNode;
SMqDoRebalanceMsg *pReq = pMsg->rpcMsg.pCont;
STrans *pTrans = mndTransCreate(pMnode, TRN_POLICY_RETRY, TRN_TYPE_REBALANCE, &pMsg->rpcMsg);
void *pIter = NULL;
mInfo("mq rebalance start");
while (1) {
pIter = taosHashIterate(pReq->rebSubHash, pIter);
if (pIter == NULL) break;
SMqRebSubscribe *pRebSub = (SMqRebSubscribe *)pIter;
SMqSubscribeObj *pSub = mndAcquireSubscribeByKey(pMnode, pRebSub->key);
mInfo("mq rebalance subscription: %s, vgNum: %d, unassignedVg: %d", pSub->key, pSub->vgNum,
(int32_t)taosArrayGetSize(pSub->unassignedVg));
// remove lost consumer
for (int32_t i = 0; i < taosArrayGetSize(pRebSub->lostConsumers); i++) {
int64_t lostConsumerId = *(int64_t *)taosArrayGet(pRebSub->lostConsumers, i);
mInfo("mq remove lost consumer %" PRId64 "", lostConsumerId);
for (int32_t j = 0; j < taosArrayGetSize(pSub->consumers); j++) {
SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, j);
if (pSubConsumer->consumerId == lostConsumerId) {
taosArrayAddAll(pSub->unassignedVg, pSubConsumer->vgInfo);
taosArrayPush(pSub->lostConsumers, pSubConsumer);
taosArrayRemove(pSub->consumers, j);
break;
}
}
}
// calculate rebalance
int32_t consumerNum = taosArrayGetSize(pSub->consumers);
if (consumerNum != 0) {
int32_t vgNum = pSub->vgNum;
int32_t vgEachConsumer = vgNum / consumerNum;
int32_t imbalanceVg = vgNum % consumerNum;
// iterate all consumers, set unassignedVgStash
for (int32_t i = 0; i < consumerNum; i++) {
SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, i);
int32_t vgThisConsumerBeforeRb = taosArrayGetSize(pSubConsumer->vgInfo);
int32_t vgThisConsumerAfterRb;
if (i < imbalanceVg)
vgThisConsumerAfterRb = vgEachConsumer + 1;
else
vgThisConsumerAfterRb = vgEachConsumer;
mInfo("mq consumer:%" PRId64 ", connectted vgroup number change from %d to %d", pSubConsumer->consumerId,
vgThisConsumerBeforeRb, vgThisConsumerAfterRb);
while (taosArrayGetSize(pSubConsumer->vgInfo) > vgThisConsumerAfterRb) {
SMqConsumerEp *pConsumerEp = taosArrayPop(pSubConsumer->vgInfo);
ASSERT(pConsumerEp != NULL);
ASSERT(pConsumerEp->consumerId == pSubConsumer->consumerId);
taosArrayPush(pSub->unassignedVg, pConsumerEp);
mDebug("mq rebalance: vg %d push to unassignedVg", pConsumerEp->vgId);
}
SMqConsumerObj *pRebConsumer = mndAcquireConsumer(pMnode, pSubConsumer->consumerId);
mDebug("consumer %ld try w lock", pRebConsumer->consumerId);
taosWLockLatch(&pRebConsumer->lock);
mDebug("consumer %ld w locked", pRebConsumer->consumerId);
int32_t status = atomic_load_32(&pRebConsumer->status);
if (vgThisConsumerAfterRb != vgThisConsumerBeforeRb ||
(vgThisConsumerAfterRb != 0 && status != MQ_CONSUMER_STATUS__ACTIVE) ||
(vgThisConsumerAfterRb == 0 && status != MQ_CONSUMER_STATUS__LOST)) {
/*if (vgThisConsumerAfterRb != vgThisConsumerBeforeRb) {*/
/*pRebConsumer->epoch++;*/
/*}*/
if (vgThisConsumerAfterRb != 0) {
atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__ACTIVE);
} else {
atomic_store_32(&pRebConsumer->status, MQ_CONSUMER_STATUS__IDLE);
}
mInfo("mq consumer:%" PRId64 ", status change from %d to %d", pRebConsumer->consumerId, status,
pRebConsumer->status);
SSdbRaw *pConsumerRaw = mndConsumerActionEncode(pRebConsumer);
sdbSetRawStatus(pConsumerRaw, SDB_STATUS_READY);
mndTransAppendCommitlog(pTrans, pConsumerRaw);
}
taosWUnLockLatch(&pRebConsumer->lock);
mDebug("consumer %ld w unlock", pRebConsumer->consumerId);
mndReleaseConsumer(pMnode, pRebConsumer);
}
// assign to vgroup
if (taosArrayGetSize(pSub->unassignedVg) != 0) {
for (int32_t i = 0; i < consumerNum; i++) {
SMqSubConsumer *pSubConsumer = taosArrayGet(pSub->consumers, i);
int32_t vgThisConsumerAfterRb;
if (i < imbalanceVg)
vgThisConsumerAfterRb = vgEachConsumer + 1;
else
vgThisConsumerAfterRb = vgEachConsumer;
while (taosArrayGetSize(pSubConsumer->vgInfo) < vgThisConsumerAfterRb) {
SMqConsumerEp *pConsumerEp = taosArrayPop(pSub->unassignedVg);
mDebug("mq rebalance: vg %d pop from unassignedVg", pConsumerEp->vgId);
ASSERT(pConsumerEp != NULL);
pConsumerEp->oldConsumerId = pConsumerEp->consumerId;
pConsumerEp->consumerId = pSubConsumer->consumerId;
// TODO
pConsumerEp->epoch = 0;
taosArrayPush(pSubConsumer->vgInfo, pConsumerEp);
char topic[TSDB_TOPIC_FNAME_LEN];
char cgroup[TSDB_CGROUP_LEN];
mndSplitSubscribeKey(pSub->key, topic, cgroup);
if (pConsumerEp->oldConsumerId == -1) {
SMqTopicObj *pTopic = mndAcquireTopic(pMnode, topic);
mInfo("mq set conn: assign vgroup %d of topic %s to consumer %" PRId64 " cgroup: %s", pConsumerEp->vgId,
topic, pConsumerEp->consumerId, cgroup);
mndPersistMqSetConnReq(pMnode, pTrans, pTopic, cgroup, pConsumerEp);
mndReleaseTopic(pMnode, pTopic);
} else {
mInfo("mq rebalance: assign vgroup %d, from consumer %" PRId64 " to consumer %" PRId64 "",
pConsumerEp->vgId, pConsumerEp->oldConsumerId, pConsumerEp->consumerId);
mndPersistRebalanceMsg(pMnode, pTrans, pConsumerEp, topic);
}
}
}
}
ASSERT(taosArrayGetSize(pSub->unassignedVg) == 0);
// TODO: log rebalance statistics
SSdbRaw *pSubRaw = mndSubActionEncode(pSub);
sdbSetRawStatus(pSubRaw, SDB_STATUS_READY);
mndTransAppendRedolog(pTrans, pSubRaw);
}
mndReleaseSubscribe(pMnode, pSub);
}
if (mndTransPrepare(pMnode, pTrans) != 0) {
mError("mq-rebalance-trans:%d, failed to prepare since %s", pTrans->id, terrstr());
taosHashCleanup(pReq->rebSubHash);
mndTransDrop(pTrans);
return -1;
}
taosHashCleanup(pReq->rebSubHash);
mndTransDrop(pTrans);
return 0;
}
#endif
static
int32_t
mndDoRebalance
(
SMnode
*
pMnode
,
const
SMqRebInputObj
*
pInput
,
SMqRebOutputObj
*
pOutput
)
{
static
int32_t
mndDoRebalance
(
SMnode
*
pMnode
,
const
SMqRebInputObj
*
pInput
,
SMqRebOutputObj
*
pOutput
)
{
if
(
pInput
->
pTopic
!=
NULL
)
{
if
(
pInput
->
pTopic
!=
NULL
)
{
// create subscribe
// create subscribe
...
@@ -825,36 +351,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
...
@@ -825,36 +351,6 @@ static int32_t mndDoRebalance(SMnode *pMnode, const SMqRebInputObj *pInput, SMqR
pRebVg
->
newConsumerId
=
pEpInSub
->
consumerId
;
pRebVg
->
newConsumerId
=
pEpInSub
->
consumerId
;
taosArrayPush
(
pOutput
->
rebVgs
,
pRebVg
);
taosArrayPush
(
pOutput
->
rebVgs
,
pRebVg
);
}
}
#if 0
/*int32_t consumerVgNum = taosArrayGetSize(pEpInSub->vgs);*/
if (imbCnt < imbConsumerNum) {
imbCnt++;
// push until equal minVg + 1
while (taosArrayGetSize(pEpInSub->vgs) < minVgCnt + 1) {
// iter hash and find one vg
pRemovedIter = taosHashIterate(pHash, pRemovedIter);
ASSERT(pRemovedIter);
pRebVg = (SMqRebOutputVg *)pRemovedIter;
// push
taosArrayPush(pEpInSub->vgs, &pRebVg->pVgEp);
pRebVg->newConsumerId = pEpInSub->consumerId;
taosArrayPush(pOutput->rebVgs, pRebVg);
}
} else {
// push until equal minVg
while (taosArrayGetSize(pEpInSub->vgs) < minVgCnt) {
// iter hash and find one vg
pRemovedIter = taosHashIterate(pHash, pRemovedIter);
ASSERT(pRemovedIter);
pRebVg = (SMqRebOutputVg *)pRemovedIter;
// push
taosArrayPush(pEpInSub->vgs, &pRebVg->pVgEp);
pRebVg->newConsumerId = pEpInSub->consumerId;
taosArrayPush(pOutput->rebVgs, pRebVg);
}
}
#endif
}
}
// 7. handle unassigned vg
// 7. handle unassigned vg
...
@@ -911,7 +407,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SNodeMsg *pMsg, const SMqRebO
...
@@ -911,7 +407,7 @@ static int32_t mndPersistRebResult(SMnode *pMnode, SNodeMsg *pMsg, const SMqRebO
int32_t
vgNum
=
taosArrayGetSize
(
rebVgs
);
int32_t
vgNum
=
taosArrayGetSize
(
rebVgs
);
for
(
int32_t
i
=
0
;
i
<
vgNum
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
vgNum
;
i
++
)
{
SMqRebOutputVg
*
pRebVg
=
taosArrayGet
(
rebVgs
,
i
);
SMqRebOutputVg
*
pRebVg
=
taosArrayGet
(
rebVgs
,
i
);
if
(
mndPersistSubChangeVgReq
(
pMnode
,
pTrans
,
pOutput
->
pSub
->
key
,
pRebVg
)
<
0
)
{
if
(
mndPersistSubChangeVgReq
(
pMnode
,
pTrans
,
pOutput
->
pSub
,
pRebVg
)
<
0
)
{
goto
REB_FAIL
;
goto
REB_FAIL
;
}
}
}
}
...
@@ -1040,52 +536,6 @@ static int32_t mndProcessRebalanceReq(SNodeMsg *pMsg) {
...
@@ -1040,52 +536,6 @@ static int32_t mndProcessRebalanceReq(SNodeMsg *pMsg) {
return
0
;
return
0
;
}
}
static
int32_t
mndPersistMqSetConnReq
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
const
SMqTopicObj
*
pTopic
,
const
char
*
cgroup
,
const
SMqConsumerEp
*
pConsumerEp
)
{
ASSERT
(
pConsumerEp
->
oldConsumerId
==
-
1
);
int32_t
vgId
=
pConsumerEp
->
vgId
;
SMqSetCVgReq
req
=
{
.
vgId
=
vgId
,
.
consumerId
=
pConsumerEp
->
consumerId
,
.
sql
=
pTopic
->
sql
,
.
physicalPlan
=
pTopic
->
physicalPlan
,
.
qmsg
=
pConsumerEp
->
qmsg
,
};
strcpy
(
req
.
cgroup
,
cgroup
);
strcpy
(
req
.
topicName
,
pTopic
->
name
);
int32_t
tlen
=
tEncodeSMqSetCVgReq
(
NULL
,
&
req
);
void
*
buf
=
taosMemoryMalloc
(
sizeof
(
SMsgHead
)
+
tlen
);
if
(
buf
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
SMsgHead
*
pMsgHead
=
(
SMsgHead
*
)
buf
;
pMsgHead
->
contLen
=
htonl
(
sizeof
(
SMsgHead
)
+
tlen
);
pMsgHead
->
vgId
=
htonl
(
vgId
);
void
*
abuf
=
POINTER_SHIFT
(
buf
,
sizeof
(
SMsgHead
));
tEncodeSMqSetCVgReq
(
&
abuf
,
&
req
);
SVgObj
*
pVgObj
=
mndAcquireVgroup
(
pMnode
,
vgId
);
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgObj
);
action
.
pCont
=
buf
;
action
.
contLen
=
sizeof
(
SMsgHead
)
+
tlen
;
action
.
msgType
=
TDMT_VND_MQ_SET_CONN
;
mndReleaseVgroup
(
pMnode
,
pVgObj
);
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
taosMemoryFree
(
buf
);
return
-
1
;
}
return
0
;
}
void
mndCleanupSubscribe
(
SMnode
*
pMnode
)
{}
void
mndCleanupSubscribe
(
SMnode
*
pMnode
)
{}
static
SSdbRaw
*
mndSubActionEncode
(
SMqSubscribeObj
*
pSub
)
{
static
SSdbRaw
*
mndSubActionEncode
(
SMqSubscribeObj
*
pSub
)
{
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
055e0516
...
@@ -76,7 +76,13 @@ SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) {
...
@@ -76,7 +76,13 @@ SSdbRaw *mndTopicActionEncode(SMqTopicObj *pTopic) {
SDB_SET_INT64
(
pRaw
,
dataPos
,
pTopic
->
updateTime
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT64
(
pRaw
,
dataPos
,
pTopic
->
updateTime
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT64
(
pRaw
,
dataPos
,
pTopic
->
uid
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT64
(
pRaw
,
dataPos
,
pTopic
->
uid
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT64
(
pRaw
,
dataPos
,
pTopic
->
dbUid
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT64
(
pRaw
,
dataPos
,
pTopic
->
dbUid
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT64
(
pRaw
,
dataPos
,
pTopic
->
subDbUid
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT32
(
pRaw
,
dataPos
,
pTopic
->
version
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT32
(
pRaw
,
dataPos
,
pTopic
->
version
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT8
(
pRaw
,
dataPos
,
pTopic
->
subType
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT8
(
pRaw
,
dataPos
,
pTopic
->
withTbName
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT8
(
pRaw
,
dataPos
,
pTopic
->
withSchema
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT8
(
pRaw
,
dataPos
,
pTopic
->
withTag
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT8
(
pRaw
,
dataPos
,
pTopic
->
withTagSchema
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT32
(
pRaw
,
dataPos
,
pTopic
->
sqlLen
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT32
(
pRaw
,
dataPos
,
pTopic
->
sqlLen
,
TOPIC_ENCODE_OVER
);
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pTopic
->
sql
,
pTopic
->
sqlLen
,
TOPIC_ENCODE_OVER
);
SDB_SET_BINARY
(
pRaw
,
dataPos
,
pTopic
->
sql
,
pTopic
->
sqlLen
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT32
(
pRaw
,
dataPos
,
pTopic
->
astLen
,
TOPIC_ENCODE_OVER
);
SDB_SET_INT32
(
pRaw
,
dataPos
,
pTopic
->
astLen
,
TOPIC_ENCODE_OVER
);
...
@@ -134,7 +140,13 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
...
@@ -134,7 +140,13 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pTopic
->
updateTime
,
TOPIC_DECODE_OVER
);
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pTopic
->
updateTime
,
TOPIC_DECODE_OVER
);
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pTopic
->
uid
,
TOPIC_DECODE_OVER
);
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pTopic
->
uid
,
TOPIC_DECODE_OVER
);
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pTopic
->
dbUid
,
TOPIC_DECODE_OVER
);
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pTopic
->
dbUid
,
TOPIC_DECODE_OVER
);
SDB_GET_INT64
(
pRaw
,
dataPos
,
&
pTopic
->
subDbUid
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTopic
->
version
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTopic
->
version
,
TOPIC_DECODE_OVER
);
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pTopic
->
subType
,
TOPIC_DECODE_OVER
);
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pTopic
->
withTbName
,
TOPIC_DECODE_OVER
);
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pTopic
->
withSchema
,
TOPIC_DECODE_OVER
);
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pTopic
->
withTag
,
TOPIC_DECODE_OVER
);
SDB_GET_INT8
(
pRaw
,
dataPos
,
&
pTopic
->
withTagSchema
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTopic
->
sqlLen
,
TOPIC_DECODE_OVER
);
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pTopic
->
sqlLen
,
TOPIC_DECODE_OVER
);
pTopic
->
sql
=
taosMemoryCalloc
(
pTopic
->
sqlLen
,
sizeof
(
char
));
pTopic
->
sql
=
taosMemoryCalloc
(
pTopic
->
sqlLen
,
sizeof
(
char
));
...
@@ -254,33 +266,13 @@ static int32_t mndCheckCreateTopicReq(SCMCreateTopicReq *pCreate) {
...
@@ -254,33 +266,13 @@ static int32_t mndCheckCreateTopicReq(SCMCreateTopicReq *pCreate) {
terrno
=
TSDB_CODE_MND_INVALID_TOPIC_OPTION
;
terrno
=
TSDB_CODE_MND_INVALID_TOPIC_OPTION
;
return
-
1
;
return
-
1
;
}
}
return
0
;
}
#if 0
static int32_t mndGetPlanString(const SCMCreateTopicReq *pCreate, char **pStr) {
if (NULL == pCreate->ast) {
return TSDB_CODE_SUCCESS;
}
SNode *pAst = NULL;
int32_t code = nodesStringToNode(pCreate->ast, &pAst);
SQueryPlan *pPlan = NULL;
if (TSDB_CODE_SUCCESS == code) {
SPlanContext cxt = {.pAstRoot = pAst, .topicQuery = true};
code = qCreateQueryPlan(&cxt, &pPlan, NULL);
}
if (TSDB_CODE_SUCCESS == code) {
if
((
pCreate
->
ast
==
NULL
||
pCreate
->
ast
[
0
]
==
0
)
&&
pCreate
->
subscribeDbName
[
0
]
==
0
)
{
code = nodesNodeToString(pPlan, false, pStr, NULL);
terrno
=
TSDB_CODE_MND_INVALID_TOPIC_OPTION
;
return
-
1
;
}
}
nodesDestroyNode(pAst);
return
0
;
nodesDestroyNode(pPlan);
terrno = code;
return code;
}
}
#endif
static
int32_t
mndCreateTopic
(
SMnode
*
pMnode
,
SNodeMsg
*
pReq
,
SCMCreateTopicReq
*
pCreate
,
SDbObj
*
pDb
)
{
static
int32_t
mndCreateTopic
(
SMnode
*
pMnode
,
SNodeMsg
*
pReq
,
SCMCreateTopicReq
*
pCreate
,
SDbObj
*
pDb
)
{
mDebug
(
"topic:%s to create"
,
pCreate
->
name
);
mDebug
(
"topic:%s to create"
,
pCreate
->
name
);
...
@@ -297,6 +289,11 @@ static int32_t mndCreateTopic(SMnode *pMnode, SNodeMsg *pReq, SCMCreateTopicReq
...
@@ -297,6 +289,11 @@ static int32_t mndCreateTopic(SMnode *pMnode, SNodeMsg *pReq, SCMCreateTopicReq
topicObj
.
ast
=
strdup
(
pCreate
->
ast
);
topicObj
.
ast
=
strdup
(
pCreate
->
ast
);
topicObj
.
astLen
=
strlen
(
pCreate
->
ast
)
+
1
;
topicObj
.
astLen
=
strlen
(
pCreate
->
ast
)
+
1
;
if
(
pCreate
->
ast
&&
pCreate
->
ast
[
0
])
{
topicObj
.
subType
=
TOPIC_SUB_TYPE__TABLE
;
topicObj
.
withTbName
=
0
;
topicObj
.
withSchema
=
0
;
SNode
*
pAst
=
NULL
;
SNode
*
pAst
=
NULL
;
if
(
nodesStringToNode
(
pCreate
->
ast
,
&
pAst
)
!=
0
)
{
if
(
nodesStringToNode
(
pCreate
->
ast
,
&
pAst
)
!=
0
)
{
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
...
@@ -320,6 +317,11 @@ static int32_t mndCreateTopic(SMnode *pMnode, SNodeMsg *pReq, SCMCreateTopicReq
...
@@ -320,6 +317,11 @@ static int32_t mndCreateTopic(SMnode *pMnode, SNodeMsg *pReq, SCMCreateTopicReq
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
mError
(
"topic:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
}
else
{
topicObj
.
subType
=
TOPIC_SUB_TYPE__DB
;
topicObj
.
withTbName
=
1
;
topicObj
.
withSchema
=
1
;
}
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_TOPIC
,
&
pReq
->
rpcMsg
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_ROLLBACK
,
TRN_TYPE_CREATE_TOPIC
,
&
pReq
->
rpcMsg
);
if
(
pTrans
==
NULL
)
{
if
(
pTrans
==
NULL
)
{
...
...
source/dnode/mnode/impl/test/func/func.cpp
浏览文件 @
055e0516
...
@@ -240,7 +240,7 @@ TEST_F(MndTestFunc, 03_Retrieve_Func) {
...
@@ -240,7 +240,7 @@ TEST_F(MndTestFunc, 03_Retrieve_Func) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_RETRIEVE_FUNC
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_RETRIEVE_FUNC
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_MND_
INVALID_FUNC
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_MND_
FUNC_NOT_EXIST
);
}
}
{
{
...
@@ -371,7 +371,7 @@ TEST_F(MndTestFunc, 03_Retrieve_Func) {
...
@@ -371,7 +371,7 @@ TEST_F(MndTestFunc, 03_Retrieve_Func) {
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_RETRIEVE_FUNC
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_RETRIEVE_FUNC
,
pReq
,
contLen
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_NE
(
pRsp
,
nullptr
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_MND_
INVALID_FUNC
);
ASSERT_EQ
(
pRsp
->
code
,
TSDB_CODE_MND_
FUNC_NOT_EXIST
);
}
}
}
}
...
...
source/dnode/mnode/impl/test/profile/profile.cpp
浏览文件 @
055e0516
...
@@ -30,8 +30,15 @@ int32_t MndTestProfile::connId;
...
@@ -30,8 +30,15 @@ int32_t MndTestProfile::connId;
TEST_F
(
MndTestProfile
,
01
_ConnectMsg
)
{
TEST_F
(
MndTestProfile
,
01
_ConnectMsg
)
{
SConnectReq
connectReq
=
{
0
};
SConnectReq
connectReq
=
{
0
};
connectReq
.
pid
=
1234
;
connectReq
.
pid
=
1234
;
char
passwd
[]
=
"taosdata"
;
char
secretEncrypt
[
TSDB_PASSWORD_LEN
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
passwd
,
strlen
(
passwd
),
secretEncrypt
);
strcpy
(
connectReq
.
app
,
"mnode_test_profile"
);
strcpy
(
connectReq
.
app
,
"mnode_test_profile"
);
strcpy
(
connectReq
.
db
,
""
);
strcpy
(
connectReq
.
db
,
""
);
strcpy
(
connectReq
.
user
,
"root"
);
strcpy
(
connectReq
.
passwd
,
secretEncrypt
);
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
...
@@ -58,10 +65,16 @@ TEST_F(MndTestProfile, 01_ConnectMsg) {
...
@@ -58,10 +65,16 @@ TEST_F(MndTestProfile, 01_ConnectMsg) {
}
}
TEST_F
(
MndTestProfile
,
02
_ConnectMsg_InvalidDB
)
{
TEST_F
(
MndTestProfile
,
02
_ConnectMsg_InvalidDB
)
{
char
passwd
[]
=
"taosdata"
;
char
secretEncrypt
[
TSDB_PASSWORD_LEN
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
passwd
,
strlen
(
passwd
),
secretEncrypt
);
SConnectReq
connectReq
=
{
0
};
SConnectReq
connectReq
=
{
0
};
connectReq
.
pid
=
1234
;
connectReq
.
pid
=
1234
;
strcpy
(
connectReq
.
app
,
"mnode_test_profile"
);
strcpy
(
connectReq
.
app
,
"mnode_test_profile"
);
strcpy
(
connectReq
.
db
,
"invalid_db"
);
strcpy
(
connectReq
.
db
,
"invalid_db"
);
strcpy
(
connectReq
.
user
,
"root"
);
strcpy
(
connectReq
.
passwd
,
secretEncrypt
);
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
...
...
source/dnode/mnode/impl/test/show/show.cpp
浏览文件 @
055e0516
...
@@ -54,10 +54,16 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) {
...
@@ -54,10 +54,16 @@ TEST_F(MndTestShow, 02_ShowMsg_InvalidMsgStart) {
}
}
TEST_F
(
MndTestShow
,
03
_ShowMsg_Conn
)
{
TEST_F
(
MndTestShow
,
03
_ShowMsg_Conn
)
{
char
passwd
[]
=
"taosdata"
;
char
secretEncrypt
[
TSDB_PASSWORD_LEN
]
=
{
0
};
taosEncryptPass_c
((
uint8_t
*
)
passwd
,
strlen
(
passwd
),
secretEncrypt
);
SConnectReq
connectReq
=
{
0
};
SConnectReq
connectReq
=
{
0
};
connectReq
.
pid
=
1234
;
connectReq
.
pid
=
1234
;
strcpy
(
connectReq
.
app
,
"mnode_test_show"
);
strcpy
(
connectReq
.
app
,
"mnode_test_show"
);
strcpy
(
connectReq
.
db
,
""
);
strcpy
(
connectReq
.
db
,
""
);
strcpy
(
connectReq
.
user
,
"root"
);
strcpy
(
connectReq
.
passwd
,
secretEncrypt
);
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
int32_t
contLen
=
tSerializeSConnectReq
(
NULL
,
0
,
&
connectReq
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
void
*
pReq
=
rpcMallocCont
(
contLen
);
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
055e0516
...
@@ -109,8 +109,7 @@ int tqReadHandleSetTbUidList(STqReadHandle *pHandle, const SArray *tbUidList
...
@@ -109,8 +109,7 @@ int tqReadHandleSetTbUidList(STqReadHandle *pHandle, const SArray *tbUidList
int
tqReadHandleAddTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int
tqReadHandleAddTbUidList
(
STqReadHandle
*
pHandle
,
const
SArray
*
tbUidList
);
int32_t
tqReadHandleSetMsg
(
STqReadHandle
*
pHandle
,
SSubmitReq
*
pMsg
,
int64_t
ver
);
int32_t
tqReadHandleSetMsg
(
STqReadHandle
*
pHandle
,
SSubmitReq
*
pMsg
,
int64_t
ver
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
int
tqRetrieveDataBlockInfo
(
STqReadHandle
*
pHandle
,
SDataBlockInfo
*
pBlockInfo
);
int32_t
tqRetrieveDataBlock
(
SArray
**
ppCols
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
int32_t
*
pNumOfRows
);
SArray
*
tqRetrieveDataBlock
(
STqReadHandle
*
pHandle
);
// need to reposition
// need to reposition
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
055e0516
...
@@ -404,6 +404,7 @@ struct SReadH {
...
@@ -404,6 +404,7 @@ struct SReadH {
#define TSDB_READ_REPO_ID(rh) REPO_ID(TSDB_READ_REPO(rh))
#define TSDB_READ_REPO_ID(rh) REPO_ID(TSDB_READ_REPO(rh))
#define TSDB_READ_FSET(rh) (&((rh)->rSet))
#define TSDB_READ_FSET(rh) (&((rh)->rSet))
#define TSDB_READ_TABLE(rh) ((rh)->pTable)
#define TSDB_READ_TABLE(rh) ((rh)->pTable)
#define TSDB_READ_TABLE_UID(rh) ((rh)->pTable->uid)
#define TSDB_READ_HEAD_FILE(rh) TSDB_DFILE_IN_SET(TSDB_READ_FSET(rh), TSDB_FILE_HEAD)
#define TSDB_READ_HEAD_FILE(rh) TSDB_DFILE_IN_SET(TSDB_READ_FSET(rh), TSDB_FILE_HEAD)
#define TSDB_READ_DATA_FILE(rh) TSDB_DFILE_IN_SET(TSDB_READ_FSET(rh), TSDB_FILE_DATA)
#define TSDB_READ_DATA_FILE(rh) TSDB_DFILE_IN_SET(TSDB_READ_FSET(rh), TSDB_FILE_DATA)
#define TSDB_READ_LAST_FILE(rh) TSDB_DFILE_IN_SET(TSDB_READ_FSET(rh), TSDB_FILE_LAST)
#define TSDB_READ_LAST_FILE(rh) TSDB_DFILE_IN_SET(TSDB_READ_FSET(rh), TSDB_FILE_LAST)
...
...
source/dnode/vnode/src/meta/metaTDBImpl.c
浏览文件 @
055e0516
...
@@ -426,6 +426,71 @@ struct SMSmaCursor {
...
@@ -426,6 +426,71 @@ struct SMSmaCursor {
int
vLen
;
int
vLen
;
};
};
STSmaWrapper
*
metaGetSmaInfoByTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
// TODO
// ASSERT(0);
// return NULL;
#ifdef META_TDB_SMA_TEST
STSmaWrapper
*
pSW
=
NULL
;
SMSmaCursor
*
pCur
=
metaOpenSmaCursor
(
pMeta
,
uid
);
if
(
pCur
==
NULL
)
{
return
NULL
;
}
void
*
pBuf
=
NULL
;
SSmaIdxKey
*
pSmaIdxKey
=
NULL
;
while
(
true
)
{
// TODO: lock during iterate?
if
(
tdbDbNext
(
pCur
->
pCur
,
&
pCur
->
pKey
,
&
pCur
->
kLen
,
NULL
,
&
pCur
->
vLen
)
==
0
)
{
pSmaIdxKey
=
pCur
->
pKey
;
ASSERT
(
pSmaIdxKey
!=
NULL
);
void
*
pSmaVal
=
metaGetSmaInfoByIndex
(
pMeta
,
pSmaIdxKey
->
smaUid
,
false
);
if
(
pSmaVal
==
NULL
)
{
tsdbWarn
(
"no tsma exists for indexUid: %"
PRIi64
,
pSmaIdxKey
->
smaUid
);
continue
;
}
if
((
pSW
==
NULL
)
&&
((
pSW
=
taosMemoryCalloc
(
1
,
sizeof
(
*
pSW
)))
==
NULL
))
{
TDB_FREE
(
pSmaVal
);
metaCloseSmaCursor
(
pCur
);
return
NULL
;
}
++
pSW
->
number
;
STSma
*
tptr
=
(
STSma
*
)
taosMemoryRealloc
(
pSW
->
tSma
,
pSW
->
number
*
sizeof
(
STSma
));
if
(
tptr
==
NULL
)
{
TDB_FREE
(
pSmaVal
);
metaCloseSmaCursor
(
pCur
);
tdDestroyTSmaWrapper
(
pSW
);
taosMemoryFreeClear
(
pSW
);
return
NULL
;
}
pSW
->
tSma
=
tptr
;
pBuf
=
pSmaVal
;
if
(
tDecodeTSma
(
pBuf
,
pSW
->
tSma
+
pSW
->
number
-
1
)
==
NULL
)
{
TDB_FREE
(
pSmaVal
);
metaCloseSmaCursor
(
pCur
);
tdDestroyTSmaWrapper
(
pSW
);
taosMemoryFreeClear
(
pSW
);
return
NULL
;
}
TDB_FREE
(
pSmaVal
);
continue
;
}
break
;
}
metaCloseSmaCursor
(
pCur
);
return
pSW
;
#endif
}
int
metaRemoveSmaFromDb
(
SMeta
*
pMeta
,
int64_t
indexUid
)
{
int
metaRemoveSmaFromDb
(
SMeta
*
pMeta
,
int64_t
indexUid
)
{
// TODO
// TODO
ASSERT
(
0
);
ASSERT
(
0
);
...
...
source/dnode/vnode/src/tq/tq.c
浏览文件 @
055e0516
...
@@ -618,127 +618,6 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
...
@@ -618,127 +618,6 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
}
}
}
}
#if 0
int32_t tqProcessRebReq(STQ* pTq, char* msg) {
SMqMVRebReq req = {0};
terrno = TSDB_CODE_SUCCESS;
tDecodeSMqMVRebReq(msg, &req);
vDebug("vg %d set from consumer %ld to consumer %ld", req.vgId, req.oldConsumerId, req.newConsumerId);
STqConsumer* pConsumer = tqHandleGet(pTq->tqMeta, req.oldConsumerId);
ASSERT(pConsumer);
ASSERT(pConsumer->consumerId == req.oldConsumerId);
int32_t numOfTopics = taosArrayGetSize(pConsumer->topics);
if (numOfTopics == 1) {
STqTopic* pTopic = taosArrayGet(pConsumer->topics, 0);
ASSERT(strcmp(pTopic->topicName, req.topic) == 0);
STqConsumer* pNewConsumer = tqHandleGet(pTq->tqMeta, req.newConsumerId);
if (pNewConsumer == NULL) {
pConsumer->consumerId = req.newConsumerId;
tqHandleMovePut(pTq->tqMeta, req.newConsumerId, pConsumer);
tqHandleCommit(pTq->tqMeta, req.newConsumerId);
tqHandlePurge(pTq->tqMeta, req.oldConsumerId);
return 0;
} else {
taosArrayPush(pNewConsumer->topics, pTopic);
}
} else {
for (int32_t i = 0; i < numOfTopics; i++) {
STqTopic* pTopic = taosArrayGet(pConsumer->topics, i);
if (strcmp(pTopic->topicName, req.topic) == 0) {
STqConsumer* pNewConsumer = tqHandleGet(pTq->tqMeta, req.newConsumerId);
if (pNewConsumer == NULL) {
pNewConsumer = taosMemoryCalloc(1, sizeof(STqConsumer));
if (pNewConsumer == NULL) {
terrno = TSDB_CODE_TQ_OUT_OF_MEMORY;
return -1;
}
strcpy(pNewConsumer->cgroup, pConsumer->cgroup);
pNewConsumer->topics = taosArrayInit(0, sizeof(STqTopic));
pNewConsumer->consumerId = req.newConsumerId;
pNewConsumer->epoch = 0;
taosArrayPush(pNewConsumer->topics, pTopic);
tqHandleMovePut(pTq->tqMeta, req.newConsumerId, pConsumer);
tqHandleCommit(pTq->tqMeta, req.newConsumerId);
return 0;
}
ASSERT(pNewConsumer->consumerId == req.newConsumerId);
taosArrayPush(pNewConsumer->topics, pTopic);
break;
}
}
//
}
return 0;
}
int32_t tqProcessSetConnReq(STQ* pTq, char* msg) {
SMqSetCVgReq req = {0};
tDecodeSMqSetCVgReq(msg, &req);
bool create = false;
vDebug("vg %d set to consumer %ld", req.vgId, req.consumerId);
STqConsumer* pConsumer = tqHandleGet(pTq->tqMeta, req.consumerId);
if (pConsumer == NULL) {
pConsumer = taosMemoryCalloc(1, sizeof(STqConsumer));
if (pConsumer == NULL) {
terrno = TSDB_CODE_TQ_OUT_OF_MEMORY;
return -1;
}
strcpy(pConsumer->cgroup, req.cgroup);
pConsumer->topics = taosArrayInit(0, sizeof(STqTopic));
pConsumer->consumerId = req.consumerId;
pConsumer->epoch = 0;
create = true;
}
STqTopic* pTopic = taosMemoryCalloc(1, sizeof(STqTopic));
if (pTopic == NULL) {
taosArrayDestroy(pConsumer->topics);
taosMemoryFree(pConsumer);
return -1;
}
strcpy(pTopic->topicName, req.topicName);
pTopic->sql = req.sql;
pTopic->physicalPlan = req.physicalPlan;
pTopic->qmsg = req.qmsg;
/*pTopic->committedOffset = -1;*/
/*pTopic->currentOffset = -1;*/
pTopic->buffer.firstOffset = -1;
pTopic->buffer.lastOffset = -1;
pTopic->pReadhandle = walOpenReadHandle(pTq->pWal);
if (pTopic->pReadhandle == NULL) {
ASSERT(false);
}
for (int i = 0; i < TQ_BUFFER_SIZE; i++) {
pTopic->buffer.output[i].status = 0;
STqReadHandle* pReadHandle = tqInitSubmitMsgScanner(pTq->pVnodeMeta);
SReadHandle handle = {
.reader = pReadHandle,
.meta = pTq->pVnodeMeta,
};
pTopic->buffer.output[i].pReadHandle = pReadHandle;
pTopic->buffer.output[i].task = qCreateStreamExecTaskInfo(req.qmsg, &handle);
ASSERT(pTopic->buffer.output[i].task);
}
vDebug("set topic %s to consumer %ld on vg %d", pTopic->topicName, req.consumerId, TD_VID(pTq->pVnode));
taosArrayPush(pConsumer->topics, pTopic);
if (create) {
tqHandleMovePut(pTq->tqMeta, req.consumerId, pConsumer);
tqHandleCommit(pTq->tqMeta, req.consumerId);
}
terrno = TSDB_CODE_SUCCESS;
return 0;
}
int32_t tqProcessCancelConnReq(STQ* pTq, char* msg) {
terrno = TSDB_CODE_SUCCESS;
return 0;
}
#endif
int32_t
tqExpandTask
(
STQ
*
pTq
,
SStreamTask
*
pTask
,
int32_t
parallel
)
{
int32_t
tqExpandTask
(
STQ
*
pTq
,
SStreamTask
*
pTask
,
int32_t
parallel
)
{
if
(
pTask
->
execType
==
TASK_EXEC__NONE
)
return
0
;
if
(
pTask
->
execType
==
TASK_EXEC__NONE
)
return
0
;
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
055e0516
...
@@ -82,16 +82,7 @@ bool tqNextDataBlock(STqReadHandle* pHandle) {
...
@@ -82,16 +82,7 @@ bool tqNextDataBlock(STqReadHandle* pHandle) {
return
false
;
return
false
;
}
}
int
tqRetrieveDataBlockInfo
(
STqReadHandle
*
pHandle
,
SDataBlockInfo
*
pBlockInfo
)
{
int32_t
tqRetrieveDataBlock
(
SArray
**
ppCols
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
int32_t
*
pNumOfRows
)
{
// currently only rows are used
pBlockInfo
->
numOfCols
=
taosArrayGetSize
(
pHandle
->
pColIdList
);
pBlockInfo
->
rows
=
pHandle
->
pBlock
->
numOfRows
;
// pBlockInfo->uid = pHandle->pBlock->uid; // the uid can not be assigned to pBlockData.
return
0
;
}
SArray
*
tqRetrieveDataBlock
(
STqReadHandle
*
pHandle
)
{
/*int32_t sversion = pHandle->pBlock->sversion;*/
/*int32_t sversion = pHandle->pBlock->sversion;*/
// TODO set to real sversion
// TODO set to real sversion
int32_t
sversion
=
0
;
int32_t
sversion
=
0
;
...
@@ -112,7 +103,7 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
...
@@ -112,7 +103,7 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
STSchema
*
pTschema
=
pHandle
->
pSchema
;
STSchema
*
pTschema
=
pHandle
->
pSchema
;
SSchemaWrapper
*
pSchemaWrapper
=
pHandle
->
pSchemaWrapper
;
SSchemaWrapper
*
pSchemaWrapper
=
pHandle
->
pSchemaWrapper
;
int32_t
n
umOfRows
=
pHandle
->
pBlock
->
numOfRows
;
*
pN
umOfRows
=
pHandle
->
pBlock
->
numOfRows
;
/*int32_t numOfCols = pHandle->pSchema->numOfCols;*/
/*int32_t numOfCols = pHandle->pSchema->numOfCols;*/
int32_t
colNumNeed
=
taosArrayGetSize
(
pHandle
->
pColIdList
);
int32_t
colNumNeed
=
taosArrayGetSize
(
pHandle
->
pColIdList
);
...
@@ -120,10 +111,11 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
...
@@ -120,10 +111,11 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
colNumNeed
=
pSchemaWrapper
->
nCols
;
colNumNeed
=
pSchemaWrapper
->
nCols
;
}
}
SArray
*
pArray
=
taosArrayInit
(
colNumNeed
,
sizeof
(
SColumnInfoData
));
*
ppCols
=
taosArrayInit
(
colNumNeed
,
sizeof
(
SColumnInfoData
));
if
(
pArray
==
NULL
)
{
if
(
*
ppCols
==
NULL
)
{
return
NULL
;
return
-
1
;
}
}
int32_t
colMeta
=
0
;
int32_t
colMeta
=
0
;
int32_t
colNeed
=
0
;
int32_t
colNeed
=
0
;
while
(
colMeta
<
pSchemaWrapper
->
nCols
&&
colNeed
<
colNumNeed
)
{
while
(
colMeta
<
pSchemaWrapper
->
nCols
&&
colNeed
<
colNumNeed
)
{
...
@@ -136,21 +128,24 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
...
@@ -136,21 +128,24 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
colNeed
++
;
colNeed
++
;
}
else
{
}
else
{
SColumnInfoData
colInfo
=
{
0
};
SColumnInfoData
colInfo
=
{
0
};
/*int sz = numOfRows * pColSchema->bytes;*/
colInfo
.
info
.
bytes
=
pColSchema
->
bytes
;
colInfo
.
info
.
bytes
=
pColSchema
->
bytes
;
colInfo
.
info
.
colId
=
pColSchema
->
colId
;
colInfo
.
info
.
colId
=
pColSchema
->
colId
;
colInfo
.
info
.
type
=
pColSchema
->
type
;
colInfo
.
info
.
type
=
pColSchema
->
type
;
if
(
colInfoDataEnsureCapacity
(
&
colInfo
,
0
,
numOfRows
)
<
0
)
{
if
(
colInfoDataEnsureCapacity
(
&
colInfo
,
0
,
*
pNumOfRows
)
<
0
)
{
taosArrayDestroyEx
(
pArray
,
(
void
(
*
)(
void
*
))
tDeleteSSDataBlock
);
goto
FAIL
;
return
NULL
;
}
}
taosArrayPush
(
pArray
,
&
colInfo
);
taosArrayPush
(
*
ppCols
,
&
colInfo
);
colMeta
++
;
colMeta
++
;
colNeed
++
;
colNeed
++
;
}
}
}
}
int32_t
colActual
=
taosArrayGetSize
(
*
ppCols
);
// TODO in stream shuffle case, fetch groupId
*
pGroupId
=
0
;
STSRowIter
iter
=
{
0
};
STSRowIter
iter
=
{
0
};
tdSTSRowIterInit
(
&
iter
,
pTschema
);
tdSTSRowIterInit
(
&
iter
,
pTschema
);
STSRow
*
row
;
STSRow
*
row
;
...
@@ -159,22 +154,22 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
...
@@ -159,22 +154,22 @@ SArray* tqRetrieveDataBlock(STqReadHandle* pHandle) {
while
((
row
=
tGetSubmitBlkNext
(
&
pHandle
->
blkIter
))
!=
NULL
)
{
while
((
row
=
tGetSubmitBlkNext
(
&
pHandle
->
blkIter
))
!=
NULL
)
{
tdSTSRowIterReset
(
&
iter
,
row
);
tdSTSRowIterReset
(
&
iter
,
row
);
// get all wanted col of that block
// get all wanted col of that block
int32_t
colTot
=
taosArrayGetSize
(
pArray
);
for
(
int32_t
i
=
0
;
i
<
colActual
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
colTot
;
i
++
)
{
SColumnInfoData
*
pColData
=
taosArrayGet
(
*
ppCols
,
i
);
SColumnInfoData
*
pColData
=
taosArrayGet
(
pArray
,
i
);
SCellVal
sVal
=
{
0
};
SCellVal
sVal
=
{
0
};
if
(
!
tdSTSRowIterNext
(
&
iter
,
pColData
->
info
.
colId
,
pColData
->
info
.
type
,
&
sVal
))
{
if
(
!
tdSTSRowIterNext
(
&
iter
,
pColData
->
info
.
colId
,
pColData
->
info
.
type
,
&
sVal
))
{
break
;
break
;
}
}
/*if (colDataAppend(pColData, curRow, sVal.val, false) < 0) {*/
if
(
colDataAppend
(
pColData
,
curRow
,
sVal
.
val
,
sVal
.
valType
==
TD_VTYPE_NULL
)
<
0
)
{
if
(
colDataAppend
(
pColData
,
curRow
,
sVal
.
val
,
sVal
.
valType
==
TD_VTYPE_NULL
)
<
0
)
{
taosArrayDestroyEx
(
pArray
,
(
void
(
*
)(
void
*
))
tDeleteSSDataBlock
);
goto
FAIL
;
return
NULL
;
}
}
}
}
curRow
++
;
curRow
++
;
}
}
return
pArray
;
return
0
;
FAIL:
taosArrayDestroy
(
*
ppCols
);
return
-
1
;
}
}
void
tqReadHandleSetColIdList
(
STqReadHandle
*
pReadHandle
,
SArray
*
pColIdList
)
{
pReadHandle
->
pColIdList
=
pColIdList
;
}
void
tqReadHandleSetColIdList
(
STqReadHandle
*
pReadHandle
,
SArray
*
pColIdList
)
{
pReadHandle
->
pColIdList
=
pColIdList
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
055e0516
...
@@ -3260,6 +3260,9 @@ int32_t tsdbRetrieveDataBlockStatisInfo(tsdbReaderT* pTsdbReadHandle, SColumnDat
...
@@ -3260,6 +3260,9 @@ int32_t tsdbRetrieveDataBlockStatisInfo(tsdbReaderT* pTsdbReadHandle, SColumnDat
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
tsdbDebug
(
"vgId:%d succeed to load block statis part for uid %"
PRIu64
,
REPO_ID
(
pHandle
->
pTsdb
),
TSDB_READ_TABLE_UID
(
&
pHandle
->
rhelper
));
int16_t
*
colIds
=
pHandle
->
defaultLoadColumn
->
pData
;
int16_t
*
colIds
=
pHandle
->
defaultLoadColumn
->
pData
;
size_t
numOfCols
=
QH_GET_NUM_OF_COLS
(
pHandle
);
size_t
numOfCols
=
QH_GET_NUM_OF_COLS
(
pHandle
);
...
...
source/dnode/vnode/src/tsdb/tsdbReadImpl.c
浏览文件 @
055e0516
...
@@ -322,15 +322,18 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
...
@@ -322,15 +322,18 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
ASSERT
(
pBlock
->
numOfSubBlocks
<=
1
);
ASSERT
(
pBlock
->
numOfSubBlocks
<=
1
);
if
(
!
pBlock
->
aggrStat
)
{
if
(
!
pBlock
->
aggrStat
)
{
tsdbDebug
(
"vgId:%d no need to load block statis part for uid %"
PRIu64
" since not exist"
,
REPO_ID
(
pReadh
->
pRepo
),
TSDB_READ_TABLE_UID
(
pReadh
));
return
TSDB_STATIS_NONE
;
return
TSDB_STATIS_NONE
;
}
}
SDFile
*
pDFileAggr
=
pBlock
->
last
?
TSDB_READ_SMAL_FILE
(
pReadh
)
:
TSDB_READ_SMAD_FILE
(
pReadh
);
SDFile
*
pDFileAggr
=
pBlock
->
last
?
TSDB_READ_SMAL_FILE
(
pReadh
)
:
TSDB_READ_SMAD_FILE
(
pReadh
);
if
(
tsdbSeekDFile
(
pDFileAggr
,
pBlock
->
aggrOffset
,
SEEK_SET
)
<
0
)
{
if
(
tsdbSeekDFile
(
pDFileAggr
,
pBlock
->
aggrOffset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to load block aggr part while seek file %s to offset %"
PRIu64
" since %s"
,
tsdbError
(
"vgId:%d failed to load block statis part for uid %"
PRIu64
" while seek file %s to offset %"
PRIu64
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
(
uint64_t
)
pBlock
->
aggrOffset
,
" since %s"
,
tstrerror
(
terrno
));
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
(
uint64_t
)
pBlock
->
aggrOffset
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -339,25 +342,28 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
...
@@ -339,25 +342,28 @@ int tsdbLoadBlockStatis(SReadH *pReadh, SBlock *pBlock) {
int64_t
nreadAggr
=
tsdbReadDFile
(
pDFileAggr
,
(
void
*
)(
pReadh
->
pAggrBlkData
),
sizeAggr
);
int64_t
nreadAggr
=
tsdbReadDFile
(
pDFileAggr
,
(
void
*
)(
pReadh
->
pAggrBlkData
),
sizeAggr
);
if
(
nreadAggr
<
0
)
{
if
(
nreadAggr
<
0
)
{
tsdbError
(
"vgId:%d failed to load block aggr part while read file %s since %s, offset:%"
PRIu64
" len :%"
PRIzu
,
tsdbError
(
"vgId:%d failed to load block statis part for uid %"
PRIu64
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
tstrerror
(
terrno
),
" while read file %s since %s, offset:%"
PRIu64
" len :%"
PRIzu
,
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
tstrerror
(
terrno
),
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
);
return
-
1
;
return
-
1
;
}
}
if
(
nreadAggr
<
sizeAggr
)
{
if
(
nreadAggr
<
sizeAggr
)
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block
aggr part in file %s is corrupted, offset:%"
PRIu64
" expected bytes:%"
PRIzu
tsdbError
(
"vgId:%d block
statis part for uid %"
PRIu64
" in file %s is corrupted, offset:%"
PRIu64
" read bytes: %"
PRId64
,
"
expected bytes:%"
PRIzu
"
read bytes: %"
PRId64
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_
FILE_FULL_NAME
(
pDFileAggr
),
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_
READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
)
,
nreadAggr
);
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
,
nreadAggr
);
return
-
1
;
return
-
1
;
}
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)(
pReadh
->
pAggrBlkData
),
(
uint32_t
)
sizeAggr
))
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)(
pReadh
->
pAggrBlkData
),
(
uint32_t
)
sizeAggr
))
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block aggr part in file %s is corrupted since wrong checksum, offset:%"
PRIu64
" len :%"
PRIzu
,
tsdbError
(
"vgId:%d block statis part for uid %"
PRIu64
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
);
"in file %s is corrupted since wrong checksum, offset:%"
PRIu64
" len :%"
PRIzu
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_READ_TABLE_UID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFileAggr
),
(
uint64_t
)
pBlock
->
aggrOffset
,
sizeAggr
);
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
...
@@ -367,7 +373,7 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
...
@@ -367,7 +373,7 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
ASSERT
(
pBlock
->
numOfSubBlocks
<=
1
);
ASSERT
(
pBlock
->
numOfSubBlocks
<=
1
);
SDFile
*
pDFile
=
(
pBlock
->
last
)
?
TSDB_READ_LAST_FILE
(
pReadh
)
:
TSDB_READ_DATA_FILE
(
pReadh
);
SDFile
*
pDFile
=
(
pBlock
->
last
)
?
TSDB_READ_LAST_FILE
(
pReadh
)
:
TSDB_READ_DATA_FILE
(
pReadh
);
if
(
tsdbSeekDFile
(
pDFile
,
pBlock
->
offset
,
SEEK_SET
)
<
0
)
{
if
(
tsdbSeekDFile
(
pDFile
,
pBlock
->
offset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to load block
statis
part while seek file %s to offset %"
PRId64
" since %s"
,
tsdbError
(
"vgId:%d failed to load block
head
part while seek file %s to offset %"
PRId64
" since %s"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
tstrerror
(
terrno
));
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
tstrerror
(
terrno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -377,14 +383,14 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
...
@@ -377,14 +383,14 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
int64_t
nread
=
tsdbReadDFile
(
pDFile
,
(
void
*
)(
pReadh
->
pBlkData
),
size
);
int64_t
nread
=
tsdbReadDFile
(
pDFile
,
(
void
*
)(
pReadh
->
pBlkData
),
size
);
if
(
nread
<
0
)
{
if
(
nread
<
0
)
{
tsdbError
(
"vgId:%d failed to load block
statis
part while read file %s since %s, offset:%"
PRId64
" len :%"
PRIzu
,
tsdbError
(
"vgId:%d failed to load block
head
part while read file %s since %s, offset:%"
PRId64
" len :%"
PRIzu
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
),
(
int64_t
)
pBlock
->
offset
,
size
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
tstrerror
(
terrno
),
(
int64_t
)
pBlock
->
offset
,
size
);
return
-
1
;
return
-
1
;
}
}
if
(
nread
<
size
)
{
if
(
nread
<
size
)
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block
statis
part in file %s is corrupted, offset:%"
PRId64
" expected bytes:%"
PRIzu
tsdbError
(
"vgId:%d block
head
part in file %s is corrupted, offset:%"
PRId64
" expected bytes:%"
PRIzu
" read bytes: %"
PRId64
,
" read bytes: %"
PRId64
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
size
,
nread
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
size
,
nread
);
return
-
1
;
return
-
1
;
...
@@ -392,7 +398,7 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
...
@@ -392,7 +398,7 @@ static int tsdbLoadBlockOffset(SReadH *pReadh, SBlock *pBlock) {
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)(
pReadh
->
pBlkData
),
(
uint32_t
)
size
))
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)(
pReadh
->
pBlkData
),
(
uint32_t
)
size
))
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block
statis
part in file %s is corrupted since wrong checksum, offset:%"
PRId64
" len :%"
PRIzu
,
tsdbError
(
"vgId:%d block
head
part in file %s is corrupted since wrong checksum, offset:%"
PRId64
" len :%"
PRIzu
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
size
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
size
);
return
-
1
;
return
-
1
;
}
}
...
@@ -546,7 +552,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
...
@@ -546,7 +552,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
int32_t
tsize
=
(
int32_t
)
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
(
uint32_t
)
pBlock
->
blkVer
);
int32_t
tsize
=
(
int32_t
)
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
(
uint32_t
)
pBlock
->
blkVer
);
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
TSDB_READ_BUF
(
pReadh
),
tsize
))
{
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
TSDB_READ_BUF
(
pReadh
),
tsize
))
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block
statis
part in file %s is corrupted since wrong checksum, offset:%"
PRId64
" len :%d"
,
tsdbError
(
"vgId:%d block
head
part in file %s is corrupted since wrong checksum, offset:%"
PRId64
" len :%d"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
tsize
);
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
(
int64_t
)
pBlock
->
offset
,
tsize
);
return
-
1
;
return
-
1
;
}
}
...
...
source/dnode/vnode/src/tsdb/tsdbSma.c
浏览文件 @
055e0516
...
@@ -643,6 +643,7 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t vers
...
@@ -643,6 +643,7 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t vers
SSubmitMsgIter
msgIter
=
{
0
};
SSubmitMsgIter
msgIter
=
{
0
};
SSubmitBlk
*
pBlock
=
NULL
;
SSubmitBlk
*
pBlock
=
NULL
;
SInterval
interval
=
{
0
};
SInterval
interval
=
{
0
};
TSKEY
lastWinSKey
=
INT64_MIN
;
if
(
tInitSubmitMsgIter
(
pMsg
,
&
msgIter
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tInitSubmitMsgIter
(
pMsg
,
&
msgIter
)
!=
TSDB_CODE_SUCCESS
)
{
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
...
@@ -657,7 +658,7 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t vers
...
@@ -657,7 +658,7 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t vers
SSubmitBlkIter
blkIter
=
{
0
};
SSubmitBlkIter
blkIter
=
{
0
};
if
(
tInitSubmitBlkIter
(
pBlock
,
&
blkIter
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tInitSubmitBlkIter
(
pBlock
,
&
blkIter
)
!=
TSDB_CODE_SUCCESS
)
{
tdFreeTSmaWrapper
(
pSW
);
pSW
=
tdFreeTSmaWrapper
(
pSW
);
break
;
break
;
}
}
...
@@ -667,16 +668,19 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t vers
...
@@ -667,16 +668,19 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t vers
tdFreeTSmaWrapper
(
pSW
);
tdFreeTSmaWrapper
(
pSW
);
break
;
break
;
}
}
if
(
pSW
==
NULL
)
{
if
(
!
pSW
||
(
pTSma
->
tableUid
!=
pBlock
->
suid
))
{
if
(
pSW
)
{
pSW
=
tdFreeTSmaWrapper
(
pSW
);
}
if
((
pSW
=
metaGetSmaInfoByTable
(
REPO_META
(
pTsdb
),
pBlock
->
suid
))
==
NULL
)
{
if
((
pSW
=
metaGetSmaInfoByTable
(
REPO_META
(
pTsdb
),
pBlock
->
suid
))
==
NULL
)
{
break
;
break
;
}
}
if
((
pSW
->
number
)
<=
0
||
(
pSW
->
tSma
==
NULL
))
{
if
((
pSW
->
number
)
<=
0
||
(
pSW
->
tSma
==
NULL
))
{
tdFreeTSmaWrapper
(
pSW
);
pSW
=
tdFreeTSmaWrapper
(
pSW
);
break
;
break
;
}
}
pTSma
=
pSW
->
tSma
;
pTSma
=
pSW
->
tSma
;
}
interval
.
interval
=
pTSma
->
interval
;
interval
.
interval
=
pTSma
->
interval
;
interval
.
intervalUnit
=
pTSma
->
intervalUnit
;
interval
.
intervalUnit
=
pTSma
->
intervalUnit
;
...
@@ -684,14 +688,17 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t vers
...
@@ -684,14 +688,17 @@ int32_t tsdbUpdateExpiredWindowImpl(STsdb *pTsdb, SSubmitReq *pMsg, int64_t vers
interval
.
precision
=
REPO_CFG
(
pTsdb
)
->
precision
;
interval
.
precision
=
REPO_CFG
(
pTsdb
)
->
precision
;
interval
.
sliding
=
pTSma
->
sliding
;
interval
.
sliding
=
pTSma
->
sliding
;
interval
.
slidingUnit
=
pTSma
->
slidingUnit
;
interval
.
slidingUnit
=
pTSma
->
slidingUnit
;
}
TSKEY
winSKey
=
taosTimeTruncate
(
TD_ROW_KEY
(
row
),
&
interval
,
interval
.
precision
);
TSKEY
winSKey
=
taosTimeTruncate
(
TD_ROW_KEY
(
row
),
&
interval
,
interval
.
precision
);
if
(
lastWinSKey
!=
winSKey
)
{
lastWinSKey
=
winSKey
;
tsdbSetExpiredWindow
(
pTsdb
,
pItemsHash
,
pTSma
->
indexUid
,
winSKey
,
version
);
tsdbSetExpiredWindow
(
pTsdb
,
pItemsHash
,
pTSma
->
indexUid
,
winSKey
,
version
);
}
else
{
// TODO: release only when suid changes.
tsdbDebug
(
"vgId:%d smaIndex %"
PRIi64
", put skey %"
PRIi64
" to expire window ignore as duplicated"
,
tdDestroyTSmaWrapper
(
pSW
);
REPO_ID
(
pTsdb
),
pTSma
->
indexUid
,
winSKey
);
taosMemoryFreeClear
(
pSW
);
}
}
}
}
}
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
055e0516
...
@@ -643,6 +643,49 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmt
...
@@ -643,6 +643,49 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmt
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgGetUdfInfoFromMnode
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
funcName
,
SFuncInfo
**
out
)
{
char
*
msg
=
NULL
;
int32_t
msgLen
=
0
;
ctgDebug
(
"try to get udf info from mnode, funcName:%s"
,
funcName
);
int32_t
code
=
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_RETRIEVE_FUNC
)]((
void
*
)
funcName
,
&
msg
,
0
,
&
msgLen
);
if
(
code
)
{
ctgError
(
"Build get udf msg failed, code:%x, db:%s"
,
code
,
funcName
);
CTG_ERR_RET
(
code
);
}
SRpcMsg
rpcMsg
=
{
.
msgType
=
TDMT_MND_RETRIEVE_FUNC
,
.
pCont
=
msg
,
.
contLen
=
msgLen
,
};
SRpcMsg
rpcRsp
=
{
0
};
rpcSendRecv
(
pRpc
,
(
SEpSet
*
)
pMgmtEps
,
&
rpcMsg
,
&
rpcRsp
);
if
(
TSDB_CODE_SUCCESS
!=
rpcRsp
.
code
)
{
if
(
TSDB_CODE_MND_FUNC_NOT_EXIST
==
rpcRsp
.
code
)
{
ctgDebug
(
"funcName %s not exist in mnode"
,
funcName
);
taosMemoryFreeClear
(
*
out
);
CTG_RET
(
TSDB_CODE_SUCCESS
);
}
ctgError
(
"error rsp for get udf, error:%s, funcName:%s"
,
tstrerror
(
rpcRsp
.
code
),
funcName
);
CTG_ERR_RET
(
rpcRsp
.
code
);
}
code
=
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_RETRIEVE_FUNC
)](
*
out
,
rpcRsp
.
pCont
,
rpcRsp
.
contLen
);
if
(
code
)
{
ctgError
(
"Process get udf rsp failed, code:%x, funcName:%s"
,
code
,
funcName
);
CTG_ERR_RET
(
code
);
}
ctgDebug
(
"Got udf from mnode, funcName:%s"
,
funcName
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgIsTableMetaExistInCache
(
SCatalog
*
pCtg
,
char
*
dbFName
,
char
*
tbName
,
int32_t
*
exist
)
{
int32_t
ctgIsTableMetaExistInCache
(
SCatalog
*
pCtg
,
char
*
dbFName
,
char
*
tbName
,
int32_t
*
exist
)
{
if
(
NULL
==
pCtg
->
dbCache
)
{
if
(
NULL
==
pCtg
->
dbCache
)
{
...
@@ -2811,6 +2854,30 @@ int32_t catalogGetIndexInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps,
...
@@ -2811,6 +2854,30 @@ int32_t catalogGetIndexInfo(SCatalog* pCtg, void *pRpc, const SEpSet* pMgmtEps,
CTG_API_LEAVE
(
ctgGetIndexInfoFromMnode
(
pCtg
,
pRpc
,
pMgmtEps
,
indexName
,
pInfo
));
CTG_API_LEAVE
(
ctgGetIndexInfoFromMnode
(
pCtg
,
pRpc
,
pMgmtEps
,
indexName
,
pInfo
));
}
}
int32_t
catalogGetUdfInfo
(
SCatalog
*
pCtg
,
void
*
pRpc
,
const
SEpSet
*
pMgmtEps
,
const
char
*
funcName
,
SFuncInfo
**
pInfo
)
{
CTG_API_ENTER
();
if
(
NULL
==
pCtg
||
NULL
==
pRpc
||
NULL
==
pMgmtEps
||
NULL
==
funcName
||
NULL
==
pInfo
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
int32_t
code
=
0
;
*
pInfo
=
taosMemoryMalloc
(
sizeof
(
SFuncInfo
));
if
(
NULL
==
*
pInfo
)
{
CTG_API_LEAVE
(
TSDB_CODE_OUT_OF_MEMORY
);
}
CTG_ERR_JRET
(
ctgGetUdfInfoFromMnode
(
pCtg
,
pRpc
,
pMgmtEps
,
funcName
,
pInfo
));
_return:
if
(
code
)
{
taosMemoryFreeClear
(
*
pInfo
);
}
CTG_API_LEAVE
(
code
);
}
void
catalogDestroy
(
void
)
{
void
catalogDestroy
(
void
)
{
qInfo
(
"start to destroy catalog"
);
qInfo
(
"start to destroy catalog"
);
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
055e0516
...
@@ -30,13 +30,12 @@
...
@@ -30,13 +30,12 @@
#include "query.h"
#include "query.h"
#include "tcompare.h"
#include "tcompare.h"
#include "thash.h"
#include "thash.h"
#include "vnode.h"
#include "ttypes.h"
#include "ttypes.h"
#include "vnode.h"
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
#define SET_REVERSE_SCAN_FLAG(_info) ((_info)->scanFlag = REVERSE_SCAN)
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
#define SWITCH_ORDER(n) (((n) = ((n) == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC))
void
switchCtxOrder
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
)
{
void
switchCtxOrder
(
SqlFunctionCtx
*
pCtx
,
int32_t
numOfOutput
)
{
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
SWITCH_ORDER
(
pCtx
[
i
].
order
);
SWITCH_ORDER
(
pCtx
[
i
].
order
);
...
@@ -90,7 +89,7 @@ static void getNextTimeWindow(SInterval* pInterval, STimeWindow* tw, int32_t ord
...
@@ -90,7 +89,7 @@ static void getNextTimeWindow(SInterval* pInterval, STimeWindow* tw, int32_t ord
}
}
int64_t
key
=
tw
->
skey
,
interval
=
pInterval
->
interval
;
int64_t
key
=
tw
->
skey
,
interval
=
pInterval
->
interval
;
//convert key to second
//
convert key to second
key
=
convertTimePrecision
(
key
,
pInterval
->
precision
,
TSDB_TIME_PRECISION_MILLI
)
/
1000
;
key
=
convertTimePrecision
(
key
,
pInterval
->
precision
,
TSDB_TIME_PRECISION_MILLI
)
/
1000
;
if
(
pInterval
->
intervalUnit
==
'y'
)
{
if
(
pInterval
->
intervalUnit
==
'y'
)
{
...
@@ -125,8 +124,8 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
...
@@ -125,8 +124,8 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
// todo handle the time range case
// todo handle the time range case
TSKEY
sk
=
INT64_MIN
;
TSKEY
sk
=
INT64_MIN
;
TSKEY
ek
=
INT64_MAX
;
TSKEY
ek
=
INT64_MAX
;
// TSKEY sk = MIN(pQueryAttr->window.skey, pQueryAttr->window.ekey);
// TSKEY sk = MIN(pQueryAttr->window.skey, pQueryAttr->window.ekey);
// TSKEY ek = MAX(pQueryAttr->window.skey, pQueryAttr->window.ekey);
// TSKEY ek = MAX(pQueryAttr->window.skey, pQueryAttr->window.ekey);
if
(
true
)
{
if
(
true
)
{
getAlignQueryTimeWindow
(
pInterval
,
pInterval
->
precision
,
pBlockInfo
->
window
.
skey
,
&
w
);
getAlignQueryTimeWindow
(
pInterval
,
pInterval
->
precision
,
pBlockInfo
->
window
.
skey
,
&
w
);
...
@@ -136,7 +135,7 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
...
@@ -136,7 +135,7 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
return
true
;
return
true
;
}
}
while
(
1
)
{
// todo handle the desc order scan case
while
(
1
)
{
// todo handle the desc order scan case
getNextTimeWindow
(
pInterval
,
&
w
,
TSDB_ORDER_ASC
);
getNextTimeWindow
(
pInterval
,
&
w
,
TSDB_ORDER_ASC
);
if
(
w
.
skey
>
pBlockInfo
->
window
.
ekey
)
{
if
(
w
.
skey
>
pBlockInfo
->
window
.
ekey
)
{
break
;
break
;
...
@@ -148,24 +147,24 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
...
@@ -148,24 +147,24 @@ static bool overlapWithTimeWindow(SInterval* pInterval, SDataBlockInfo* pBlockIn
}
}
}
}
}
else
{
}
else
{
// getAlignQueryTimeWindow(pQueryAttr, pBlockInfo->window.ekey, sk, ek, &w);
// getAlignQueryTimeWindow(pQueryAttr, pBlockInfo->window.ekey, sk, ek, &w);
// assert(w.skey <= pBlockInfo->window.ekey);
// assert(w.skey <= pBlockInfo->window.ekey);
//
//
// if (w.skey > pBlockInfo->window.skey) {
// if (w.skey > pBlockInfo->window.skey) {
// return true;
// return true;
// }
// }
//
//
// while(1) {
// while(1) {
// getNextTimeWindow(pQueryAttr, &w);
// getNextTimeWindow(pQueryAttr, &w);
// if (w.ekey < pBlockInfo->window.skey) {
// if (w.ekey < pBlockInfo->window.skey) {
// break;
// break;
// }
// }
//
//
// assert(w.skey < pBlockInfo->window.skey);
// assert(w.skey < pBlockInfo->window.skey);
// if (w.ekey < pBlockInfo->window.ekey && w.ekey >= pBlockInfo->window.skey) {
// if (w.ekey < pBlockInfo->window.ekey && w.ekey >= pBlockInfo->window.skey) {
// return true;
// return true;
// }
// }
// }
// }
}
}
return
false
;
return
false
;
...
@@ -189,13 +188,13 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo,
...
@@ -189,13 +188,13 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo,
taosMemoryFreeClear
(
pBlock
->
pBlockAgg
);
taosMemoryFreeClear
(
pBlock
->
pBlockAgg
);
if
(
*
status
==
FUNC_DATA_REQUIRED_FILTEROUT
)
{
if
(
*
status
==
FUNC_DATA_REQUIRED_FILTEROUT
)
{
qDebug
(
"%s data block filter out, brange:%"
PRId64
"-%"
PRId64
", rows:%d"
,
GET_TASKID
(
pTaskInfo
),
pBlockInfo
->
window
.
skey
,
qDebug
(
"%s data block filter out, brange:%"
PRId64
"-%"
PRId64
", rows:%d"
,
GET_TASKID
(
pTaskInfo
),
pBlockInfo
->
window
.
ekey
,
pBlockInfo
->
rows
);
pBlockInfo
->
window
.
skey
,
pBlockInfo
->
window
.
ekey
,
pBlockInfo
->
rows
);
pCost
->
filterOutBlocks
+=
1
;
pCost
->
filterOutBlocks
+=
1
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
*
status
==
FUNC_DATA_REQUIRED_NOT_LOAD
)
{
}
else
if
(
*
status
==
FUNC_DATA_REQUIRED_NOT_LOAD
)
{
qDebug
(
"%s data block skipped, brange:%"
PRId64
"-%"
PRId64
", rows:%d"
,
GET_TASKID
(
pTaskInfo
),
pBlockInfo
->
window
.
skey
,
qDebug
(
"%s data block skipped, brange:%"
PRId64
"-%"
PRId64
", rows:%d"
,
GET_TASKID
(
pTaskInfo
),
pBlockInfo
->
window
.
ekey
,
pBlockInfo
->
rows
);
pBlockInfo
->
window
.
skey
,
pBlockInfo
->
window
.
ekey
,
pBlockInfo
->
rows
);
pCost
->
skipBlocks
+=
1
;
pCost
->
skipBlocks
+=
1
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
*
status
==
FUNC_DATA_REQUIRED_STATIS_LOAD
)
{
}
else
if
(
*
status
==
FUNC_DATA_REQUIRED_STATIS_LOAD
)
{
...
@@ -223,7 +222,7 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo,
...
@@ -223,7 +222,7 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo,
}
}
}
}
ASSERT
(
*
status
==
FUNC_DATA_REQUIRED_DATA_LOAD
);
ASSERT
(
*
status
==
FUNC_DATA_REQUIRED_DATA_LOAD
);
// todo filter data block according to the block sma data firstly
// todo filter data block according to the block sma data firstly
#if 0
#if 0
...
@@ -249,8 +248,8 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo,
...
@@ -249,8 +248,8 @@ int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableScanInfo,
doFilter
(
pTableScanInfo
->
pFilterNode
,
pBlock
);
doFilter
(
pTableScanInfo
->
pFilterNode
,
pBlock
);
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
),
pBlockInfo
->
window
.
skey
,
qDebug
(
"%s data block filter out, brange:%"
PRId64
"-%"
PRId64
", rows:%d"
,
GET_TASKID
(
pTaskInfo
),
pBlockInfo
->
window
.
ekey
,
pBlockInfo
->
rows
);
pBlockInfo
->
window
.
skey
,
pBlockInfo
->
window
.
ekey
,
pBlockInfo
->
rows
);
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -348,9 +347,9 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -348,9 +347,9 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator, bool* newgroup) {
setTaskStatus
(
pTaskInfo
,
TASK_NOT_COMPLETED
);
setTaskStatus
(
pTaskInfo
,
TASK_NOT_COMPLETED
);
pTableScanInfo
->
scanFlag
=
REPEAT_SCAN
;
pTableScanInfo
->
scanFlag
=
REPEAT_SCAN
;
// if (pResultRowInfo->size > 0) {
// if (pResultRowInfo->size > 0) {
// pResultRowInfo->curPos = 0;
// pResultRowInfo->curPos = 0;
// }
// }
qDebug
(
"%s start to repeat scan data blocks due to query func required, qrange:%"
PRId64
"-%"
PRId64
,
qDebug
(
"%s start to repeat scan data blocks due to query func required, qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pTaskInfo
->
window
.
skey
,
pTaskInfo
->
window
.
ekey
);
GET_TASKID
(
pTaskInfo
),
pTaskInfo
->
window
.
skey
,
pTaskInfo
->
window
.
ekey
);
...
@@ -367,7 +366,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -367,7 +366,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator, bool* newgroup) {
GET_TASKID
(
pTaskInfo
),
pTaskInfo
->
window
.
skey
,
pTaskInfo
->
window
.
ekey
);
GET_TASKID
(
pTaskInfo
),
pTaskInfo
->
window
.
skey
,
pTaskInfo
->
window
.
ekey
);
if
(
pResultRowInfo
->
size
>
0
)
{
if
(
pResultRowInfo
->
size
>
0
)
{
// pResultRowInfo->curPos = pResultRowInfo->size - 1;
// pResultRowInfo->curPos = pResultRowInfo->size - 1;
}
}
p
=
doTableScanImpl
(
pOperator
,
newgroup
);
p
=
doTableScanImpl
(
pOperator
,
newgroup
);
...
@@ -376,9 +375,10 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -376,9 +375,10 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator, bool* newgroup) {
return
p
;
return
p
;
}
}
SOperatorInfo
*
createTableScanOperatorInfo
(
void
*
pTsdbReadHandle
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
dataLoadFlag
,
SOperatorInfo
*
createTableScanOperatorInfo
(
void
*
pTsdbReadHandle
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
repeatTime
,
int32_t
reverseTime
,
SArray
*
pColMatchInfo
,
SSDataBlock
*
pResBlock
,
int32_t
dataLoadFlag
,
int32_t
repeatTime
,
int32_t
reverseTime
,
SNode
*
pCondition
,
SInterval
*
pInterval
,
double
sampleRatio
,
SExecTaskInfo
*
pTaskInfo
)
{
SArray
*
pColMatchInfo
,
SSDataBlock
*
pResBlock
,
SNode
*
pCondition
,
SInterval
*
pInterval
,
double
sampleRatio
,
SExecTaskInfo
*
pTaskInfo
)
{
assert
(
repeatTime
>
0
);
assert
(
repeatTime
>
0
);
STableScanInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
STableScanInfo
));
STableScanInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
STableScanInfo
));
...
@@ -393,7 +393,7 @@ SOperatorInfo* createTableScanOperatorInfo(void* pTsdbReadHandle, int32_t order,
...
@@ -393,7 +393,7 @@ SOperatorInfo* createTableScanOperatorInfo(void* pTsdbReadHandle, int32_t order,
pInfo
->
interval
=
*
pInterval
;
pInfo
->
interval
=
*
pInterval
;
pInfo
->
sampleRatio
=
sampleRatio
;
pInfo
->
sampleRatio
=
sampleRatio
;
pInfo
->
dataBlockLoadFlag
=
dataLoadFlag
;
pInfo
->
dataBlockLoadFlag
=
dataLoadFlag
;
pInfo
->
pResBlock
=
pResBlock
;
pInfo
->
pResBlock
=
pResBlock
;
pInfo
->
pFilterNode
=
pCondition
;
pInfo
->
pFilterNode
=
pCondition
;
pInfo
->
dataReader
=
pTsdbReadHandle
;
pInfo
->
dataReader
=
pTsdbReadHandle
;
...
@@ -463,25 +463,25 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -463,25 +463,25 @@ static SSDataBlock* doBlockInfoScan(SOperatorInfo* pOperator, bool* newgroup) {
tableBlockDist
.
minRows
=
INT_MAX
;
tableBlockDist
.
minRows
=
INT_MAX
;
tsdbGetFileBlocksDistInfo
(
pTableScanInfo
->
dataReader
,
&
tableBlockDist
);
tsdbGetFileBlocksDistInfo
(
pTableScanInfo
->
dataReader
,
&
tableBlockDist
);
tableBlockDist
.
numOfRowsInMemTable
=
(
int32_t
)
tsdbGetNumOfRowsInMemTable
(
pTableScanInfo
->
dataReader
);
tableBlockDist
.
numOfRowsInMemTable
=
(
int32_t
)
tsdbGetNumOfRowsInMemTable
(
pTableScanInfo
->
dataReader
);
SSDataBlock
*
pBlock
=
pTableScanInfo
->
pResBlock
;
SSDataBlock
*
pBlock
=
pTableScanInfo
->
pResBlock
;
pBlock
->
info
.
rows
=
1
;
pBlock
->
info
.
rows
=
1
;
pBlock
->
info
.
numOfCols
=
1
;
pBlock
->
info
.
numOfCols
=
1
;
// SBufferWriter bw = tbufInitWriter(NULL, false);
// SBufferWriter bw = tbufInitWriter(NULL, false);
// blockDistInfoToBinary(&tableBlockDist, &bw);
// blockDistInfoToBinary(&tableBlockDist, &bw);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
// int32_t len = (int32_t) tbufTell(&bw);
// int32_t len = (int32_t) tbufTell(&bw);
// pColInfo->pData = taosMemoryMalloc(len + sizeof(int32_t));
// pColInfo->pData = taosMemoryMalloc(len + sizeof(int32_t));
// *(int32_t*) pColInfo->pData = len;
// *(int32_t*) pColInfo->pData = len;
// memcpy(pColInfo->pData + sizeof(int32_t), tbufGetData(&bw, false), len);
// memcpy(pColInfo->pData + sizeof(int32_t), tbufGetData(&bw, false), len);
//
//
// tbufCloseWriter(&bw);
// tbufCloseWriter(&bw);
// SArray* g = GET_TABLEGROUP(pOperator->, 0);
// SArray* g = GET_TABLEGROUP(pOperator->, 0);
// pOperator->pRuntimeEnv->current = taosArrayGetP(g, 0);
// pOperator->pRuntimeEnv->current = taosArrayGetP(g, 0);
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
status
=
OP_EXEC_DONE
;
return
pBlock
;
return
pBlock
;
...
@@ -496,13 +496,13 @@ SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SExecTaskInfo*
...
@@ -496,13 +496,13 @@ SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SExecTaskInfo*
}
}
pInfo
->
dataReader
=
dataReader
;
pInfo
->
dataReader
=
dataReader
;
// pInfo->block.pDataBlock = taosArrayInit(1, sizeof(SColumnInfoData));
// pInfo->block.pDataBlock = taosArrayInit(1, sizeof(SColumnInfoData));
SColumnInfoData
infoData
=
{
0
};
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
type
=
TSDB_DATA_TYPE_BINARY
;
infoData
.
info
.
type
=
TSDB_DATA_TYPE_BINARY
;
infoData
.
info
.
bytes
=
1024
;
infoData
.
info
.
bytes
=
1024
;
infoData
.
info
.
colId
=
0
;
infoData
.
info
.
colId
=
0
;
// taosArrayPush(pInfo->block.pDataBlock, &infoData);
// taosArrayPush(pInfo->block.pDataBlock, &infoData);
pOperator
->
name
=
"DataBlockInfoScanOperator"
;
pOperator
->
name
=
"DataBlockInfoScanOperator"
;
// pOperator->operatorType = OP_TableBlockInfoScan;
// pOperator->operatorType = OP_TableBlockInfoScan;
...
@@ -516,7 +516,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SExecTaskInfo*
...
@@ -516,7 +516,7 @@ SOperatorInfo* createDataBlockInfoScanOperator(void* dataReader, SExecTaskInfo*
return
pOperator
;
return
pOperator
;
_error:
_error:
taosMemoryFreeClear
(
pInfo
);
taosMemoryFreeClear
(
pInfo
);
taosMemoryFreeClear
(
pOperator
);
taosMemoryFreeClear
(
pOperator
);
return
NULL
;
return
NULL
;
...
@@ -558,29 +558,42 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator, bool* newgroup)
...
@@ -558,29 +558,42 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator, bool* newgroup)
blockDataCleanup
(
pInfo
->
pRes
);
blockDataCleanup
(
pInfo
->
pRes
);
while
(
tqNextDataBlock
(
pInfo
->
readerHandle
))
{
while
(
tqNextDataBlock
(
pInfo
->
readerHandle
))
{
pTaskInfo
->
code
=
tqRetrieveDataBlockInfo
(
pInfo
->
readerHandle
,
pBlockInfo
);
SArray
*
pCols
=
NULL
;
if
(
pTaskInfo
->
code
!=
TSDB_CODE_SUCCESS
)
{
uint64_t
groupId
;
terrno
=
pTaskInfo
->
code
;
int32_t
numOfRows
;
pOperator
->
status
=
OP_EXEC_DONE
;
int32_t
code
=
tqRetrieveDataBlock
(
&
pCols
,
pInfo
->
readerHandle
,
&
groupId
,
&
numOfRows
);
return
NULL
;
}
if
(
pBlockInfo
->
rows
==
0
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
||
numOfRows
==
0
)
{
break
;
pTaskInfo
->
code
=
code
;
return
NULL
;
}
}
SArray
*
pCols
=
tqRetrieveDataBlock
(
pInfo
->
readerHandle
);
pInfo
->
pRes
->
info
.
groupId
=
groupId
;
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
int32_t
numOfCols
=
pInfo
->
pRes
->
info
.
numOfCols
;
int32_t
numOfCols
=
pInfo
->
pRes
->
info
.
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pCols
,
i
);
SColMatchInfo
*
pColMatchInfo
=
taosArrayGet
(
pInfo
->
pColMatchInfo
,
i
);
SColMatchInfo
*
pColMatchInfo
=
taosArrayGet
(
pInfo
->
pColMatchInfo
,
i
);
if
(
!
pColMatchInfo
->
output
)
{
if
(
!
pColMatchInfo
->
output
)
{
continue
;
continue
;
}
}
ASSERT
(
pColMatchInfo
->
colId
==
p
->
info
.
colId
);
bool
colExists
=
false
;
taosArraySet
(
pInfo
->
pRes
->
pDataBlock
,
pColMatchInfo
->
targetSlotId
,
p
);
for
(
int32_t
j
=
0
;
j
<
taosArrayGetSize
(
pCols
);
++
j
)
{
SColumnInfoData
*
pResCol
=
taosArrayGet
(
pCols
,
j
);
if
(
pResCol
->
info
.
colId
==
pColMatchInfo
->
colId
)
{
taosArraySet
(
pInfo
->
pRes
->
pDataBlock
,
pColMatchInfo
->
targetSlotId
,
pResCol
);
colExists
=
true
;
break
;
}
}
// the required column does not exists in submit block, let's set it to be all null value
if
(
!
colExists
)
{
SColumnInfoData
*
pDst
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
pColMatchInfo
->
targetSlotId
);
colInfoDataEnsureCapacity
(
pDst
,
0
,
pBlockInfo
->
rows
);
colDataAppendNNULL
(
pDst
,
0
,
pBlockInfo
->
rows
);
}
}
}
if
(
pInfo
->
pRes
->
pDataBlock
==
NULL
)
{
if
(
pInfo
->
pRes
->
pDataBlock
==
NULL
)
{
...
@@ -605,7 +618,8 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator, bool* newgroup)
...
@@ -605,7 +618,8 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator, bool* newgroup)
}
}
}
}
SOperatorInfo
*
createStreamScanOperatorInfo
(
void
*
streamReadHandle
,
SSDataBlock
*
pResBlock
,
SArray
*
pColList
,
SArray
*
pTableIdList
,
SExecTaskInfo
*
pTaskInfo
)
{
SOperatorInfo
*
createStreamScanOperatorInfo
(
void
*
streamReadHandle
,
SSDataBlock
*
pResBlock
,
SArray
*
pColList
,
SArray
*
pTableIdList
,
SExecTaskInfo
*
pTaskInfo
)
{
SStreamBlockScanInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamBlockScanInfo
));
SStreamBlockScanInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SStreamBlockScanInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
SOperatorInfo
*
pOperator
=
taosMemoryCalloc
(
1
,
sizeof
(
SOperatorInfo
));
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
if
(
pInfo
==
NULL
||
pOperator
==
NULL
)
{
...
@@ -618,7 +632,7 @@ SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, SSDataBlock*
...
@@ -618,7 +632,7 @@ SOperatorInfo* createStreamScanOperatorInfo(void* streamReadHandle, SSDataBlock*
int32_t
numOfOutput
=
taosArrayGetSize
(
pColList
);
int32_t
numOfOutput
=
taosArrayGetSize
(
pColList
);
SArray
*
pColIds
=
taosArrayInit
(
4
,
sizeof
(
int16_t
));
SArray
*
pColIds
=
taosArrayInit
(
4
,
sizeof
(
int16_t
));
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfOutput
;
++
i
)
{
int16_t
*
id
=
taosArrayGet
(
pColList
,
i
);
int16_t
*
id
=
taosArrayGet
(
pColList
,
i
);
taosArrayPush
(
pColIds
,
id
);
taosArrayPush
(
pColIds
,
id
);
}
}
...
@@ -828,7 +842,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
...
@@ -828,7 +842,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
i
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
i
);
int64_t
tmp
=
0
;
int64_t
tmp
=
0
;
char
t
[
10
]
=
{
0
};
char
t
[
10
]
=
{
0
};
STR_TO_VARSTR
(
t
,
"_"
);
//TODO
STR_TO_VARSTR
(
t
,
"_"
);
//
TODO
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
colDataAppend
(
pColInfoData
,
numOfRows
,
t
,
false
);
colDataAppend
(
pColInfoData
,
numOfRows
,
t
,
false
);
}
else
{
}
else
{
...
@@ -988,7 +1002,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
...
@@ -988,7 +1002,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
tableType
=
TSDB_MGMT_TABLE_QUERIES
;
tableType
=
TSDB_MGMT_TABLE_QUERIES
;
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_VNODES
,
tListLen
(
pName
->
tname
))
==
0
)
{
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_VNODES
,
tListLen
(
pName
->
tname
))
==
0
)
{
tableType
=
TSDB_MGMT_TABLE_VNODES
;
tableType
=
TSDB_MGMT_TABLE_VNODES
;
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
...
...
source/libs/function/src/functionMgt.c
浏览文件 @
055e0516
...
@@ -29,6 +29,7 @@ typedef struct SFuncMgtService {
...
@@ -29,6 +29,7 @@ typedef struct SFuncMgtService {
typedef
struct
SUdfInfo
{
typedef
struct
SUdfInfo
{
SDataType
outputDt
;
SDataType
outputDt
;
int8_t
funcType
;
}
SUdfInfo
;
}
SUdfInfo
;
static
SFuncMgtService
gFunMgtService
;
static
SFuncMgtService
gFunMgtService
;
...
@@ -52,30 +53,41 @@ static void doInitFunctionTable() {
...
@@ -52,30 +53,41 @@ static void doInitFunctionTable() {
gFunMgtService
.
pUdfTable
=
NULL
;
gFunMgtService
.
pUdfTable
=
NULL
;
}
}
static
int8_t
getUdfType
(
int32_t
funcId
)
{
SUdfInfo
*
pUdf
=
taosArrayGet
(
gFunMgtService
.
pUdfTable
,
funcId
-
FUNC_UDF_ID_START_OFFSET_VAL
-
1
);
return
pUdf
->
funcType
;
}
static
bool
isSpecificClassifyFunc
(
int32_t
funcId
,
uint64_t
classification
)
{
static
bool
isSpecificClassifyFunc
(
int32_t
funcId
,
uint64_t
classification
)
{
if
(
fmIsUserDefinedFunc
(
funcId
))
{
return
getUdfType
(
funcId
);
}
if
(
funcId
<
0
||
funcId
>=
funcMgtBuiltinsNum
)
{
if
(
funcId
<
0
||
funcId
>=
funcMgtBuiltinsNum
)
{
return
false
;
return
false
;
}
}
return
FUNC_MGT_TEST_MASK
(
funcMgtBuiltins
[
funcId
].
classification
,
classification
);
return
FUNC_MGT_TEST_MASK
(
funcMgtBuiltins
[
funcId
].
classification
,
classification
);
}
}
static
int32_t
getUdfId
(
const
char
*
pFuncName
)
{
static
int32_t
getUdfId
(
SFmGetFuncInfoParam
*
pParam
,
const
char
*
pFuncName
)
{
// todo: udf by call catalog
SFuncInfo
*
pInfo
=
NULL
;
if
(
1
)
{
int32_t
code
=
catalogGetUdfInfo
(
pParam
->
pCtg
,
pParam
->
pRpc
,
pParam
->
pMgmtEps
,
pFuncName
,
&
pInfo
);
if
(
TSDB_CODE_SUCCESS
!=
code
||
NULL
==
pInfo
)
{
return
-
1
;
return
-
1
;
}
}
if
(
NULL
==
gFunMgtService
.
pUdfTable
)
{
if
(
NULL
==
gFunMgtService
.
pUdfTable
)
{
gFunMgtService
.
pUdfTable
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
sizeof
(
SUdfInfo
));
gFunMgtService
.
pUdfTable
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
sizeof
(
SUdfInfo
));
}
}
SUdfInfo
info
=
{
0
};
//todo
SUdfInfo
info
=
{
.
outputDt
.
type
=
pInfo
->
outputType
,
.
outputDt
.
bytes
=
pInfo
->
outputLen
,
.
funcType
=
pInfo
->
funcType
};
taosArrayPush
(
gFunMgtService
.
pUdfTable
,
&
info
);
taosArrayPush
(
gFunMgtService
.
pUdfTable
,
&
info
);
tFreeSFuncInfo
(
pInfo
);
taosMemoryFree
(
pInfo
);
return
taosArrayGetSize
(
gFunMgtService
.
pUdfTable
)
+
FUNC_UDF_ID_START_OFFSET_VAL
;
return
taosArrayGetSize
(
gFunMgtService
.
pUdfTable
)
+
FUNC_UDF_ID_START_OFFSET_VAL
;
}
}
static
int32_t
getFuncId
(
const
char
*
pFuncName
)
{
static
int32_t
getFuncId
(
SFmGetFuncInfoParam
*
pParam
,
const
char
*
pFuncName
)
{
void
*
pVal
=
taosHashGet
(
gFunMgtService
.
pFuncNameHashTable
,
pFuncName
,
strlen
(
pFuncName
));
void
*
pVal
=
taosHashGet
(
gFunMgtService
.
pFuncNameHashTable
,
pFuncName
,
strlen
(
pFuncName
));
if
(
NULL
==
pVal
)
{
if
(
NULL
==
pVal
)
{
return
getUdfId
(
pFuncName
);
return
getUdfId
(
p
Param
,
p
FuncName
);
}
}
return
*
(
int32_t
*
)
pVal
;
return
*
(
int32_t
*
)
pVal
;
}
}
...
@@ -91,8 +103,8 @@ int32_t fmFuncMgtInit() {
...
@@ -91,8 +103,8 @@ int32_t fmFuncMgtInit() {
return
initFunctionCode
;
return
initFunctionCode
;
}
}
int32_t
fmGetFuncInfo
(
const
char
*
pFuncName
,
int32_t
*
pFuncId
,
int32_t
*
pFuncType
)
{
int32_t
fmGetFuncInfo
(
SFmGetFuncInfoParam
*
pParam
,
const
char
*
pFuncName
,
int32_t
*
pFuncId
,
int32_t
*
pFuncType
)
{
*
pFuncId
=
getFuncId
(
pFuncName
);
*
pFuncId
=
getFuncId
(
p
Param
,
p
FuncName
);
if
(
*
pFuncId
<
0
)
{
if
(
*
pFuncId
<
0
)
{
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
...
source/libs/parser/inc/sql.y
浏览文件 @
055e0516
...
@@ -837,6 +837,8 @@ query_expression(A) ::=
...
@@ -837,6 +837,8 @@ query_expression(A) ::=
query_expression_body(A) ::= query_primary(B). { A = B; }
query_expression_body(A) ::= query_primary(B). { A = B; }
query_expression_body(A) ::=
query_expression_body(A) ::=
query_expression_body(B) UNION ALL query_expression_body(D). { A = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, B, D); }
query_expression_body(B) UNION ALL query_expression_body(D). { A = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, B, D); }
query_expression_body(A) ::=
query_expression_body(B) UNION query_expression_body(D). { A = createSetOperator(pCxt, SET_OP_TYPE_UNION, B, D); }
query_primary(A) ::= query_specification(B). { A = B; }
query_primary(A) ::= query_specification(B). { A = B; }
//query_primary(A) ::=
//query_primary(A) ::=
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
055e0516
...
@@ -230,6 +230,21 @@ static int32_t initTranslateContext(SParseContext* pParseCxt, STranslateContext*
...
@@ -230,6 +230,21 @@ static int32_t initTranslateContext(SParseContext* pParseCxt, STranslateContext*
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
resetTranslateNamespace
(
STranslateContext
*
pCxt
)
{
if
(
NULL
!=
pCxt
->
pNsLevel
)
{
size_t
size
=
taosArrayGetSize
(
pCxt
->
pNsLevel
);
for
(
size_t
i
=
0
;
i
<
size
;
++
i
)
{
taosArrayDestroy
(
taosArrayGetP
(
pCxt
->
pNsLevel
,
i
));
}
taosArrayDestroy
(
pCxt
->
pNsLevel
);
}
pCxt
->
pNsLevel
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
POINTER_BYTES
);
if
(
NULL
==
pCxt
->
pNsLevel
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
return
TSDB_CODE_SUCCESS
;
}
static
void
destroyTranslateContext
(
STranslateContext
*
pCxt
)
{
static
void
destroyTranslateContext
(
STranslateContext
*
pCxt
)
{
if
(
NULL
!=
pCxt
->
pNsLevel
)
{
if
(
NULL
!=
pCxt
->
pNsLevel
)
{
size_t
size
=
taosArrayGetSize
(
pCxt
->
pNsLevel
);
size_t
size
=
taosArrayGetSize
(
pCxt
->
pNsLevel
);
...
@@ -261,9 +276,11 @@ static bool belongTable(const char* currentDb, const SColumnNode* pCol, const ST
...
@@ -261,9 +276,11 @@ static bool belongTable(const char* currentDb, const SColumnNode* pCol, const ST
return
(
0
==
cmp
);
return
(
0
==
cmp
);
}
}
static
SNodeList
*
getProjectList
(
SNode
*
pNode
)
{
static
SNodeList
*
getProjectList
(
const
SNode
*
pNode
)
{
if
(
QUERY_NODE_SELECT_STMT
==
nodeType
(
pNode
))
{
if
(
QUERY_NODE_SELECT_STMT
==
nodeType
(
pNode
))
{
return
((
SSelectStmt
*
)
pNode
)
->
pProjectionList
;
return
((
SSelectStmt
*
)
pNode
)
->
pProjectionList
;
}
else
if
(
QUERY_NODE_SET_OPERATOR
==
nodeType
(
pNode
))
{
return
((
SSetOperator
*
)
pNode
)
->
pProjectionList
;
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -568,7 +585,8 @@ static EDealRes haveAggFunction(SNode* pNode, void* pContext) {
...
@@ -568,7 +585,8 @@ static EDealRes haveAggFunction(SNode* pNode, void* pContext) {
}
}
static
EDealRes
translateFunction
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
static
EDealRes
translateFunction
(
STranslateContext
*
pCxt
,
SFunctionNode
*
pFunc
)
{
if
(
TSDB_CODE_SUCCESS
!=
fmGetFuncInfo
(
pFunc
->
functionName
,
&
pFunc
->
funcId
,
&
pFunc
->
funcType
))
{
SFmGetFuncInfoParam
param
=
{
.
pCtg
=
pCxt
->
pParseCxt
->
pCatalog
,
.
pRpc
=
pCxt
->
pParseCxt
->
pTransporter
,
.
pMgmtEps
=
&
pCxt
->
pParseCxt
->
mgmtEpSet
};
if
(
TSDB_CODE_SUCCESS
!=
fmGetFuncInfo
(
&
param
,
pFunc
->
functionName
,
&
pFunc
->
funcId
,
&
pFunc
->
funcType
))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_FUNTION
,
pFunc
->
functionName
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_FUNTION
,
pFunc
->
functionName
);
}
}
pCxt
->
errCode
=
fmGetFuncResultType
(
pFunc
,
pCxt
->
msgBuf
.
buf
,
pCxt
->
msgBuf
.
len
);
pCxt
->
errCode
=
fmGetFuncResultType
(
pFunc
,
pCxt
->
msgBuf
.
buf
,
pCxt
->
msgBuf
.
len
);
...
@@ -1353,13 +1371,77 @@ static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) {
...
@@ -1353,13 +1371,77 @@ static int32_t translateSelect(STranslateContext* pCxt, SSelectStmt* pSelect) {
return
code
;
return
code
;
}
}
static
SNode
*
createSetOperProject
(
SNode
*
pNode
)
{
SColumnNode
*
pCol
=
nodesMakeNode
(
QUERY_NODE_COLUMN
);
if
(
NULL
==
pCol
)
{
return
NULL
;
}
pCol
->
node
.
resType
=
((
SExprNode
*
)
pNode
)
->
resType
;
strcpy
(
pCol
->
colName
,
((
SExprNode
*
)
pNode
)
->
aliasName
);
strcpy
(
pCol
->
node
.
aliasName
,
pCol
->
colName
);
return
(
SNode
*
)
pCol
;
}
static
bool
dataTypeEqual
(
const
SDataType
*
l
,
const
SDataType
*
r
)
{
return
(
l
->
type
==
r
->
type
&&
l
->
bytes
==
l
->
bytes
&&
l
->
precision
==
r
->
precision
&&
l
->
scale
==
l
->
scale
);
}
static
int32_t
createCastFunc
(
STranslateContext
*
pCxt
,
SNode
*
pExpr
,
SDataType
dt
,
SNode
**
pCast
)
{
SFunctionNode
*
pFunc
=
nodesMakeNode
(
QUERY_NODE_FUNCTION
);
if
(
NULL
==
pFunc
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
strcpy
(
pFunc
->
functionName
,
"cast"
);
pFunc
->
node
.
resType
=
dt
;
if
(
TSDB_CODE_SUCCESS
!=
nodesListMakeAppend
(
&
pFunc
->
pParameterList
,
pExpr
))
{
nodesDestroyNode
(
pFunc
);
return
TSDB_CODE_OUT_OF_MEMORY
;
}
if
(
DEAL_RES_ERROR
==
translateFunction
(
pCxt
,
pFunc
))
{
nodesClearList
(
pFunc
->
pParameterList
);
pFunc
->
pParameterList
=
NULL
;
nodesDestroyNode
(
pFunc
);
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
((
SExprNode
*
)
pExpr
)
->
aliasName
);
}
*
pCast
=
(
SNode
*
)
pFunc
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
translateSetOperatorImpl
(
STranslateContext
*
pCxt
,
SSetOperator
*
pSetOperator
)
{
static
int32_t
translateSetOperatorImpl
(
STranslateContext
*
pCxt
,
SSetOperator
*
pSetOperator
)
{
// todo
SNodeList
*
pLeftProjections
=
getProjectList
(
pSetOperator
->
pLeft
);
SNodeList
*
pRightProjections
=
getProjectList
(
pSetOperator
->
pRight
);
if
(
LIST_LENGTH
(
pLeftProjections
)
!=
LIST_LENGTH
(
pRightProjections
))
{
return
generateSyntaxErrMsg
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_INCORRECT_NUM_OF_COL
);
}
SNode
*
pLeft
=
NULL
;
SNode
*
pRight
=
NULL
;
FORBOTH
(
pLeft
,
pLeftProjections
,
pRight
,
pRightProjections
)
{
SExprNode
*
pLeftExpr
=
(
SExprNode
*
)
pLeft
;
SExprNode
*
pRightExpr
=
(
SExprNode
*
)
pRight
;
if
(
!
dataTypeEqual
(
&
pLeftExpr
->
resType
,
&
pRightExpr
->
resType
))
{
SNode
*
pRightFunc
=
NULL
;
int32_t
code
=
createCastFunc
(
pCxt
,
pRight
,
pLeftExpr
->
resType
,
&
pRightFunc
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
return
code
;
}
REPLACE_LIST2_NODE
(
pRightFunc
);
pRightExpr
=
(
SExprNode
*
)
pRightFunc
;
}
strcpy
(
pRightExpr
->
aliasName
,
pLeftExpr
->
aliasName
);
pRightExpr
->
aliasName
[
strlen
(
pLeftExpr
->
aliasName
)]
=
'\0'
;
if
(
TSDB_CODE_SUCCESS
!=
nodesListMakeStrictAppend
(
&
pSetOperator
->
pProjectionList
,
createSetOperProject
(
pLeft
)))
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
translateSetOperator
(
STranslateContext
*
pCxt
,
SSetOperator
*
pSetOperator
)
{
static
int32_t
translateSetOperator
(
STranslateContext
*
pCxt
,
SSetOperator
*
pSetOperator
)
{
int32_t
code
=
translateQuery
(
pCxt
,
pSetOperator
->
pLeft
);
int32_t
code
=
translateQuery
(
pCxt
,
pSetOperator
->
pLeft
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
resetTranslateNamespace
(
pCxt
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
translateQuery
(
pCxt
,
pSetOperator
->
pRight
);
code
=
translateQuery
(
pCxt
,
pSetOperator
->
pRight
);
}
}
...
@@ -1837,7 +1919,8 @@ static int32_t checkTableRollupOption(STranslateContext* pCxt, SNodeList* pFuncs
...
@@ -1837,7 +1919,8 @@ static int32_t checkTableRollupOption(STranslateContext* pCxt, SNodeList* pFuncs
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_ROLLUP_OPTION
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_ROLLUP_OPTION
);
}
}
SFunctionNode
*
pFunc
=
nodesListGetNode
(
pFuncs
,
0
);
SFunctionNode
*
pFunc
=
nodesListGetNode
(
pFuncs
,
0
);
if
(
TSDB_CODE_SUCCESS
!=
fmGetFuncInfo
(
pFunc
->
functionName
,
&
pFunc
->
funcId
,
&
pFunc
->
funcType
))
{
SFmGetFuncInfoParam
param
=
{
.
pCtg
=
pCxt
->
pParseCxt
->
pCatalog
,
.
pRpc
=
pCxt
->
pParseCxt
->
pTransporter
,
.
pMgmtEps
=
&
pCxt
->
pParseCxt
->
mgmtEpSet
};
if
(
TSDB_CODE_SUCCESS
!=
fmGetFuncInfo
(
&
param
,
pFunc
->
functionName
,
&
pFunc
->
funcId
,
&
pFunc
->
funcType
))
{
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_FUNTION
,
pFunc
->
functionName
);
return
generateDealNodeErrMsg
(
pCxt
,
TSDB_CODE_PAR_INVALID_FUNTION
,
pFunc
->
functionName
);
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -2794,8 +2877,8 @@ static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode) {
...
@@ -2794,8 +2877,8 @@ static int32_t translateSubquery(STranslateContext* pCxt, SNode* pNode) {
return
code
;
return
code
;
}
}
static
int32_t
extract
SelectResultSchema
(
const
SSelectStmt
*
pSelect
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
static
int32_t
extract
QueryResultSchema
(
const
SNodeList
*
pProjections
,
int32_t
*
numOfCols
,
SSchema
**
pSchema
)
{
*
numOfCols
=
LIST_LENGTH
(
p
Select
->
pProjectionList
);
*
numOfCols
=
LIST_LENGTH
(
p
Projections
);
*
pSchema
=
taosMemoryCalloc
((
*
numOfCols
),
sizeof
(
SSchema
));
*
pSchema
=
taosMemoryCalloc
((
*
numOfCols
),
sizeof
(
SSchema
));
if
(
NULL
==
(
*
pSchema
))
{
if
(
NULL
==
(
*
pSchema
))
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -2803,7 +2886,7 @@ static int32_t extractSelectResultSchema(const SSelectStmt* pSelect, int32_t* nu
...
@@ -2803,7 +2886,7 @@ static int32_t extractSelectResultSchema(const SSelectStmt* pSelect, int32_t* nu
SNode
*
pNode
;
SNode
*
pNode
;
int32_t
index
=
0
;
int32_t
index
=
0
;
FOREACH
(
pNode
,
p
Select
->
pProjectionList
)
{
FOREACH
(
pNode
,
p
Projections
)
{
SExprNode
*
pExpr
=
(
SExprNode
*
)
pNode
;
SExprNode
*
pExpr
=
(
SExprNode
*
)
pNode
;
(
*
pSchema
)[
index
].
type
=
pExpr
->
resType
.
type
;
(
*
pSchema
)[
index
].
type
=
pExpr
->
resType
.
type
;
(
*
pSchema
)[
index
].
bytes
=
pExpr
->
resType
.
bytes
;
(
*
pSchema
)[
index
].
bytes
=
pExpr
->
resType
.
bytes
;
...
@@ -2862,7 +2945,8 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS
...
@@ -2862,7 +2945,8 @@ int32_t extractResultSchema(const SNode* pRoot, int32_t* numOfCols, SSchema** pS
switch
(
nodeType
(
pRoot
))
{
switch
(
nodeType
(
pRoot
))
{
case
QUERY_NODE_SELECT_STMT
:
case
QUERY_NODE_SELECT_STMT
:
return
extractSelectResultSchema
((
SSelectStmt
*
)
pRoot
,
numOfCols
,
pSchema
);
case
QUERY_NODE_SET_OPERATOR
:
return
extractQueryResultSchema
(
getProjectList
(
pRoot
),
numOfCols
,
pSchema
);
case
QUERY_NODE_EXPLAIN_STMT
:
case
QUERY_NODE_EXPLAIN_STMT
:
return
extractExplainResultSchema
(
numOfCols
,
pSchema
);
return
extractExplainResultSchema
(
numOfCols
,
pSchema
);
case
QUERY_NODE_DESCRIBE_STMT
:
case
QUERY_NODE_DESCRIBE_STMT
:
...
@@ -3487,6 +3571,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
...
@@ -3487,6 +3571,7 @@ static int32_t rewriteQuery(STranslateContext* pCxt, SQuery* pQuery) {
static
int32_t
setQuery
(
STranslateContext
*
pCxt
,
SQuery
*
pQuery
)
{
static
int32_t
setQuery
(
STranslateContext
*
pCxt
,
SQuery
*
pQuery
)
{
switch
(
nodeType
(
pQuery
->
pRoot
))
{
switch
(
nodeType
(
pQuery
->
pRoot
))
{
case
QUERY_NODE_SELECT_STMT
:
case
QUERY_NODE_SELECT_STMT
:
case
QUERY_NODE_SET_OPERATOR
:
case
QUERY_NODE_EXPLAIN_STMT
:
case
QUERY_NODE_EXPLAIN_STMT
:
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
pQuery
->
execMode
=
QUERY_EXEC_MODE_SCHEDULE
;
pQuery
->
haveResultSet
=
true
;
pQuery
->
haveResultSet
=
true
;
...
...
source/libs/parser/src/parUtil.c
浏览文件 @
055e0516
...
@@ -118,6 +118,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
...
@@ -118,6 +118,8 @@ static char* getSyntaxErrFormat(int32_t errCode) {
return
"sliding value can not less than 1% of interval value"
;
return
"sliding value can not less than 1% of interval value"
;
case
TSDB_CODE_PAR_ONLY_ONE_JSON_TAG
:
case
TSDB_CODE_PAR_ONLY_ONE_JSON_TAG
:
return
"Only one tag if there is a json tag"
;
return
"Only one tag if there is a json tag"
;
case
TSDB_CODE_PAR_INCORRECT_NUM_OF_COL
:
return
"Query block has incorrect number of result columns"
;
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/src/sql.c
浏览文件 @
055e0516
...
@@ -133,16 +133,16 @@ typedef union {
...
@@ -133,16 +133,16 @@ typedef union {
#define ParseCTX_FETCH
#define ParseCTX_FETCH
#define ParseCTX_STORE
#define ParseCTX_STORE
#define YYNSTATE 572
#define YYNSTATE 572
#define YYNRULE 43
6
#define YYNRULE 43
7
#define YYNTOKEN 222
#define YYNTOKEN 222
#define YY_MAX_SHIFT 571
#define YY_MAX_SHIFT 571
#define YY_MIN_SHIFTREDUCE 8
49
#define YY_MIN_SHIFTREDUCE 8
50
#define YY_MAX_SHIFTREDUCE 128
4
#define YY_MAX_SHIFTREDUCE 128
6
#define YY_ERROR_ACTION 128
5
#define YY_ERROR_ACTION 128
7
#define YY_ACCEPT_ACTION 128
6
#define YY_ACCEPT_ACTION 128
8
#define YY_NO_ACTION 128
7
#define YY_NO_ACTION 128
9
#define YY_MIN_REDUCE 12
88
#define YY_MIN_REDUCE 12
90
#define YY_MAX_REDUCE 172
3
#define YY_MAX_REDUCE 172
6
/************* End control #defines *******************************************/
/************* End control #defines *******************************************/
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
...
@@ -211,368 +211,368 @@ typedef union {
...
@@ -211,368 +211,368 @@ typedef union {
*********** Begin parsing tables **********************************************/
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (1960)
#define YY_ACTTAB_COUNT (1960)
static
const
YYACTIONTYPE
yy_action
[]
=
{
static
const
YYACTIONTYPE
yy_action
[]
=
{
/* 0 */
2
69
,
1591
,
286
,
472
,
1575
,
485
,
281
,
324
,
469
,
1503
,
/* 0 */
2
70
,
1593
,
287
,
472
,
1577
,
485
,
282
,
325
,
469
,
1505
,
/* 10 */
128
6
,
1399
,
33
,
31
,
77
,
1575
,
123
,
1561
,
1300
,
1561
,
/* 10 */
128
8
,
1401
,
33
,
31
,
78
,
1577
,
124
,
1563
,
1302
,
1563
,
/* 20 */
27
8
,
382
,
1105
,
34
,
32
,
30
,
29
,
28
,
1591
,
1561
,
/* 20 */
27
9
,
383
,
1106
,
34
,
32
,
30
,
29
,
28
,
1593
,
1563
,
/* 30 */
141
0
,
1557
,
1563
,
1557
,
1563
,
469
,
124
,
249
,
1103
,
1591
,
/* 30 */
141
2
,
1559
,
1565
,
1559
,
1565
,
469
,
125
,
250
,
1104
,
1593
,
/* 40 */
136
7
,
53
,
437
,
1557
,
1564
,
468
,
469
,
1387
,
444
,
1547
,
/* 40 */
136
9
,
1705
,
438
,
1559
,
1566
,
468
,
469
,
1389
,
445
,
1549
,
/* 50 */
12
,
33
,
31
,
122
7
,
99
,
53
,
468
,
1111
,
484
,
278
,
/* 50 */
12
,
33
,
31
,
122
8
,
1704
,
54
,
468
,
1112
,
1702
,
279
,
/* 60 */
154
7
,
1105
,
1405
,
294
,
318
,
448
,
1575
,
242
,
1576
,
471
,
/* 60 */
154
9
,
1106
,
484
,
295
,
319
,
449
,
1577
,
243
,
1578
,
471
,
/* 70 */
15
78
,
1579
,
467
,
104
,
462
,
1
,
1406
,
1103
,
72
,
1576
,
/* 70 */
15
80
,
1581
,
467
,
105
,
462
,
1
,
1408
,
1104
,
73
,
1578
,
/* 80 */
471
,
15
78
,
1579
,
467
,
361
,
462
,
484
,
289
,
1641
,
12
,
/* 80 */
471
,
15
80
,
1581
,
467
,
525
,
462
,
1384
,
290
,
1643
,
12
,
/* 90 */
159
1
,
484
,
250
,
1637
,
1494
,
1496
,
1111
,
447
,
568
,
26
,
/* 90 */
159
3
,
484
,
251
,
1639
,
1496
,
1498
,
1112
,
448
,
568
,
26
,
/* 100 */
20
4
,
452
,
1702
,
1702
,
1702
,
440
,
420
,
468
,
106
,
102
,
/* 100 */
20
5
,
362
,
1705
,
1705
,
1705
,
441
,
421
,
468
,
107
,
103
,
/* 110 */
110
4
,
1547
,
516
,
485
,
1
,
136
,
136
,
136
,
1327
,
1700
,
/* 110 */
110
5
,
1549
,
516
,
485
,
1
,
137
,
137
,
137
,
1129
,
1702
,
/* 120 */
170
0
,
1700
,
322
,
446
,
132
,
1648
,
1649
,
444
,
1653
,
73
,
/* 120 */
170
2
,
1702
,
323
,
447
,
133
,
1650
,
1651
,
445
,
1655
,
74
,
/* 130 */
157
6
,
471
,
1578
,
1579
,
467
,
519
,
462
,
568
,
1410
,
1641
,
/* 130 */
157
8
,
471
,
1580
,
1581
,
467
,
519
,
462
,
568
,
1412
,
1643
,
/* 140 */
399
,
36
,
485
,
271
,
1637
,
131
,
36
,
69
,
1106
,
1104
,
/* 140 */
54
,
144
,
485
,
272
,
1639
,
132
,
36
,
940
,
1107
,
1105
,
/* 150 */
42
1
,
323
,
104
,
1126
,
515
,
514
,
513
,
200
,
512
,
1491
,
/* 150 */
42
2
,
324
,
105
,
100
,
515
,
514
,
513
,
201
,
512
,
1127
,
/* 160 */
127
,
105
,
1128
,
427
,
1668
,
434
,
145
,
1410
,
1402
,
1109
,
/* 160 */
439
,
1407
,
1130
,
428
,
1670
,
435
,
942
,
1412
,
52
,
1110
,
/* 170 */
111
0
,
1451
,
1154
,
1155
,
1156
,
1157
,
1158
,
1159
,
1160
,
464
,
/* 170 */
111
1
,
51
,
1155
,
1156
,
1157
,
1158
,
1159
,
1160
,
1161
,
464
,
/* 180 */
116
5
,
1166
,
1167
,
1168
,
1169
,
1170
,
1171
,
1106
,
102
,
1702
,
/* 180 */
116
6
,
1167
,
1168
,
1169
,
1170
,
1171
,
1172
,
1107
,
103
,
1705
,
/* 190 */
14
59
,
34
,
32
,
30
,
29
,
28
,
268
,
9
,
8
,
137
,
/* 190 */
14
61
,
34
,
32
,
30
,
29
,
28
,
269
,
9
,
8
,
138
,
/* 200 */
6
8
,
1457
,
136
,
133
,
1648
,
1649
,
1700
,
1653
,
1109
,
1110
,
/* 200 */
6
9
,
1459
,
137
,
134
,
1650
,
1651
,
1702
,
1655
,
1110
,
1111
,
/* 210 */
6
4
,
1154
,
1155
,
1156
,
1157
,
1158
,
1159
,
1160
,
464
,
1165
,
/* 210 */
6
5
,
1155
,
1156
,
1157
,
1158
,
1159
,
1160
,
1161
,
464
,
1166
,
/* 220 */
116
6
,
1167
,
1168
,
1169
,
1170
,
1171
,
33
,
31
,
438
,
251
,
/* 220 */
116
7
,
1168
,
1169
,
1170
,
1171
,
1172
,
33
,
31
,
138
,
252
,
/* 230 */
22
6
,
439
,
435
,
1440
,
278
,
248
,
1105
,
1126
,
1575
,
398
,
/* 230 */
22
7
,
440
,
436
,
1442
,
279
,
249
,
1106
,
1127
,
1577
,
399
,
/* 240 */
886
,
392
,
885
,
1459
,
340
,
397
,
453
,
352
,
101
,
283
,
/* 240 */
63
,
393
,
521
,
1461
,
341
,
398
,
70
,
353
,
102
,
284
,
/* 250 */
39
3
,
391
,
1103
,
394
,
1457
,
1141
,
353
,
317
,
390
,
316
,
/* 250 */
39
4
,
392
,
1104
,
395
,
1459
,
1142
,
354
,
318
,
391
,
317
,
/* 260 */
887
,
137
,
1591
,
1189
,
12
,
33
,
31
,
387
,
386
,
469
,
/* 260 */
106
,
1405
,
1593
,
1190
,
12
,
33
,
31
,
1404
,
1227
,
469
,
/* 270 */
13
7
,
1111
,
1203
,
278
,
22
,
1105
,
1655
,
55
,
267
,
468
,
/* 270 */
13
8
,
1112
,
1204
,
279
,
22
,
1106
,
1657
,
56
,
268
,
468
,
/* 280 */
125
1
,
174
,
24
,
1547
,
34
,
32
,
30
,
29
,
28
,
1
,
/* 280 */
125
2
,
175
,
24
,
1549
,
34
,
32
,
30
,
29
,
28
,
1
,
/* 290 */
165
5
,
1103
,
34
,
32
,
30
,
29
,
28
,
30
,
29
,
28
,
/* 290 */
165
7
,
1104
,
34
,
32
,
30
,
29
,
28
,
30
,
29
,
28
,
/* 300 */
165
2
,
73
,
1576
,
471
,
1578
,
1579
,
467
,
1401
,
462
,
137
,
/* 300 */
165
4
,
74
,
1578
,
471
,
1580
,
1581
,
467
,
128
,
462
,
138
,
/* 310 */
111
1
,
1641
,
568
,
1190
,
1651
,
271
,
1637
,
1714
,
1129
,
431
,
/* 310 */
111
2
,
1643
,
568
,
1191
,
1653
,
272
,
1639
,
1717
,
1453
,
432
,
/* 320 */
12
49
,
1250
,
1252
,
1253
,
1104
,
412
,
1675
,
1388
,
7
,
1288
,
/* 320 */
12
50
,
1251
,
1253
,
1254
,
1105
,
413
,
1677
,
1390
,
7
,
1290
,
/* 330 */
35
1
,
1195
,
137
,
346
,
345
,
344
,
343
,
342
,
1130
,
339
,
/* 330 */
35
2
,
1196
,
1128
,
347
,
346
,
345
,
344
,
343
,
138
,
340
,
/* 340 */
33
8
,
337
,
336
,
335
,
331
,
330
,
329
,
328
,
327
,
326
,
/* 340 */
33
9
,
338
,
337
,
336
,
332
,
331
,
330
,
329
,
328
,
327
,
/* 350 */
32
5
,
568
,
1547
,
97
,
96
,
95
,
94
,
93
,
92
,
91
,
/* 350 */
32
6
,
568
,
59
,
98
,
97
,
96
,
95
,
94
,
93
,
92
,
/* 360 */
9
0
,
89
,
1106
,
1104
,
1702
,
1702
,
25
,
276
,
1184
,
1185
,
/* 360 */
9
1
,
90
,
1107
,
1105
,
1705
,
1705
,
25
,
277
,
1185
,
1186
,
/* 370 */
118
6
,
1187
,
1188
,
1192
,
1193
,
1194
,
361
,
136
,
1701
,
1311
,
/* 370 */
118
7
,
1188
,
1189
,
1193
,
1194
,
1195
,
362
,
137
,
1703
,
1403
,
/* 380 */
521
,
1700
,
1700
,
1109
,
1110
,
939
,
1154
,
1155
,
1156
,
1157
,
/* 380 */
1131
,
1702
,
1702
,
1110
,
1111
,
6
,
1155
,
1156
,
1157
,
1158
,
/* 390 */
115
8
,
1159
,
1160
,
464
,
1165
,
1166
,
1167
,
1168
,
1169
,
1170
,
/* 390 */
115
9
,
1160
,
1161
,
464
,
1166
,
1167
,
1168
,
1169
,
1170
,
1171
,
/* 400 */
117
1
,
1106
,
564
,
563
,
941
,
34
,
32
,
30
,
29
,
28
,
/* 400 */
117
2
,
1107
,
524
,
484
,
452
,
34
,
32
,
30
,
29
,
28
,
/* 410 */
8
8
,
396
,
395
,
87
,
86
,
85
,
84
,
83
,
82
,
81
,
/* 410 */
8
9
,
564
,
563
,
88
,
87
,
86
,
85
,
84
,
83
,
82
,
/* 420 */
8
0
,
79
,
1109
,
1110
,
1547
,
1154
,
1155
,
1156
,
1157
,
1158
,
/* 420 */
8
1
,
80
,
1110
,
1111
,
1549
,
1155
,
1156
,
1157
,
1158
,
1159
,
/* 430 */
11
59
,
1160
,
464
,
1165
,
1166
,
1167
,
1168
,
1169
,
1170
,
1171
,
/* 430 */
11
60
,
1161
,
464
,
1166
,
1167
,
1168
,
1169
,
1170
,
1171
,
1172
,
/* 440 */
33
,
31
,
117
2
,
251
,
1289
,
309
,
1310
,
282
,
278
,
1127
,
/* 440 */
33
,
31
,
117
3
,
252
,
1291
,
536
,
1313
,
283
,
279
,
313
,
/* 450 */
110
5
,
288
,
137
,
485
,
472
,
121
,
261
,
100
,
199
,
121
,
/* 450 */
110
6
,
289
,
138
,
485
,
472
,
122
,
262
,
101
,
36
,
122
,
/* 460 */
150
4
,
385
,
332
,
1412
,
311
,
88
,
1103
,
1412
,
87
,
86
,
/* 460 */
150
6
,
386
,
333
,
1414
,
1226
,
89
,
1104
,
1414
,
88
,
87
,
/* 470 */
8
5
,
84
,
83
,
82
,
81
,
80
,
79
,
1189
,
1410
,
33
,
/* 470 */
8
6
,
85
,
84
,
83
,
82
,
81
,
80
,
1190
,
1412
,
33
,
/* 480 */
31
,
143
,
100
,
1385
,
388
,
1111
,
385
,
278
,
1309
,
1105
,
/* 480 */
31
,
48
,
101
,
1387
,
389
,
1112
,
386
,
279
,
1312
,
1106
,
/* 490 */
157
5
,
1547
,
34
,
32
,
30
,
29
,
28
,
485
,
485
,
262
,
/* 490 */
157
7
,
1549
,
34
,
32
,
30
,
29
,
28
,
485
,
485
,
263
,
/* 500 */
1386
,
260
,
259
,
7
,
384
,
1103
,
77
,
333
,
51
,
388
,
/* 500 */
200
,
261
,
260
,
7
,
385
,
1104
,
78
,
334
,
511
,
389
,
/* 510 */
1322
,
50
,
291
,
389
,
1591
,
34
,
32
,
30
,
29
,
28
,
/* 510 */
388
,
387
,
292
,
390
,
1593
,
34
,
32
,
30
,
29
,
28
,
/* 520 */
12
1
,
469
,
1410
,
1410
,
1111
,
485
,
568
,
1190
,
1412
,
1308
,
/* 520 */
12
2
,
469
,
1412
,
1412
,
1112
,
485
,
568
,
1191
,
1414
,
1311
,
/* 530 */
14
59
,
468
,
401
,
1547
,
360
,
1547
,
290
,
485
,
1104
,
121
,
/* 530 */
14
61
,
468
,
1493
,
1549
,
361
,
1549
,
291
,
485
,
1105
,
146
,
/* 540 */
1
459
,
1457
,
7
,
1191
,
106
,
1195
,
1407
,
1413
,
516
,
521
,
/* 540 */
1
223
,
1459
,
7
,
1192
,
107
,
1196
,
1409
,
138
,
516
,
453
,
/* 550 */
141
0
,
1458
,
62
,
73
,
1576
,
471
,
1578
,
1579
,
467
,
51
1
,
/* 550 */
141
2
,
397
,
396
,
74
,
1578
,
471
,
1580
,
1581
,
467
,
146
1
,
/* 560 */
462
,
119
6
,
1410
,
1641
,
1340
,
568
,
524
,
271
,
1637
,
1714
,
/* 560 */
462
,
119
7
,
1412
,
1643
,
1342
,
568
,
1132
,
272
,
1639
,
1717
,
/* 570 */
1
131
,
519
,
347
,
1403
,
1547
,
1655
,
1106
,
1104
,
1698
,
1241
,
/* 570 */
1
460
,
519
,
348
,
1397
,
1549
,
1657
,
1107
,
1105
,
1700
,
1242
,
/* 580 */
25
,
27
6
,
1184
,
1185
,
1186
,
1187
,
1188
,
1192
,
1193
,
1194
,
/* 580 */
25
,
27
7
,
1185
,
1186
,
1187
,
1188
,
1189
,
1193
,
1194
,
1195
,
/* 590 */
515
,
514
,
513
,
157
5
,
512
,
451
,
23
,
1109
,
1110
,
1650
,
/* 590 */
515
,
514
,
513
,
157
7
,
512
,
1538
,
23
,
1110
,
1111
,
1652
,
/* 600 */
115
4
,
1155
,
1156
,
1157
,
1158
,
1159
,
1160
,
464
,
1165
,
1166
,
/* 600 */
115
5
,
1156
,
1157
,
1158
,
1159
,
1160
,
1161
,
464
,
1166
,
1167
,
/* 610 */
116
7
,
1168
,
1169
,
1170
,
1171
,
1106
,
398
,
1591
,
392
,
147
,
/* 610 */
116
8
,
1169
,
1170
,
1171
,
1172
,
1107
,
399
,
1593
,
393
,
148
,
/* 620 */
14
6
,
1281
,
397
,
1307
,
447
,
101
,
1395
,
393
,
391
,
525
,
/* 620 */
14
7
,
1283
,
398
,
1310
,
448
,
102
,
166
,
394
,
392
,
164
,
/* 630 */
39
4
,
1382
,
518
,
517
,
468
,
390
,
1109
,
1110
,
1547
,
1154
,
/* 630 */
39
5
,
302
,
518
,
517
,
468
,
391
,
1110
,
1111
,
1549
,
1155
,
/* 640 */
115
5
,
1156
,
1157
,
1158
,
1159
,
1160
,
464
,
1165
,
1166
,
1167
,
/* 640 */
115
6
,
1157
,
1158
,
1159
,
1160
,
1161
,
464
,
1166
,
1167
,
1168
,
/* 650 */
116
8
,
1169
,
1170
,
1171
,
33
,
31
,
73
,
1576
,
471
,
1578
,
/* 650 */
116
9
,
1170
,
1171
,
1172
,
33
,
31
,
74
,
1578
,
471
,
1580
,
/* 660 */
15
79
,
467
,
278
,
462
,
1105
,
1575
,
1641
,
1397
,
1547
,
485
,
/* 660 */
15
81
,
467
,
279
,
462
,
1106
,
1577
,
1643
,
1388
,
1549
,
485
,
/* 670 */
27
1
,
1637
,
131
,
34
,
32
,
30
,
29
,
28
,
1528
,
485
,
/* 670 */
27
2
,
1639
,
132
,
34
,
32
,
30
,
29
,
28
,
1530
,
485
,
/* 680 */
110
3
,
1306
,
1226
,
485
,
444
,
885
,
537
,
535
,
482
,
1591
,
/* 680 */
110
4
,
1309
,
122
,
485
,
445
,
887
,
186
,
886
,
482
,
1593
,
/* 690 */
185
,
1669
,
292
,
1568
,
1410
,
1393
,
469
,
1495
,
1496
,
1111
,
/* 690 */
1415
,
1671
,
293
,
451
,
1412
,
1399
,
469
,
537
,
535
,
1112
,
/* 700 */
128
0
,
380
,
485
,
6
,
1410
,
1566
,
468
,
177
,
1410
,
104
,
/* 700 */
128
2
,
1235
,
485
,
886
,
1412
,
888
,
468
,
1129
,
1412
,
105
,
/* 710 */
154
7
,
483
,
485
,
1305
,
1304
,
1660
,
1222
,
1
,
1337
,
1234
,
/* 710 */
154
9
,
483
,
485
,
1308
,
1307
,
310
,
521
,
1
,
1339
,
381
,
/* 720 */
130
3
,
218
,
1302
,
1299
,
1298
,
1128
,
1547
,
1410
,
73
,
1576
,
/* 720 */
130
6
,
219
,
1305
,
1304
,
1301
,
1395
,
1549
,
1412
,
74
,
1578
,
/* 730 */
471
,
15
78
,
1579
,
467
,
463
,
462
,
510
,
1410
,
1641
,
1536
,
/* 730 */
471
,
15
80
,
1581
,
467
,
312
,
462
,
168
,
1412
,
1643
,
167
,
/* 740 */
568
,
455
,
27
1
,
1637
,
1714
,
102
,
34
,
32
,
30
,
29
,
/* 740 */
568
,
455
,
27
2
,
1639
,
1717
,
103
,
34
,
32
,
30
,
29
,
/* 750 */
28
,
1
297
,
1104
,
1659
,
1296
,
1295
,
419
,
1294
,
1547
,
1547
,
/* 750 */
28
,
1
300
,
1105
,
1661
,
1299
,
1298
,
178
,
1297
,
1549
,
1549
,
/* 760 */
13
4
,
1648
,
1649
,
1293
,
1653
,
1547
,
1301
,
1547
,
1547
,
1547
,
/* 760 */
13
5
,
1650
,
1651
,
1296
,
1655
,
1549
,
459
,
1549
,
1549
,
1549
,
/* 770 */
544
,
543
,
542
,
541
,
29
3
,
301
,
540
,
539
,
538
,
107
,
/* 770 */
544
,
543
,
542
,
541
,
29
4
,
463
,
540
,
539
,
538
,
108
,
/* 780 */
533
,
532
,
531
,
530
,
529
,
528
,
527
,
526
,
11
4
,
522
,
/* 780 */
533
,
532
,
531
,
530
,
529
,
528
,
527
,
526
,
11
5
,
522
,
/* 790 */
110
6
,
1177
,
165
,
459
,
536
,
163
,
1547
,
1128
,
312
,
1547
,
/* 790 */
110
7
,
1178
,
1497
,
1498
,
1662
,
1223
,
1549
,
1129
,
510
,
1549
,
/* 800 */
154
7
,
120
,
1547
,
1292
,
1091
,
1092
,
1291
,
450
,
1547
,
1368
,
/* 800 */
154
9
,
121
,
1549
,
1295
,
1092
,
1093
,
1294
,
1293
,
1549
,
113
,
/* 810 */
114
1
,
1109
,
1110
,
201
,
1154
,
1155
,
1156
,
1157
,
1158
,
1159
,
/* 810 */
114
2
,
1110
,
1111
,
424
,
1155
,
1156
,
1157
,
1158
,
1159
,
1160
,
/* 820 */
116
0
,
464
,
1165
,
1166
,
1167
,
1168
,
1169
,
1170
,
1171
,
432
,
/* 820 */
116
1
,
464
,
1166
,
1167
,
1168
,
1169
,
1170
,
1171
,
1172
,
1570
,
/* 830 */
97
7
,
508
,
507
,
506
,
981
,
505
,
983
,
984
,
504
,
986
,
/* 830 */
97
8
,
508
,
507
,
506
,
982
,
505
,
984
,
985
,
504
,
987
,
/* 840 */
501
,
1
452
,
992
,
498
,
994
,
995
,
495
,
492
,
1547
,
122
,
/* 840 */
501
,
1
568
,
993
,
498
,
995
,
996
,
495
,
492
,
1549
,
123
,
/* 850 */
157
5
,
1547
,
167
,
169
,
232
,
166
,
168
,
171
,
1222
,
410
,
/* 850 */
157
7
,
1549
,
1549
,
170
,
233
,
1329
,
169
,
172
,
1324
,
411
,
/* 860 */
17
0
,
1320
,
1114
,
1575
,
112
,
47
,
230
,
188
,
423
,
1248
,
/* 860 */
17
1
,
1322
,
1115
,
1577
,
47
,
189
,
231
,
420
,
1249
,
191
,
/* 870 */
1113
,
190
,
408
,
35
,
1591
,
1283
,
1284
,
1197
,
1225
,
148
,
/* 870 */
9
,
8
,
409
,
1114
,
1593
,
1285
,
1286
,
400
,
35
,
149
,
/* 880 */
35
,
469
,
413
,
404
,
1161
,
9
,
8
,
1591
,
456
,
35
,
/* 880 */
402
,
469
,
1198
,
405
,
1303
,
1182
,
35
,
1593
,
456
,
35
,
/* 890 */
379
,
468
,
207
,
1066
,
469
,
1547
,
209
,
109
,
194
,
110
,
/* 890 */
1162
,
468
,
208
,
1067
,
469
,
1549
,
210
,
110
,
1370
,
111
,
/* 900 */
44
8
,
477
,
1671
,
215
,
468
,
112
,
47
,
490
,
1547
,
970
,
/* 900 */
44
9
,
477
,
113
,
216
,
468
,
47
,
971
,
202
,
1549
,
966
,
/* 910 */
965
,
998
,
1181
,
239
,
1576
,
471
,
1578
,
1579
,
467
,
11
0
,
/* 910 */
433
,
1454
,
414
,
240
,
1578
,
471
,
1580
,
1581
,
467
,
49
0
,
/* 920 */
462
,
111
,
445
,
1002
,
1592
,
1009
,
74
,
1576
,
471
,
1578
,
/* 920 */
462
,
111
,
195
,
999
,
380
,
1003
,
75
,
1578
,
471
,
1580
,
/* 930 */
15
79
,
467
,
203
,
462
,
1117
,
911
,
1641
,
2
,
1126
,
1702
,
/* 930 */
15
81
,
467
,
446
,
462
,
1118
,
1673
,
1643
,
1594
,
112
,
1705
,
/* 940 */
164
0
,
1637
,
1116
,
71
,
1575
,
112
,
296
,
300
,
256
,
1008
,
/* 940 */
164
2
,
1639
,
1010
,
72
,
1577
,
1117
,
204
,
912
,
2
,
301
,
/* 950 */
16
0
,
110
,
136
,
130
,
912
,
113
,
1700
,
939
,
258
,
378
,
/* 950 */
16
1
,
113
,
137
,
131
,
111
,
1009
,
1702
,
1127
,
114
,
379
,
/* 960 */
1075
,
374
,
370
,
366
,
159
,
223
,
334
,
1493
,
1591
,
144
,
/* 960 */
297
,
375
,
371
,
367
,
160
,
257
,
913
,
259
,
1593
,
940
,
/* 970 */
341
,
349
,
49
,
48
,
321
,
469
,
142
,
354
,
348
,
350
,
/* 970 */
224
,
335
,
50
,
49
,
322
,
469
,
143
,
1495
,
1076
,
342
,
/* 980 */
1135
,
315
,
355
,
149
,
1134
,
468
,
356
,
152
,
357
,
1547
,
/* 980 */
145
,
316
,
350
,
349
,
351
,
468
,
355
,
1136
,
356
,
1549
,
/* 990 */
1133
,
54
,
359
,
257
,
157
,
307
,
1575
,
303
,
299
,
139
,
/* 990 */
150
,
55
,
357
,
258
,
158
,
308
,
1577
,
304
,
300
,
140
,
/* 1000 */
358
,
155
,
52
,
362
,
1132
,
383
,
381
,
74
,
1576
,
471
,
/* 1000 */
1135
,
358
,
153
,
359
,
1134
,
360
,
156
,
75
,
1578
,
471
,
/* 1010 */
15
78
,
1579
,
467
,
158
,
462
,
1400
,
162
,
1641
,
78
,
571
,
/* 1010 */
15
80
,
1581
,
467
,
53
,
462
,
363
,
159
,
1643
,
1133
,
571
,
/* 1020 */
159
1
,
458
,
1637
,
266
,
1396
,
164
,
1111
,
466
,
1532
,
224
,
/* 1020 */
159
3
,
458
,
1639
,
382
,
384
,
1402
,
79
,
466
,
163
,
267
,
/* 1030 */
13
7
,
115
,
116
,
222
,
1398
,
1394
,
98
,
468
,
117
,
118
,
/* 1030 */
13
8
,
1398
,
1112
,
223
,
165
,
116
,
99
,
468
,
117
,
1400
,
/* 1040 */
175
,
1547
,
560
,
414
,
556
,
552
,
548
,
221
,
178
,
415
,
/* 1040 */
1396
,
1549
,
560
,
118
,
556
,
552
,
548
,
222
,
119
,
176
,
/* 1050 */
418
,
1575
,
156
,
180
,
151
,
422
,
153
,
1131
,
424
,
246
,
/* 1050 */
225
,
1577
,
157
,
415
,
152
,
423
,
154
,
1534
,
179
,
247
,
/* 1060 */
157
6
,
471
,
1578
,
1579
,
467
,
465
,
462
,
460
,
1613
,
183
,
/* 1060 */
157
8
,
471
,
1580
,
1581
,
467
,
465
,
462
,
460
,
1615
,
419
,
/* 1070 */
425
,
433
,
1682
,
150
,
70
,
1591
,
475
,
216
,
1672
,
1681
,
/* 1070 */
181
,
425
,
426
,
151
,
71
,
1593
,
416
,
217
,
1132
,
434
,
/* 1080 */
18
6
,
430
,
469
,
189
,
1662
,
270
,
436
,
429
,
5
,
441
,
/* 1080 */
18
4
,
187
,
469
,
1684
,
475
,
1674
,
431
,
1683
,
5
,
190
,
/* 1090 */
4
,
1222
,
468
,
1130
,
37
,
1717
,
1547
,
103
,
272
,
1656
,
/* 1090 */
442
,
271
,
468
,
437
,
430
,
4
,
1549
,
1223
,
104
,
1131
,
/* 1100 */
157
5
,
457
,
196
,
454
,
16
,
1622
,
473
,
481
,
193
,
478
,
/* 1100 */
157
7
,
273
,
37
,
1720
,
457
,
454
,
197
,
481
,
1658
,
1664
,
/* 1110 */
479
,
1502
,
129
,
474
,
125
,
1576
,
471
,
1578
,
1579
,
467
,
/* 1110 */
16
,
473
,
1624
,
474
,
126
,
1578
,
471
,
1580
,
1581
,
467
,
/* 1120 */
280
,
462
,
195
,
1501
,
1591
,
211
,
480
,
225
,
1699
,
20
2
,
/* 1120 */
194
,
462
,
130
,
1504
,
1593
,
196
,
478
,
1503
,
226
,
21
2
,
/* 1130 */
2
13
,
469
,
61
,
63
,
1411
,
1383
,
426
,
227
,
488
,
181
,
/* 1130 */
2
81
,
469
,
479
,
214
,
480
,
62
,
427
,
1701
,
203
,
182
,
/* 1140 */
220
,
468
,
567
,
43
,
128
,
1547
,
233
,
234
,
229
,
231
,
/* 1140 */
1413
,
468
,
64
,
488
,
221
,
1549
,
1385
,
228
,
567
,
129
,
/* 1150 */
1541
,
1540
,
1575
,
295
,
1083
,
1537
,
176
,
297
,
449
,
1715
,
/* 1150 */
230
,
234
,
1577
,
43
,
1084
,
235
,
177
,
232
,
450
,
1718
,
/* 1160 */
44
4
,
298
,
1099
,
74
,
1576
,
471
,
1578
,
1579
,
467
,
1100
,
/* 1160 */
44
5
,
1543
,
1542
,
75
,
1578
,
471
,
1580
,
1581
,
467
,
296
,
/* 1170 */
462
,
140
,
302
,
1641
,
1535
,
304
,
1591
,
305
,
1638
,
306
,
/* 1170 */
462
,
1539
,
298
,
1643
,
299
,
1100
,
1593
,
1101
,
1640
,
141
,
/* 1180 */
1534
,
308
,
1575
,
469
,
1533
,
104
,
310
,
1518
,
141
,
1078
,
/* 1180 */
303
,
1537
,
1577
,
469
,
305
,
105
,
306
,
307
,
1536
,
309
,
/* 1190 */
1
077
,
313
,
314
,
468
,
1512
,
1511
,
320
,
1547
,
319
,
1510
,
/* 1190 */
1
535
,
1520
,
311
,
468
,
142
,
314
,
315
,
1549
,
1079
,
1078
,
/* 1200 */
42
8
,
1509
,
1486
,
1049
,
448
,
1485
,
1591
,
1484
,
1483
,
1482
,
/* 1200 */
42
9
,
1514
,
1513
,
320
,
449
,
321
,
1593
,
1512
,
1511
,
1050
,
/* 1210 */
148
1
,
1480
,
1479
,
469
,
108
,
247
,
1576
,
471
,
1578
,
1579
,
/* 1210 */
148
8
,
1487
,
1486
,
469
,
109
,
248
,
1578
,
471
,
1580
,
1581
,
/* 1220 */
467
,
10
2
,
462
,
468
,
1478
,
1477
,
1476
,
1547
,
1475
,
1474
,
/* 1220 */
467
,
10
3
,
462
,
468
,
1485
,
1484
,
1483
,
1549
,
1482
,
1481
,
/* 1230 */
14
73
,
1472
,
1471
,
1575
,
1470
,
1469
,
197
,
1648
,
443
,
1468
,
/* 1230 */
14
80
,
1479
,
1478
,
1577
,
1477
,
1476
,
198
,
1650
,
444
,
1475
,
/* 1240 */
44
2
,
1467
,
1466
,
1702
,
1465
,
125
,
1576
,
471
,
1578
,
1579
,
/* 1240 */
44
3
,
1474
,
1473
,
1705
,
1472
,
126
,
1578
,
471
,
1580
,
1581
,
/* 1250 */
467
,
14
64
,
462
,
1463
,
1462
,
1051
,
136
,
1591
,
1461
,
1460
,
/* 1250 */
467
,
14
71
,
462
,
1470
,
1469
,
1468
,
137
,
1593
,
1467
,
1466
,
/* 1260 */
170
0
,
1339
,
1526
,
1575
,
469
,
1520
,
1508
,
1499
,
1389
,
904
,
/* 1260 */
170
2
,
1465
,
1052
,
1577
,
469
,
1464
,
1463
,
1462
,
1341
,
1528
,
/* 1270 */
154
,
1338
,
1336
,
1334
,
468
,
363
,
364
,
1332
,
1547
,
365
,
/* 1270 */
1522
,
1510
,
1501
,
1391
,
468
,
162
,
155
,
1340
,
1549
,
1338
,
/* 1280 */
133
0
,
275
,
368
,
367
,
372
,
371
,
369
,
1591
,
375
,
1319
,
/* 1280 */
133
6
,
276
,
365
,
364
,
369
,
368
,
366
,
1593
,
905
,
1334
,
/* 1290 */
171
6
,
1575
,
373
,
376
,
466
,
377
,
247
,
1576
,
471
,
1578
,
/* 1290 */
171
9
,
1577
,
370
,
374
,
466
,
372
,
248
,
1578
,
471
,
1580
,
/* 1300 */
15
79
,
467
,
1318
,
462
,
468
,
1315
,
1391
,
76
,
1547
,
1014
,
/* 1300 */
15
81
,
467
,
1332
,
462
,
468
,
378
,
1321
,
1320
,
1549
,
1317
,
/* 1310 */
1390
,
1328
,
1017
,
263
,
1323
,
1591
,
938
,
937
,
1321
,
936
,
/* 1310 */
373
,
1393
,
1015
,
1392
,
1018
,
1593
,
376
,
377
,
1330
,
264
,
/* 1320 */
161
,
935
,
469
,
934
,
931
,
264
,
246
,
1576
,
471
,
1578
,
/* 1320 */
77
,
939
,
469
,
938
,
534
,
937
,
247
,
1578
,
471
,
1580
,
/* 1330 */
15
79
,
467
,
468
,
462
,
930
,
1614
,
1547
,
402
,
265
,
277
,
/* 1330 */
15
81
,
467
,
468
,
462
,
936
,
1616
,
1549
,
935
,
932
,
278
,
/* 1340 */
157
5
,
534
,
285
,
284
,
1314
,
405
,
407
,
1313
,
536
,
1105
,
/* 1340 */
157
7
,
931
,
286
,
285
,
1325
,
1323
,
265
,
403
,
266
,
1106
,
/* 1350 */
40
9
,
75
,
1119
,
1525
,
247
,
1576
,
471
,
1578
,
1579
,
467
,
/* 1350 */
40
6
,
1316
,
1120
,
408
,
248
,
1578
,
471
,
1580
,
1581
,
467
,
/* 1360 */
46
,
462
,
1519
,
1085
,
1591
,
1103
,
119
,
416
,
1112
,
1507
,
/* 1360 */
536
,
462
,
1315
,
410
,
1593
,
1104
,
76
,
1527
,
1113
,
1521
,
/* 1370 */
1
506
,
469
,
1498
,
3
,
56
,
182
,
35
,
1566
,
1575
,
13
,
/* 1370 */
1
086
,
469
,
120
,
1509
,
417
,
180
,
1508
,
1500
,
1577
,
57
,
/* 1380 */
41
,
468
,
14
,
38
,
1111
,
1547
,
11
,
1111
,
279
,
1575
,
/* 1380 */
183
,
468
,
3
,
13
,
1112
,
1549
,
35
,
1112
,
280
,
1577
,
/* 1390 */
58
,
187
,
126
,
179
,
191
,
417
,
1247
,
20
,
184
,
198
,
/* 1390 */
14
,
188
,
41
,
1248
,
127
,
38
,
46
,
192
,
185
,
11
,
/* 1400 */
40
,
192
,
1591
,
247
,
1576
,
471
,
1578
,
1579
,
467
,
469
,
/* 1400 */
418
,
1241
,
1593
,
248
,
1578
,
471
,
1580
,
1581
,
467
,
469
,
/* 1410 */
462
,
12
40
,
57
,
1591
,
21
,
1219
,
1218
,
1274
,
39
,
468
,
/* 1410 */
462
,
12
20
,
193
,
1593
,
20
,
1568
,
199
,
58
,
1271
,
468
,
/* 1420 */
469
,
135
,
15
,
1547
,
8
,
568
,
1269
,
1268
,
486
,
273
,
/* 1420 */
469
,
21
,
40
,
1549
,
1219
,
568
,
39
,
15
,
486
,
1276
,
/* 1430 */
468
,
127
3
,
1272
,
274
,
1547
,
17
,
1164
,
1104
,
138
,
1575
,
/* 1430 */
468
,
127
0
,
274
,
1275
,
1549
,
1274
,
275
,
1105
,
8
,
1577
,
/* 1440 */
111
5
,
235
,
1576
,
471
,
1578
,
1579
,
467
,
1163
,
462
,
461
,
/* 1440 */
111
6
,
236
,
1578
,
471
,
1580
,
1581
,
467
,
136
,
462
,
461
,
/* 1450 */
27
,
1182
,
241
,
1576
,
471
,
1578
,
1579
,
467
,
1162
,
462
,
/* 1450 */
17
,
1165
,
242
,
1578
,
471
,
1580
,
1581
,
467
,
1164
,
462
,
/* 1460 */
10
,
1149
,
18
,
1591
,
205
,
470
,
206
,
19
,
1497
,
212
,
/* 1460 */
1183
,
27
,
10
,
1593
,
1163
,
18
,
139
,
1150
,
206
,
470
,
/* 1470 */
469
,
476
,
1245
,
208
,
210
,
1106
,
59
,
60
,
1120
,
112
1
,
/* 1470 */
469
,
19
,
476
,
1499
,
209
,
1107
,
207
,
1246
,
1121
,
21
1
,
/* 1480 */
468
,
42
,
64
,
214
,
1547
,
999
,
489
,
1565
,
287
,
1575
,
/* 1480 */
468
,
60
,
213
,
61
,
1549
,
215
,
42
,
65
,
1122
,
1577
,
/* 1490 */
217
,
491
,
493
,
487
,
996
,
494
,
1109
,
1110
,
496
,
1123
,
/* 1490 */
1567
,
1000
,
489
,
288
,
218
,
487
,
1110
,
1111
,
491
,
1124
,
/* 1500 */
157
5
,
993
,
243
,
1576
,
471
,
1578
,
1579
,
467
,
497
,
462
,
/* 1500 */
157
7
,
997
,
244
,
1578
,
471
,
1580
,
1581
,
467
,
493
,
462
,
/* 1510 */
987
,
499
,
500
,
1591
,
985
,
502
,
503
,
991
,
976
,
990
,
/* 1510 */
494
,
977
,
496
,
1593
,
994
,
497
,
499
,
988
,
500
,
502
,
/* 1520 */
469
,
9
89
,
65
,
988
,
1591
,
1011
,
66
,
67
,
509
,
1007
,
/* 1520 */
469
,
9
92
,
986
,
503
,
1593
,
509
,
991
,
990
,
989
,
1012
,
/* 1530 */
468
,
469
,
1004
,
902
,
1547
,
520
,
927
,
1010
,
945
,
523
,
/* 1530 */
468
,
469
,
66
,
67
,
1549
,
68
,
1008
,
1005
,
903
,
1011
,
/* 1540 */
925
,
468
,
219
,
924
,
923
,
1547
,
922
,
921
,
1575
,
920
,
/* 1540 */
520
,
468
,
928
,
946
,
523
,
1549
,
926
,
220
,
1577
,
925
,
/* 1550 */
9
19
,
918
,
236
,
1576
,
471
,
1578
,
1579
,
467
,
94
2
,
462
,
/* 1550 */
9
24
,
923
,
237
,
1578
,
471
,
1580
,
1581
,
467
,
92
2
,
462
,
/* 1560 */
9
40
,
1575
,
403
,
244
,
1576
,
471
,
1578
,
1579
,
467
,
915
,
/* 1560 */
9
21
,
1577
,
404
,
245
,
1578
,
471
,
1580
,
1581
,
467
,
920
,
/* 1570 */
462
,
91
4
,
1591
,
913
,
910
,
909
,
908
,
411
,
907
,
469
,
/* 1570 */
462
,
91
9
,
1593
,
943
,
941
,
916
,
915
,
412
,
914
,
469
,
/* 1580 */
1335
,
545
,
546
,
1333
,
547
,
1591
,
549
,
550
,
551
,
468
,
/* 1580 */
911
,
910
,
909
,
908
,
1337
,
1593
,
545
,
546
,
1335
,
468
,
/* 1590 */
1331
,
173
,
469
,
1547
,
406
,
553
,
554
,
555
,
1329
,
400
,
/* 1590 */
547
,
174
,
469
,
1549
,
407
,
549
,
550
,
551
,
1333
,
401
,
/* 1600 */
55
7
,
558
,
468
,
1317
,
559
,
172
,
1547
,
561
,
562
,
1316
,
/* 1600 */
55
3
,
554
,
468
,
1331
,
555
,
173
,
1549
,
557
,
558
,
559
,
/* 1610 */
131
2
,
237
,
1576
,
471
,
1578
,
1579
,
467
,
565
,
462
,
1107
,
/* 1610 */
131
9
,
238
,
1578
,
471
,
1580
,
1581
,
467
,
561
,
462
,
562
,
/* 1620 */
566
,
570
,
228
,
569
,
245
,
1576
,
471
,
1578
,
1579
,
467
,
/* 1620 */
1318
,
1314
,
565
,
566
,
246
,
1578
,
471
,
1580
,
1581
,
467
,
/* 1630 */
157
5
,
462
,
45
,
1287
,
1287
,
44
,
1287
,
1287
,
1287
,
1575
,
/* 1630 */
157
7
,
462
,
45
,
1108
,
229
,
44
,
569
,
570
,
1289
,
1577
,
/* 1640 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1640 */
128
9
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1650 */
128
7
,
1287
,
1287
,
1287
,
1591
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1650 */
128
9
,
1289
,
1289
,
1289
,
1593
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1660 */
128
7
,
469
,
1287
,
1591
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1660 */
128
9
,
469
,
1289
,
1593
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1670 */
469
,
468
,
128
7
,
1287
,
1287
,
1547
,
1287
,
1287
,
1287
,
1287
,
/* 1670 */
469
,
468
,
128
9
,
1289
,
1289
,
1549
,
1289
,
1289
,
1289
,
1289
,
/* 1680 */
468
,
128
7
,
1287
,
1287
,
1547
,
1287
,
1287
,
1287
,
1287
,
1575
,
/* 1680 */
468
,
128
9
,
1289
,
1289
,
1549
,
1289
,
1289
,
1289
,
1289
,
1577
,
/* 1690 */
128
7
,
1287
,
1287
,
238
,
1576
,
471
,
1578
,
1579
,
467
,
1287
,
/* 1690 */
128
9
,
1289
,
1289
,
239
,
1578
,
471
,
1580
,
1581
,
467
,
1289
,
/* 1700 */
462
,
128
7
,
1587
,
1576
,
471
,
1578
,
1579
,
467
,
1287
,
462
,
/* 1700 */
462
,
128
9
,
1589
,
1578
,
471
,
1580
,
1581
,
467
,
1289
,
462
,
/* 1710 */
128
7
,
1287
,
1287
,
1591
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1710 */
128
9
,
1289
,
1289
,
1593
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1720 */
469
,
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1720 */
469
,
128
9
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1730 */
468
,
128
7
,
1287
,
1287
,
1547
,
1287
,
1287
,
1287
,
1287
,
1575
,
/* 1730 */
468
,
128
9
,
1289
,
1289
,
1549
,
1289
,
1289
,
1289
,
1289
,
1577
,
/* 1740 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1740 */
128
9
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1750 */
157
5
,
1287
,
1586
,
1576
,
471
,
1578
,
1579
,
467
,
1287
,
462
,
/* 1750 */
157
7
,
1289
,
1588
,
1578
,
471
,
1580
,
1581
,
467
,
1289
,
462
,
/* 1760 */
128
7
,
1287
,
1287
,
1591
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1760 */
128
9
,
1289
,
1289
,
1593
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1770 */
469
,
128
7
,
1287
,
1287
,
1591
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1770 */
469
,
128
9
,
1289
,
1289
,
1593
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1780 */
468
,
469
,
128
7
,
1287
,
1547
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1780 */
468
,
469
,
128
9
,
1289
,
1549
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1790 */
128
7
,
468
,
1287
,
1287
,
1287
,
1547
,
1287
,
1287
,
1575
,
1287
,
/* 1790 */
128
9
,
468
,
1289
,
1289
,
1289
,
1549
,
1289
,
1289
,
1577
,
1289
,
/* 1800 */
128
7
,
1287
,
1585
,
1576
,
471
,
1578
,
1579
,
467
,
1287
,
462
,
/* 1800 */
128
9
,
1289
,
1587
,
1578
,
471
,
1580
,
1581
,
467
,
1289
,
462
,
/* 1810 */
128
7
,
1575
,
1287
,
254
,
1576
,
471
,
1578
,
1579
,
467
,
1287
,
/* 1810 */
128
9
,
1577
,
1289
,
255
,
1578
,
471
,
1580
,
1581
,
467
,
1289
,
/* 1820 */
462
,
128
7
,
1591
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
469
,
/* 1820 */
462
,
128
9
,
1593
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
469
,
/* 1830 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1591
,
1287
,
1287
,
1287
,
468
,
/* 1830 */
128
9
,
1289
,
1289
,
1289
,
1289
,
1593
,
1289
,
1289
,
1289
,
468
,
/* 1840 */
128
7
,
1287
,
469
,
1547
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1840 */
128
9
,
1289
,
469
,
1549
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1850 */
128
7
,
1287
,
468
,
1287
,
1287
,
1287
,
1547
,
1287
,
1287
,
1287
,
/* 1850 */
128
9
,
1289
,
468
,
1289
,
1289
,
1289
,
1549
,
1289
,
1289
,
1289
,
/* 1860 */
128
7
,
253
,
1576
,
471
,
1578
,
1579
,
467
,
1287
,
462
,
1287
,
/* 1860 */
128
9
,
254
,
1578
,
471
,
1580
,
1581
,
467
,
1289
,
462
,
1289
,
/* 1870 */
128
7
,
1287
,
1287
,
1287
,
255
,
1576
,
471
,
1578
,
1579
,
467
,
/* 1870 */
128
9
,
1289
,
1289
,
1289
,
256
,
1578
,
471
,
1580
,
1581
,
467
,
/* 1880 */
157
5
,
462
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1575
,
/* 1880 */
157
7
,
462
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1577
,
/* 1890 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1890 */
128
9
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1900 */
128
7
,
1287
,
1287
,
1287
,
1591
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1900 */
128
9
,
1289
,
1289
,
1289
,
1593
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1910 */
128
7
,
469
,
1287
,
1591
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1910 */
128
9
,
469
,
1289
,
1593
,
1289
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1920 */
469
,
468
,
128
7
,
1287
,
1287
,
1547
,
1287
,
1287
,
1287
,
1287
,
/* 1920 */
469
,
468
,
128
9
,
1289
,
1289
,
1549
,
1289
,
1289
,
1289
,
1289
,
/* 1930 */
468
,
128
7
,
1287
,
1287
,
1547
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 1930 */
468
,
128
9
,
1289
,
1289
,
1549
,
1289
,
1289
,
1289
,
1289
,
1289
,
/* 1940 */
128
7
,
1287
,
1287
,
252
,
1576
,
471
,
1578
,
1579
,
467
,
1287
,
/* 1940 */
128
9
,
1289
,
1289
,
253
,
1578
,
471
,
1580
,
1581
,
467
,
1289
,
/* 1950 */
462
,
128
7
,
240
,
1576
,
471
,
1578
,
1579
,
467
,
1287
,
462
,
/* 1950 */
462
,
128
9
,
241
,
1578
,
471
,
1580
,
1581
,
467
,
1289
,
462
,
};
};
static
const
YYCODETYPE
yy_lookahead
[]
=
{
static
const
YYCODETYPE
yy_lookahead
[]
=
{
/* 0 */
253
,
249
,
253
,
266
,
225
,
231
,
269
,
231
,
256
,
272
,
/* 0 */
253
,
249
,
253
,
266
,
225
,
231
,
269
,
231
,
256
,
272
,
/* 10 */
222
,
250
,
12
,
13
,
240
,
225
,
224
,
270
,
226
,
270
,
/* 10 */
222
,
250
,
12
,
13
,
240
,
225
,
224
,
270
,
226
,
270
,
/* 20 */
20
,
247
,
22
,
12
,
13
,
14
,
15
,
16
,
249
,
270
,
/* 20 */
20
,
247
,
22
,
12
,
13
,
14
,
15
,
16
,
249
,
270
,
/* 30 */
256
,
284
,
285
,
284
,
285
,
256
,
234
,
261
,
38
,
249
,
/* 30 */
256
,
284
,
285
,
284
,
285
,
256
,
234
,
261
,
38
,
249
,
/* 40 */
238
,
233
,
290
,
284
,
285
,
266
,
256
,
0
,
231
,
270
,
/* 40 */
238
,
314
,
290
,
284
,
285
,
266
,
256
,
0
,
231
,
270
,
/* 50 */
50
,
12
,
13
,
14
,
246
,
233
,
266
,
57
,
20
,
20
,
/* 50 */
50
,
12
,
13
,
14
,
327
,
233
,
266
,
57
,
331
,
20
,
/* 60 */
270
,
22
,
254
,
275
,
275
,
275
,
225
,
288
,
289
,
290
,
/* 60 */
270
,
22
,
20
,
275
,
275
,
275
,
225
,
288
,
289
,
290
,
/* 70 */
291
,
292
,
293
,
256
,
295
,
75
,
254
,
38
,
288
,
289
,
/* 70 */
291
,
292
,
293
,
256
,
295
,
75
,
254
,
38
,
288
,
289
,
/* 80 */
290
,
291
,
292
,
293
,
49
,
295
,
20
,
258
,
298
,
50
,
/* 80 */
290
,
291
,
292
,
293
,
237
,
295
,
239
,
258
,
298
,
50
,
/* 90 */
249
,
20
,
302
,
303
,
265
,
266
,
57
,
256
,
98
,
299
,
/* 90 */
249
,
20
,
302
,
303
,
265
,
266
,
57
,
256
,
98
,
299
,
/* 100 */
300
,
72
,
314
,
314
,
314
,
326
,
231
,
266
,
61
,
292
,
/* 100 */
300
,
49
,
314
,
314
,
314
,
326
,
231
,
266
,
61
,
292
,
/* 110 */
110
,
270
,
65
,
231
,
75
,
327
,
327
,
327
,
0
,
331
,
/* 110 */
110
,
270
,
65
,
231
,
75
,
327
,
327
,
327
,
2
0
,
331
,
/* 120 */
331
,
331
,
240
,
306
,
307
,
308
,
309
,
231
,
311
,
288
,
/* 120 */
331
,
331
,
240
,
306
,
307
,
308
,
309
,
231
,
311
,
288
,
/* 130 */
289
,
290
,
291
,
292
,
293
,
88
,
295
,
98
,
256
,
298
,
/* 130 */
289
,
290
,
291
,
292
,
293
,
88
,
295
,
98
,
256
,
298
,
/* 140 */
22
,
75
,
231
,
302
,
303
,
304
,
75
,
230
,
148
,
110
,
/* 140 */
233
,
47
,
231
,
302
,
303
,
304
,
75
,
38
,
148
,
110
,
/* 150 */
275
,
240
,
256
,
20
,
107
,
108
,
109
,
316
,
111
,
256
,
/* 150 */
275
,
240
,
256
,
246
,
107
,
108
,
109
,
316
,
111
,
20
,
/* 160 */
248
,
244
,
20
,
322
,
323
,
138
,
263
,
256
,
251
,
169
,
/* 160 */
20
,
254
,
20
,
322
,
323
,
138
,
57
,
256
,
74
,
169
,
/* 170 */
170
,
259
,
172
,
173
,
174
,
175
,
176
,
177
,
178
,
179
,
/* 170 */
170
,
77
,
172
,
173
,
174
,
175
,
176
,
177
,
178
,
179
,
/* 180 */
180
,
181
,
182
,
183
,
184
,
185
,
186
,
148
,
292
,
314
,
/* 180 */
180
,
181
,
182
,
183
,
184
,
185
,
186
,
148
,
292
,
314
,
/* 190 */
249
,
12
,
13
,
14
,
15
,
16
,
255
,
1
,
2
,
199
,
/* 190 */
249
,
12
,
13
,
14
,
15
,
16
,
255
,
1
,
2
,
199
,
/* 200 */
75
,
260
,
327
,
307
,
308
,
309
,
331
,
311
,
169
,
170
,
/* 200 */
75
,
260
,
327
,
307
,
308
,
309
,
331
,
311
,
169
,
170
,
/* 210 */
85
,
172
,
173
,
174
,
175
,
176
,
177
,
178
,
179
,
180
,
/* 210 */
85
,
172
,
173
,
174
,
175
,
176
,
177
,
178
,
179
,
180
,
/* 220 */
181
,
182
,
183
,
184
,
185
,
186
,
12
,
13
,
20
,
50
,
/* 220 */
181
,
182
,
183
,
184
,
185
,
186
,
12
,
13
,
199
,
50
,
/* 230 */
242
,
204
,
205
,
245
,
20
,
18
,
22
,
20
,
225
,
52
,
/* 230 */
242
,
204
,
205
,
245
,
20
,
18
,
22
,
20
,
225
,
52
,
/* 240 */
20
,
54
,
22
,
249
,
27
,
58
,
217
,
30
,
61
,
255
,
/* 240 */
230
,
54
,
49
,
249
,
27
,
58
,
230
,
30
,
61
,
255
,
/* 250 */
63
,
64
,
38
,
66
,
260
,
76
,
39
,
147
,
71
,
149
,
/* 250 */
63
,
64
,
38
,
66
,
260
,
76
,
39
,
147
,
71
,
149
,
/* 260 */
40
,
199
,
249
,
84
,
50
,
12
,
13
,
235
,
236
,
256
,
/* 260 */
244
,
251
,
249
,
84
,
50
,
12
,
13
,
251
,
4
,
256
,
/* 270 */
199
,
57
,
76
,
20
,
2
,
22
,
286
,
157
,
158
,
266
,
/* 270 */
199
,
57
,
76
,
20
,
2
,
22
,
286
,
157
,
158
,
266
,
/* 280 */
169
,
161
,
2
,
270
,
12
,
13
,
14
,
15
,
16
,
75
,
/* 280 */
169
,
161
,
2
,
270
,
12
,
13
,
14
,
15
,
16
,
75
,
/* 290 */
286
,
38
,
12
,
13
,
14
,
15
,
16
,
14
,
15
,
16
,
/* 290 */
286
,
38
,
12
,
13
,
14
,
15
,
16
,
14
,
15
,
16
,
/* 300 */
310
,
288
,
289
,
290
,
291
,
292
,
293
,
2
25
,
295
,
199
,
/* 300 */
310
,
288
,
289
,
290
,
291
,
292
,
293
,
2
48
,
295
,
199
,
/* 310 */
57
,
298
,
98
,
134
,
310
,
302
,
303
,
304
,
20
,
208
,
/* 310 */
57
,
298
,
98
,
134
,
310
,
302
,
303
,
304
,
259
,
208
,
/* 320 */
209
,
210
,
211
,
212
,
110
,
275
,
313
,
0
,
75
,
0
,
/* 320 */
209
,
210
,
211
,
212
,
110
,
275
,
313
,
0
,
75
,
0
,
/* 330 */
113
,
152
,
199
,
116
,
117
,
118
,
119
,
120
,
20
,
122
,
/* 330 */
113
,
152
,
20
,
116
,
117
,
118
,
119
,
120
,
199
,
122
,
/* 340 */
123
,
124
,
125
,
126
,
127
,
128
,
129
,
130
,
131
,
132
,
/* 340 */
123
,
124
,
125
,
126
,
127
,
128
,
129
,
130
,
131
,
132
,
/* 350 */
133
,
98
,
270
,
24
,
25
,
26
,
27
,
28
,
29
,
30
,
/* 350 */
133
,
98
,
4
,
24
,
25
,
26
,
27
,
28
,
29
,
30
,
/* 360 */
31
,
32
,
148
,
110
,
314
,
314
,
187
,
188
,
189
,
190
,
/* 360 */
31
,
32
,
148
,
110
,
314
,
314
,
187
,
188
,
189
,
190
,
/* 370 */
191
,
192
,
193
,
194
,
195
,
196
,
49
,
327
,
327
,
225
,
/* 370 */
191
,
192
,
193
,
194
,
195
,
196
,
49
,
327
,
327
,
225
,
/* 380 */
49
,
331
,
331
,
169
,
170
,
38
,
172
,
173
,
174
,
175
,
/* 380 */
20
,
331
,
331
,
169
,
170
,
43
,
172
,
173
,
174
,
175
,
/* 390 */
176
,
177
,
178
,
179
,
180
,
181
,
182
,
183
,
184
,
185
,
/* 390 */
176
,
177
,
178
,
179
,
180
,
181
,
182
,
183
,
184
,
185
,
/* 400 */
186
,
148
,
228
,
229
,
57
,
12
,
13
,
14
,
15
,
16
,
/* 400 */
186
,
148
,
57
,
20
,
72
,
12
,
13
,
14
,
15
,
16
,
/* 410 */
21
,
2
35
,
236
,
24
,
25
,
26
,
27
,
28
,
29
,
30
,
/* 410 */
21
,
2
28
,
229
,
24
,
25
,
26
,
27
,
28
,
29
,
30
,
/* 420 */
31
,
32
,
169
,
170
,
270
,
172
,
173
,
174
,
175
,
176
,
/* 420 */
31
,
32
,
169
,
170
,
270
,
172
,
173
,
174
,
175
,
176
,
/* 430 */
177
,
178
,
179
,
180
,
181
,
182
,
183
,
184
,
185
,
186
,
/* 430 */
177
,
178
,
179
,
180
,
181
,
182
,
183
,
184
,
185
,
186
,
/* 440 */
12
,
13
,
14
,
50
,
0
,
144
,
225
,
241
,
20
,
20
,
/* 440 */
12
,
13
,
14
,
50
,
0
,
72
,
225
,
241
,
20
,
76
,
/* 450 */
22
,
241
,
199
,
231
,
266
,
249
,
35
,
61
,
140
,
249
,
/* 450 */
22
,
241
,
199
,
231
,
266
,
249
,
35
,
61
,
75
,
249
,
/* 460 */
272
,
65
,
240
,
257
,
163
,
21
,
38
,
257
,
24
,
25
,
/* 460 */
272
,
65
,
240
,
257
,
200
,
21
,
38
,
257
,
24
,
25
,
/* 470 */
26
,
27
,
28
,
29
,
30
,
31
,
32
,
84
,
256
,
12
,
/* 470 */
26
,
27
,
28
,
29
,
30
,
31
,
32
,
84
,
256
,
12
,
/* 480 */
13
,
47
,
61
,
0
,
88
,
57
,
65
,
20
,
225
,
22
,
/* 480 */
13
,
3
,
61
,
0
,
88
,
57
,
65
,
20
,
225
,
22
,
/* 490 */
225
,
270
,
12
,
13
,
14
,
15
,
16
,
231
,
231
,
78
,
/* 490 */
225
,
270
,
12
,
13
,
14
,
15
,
16
,
231
,
231
,
78
,
/* 500 */
0
,
80
,
81
,
75
,
83
,
38
,
240
,
240
,
74
,
88
,
/* 500 */
140
,
80
,
81
,
75
,
83
,
38
,
240
,
240
,
86
,
88
,
/* 510 */
0
,
77
,
241
,
247
,
249
,
12
,
13
,
14
,
15
,
16
,
/* 510 */
235
,
236
,
241
,
247
,
249
,
12
,
13
,
14
,
15
,
16
,
/* 520 */
249
,
256
,
256
,
256
,
57
,
231
,
98
,
134
,
257
,
225
,
/* 520 */
249
,
256
,
256
,
256
,
57
,
231
,
98
,
134
,
257
,
225
,
/* 530 */
249
,
266
,
22
,
270
,
240
,
270
,
255
,
231
,
110
,
249
,
/* 530 */
249
,
266
,
256
,
270
,
240
,
270
,
255
,
231
,
110
,
263
,
/* 540 */
249
,
260
,
75
,
134
,
61
,
152
,
240
,
257
,
65
,
49
,
/* 540 */
198
,
260
,
75
,
134
,
61
,
152
,
240
,
199
,
65
,
217
,
/* 550 */
256
,
2
60
,
230
,
288
,
289
,
290
,
291
,
292
,
293
,
86
,
/* 550 */
256
,
2
35
,
236
,
288
,
289
,
290
,
291
,
292
,
293
,
249
,
/* 560 */
295
,
152
,
256
,
298
,
0
,
98
,
57
,
302
,
303
,
304
,
/* 560 */
295
,
152
,
256
,
298
,
0
,
98
,
20
,
302
,
303
,
304
,
/* 570 */
20
,
88
,
67
,
251
,
270
,
286
,
148
,
110
,
313
,
76
,
/* 570 */
260
,
88
,
67
,
250
,
270
,
286
,
148
,
110
,
313
,
76
,
/* 580 */
187
,
188
,
189
,
190
,
191
,
192
,
193
,
194
,
195
,
196
,
/* 580 */
187
,
188
,
189
,
190
,
191
,
192
,
193
,
194
,
195
,
196
,
/* 590 */
107
,
108
,
109
,
225
,
111
,
3
,
187
,
169
,
170
,
310
,
/* 590 */
107
,
108
,
109
,
225
,
111
,
0
,
187
,
169
,
170
,
310
,
/* 600 */
172
,
173
,
174
,
175
,
176
,
177
,
178
,
179
,
180
,
181
,
/* 600 */
172
,
173
,
174
,
175
,
176
,
177
,
178
,
179
,
180
,
181
,
/* 610 */
182
,
183
,
184
,
185
,
186
,
148
,
52
,
249
,
54
,
114
,
/* 610 */
182
,
183
,
184
,
185
,
186
,
148
,
52
,
249
,
54
,
114
,
/* 620 */
115
,
141
,
58
,
225
,
256
,
61
,
250
,
63
,
64
,
237
,
/* 620 */
115
,
141
,
58
,
225
,
256
,
61
,
79
,
63
,
64
,
82
,
/* 630 */
66
,
239
,
235
,
236
,
266
,
71
,
169
,
170
,
270
,
172
,
/* 630 */
66
,
36
,
235
,
236
,
266
,
71
,
169
,
170
,
270
,
172
,
/* 640 */
173
,
174
,
175
,
176
,
177
,
178
,
179
,
180
,
181
,
182
,
/* 640 */
173
,
174
,
175
,
176
,
177
,
178
,
179
,
180
,
181
,
182
,
/* 650 */
183
,
184
,
185
,
186
,
12
,
13
,
288
,
289
,
290
,
291
,
/* 650 */
183
,
184
,
185
,
186
,
12
,
13
,
288
,
289
,
290
,
291
,
/* 660 */
292
,
293
,
20
,
295
,
22
,
225
,
298
,
25
0
,
270
,
231
,
/* 660 */
292
,
293
,
20
,
295
,
22
,
225
,
298
,
0
,
270
,
231
,
/* 670 */
302
,
303
,
304
,
12
,
13
,
14
,
15
,
16
,
240
,
231
,
/* 670 */
302
,
303
,
304
,
12
,
13
,
14
,
15
,
16
,
240
,
231
,
/* 680 */
38
,
225
,
4
,
231
,
231
,
22
,
235
,
236
,
240
,
249
,
/* 680 */
38
,
225
,
249
,
231
,
231
,
20
,
140
,
22
,
240
,
249
,
/* 690 */
140
,
323
,
240
,
75
,
256
,
250
,
256
,
265
,
26
6
,
57
,
/* 690 */
257
,
323
,
240
,
215
,
256
,
250
,
256
,
235
,
23
6
,
57
,
/* 700 */
220
,
38
,
231
,
43
,
256
,
87
,
266
,
25
0
,
256
,
256
,
/* 700 */
220
,
14
,
231
,
22
,
256
,
40
,
266
,
2
0
,
256
,
256
,
/* 710 */
270
,
240
,
231
,
225
,
225
,
1
97
,
198
,
75
,
0
,
14
,
/* 710 */
270
,
240
,
231
,
225
,
225
,
1
44
,
49
,
75
,
0
,
38
,
/* 720 */
225
,
240
,
225
,
225
,
225
,
2
0
,
270
,
256
,
288
,
289
,
/* 720 */
225
,
240
,
225
,
225
,
225
,
25
0
,
270
,
256
,
288
,
289
,
/* 730 */
290
,
291
,
292
,
293
,
250
,
295
,
250
,
256
,
298
,
0
,
/* 730 */
290
,
291
,
292
,
293
,
163
,
295
,
79
,
256
,
298
,
82
,
/* 740 */
98
,
72
,
302
,
303
,
304
,
292
,
12
,
13
,
14
,
15
,
/* 740 */
98
,
72
,
302
,
303
,
304
,
292
,
12
,
13
,
14
,
15
,
/* 750 */
16
,
225
,
110
,
313
,
225
,
225
,
2
78
,
225
,
270
,
270
,
/* 750 */
16
,
225
,
110
,
313
,
225
,
225
,
2
50
,
225
,
270
,
270
,
/* 760 */
307
,
308
,
309
,
225
,
311
,
270
,
226
,
270
,
270
,
270
,
/* 760 */
307
,
308
,
309
,
225
,
311
,
270
,
50
,
270
,
270
,
270
,
/* 770 */
52
,
53
,
54
,
55
,
56
,
36
,
58
,
59
,
60
,
61
,
/* 770 */
52
,
53
,
54
,
55
,
56
,
250
,
58
,
59
,
60
,
61
,
/* 780 */
62
,
63
,
64
,
65
,
66
,
67
,
68
,
69
,
70
,
71
,
/* 780 */
62
,
63
,
64
,
65
,
66
,
67
,
68
,
69
,
70
,
71
,
/* 790 */
148
,
14
,
79
,
50
,
72
,
82
,
270
,
20
,
76
,
270
,
/* 790 */
148
,
14
,
265
,
266
,
197
,
198
,
270
,
20
,
250
,
270
,
/* 800 */
270
,
140
,
270
,
225
,
159
,
160
,
225
,
2
15
,
270
,
238
,
/* 800 */
270
,
140
,
270
,
225
,
159
,
160
,
225
,
2
25
,
270
,
72
,
/* 810 */
76
,
169
,
170
,
334
,
172
,
173
,
174
,
175
,
176
,
177
,
/* 810 */
76
,
169
,
170
,
76
,
172
,
173
,
174
,
175
,
176
,
177
,
/* 820 */
178
,
179
,
180
,
181
,
182
,
183
,
184
,
185
,
186
,
32
5
,
/* 820 */
178
,
179
,
180
,
181
,
182
,
183
,
184
,
185
,
186
,
7
5
,
/* 830 */
89
,
90
,
91
,
92
,
93
,
94
,
95
,
96
,
97
,
98
,
/* 830 */
89
,
90
,
91
,
92
,
93
,
94
,
95
,
96
,
97
,
98
,
/* 840 */
99
,
259
,
101
,
102
,
103
,
104
,
105
,
106
,
270
,
18
,
/* 840 */
99
,
87
,
101
,
102
,
103
,
104
,
105
,
106
,
270
,
18
,
/* 850 */
225
,
270
,
79
,
79
,
23
,
82
,
82
,
79
,
198
,
21
,
/* 850 */
225
,
270
,
270
,
79
,
23
,
0
,
82
,
79
,
0
,
21
,
/* 860 */
82
,
0
,
38
,
225
,
72
,
72
,
35
,
72
,
76
,
76
,
/* 860 */
82
,
0
,
38
,
225
,
72
,
72
,
35
,
278
,
76
,
76
,
/* 870 */
38
,
76
,
34
,
72
,
249
,
184
,
185
,
76
,
200
,
48
,
/* 870 */
1
,
2
,
34
,
38
,
249
,
184
,
185
,
22
,
72
,
48
,
/* 880 */
72
,
256
,
282
,
22
,
76
,
1
,
2
,
249
,
219
,
72
,
/* 880 */
22
,
256
,
76
,
22
,
226
,
169
,
7
2
,
249
,
219
,
72
,
/* 890 */
228
,
266
,
72
,
76
,
256
,
270
,
76
,
72
,
319
,
72
,
/* 890 */
76
,
266
,
72
,
76
,
256
,
270
,
76
,
72
,
238
,
72
,
/* 900 */
275
,
76
,
287
,
76
,
266
,
72
,
72
,
72
,
270
,
76
,
/* 900 */
275
,
76
,
72
,
76
,
266
,
72
,
76
,
334
,
270
,
76
,
/* 910 */
76
,
76
,
169
,
288
,
289
,
290
,
291
,
292
,
293
,
72
,
/* 910 */
325
,
259
,
282
,
288
,
289
,
290
,
291
,
292
,
293
,
72
,
/* 920 */
295
,
72
,
31
2
,
76
,
249
,
76
,
288
,
289
,
290
,
291
,
/* 920 */
295
,
72
,
31
9
,
76
,
228
,
76
,
288
,
289
,
290
,
291
,
/* 930 */
292
,
293
,
3
28
,
295
,
110
,
38
,
298
,
315
,
20
,
314
,
/* 930 */
292
,
293
,
3
12
,
295
,
110
,
287
,
298
,
249
,
72
,
314
,
/* 940 */
302
,
303
,
110
,
112
,
225
,
72
,
231
,
36
,
283
,
7
6
,
/* 940 */
302
,
303
,
76
,
112
,
225
,
110
,
328
,
38
,
315
,
3
6
,
/* 950 */
33
,
72
,
327
,
36
,
57
,
76
,
331
,
38
,
235
,
42
,
/* 950 */
33
,
72
,
327
,
36
,
72
,
76
,
331
,
20
,
76
,
42
,
/* 960 */
146
,
44
,
45
,
46
,
47
,
276
,
231
,
231
,
249
,
121
,
/* 960 */
231
,
44
,
45
,
46
,
47
,
283
,
57
,
235
,
249
,
38
,
/* 970 */
2
64
,
134
,
141
,
142
,
143
,
256
,
145
,
231
,
262
,
262
,
/* 970 */
2
76
,
231
,
141
,
142
,
143
,
256
,
145
,
231
,
146
,
264
,
/* 980 */
20
,
150
,
280
,
233
,
20
,
266
,
266
,
233
,
274
,
270
,
/* 980 */
121
,
150
,
134
,
262
,
262
,
266
,
231
,
20
,
280
,
270
,
/* 990 */
20
,
74
,
267
,
162
,
77
,
164
,
225
,
166
,
167
,
168
,
/* 990 */
233
,
74
,
266
,
162
,
77
,
164
,
225
,
166
,
167
,
168
,
/* 1000 */
256
,
233
,
233
,
231
,
20
,
249
,
227
,
288
,
289
,
290
,
/* 1000 */
20
,
274
,
233
,
256
,
20
,
267
,
233
,
288
,
289
,
290
,
/* 1010 */
291
,
292
,
293
,
233
,
295
,
2
49
,
249
,
298
,
231
,
19
,
/* 1010 */
291
,
292
,
293
,
233
,
295
,
2
31
,
233
,
298
,
20
,
19
,
/* 1020 */
249
,
302
,
303
,
227
,
249
,
249
,
57
,
256
,
270
,
280
,
/* 1020 */
249
,
302
,
303
,
227
,
249
,
249
,
231
,
256
,
249
,
227
,
/* 1030 */
199
,
249
,
249
,
33
,
249
,
249
,
36
,
266
,
249
,
249
,
/* 1030 */
199
,
249
,
57
,
33
,
249
,
249
,
36
,
266
,
249
,
249
,
/* 1040 */
2
30
,
270
,
42
,
155
,
44
,
45
,
46
,
47
,
230
,
279
,
/* 1040 */
2
49
,
270
,
42
,
249
,
44
,
45
,
46
,
47
,
249
,
230
,
/* 1050 */
2
66
,
225
,
135
,
230
,
137
,
274
,
139
,
20
,
256
,
288
,
/* 1050 */
2
80
,
225
,
135
,
155
,
137
,
274
,
139
,
270
,
230
,
288
,
/* 1060 */
289
,
290
,
291
,
292
,
293
,
294
,
295
,
296
,
297
,
2
30
,
/* 1060 */
289
,
290
,
291
,
292
,
293
,
294
,
295
,
296
,
297
,
2
66
,
/* 1070 */
2
67
,
207
,
324
,
156
,
74
,
249
,
206
,
77
,
287
,
324
,
/* 1070 */
2
30
,
256
,
267
,
156
,
74
,
249
,
279
,
77
,
20
,
207
,
/* 1080 */
2
71
,
270
,
256
,
271
,
321
,
270
,
270
,
202
,
214
,
213
,
/* 1080 */
2
30
,
271
,
256
,
324
,
206
,
287
,
270
,
324
,
214
,
271
,
/* 1090 */
2
01
,
198
,
266
,
20
,
121
,
335
,
270
,
256
,
221
,
286
,
/* 1090 */
2
13
,
270
,
266
,
270
,
202
,
201
,
270
,
198
,
256
,
20
,
/* 1100 */
225
,
2
18
,
305
,
216
,
75
,
301
,
270
,
107
,
320
,
137
,
/* 1100 */
225
,
2
21
,
121
,
335
,
218
,
216
,
305
,
107
,
286
,
321
,
/* 1110 */
268
,
271
,
318
,
270
,
288
,
289
,
290
,
291
,
292
,
293
,
/* 1110 */
75
,
270
,
301
,
270
,
288
,
289
,
290
,
291
,
292
,
293
,
/* 1120 */
270
,
295
,
317
,
271
,
249
,
256
,
267
,
245
,
330
,
329
,
/* 1120 */
320
,
295
,
318
,
271
,
249
,
317
,
137
,
271
,
245
,
256
,
/* 1130 */
2
30
,
256
,
230
,
75
,
256
,
239
,
136
,
231
,
252
,
139
,
/* 1130 */
2
70
,
256
,
268
,
230
,
267
,
230
,
136
,
330
,
329
,
139
,
/* 1140 */
2
30
,
266
,
227
,
277
,
281
,
270
,
243
,
243
,
232
,
223
,
/* 1140 */
2
56
,
266
,
75
,
252
,
230
,
270
,
239
,
231
,
227
,
281
,
/* 1150 */
0
,
0
,
225
,
64
,
154
,
0
,
156
,
38
,
332
,
333
,
/* 1150 */
232
,
243
,
225
,
277
,
154
,
243
,
156
,
223
,
332
,
333
,
/* 1160 */
231
,
165
,
38
,
288
,
289
,
290
,
291
,
292
,
293
,
38
,
/* 1160 */
231
,
0
,
0
,
288
,
289
,
290
,
291
,
292
,
293
,
64
,
/* 1170 */
295
,
38
,
165
,
298
,
0
,
38
,
249
,
38
,
303
,
165
,
/* 1170 */
295
,
0
,
38
,
298
,
165
,
38
,
249
,
38
,
303
,
38
,
/* 1180 */
0
,
38
,
225
,
256
,
0
,
256
,
38
,
0
,
75
,
110
,
/* 1180 */
165
,
0
,
225
,
256
,
38
,
256
,
38
,
165
,
0
,
38
,
/* 1190 */
148
,
152
,
151
,
266
,
0
,
0
,
144
,
270
,
53
,
0
,
/* 1190 */
0
,
0
,
38
,
266
,
75
,
152
,
151
,
270
,
110
,
148
,
/* 1200 */
273
,
0
,
0
,
87
,
275
,
0
,
249
,
0
,
0
,
0
,
/* 1200 */
273
,
0
,
0
,
53
,
275
,
144
,
249
,
0
,
0
,
87
,
/* 1210 */
0
,
0
,
0
,
256
,
121
,
288
,
289
,
290
,
291
,
292
,
/* 1210 */
0
,
0
,
0
,
256
,
121
,
288
,
289
,
290
,
291
,
292
,
/* 1220 */
293
,
292
,
295
,
266
,
0
,
0
,
0
,
270
,
0
,
0
,
/* 1220 */
293
,
292
,
295
,
266
,
0
,
0
,
0
,
270
,
0
,
0
,
/* 1230 */
0
,
0
,
0
,
225
,
0
,
0
,
307
,
308
,
309
,
0
,
/* 1230 */
0
,
0
,
0
,
225
,
0
,
0
,
307
,
308
,
309
,
0
,
/* 1240 */
311
,
0
,
0
,
314
,
0
,
288
,
289
,
290
,
291
,
292
,
/* 1240 */
311
,
0
,
0
,
314
,
0
,
288
,
289
,
290
,
291
,
292
,
/* 1250 */
293
,
0
,
295
,
0
,
0
,
22
,
327
,
249
,
0
,
0
,
/* 1250 */
293
,
0
,
295
,
0
,
0
,
0
,
327
,
249
,
0
,
0
,
/* 1260 */
331
,
0
,
0
,
225
,
256
,
0
,
0
,
0
,
0
,
51
,
/* 1260 */
331
,
0
,
22
,
225
,
256
,
0
,
0
,
0
,
0
,
0
,
/* 1270 */
43
,
0
,
0
,
0
,
266
,
38
,
36
,
0
,
270
,
43
,
/* 1270 */
0
,
0
,
0
,
0
,
266
,
82
,
43
,
0
,
270
,
0
,
/* 1280 */
0
,
273
,
36
,
38
,
36
,
38
,
43
,
249
,
38
,
0
,
/* 1280 */
0
,
273
,
36
,
38
,
36
,
38
,
43
,
249
,
51
,
0
,
/* 1290 */
333
,
225
,
43
,
36
,
256
,
43
,
288
,
289
,
290
,
291
,
/* 1290 */
333
,
225
,
43
,
43
,
256
,
38
,
288
,
289
,
290
,
291
,
/* 1300 */
292
,
293
,
0
,
295
,
266
,
0
,
0
,
84
,
270
,
22
,
/* 1300 */
292
,
293
,
0
,
295
,
266
,
43
,
0
,
0
,
270
,
0
,
/* 1310 */
0
,
0
,
38
,
22
,
0
,
249
,
38
,
38
,
0
,
38
,
/* 1310 */
36
,
0
,
22
,
0
,
38
,
249
,
38
,
36
,
0
,
22
,
/* 1320 */
8
2
,
38
,
256
,
38
,
38
,
22
,
288
,
289
,
290
,
291
,
/* 1320 */
8
4
,
38
,
256
,
38
,
72
,
38
,
288
,
289
,
290
,
291
,
/* 1330 */
292
,
293
,
266
,
295
,
38
,
297
,
270
,
3
9
,
22
,
273
,
/* 1330 */
292
,
293
,
266
,
295
,
38
,
297
,
270
,
3
8
,
38
,
273
,
/* 1340 */
225
,
72
,
12
,
13
,
0
,
38
,
22
,
0
,
7
2
,
22
,
/* 1340 */
225
,
38
,
12
,
13
,
0
,
0
,
22
,
39
,
2
2
,
22
,
/* 1350 */
22
,
20
,
22
,
0
,
288
,
289
,
290
,
291
,
292
,
293
,
/* 1350 */
38
,
0
,
22
,
22
,
288
,
289
,
290
,
291
,
292
,
293
,
/* 1360 */
140
,
295
,
0
,
38
,
249
,
38
,
153
,
22
,
38
,
0
,
/* 1360 */
72
,
295
,
0
,
22
,
249
,
38
,
20
,
0
,
38
,
0
,
/* 1370 */
0
,
256
,
0
,
72
,
75
,
43
,
72
,
87
,
225
,
203
,
/* 1370 */
38
,
256
,
153
,
0
,
22
,
137
,
0
,
0
,
225
,
75
,
/* 1380 */
72
,
266
,
203
,
197
,
57
,
270
,
203
,
57
,
273
,
225
,
/* 1380 */
43
,
266
,
72
,
203
,
57
,
270
,
72
,
57
,
273
,
225
,
/* 1390 */
4
,
76
,
75
,
137
,
75
,
140
,
76
,
75
,
135
,
87
,
/* 1390 */
203
,
76
,
72
,
76
,
75
,
197
,
140
,
75
,
135
,
203
,
/* 1400 */
140
,
7
2
,
249
,
288
,
289
,
290
,
291
,
292
,
293
,
256
,
/* 1400 */
140
,
7
6
,
249
,
288
,
289
,
290
,
291
,
292
,
293
,
256
,
/* 1410 */
295
,
76
,
7
5
,
249
,
72
,
76
,
76
,
76
,
72
,
266
,
/* 1410 */
295
,
76
,
7
2
,
249
,
75
,
87
,
87
,
75
,
38
,
266
,
/* 1420 */
256
,
87
,
72
,
270
,
2
,
98
,
38
,
38
,
98
,
38
,
/* 1420 */
256
,
72
,
140
,
270
,
76
,
98
,
72
,
72
,
98
,
76
,
/* 1430 */
266
,
38
,
38
,
38
,
270
,
72
,
76
,
110
,
87
,
225
,
/* 1430 */
266
,
38
,
38
,
38
,
270
,
38
,
38
,
110
,
2
,
225
,
/* 1440 */
110
,
288
,
289
,
290
,
291
,
292
,
293
,
76
,
295
,
75
,
/* 1440 */
110
,
288
,
289
,
290
,
291
,
292
,
293
,
87
,
295
,
75
,
/* 1450 */
7
5
,
169
,
288
,
289
,
290
,
291
,
292
,
293
,
76
,
295
,
/* 1450 */
7
2
,
76
,
288
,
289
,
290
,
291
,
292
,
293
,
76
,
295
,
/* 1460 */
75
,
22
,
75
,
249
,
87
,
171
,
76
,
75
,
0
,
43
,
/* 1460 */
169
,
75
,
75
,
249
,
76
,
75
,
87
,
22
,
87
,
171
,
/* 1470 */
256
,
138
,
76
,
75
,
75
,
148
,
75
,
75
,
148
,
22
,
/* 1470 */
256
,
75
,
138
,
0
,
75
,
148
,
76
,
76
,
148
,
75
,
/* 1480 */
266
,
75
,
85
,
135
,
270
,
76
,
38
,
87
,
38
,
225
,
/* 1480 */
266
,
75
,
43
,
75
,
270
,
135
,
75
,
85
,
22
,
225
,
/* 1490 */
87
,
7
5
,
38
,
86
,
76
,
75
,
169
,
170
,
38
,
169
,
/* 1490 */
87
,
7
6
,
38
,
38
,
87
,
86
,
169
,
170
,
75
,
169
,
/* 1500 */
225
,
76
,
288
,
289
,
290
,
291
,
292
,
293
,
75
,
295
,
/* 1500 */
225
,
76
,
288
,
289
,
290
,
291
,
292
,
293
,
38
,
295
,
/* 1510 */
7
6
,
38
,
75
,
249
,
76
,
38
,
75
,
100
,
22
,
100
,
/* 1510 */
7
5
,
22
,
38
,
249
,
76
,
75
,
38
,
76
,
75
,
38
,
/* 1520 */
256
,
100
,
7
5
,
100
,
249
,
38
,
75
,
75
,
88
,
38
,
/* 1520 */
256
,
100
,
7
6
,
75
,
249
,
88
,
100
,
100
,
100
,
38
,
/* 1530 */
266
,
256
,
22
,
51
,
270
,
50
,
38
,
110
,
57
,
73
,
/* 1530 */
266
,
256
,
75
,
75
,
270
,
75
,
38
,
22
,
51
,
110
,
/* 1540 */
38
,
266
,
72
,
38
,
38
,
270
,
38
,
38
,
225
,
38
,
/* 1540 */
50
,
266
,
38
,
57
,
73
,
270
,
38
,
72
,
225
,
38
,
/* 1550 */
38
,
22
,
288
,
289
,
290
,
291
,
292
,
293
,
57
,
295
,
/* 1550 */
38
,
38
,
288
,
289
,
290
,
291
,
292
,
293
,
38
,
295
,
/* 1560 */
38
,
225
,
4
,
288
,
289
,
290
,
291
,
292
,
293
,
38
,
/* 1560 */
38
,
225
,
4
,
288
,
289
,
290
,
291
,
292
,
293
,
38
,
/* 1570 */
295
,
38
,
249
,
38
,
38
,
38
,
38
,
19
,
38
,
256
,
/* 1570 */
295
,
22
,
249
,
57
,
38
,
38
,
38
,
19
,
38
,
256
,
/* 1580 */
0
,
38
,
36
,
0
,
43
,
249
,
38
,
36
,
43
,
266
,
/* 1580 */
38
,
38
,
38
,
38
,
0
,
249
,
38
,
36
,
0
,
266
,
/* 1590 */
0
,
33
,
256
,
270
,
36
,
38
,
36
,
43
,
0
,
41
,
/* 1590 */
43
,
33
,
256
,
270
,
36
,
38
,
36
,
43
,
0
,
41
,
/* 1600 */
38
,
36
,
266
,
0
,
43
,
47
,
270
,
38
,
3
7
,
0
,
/* 1600 */
38
,
36
,
266
,
0
,
43
,
47
,
270
,
38
,
3
6
,
43
,
/* 1610 */
0
,
288
,
289
,
290
,
291
,
292
,
293
,
22
,
295
,
22
,
/* 1610 */
0
,
288
,
289
,
290
,
291
,
292
,
293
,
38
,
295
,
37
,
/* 1620 */
21
,
2
0
,
22
,
21
,
288
,
289
,
290
,
291
,
292
,
293
,
/* 1620 */
0
,
0
,
22
,
21
,
288
,
289
,
290
,
291
,
292
,
293
,
/* 1630 */
225
,
295
,
74
,
336
,
336
,
77
,
336
,
336
,
336
,
225
,
/* 1630 */
225
,
295
,
74
,
22
,
22
,
77
,
21
,
20
,
336
,
225
,
/* 1640 */
336
,
336
,
336
,
336
,
336
,
336
,
336
,
336
,
336
,
336
,
/* 1640 */
336
,
336
,
336
,
336
,
336
,
336
,
336
,
336
,
336
,
336
,
/* 1650 */
336
,
336
,
336
,
336
,
249
,
336
,
336
,
336
,
336
,
336
,
/* 1650 */
336
,
336
,
336
,
336
,
249
,
336
,
336
,
336
,
336
,
336
,
/* 1660 */
336
,
256
,
336
,
249
,
336
,
336
,
336
,
336
,
336
,
336
,
/* 1660 */
336
,
256
,
336
,
249
,
336
,
336
,
336
,
336
,
336
,
336
,
...
@@ -608,154 +608,154 @@ static const YYCODETYPE yy_lookahead[] = {
...
@@ -608,154 +608,154 @@ static const YYCODETYPE yy_lookahead[] = {
};
};
#define YY_SHIFT_COUNT (571)
#define YY_SHIFT_COUNT (571)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (16
10
)
#define YY_SHIFT_MAX (16
21
)
static
const
unsigned
short
int
yy_shift_ofst
[]
=
{
static
const
unsigned
short
int
yy_shift_ofst
[]
=
{
/* 0 */
831
,
0
,
39
,
214
,
214
,
214
,
214
,
253
,
214
,
214
,
/* 0 */
831
,
0
,
39
,
214
,
214
,
214
,
214
,
253
,
214
,
214
,
/* 10 */
428
,
467
,
642
,
467
,
467
,
467
,
467
,
467
,
467
,
467
,
/* 10 */
428
,
467
,
642
,
467
,
467
,
467
,
467
,
467
,
467
,
467
,
/* 20 */
467
,
467
,
467
,
467
,
467
,
467
,
467
,
467
,
467
,
467
,
/* 20 */
467
,
467
,
467
,
467
,
467
,
467
,
467
,
467
,
467
,
467
,
/* 30 */
467
,
467
,
467
,
467
,
467
,
467
,
71
,
66
,
66
,
66
,
/* 30 */
467
,
467
,
467
,
467
,
467
,
467
,
71
,
383
,
383
,
383
,
/* 40 */
13
3
,
1330
,
1330
,
110
,
38
,
38
,
62
,
1330
,
38
,
38
,
/* 40 */
13
9
,
1330
,
1330
,
110
,
42
,
42
,
29
,
1330
,
348
,
42
,
/* 50 */
38
,
38
,
38
,
38
,
35
,
38
,
142
,
208
,
62
,
298
,
/* 50 */
42
,
42
,
42
,
42
,
42
,
52
,
42
,
98
,
140
,
29
,
/* 60 */
142
,
38
,
38
,
142
,
38
,
142
,
298
,
142
,
142
,
3
8
,
/* 60 */
142
,
98
,
42
,
42
,
98
,
42
,
98
,
142
,
98
,
9
8
,
/* 70 */
331
,
217
,
179
,
393
,
393
,
389
,
1327
,
421
,
187
,
132
7
,
/* 70 */
42
,
193
,
217
,
179
,
393
,
393
,
389
,
1327
,
421
,
18
7
,
/* 80 */
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
/* 80 */
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
/* 90 */
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
220
,
327
,
/* 90 */
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
1327
,
665
,
/* 100 */
3
47
,
347
,
318
,
318
,
318
,
500
,
347
,
347
,
429
,
298
,
/* 100 */
3
27
,
109
,
109
,
360
,
360
,
360
,
667
,
109
,
109
,
312
,
/* 110 */
142
,
298
,
142
,
473
,
509
,
741
,
741
,
741
,
741
,
741
,
/* 110 */
142
,
98
,
142
,
98
,
422
,
345
,
741
,
741
,
741
,
741
,
/* 120 */
741
,
741
,
1000
,
444
,
564
,
480
,
111
,
396
,
120
,
27
,
/* 120 */
741
,
741
,
741
,
1000
,
444
,
564
,
480
,
111
,
396
,
120
,
/* 130 */
663
,
550
,
518
,
660
,
518
,
705
,
592
,
678
,
777
,
918
,
/* 130 */
27
,
681
,
546
,
597
,
342
,
597
,
687
,
478
,
264
,
777
,
/* 140 */
9
11
,
919
,
814
,
918
,
918
,
848
,
837
,
837
,
918
,
960
,
/* 140 */
9
37
,
913
,
931
,
832
,
937
,
937
,
859
,
848
,
848
,
937
,
/* 150 */
35
,
298
,
964
,
35
,
429
,
970
,
35
,
35
,
918
,
35
,
/* 150 */
967
,
52
,
142
,
980
,
52
,
312
,
984
,
52
,
52
,
937
,
/* 160 */
984
,
142
,
142
,
142
,
142
,
142
,
142
,
142
,
142
,
142
,
/* 160 */
52
,
998
,
98
,
98
,
98
,
98
,
98
,
98
,
98
,
98
,
/* 170 */
142
,
142
,
918
,
984
,
969
,
960
,
331
,
888
,
298
,
331
,
/* 170 */
98
,
98
,
98
,
937
,
998
,
975
,
967
,
193
,
898
,
142
,
/* 180 */
964
,
331
,
429
,
970
,
331
,
1037
,
864
,
870
,
969
,
864
,
/* 180 */
193
,
980
,
193
,
312
,
984
,
193
,
1058
,
872
,
878
,
975
,
/* 190 */
87
0
,
969
,
969
,
874
,
876
,
885
,
889
,
893
,
429
,
1073
,
/* 190 */
87
2
,
878
,
975
,
975
,
874
,
877
,
892
,
894
,
899
,
312
,
/* 200 */
973
,
877
,
883
,
887
,
1029
,
142
,
870
,
969
,
969
,
870
,
/* 200 */
1079
,
981
,
880
,
886
,
889
,
1035
,
98
,
878
,
975
,
975
,
/* 210 */
969
,
972
,
429
,
970
,
331
,
473
,
331
,
429
,
1058
,
509
,
/* 210 */
878
,
975
,
989
,
312
,
984
,
193
,
422
,
193
,
312
,
1067
,
/* 220 */
918
,
331
,
984
,
1960
,
1960
,
1960
,
1960
,
1960
,
1960
,
718
,
/* 220 */
345
,
937
,
193
,
998
,
1960
,
1960
,
1960
,
1960
,
1960
,
1960
,
/* 230 */
917
,
329
,
1558
,
47
,
483
,
503
,
272
,
280
,
661
,
734
,
/* 230 */
718
,
917
,
329
,
1558
,
47
,
483
,
503
,
272
,
280
,
661
,
/* 240 */
11
,
11
,
11
,
11
,
11
,
11
,
11
,
11
,
434
,
505
,
/* 240 */
734
,
11
,
11
,
11
,
11
,
11
,
11
,
11
,
11
,
94
,
/* 250 */
196
,
409
,
283
,
283
,
283
,
283
,
739
,
301
,
722
,
71
3
,
/* 250 */
505
,
196
,
409
,
283
,
283
,
283
,
283
,
595
,
571
,
37
3
,
/* 260 */
773
,
774
,
778
,
118
,
510
,
861
,
838
,
645
,
792
,
793
,
/* 260 */
547
,
657
,
774
,
778
,
855
,
858
,
861
,
838
,
645
,
737
,
/* 270 */
79
5
,
884
,
691
,
29
,
669
,
801
,
743
,
808
,
618
,
817
,
/* 270 */
79
2
,
793
,
869
,
691
,
332
,
669
,
806
,
716
,
814
,
754
,
/* 280 */
8
20
,
825
,
827
,
833
,
824
,
832
,
834
,
835
,
847
,
849
,
/* 280 */
8
17
,
820
,
825
,
827
,
830
,
824
,
835
,
833
,
847
,
849
,
/* 290 */
8
73
,
879
,
125
,
897
,
1150
,
1151
,
1089
,
1155
,
1119
,
996
,
/* 290 */
8
66
,
879
,
882
,
125
,
909
,
1161
,
1162
,
1105
,
1171
,
1134
,
/* 300 */
1
124
,
1131
,
1133
,
1007
,
1174
,
1137
,
1139
,
1014
,
1180
,
1143
,
/* 300 */
1
009
,
1137
,
1139
,
1141
,
1015
,
1181
,
1146
,
1148
,
1022
,
1188
,
/* 310 */
11
84
,
1148
,
1187
,
1113
,
1039
,
1041
,
1079
,
1042
,
1194
,
1195
,
/* 310 */
11
51
,
1190
,
1154
,
1191
,
1119
,
1043
,
1045
,
1088
,
1051
,
1201
,
/* 320 */
1
145
,
1052
,
1199
,
1201
,
1116
,
1202
,
1205
,
1207
,
1208
,
1209
,
/* 320 */
1
202
,
1150
,
1061
,
1207
,
1208
,
1122
,
1210
,
1211
,
1212
,
1224
,
/* 330 */
12
10
,
1211
,
1212
,
1224
,
1225
,
1226
,
1228
,
1229
,
1230
,
1231
,
/* 330 */
12
25
,
1226
,
1228
,
1229
,
1230
,
1231
,
1232
,
1234
,
1235
,
1239
,
/* 340 */
12
32
,
1234
,
1093
,
1235
,
1239
,
1241
,
1242
,
1244
,
1251
,
1233
,
/* 340 */
12
41
,
1242
,
1244
,
1093
,
1251
,
1253
,
1254
,
1255
,
1258
,
1259
,
/* 350 */
12
53
,
1254
,
1258
,
1259
,
1261
,
1262
,
1265
,
1266
,
1267
,
1227
,
/* 350 */
12
40
,
1261
,
1265
,
1266
,
1267
,
1268
,
1269
,
1270
,
1271
,
1272
,
/* 360 */
12
68
,
1218
,
1271
,
1272
,
1237
,
1240
,
1236
,
1273
,
1245
,
1246
,
/* 360 */
12
33
,
1273
,
1237
,
1277
,
1279
,
1245
,
1246
,
1243
,
1280
,
1247
,
/* 370 */
124
3
,
1277
,
1247
,
1248
,
1249
,
1280
,
1250
,
1257
,
1252
,
1289
,
/* 370 */
124
8
,
1249
,
1289
,
1257
,
1274
,
1250
,
1302
,
1278
,
1281
,
1262
,
/* 380 */
130
2
,
1305
,
1306
,
1223
,
1238
,
1274
,
1269
,
1276
,
1287
,
131
0
,
/* 380 */
130
6
,
1307
,
1309
,
1311
,
1236
,
1193
,
1276
,
1252
,
1288
,
129
0
,
/* 390 */
1
278
,
1279
,
1281
,
1283
,
1285
,
1269
,
1276
,
1286
,
1296
,
1311
,
/* 390 */
1
313
,
1283
,
1285
,
1287
,
1296
,
1299
,
1252
,
1288
,
1300
,
1303
,
/* 400 */
1
291
,
1314
,
1303
,
1298
,
1318
,
1316
,
1307
,
1344
,
1324
,
1347
,
/* 400 */
1
318
,
1297
,
1344
,
1324
,
1308
,
1345
,
1326
,
1312
,
1351
,
1331
,
/* 410 */
13
28
,
1331
,
1353
,
1220
,
1325
,
1362
,
1213
,
1345
,
1255
,
1256
,
/* 410 */
13
62
,
1341
,
1346
,
1367
,
1256
,
1332
,
1369
,
1219
,
1352
,
1260
,
/* 420 */
1
369
,
1370
,
1260
,
1372
,
1299
,
1332
,
1263
,
1301
,
1304
,
1176
,
/* 420 */
1
238
,
1373
,
1376
,
1282
,
1377
,
1304
,
1337
,
1263
,
1310
,
1314
,
/* 430 */
1
315
,
1308
,
1320
,
1317
,
1319
,
1322
,
1335
,
1329
,
1290
,
1337
,
/* 430 */
1
180
,
1315
,
1320
,
1317
,
1319
,
1322
,
1339
,
1325
,
1340
,
1328
,
/* 440 */
1342
,
1
179
,
1339
,
1340
,
1312
,
1186
,
1346
,
1334
,
1341
,
1350
,
/* 440 */
1342
,
1
349
,
1187
,
1335
,
1348
,
1329
,
1198
,
1354
,
1360
,
1353
,
/* 450 */
1
183
,
1386
,
1388
,
1389
,
1391
,
1393
,
1394
,
1395
,
1422
,
1282
,
/* 450 */
1
355
,
1196
,
1380
,
1393
,
1394
,
1395
,
1397
,
1398
,
1436
,
1291
,
/* 460 */
13
63
,
1360
,
1374
,
1371
,
1375
,
1382
,
1351
,
1385
,
1387
,
1377
,
/* 460 */
13
78
,
1375
,
1374
,
1382
,
1386
,
1388
,
1379
,
1387
,
1390
,
1381
,
/* 470 */
14
39
,
1294
,
1392
,
1390
,
1396
,
1398
,
1399
,
1333
,
1401
,
1468
,
/* 470 */
14
45
,
1298
,
1396
,
1400
,
1401
,
1399
,
1404
,
1334
,
1406
,
1473
,
/* 480 */
14
26
,
1348
,
1402
,
1397
,
1400
,
1403
,
1457
,
1406
,
1407
,
1409
,
/* 480 */
14
39
,
1350
,
1408
,
1402
,
1403
,
1407
,
1466
,
1411
,
1409
,
1415
,
/* 490 */
14
48
,
1450
,
1416
,
1418
,
1454
,
1420
,
1425
,
1460
,
1433
,
1434
,
/* 490 */
14
54
,
1455
,
1423
,
1425
,
1470
,
1435
,
1438
,
1474
,
1440
,
1441
,
/* 500 */
147
3
,
1437
,
1438
,
1477
,
1441
,
1417
,
1419
,
1421
,
1423
,
1496
,
/* 500 */
147
8
,
1443
,
1446
,
1481
,
1448
,
1421
,
1426
,
1427
,
1428
,
1489
,
/* 510 */
14
40
,
1447
,
1487
,
1427
,
1451
,
1452
,
1491
,
1269
,
1276
,
1510
,
/* 510 */
14
37
,
1457
,
1491
,
1429
,
1458
,
1460
,
1498
,
1252
,
1288
,
1515
,
/* 520 */
148
2
,
1485
,
1498
,
1481
,
1466
,
1470
,
1502
,
1505
,
1506
,
1508
,
/* 520 */
148
7
,
1490
,
1504
,
1486
,
1471
,
1475
,
1508
,
1511
,
1512
,
1513
,
/* 530 */
15
09
,
1511
,
1512
,
1529
,
1501
,
1269
,
1522
,
1276
,
1531
,
1533
,
/* 530 */
15
20
,
1522
,
1531
,
1549
,
1516
,
1252
,
1536
,
1288
,
1537
,
1538
,
/* 540 */
15
35
,
1536
,
1537
,
1538
,
1540
,
1580
,
1543
,
1546
,
1541
,
1583
,
/* 540 */
15
40
,
1542
,
1543
,
1544
,
1545
,
1584
,
1548
,
1551
,
1547
,
1588
,
/* 550 */
15
48
,
1551
,
1545
,
1590
,
1557
,
1560
,
1554
,
1598
,
1562
,
1565
,
/* 550 */
15
57
,
1560
,
1554
,
1598
,
1562
,
1565
,
1561
,
1603
,
1569
,
1572
,
/* 560 */
156
1
,
1603
,
1569
,
1571
,
1609
,
1610
,
1595
,
1599
,
1597
,
1600
,
/* 560 */
156
6
,
1610
,
1579
,
1582
,
1620
,
1621
,
1600
,
1602
,
1611
,
1612
,
/* 570 */
16
02
,
1601
,
/* 570 */
16
15
,
1617
,
};
};
#define YY_REDUCE_COUNT (22
8
)
#define YY_REDUCE_COUNT (22
9
)
#define YY_REDUCE_MIN (-2
6
3)
#define YY_REDUCE_MIN (-2
7
3)
#define YY_REDUCE_MAX (1664)
#define YY_REDUCE_MAX (1664)
static
const
short
yy_reduce_ofst
[]
=
{
static
const
short
yy_reduce_ofst
[]
=
{
/* 0 */
-
212
,
-
210
,
-
159
,
368
,
13
,
265
,
440
,
625
,
638
,
719
,
/* 0 */
-
212
,
-
210
,
-
159
,
368
,
13
,
265
,
440
,
625
,
638
,
719
,
/* 10 */
771
,
826
,
875
,
927
,
-
221
,
957
,
1008
,
1038
,
1066
,
1115
,
/* 10 */
771
,
826
,
875
,
927
,
-
221
,
957
,
1008
,
1038
,
1066
,
1115
,
/* 20 */
1153
,
1164
,
1214
,
1264
,
1275
,
1323
,
1336
,
1405
,
1414
,
1464
,
/* 20 */
1153
,
1164
,
1214
,
1264
,
1275
,
1323
,
1336
,
1405
,
1414
,
1464
,
/* 30 */
1514
,
1525
,
1573
,
1586
,
1655
,
1664
,
929
,
-
183
,
-
104
,
453
,
/* 30 */
1514
,
1525
,
1573
,
1586
,
1655
,
1664
,
929
,
-
183
,
-
104
,
453
,
/* 40 */
-
125
,
-
253
,
-
251
,
-
211
,
-
226
,
266
,
50
,
-
241
,
-
118
,
-
89
,
/* 40 */
-
125
,
-
253
,
-
251
,
-
211
,
-
226
,
266
,
50
,
-
241
,
-
273
,
-
118
,
/* 50 */
222
,
267
,
294
,
306
,
-
192
,
438
,
-
59
,
-
248
,
51
,
-
263
,
/* 50 */
-
89
,
222
,
267
,
294
,
306
,
-
93
,
438
,
-
59
,
-
248
,
51
,
/* 60 */
206
,
448
,
471
,
-
6
,
481
,
210
,
-
171
,
281
,
271
,
452
,
/* 60 */
-
263
,
206
,
448
,
471
,
-
6
,
481
,
210
,
-
171
,
281
,
271
,
/* 70 */
-
83
,
-
224
,
-
200
,
-
200
,
-
200
,
-
208
,
82
,
-
88
,
-
198
,
154
,
/* 70 */
452
,
16
,
-
224
,
-
200
,
-
200
,
-
200
,
-
208
,
154
,
59
,
-
198
,
/* 80 */
221
,
263
,
304
,
398
,
456
,
488
,
489
,
495
,
497
,
498
,
/* 80 */
221
,
263
,
304
,
398
,
456
,
488
,
489
,
495
,
497
,
498
,
/* 90 */
499
,
526
,
529
,
530
,
532
,
538
,
578
,
581
,
174
,
-
178
,
/* 90 */
499
,
526
,
529
,
530
,
532
,
538
,
578
,
581
,
582
,
183
,
/* 100 */
32
,
176
,
-
10
,
4
,
289
,
322
,
397
,
451
,
-
97
,
188
,
/* 100 */
-
178
,
275
,
316
,
-
10
,
4
,
289
,
10
,
397
,
462
,
276
,
/* 110 */
290
,
432
,
291
,
-
12
,
392
,
-
239
,
376
,
417
,
445
,
457
,
/* 110 */
188
,
433
,
527
,
310
,
-
12
,
-
153
,
-
239
,
323
,
445
,
475
,
/* 120 */
484
,
486
,
478
,
540
,
571
,
479
,
504
,
582
,
600
,
579
,
/* 120 */
506
,
525
,
548
,
589
,
658
,
660
,
573
,
585
,
652
,
630
,
/* 130 */
6
62
,
615
,
610
,
610
,
610
,
675
,
604
,
622
,
675
,
715
,
/* 130 */
6
03
,
696
,
648
,
620
,
620
,
620
,
688
,
618
,
633
,
688
,
/* 140 */
665
,
723
,
689
,
735
,
736
,
706
,
716
,
717
,
746
,
702
,
/* 140 */
729
,
682
,
732
,
694
,
740
,
746
,
715
,
721
,
722
,
755
,
/* 150 */
7
50
,
720
,
714
,
754
,
744
,
725
,
768
,
769
,
772
,
780
,
/* 150 */
7
08
,
757
,
726
,
727
,
769
,
747
,
738
,
773
,
780
,
784
,
/* 160 */
7
79
,
756
,
766
,
767
,
775
,
776
,
782
,
783
,
785
,
786
,
/* 160 */
7
83
,
796
,
775
,
776
,
779
,
782
,
785
,
786
,
789
,
790
,
/* 170 */
7
89
,
790
,
787
,
796
,
758
,
749
,
810
,
770
,
784
,
818
,
/* 170 */
7
91
,
794
,
799
,
795
,
802
,
787
,
770
,
819
,
797
,
803
,
/* 180 */
781
,
823
,
802
,
803
,
839
,
791
,
748
,
809
,
811
,
755
,
/* 180 */
828
,
781
,
840
,
815
,
805
,
850
,
798
,
759
,
810
,
816
,
/* 190 */
812
,
815
,
816
,
763
,
788
,
794
,
805
,
610
,
841
,
813
,
/* 190 */
763
,
818
,
821
,
823
,
788
,
800
,
804
,
808
,
620
,
842
,
/* 200 */
797
,
760
,
798
,
800
,
804
,
675
,
840
,
836
,
843
,
852
,
/* 200 */
822
,
801
,
768
,
807
,
809
,
811
,
688
,
852
,
841
,
843
,
/* 210 */
85
0
,
842
,
869
,
859
,
900
,
882
,
902
,
878
,
886
,
896
,
/* 210 */
85
6
,
860
,
864
,
873
,
867
,
903
,
883
,
905
,
884
,
891
,
/* 220 */
90
6
,
910
,
915
,
866
,
863
,
903
,
904
,
916
,
926
,
/* 220 */
90
7
,
916
,
914
,
921
,
876
,
868
,
908
,
912
,
918
,
934
,
};
};
static
const
YYACTIONTYPE
yy_default
[]
=
{
static
const
YYACTIONTYPE
yy_default
[]
=
{
/* 0 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 0 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 10 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 10 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 20 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 20 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 30 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 30 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 40 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 40 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 50 */
128
5
,
1285
,
1285
,
1285
,
1344
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 50 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1346
,
1287
,
1287
,
1287
,
1287
,
/* 60 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 60 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 70 */
1
342
,
1487
,
1285
,
1643
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 70 */
1
287
,
1344
,
1489
,
1287
,
1645
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 80 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 80 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 90 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1344
,
/* 90 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 100 */
1
285
,
1285
,
1654
,
1654
,
1654
,
1342
,
1285
,
1285
,
1285
,
1285
,
/* 100 */
1
346
,
1287
,
1287
,
1656
,
1656
,
1656
,
1344
,
1287
,
1287
,
1287
,
/* 110 */
128
5
,
1285
,
1285
,
1439
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 110 */
128
7
,
1287
,
1287
,
1287
,
1441
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 120 */
128
5
,
1285
,
1521
,
1285
,
1285
,
1718
,
1285
,
1392
,
1527
,
1678
,
/* 120 */
128
7
,
1287
,
1287
,
1523
,
1287
,
1287
,
1721
,
1287
,
1394
,
1529
,
/* 130 */
1
285
,
1670
,
1646
,
1660
,
1647
,
1285
,
1703
,
1663
,
1285
,
1285
,
/* 130 */
1
680
,
1287
,
1672
,
1648
,
1662
,
1649
,
1287
,
1706
,
1665
,
1287
,
/* 140 */
128
5
,
1285
,
1513
,
1285
,
1285
,
1492
,
1489
,
1489
,
1285
,
1285
,
/* 140 */
128
7
,
1287
,
1287
,
1515
,
1287
,
1287
,
1494
,
1491
,
1491
,
1287
,
/* 150 */
1
344
,
1285
,
1285
,
1344
,
1285
,
1285
,
1344
,
1344
,
1285
,
1344
,
/* 150 */
1
287
,
1346
,
1287
,
1287
,
1346
,
1287
,
1287
,
1346
,
1346
,
1287
,
/* 160 */
1
285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 160 */
1
346
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 170 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1342
,
1523
,
1285
,
1342
,
/* 170 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1344
,
1525
,
1287
,
/* 180 */
1
285
,
1342
,
1285
,
1285
,
1342
,
1285
,
1685
,
1683
,
1285
,
1685
,
/* 180 */
1
344
,
1287
,
1344
,
1287
,
1287
,
1344
,
1287
,
1687
,
1685
,
1287
,
/* 190 */
168
3
,
1285
,
1285
,
1697
,
1693
,
1676
,
1674
,
1660
,
1285
,
1285
,
/* 190 */
168
7
,
1685
,
1287
,
1287
,
1699
,
1695
,
1678
,
1676
,
1662
,
1287
,
/* 200 */
128
5
,
1721
,
1709
,
1705
,
1285
,
1285
,
1683
,
1285
,
1285
,
1683
,
/* 200 */
128
7
,
1287
,
1724
,
1712
,
1708
,
1287
,
1287
,
1685
,
1287
,
1287
,
/* 210 */
1
285
,
1500
,
1285
,
1285
,
1342
,
1285
,
1342
,
1285
,
1408
,
1285
,
/* 210 */
1
685
,
1287
,
1502
,
1287
,
1287
,
1344
,
1287
,
1344
,
1287
,
1410
,
/* 220 */
128
5
,
1342
,
1285
,
1515
,
1529
,
1442
,
1442
,
1345
,
1290
,
1285
,
/* 220 */
128
7
,
1287
,
1344
,
1287
,
1517
,
1531
,
1444
,
1444
,
1347
,
1292
,
/* 230 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 230 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 240 */
1
590
,
1696
,
1695
,
1619
,
1618
,
1617
,
1615
,
1589
,
1285
,
1285
,
/* 240 */
1
287
,
1592
,
1698
,
1697
,
1621
,
1620
,
1619
,
1617
,
1591
,
1287
,
/* 250 */
128
5
,
1285
,
1583
,
1584
,
1582
,
1581
,
1285
,
1285
,
1285
,
1285
,
/* 250 */
128
7
,
1287
,
1287
,
1585
,
1586
,
1584
,
1583
,
1287
,
1287
,
1287
,
/* 260 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 260 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 270 */
128
5
,
1644
,
1285
,
1706
,
1710
,
1285
,
1285
,
1285
,
1567
,
1285
,
/* 270 */
128
7
,
1287
,
1646
,
1287
,
1709
,
1713
,
1287
,
1287
,
1287
,
1569
,
/* 280 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 280 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 290 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 290 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 300 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 300 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 310 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 310 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 320 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 320 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 330 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 330 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 340 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 340 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 350 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 350 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 360 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 360 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 370 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 370 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 380 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1455
,
1454
,
1285
,
1285
,
/* 380 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1457
,
1456
,
1287
,
/* 390 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1372
,
1371
,
1285
,
1285
,
1285
,
/* 390 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1374
,
1373
,
1287
,
1287
,
/* 400 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 400 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 410 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 410 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 420 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1667
,
1677
,
1285
,
/* 420 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1669
,
1679
,
/* 430 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1567
,
1285
,
/* 430 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1569
,
/* 440 */
1
694
,
1285
,
1653
,
1649
,
1285
,
1285
,
1645
,
1285
,
1285
,
1704
,
/* 440 */
1
287
,
1696
,
1287
,
1655
,
1651
,
1287
,
1287
,
1647
,
1287
,
1287
,
/* 450 */
1
285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1639
,
1285
,
/* 450 */
1
707
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1641
,
1287
,
/* 460 */
161
2
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 460 */
161
4
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 470 */
128
5
,
1577
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 470 */
128
7
,
1579
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 480 */
128
5
,
1285
,
1285
,
1285
,
1566
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 480 */
128
7
,
1287
,
1287
,
1287
,
1568
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 490 */
128
5
,
1285
,
1436
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 490 */
128
7
,
1287
,
1438
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 500 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1421
,
1419
,
1418
,
1417
,
1285
,
/* 500 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1423
,
1421
,
1420
,
1419
,
1287
,
/* 510 */
141
4
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1445
,
1444
,
1285
,
/* 510 */
141
6
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1447
,
1446
,
1287
,
/* 520 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1365
,
1285
,
1285
,
1285
,
1285
,
/* 520 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1367
,
1287
,
1287
,
1287
,
1287
,
/* 530 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1356
,
1285
,
1355
,
1285
,
1285
,
/* 530 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1358
,
1287
,
1357
,
1287
,
1287
,
/* 540 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 540 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 550 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 550 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 560 */
128
5
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
1285
,
/* 560 */
128
7
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
1287
,
/* 570 */
128
5
,
1285
,
/* 570 */
128
7
,
1287
,
};
};
/********** End of lemon-generated parsing tables *****************************/
/********** End of lemon-generated parsing tables *****************************/
...
@@ -1619,28 +1619,29 @@ static const char *const yyRuleName[] = {
...
@@ -1619,28 +1619,29 @@ static const char *const yyRuleName[] = {
/* 411 */
"query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt"
,
/* 411 */
"query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt"
,
/* 412 */
"query_expression_body ::= query_primary"
,
/* 412 */
"query_expression_body ::= query_primary"
,
/* 413 */
"query_expression_body ::= query_expression_body UNION ALL query_expression_body"
,
/* 413 */
"query_expression_body ::= query_expression_body UNION ALL query_expression_body"
,
/* 414 */
"query_primary ::= query_specification"
,
/* 414 */
"query_expression_body ::= query_expression_body UNION query_expression_body"
,
/* 415 */
"order_by_clause_opt ::="
,
/* 415 */
"query_primary ::= query_specification"
,
/* 416 */
"order_by_clause_opt ::= ORDER BY sort_specification_list"
,
/* 416 */
"order_by_clause_opt ::="
,
/* 417 */
"slimit_clause_opt ::="
,
/* 417 */
"order_by_clause_opt ::= ORDER BY sort_specification_list"
,
/* 418 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER"
,
/* 418 */
"slimit_clause_opt ::="
,
/* 419 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER"
,
/* 419 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER"
,
/* 420 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER"
,
/* 420 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER"
,
/* 421 */
"limit_clause_opt ::="
,
/* 421 */
"slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER"
,
/* 422 */
"limit_clause_opt ::= LIMIT NK_INTEGER"
,
/* 422 */
"limit_clause_opt ::="
,
/* 423 */
"limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER"
,
/* 423 */
"limit_clause_opt ::= LIMIT NK_INTEGER"
,
/* 424 */
"limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER"
,
/* 424 */
"limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER"
,
/* 425 */
"subquery ::= NK_LP query_expression NK_RP"
,
/* 425 */
"limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER"
,
/* 426 */
"search_condition ::= common_expression"
,
/* 426 */
"subquery ::= NK_LP query_expression NK_RP"
,
/* 427 */
"sort_specification_list ::= sort_specification"
,
/* 427 */
"search_condition ::= common_expression"
,
/* 428 */
"sort_specification_list ::= sort_specification_list NK_COMMA sort_specification"
,
/* 428 */
"sort_specification_list ::= sort_specification"
,
/* 429 */
"sort_specification ::= expression ordering_specification_opt null_ordering_opt"
,
/* 429 */
"sort_specification_list ::= sort_specification_list NK_COMMA sort_specification"
,
/* 430 */
"ordering_specification_opt ::="
,
/* 430 */
"sort_specification ::= expression ordering_specification_opt null_ordering_opt"
,
/* 431 */
"ordering_specification_opt ::= ASC"
,
/* 431 */
"ordering_specification_opt ::="
,
/* 432 */
"ordering_specification_opt ::= DESC"
,
/* 432 */
"ordering_specification_opt ::= ASC"
,
/* 433 */
"null_ordering_opt ::="
,
/* 433 */
"ordering_specification_opt ::= DESC"
,
/* 434 */
"null_ordering_opt ::= NULLS FIRST"
,
/* 434 */
"null_ordering_opt ::="
,
/* 435 */
"null_ordering_opt ::= NULLS LAST"
,
/* 435 */
"null_ordering_opt ::= NULLS FIRST"
,
/* 436 */
"null_ordering_opt ::= NULLS LAST"
,
};
};
#endif
/* NDEBUG */
#endif
/* NDEBUG */
...
@@ -2637,28 +2638,29 @@ static const struct {
...
@@ -2637,28 +2638,29 @@ static const struct {
{
275
,
-
4
},
/* (411) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
275
,
-
4
},
/* (411) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */
{
327
,
-
1
},
/* (412) query_expression_body ::= query_primary */
{
327
,
-
1
},
/* (412) query_expression_body ::= query_primary */
{
327
,
-
4
},
/* (413) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{
327
,
-
4
},
/* (413) query_expression_body ::= query_expression_body UNION ALL query_expression_body */
{
331
,
-
1
},
/* (414) query_primary ::= query_specification */
{
327
,
-
3
},
/* (414) query_expression_body ::= query_expression_body UNION query_expression_body */
{
328
,
0
},
/* (415) order_by_clause_opt ::= */
{
331
,
-
1
},
/* (415) query_primary ::= query_specification */
{
328
,
-
3
},
/* (416) order_by_clause_opt ::= ORDER BY sort_specification_list */
{
328
,
0
},
/* (416) order_by_clause_opt ::= */
{
329
,
0
},
/* (417) slimit_clause_opt ::= */
{
328
,
-
3
},
/* (417) order_by_clause_opt ::= ORDER BY sort_specification_list */
{
329
,
-
2
},
/* (418) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{
329
,
0
},
/* (418) slimit_clause_opt ::= */
{
329
,
-
4
},
/* (419) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{
329
,
-
2
},
/* (419) slimit_clause_opt ::= SLIMIT NK_INTEGER */
{
329
,
-
4
},
/* (420) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{
329
,
-
4
},
/* (420) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
{
330
,
0
},
/* (421) limit_clause_opt ::= */
{
329
,
-
4
},
/* (421) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{
330
,
-
2
},
/* (422) limit_clause_opt ::= LIMIT NK_INTEGER */
{
330
,
0
},
/* (422) limit_clause_opt ::= */
{
330
,
-
4
},
/* (423) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{
330
,
-
2
},
/* (423) limit_clause_opt ::= LIMIT NK_INTEGER */
{
330
,
-
4
},
/* (424) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{
330
,
-
4
},
/* (424) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
{
292
,
-
3
},
/* (425) subquery ::= NK_LP query_expression NK_RP */
{
330
,
-
4
},
/* (425) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
{
313
,
-
1
},
/* (426) search_condition ::= common_expression */
{
292
,
-
3
},
/* (426) subquery ::= NK_LP query_expression NK_RP */
{
332
,
-
1
},
/* (427) sort_specification_list ::= sort_specification */
{
313
,
-
1
},
/* (427) search_condition ::= common_expression */
{
332
,
-
3
},
/* (428) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{
332
,
-
1
},
/* (428) sort_specification_list ::= sort_specification */
{
333
,
-
3
},
/* (429) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{
332
,
-
3
},
/* (429) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
{
334
,
0
},
/* (430) ordering_specification_opt ::= */
{
333
,
-
3
},
/* (430) sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{
334
,
-
1
},
/* (431) ordering_specification_opt ::= ASC */
{
334
,
0
},
/* (431) ordering_specification_opt ::= */
{
334
,
-
1
},
/* (432) ordering_specification_opt ::= DESC */
{
334
,
-
1
},
/* (432) ordering_specification_opt ::= ASC */
{
335
,
0
},
/* (433) null_ordering_opt ::= */
{
334
,
-
1
},
/* (433) ordering_specification_opt ::= DESC */
{
335
,
-
2
},
/* (434) null_ordering_opt ::= NULLS FIRST */
{
335
,
0
},
/* (434) null_ordering_opt ::= */
{
335
,
-
2
},
/* (435) null_ordering_opt ::= NULLS LAST */
{
335
,
-
2
},
/* (435) null_ordering_opt ::= NULLS FIRST */
{
335
,
-
2
},
/* (436) null_ordering_opt ::= NULLS LAST */
};
};
static
void
yy_accept
(
yyParser
*
);
/* Forward Declaration */
static
void
yy_accept
(
yyParser
*
);
/* Forward Declaration */
...
@@ -3052,7 +3054,7 @@ static YYACTIONTYPE yy_reduce(
...
@@ -3052,7 +3054,7 @@ static YYACTIONTYPE yy_reduce(
case
275
:
/* literal_list ::= signed_literal */
yytestcase
(
yyruleno
==
275
);
case
275
:
/* literal_list ::= signed_literal */
yytestcase
(
yyruleno
==
275
);
case
325
:
/* other_para_list ::= star_func_para */
yytestcase
(
yyruleno
==
325
);
case
325
:
/* other_para_list ::= star_func_para */
yytestcase
(
yyruleno
==
325
);
case
380
:
/* select_sublist ::= select_item */
yytestcase
(
yyruleno
==
380
);
case
380
:
/* select_sublist ::= select_item */
yytestcase
(
yyruleno
==
380
);
case
42
7
:
/* sort_specification_list ::= sort_specification */
yytestcase
(
yyruleno
==
427
);
case
42
8
:
/* sort_specification_list ::= sort_specification */
yytestcase
(
yyruleno
==
428
);
{
yylhsminor
.
yy376
=
createNodeList
(
pCxt
,
yymsp
[
0
].
minor
.
yy392
);
}
{
yylhsminor
.
yy376
=
createNodeList
(
pCxt
,
yymsp
[
0
].
minor
.
yy392
);
}
yymsp
[
0
].
minor
.
yy376
=
yylhsminor
.
yy376
;
yymsp
[
0
].
minor
.
yy376
=
yylhsminor
.
yy376
;
break
;
break
;
...
@@ -3064,7 +3066,7 @@ static YYACTIONTYPE yy_reduce(
...
@@ -3064,7 +3066,7 @@ static YYACTIONTYPE yy_reduce(
case
276
:
/* literal_list ::= literal_list NK_COMMA signed_literal */
yytestcase
(
yyruleno
==
276
);
case
276
:
/* literal_list ::= literal_list NK_COMMA signed_literal */
yytestcase
(
yyruleno
==
276
);
case
326
:
/* other_para_list ::= other_para_list NK_COMMA star_func_para */
yytestcase
(
yyruleno
==
326
);
case
326
:
/* other_para_list ::= other_para_list NK_COMMA star_func_para */
yytestcase
(
yyruleno
==
326
);
case
381
:
/* select_sublist ::= select_sublist NK_COMMA select_item */
yytestcase
(
yyruleno
==
381
);
case
381
:
/* select_sublist ::= select_sublist NK_COMMA select_item */
yytestcase
(
yyruleno
==
381
);
case
42
8
:
/* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
yytestcase
(
yyruleno
==
428
);
case
42
9
:
/* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */
yytestcase
(
yyruleno
==
429
);
{
yylhsminor
.
yy376
=
addNodeToList
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy376
,
yymsp
[
0
].
minor
.
yy392
);
}
{
yylhsminor
.
yy376
=
addNodeToList
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy376
,
yymsp
[
0
].
minor
.
yy392
);
}
yymsp
[
-
2
].
minor
.
yy376
=
yylhsminor
.
yy376
;
yymsp
[
-
2
].
minor
.
yy376
=
yylhsminor
.
yy376
;
break
;
break
;
...
@@ -3147,7 +3149,7 @@ static YYACTIONTYPE yy_reduce(
...
@@ -3147,7 +3149,7 @@ static YYACTIONTYPE yy_reduce(
case
151
:
/* tags_def_opt ::= */
yytestcase
(
yyruleno
==
151
);
case
151
:
/* tags_def_opt ::= */
yytestcase
(
yyruleno
==
151
);
case
388
:
/* partition_by_clause_opt ::= */
yytestcase
(
yyruleno
==
388
);
case
388
:
/* partition_by_clause_opt ::= */
yytestcase
(
yyruleno
==
388
);
case
405
:
/* group_by_clause_opt ::= */
yytestcase
(
yyruleno
==
405
);
case
405
:
/* group_by_clause_opt ::= */
yytestcase
(
yyruleno
==
405
);
case
41
5
:
/* order_by_clause_opt ::= */
yytestcase
(
yyruleno
==
415
);
case
41
6
:
/* order_by_clause_opt ::= */
yytestcase
(
yyruleno
==
416
);
{
yymsp
[
1
].
minor
.
yy376
=
NULL
;
}
{
yymsp
[
1
].
minor
.
yy376
=
NULL
;
}
break
;
break
;
case
121
:
/* specific_tags_opt ::= NK_LP col_name_list NK_RP */
case
121
:
/* specific_tags_opt ::= NK_LP col_name_list NK_RP */
...
@@ -3394,8 +3396,8 @@ static YYACTIONTYPE yy_reduce(
...
@@ -3394,8 +3396,8 @@ static YYACTIONTYPE yy_reduce(
case
395
:
/* sliding_opt ::= */
yytestcase
(
yyruleno
==
395
);
case
395
:
/* sliding_opt ::= */
yytestcase
(
yyruleno
==
395
);
case
397
:
/* fill_opt ::= */
yytestcase
(
yyruleno
==
397
);
case
397
:
/* fill_opt ::= */
yytestcase
(
yyruleno
==
397
);
case
409
:
/* having_clause_opt ::= */
yytestcase
(
yyruleno
==
409
);
case
409
:
/* having_clause_opt ::= */
yytestcase
(
yyruleno
==
409
);
case
41
7
:
/* slimit_clause_opt ::= */
yytestcase
(
yyruleno
==
417
);
case
41
8
:
/* slimit_clause_opt ::= */
yytestcase
(
yyruleno
==
418
);
case
42
1
:
/* limit_clause_opt ::= */
yytestcase
(
yyruleno
==
421
);
case
42
2
:
/* limit_clause_opt ::= */
yytestcase
(
yyruleno
==
422
);
{
yymsp
[
1
].
minor
.
yy392
=
NULL
;
}
{
yymsp
[
1
].
minor
.
yy392
=
NULL
;
}
break
;
break
;
case
202
:
/* like_pattern_opt ::= LIKE NK_STRING */
case
202
:
/* like_pattern_opt ::= LIKE NK_STRING */
...
@@ -3565,7 +3567,7 @@ static YYACTIONTYPE yy_reduce(
...
@@ -3565,7 +3567,7 @@ static YYACTIONTYPE yy_reduce(
case
361
:
/* table_reference ::= joined_table */
yytestcase
(
yyruleno
==
361
);
case
361
:
/* table_reference ::= joined_table */
yytestcase
(
yyruleno
==
361
);
case
365
:
/* table_primary ::= parenthesized_joined_table */
yytestcase
(
yyruleno
==
365
);
case
365
:
/* table_primary ::= parenthesized_joined_table */
yytestcase
(
yyruleno
==
365
);
case
412
:
/* query_expression_body ::= query_primary */
yytestcase
(
yyruleno
==
412
);
case
412
:
/* query_expression_body ::= query_primary */
yytestcase
(
yyruleno
==
412
);
case
41
4
:
/* query_primary ::= query_specification */
yytestcase
(
yyruleno
==
414
);
case
41
5
:
/* query_primary ::= query_specification */
yytestcase
(
yyruleno
==
415
);
{
yylhsminor
.
yy392
=
yymsp
[
0
].
minor
.
yy392
;
}
{
yylhsminor
.
yy392
=
yymsp
[
0
].
minor
.
yy392
;
}
yymsp
[
0
].
minor
.
yy392
=
yylhsminor
.
yy392
;
yymsp
[
0
].
minor
.
yy392
=
yylhsminor
.
yy392
;
break
;
break
;
...
@@ -3625,7 +3627,7 @@ static YYACTIONTYPE yy_reduce(
...
@@ -3625,7 +3627,7 @@ static YYACTIONTYPE yy_reduce(
case
273
:
/* signed_literal ::= duration_literal */
case
273
:
/* signed_literal ::= duration_literal */
case
327
:
/* star_func_para ::= expression */
yytestcase
(
yyruleno
==
327
);
case
327
:
/* star_func_para ::= expression */
yytestcase
(
yyruleno
==
327
);
case
382
:
/* select_item ::= common_expression */
yytestcase
(
yyruleno
==
382
);
case
382
:
/* select_item ::= common_expression */
yytestcase
(
yyruleno
==
382
);
case
42
6
:
/* search_condition ::= common_expression */
yytestcase
(
yyruleno
==
426
);
case
42
7
:
/* search_condition ::= common_expression */
yytestcase
(
yyruleno
==
427
);
{
yylhsminor
.
yy392
=
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy392
);
}
{
yylhsminor
.
yy392
=
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy392
);
}
yymsp
[
0
].
minor
.
yy392
=
yylhsminor
.
yy392
;
yymsp
[
0
].
minor
.
yy392
=
yylhsminor
.
yy392
;
break
;
break
;
...
@@ -3917,7 +3919,7 @@ static YYACTIONTYPE yy_reduce(
...
@@ -3917,7 +3919,7 @@ static YYACTIONTYPE yy_reduce(
break
;
break
;
case
389
:
/* partition_by_clause_opt ::= PARTITION BY expression_list */
case
389
:
/* partition_by_clause_opt ::= PARTITION BY expression_list */
case
406
:
/* group_by_clause_opt ::= GROUP BY group_by_list */
yytestcase
(
yyruleno
==
406
);
case
406
:
/* group_by_clause_opt ::= GROUP BY group_by_list */
yytestcase
(
yyruleno
==
406
);
case
41
6
:
/* order_by_clause_opt ::= ORDER BY sort_specification_list */
yytestcase
(
yyruleno
==
416
);
case
41
7
:
/* order_by_clause_opt ::= ORDER BY sort_specification_list */
yytestcase
(
yyruleno
==
417
);
{
yymsp
[
-
2
].
minor
.
yy376
=
yymsp
[
0
].
minor
.
yy376
;
}
{
yymsp
[
-
2
].
minor
.
yy376
=
yymsp
[
0
].
minor
.
yy376
;
}
break
;
break
;
case
391
:
/* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
case
391
:
/* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */
...
@@ -3976,42 +3978,46 @@ static YYACTIONTYPE yy_reduce(
...
@@ -3976,42 +3978,46 @@ static YYACTIONTYPE yy_reduce(
{
yylhsminor
.
yy392
=
createSetOperator
(
pCxt
,
SET_OP_TYPE_UNION_ALL
,
yymsp
[
-
3
].
minor
.
yy392
,
yymsp
[
0
].
minor
.
yy392
);
}
{
yylhsminor
.
yy392
=
createSetOperator
(
pCxt
,
SET_OP_TYPE_UNION_ALL
,
yymsp
[
-
3
].
minor
.
yy392
,
yymsp
[
0
].
minor
.
yy392
);
}
yymsp
[
-
3
].
minor
.
yy392
=
yylhsminor
.
yy392
;
yymsp
[
-
3
].
minor
.
yy392
=
yylhsminor
.
yy392
;
break
;
break
;
case
418
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case
414
:
/* query_expression_body ::= query_expression_body UNION query_expression_body */
case
422
:
/* limit_clause_opt ::= LIMIT NK_INTEGER */
yytestcase
(
yyruleno
==
422
);
{
yylhsminor
.
yy392
=
createSetOperator
(
pCxt
,
SET_OP_TYPE_UNION
,
yymsp
[
-
2
].
minor
.
yy392
,
yymsp
[
0
].
minor
.
yy392
);
}
yymsp
[
-
2
].
minor
.
yy392
=
yylhsminor
.
yy392
;
break
;
case
419
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER */
case
423
:
/* limit_clause_opt ::= LIMIT NK_INTEGER */
yytestcase
(
yyruleno
==
423
);
{
yymsp
[
-
1
].
minor
.
yy392
=
createLimitNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
NULL
);
}
{
yymsp
[
-
1
].
minor
.
yy392
=
createLimitNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
NULL
);
}
break
;
break
;
case
4
19
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case
4
20
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */
case
42
3
:
/* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
yytestcase
(
yyruleno
==
423
);
case
42
4
:
/* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */
yytestcase
(
yyruleno
==
424
);
{
yymsp
[
-
3
].
minor
.
yy392
=
createLimitNode
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);
}
{
yymsp
[
-
3
].
minor
.
yy392
=
createLimitNode
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
);
}
break
;
break
;
case
42
0
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
case
42
1
:
/* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */
case
42
4
:
/* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
yytestcase
(
yyruleno
==
424
);
case
42
5
:
/* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */
yytestcase
(
yyruleno
==
425
);
{
yymsp
[
-
3
].
minor
.
yy392
=
createLimitNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
&
yymsp
[
-
2
].
minor
.
yy0
);
}
{
yymsp
[
-
3
].
minor
.
yy392
=
createLimitNode
(
pCxt
,
&
yymsp
[
0
].
minor
.
yy0
,
&
yymsp
[
-
2
].
minor
.
yy0
);
}
break
;
break
;
case
42
5
:
/* subquery ::= NK_LP query_expression NK_RP */
case
42
6
:
/* subquery ::= NK_LP query_expression NK_RP */
{
yylhsminor
.
yy392
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
yymsp
[
-
1
].
minor
.
yy392
);
}
{
yylhsminor
.
yy392
=
createRawExprNodeExt
(
pCxt
,
&
yymsp
[
-
2
].
minor
.
yy0
,
&
yymsp
[
0
].
minor
.
yy0
,
yymsp
[
-
1
].
minor
.
yy392
);
}
yymsp
[
-
2
].
minor
.
yy392
=
yylhsminor
.
yy392
;
yymsp
[
-
2
].
minor
.
yy392
=
yylhsminor
.
yy392
;
break
;
break
;
case
4
29
:
/* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
case
4
30
:
/* sort_specification ::= expression ordering_specification_opt null_ordering_opt */
{
yylhsminor
.
yy392
=
createOrderByExprNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy392
),
yymsp
[
-
1
].
minor
.
yy386
,
yymsp
[
0
].
minor
.
yy361
);
}
{
yylhsminor
.
yy392
=
createOrderByExprNode
(
pCxt
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy392
),
yymsp
[
-
1
].
minor
.
yy386
,
yymsp
[
0
].
minor
.
yy361
);
}
yymsp
[
-
2
].
minor
.
yy392
=
yylhsminor
.
yy392
;
yymsp
[
-
2
].
minor
.
yy392
=
yylhsminor
.
yy392
;
break
;
break
;
case
43
0
:
/* ordering_specification_opt ::= */
case
43
1
:
/* ordering_specification_opt ::= */
{
yymsp
[
1
].
minor
.
yy386
=
ORDER_ASC
;
}
{
yymsp
[
1
].
minor
.
yy386
=
ORDER_ASC
;
}
break
;
break
;
case
43
1
:
/* ordering_specification_opt ::= ASC */
case
43
2
:
/* ordering_specification_opt ::= ASC */
{
yymsp
[
0
].
minor
.
yy386
=
ORDER_ASC
;
}
{
yymsp
[
0
].
minor
.
yy386
=
ORDER_ASC
;
}
break
;
break
;
case
43
2
:
/* ordering_specification_opt ::= DESC */
case
43
3
:
/* ordering_specification_opt ::= DESC */
{
yymsp
[
0
].
minor
.
yy386
=
ORDER_DESC
;
}
{
yymsp
[
0
].
minor
.
yy386
=
ORDER_DESC
;
}
break
;
break
;
case
43
3
:
/* null_ordering_opt ::= */
case
43
4
:
/* null_ordering_opt ::= */
{
yymsp
[
1
].
minor
.
yy361
=
NULL_ORDER_DEFAULT
;
}
{
yymsp
[
1
].
minor
.
yy361
=
NULL_ORDER_DEFAULT
;
}
break
;
break
;
case
43
4
:
/* null_ordering_opt ::= NULLS FIRST */
case
43
5
:
/* null_ordering_opt ::= NULLS FIRST */
{
yymsp
[
-
1
].
minor
.
yy361
=
NULL_ORDER_FIRST
;
}
{
yymsp
[
-
1
].
minor
.
yy361
=
NULL_ORDER_FIRST
;
}
break
;
break
;
case
43
5
:
/* null_ordering_opt ::= NULLS LAST */
case
43
6
:
/* null_ordering_opt ::= NULLS LAST */
{
yymsp
[
-
1
].
minor
.
yy361
=
NULL_ORDER_LAST
;
}
{
yymsp
[
-
1
].
minor
.
yy361
=
NULL_ORDER_LAST
;
}
break
;
break
;
default:
default:
...
...
source/libs/planner/src/planLogicCreater.c
浏览文件 @
055e0516
...
@@ -22,6 +22,7 @@ typedef struct SLogicPlanContext {
...
@@ -22,6 +22,7 @@ typedef struct SLogicPlanContext {
}
SLogicPlanContext
;
}
SLogicPlanContext
;
typedef
int32_t
(
*
FCreateLogicNode
)(
SLogicPlanContext
*
,
SSelectStmt
*
,
SLogicNode
**
);
typedef
int32_t
(
*
FCreateLogicNode
)(
SLogicPlanContext
*
,
SSelectStmt
*
,
SLogicNode
**
);
typedef
int32_t
(
*
FCreateSetOpLogicNode
)(
SLogicPlanContext
*
,
SSetOperator
*
,
SLogicNode
**
);
static
int32_t
doCreateLogicNodeByTable
(
SLogicPlanContext
*
pCxt
,
SSelectStmt
*
pSelect
,
SNode
*
pTable
,
SLogicNode
**
pLogicNode
);
static
int32_t
doCreateLogicNodeByTable
(
SLogicPlanContext
*
pCxt
,
SSelectStmt
*
pSelect
,
SNode
*
pTable
,
SLogicNode
**
pLogicNode
);
static
int32_t
createQueryLogicNode
(
SLogicPlanContext
*
pCxt
,
SNode
*
pStmt
,
SLogicNode
**
pLogicNode
);
static
int32_t
createQueryLogicNode
(
SLogicPlanContext
*
pCxt
,
SNode
*
pStmt
,
SLogicNode
**
pLogicNode
);
...
@@ -84,13 +85,19 @@ static EDealRes doNameExpr(SNode* pNode, void* pContext) {
...
@@ -84,13 +85,19 @@ static EDealRes doNameExpr(SNode* pNode, void* pContext) {
return
DEAL_RES_CONTINUE
;
return
DEAL_RES_CONTINUE
;
}
}
static
int32_t
rewriteExpr
(
SNodeList
*
pExprs
,
SSelectStmt
*
pSelect
,
ESqlClause
clause
)
{
static
int32_t
rewriteExpr
ForSelect
(
SNodeList
*
pExprs
,
SSelectStmt
*
pSelect
,
ESqlClause
clause
)
{
nodesWalkExprs
(
pExprs
,
doNameExpr
,
NULL
);
nodesWalkExprs
(
pExprs
,
doNameExpr
,
NULL
);
SRewriteExprCxt
cxt
=
{
.
errCode
=
TSDB_CODE_SUCCESS
,
.
pExprs
=
pExprs
};
SRewriteExprCxt
cxt
=
{
.
errCode
=
TSDB_CODE_SUCCESS
,
.
pExprs
=
pExprs
};
nodesRewriteSelectStmt
(
pSelect
,
clause
,
doRewriteExpr
,
&
cxt
);
nodesRewriteSelectStmt
(
pSelect
,
clause
,
doRewriteExpr
,
&
cxt
);
return
cxt
.
errCode
;
return
cxt
.
errCode
;
}
}
static
int32_t
rewriteExprs
(
SNodeList
*
pExprs
,
SNodeList
*
pTarget
)
{
SRewriteExprCxt
cxt
=
{
.
errCode
=
TSDB_CODE_SUCCESS
,
.
pExprs
=
pExprs
};
nodesRewriteExprs
(
pTarget
,
doRewriteExpr
,
&
cxt
);
return
cxt
.
errCode
;
}
static
int32_t
pushLogicNode
(
SLogicPlanContext
*
pCxt
,
SLogicNode
**
pOldRoot
,
SLogicNode
*
pNewRoot
)
{
static
int32_t
pushLogicNode
(
SLogicPlanContext
*
pCxt
,
SLogicNode
**
pOldRoot
,
SLogicNode
*
pNewRoot
)
{
if
(
NULL
==
pNewRoot
->
pChildren
)
{
if
(
NULL
==
pNewRoot
->
pChildren
)
{
pNewRoot
->
pChildren
=
nodesMakeList
();
pNewRoot
->
pChildren
=
nodesMakeList
();
...
@@ -343,7 +350,9 @@ static SColumnNode* createColumnByExpr(const char* pStmtName, SExprNode* pExpr)
...
@@ -343,7 +350,9 @@ static SColumnNode* createColumnByExpr(const char* pStmtName, SExprNode* pExpr)
}
}
pCol
->
node
.
resType
=
pExpr
->
resType
;
pCol
->
node
.
resType
=
pExpr
->
resType
;
strcpy
(
pCol
->
colName
,
pExpr
->
aliasName
);
strcpy
(
pCol
->
colName
,
pExpr
->
aliasName
);
if
(
NULL
!=
pStmtName
)
{
strcpy
(
pCol
->
tableAlias
,
pStmtName
);
strcpy
(
pCol
->
tableAlias
,
pStmtName
);
}
return
pCol
;
return
pCol
;
}
}
...
@@ -430,10 +439,10 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect,
...
@@ -430,10 +439,10 @@ static int32_t createAggLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect,
// rewrite the expression in subsequent clauses
// rewrite the expression in subsequent clauses
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
rewriteExpr
(
pAgg
->
pGroupKeys
,
pSelect
,
SQL_CLAUSE_GROUP_BY
);
code
=
rewriteExpr
ForSelect
(
pAgg
->
pGroupKeys
,
pSelect
,
SQL_CLAUSE_GROUP_BY
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
rewriteExpr
(
pAgg
->
pAggFuncs
,
pSelect
,
SQL_CLAUSE_GROUP_BY
);
code
=
rewriteExpr
ForSelect
(
pAgg
->
pAggFuncs
,
pSelect
,
SQL_CLAUSE_GROUP_BY
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pSelect
->
pHaving
)
{
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pSelect
->
pHaving
)
{
...
@@ -469,7 +478,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm
...
@@ -469,7 +478,7 @@ static int32_t createWindowLogicNodeFinalize(SLogicPlanContext* pCxt, SSelectStm
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
rewriteExpr
(
pWindow
->
pFuncs
,
pSelect
,
SQL_CLAUSE_WINDOW
);
code
=
rewriteExpr
ForSelect
(
pWindow
->
pFuncs
,
pSelect
,
SQL_CLAUSE_WINDOW
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
@@ -720,7 +729,7 @@ static int32_t createDistinctLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSe
...
@@ -720,7 +729,7 @@ static int32_t createDistinctLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSe
// rewrite the expression in subsequent clauses
// rewrite the expression in subsequent clauses
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
rewriteExpr
(
pAgg
->
pGroupKeys
,
pSelect
,
SQL_CLAUSE_DISTINCT
);
code
=
rewriteExpr
ForSelect
(
pAgg
->
pGroupKeys
,
pSelect
,
SQL_CLAUSE_DISTINCT
);
}
}
// set the output
// set the output
...
@@ -768,11 +777,160 @@ static int32_t createSelectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSele
...
@@ -768,11 +777,160 @@ static int32_t createSelectLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSele
return
code
;
return
code
;
}
}
static
int32_t
createSetOpChildLogicNode
(
SLogicPlanContext
*
pCxt
,
SSetOperator
*
pSetOperator
,
FCreateSetOpLogicNode
func
,
SLogicNode
**
pRoot
)
{
SLogicNode
*
pNode
=
NULL
;
int32_t
code
=
func
(
pCxt
,
pSetOperator
,
&
pNode
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pNode
)
{
code
=
pushLogicNode
(
pCxt
,
pRoot
,
pNode
);
}
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
nodesDestroyNode
(
pNode
);
}
return
code
;
}
static
int32_t
createSetOpSortLogicNode
(
SLogicPlanContext
*
pCxt
,
SSetOperator
*
pSetOperator
,
SLogicNode
**
pLogicNode
)
{
if
(
NULL
==
pSetOperator
->
pOrderByList
)
{
return
TSDB_CODE_SUCCESS
;
}
SSortLogicNode
*
pSort
=
nodesMakeNode
(
QUERY_NODE_LOGIC_PLAN_SORT
);
if
(
NULL
==
pSort
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
pSort
->
node
.
pTargets
=
nodesCloneList
(
pSetOperator
->
pProjectionList
);
if
(
NULL
==
pSort
->
node
.
pTargets
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
pSort
->
pSortKeys
=
nodesCloneList
(
pSetOperator
->
pOrderByList
);
if
(
NULL
==
pSort
->
pSortKeys
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pLogicNode
=
(
SLogicNode
*
)
pSort
;
}
else
{
nodesDestroyNode
(
pSort
);
}
return
code
;
}
static
int32_t
createSetOpProjectLogicNode
(
SLogicPlanContext
*
pCxt
,
SSetOperator
*
pSetOperator
,
SLogicNode
**
pLogicNode
)
{
SProjectLogicNode
*
pProject
=
(
SProjectLogicNode
*
)
nodesMakeNode
(
QUERY_NODE_LOGIC_PLAN_PROJECT
);
if
(
NULL
==
pProject
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
if
(
NULL
!=
pSetOperator
->
pLimit
)
{
pProject
->
limit
=
((
SLimitNode
*
)
pSetOperator
->
pLimit
)
->
limit
;
pProject
->
offset
=
((
SLimitNode
*
)
pSetOperator
->
pLimit
)
->
offset
;
}
else
{
pProject
->
limit
=
-
1
;
pProject
->
offset
=
-
1
;
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
pProject
->
pProjections
=
nodesCloneList
(
pSetOperator
->
pProjectionList
);
if
(
NULL
==
pProject
->
pProjections
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
createColumnByProjections
(
pCxt
,
NULL
,
pSetOperator
->
pProjectionList
,
&
pProject
->
node
.
pTargets
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pLogicNode
=
(
SLogicNode
*
)
pProject
;
}
else
{
nodesDestroyNode
(
pProject
);
}
return
code
;
}
static
int32_t
createSetOpAggLogicNode
(
SLogicPlanContext
*
pCxt
,
SSetOperator
*
pSetOperator
,
SLogicNode
**
pLogicNode
)
{
SAggLogicNode
*
pAgg
=
(
SAggLogicNode
*
)
nodesMakeNode
(
QUERY_NODE_LOGIC_PLAN_AGG
);
if
(
NULL
==
pAgg
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
pAgg
->
pGroupKeys
=
nodesCloneList
(
pSetOperator
->
pProjectionList
);
if
(
NULL
==
pAgg
->
pGroupKeys
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
}
// rewrite the expression in subsequent clauses
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
rewriteExprs
(
pAgg
->
pGroupKeys
,
pSetOperator
->
pOrderByList
);
}
// set the output
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
createColumnByRewriteExps
(
pCxt
,
pAgg
->
pGroupKeys
,
&
pAgg
->
node
.
pTargets
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pLogicNode
=
(
SLogicNode
*
)
pAgg
;
}
else
{
nodesDestroyNode
(
pAgg
);
}
return
code
;
}
static
int32_t
createSetOpLogicNode
(
SLogicPlanContext
*
pCxt
,
SSetOperator
*
pSetOperator
,
SLogicNode
**
pLogicNode
)
{
SLogicNode
*
pSetOp
=
NULL
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
switch
(
pSetOperator
->
opType
)
{
case
SET_OP_TYPE_UNION_ALL
:
code
=
createSetOpProjectLogicNode
(
pCxt
,
pSetOperator
,
&
pSetOp
);
break
;
case
SET_OP_TYPE_UNION
:
code
=
createSetOpAggLogicNode
(
pCxt
,
pSetOperator
,
&
pSetOp
);
break
;
default:
code
=
-
1
;
break
;
}
SLogicNode
*
pLeft
=
NULL
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
createQueryLogicNode
(
pCxt
,
pSetOperator
->
pLeft
,
&
pLeft
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesListMakeStrictAppend
(
&
pSetOp
->
pChildren
,
(
SNode
*
)
pLeft
);
}
SLogicNode
*
pRight
=
NULL
;
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
createQueryLogicNode
(
pCxt
,
pSetOperator
->
pRight
,
&
pRight
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
nodesListStrictAppend
(
pSetOp
->
pChildren
,
(
SNode
*
)
pRight
);
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pLogicNode
=
(
SLogicNode
*
)
pSetOp
;
}
else
{
nodesDestroyNode
(
pSetOp
);
}
return
code
;
}
static
int32_t
createSetOperatorLogicNode
(
SLogicPlanContext
*
pCxt
,
SSetOperator
*
pSetOperator
,
SLogicNode
**
pLogicNode
)
{
static
int32_t
createSetOperatorLogicNode
(
SLogicPlanContext
*
pCxt
,
SSetOperator
*
pSetOperator
,
SLogicNode
**
pLogicNode
)
{
SLogicNode
*
pRoot
=
NULL
;
SLogicNode
*
pRoot
=
NULL
;
int32_t
code
=
create
QueryLogicNode
(
pCxt
,
pSetOperator
->
pLeft
,
&
pRoot
);
int32_t
code
=
create
SetOpLogicNode
(
pCxt
,
pSetOperator
,
&
pRoot
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
create
QueryLogicNode
(
pCxt
,
pSetOperator
->
pRight
,
&
pRoot
);
code
=
create
SetOpChildLogicNode
(
pCxt
,
pSetOperator
,
createSetOpSortLogicNode
,
&
pRoot
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
055e0516
...
@@ -228,6 +228,8 @@ static int32_t cpdMergeConds(SNode** pDst, SNodeList** pSrc) {
...
@@ -228,6 +228,8 @@ static int32_t cpdMergeConds(SNode** pDst, SNodeList** pSrc) {
if
(
NULL
==
pLogicCond
)
{
if
(
NULL
==
pLogicCond
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
pLogicCond
->
node
.
resType
.
type
=
TSDB_DATA_TYPE_BOOL
;
pLogicCond
->
node
.
resType
.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_BOOL
].
bytes
;
pLogicCond
->
condType
=
LOGIC_COND_TYPE_AND
;
pLogicCond
->
condType
=
LOGIC_COND_TYPE_AND
;
pLogicCond
->
pParameterList
=
*
pSrc
;
pLogicCond
->
pParameterList
=
*
pSrc
;
*
pDst
=
(
SNode
*
)
pLogicCond
;
*
pDst
=
(
SNode
*
)
pLogicCond
;
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
055e0516
...
@@ -38,7 +38,7 @@ typedef struct SPhysiPlanContext {
...
@@ -38,7 +38,7 @@ typedef struct SPhysiPlanContext {
static
int32_t
getSlotKey
(
SNode
*
pNode
,
const
char
*
pStmtName
,
char
*
pKey
)
{
static
int32_t
getSlotKey
(
SNode
*
pNode
,
const
char
*
pStmtName
,
char
*
pKey
)
{
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
))
{
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
))
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
if
(
NULL
!=
pStmtName
)
{
if
(
NULL
!=
pStmtName
&&
'\0'
!=
pStmtName
[
0
]
)
{
return
sprintf
(
pKey
,
"%s.%s"
,
pStmtName
,
pCol
->
node
.
aliasName
);
return
sprintf
(
pKey
,
"%s.%s"
,
pStmtName
,
pCol
->
node
.
aliasName
);
}
}
if
(
'\0'
==
pCol
->
tableAlias
[
0
])
{
if
(
'\0'
==
pCol
->
tableAlias
[
0
])
{
...
@@ -47,7 +47,7 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char* pKey) {
...
@@ -47,7 +47,7 @@ static int32_t getSlotKey(SNode* pNode, const char* pStmtName, char* pKey) {
return
sprintf
(
pKey
,
"%s.%s"
,
pCol
->
tableAlias
,
pCol
->
colName
);
return
sprintf
(
pKey
,
"%s.%s"
,
pCol
->
tableAlias
,
pCol
->
colName
);
}
}
if
(
NULL
!=
pStmtName
)
{
if
(
NULL
!=
pStmtName
&&
'\0'
!=
pStmtName
[
0
]
)
{
return
sprintf
(
pKey
,
"%s.%s"
,
pStmtName
,
((
SExprNode
*
)
pNode
)
->
aliasName
);
return
sprintf
(
pKey
,
"%s.%s"
,
pStmtName
,
((
SExprNode
*
)
pNode
)
->
aliasName
);
}
}
return
sprintf
(
pKey
,
"%s"
,
((
SExprNode
*
)
pNode
)
->
aliasName
);
return
sprintf
(
pKey
,
"%s"
,
((
SExprNode
*
)
pNode
)
->
aliasName
);
...
...
source/libs/planner/src/planScaleOut.c
浏览文件 @
055e0516
...
@@ -129,7 +129,7 @@ static int32_t pushHierarchicalPlan(SNodeList* pParentsGroup, SNodeList* pCurren
...
@@ -129,7 +129,7 @@ static int32_t pushHierarchicalPlan(SNodeList* pParentsGroup, SNodeList* pCurren
return
code
;
return
code
;
}
}
static
int32_t
doScaleOut
(
SScaleOutContext
*
pCxt
,
SLogicSubplan
*
pSubplan
,
int32_t
*
pL
evel
,
SNodeList
*
pParentsGroup
)
{
static
int32_t
doScaleOut
(
SScaleOutContext
*
pCxt
,
SLogicSubplan
*
pSubplan
,
int32_t
l
evel
,
SNodeList
*
pParentsGroup
)
{
SNodeList
*
pCurrentGroup
=
nodesMakeList
();
SNodeList
*
pCurrentGroup
=
nodesMakeList
();
if
(
NULL
==
pCurrentGroup
)
{
if
(
NULL
==
pCurrentGroup
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
...
@@ -138,13 +138,13 @@ static int32_t doScaleOut(SScaleOutContext* pCxt, SLogicSubplan* pSubplan, int32
...
@@ -138,13 +138,13 @@ static int32_t doScaleOut(SScaleOutContext* pCxt, SLogicSubplan* pSubplan, int32
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
switch
(
pSubplan
->
subplanType
)
{
switch
(
pSubplan
->
subplanType
)
{
case
SUBPLAN_TYPE_MERGE
:
case
SUBPLAN_TYPE_MERGE
:
code
=
scaleOutForMerge
(
pCxt
,
pSubplan
,
*
pL
evel
,
pCurrentGroup
);
code
=
scaleOutForMerge
(
pCxt
,
pSubplan
,
l
evel
,
pCurrentGroup
);
break
;
break
;
case
SUBPLAN_TYPE_SCAN
:
case
SUBPLAN_TYPE_SCAN
:
code
=
scaleOutForScan
(
pCxt
,
pSubplan
,
*
pL
evel
,
pCurrentGroup
);
code
=
scaleOutForScan
(
pCxt
,
pSubplan
,
l
evel
,
pCurrentGroup
);
break
;
break
;
case
SUBPLAN_TYPE_MODIFY
:
case
SUBPLAN_TYPE_MODIFY
:
code
=
scaleOutForModify
(
pCxt
,
pSubplan
,
*
pL
evel
,
pCurrentGroup
);
code
=
scaleOutForModify
(
pCxt
,
pSubplan
,
l
evel
,
pCurrentGroup
);
break
;
break
;
default:
default:
break
;
break
;
...
@@ -152,13 +152,12 @@ static int32_t doScaleOut(SScaleOutContext* pCxt, SLogicSubplan* pSubplan, int32
...
@@ -152,13 +152,12 @@ static int32_t doScaleOut(SScaleOutContext* pCxt, SLogicSubplan* pSubplan, int32
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
pushHierarchicalPlan
(
pParentsGroup
,
pCurrentGroup
);
code
=
pushHierarchicalPlan
(
pParentsGroup
,
pCurrentGroup
);
++
(
*
pLevel
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
SNode
*
pChild
;
SNode
*
pChild
;
FOREACH
(
pChild
,
pSubplan
->
pChildren
)
{
FOREACH
(
pChild
,
pSubplan
->
pChildren
)
{
code
=
doScaleOut
(
pCxt
,
(
SLogicSubplan
*
)
pChild
,
pLevel
,
pCurrentGroup
);
code
=
doScaleOut
(
pCxt
,
(
SLogicSubplan
*
)
pChild
,
level
+
1
,
pCurrentGroup
);
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
if
(
TSDB_CODE_SUCCESS
!=
code
)
{
break
;
break
;
}
}
...
@@ -194,7 +193,7 @@ int32_t scaleOutLogicPlan(SPlanContext* pCxt, SLogicSubplan* pLogicSubplan, SQue
...
@@ -194,7 +193,7 @@ int32_t scaleOutLogicPlan(SPlanContext* pCxt, SLogicSubplan* pLogicSubplan, SQue
}
}
SScaleOutContext
cxt
=
{
.
pPlanCxt
=
pCxt
,
.
subplanId
=
1
};
SScaleOutContext
cxt
=
{
.
pPlanCxt
=
pCxt
,
.
subplanId
=
1
};
int32_t
code
=
doScaleOut
(
&
cxt
,
pLogicSubplan
,
&
(
pPlan
->
totalLevel
)
,
pPlan
->
pTopSubplans
);
int32_t
code
=
doScaleOut
(
&
cxt
,
pLogicSubplan
,
0
,
pPlan
->
pTopSubplans
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
*
pLogicPlan
=
pPlan
;
*
pLogicPlan
=
pPlan
;
}
else
{
}
else
{
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
055e0516
...
@@ -45,7 +45,17 @@ typedef struct SCtjInfo {
...
@@ -45,7 +45,17 @@ typedef struct SCtjInfo {
SLogicSubplan
*
pSubplan
;
SLogicSubplan
*
pSubplan
;
}
SCtjInfo
;
}
SCtjInfo
;
typedef
bool
(
*
FSplFindSplitNode
)(
SLogicSubplan
*
pSubplan
,
SStsInfo
*
pInfo
);
typedef
struct
SUaInfo
{
SProjectLogicNode
*
pProject
;
SLogicSubplan
*
pSubplan
;
}
SUaInfo
;
typedef
struct
SUnInfo
{
SAggLogicNode
*
pAgg
;
SLogicSubplan
*
pSubplan
;
}
SUnInfo
;
typedef
bool
(
*
FSplFindSplitNode
)(
SLogicSubplan
*
pSubplan
,
void
*
pInfo
);
static
SLogicSubplan
*
splCreateScanSubplan
(
SSplitContext
*
pCxt
,
SScanLogicNode
*
pScan
,
int32_t
flag
)
{
static
SLogicSubplan
*
splCreateScanSubplan
(
SSplitContext
*
pCxt
,
SScanLogicNode
*
pScan
,
int32_t
flag
)
{
SLogicSubplan
*
pSubplan
=
nodesMakeNode
(
QUERY_NODE_LOGIC_SUBPLAN
);
SLogicSubplan
*
pSubplan
=
nodesMakeNode
(
QUERY_NODE_LOGIC_SUBPLAN
);
...
@@ -132,16 +142,10 @@ static bool stsFindSplitNode(SLogicSubplan* pSubplan, SStsInfo* pInfo) {
...
@@ -132,16 +142,10 @@ static bool stsFindSplitNode(SLogicSubplan* pSubplan, SStsInfo* pInfo) {
static
int32_t
stsSplit
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
)
{
static
int32_t
stsSplit
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
)
{
SStsInfo
info
=
{
0
};
SStsInfo
info
=
{
0
};
if
(
!
splMatch
(
pCxt
,
pSubplan
,
SPLIT_FLAG_STS
,
stsFindSplitNode
,
&
info
))
{
if
(
!
splMatch
(
pCxt
,
pSubplan
,
SPLIT_FLAG_STS
,
(
FSplFindSplitNode
)
stsFindSplitNode
,
&
info
))
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
NULL
==
info
.
pSubplan
->
pChildren
)
{
int32_t
code
=
nodesListMakeStrictAppend
(
&
info
.
pSubplan
->
pChildren
,
splCreateScanSubplan
(
pCxt
,
info
.
pScan
,
SPLIT_FLAG_STS
));
info
.
pSubplan
->
pChildren
=
nodesMakeList
();
if
(
NULL
==
info
.
pSubplan
->
pChildren
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
int32_t
code
=
nodesListStrictAppend
(
info
.
pSubplan
->
pChildren
,
splCreateScanSubplan
(
pCxt
,
info
.
pScan
,
SPLIT_FLAG_STS
));
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
splCreateExchangeNode
(
pCxt
,
info
.
pSubplan
,
info
.
pScan
,
SUBPLAN_TYPE_MERGE
);
code
=
splCreateExchangeNode
(
pCxt
,
info
.
pSubplan
,
info
.
pScan
,
SUBPLAN_TYPE_MERGE
);
}
}
...
@@ -173,7 +177,7 @@ static SLogicNode* ctjMatchByNode(SLogicNode* pNode) {
...
@@ -173,7 +177,7 @@ static SLogicNode* ctjMatchByNode(SLogicNode* pNode) {
return
NULL
;
return
NULL
;
}
}
static
bool
ctjFindSplitNode
(
SLogicSubplan
*
pSubplan
,
S
Sts
Info
*
pInfo
)
{
static
bool
ctjFindSplitNode
(
SLogicSubplan
*
pSubplan
,
S
Ctj
Info
*
pInfo
)
{
SLogicNode
*
pSplitNode
=
ctjMatchByNode
(
pSubplan
->
pNode
);
SLogicNode
*
pSplitNode
=
ctjMatchByNode
(
pSubplan
->
pNode
);
if
(
NULL
!=
pSplitNode
)
{
if
(
NULL
!=
pSplitNode
)
{
pInfo
->
pScan
=
(
SScanLogicNode
*
)
pSplitNode
;
pInfo
->
pScan
=
(
SScanLogicNode
*
)
pSplitNode
;
...
@@ -184,18 +188,172 @@ static bool ctjFindSplitNode(SLogicSubplan* pSubplan, SStsInfo* pInfo) {
...
@@ -184,18 +188,172 @@ static bool ctjFindSplitNode(SLogicSubplan* pSubplan, SStsInfo* pInfo) {
static
int32_t
ctjSplit
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
)
{
static
int32_t
ctjSplit
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
)
{
SCtjInfo
info
=
{
0
};
SCtjInfo
info
=
{
0
};
if
(
!
splMatch
(
pCxt
,
pSubplan
,
SPLIT_FLAG_CTJ
,
ctjFindSplitNode
,
&
info
))
{
if
(
!
splMatch
(
pCxt
,
pSubplan
,
SPLIT_FLAG_CTJ
,
(
FSplFindSplitNode
)
ctjFindSplitNode
,
&
info
))
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
NULL
==
info
.
pSubplan
->
pChildren
)
{
int32_t
code
=
nodesListMakeStrictAppend
(
&
info
.
pSubplan
->
pChildren
,
splCreateScanSubplan
(
pCxt
,
info
.
pScan
,
SPLIT_FLAG_CTJ
));
info
.
pSubplan
->
pChildren
=
nodesMakeList
();
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
NULL
==
info
.
pSubplan
->
pChildren
)
{
code
=
splCreateExchangeNode
(
pCxt
,
info
.
pSubplan
,
info
.
pScan
,
info
.
pSubplan
->
subplanType
);
}
++
(
pCxt
->
groupId
);
pCxt
->
split
=
true
;
return
code
;
}
static
SLogicNode
*
uaMatchByNode
(
SLogicNode
*
pNode
)
{
if
(
QUERY_NODE_LOGIC_PLAN_PROJECT
==
nodeType
(
pNode
)
&&
LIST_LENGTH
(
pNode
->
pChildren
)
>
1
)
{
return
pNode
;
}
SNode
*
pChild
;
FOREACH
(
pChild
,
pNode
->
pChildren
)
{
SLogicNode
*
pSplitNode
=
uaMatchByNode
((
SLogicNode
*
)
pChild
);
if
(
NULL
!=
pSplitNode
)
{
return
pSplitNode
;
}
}
return
NULL
;
}
static
bool
uaFindSplitNode
(
SLogicSubplan
*
pSubplan
,
SUaInfo
*
pInfo
)
{
SLogicNode
*
pSplitNode
=
uaMatchByNode
(
pSubplan
->
pNode
);
if
(
NULL
!=
pSplitNode
)
{
pInfo
->
pProject
=
(
SProjectLogicNode
*
)
pSplitNode
;
pInfo
->
pSubplan
=
pSubplan
;
}
return
NULL
!=
pSplitNode
;
}
static
SLogicSubplan
*
uaCreateSubplan
(
SSplitContext
*
pCxt
,
SLogicNode
*
pNode
)
{
SLogicSubplan
*
pSubplan
=
nodesMakeNode
(
QUERY_NODE_LOGIC_SUBPLAN
);
if
(
NULL
==
pSubplan
)
{
return
NULL
;
}
pSubplan
->
id
.
groupId
=
pCxt
->
groupId
;
pSubplan
->
subplanType
=
SUBPLAN_TYPE_SCAN
;
pSubplan
->
pNode
=
pNode
;
return
pSubplan
;
}
static
int32_t
uaCreateExchangeNode
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
,
SProjectLogicNode
*
pProject
)
{
SExchangeLogicNode
*
pExchange
=
nodesMakeNode
(
QUERY_NODE_LOGIC_PLAN_EXCHANGE
);
if
(
NULL
==
pExchange
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
pExchange
->
srcGroupId
=
pCxt
->
groupId
;
// pExchange->precision = pScan->pMeta->tableInfo.precision;
pExchange
->
node
.
pTargets
=
nodesCloneList
(
pProject
->
node
.
pTargets
);
if
(
NULL
==
pExchange
->
node
.
pTargets
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pSubplan
->
subplanType
=
SUBPLAN_TYPE_MERGE
;
if
(
NULL
==
pProject
->
node
.
pParent
)
{
pSubplan
->
pNode
=
(
SLogicNode
*
)
pExchange
;
nodesDestroyNode
(
pProject
);
return
TSDB_CODE_SUCCESS
;
}
SNode
*
pNode
;
FOREACH
(
pNode
,
pProject
->
node
.
pParent
->
pChildren
)
{
if
(
nodesEqualNode
(
pNode
,
pProject
))
{
REPLACE_NODE
(
pExchange
);
nodesDestroyNode
(
pNode
);
return
TSDB_CODE_SUCCESS
;
}
}
}
int32_t
code
=
nodesListStrictAppend
(
info
.
pSubplan
->
pChildren
,
splCreateScanSubplan
(
pCxt
,
info
.
pScan
,
SPLIT_FLAG_CTJ
));
nodesDestroyNode
(
pExchange
);
return
TSDB_CODE_FAILED
;
}
static
int32_t
uaSplit
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
)
{
SUaInfo
info
=
{
0
};
if
(
!
splMatch
(
pCxt
,
pSubplan
,
0
,
(
FSplFindSplitNode
)
uaFindSplitNode
,
&
info
))
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
SNode
*
pChild
=
NULL
;
FOREACH
(
pChild
,
info
.
pProject
->
node
.
pChildren
)
{
code
=
nodesListMakeStrictAppend
(
&
info
.
pSubplan
->
pChildren
,
uaCreateSubplan
(
pCxt
,
(
SLogicNode
*
)
pChild
));
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
splCreateExchangeNode
(
pCxt
,
info
.
pSubplan
,
info
.
pScan
,
info
.
pSubplan
->
subplanType
);
REPLACE_NODE
(
NULL
);
}
else
{
break
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
nodesClearList
(
info
.
pProject
->
node
.
pChildren
);
info
.
pProject
->
node
.
pChildren
=
NULL
;
code
=
uaCreateExchangeNode
(
pCxt
,
info
.
pSubplan
,
info
.
pProject
);
}
++
(
pCxt
->
groupId
);
pCxt
->
split
=
true
;
return
code
;
}
static
SLogicNode
*
unMatchByNode
(
SLogicNode
*
pNode
)
{
if
(
QUERY_NODE_LOGIC_PLAN_AGG
==
nodeType
(
pNode
)
&&
LIST_LENGTH
(
pNode
->
pChildren
)
>
1
)
{
return
pNode
;
}
SNode
*
pChild
;
FOREACH
(
pChild
,
pNode
->
pChildren
)
{
SLogicNode
*
pSplitNode
=
uaMatchByNode
((
SLogicNode
*
)
pChild
);
if
(
NULL
!=
pSplitNode
)
{
return
pSplitNode
;
}
}
return
NULL
;
}
static
int32_t
unCreateExchangeNode
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
,
SAggLogicNode
*
pAgg
)
{
SExchangeLogicNode
*
pExchange
=
nodesMakeNode
(
QUERY_NODE_LOGIC_PLAN_EXCHANGE
);
if
(
NULL
==
pExchange
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pExchange
->
srcGroupId
=
pCxt
->
groupId
;
// pExchange->precision = pScan->pMeta->tableInfo.precision;
pExchange
->
node
.
pTargets
=
nodesCloneList
(
pAgg
->
node
.
pTargets
);
if
(
NULL
==
pExchange
->
node
.
pTargets
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pSubplan
->
subplanType
=
SUBPLAN_TYPE_MERGE
;
return
nodesListMakeAppend
(
&
pAgg
->
node
.
pChildren
,
pExchange
);
}
static
bool
unFindSplitNode
(
SLogicSubplan
*
pSubplan
,
SUnInfo
*
pInfo
)
{
SLogicNode
*
pSplitNode
=
unMatchByNode
(
pSubplan
->
pNode
);
if
(
NULL
!=
pSplitNode
)
{
pInfo
->
pAgg
=
(
SAggLogicNode
*
)
pSplitNode
;
pInfo
->
pSubplan
=
pSubplan
;
}
return
NULL
!=
pSplitNode
;
}
static
int32_t
unSplit
(
SSplitContext
*
pCxt
,
SLogicSubplan
*
pSubplan
)
{
SUnInfo
info
=
{
0
};
if
(
!
splMatch
(
pCxt
,
pSubplan
,
0
,
(
FSplFindSplitNode
)
unFindSplitNode
,
&
info
))
{
return
TSDB_CODE_SUCCESS
;
}
int32_t
code
=
TSDB_CODE_SUCCESS
;
SNode
*
pChild
=
NULL
;
FOREACH
(
pChild
,
info
.
pAgg
->
node
.
pChildren
)
{
code
=
nodesListMakeStrictAppend
(
&
info
.
pSubplan
->
pChildren
,
uaCreateSubplan
(
pCxt
,
(
SLogicNode
*
)
pChild
));
if
(
TSDB_CODE_SUCCESS
==
code
)
{
REPLACE_NODE
(
NULL
);
}
else
{
break
;
}
}
if
(
TSDB_CODE_SUCCESS
==
code
)
{
nodesClearList
(
info
.
pAgg
->
node
.
pChildren
);
info
.
pAgg
->
node
.
pChildren
=
NULL
;
code
=
unCreateExchangeNode
(
pCxt
,
info
.
pSubplan
,
info
.
pAgg
);
}
}
++
(
pCxt
->
groupId
);
++
(
pCxt
->
groupId
);
pCxt
->
split
=
true
;
pCxt
->
split
=
true
;
...
@@ -205,6 +363,8 @@ static int32_t ctjSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) {
...
@@ -205,6 +363,8 @@ static int32_t ctjSplit(SSplitContext* pCxt, SLogicSubplan* pSubplan) {
static
const
SSplitRule
splitRuleSet
[]
=
{
static
const
SSplitRule
splitRuleSet
[]
=
{
{
.
pName
=
"SuperTableScan"
,
.
splitFunc
=
stsSplit
},
{
.
pName
=
"SuperTableScan"
,
.
splitFunc
=
stsSplit
},
{
.
pName
=
"ChildTableJoin"
,
.
splitFunc
=
ctjSplit
},
{
.
pName
=
"ChildTableJoin"
,
.
splitFunc
=
ctjSplit
},
{
.
pName
=
"UnionAll"
,
.
splitFunc
=
uaSplit
},
{
.
pName
=
"Union"
,
.
splitFunc
=
unSplit
}
};
};
static
const
int32_t
splitRuleNum
=
(
sizeof
(
splitRuleSet
)
/
sizeof
(
SSplitRule
));
static
const
int32_t
splitRuleNum
=
(
sizeof
(
splitRuleSet
)
/
sizeof
(
SSplitRule
));
...
...
source/libs/planner/test/planSetOpTest.cpp
0 → 100644
浏览文件 @
055e0516
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "planTestUtil.h"
#include "planner.h"
using
namespace
std
;
class
PlanSetOpTest
:
public
PlannerTestBase
{
};
TEST_F
(
PlanSetOpTest
,
unionAll
)
{
useDb
(
"root"
,
"test"
);
run
(
"select c1, c2 from t1 where c1 > 10 union all select c1, c2 from t1 where c1 > 20"
);
}
TEST_F
(
PlanSetOpTest
,
union
)
{
useDb
(
"root"
,
"test"
);
run
(
"select c1, c2 from t1 where c1 > 10 union select c1, c2 from t1 where c1 > 20"
);
}
source/libs/planner/test/plan
ner
TestMain.cpp
→
source/libs/planner/test/planTestMain.cpp
浏览文件 @
055e0516
文件已移动
source/libs/planner/test/planTestUtil.cpp
浏览文件 @
055e0516
...
@@ -62,7 +62,11 @@ public:
...
@@ -62,7 +62,11 @@ public:
doScaleOutLogicPlan
(
&
cxt
,
pLogicSubplan
,
&
pLogicPlan
);
doScaleOutLogicPlan
(
&
cxt
,
pLogicSubplan
,
&
pLogicPlan
);
SQueryPlan
*
pPlan
=
nullptr
;
SQueryPlan
*
pPlan
=
nullptr
;
doCreatePhysiPlan
(
&
cxt
,
pLogicPlan
,
&
pPlan
,
NULL
);
doCreatePhysiPlan
(
&
cxt
,
pLogicPlan
,
&
pPlan
);
if
(
g_isDump
)
{
dump
();
}
}
catch
(...)
{
}
catch
(...)
{
dump
();
dump
();
throw
;
throw
;
...
@@ -87,6 +91,7 @@ private:
...
@@ -87,6 +91,7 @@ private:
string
splitLogicPlan_
;
string
splitLogicPlan_
;
string
scaledLogicPlan_
;
string
scaledLogicPlan_
;
string
physiPlan_
;
string
physiPlan_
;
vector
<
string
>
physiSubplans_
;
};
};
void
reset
()
{
void
reset
()
{
...
@@ -115,6 +120,10 @@ private:
...
@@ -115,6 +120,10 @@ private:
cout
<<
res_
.
scaledLogicPlan_
<<
endl
;
cout
<<
res_
.
scaledLogicPlan_
<<
endl
;
cout
<<
"physical plan : "
<<
endl
;
cout
<<
"physical plan : "
<<
endl
;
cout
<<
res_
.
physiPlan_
<<
endl
;
cout
<<
res_
.
physiPlan_
<<
endl
;
cout
<<
"physical subplan : "
<<
endl
;
for
(
const
auto
&
subplan
:
res_
.
physiSubplans_
)
{
cout
<<
subplan
<<
endl
;
}
}
}
void
doParseSql
(
const
string
&
sql
,
SQuery
**
pQuery
)
{
void
doParseSql
(
const
string
&
sql
,
SQuery
**
pQuery
)
{
...
@@ -153,9 +162,17 @@ private:
...
@@ -153,9 +162,17 @@ private:
res_
.
scaledLogicPlan_
=
toString
((
SNode
*
)(
*
pLogicPlan
));
res_
.
scaledLogicPlan_
=
toString
((
SNode
*
)(
*
pLogicPlan
));
}
}
void
doCreatePhysiPlan
(
SPlanContext
*
pCxt
,
SQueryLogicPlan
*
pLogicPlan
,
SQueryPlan
**
pPlan
,
SArray
*
pExecNodeList
)
{
void
doCreatePhysiPlan
(
SPlanContext
*
pCxt
,
SQueryLogicPlan
*
pLogicPlan
,
SQueryPlan
**
pPlan
)
{
SArray
*
pExecNodeList
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
sizeof
(
SQueryNodeAddr
));
DO_WITH_THROW
(
createPhysiPlan
,
pCxt
,
pLogicPlan
,
pPlan
,
pExecNodeList
);
DO_WITH_THROW
(
createPhysiPlan
,
pCxt
,
pLogicPlan
,
pPlan
,
pExecNodeList
);
res_
.
physiPlan_
=
toString
((
SNode
*
)(
*
pPlan
));
res_
.
physiPlan_
=
toString
((
SNode
*
)(
*
pPlan
));
SNode
*
pNode
;
FOREACH
(
pNode
,
(
*
pPlan
)
->
pSubplans
)
{
SNode
*
pSubplan
;
FOREACH
(
pSubplan
,
((
SNodeListNode
*
)
pNode
)
->
pNodeList
)
{
res_
.
physiSubplans_
.
push_back
(
toString
(
pSubplan
));
}
}
}
}
void
setPlanContext
(
SQuery
*
pQuery
,
SPlanContext
*
pCxt
)
{
void
setPlanContext
(
SQuery
*
pQuery
,
SPlanContext
*
pCxt
)
{
...
...
source/libs/qcom/src/querymsg.c
浏览文件 @
055e0516
...
@@ -157,6 +157,28 @@ int32_t queryBuildGetIndexMsg(void *input, char **msg, int32_t msgSize, int32_t
...
@@ -157,6 +157,28 @@ int32_t queryBuildGetIndexMsg(void *input, char **msg, int32_t msgSize, int32_t
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
queryBuildRetrieveFuncMsg
(
void
*
input
,
char
**
msg
,
int32_t
msgSize
,
int32_t
*
msgLen
)
{
if
(
NULL
==
msg
||
NULL
==
msgLen
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
SRetrieveFuncReq
funcReq
=
{
0
};
funcReq
.
numOfFuncs
=
1
;
funcReq
.
ignoreCodeComment
=
true
;
funcReq
.
pFuncNames
=
taosArrayInit
(
1
,
strlen
(
input
)
+
1
);
taosArrayPush
(
funcReq
.
pFuncNames
,
input
);
int32_t
bufLen
=
tSerializeSRetrieveFuncReq
(
NULL
,
0
,
&
funcReq
);
void
*
pBuf
=
rpcMallocCont
(
bufLen
);
tSerializeSRetrieveFuncReq
(
pBuf
,
bufLen
,
&
funcReq
);
taosArrayDestroy
(
funcReq
.
pFuncNames
);
*
msg
=
pBuf
;
*
msgLen
=
bufLen
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
queryProcessUseDBRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
int32_t
queryProcessUseDBRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
SUseDbOutput
*
pOut
=
output
;
SUseDbOutput
*
pOut
=
output
;
...
@@ -379,6 +401,31 @@ int32_t queryProcessGetIndexRsp(void *output, char *msg, int32_t msgSize) {
...
@@ -379,6 +401,31 @@ int32_t queryProcessGetIndexRsp(void *output, char *msg, int32_t msgSize) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
queryProcessRetrieveFuncRsp
(
void
*
output
,
char
*
msg
,
int32_t
msgSize
)
{
SRetrieveFuncRsp
out
=
{
0
};
if
(
NULL
==
output
||
NULL
==
msg
||
msgSize
<=
0
)
{
return
TSDB_CODE_TSC_INVALID_INPUT
;
}
if
(
tDeserializeSRetrieveFuncRsp
(
msg
,
msgSize
,
&
out
)
!=
0
)
{
qError
(
"tDeserializeSRetrieveFuncRsp failed, msgSize:%d"
,
msgSize
);
return
TSDB_CODE_INVALID_MSG
;
}
if
(
1
!=
out
.
numOfFuncs
)
{
qError
(
"invalid func num returned, numOfFuncs:%d"
,
out
.
numOfFuncs
);
return
TSDB_CODE_INVALID_MSG
;
}
SFuncInfo
*
funcInfo
=
taosArrayGet
(
out
.
pFuncInfos
,
0
);
memcpy
(
output
,
funcInfo
,
sizeof
(
*
funcInfo
));
taosArrayDestroy
(
out
.
pFuncInfos
);
return
TSDB_CODE_SUCCESS
;
}
void
initQueryModuleMsgHandle
()
{
void
initQueryModuleMsgHandle
()
{
queryBuildMsg
[
TMSG_INDEX
(
TDMT_VND_TABLE_META
)]
=
queryBuildTableMetaReqMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_VND_TABLE_META
)]
=
queryBuildTableMetaReqMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_TABLE_META
)]
=
queryBuildTableMetaReqMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_TABLE_META
)]
=
queryBuildTableMetaReqMsg
;
...
@@ -386,6 +433,7 @@ void initQueryModuleMsgHandle() {
...
@@ -386,6 +433,7 @@ void initQueryModuleMsgHandle() {
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_QNODE_LIST
)]
=
queryBuildQnodeListMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_QNODE_LIST
)]
=
queryBuildQnodeListMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_GET_DB_CFG
)]
=
queryBuildGetDBCfgMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_GET_DB_CFG
)]
=
queryBuildGetDBCfgMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_GET_INDEX
)]
=
queryBuildGetIndexMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_GET_INDEX
)]
=
queryBuildGetIndexMsg
;
queryBuildMsg
[
TMSG_INDEX
(
TDMT_MND_RETRIEVE_FUNC
)]
=
queryBuildRetrieveFuncMsg
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_VND_TABLE_META
)]
=
queryProcessTableMetaRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_VND_TABLE_META
)]
=
queryProcessTableMetaRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_TABLE_META
)]
=
queryProcessTableMetaRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_TABLE_META
)]
=
queryProcessTableMetaRsp
;
...
@@ -393,6 +441,7 @@ void initQueryModuleMsgHandle() {
...
@@ -393,6 +441,7 @@ void initQueryModuleMsgHandle() {
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_QNODE_LIST
)]
=
queryProcessQnodeListRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_QNODE_LIST
)]
=
queryProcessQnodeListRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_GET_DB_CFG
)]
=
queryProcessGetDbCfgRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_GET_DB_CFG
)]
=
queryProcessGetDbCfgRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_GET_INDEX
)]
=
queryProcessGetIndexRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_GET_INDEX
)]
=
queryProcessGetIndexRsp
;
queryProcessMsgRsp
[
TMSG_INDEX
(
TDMT_MND_RETRIEVE_FUNC
)]
=
queryProcessRetrieveFuncRsp
;
}
}
#pragma GCC diagnostic pop
#pragma GCC diagnostic pop
source/libs/scalar/src/sclfunc.c
浏览文件 @
055e0516
...
@@ -716,7 +716,8 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
...
@@ -716,7 +716,8 @@ int32_t castFunction(SScalarParam *pInput, int32_t inputNum, SScalarParam *pOutp
int32_t
len
=
sprintf
(
varDataVal
(
output
),
"%.*s"
,
(
int32_t
)(
outputLen
-
VARSTR_HEADER_SIZE
),
*
(
int8_t
*
)
input
?
"true"
:
"false"
);
int32_t
len
=
sprintf
(
varDataVal
(
output
),
"%.*s"
,
(
int32_t
)(
outputLen
-
VARSTR_HEADER_SIZE
),
*
(
int8_t
*
)
input
?
"true"
:
"false"
);
varDataSetLen
(
output
,
len
);
varDataSetLen
(
output
,
len
);
}
else
if
(
inputType
==
TSDB_DATA_TYPE_BINARY
)
{
}
else
if
(
inputType
==
TSDB_DATA_TYPE_BINARY
)
{
int32_t
len
=
sprintf
(
varDataVal
(
output
),
"%.*s"
,
(
int32_t
)(
outputLen
-
VARSTR_HEADER_SIZE
),
varDataVal
(
input
));
int32_t
len
=
MIN
(
varDataLen
(
input
),
outputLen
-
VARSTR_HEADER_SIZE
);
len
=
sprintf
(
varDataVal
(
output
),
"%.*s"
,
len
,
varDataVal
(
input
));
varDataSetLen
(
output
,
len
);
varDataSetLen
(
output
,
len
);
}
else
if
(
inputType
==
TSDB_DATA_TYPE_NCHAR
)
{
}
else
if
(
inputType
==
TSDB_DATA_TYPE_NCHAR
)
{
//not support
//not support
...
...
source/libs/transport/inc/transComm.h
浏览文件 @
055e0516
...
@@ -158,6 +158,7 @@ typedef struct {
...
@@ -158,6 +158,7 @@ typedef struct {
char
secured
:
2
;
char
secured
:
2
;
char
spi
:
2
;
char
spi
:
2
;
char
user
[
TSDB_UNI_LEN
];
uint64_t
ahandle
;
// ahandle assigned by client
uint64_t
ahandle
;
// ahandle assigned by client
uint32_t
code
;
// del later
uint32_t
code
;
// del later
uint32_t
msgType
;
uint32_t
msgType
;
...
...
source/libs/transport/src/transCli.c
浏览文件 @
055e0516
...
@@ -614,35 +614,16 @@ void cliSend(SCliConn* pConn) {
...
@@ -614,35 +614,16 @@ void cliSend(SCliConn* pConn) {
pMsg
->
pCont
=
(
void
*
)
rpcMallocCont
(
0
);
pMsg
->
pCont
=
(
void
*
)
rpcMallocCont
(
0
);
pMsg
->
contLen
=
0
;
pMsg
->
contLen
=
0
;
}
}
STransMsgHead
*
pHead
=
transHeadFromCont
(
pMsg
->
pCont
);
pHead
->
ahandle
=
pCtx
!=
NULL
?
(
uint64_t
)
pCtx
->
ahandle
:
0
;
int
msgLen
=
transMsgLenFromCont
(
pMsg
->
contLen
);
int
msgLen
=
transMsgLenFromCont
(
pMsg
->
contLen
);
if
(
!
pConn
->
secured
)
{
STransMsgHead
*
pHead
=
transHeadFromCont
(
pMsg
->
pCont
);
char
*
buf
=
taosMemoryCalloc
(
1
,
msgLen
+
sizeof
(
STransUserMsg
));
pHead
->
ahandle
=
pCtx
!=
NULL
?
(
uint64_t
)
pCtx
->
ahandle
:
0
;
memcpy
(
buf
,
(
char
*
)
pHead
,
msgLen
);
STransUserMsg
*
uMsg
=
(
STransUserMsg
*
)(
buf
+
msgLen
);
memcpy
(
uMsg
->
user
,
pTransInst
->
user
,
tListLen
(
uMsg
->
user
));
memcpy
(
uMsg
->
secret
,
pTransInst
->
secret
,
tListLen
(
uMsg
->
secret
));
// to avoid mem leak
destroyUserdata
(
pMsg
);
pMsg
->
pCont
=
(
char
*
)
buf
+
sizeof
(
STransMsgHead
);
pMsg
->
contLen
=
msgLen
+
sizeof
(
STransUserMsg
)
-
sizeof
(
STransMsgHead
);
pHead
=
(
STransMsgHead
*
)
buf
;
pHead
->
secured
=
1
;
msgLen
+=
sizeof
(
STransUserMsg
);
}
pHead
->
noResp
=
REQUEST_NO_RESP
(
pMsg
)
?
1
:
0
;
pHead
->
noResp
=
REQUEST_NO_RESP
(
pMsg
)
?
1
:
0
;
pHead
->
persist
=
REQUEST_PERSIS_HANDLE
(
pMsg
)
?
1
:
0
;
pHead
->
persist
=
REQUEST_PERSIS_HANDLE
(
pMsg
)
?
1
:
0
;
pHead
->
msgType
=
pMsg
->
msgType
;
pHead
->
msgType
=
pMsg
->
msgType
;
pHead
->
msgLen
=
(
int32_t
)
htonl
((
uint32_t
)
msgLen
);
pHead
->
msgLen
=
(
int32_t
)
htonl
((
uint32_t
)
msgLen
);
pHead
->
release
=
REQUEST_RELEASE_HANDLE
(
pCliMsg
)
?
1
:
0
;
pHead
->
release
=
REQUEST_RELEASE_HANDLE
(
pCliMsg
)
?
1
:
0
;
memcpy
(
pHead
->
user
,
pTransInst
->
user
,
strlen
(
pTransInst
->
user
));
uv_buf_t
wb
=
uv_buf_init
((
char
*
)
pHead
,
msgLen
);
uv_buf_t
wb
=
uv_buf_init
((
char
*
)
pHead
,
msgLen
);
tDebug
(
"%s cli conn %p %s is send to %s:%d, local info %s:%d"
,
CONN_GET_INST_LABEL
(
pConn
),
pConn
,
tDebug
(
"%s cli conn %p %s is send to %s:%d, local info %s:%d"
,
CONN_GET_INST_LABEL
(
pConn
),
pConn
,
...
...
source/libs/transport/src/transSrv.c
浏览文件 @
055e0516
...
@@ -46,7 +46,6 @@ typedef struct SSrvConn {
...
@@ -46,7 +46,6 @@ typedef struct SSrvConn {
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
struct
sockaddr_in
locaddr
;
struct
sockaddr_in
locaddr
;
char
secured
;
int
spi
;
int
spi
;
char
info
[
64
];
char
info
[
64
];
char
user
[
TSDB_UNI_LEN
];
// user ID for the link
char
user
[
TSDB_UNI_LEN
];
// user ID for the link
...
@@ -104,6 +103,13 @@ static void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf)
...
@@ -104,6 +103,13 @@ static void uvOnConnectionCb(uv_stream_t* q, ssize_t nread, const uv_buf_t* buf)
static
void
uvWorkerAsyncCb
(
uv_async_t
*
handle
);
static
void
uvWorkerAsyncCb
(
uv_async_t
*
handle
);
static
void
uvAcceptAsyncCb
(
uv_async_t
*
handle
);
static
void
uvAcceptAsyncCb
(
uv_async_t
*
handle
);
static
void
uvShutDownCb
(
uv_shutdown_t
*
req
,
int
status
);
static
void
uvShutDownCb
(
uv_shutdown_t
*
req
,
int
status
);
/*
* time-consuming task throwed into BG work thread
*/
static
void
uvWorkDoTask
(
uv_work_t
*
req
);
static
void
uvWorkAfterTask
(
uv_work_t
*
req
,
int
status
);
static
void
uvWalkCb
(
uv_handle_t
*
handle
,
void
*
arg
);
static
void
uvWalkCb
(
uv_handle_t
*
handle
,
void
*
arg
);
static
void
uvFreeCb
(
uv_handle_t
*
handle
);
static
void
uvFreeCb
(
uv_handle_t
*
handle
);
...
@@ -181,16 +187,16 @@ static void uvHandleReq(SSrvConn* pConn) {
...
@@ -181,16 +187,16 @@ static void uvHandleReq(SSrvConn* pConn) {
uint32_t
msgLen
=
pBuf
->
len
;
uint32_t
msgLen
=
pBuf
->
len
;
STransMsgHead
*
pHead
=
(
STransMsgHead
*
)
msg
;
STransMsgHead
*
pHead
=
(
STransMsgHead
*
)
msg
;
if
(
pHead
->
secured
==
1
)
{
STransUserMsg
*
uMsg
=
(
STransUserMsg
*
)((
char
*
)
msg
+
msgLen
-
sizeof
(
STransUserMsg
));
memcpy
(
pConn
->
user
,
uMsg
->
user
,
tListLen
(
uMsg
->
user
));
memcpy
(
pConn
->
secret
,
uMsg
->
secret
,
tListLen
(
uMsg
->
secret
));
}
pHead
->
code
=
htonl
(
pHead
->
code
);
pHead
->
code
=
htonl
(
pHead
->
code
);
pHead
->
msgLen
=
htonl
(
pHead
->
msgLen
);
pHead
->
msgLen
=
htonl
(
pHead
->
msgLen
);
if
(
pHead
->
secured
==
1
)
{
memcpy
(
pConn
->
user
,
pHead
->
user
,
strlen
(
pHead
->
user
));
pHead
->
msgLen
-=
sizeof
(
STransUserMsg
);
}
// TODO(dengyihao): time-consuming task throwed into BG Thread
// uv_work_t* wreq = taosMemoryMalloc(sizeof(uv_work_t));
// wreq->data = pConn;
// uv_read_stop((uv_stream_t*)pConn->pTcp);
// transRefSrvHandle(pConn);
// uv_queue_work(((SWorkThrdObj*)pConn->hostThrd)->loop, wreq, uvWorkDoTask, uvWorkAfterTask);
CONN_SHOULD_RELEASE
(
pConn
,
pHead
);
CONN_SHOULD_RELEASE
(
pConn
,
pHead
);
...
@@ -344,12 +350,6 @@ static void uvPrepareSendData(SSrvMsg* smsg, uv_buf_t* wb) {
...
@@ -344,12 +350,6 @@ static void uvPrepareSendData(SSrvMsg* smsg, uv_buf_t* wb) {
STransMsgHead
*
pHead
=
transHeadFromCont
(
pMsg
->
pCont
);
STransMsgHead
*
pHead
=
transHeadFromCont
(
pMsg
->
pCont
);
pHead
->
ahandle
=
(
uint64_t
)
pMsg
->
ahandle
;
pHead
->
ahandle
=
(
uint64_t
)
pMsg
->
ahandle
;
// pHead->secured = pMsg->code == 0 ? 1 : 0; //
if
(
!
pConn
->
secured
)
{
pConn
->
secured
=
pMsg
->
code
==
0
?
1
:
0
;
}
pHead
->
secured
=
pConn
->
secured
;
if
(
pConn
->
status
==
ConnNormal
)
{
if
(
pConn
->
status
==
ConnNormal
)
{
pHead
->
msgType
=
pConn
->
inType
+
1
;
pHead
->
msgType
=
pConn
->
inType
+
1
;
}
else
{
}
else
{
...
@@ -464,6 +464,24 @@ static void uvShutDownCb(uv_shutdown_t* req, int status) {
...
@@ -464,6 +464,24 @@ static void uvShutDownCb(uv_shutdown_t* req, int status) {
taosMemoryFree
(
req
);
taosMemoryFree
(
req
);
}
}
static
void
uvWorkDoTask
(
uv_work_t
*
req
)
{
// doing time-consumeing task
// only auth conn currently, add more func later
tTrace
(
"server conn %p start to be processed in BG Thread"
,
req
->
data
);
return
;
}
static
void
uvWorkAfterTask
(
uv_work_t
*
req
,
int
status
)
{
if
(
status
!=
0
)
{
tTrace
(
"server conn %p failed to processed "
,
req
->
data
);
}
// Done time-consumeing task
// add more func later
// this func called in main loop
tTrace
(
"server conn %p already processed "
,
req
->
data
);
taosMemoryFree
(
req
);
}
void
uvOnAcceptCb
(
uv_stream_t
*
stream
,
int
status
)
{
void
uvOnAcceptCb
(
uv_stream_t
*
stream
,
int
status
)
{
if
(
status
==
-
1
)
{
if
(
status
==
-
1
)
{
return
;
return
;
...
...
tests/script/runAllSimCases.sh
浏览文件 @
055e0516
!
/bin/bash
#
!/bin/bash
##################################################
##################################################
#
#
...
...
tests/system-test/2-query/cast.py
浏览文件 @
055e0516
import
taos
import
taos
import
sys
import
sys
import
datetime
import
datetime
import
inspect
from
util.log
import
*
from
util.log
import
*
from
util.sql
import
*
from
util.sql
import
*
...
@@ -70,16 +71,6 @@ class TDTestCase:
...
@@ -70,16 +71,6 @@ class TDTestCase:
tdSql
.
query
(
"select c1 from t1"
)
tdSql
.
query
(
"select c1 from t1"
)
data_t1_c1
=
[
tdSql
.
getData
(
i
,
0
)
for
i
in
range
(
tdSql
.
queryRows
)]
data_t1_c1
=
[
tdSql
.
getData
(
i
,
0
)
for
i
in
range
(
tdSql
.
queryRows
)]
# tdLog.printNoPrefix("==========step1: cast int to int, expect no changes")
# tdSql.query("select cast(c1 as int) as b from ct4")
# for i in range(len(data_ct4)):
# tdSql.checkData( i, 0, data_ct4[i])
# tdSql.query("select cast(c1 as int) as b from t1")
# for i in range(len(data_t1)):
# tdSql.checkData( i, 0, data_t1[i])
tdLog
.
printNoPrefix
(
"==========step2: cast int to bigint, expect no changes"
)
tdLog
.
printNoPrefix
(
"==========step2: cast int to bigint, expect no changes"
)
tdSql
.
query
(
"select cast(c1 as bigint) as b from ct4"
)
tdSql
.
query
(
"select cast(c1 as bigint) as b from ct4"
)
...
@@ -89,24 +80,6 @@ class TDTestCase:
...
@@ -89,24 +80,6 @@ class TDTestCase:
for
i
in
range
(
len
(
data_t1_c1
)):
for
i
in
range
(
len
(
data_t1_c1
)):
tdSql
.
checkData
(
i
,
0
,
data_t1_c1
[
i
])
tdSql
.
checkData
(
i
,
0
,
data_t1_c1
[
i
])
# tdLog.printNoPrefix("==========step3: cast int to float, expect no changes")
# tdSql.query("select cast(c1 as float) as b from ct4")
# for i in range(len(data_ct4)):
# tdSql.checkData( i, 0, data_ct4[i])
# tdSql.query("select cast(c1 as float) as b from t1")
# for i in range(len(data_t1)):
# tdSql.checkData( i, 0, data_t1[i])
# tdLog.printNoPrefix("==========step4: cast int to double, expect no changes")
# tdSql.query("select cast(c1 as double) as b from ct4")
# for i in range(len(data_ct4)):
# tdSql.checkData( i, 0, data_ct4[i])
# tdSql.query("select cast(c1 as double) as b from t1")
# for i in range(len(data_t1)):
# tdSql.checkData( i, 0, data_t1[i])
tdLog
.
printNoPrefix
(
"==========step5: cast int to binary, expect changes to str(int) "
)
tdLog
.
printNoPrefix
(
"==========step5: cast int to binary, expect changes to str(int) "
)
tdSql
.
query
(
"select cast(c1 as binary(32)) as b from ct4"
)
tdSql
.
query
(
"select cast(c1 as binary(32)) as b from ct4"
)
...
@@ -195,10 +168,13 @@ class TDTestCase:
...
@@ -195,10 +168,13 @@ class TDTestCase:
date_data
=
date_init_stamp
.
replace
(
tzinfo
=
utc_zone
).
astimezone
(
utc_8
).
strftime
(
"%Y-%m-%d %H:%M:%S.%f"
)
date_data
=
date_init_stamp
.
replace
(
tzinfo
=
utc_zone
).
astimezone
(
utc_8
).
strftime
(
"%Y-%m-%d %H:%M:%S.%f"
)
tdSql
.
checkData
(
i
,
0
,
date_data
)
tdSql
.
checkData
(
i
,
0
,
date_data
)
tdSql
.
query
(
"select cast(c2 as timestamp) as b from t1"
)
tdSql
.
query
(
"select cast(c2 as timestamp) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c2
)):
for
i
in
range
(
len
(
data_t1_c2
)):
if
data_t1_c2
[
i
]
is
None
:
if
data_t1_c2
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
tdSql
.
checkData
(
i
,
0
,
None
)
elif
i
==
10
:
continue
else
:
else
:
utc_zone
=
datetime
.
timezone
.
utc
utc_zone
=
datetime
.
timezone
.
utc
utc_8
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
))
utc_8
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
))
...
@@ -329,29 +305,26 @@ class TDTestCase:
...
@@ -329,29 +305,26 @@ class TDTestCase:
tdSql
.
query
(
"select cast(c5 as bigint) as b from ct4"
)
tdSql
.
query
(
"select cast(c5 as bigint) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c5
)):
for
i
in
range
(
len
(
data_ct4_c5
)):
tdSql
.
checkData
(
i
,
0
,
data_ct4_c5
[
i
]
)
if
data_ct4_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
int
(
data_ct4_c5
[
i
])
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_ct4_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
int
(
data_ct4_c5
[
i
])
)
tdSql
.
query
(
"select cast(c5 as bigint) as b from t1"
)
tdSql
.
query
(
"select cast(c5 as bigint) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c5
)):
for
i
in
range
(
len
(
data_t1_c5
)):
tdSql
.
checkData
(
i
,
0
,
data_t1_c5
[
i
]
)
if
data_t1_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
int
(
data_t1_c5
[
i
])
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_t1_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
int
(
data_t1_c5
[
i
])
)
tdLog
.
printNoPrefix
(
"==========step21: cast float to binary, expect changes to str(int) "
)
tdLog
.
printNoPrefix
(
"==========step21: cast float to binary, expect changes to str(int) "
)
tdSql
.
query
(
"select cast(c5 as binary(32)) as b from ct4"
)
tdSql
.
query
(
"select cast(c5 as binary(32)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c5
)):
for
i
in
range
(
len
(
data_ct4_c5
)):
# tdSql.checkData( i, 0, str(data_ct4_c5[i]) ) if data_ct4_c5[i] is None else tdSql.checkData( i, 0, str(round(data_ct4_c5[i], 6)) )
tdSql
.
checkData
(
i
,
0
,
str
(
data_ct4_c5
[
i
])
)
if
data_ct4_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_ct4_c5
[
i
]:.
6
f
}
'
)
tdSql
.
checkData
(
i
,
0
,
str
(
data_ct4_c5
[
i
])
)
if
data_ct4_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_ct4_c5
[
i
]:.
6
f
}
'
)
tdSql
.
query
(
"select cast(c5 as binary(32)) as b from t1"
)
tdSql
.
query
(
"select cast(c5 as binary(32)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c5
)):
for
i
in
range
(
len
(
data_t1_c5
)):
# tdSql.checkData( i, 0, str(data_t1_c5[i]) ) if data_t1_c5[i] is None else tdSql.checkData( i, 0, str(round(data_t1_c5[i], 6)) )
tdSql
.
checkData
(
i
,
0
,
str
(
data_t1_c5
[
i
])
)
if
data_t1_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_t1_c5
[
i
]:.
6
f
}
'
)
tdSql
.
checkData
(
i
,
0
,
str
(
data_t1_c5
[
i
])
)
if
data_t1_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_t1_c5
[
i
]:.
6
f
}
'
)
# tdSql.checkData( i, 0, str(data_t1_c5[i]) )
tdLog
.
printNoPrefix
(
"==========step22: cast float to nchar, expect changes to str(int) "
)
tdLog
.
printNoPrefix
(
"==========step22: cast float to nchar, expect changes to str(int) "
)
tdSql
.
query
(
"select cast(c5 as nchar(32)) as b from ct4"
)
tdSql
.
query
(
"select cast(c5 as nchar(32)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c5
)):
for
i
in
range
(
len
(
data_ct4_c5
)):
tdSql
.
checkData
(
i
,
0
,
str
(
data_ct4_c5
[
i
])
)
if
data_ct4_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_ct4_c5
[
i
]:.
6
f
}
'
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_ct4_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_ct4_c5
[
i
]:.
6
f
}
'
)
tdSql
.
query
(
"select cast(c5 as nchar(32)) as b from t1"
)
tdSql
.
query
(
"select cast(c5 as nchar(32)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c5
)):
for
i
in
range
(
len
(
data_t1_c5
)):
tdSql
.
checkData
(
i
,
0
,
str
(
data_t1_c5
[
i
])
)
if
data_t1_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_t1_c5
[
i
]:.
6
f
}
'
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_t1_c5
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_t1_c5
[
i
]:.
6
f
}
'
)
tdLog
.
printNoPrefix
(
"==========step23: cast float to timestamp, expect changes to timestamp "
)
tdLog
.
printNoPrefix
(
"==========step23: cast float to timestamp, expect changes to timestamp "
)
tdSql
.
query
(
"select cast(c5 as timestamp) as b from ct4"
)
tdSql
.
query
(
"select cast(c5 as timestamp) as b from ct4"
)
...
@@ -383,7 +356,7 @@ class TDTestCase:
...
@@ -383,7 +356,7 @@ class TDTestCase:
tdSql
.
query
(
"select cast(c6 as bigint) as b from ct4"
)
tdSql
.
query
(
"select cast(c6 as bigint) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c6
)):
for
i
in
range
(
len
(
data_ct4_c6
)):
tdSql
.
checkData
(
i
,
0
,
data_ct4_c6
[
i
]
)
if
data_ct4_c6
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
int
(
data_ct4_c6
[
i
])
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_ct4_c6
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
int
(
data_ct4_c6
[
i
])
)
tdSql
.
query
(
"select cast(c6 as bigint) as b from t1"
)
tdSql
.
query
(
"select cast(c6 as bigint) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c6
)):
for
i
in
range
(
len
(
data_t1_c6
)):
if
data_t1_c6
[
i
]
is
None
:
if
data_t1_c6
[
i
]
is
None
:
...
@@ -396,18 +369,18 @@ class TDTestCase:
...
@@ -396,18 +369,18 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step25: cast double to binary, expect changes to str(int) "
)
tdLog
.
printNoPrefix
(
"==========step25: cast double to binary, expect changes to str(int) "
)
tdSql
.
query
(
"select cast(c6 as binary(32)) as b from ct4"
)
tdSql
.
query
(
"select cast(c6 as binary(32)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c6
)):
for
i
in
range
(
len
(
data_ct4_c6
)):
tdSql
.
checkData
(
i
,
0
,
str
(
data_ct4_c6
[
i
])
)
if
data_ct4_c6
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_ct4_c6
[
i
]:.
6
f
}
'
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_ct4_c6
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_ct4_c6
[
i
]:.
6
f
}
'
)
tdSql
.
query
(
"select cast(c6 as binary(32)) as b from t1"
)
tdSql
.
query
(
"select cast(c6 as binary(32)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c6
)):
for
i
in
range
(
len
(
data_t1_c6
)):
tdSql
.
checkData
(
i
,
0
,
str
(
data_t1_c6
[
i
])
)
if
data_t1_c6
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_t1_c6
[
i
]:.
6
f
}
'
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_t1_c6
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_t1_c6
[
i
]:.
6
f
}
'
)
tdLog
.
printNoPrefix
(
"==========step26: cast double to nchar, expect changes to str(int) "
)
tdLog
.
printNoPrefix
(
"==========step26: cast double to nchar, expect changes to str(int) "
)
tdSql
.
query
(
"select cast(c6 as nchar(32)) as b from ct4"
)
tdSql
.
query
(
"select cast(c6 as nchar(32)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c6
)):
for
i
in
range
(
len
(
data_ct4_c6
)):
tdSql
.
checkData
(
i
,
0
,
str
(
data_ct4_c6
[
i
])
)
if
data_ct4_c6
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_ct4_c6
[
i
]:.
6
f
}
'
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_ct4_c6
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_ct4_c6
[
i
]:.
6
f
}
'
)
tdSql
.
query
(
"select cast(c6 as nchar(32)) as b from t1"
)
tdSql
.
query
(
"select cast(c6 as nchar(32)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c6
)):
for
i
in
range
(
len
(
data_t1_c6
)):
tdSql
.
checkData
(
i
,
0
,
str
(
data_t1_c6
[
i
])
)
if
data_t1_c6
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_t1_c6
[
i
]:.
6
f
}
'
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_t1_c6
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
f
'
{
data_t1_c6
[
i
]:.
6
f
}
'
)
tdLog
.
printNoPrefix
(
"==========step27: cast double to timestamp, expect changes to timestamp "
)
tdLog
.
printNoPrefix
(
"==========step27: cast double to timestamp, expect changes to timestamp "
)
tdSql
.
query
(
"select cast(c6 as timestamp) as b from ct4"
)
tdSql
.
query
(
"select cast(c6 as timestamp) as b from ct4"
)
...
@@ -420,16 +393,19 @@ class TDTestCase:
...
@@ -420,16 +393,19 @@ class TDTestCase:
date_init_stamp
=
datetime
.
datetime
.
utcfromtimestamp
(
int
(
data_ct4_c6
[
i
]
/
1000
))
date_init_stamp
=
datetime
.
datetime
.
utcfromtimestamp
(
int
(
data_ct4_c6
[
i
]
/
1000
))
date_data
=
date_init_stamp
.
replace
(
tzinfo
=
utc_zone
).
astimezone
(
utc_8
).
strftime
(
"%Y-%m-%d %H:%M:%S.%f"
)
date_data
=
date_init_stamp
.
replace
(
tzinfo
=
utc_zone
).
astimezone
(
utc_8
).
strftime
(
"%Y-%m-%d %H:%M:%S.%f"
)
tdSql
.
checkData
(
i
,
0
,
date_data
)
tdSql
.
checkData
(
i
,
0
,
date_data
)
# tdSql.query("select cast(c6 as timestamp) as b from t1")
# for i in range(len(data_t1_c6)):
tdSql
.
query
(
"select cast(c6 as timestamp) as b from t1"
)
# if data_t1_c6[i] is None:
for
i
in
range
(
len
(
data_t1_c6
)):
# tdSql.checkData( i, 0 , None )
if
data_t1_c6
[
i
]
is
None
:
# else:
tdSql
.
checkData
(
i
,
0
,
None
)
# utc_zone = datetime.timezone.utc
elif
i
==
10
:
# utc_8 = datetime.timezone(datetime.timedelta(hours=8))
continue
# date_init_stamp = datetime.datetime.utcfromtimestamp(int(data_t1_c6[i]/1000))
else
:
# date_data = date_init_stamp.replace(tzinfo=utc_zone).astimezone(utc_8).strftime("%Y-%m-%d %H:%M:%S.%f")
utc_zone
=
datetime
.
timezone
.
utc
# tdSql.checkData( i, 0, date_data)
utc_8
=
datetime
.
timezone
(
datetime
.
timedelta
(
hours
=
8
))
date_init_stamp
=
datetime
.
datetime
.
utcfromtimestamp
(
int
(
data_t1_c6
[
i
]
/
1000
))
date_data
=
date_init_stamp
.
replace
(
tzinfo
=
utc_zone
).
astimezone
(
utc_8
).
strftime
(
"%Y-%m-%d %H:%M:%S.%f"
)
tdSql
.
checkData
(
i
,
0
,
date_data
)
tdLog
.
printNoPrefix
(
"==========step28: cast bool to bigint, expect no changes"
)
tdLog
.
printNoPrefix
(
"==========step28: cast bool to bigint, expect no changes"
)
tdSql
.
query
(
"select c7 from ct4"
)
tdSql
.
query
(
"select c7 from ct4"
)
...
@@ -491,26 +467,51 @@ class TDTestCase:
...
@@ -491,26 +467,51 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step32: cast binary to binary, expect no changes "
)
tdLog
.
printNoPrefix
(
"==========step32: cast binary to binary, expect no changes "
)
tdSql
.
query
(
"select cast(c8 as binary(32)) as b from ct4"
)
tdSql
.
query
(
"select cast(c8 as binary(32)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c8
)):
for
i
in
range
(
len
(
data_ct4_c8
)):
tdSql
.
checkData
(
i
,
0
,
data_ct4_c8
[
i
]
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_ct4_c8
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
data_ct4_c8
[
i
])
tdSql
.
query
(
"select cast(c8 as binary(32)) as b from t1"
)
tdSql
.
query
(
"select cast(c8 as binary(32)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c8
)):
for
i
in
range
(
len
(
data_t1_c8
)):
tdSql
.
checkData
(
i
,
0
,
data_t1_c8
[
i
]
)
tdSql
.
checkData
(
i
,
0
,
None
)
if
data_t1_c8
[
i
]
is
None
else
tdSql
.
checkData
(
i
,
0
,
data_t1_c8
[
i
]
)
tdLog
.
printNoPrefix
(
"==========step33: cast binary to binary, expect truncate "
)
tdLog
.
printNoPrefix
(
"==========step33: cast binary to binary, expect truncate "
)
tdSql
.
query
(
"select cast(c8 as binary(2)) as b from ct4"
)
tdSql
.
query
(
"select cast(c8 as binary(2)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c8
)):
for
i
in
range
(
len
(
data_ct4_c8
)):
tdSql
.
checkData
(
i
,
0
,
data_ct4_c8
[
i
][:
2
]
)
if
data_ct4_c8
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
elif
tdSql
.
getData
(
i
,
0
)
==
data_ct4_c8
[
i
][:
2
]:
tdLog
.
info
(
f
"sql:
{
tdSql
.
sql
}
, row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
== expect:
{
data_ct4_c8
[
i
][:
2
]
}
"
)
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
tdLog
.
exit
(
f
"
{
caller
.
filename
}
(
{
caller
.
lineno
}
) failed: sql:
{
tdSql
.
sql
}
row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
!= expect:
{
data_ct4_c8
[
i
][:
2
]
}
"
)
tdSql
.
query
(
"select cast(c8 as binary(2)) as b from t1"
)
tdSql
.
query
(
"select cast(c8 as binary(2)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c8
)):
for
i
in
range
(
len
(
data_t1_c8
)):
tdSql
.
checkData
(
i
,
0
,
data_t1_c8
[
i
][:
2
]
)
if
data_t1_c8
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
elif
tdSql
.
getData
(
i
,
0
)
==
data_t1_c8
[
i
][:
2
]:
tdLog
.
info
(
f
"sql:
{
tdSql
.
sql
}
, row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
== expect:
{
data_t1_c8
[
i
][:
2
]
}
"
)
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
tdLog
.
exit
(
f
"
{
caller
.
filename
}
(
{
caller
.
lineno
}
) failed: sql:
{
tdSql
.
sql
}
row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
!= expect:
{
data_t1_c8
[
i
][:
2
]
}
"
)
tdLog
.
printNoPrefix
(
"==========step34: cast binary to nchar, expect changes to str(int) "
)
tdLog
.
printNoPrefix
(
"==========step34: cast binary to nchar, expect changes to str(int) "
)
tdSql
.
query
(
"select cast(c8 as nchar(32)) as b from ct4"
)
tdSql
.
query
(
"select cast(c8 as nchar(32)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c8
)):
for
i
in
range
(
len
(
data_ct4_c8
)):
tdSql
.
checkData
(
i
,
0
,
data_ct4_c8
[
i
]
)
if
data_ct4_c8
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
elif
tdSql
.
getData
(
i
,
0
)
==
data_ct4_c8
[
i
]:
tdLog
.
info
(
f
"sql:
{
tdSql
.
sql
}
, row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
== expect:
{
data_ct4_c8
[
i
]
}
"
)
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
tdLog
.
exit
(
f
"
{
caller
.
filename
}
(
{
caller
.
lineno
}
) failed: sql:
{
tdSql
.
sql
}
row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
!= expect:
{
data_ct4_c8
[
i
]
}
"
)
tdSql
.
query
(
"select cast(c8 as nchar(32)) as b from t1"
)
tdSql
.
query
(
"select cast(c8 as nchar(32)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c8
)):
for
i
in
range
(
len
(
data_t1_c8
)):
tdSql
.
checkData
(
i
,
0
,
data_t1_c8
[
i
]
)
if
data_t1_c8
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
elif
tdSql
.
getData
(
i
,
0
)
==
data_t1_c8
[
i
]:
tdLog
.
info
(
f
"sql:
{
tdSql
.
sql
}
, row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
== expect:
{
data_t1_c8
[
i
]
}
"
)
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
tdLog
.
exit
(
f
"
{
caller
.
filename
}
(
{
caller
.
lineno
}
) failed: sql:
{
tdSql
.
sql
}
row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
!= expect:
{
data_t1_c8
[
i
]
}
"
)
tdSql
.
query
(
"select c9 from ct4"
)
tdSql
.
query
(
"select c9 from ct4"
)
...
@@ -522,31 +523,84 @@ class TDTestCase:
...
@@ -522,31 +523,84 @@ class TDTestCase:
tdLog
.
printNoPrefix
(
"==========step35: cast nchar to nchar, expect no changes "
)
tdLog
.
printNoPrefix
(
"==========step35: cast nchar to nchar, expect no changes "
)
tdSql
.
query
(
"select cast(c9 as nchar(32)) as b from ct4"
)
tdSql
.
query
(
"select cast(c9 as nchar(32)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c9
)):
for
i
in
range
(
len
(
data_ct4_c9
)):
tdSql
.
checkData
(
i
,
0
,
data_ct4_c9
[
i
])
if
data_ct4_c9
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
elif
tdSql
.
getData
(
i
,
0
)
==
data_ct4_c9
[
i
]:
tdLog
.
info
(
f
"sql:
{
tdSql
.
sql
}
, row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
== expect:
{
data_ct4_c9
[
i
]
}
"
)
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
tdLog
.
exit
(
f
"
{
caller
.
filename
}
(
{
caller
.
lineno
}
) failed: sql:
{
tdSql
.
sql
}
row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
!= expect:
{
data_ct4_c9
[
i
]
}
"
)
tdSql
.
query
(
"select cast(c9 as nchar(32)) as b from t1"
)
tdSql
.
query
(
"select cast(c9 as nchar(32)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c9
)):
for
i
in
range
(
len
(
data_t1_c9
)):
tdSql
.
checkData
(
i
,
0
,
data_t1_c9
[
i
]
)
tdSql
.
checkData
(
i
,
0
,
data_t1_c9
[
i
]
)
if
data_t1_c9
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
elif
tdSql
.
getData
(
i
,
0
)
==
data_t1_c9
[
i
]:
tdLog
.
info
(
f
"sql:
{
tdSql
.
sql
}
, row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
== expect:
{
data_t1_c9
[
i
]
}
"
)
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
tdLog
.
exit
(
f
"
{
caller
.
filename
}
(
{
caller
.
lineno
}
) failed: sql:
{
tdSql
.
sql
}
row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
!= expect:
{
data_t1_c9
[
i
]
}
"
)
tdLog
.
printNoPrefix
(
"==========step36: cast nchar to nchar, expect truncate "
)
tdLog
.
printNoPrefix
(
"==========step36: cast nchar to nchar, expect truncate "
)
tdSql
.
query
(
"select cast(c9 as nchar(2)) as b from ct4"
)
tdSql
.
query
(
"select cast(c9 as nchar(2)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c9
)):
for
i
in
range
(
len
(
data_ct4_c9
)):
tdSql
.
checkData
(
i
,
0
,
data_ct4_c9
[
i
][:
2
]
)
if
data_ct4_c9
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
elif
tdSql
.
getData
(
i
,
0
)
==
data_ct4_c9
[
i
][:
2
]:
tdLog
.
info
(
f
"sql:
{
tdSql
.
sql
}
, row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
== expect:
{
data_ct4_c9
[
i
][:
2
]
}
"
)
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
tdLog
.
exit
(
f
"
{
caller
.
filename
}
(
{
caller
.
lineno
}
) failed: sql:
{
tdSql
.
sql
}
row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
!= expect:
{
data_ct4_c9
[
i
][:
2
]
}
"
)
tdSql
.
query
(
"select cast(c9 as nchar(2)) as b from t1"
)
tdSql
.
query
(
"select cast(c9 as nchar(2)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c9
)):
for
i
in
range
(
len
(
data_t1_c9
)):
tdSql
.
checkData
(
i
,
0
,
data_t1_c9
[
i
][:
2
]
)
if
data_t1_c9
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
elif
tdSql
.
getData
(
i
,
0
)
==
data_t1_c9
[
i
][:
2
]:
tdLog
.
info
(
f
"sql:
{
tdSql
.
sql
}
, row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
== expect:
{
data_t1_c9
[
i
][:
2
]
}
"
)
else
:
caller
=
inspect
.
getframeinfo
(
inspect
.
stack
()[
1
][
0
])
tdLog
.
exit
(
f
"
{
caller
.
filename
}
(
{
caller
.
lineno
}
) failed: sql:
{
tdSql
.
sql
}
row:
{
i
}
col:0 data:
{
tdSql
.
queryResult
[
i
][
0
]
}
!= expect:
{
data_t1_c9
[
i
][:
2
]
}
"
)
tdSql
.
query
(
"select c
9
from ct4"
)
tdSql
.
query
(
"select c
10
from ct4"
)
data_ct4_c10
=
[
tdSql
.
getData
(
i
,
0
)
for
i
in
range
(
tdSql
.
queryRows
)]
data_ct4_c10
=
[
tdSql
.
getData
(
i
,
0
)
for
i
in
range
(
tdSql
.
queryRows
)]
tdSql
.
query
(
"select c
9
from t1"
)
tdSql
.
query
(
"select c
10
from t1"
)
data_t1_c10
=
[
tdSql
.
getData
(
i
,
0
)
for
i
in
range
(
tdSql
.
queryRows
)]
data_t1_c10
=
[
tdSql
.
getData
(
i
,
0
)
for
i
in
range
(
tdSql
.
queryRows
)]
tdLog
.
printNoPrefix
(
"==========step37: cast timestamp to nchar, expect no changes "
)
tdLog
.
printNoPrefix
(
"==========step37: cast timestamp to nchar, expect no changes "
)
tdSql
.
query
(
"select cast(c
9
as nchar(32)) as b from ct4"
)
tdSql
.
query
(
"select cast(c
10
as nchar(32)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c10
)):
for
i
in
range
(
len
(
data_ct4_c10
)):
tdSql
.
checkData
(
i
,
0
,
data_ct4_c10
[
i
])
if
data_ct4_c10
[
i
]
is
None
:
tdSql
.
query
(
"select cast(c9 as nchar(32)) as b from t1"
)
tdSql
.
checkData
(
i
,
0
,
None
)
else
:
time2str
=
str
(
int
(
datetime
.
datetime
.
timestamp
(
data_ct4_c10
[
i
])
*
1000
))
tdSql
.
checkData
(
i
,
0
,
time2str
)
tdSql
.
query
(
"select cast(c10 as nchar(32)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c10
)):
for
i
in
range
(
len
(
data_t1_c10
)):
tdSql
.
checkData
(
i
,
0
,
data_t1_c10
[
i
]
)
if
data_t1_c10
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
elif
i
==
10
:
continue
else
:
time2str
=
str
(
int
(
datetime
.
datetime
.
timestamp
(
data_t1_c10
[
i
])
*
1000
))
tdSql
.
checkData
(
i
,
0
,
time2str
)
tdLog
.
printNoPrefix
(
"==========step38: cast timestamp to binary, expect no changes "
)
tdSql
.
query
(
"select cast(c10 as binary(32)) as b from ct4"
)
for
i
in
range
(
len
(
data_ct4_c10
)):
if
data_ct4_c10
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
else
:
time2str
=
str
(
int
(
datetime
.
datetime
.
timestamp
(
data_ct4_c10
[
i
])
*
1000
))
tdSql
.
checkData
(
i
,
0
,
time2str
)
tdSql
.
query
(
"select cast(c10 as binary(32)) as b from t1"
)
for
i
in
range
(
len
(
data_t1_c10
)):
if
data_t1_c10
[
i
]
is
None
:
tdSql
.
checkData
(
i
,
0
,
None
)
elif
i
==
10
:
continue
else
:
time2str
=
str
(
int
(
datetime
.
datetime
.
timestamp
(
data_t1_c10
[
i
])
*
1000
))
tdSql
.
checkData
(
i
,
0
,
time2str
)
tdSql
.
error
(
"select cast(c1 as int) as b from ct4"
)
tdSql
.
error
(
"select cast(c1 as int) as b from ct4"
)
...
@@ -567,12 +621,9 @@ class TDTestCase:
...
@@ -567,12 +621,9 @@ class TDTestCase:
tdSql
.
error
(
"select cast(c7 as double) as b from ct4"
)
tdSql
.
error
(
"select cast(c7 as double) as b from ct4"
)
tdSql
.
error
(
"select cast(c8 as tinyint unsigned) as b from ct4"
)
tdSql
.
error
(
"select cast(c8 as tinyint unsigned) as b from ct4"
)
tdSql
.
query
(
"select cast(c8 as timestamp ) as b from ct4"
)
tdSql
.
error
(
"select cast(c8 as timestamp ) as b from ct4"
)
tdSql
.
query
(
"select cast(c9 as timestamp ) as b from ct4"
)
tdSql
.
error
(
"select cast(c9 as timestamp ) as b from ct4"
)
tdSql
.
error
(
"select cast(c9 as binary(64) ) as b from ct4"
)
tdSql
.
error
(
"select cast(c9 as binary(64) ) as b from ct4"
)
tdSql
.
error
(
"select cast(c10 as binary(64) ) as b from ct4"
)
tdSql
.
error
(
"select cast(c10 as nchar(64) ) as b from ct4"
)
def
stop
(
self
):
def
stop
(
self
):
...
...
tests/system-test/fulltest.sh
浏览文件 @
055e0516
python3 ./test.py
-f
2-query/between.py
#!/bin/bash
set
-e
#python3 ./test.py -f 2-query/between.py
python3 ./test.py
-f
2-query/distinct.py
python3 ./test.py
-f
2-query/distinct.py
python3 ./test.py
-f
2-query/varchar.py
python3 ./test.py
-f
2-query/varchar.py
python3 ./test.py
-f
2-query/cast.py
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录