Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Mr、小李
TDengine
提交
d1828544
T
TDengine
项目概览
Mr、小李
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d1828544
编写于
3月 19, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-32] refactor the table meta
上级
9f8178d0
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
208 addition
and
209 deletion
+208
-209
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+3
-3
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-2
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+7
-7
src/client/src/tscJoinProcess.c
src/client/src/tscJoinProcess.c
+9
-9
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+5
-5
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+10
-10
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+66
-64
src/client/src/tscSecondaryMerge.c
src/client/src/tscSecondaryMerge.c
+10
-10
src/client/src/tscServer.c
src/client/src/tscServer.c
+41
-64
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-3
src/client/src/tscStream.c
src/client/src/tscStream.c
+3
-3
src/client/src/tscSub.c
src/client/src/tscSub.c
+2
-2
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+24
-24
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-1
tests/examples/c/demo.c
tests/examples/c/demo.c
+22
-2
未找到文件。
src/client/inc/tscUtil.h
浏览文件 @
d1828544
...
@@ -191,7 +191,7 @@ bool tscShouldFreeAsyncSqlObj(SSqlObj* pSql);
...
@@ -191,7 +191,7 @@ bool tscShouldFreeAsyncSqlObj(SSqlObj* pSql);
void
tscRemoveAllMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
address
,
bool
removeFromCache
);
void
tscRemoveAllMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
address
,
bool
removeFromCache
);
STableMetaInfo
*
tscGetMeterMetaInfo
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
,
int32_t
tableIndex
);
STableMetaInfo
*
tscGetMeterMetaInfo
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
,
int32_t
tableIndex
);
STableMetaInfo
*
tscGetMet
erMetaInfoFromQuery
Info
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
STableMetaInfo
*
tscGetMet
a
Info
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
);
SQueryInfo
*
tscGetQueryInfoDetail
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
);
SQueryInfo
*
tscGetQueryInfoDetail
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
);
int32_t
tscGetQueryInfoDetailSafely
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
,
SQueryInfo
**
pQueryInfo
);
int32_t
tscGetQueryInfoDetailSafely
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
,
SQueryInfo
**
pQueryInfo
);
...
@@ -201,14 +201,14 @@ void tscClearMeterMetaInfo(STableMetaInfo* pTableMetaInfo, bool remov
...
@@ -201,14 +201,14 @@ void tscClearMeterMetaInfo(STableMetaInfo* pTableMetaInfo, bool remov
STableMetaInfo
*
tscAddMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
STableMeta
*
pTableMeta
,
SSuperTableMeta
*
pMetricMeta
,
STableMetaInfo
*
tscAddMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
STableMeta
*
pTableMeta
,
SSuperTableMeta
*
pMetricMeta
,
int16_t
numOfTags
,
int16_t
*
tags
);
int16_t
numOfTags
,
int16_t
*
tags
);
STableMetaInfo
*
tscAddEmptyMet
erMet
aInfo
(
SQueryInfo
*
pQueryInfo
);
STableMetaInfo
*
tscAddEmptyMetaInfo
(
SQueryInfo
*
pQueryInfo
);
int32_t
tscAddSubqueryInfo
(
SSqlCmd
*
pCmd
);
int32_t
tscAddSubqueryInfo
(
SSqlCmd
*
pCmd
);
void
tscFreeSubqueryInfo
(
SSqlCmd
*
pCmd
);
void
tscFreeSubqueryInfo
(
SSqlCmd
*
pCmd
);
void
tscClearSubqueryInfo
(
SSqlCmd
*
pCmd
);
void
tscClearSubqueryInfo
(
SSqlCmd
*
pCmd
);
void
tscGetMetricMetaCacheKey
(
SQueryInfo
*
pQueryInfo
,
char
*
keyStr
,
uint64_t
uid
);
void
tscGetMetricMetaCacheKey
(
SQueryInfo
*
pQueryInfo
,
char
*
keyStr
,
uint64_t
uid
);
int
tscGetMetricMeta
(
SSqlObj
*
pSql
,
int32_t
clauseIndex
);
int
tscGetMetricMeta
(
SSqlObj
*
pSql
,
int32_t
clauseIndex
);
int
tscGet
Meter
Meta
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
);
int
tscGet
Table
Meta
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
);
int
tscGetMeterMetaEx
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
,
bool
createIfNotExists
);
int
tscGetMeterMetaEx
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
,
bool
createIfNotExists
);
void
tscResetForNextRetrieve
(
SSqlRes
*
pRes
);
void
tscResetForNextRetrieve
(
SSqlRes
*
pRes
);
...
...
src/client/inc/tsclient.h
浏览文件 @
d1828544
...
@@ -238,7 +238,7 @@ typedef struct SDataBlockList {
...
@@ -238,7 +238,7 @@ typedef struct SDataBlockList {
typedef
struct
SQueryInfo
{
typedef
struct
SQueryInfo
{
int16_t
command
;
// the command may be different for each subclause, so keep it seperately.
int16_t
command
;
// the command may be different for each subclause, so keep it seperately.
uint16_t
type
;
// query/insert/import type
uint16_t
type
;
// query/insert/import type
char
interval
TimeUnit
;
char
sliding
TimeUnit
;
int64_t
etime
,
stime
;
int64_t
etime
,
stime
;
int64_t
intervalTime
;
// aggregation time interval
int64_t
intervalTime
;
// aggregation time interval
...
@@ -254,7 +254,7 @@ typedef struct SQueryInfo {
...
@@ -254,7 +254,7 @@ typedef struct SQueryInfo {
SOrderVal
order
;
SOrderVal
order
;
int16_t
interpoType
;
// interpolate type
int16_t
interpoType
;
// interpolate type
int16_t
numOfTables
;
int16_t
numOfTables
;
STableMetaInfo
**
p
Meter
Info
;
STableMetaInfo
**
p
TableMeta
Info
;
struct
STSBuf
*
tsBuf
;
struct
STSBuf
*
tsBuf
;
int64_t
*
defaultVal
;
// default value for interpolation
int64_t
*
defaultVal
;
// default value for interpolation
char
*
msg
;
// pointer to the pCmd->payload to keep error message temporarily
char
*
msg
;
// pointer to the pCmd->payload to keep error message temporarily
...
...
src/client/src/tscAsync.c
浏览文件 @
d1828544
...
@@ -407,7 +407,7 @@ void tscAsyncInsertMultiVnodesProxy(void *param, TAOS_RES *tres, int numOfRows)
...
@@ -407,7 +407,7 @@ void tscAsyncInsertMultiVnodesProxy(void *param, TAOS_RES *tres, int numOfRows)
int32_t
index
=
0
;
int32_t
index
=
0
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
index
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
index
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
assert
(
pQueryInfo
->
numOfTables
==
1
||
pQueryInfo
->
numOfTables
==
2
);
assert
(
pQueryInfo
->
numOfTables
==
1
||
pQueryInfo
->
numOfTables
==
2
);
SDataBlockList
*
pDataBlocks
=
pCmd
->
pDataBlocks
;
SDataBlockList
*
pDataBlocks
=
pCmd
->
pDataBlocks
;
...
@@ -441,7 +441,7 @@ void tscAsyncInsertMultiVnodesProxy(void *param, TAOS_RES *tres, int numOfRows)
...
@@ -441,7 +441,7 @@ void tscAsyncInsertMultiVnodesProxy(void *param, TAOS_RES *tres, int numOfRows)
int
tscSendMsgToServer
(
SSqlObj
*
pSql
);
int
tscSendMsgToServer
(
SSqlObj
*
pSql
);
void
tsc
Meter
MetaCallBack
(
void
*
param
,
TAOS_RES
*
res
,
int
code
)
{
void
tsc
Table
MetaCallBack
(
void
*
param
,
TAOS_RES
*
res
,
int
code
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
param
;
SSqlObj
*
pSql
=
(
SSqlObj
*
)
param
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
return
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
return
;
...
@@ -468,7 +468,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
...
@@ -468,7 +468,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
STableMetaInfo
*
pTableMetaInfo
=
tscGetMeterMetaInfo
(
&
pSql
->
cmd
,
0
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMeterMetaInfo
(
&
pSql
->
cmd
,
0
,
0
);
assert
(
pTableMetaInfo
->
pTableMeta
==
NULL
);
assert
(
pTableMetaInfo
->
pTableMeta
==
NULL
);
tscGet
Meter
Meta
(
pSql
,
pTableMetaInfo
);
tscGet
Table
Meta
(
pSql
,
pTableMetaInfo
);
code
=
tscSendMsgToServer
(
pSql
);
code
=
tscSendMsgToServer
(
pSql
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
pRes
->
code
=
code
;
pRes
->
code
=
code
;
...
@@ -490,7 +490,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
...
@@ -490,7 +490,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
if
((
pQueryInfo
->
type
&
TSDB_QUERY_TYPE_STABLE_SUBQUERY
)
==
TSDB_QUERY_TYPE_STABLE_SUBQUERY
)
{
if
((
pQueryInfo
->
type
&
TSDB_QUERY_TYPE_STABLE_SUBQUERY
)
==
TSDB_QUERY_TYPE_STABLE_SUBQUERY
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
assert
((
tscGetNumOfTags
(
pTableMetaInfo
->
pTableMeta
)
!=
0
)
&&
pTableMetaInfo
->
vnodeIndex
>=
0
&&
pSql
->
param
!=
NULL
);
assert
((
tscGetNumOfTags
(
pTableMetaInfo
->
pTableMeta
)
!=
0
)
&&
pTableMetaInfo
->
vnodeIndex
>=
0
&&
pSql
->
param
!=
NULL
);
SRetrieveSupport
*
trs
=
(
SRetrieveSupport
*
)
pSql
->
param
;
SRetrieveSupport
*
trs
=
(
SRetrieveSupport
*
)
pSql
->
param
;
...
@@ -501,7 +501,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
...
@@ -501,7 +501,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
tscTrace
(
"%p get metricMeta during super table query successfully"
,
pSql
);
tscTrace
(
"%p get metricMeta during super table query successfully"
,
pSql
);
code
=
tscGet
Meter
Meta
(
pSql
,
pTableMetaInfo
);
code
=
tscGet
Table
Meta
(
pSql
,
pTableMetaInfo
);
pRes
->
code
=
code
;
pRes
->
code
=
code
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
...
@@ -515,7 +515,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
...
@@ -515,7 +515,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
tscTrace
(
"%p resend data to vnode in metermeta callback since sql has been parsed completed"
,
pSql
);
tscTrace
(
"%p resend data to vnode in metermeta callback since sql has been parsed completed"
,
pSql
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
code
=
tscGet
Meter
Meta
(
pSql
,
pTableMetaInfo
);
code
=
tscGet
Table
Meta
(
pSql
,
pTableMetaInfo
);
assert
(
code
==
TSDB_CODE_SUCCESS
);
assert
(
code
==
TSDB_CODE_SUCCESS
);
if
(
pTableMetaInfo
->
pTableMeta
)
{
if
(
pTableMetaInfo
->
pTableMeta
)
{
...
@@ -530,7 +530,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
...
@@ -530,7 +530,7 @@ void tscMeterMetaCallBack(void *param, TAOS_RES *res, int code) {
}
else
{
// stream computing
}
else
{
// stream computing
STableMetaInfo
*
pTableMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMeterMetaInfo
(
pCmd
,
pCmd
->
clauseIndex
,
0
);
code
=
tscGet
Meter
Meta
(
pSql
,
pTableMetaInfo
);
code
=
tscGet
Table
Meta
(
pSql
,
pTableMetaInfo
);
pRes
->
code
=
code
;
pRes
->
code
=
code
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
...
...
src/client/src/tscJoinProcess.c
浏览文件 @
d1828544
...
@@ -315,7 +315,7 @@ int32_t tscLaunchSecondPhaseSubqueries(SSqlObj* pSql) {
...
@@ -315,7 +315,7 @@ int32_t tscLaunchSecondPhaseSubqueries(SSqlObj* pSql) {
tscFieldInfoCalOffset
(
pNewQueryInfo
);
tscFieldInfoCalOffset
(
pNewQueryInfo
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pNewQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pNewQueryInfo
,
0
);
/*
/*
* When handling the projection query, the offset value will be modified for table-table join, which is changed
* When handling the projection query, the offset value will be modified for table-table join, which is changed
...
@@ -339,7 +339,7 @@ int32_t tscLaunchSecondPhaseSubqueries(SSqlObj* pSql) {
...
@@ -339,7 +339,7 @@ int32_t tscLaunchSecondPhaseSubqueries(SSqlObj* pSql) {
tscTrace
(
"%p subquery:%p tableIndex:%d, vnodeIdx:%d, type:%d, exprInfo:%d, colList:%d, fieldsInfo:%d, name:%s"
,
tscTrace
(
"%p subquery:%p tableIndex:%d, vnodeIdx:%d, type:%d, exprInfo:%d, colList:%d, fieldsInfo:%d, name:%s"
,
pSql
,
pNew
,
0
,
pTableMetaInfo
->
vnodeIndex
,
pNewQueryInfo
->
type
,
pSql
,
pNew
,
0
,
pTableMetaInfo
->
vnodeIndex
,
pNewQueryInfo
->
type
,
pNewQueryInfo
->
exprsInfo
.
numOfExprs
,
pNewQueryInfo
->
colList
.
numOfCols
,
pNewQueryInfo
->
exprsInfo
.
numOfExprs
,
pNewQueryInfo
->
colList
.
numOfCols
,
pNewQueryInfo
->
fieldsInfo
.
numOfOutputCols
,
pNewQueryInfo
->
p
Meter
Info
[
0
]
->
name
);
pNewQueryInfo
->
fieldsInfo
.
numOfOutputCols
,
pNewQueryInfo
->
p
TableMeta
Info
[
0
]
->
name
);
}
}
//prepare the subqueries object failed, abort
//prepare the subqueries object failed, abort
...
@@ -450,7 +450,7 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) {
...
@@ -450,7 +450,7 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) {
pSupporter
->
pTSBuf
=
pBuf
;
pSupporter
->
pTSBuf
=
pBuf
;
}
else
{
}
else
{
assert
(
pQueryInfo
->
numOfTables
==
1
);
// for subquery, only one metermetaInfo
assert
(
pQueryInfo
->
numOfTables
==
1
);
// for subquery, only one metermetaInfo
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
tsBufMerge
(
pSupporter
->
pTSBuf
,
pBuf
,
pTableMetaInfo
->
vnodeIndex
);
tsBufMerge
(
pSupporter
->
pTSBuf
,
pBuf
,
pTableMetaInfo
->
vnodeIndex
);
tsBufDestory
(
pBuf
);
tsBufDestory
(
pBuf
);
...
@@ -467,7 +467,7 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) {
...
@@ -467,7 +467,7 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) {
//todo refactor
//todo refactor
if
(
tscNonOrderedProjectionQueryOnSTable
(
pParentQueryInfo
,
0
))
{
if
(
tscNonOrderedProjectionQueryOnSTable
(
pParentQueryInfo
,
0
))
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
assert
(
pQueryInfo
->
numOfTables
==
1
);
assert
(
pQueryInfo
->
numOfTables
==
1
);
// for projection query, need to try next vnode
// for projection query, need to try next vnode
...
@@ -532,7 +532,7 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) {
...
@@ -532,7 +532,7 @@ static void joinRetrieveCallback(void* param, TAOS_RES* tres, int numOfRows) {
}
}
if
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
numOfRows
==
0
)
{
if
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
numOfRows
==
0
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
assert
(
pQueryInfo
->
numOfTables
==
1
);
assert
(
pQueryInfo
->
numOfTables
==
1
);
// for projection query, need to try next vnode if current vnode is exhausted
// for projection query, need to try next vnode if current vnode is exhausted
...
@@ -600,7 +600,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
...
@@ -600,7 +600,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
SSqlRes
*
pRes
=
&
pSql
->
pSubs
[
i
]
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
pSubs
[
i
]
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
pSubs
[
i
]
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
pSubs
[
i
]
->
cmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
if
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
if
(
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
if
(
pRes
->
row
>=
pRes
->
numOfRows
&&
pTableMetaInfo
->
vnodeIndex
<
pTableMetaInfo
->
pMetricMeta
->
numOfVnodes
&&
if
(
pRes
->
row
>=
pRes
->
numOfRows
&&
pTableMetaInfo
->
vnodeIndex
<
pTableMetaInfo
->
pMetricMeta
->
numOfVnodes
&&
...
@@ -638,7 +638,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
...
@@ -638,7 +638,7 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd1
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd1
,
0
);
assert
(
pRes1
->
numOfRows
>=
0
&&
pQueryInfo
->
numOfTables
==
1
);
assert
(
pRes1
->
numOfRows
>=
0
&&
pQueryInfo
->
numOfTables
==
1
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
if
(
pRes1
->
row
>=
pRes1
->
numOfRows
)
{
if
(
pRes1
->
row
>=
pRes1
->
numOfRows
)
{
tscTrace
(
"%p subquery:%p retrieve data from vnode, subquery:%d, vnodeIndex:%d"
,
pSql
,
pSql1
,
tscTrace
(
"%p subquery:%p retrieve data from vnode, subquery:%d, vnodeIndex:%d"
,
pSql
,
pSql1
,
...
@@ -688,7 +688,7 @@ void tscSetupOutputColumnIndex(SSqlObj* pSql) {
...
@@ -688,7 +688,7 @@ void tscSetupOutputColumnIndex(SSqlObj* pSql) {
int32_t
tableIndexOfSub
=
-
1
;
int32_t
tableIndexOfSub
=
-
1
;
for
(
int32_t
j
=
0
;
j
<
pQueryInfo
->
numOfTables
;
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
pQueryInfo
->
numOfTables
;
++
j
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
j
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
j
);
if
(
pTableMetaInfo
->
pTableMeta
->
uid
==
pExpr
->
uid
)
{
if
(
pTableMetaInfo
->
pTableMeta
->
uid
==
pExpr
->
uid
)
{
tableIndexOfSub
=
j
;
tableIndexOfSub
=
j
;
break
;
break
;
...
@@ -776,7 +776,7 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
...
@@ -776,7 +776,7 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
assert
(
finished
==
numOfTotal
);
assert
(
finished
==
numOfTotal
);
tscSetupOutputColumnIndex
(
pParentSql
);
tscSetupOutputColumnIndex
(
pParentSql
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
/**
/**
* if the query is a continue query (vnodeIndex > 0 for projection query) for next vnode, do the retrieval of
* if the query is a continue query (vnodeIndex > 0 for projection query) for next vnode, do the retrieval of
...
...
src/client/src/tscLocal.c
浏览文件 @
d1828544
...
@@ -110,7 +110,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
...
@@ -110,7 +110,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
// one column for each row
// one column for each row
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
STableMeta
*
pMeta
=
pTableMetaInfo
->
pTableMeta
;
STableMeta
*
pMeta
=
pTableMetaInfo
->
pTableMeta
;
/*
/*
...
@@ -267,7 +267,7 @@ static int32_t tscBuildMeterSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
...
@@ -267,7 +267,7 @@ static int32_t tscBuildMeterSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
static
int32_t
tscProcessDescribeTable
(
SSqlObj
*
pSql
)
{
static
int32_t
tscProcessDescribeTable
(
SSqlObj
*
pSql
)
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
assert
(
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
)
->
pTableMeta
!=
NULL
);
assert
(
tscGetMet
a
Info
(
pQueryInfo
,
0
)
->
pTableMeta
!=
NULL
);
const
int32_t
NUM_OF_DESCRIBE_TABLE_COLUMNS
=
4
;
const
int32_t
NUM_OF_DESCRIBE_TABLE_COLUMNS
=
4
;
const
int32_t
TYPE_COLUMN_LENGTH
=
16
;
const
int32_t
TYPE_COLUMN_LENGTH
=
16
;
...
@@ -292,7 +292,7 @@ static int tscBuildMetricTagProjectionResult(SSqlObj *pSql) {
...
@@ -292,7 +292,7 @@ static int tscBuildMetricTagProjectionResult(SSqlObj *pSql) {
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
SSuperTableMeta
*
pMetricMeta
=
pTableMetaInfo
->
pMetricMeta
;
SSuperTableMeta
*
pMetricMeta
=
pTableMetaInfo
->
pMetricMeta
;
SSchema
*
pSchema
=
tscGetTableTagSchema
(
pTableMetaInfo
->
pTableMeta
);
SSchema
*
pSchema
=
tscGetTableTagSchema
(
pTableMetaInfo
->
pTableMeta
);
...
@@ -345,7 +345,7 @@ static int tscBuildMetricTagSqlFunctionResult(SSqlObj *pSql) {
...
@@ -345,7 +345,7 @@ static int tscBuildMetricTagSqlFunctionResult(SSqlObj *pSql) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SSuperTableMeta
*
pMetricMeta
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
)
->
pMetricMeta
;
SSuperTableMeta
*
pMetricMeta
=
tscGetMet
a
Info
(
pQueryInfo
,
0
)
->
pMetricMeta
;
int32_t
totalNumOfResults
=
1
;
// count function only produce one result
int32_t
totalNumOfResults
=
1
;
// count function only produce one result
int32_t
rowLen
=
tscGetResRowLength
(
pQueryInfo
);
int32_t
rowLen
=
tscGetResRowLength
(
pQueryInfo
);
...
@@ -377,7 +377,7 @@ static int tscProcessQueryTags(SSqlObj *pSql) {
...
@@ -377,7 +377,7 @@ static int tscProcessQueryTags(SSqlObj *pSql) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMeta
*
pTableMeta
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
)
->
pTableMeta
;
STableMeta
*
pTableMeta
=
tscGetMet
a
Info
(
pQueryInfo
,
0
)
->
pTableMeta
;
if
(
pTableMeta
==
NULL
||
tscGetNumOfTags
(
pTableMeta
)
==
0
||
tscGetNumOfColumns
(
pTableMeta
)
==
0
)
{
if
(
pTableMeta
==
NULL
||
tscGetNumOfTags
(
pTableMeta
)
==
0
||
tscGetNumOfColumns
(
pTableMeta
)
==
0
)
{
strcpy
(
pCmd
->
payload
,
"invalid table"
);
strcpy
(
pCmd
->
payload
,
"invalid table"
);
pSql
->
res
.
code
=
TSDB_CODE_INVALID_TABLE
;
pSql
->
res
.
code
=
TSDB_CODE_INVALID_TABLE
;
...
...
src/client/src/tscParseInsert.c
浏览文件 @
d1828544
...
@@ -759,7 +759,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
...
@@ -759,7 +759,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
return
TSDB_CODE_INVALID_SQL
;
return
TSDB_CODE_INVALID_SQL
;
}
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
TABLE_INDEX
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
TABLE_INDEX
);
if
(
sToken
.
type
==
TK_USING
)
{
// create table if not exists according to the super table
if
(
sToken
.
type
==
TK_USING
)
{
// create table if not exists according to the super table
index
=
0
;
index
=
0
;
...
@@ -773,14 +773,14 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
...
@@ -773,14 +773,14 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
* the source super table is moved to the secondary position of the pTableMetaInfo list
* the source super table is moved to the secondary position of the pTableMetaInfo list
*/
*/
if
(
pQueryInfo
->
numOfTables
<
2
)
{
if
(
pQueryInfo
->
numOfTables
<
2
)
{
tscAddEmptyMet
erMet
aInfo
(
pQueryInfo
);
tscAddEmptyMetaInfo
(
pQueryInfo
);
}
}
STableMetaInfo
*
pSTableMeterMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
STABLE_INDEX
);
STableMetaInfo
*
pSTableMeterMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
STABLE_INDEX
);
setMeterID
(
pSTableMeterMetaInfo
,
&
sToken
,
pSql
);
setMeterID
(
pSTableMeterMetaInfo
,
&
sToken
,
pSql
);
strncpy
(
pTag
->
name
,
pSTableMeterMetaInfo
->
name
,
TSDB_TABLE_ID_LEN
);
strncpy
(
pTag
->
name
,
pSTableMeterMetaInfo
->
name
,
TSDB_TABLE_ID_LEN
);
code
=
tscGet
Meter
Meta
(
pSql
,
pSTableMeterMetaInfo
);
code
=
tscGet
Table
Meta
(
pSql
,
pSTableMeterMetaInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
return
code
;
}
}
...
@@ -937,7 +937,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
...
@@ -937,7 +937,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
}
else
{
}
else
{
sql
=
sToken
.
z
;
sql
=
sToken
.
z
;
}
}
code
=
tscGet
Meter
Meta
(
pSql
,
pTableMetaInfo
);
code
=
tscGet
Table
Meta
(
pSql
,
pTableMetaInfo
);
}
}
int32_t
len
=
cend
-
cstart
+
1
;
int32_t
len
=
cend
-
cstart
+
1
;
...
@@ -992,9 +992,9 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
...
@@ -992,9 +992,9 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
assert
(
pQueryInfo
!=
NULL
);
assert
(
pQueryInfo
!=
NULL
);
if
(
pQueryInfo
->
numOfTables
==
0
)
{
if
(
pQueryInfo
->
numOfTables
==
0
)
{
pTableMetaInfo
=
tscAddEmptyMet
erMet
aInfo
(
pQueryInfo
);
pTableMetaInfo
=
tscAddEmptyMetaInfo
(
pQueryInfo
);
}
else
{
}
else
{
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
}
}
if
((
code
=
tscAllocPayload
(
pCmd
,
TSDB_PAYLOAD_SIZE
))
!=
TSDB_CODE_SUCCESS
)
{
if
((
code
=
tscAllocPayload
(
pCmd
,
TSDB_PAYLOAD_SIZE
))
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -1340,7 +1340,7 @@ int tsParseSql(SSqlObj *pSql, bool multiVnodeInsertion) {
...
@@ -1340,7 +1340,7 @@ int tsParseSql(SSqlObj *pSql, bool multiVnodeInsertion) {
}
}
/*
/*
* the pRes->code may be modified or even released by another thread in tsc
Meter
MetaCallBack
* the pRes->code may be modified or even released by another thread in tsc
Table
MetaCallBack
* function, so do NOT use pRes->code to determine if the getMeterMeta/getMetricMeta function
* function, so do NOT use pRes->code to determine if the getMeterMeta/getMetricMeta function
* invokes new threads to get data from mnode or simply retrieves data from cache.
* invokes new threads to get data from mnode or simply retrieves data from cache.
*
*
...
@@ -1521,7 +1521,7 @@ void tscProcessMultiVnodesInsertFromFile(SSqlObj *pSql) {
...
@@ -1521,7 +1521,7 @@ void tscProcessMultiVnodesInsertFromFile(SSqlObj *pSql) {
}
}
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
STableDataBlocks
*
pDataBlock
=
NULL
;
STableDataBlocks
*
pDataBlock
=
NULL
;
int32_t
affected_rows
=
0
;
int32_t
affected_rows
=
0
;
...
@@ -1555,7 +1555,7 @@ void tscProcessMultiVnodesInsertFromFile(SSqlObj *pSql) {
...
@@ -1555,7 +1555,7 @@ void tscProcessMultiVnodesInsertFromFile(SSqlObj *pSql) {
strncpy
(
pTableMetaInfo
->
name
,
pDataBlock
->
tableId
,
TSDB_TABLE_ID_LEN
);
strncpy
(
pTableMetaInfo
->
name
,
pDataBlock
->
tableId
,
TSDB_TABLE_ID_LEN
);
memset
(
pDataBlock
->
pData
,
0
,
pDataBlock
->
nAllocSize
);
memset
(
pDataBlock
->
pData
,
0
,
pDataBlock
->
nAllocSize
);
int32_t
ret
=
tscGet
Meter
Meta
(
pSql
,
pTableMetaInfo
);
int32_t
ret
=
tscGet
Table
Meta
(
pSql
,
pTableMetaInfo
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"%p get meter meta failed, abort"
,
pSql
);
tscError
(
"%p get meter meta failed, abort"
,
pSql
);
continue
;
continue
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
d1828544
此差异已折叠。
点击以展开。
src/client/src/tscSecondaryMerge.c
浏览文件 @
d1828544
...
@@ -325,7 +325,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
...
@@ -325,7 +325,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
int16_t
prec
=
tinfo
.
precision
;
int16_t
prec
=
tinfo
.
precision
;
int64_t
stime
=
(
pQueryInfo
->
stime
<
pQueryInfo
->
etime
)
?
pQueryInfo
->
stime
:
pQueryInfo
->
etime
;
int64_t
stime
=
(
pQueryInfo
->
stime
<
pQueryInfo
->
etime
)
?
pQueryInfo
->
stime
:
pQueryInfo
->
etime
;
int64_t
revisedSTime
=
int64_t
revisedSTime
=
taosGetIntervalStartTimestamp
(
stime
,
pQueryInfo
->
intervalTime
,
pQueryInfo
->
interval
TimeUnit
,
prec
);
taosGetIntervalStartTimestamp
(
stime
,
pQueryInfo
->
intervalTime
,
pQueryInfo
->
sliding
TimeUnit
,
prec
);
SInterpolationInfo
*
pInterpoInfo
=
&
pReducer
->
interpolationInfo
;
SInterpolationInfo
*
pInterpoInfo
=
&
pReducer
->
interpolationInfo
;
taosInitInterpoInfo
(
pInterpoInfo
,
pQueryInfo
->
order
.
order
,
revisedSTime
,
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
,
taosInitInterpoInfo
(
pInterpoInfo
,
pQueryInfo
->
order
.
order
,
revisedSTime
,
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
,
...
@@ -603,7 +603,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
...
@@ -603,7 +603,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
*
pFinalModel
=
NULL
;
*
pFinalModel
=
NULL
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
(
*
pMemBuffer
)
=
(
tExtMemBuffer
**
)
malloc
(
POINTER_BYTES
*
pTableMetaInfo
->
pMetricMeta
->
numOfVnodes
);
(
*
pMemBuffer
)
=
(
tExtMemBuffer
**
)
malloc
(
POINTER_BYTES
*
pTableMetaInfo
->
pMetricMeta
->
numOfVnodes
);
if
(
*
pMemBuffer
==
NULL
)
{
if
(
*
pMemBuffer
==
NULL
)
{
...
@@ -775,14 +775,14 @@ void adjustLoserTreeFromNewData(SLocalReducer *pLocalReducer, SLocalDataSource *
...
@@ -775,14 +775,14 @@ void adjustLoserTreeFromNewData(SLocalReducer *pLocalReducer, SLocalDataSource *
void
savePrevRecordAndSetupInterpoInfo
(
SLocalReducer
*
pLocalReducer
,
SQueryInfo
*
pQueryInfo
,
void
savePrevRecordAndSetupInterpoInfo
(
SLocalReducer
*
pLocalReducer
,
SQueryInfo
*
pQueryInfo
,
SInterpolationInfo
*
pInterpoInfo
)
{
SInterpolationInfo
*
pInterpoInfo
)
{
// discard following dataset in the same group and reset the interpolation information
// discard following dataset in the same group and reset the interpolation information
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
STableInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
STableInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
int16_t
prec
=
tinfo
.
precision
;
int16_t
prec
=
tinfo
.
precision
;
int64_t
stime
=
(
pQueryInfo
->
stime
<
pQueryInfo
->
etime
)
?
pQueryInfo
->
stime
:
pQueryInfo
->
etime
;
int64_t
stime
=
(
pQueryInfo
->
stime
<
pQueryInfo
->
etime
)
?
pQueryInfo
->
stime
:
pQueryInfo
->
etime
;
int64_t
revisedSTime
=
int64_t
revisedSTime
=
taosGetIntervalStartTimestamp
(
stime
,
pQueryInfo
->
intervalTime
,
pQueryInfo
->
interval
TimeUnit
,
prec
);
taosGetIntervalStartTimestamp
(
stime
,
pQueryInfo
->
intervalTime
,
pQueryInfo
->
sliding
TimeUnit
,
prec
);
taosInitInterpoInfo
(
pInterpoInfo
,
pQueryInfo
->
order
.
order
,
revisedSTime
,
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
,
taosInitInterpoInfo
(
pInterpoInfo
,
pQueryInfo
->
order
.
order
,
revisedSTime
,
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
,
pLocalReducer
->
rowSize
);
pLocalReducer
->
rowSize
);
...
@@ -928,7 +928,7 @@ static void doInterpolateResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, boo
...
@@ -928,7 +928,7 @@ static void doInterpolateResult(SSqlObj *pSql, SLocalReducer *pLocalReducer, boo
while
(
1
)
{
while
(
1
)
{
int32_t
remains
=
taosNumOfRemainPoints
(
pInterpoInfo
);
int32_t
remains
=
taosNumOfRemainPoints
(
pInterpoInfo
);
TSKEY
etime
=
taosGetRevisedEndKey
(
actualETime
,
pQueryInfo
->
order
.
order
,
pQueryInfo
->
intervalTime
,
TSKEY
etime
=
taosGetRevisedEndKey
(
actualETime
,
pQueryInfo
->
order
.
order
,
pQueryInfo
->
intervalTime
,
pQueryInfo
->
interval
TimeUnit
,
precision
);
pQueryInfo
->
sliding
TimeUnit
,
precision
);
int32_t
nrows
=
taosGetNumOfResultWithInterpo
(
pInterpoInfo
,
pPrimaryKeys
,
remains
,
pQueryInfo
->
intervalTime
,
etime
,
int32_t
nrows
=
taosGetNumOfResultWithInterpo
(
pInterpoInfo
,
pPrimaryKeys
,
remains
,
pQueryInfo
->
intervalTime
,
etime
,
pLocalReducer
->
resColModel
->
capacity
);
pLocalReducer
->
resColModel
->
capacity
);
...
@@ -1282,7 +1282,7 @@ static void resetEnvForNewResultset(SSqlRes *pRes, SSqlCmd *pCmd, SLocalReducer
...
@@ -1282,7 +1282,7 @@ static void resetEnvForNewResultset(SSqlRes *pRes, SSqlCmd *pCmd, SLocalReducer
if
(
pQueryInfo
->
interpoType
!=
TSDB_INTERPO_NONE
)
{
if
(
pQueryInfo
->
interpoType
!=
TSDB_INTERPO_NONE
)
{
int64_t
stime
=
(
pQueryInfo
->
stime
<
pQueryInfo
->
etime
)
?
pQueryInfo
->
stime
:
pQueryInfo
->
etime
;
int64_t
stime
=
(
pQueryInfo
->
stime
<
pQueryInfo
->
etime
)
?
pQueryInfo
->
stime
:
pQueryInfo
->
etime
;
int64_t
newTime
=
int64_t
newTime
=
taosGetIntervalStartTimestamp
(
stime
,
pQueryInfo
->
intervalTime
,
pQueryInfo
->
interval
TimeUnit
,
precision
);
taosGetIntervalStartTimestamp
(
stime
,
pQueryInfo
->
intervalTime
,
pQueryInfo
->
sliding
TimeUnit
,
precision
);
taosInitInterpoInfo
(
&
pLocalReducer
->
interpolationInfo
,
pQueryInfo
->
order
.
order
,
newTime
,
taosInitInterpoInfo
(
&
pLocalReducer
->
interpolationInfo
,
pQueryInfo
->
order
.
order
,
newTime
,
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
,
pLocalReducer
->
rowSize
);
pQueryInfo
->
groupbyExpr
.
numOfGroupCols
,
pLocalReducer
->
rowSize
);
...
@@ -1301,7 +1301,7 @@ static bool doInterpolationForCurrentGroup(SSqlObj *pSql) {
...
@@ -1301,7 +1301,7 @@ static bool doInterpolationForCurrentGroup(SSqlObj *pSql) {
SLocalReducer
*
pLocalReducer
=
pRes
->
pLocalReducer
;
SLocalReducer
*
pLocalReducer
=
pRes
->
pLocalReducer
;
SInterpolationInfo
*
pInterpoInfo
=
&
pLocalReducer
->
interpolationInfo
;
SInterpolationInfo
*
pInterpoInfo
=
&
pLocalReducer
->
interpolationInfo
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
STableInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
STableInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
int8_t
p
=
tinfo
.
precision
;
int8_t
p
=
tinfo
.
precision
;
...
@@ -1314,7 +1314,7 @@ static bool doInterpolationForCurrentGroup(SSqlObj *pSql) {
...
@@ -1314,7 +1314,7 @@ static bool doInterpolationForCurrentGroup(SSqlObj *pSql) {
int32_t
remain
=
taosNumOfRemainPoints
(
pInterpoInfo
);
int32_t
remain
=
taosNumOfRemainPoints
(
pInterpoInfo
);
TSKEY
ekey
=
TSKEY
ekey
=
taosGetRevisedEndKey
(
etime
,
pQueryInfo
->
order
.
order
,
pQueryInfo
->
intervalTime
,
pQueryInfo
->
interval
TimeUnit
,
p
);
taosGetRevisedEndKey
(
etime
,
pQueryInfo
->
order
.
order
,
pQueryInfo
->
intervalTime
,
pQueryInfo
->
sliding
TimeUnit
,
p
);
int32_t
rows
=
taosGetNumOfResultWithInterpo
(
pInterpoInfo
,
(
TSKEY
*
)
pLocalReducer
->
pBufForInterpo
,
remain
,
int32_t
rows
=
taosGetNumOfResultWithInterpo
(
pInterpoInfo
,
(
TSKEY
*
)
pLocalReducer
->
pBufForInterpo
,
remain
,
pQueryInfo
->
intervalTime
,
ekey
,
pLocalReducer
->
resColModel
->
capacity
);
pQueryInfo
->
intervalTime
,
ekey
,
pLocalReducer
->
resColModel
->
capacity
);
if
(
rows
>
0
)
{
// do interpo
if
(
rows
>
0
)
{
// do interpo
...
@@ -1337,7 +1337,7 @@ static bool doHandleLastRemainData(SSqlObj *pSql) {
...
@@ -1337,7 +1337,7 @@ static bool doHandleLastRemainData(SSqlObj *pSql) {
bool
prevGroupCompleted
=
(
!
pLocalReducer
->
discard
)
&&
pLocalReducer
->
hasUnprocessedRow
;
bool
prevGroupCompleted
=
(
!
pLocalReducer
->
discard
)
&&
pLocalReducer
->
hasUnprocessedRow
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
STableInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
STableInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
int8_t
precision
=
tinfo
.
precision
;
int8_t
precision
=
tinfo
.
precision
;
...
@@ -1349,7 +1349,7 @@ static bool doHandleLastRemainData(SSqlObj *pSql) {
...
@@ -1349,7 +1349,7 @@ static bool doHandleLastRemainData(SSqlObj *pSql) {
int64_t
etime
=
(
pQueryInfo
->
stime
<
pQueryInfo
->
etime
)
?
pQueryInfo
->
etime
:
pQueryInfo
->
stime
;
int64_t
etime
=
(
pQueryInfo
->
stime
<
pQueryInfo
->
etime
)
?
pQueryInfo
->
etime
:
pQueryInfo
->
stime
;
etime
=
taosGetRevisedEndKey
(
etime
,
pQueryInfo
->
order
.
order
,
pQueryInfo
->
intervalTime
,
etime
=
taosGetRevisedEndKey
(
etime
,
pQueryInfo
->
order
.
order
,
pQueryInfo
->
intervalTime
,
pQueryInfo
->
interval
TimeUnit
,
precision
);
pQueryInfo
->
sliding
TimeUnit
,
precision
);
int32_t
rows
=
taosGetNumOfResultWithInterpo
(
pInterpoInfo
,
NULL
,
0
,
pQueryInfo
->
intervalTime
,
etime
,
int32_t
rows
=
taosGetNumOfResultWithInterpo
(
pInterpoInfo
,
NULL
,
0
,
pQueryInfo
->
intervalTime
,
etime
,
pLocalReducer
->
resColModel
->
capacity
);
pLocalReducer
->
resColModel
->
capacity
);
if
(
rows
>
0
)
{
// do interpo
if
(
rows
>
0
)
{
// do interpo
...
...
src/client/src/tscServer.c
浏览文件 @
d1828544
...
@@ -436,7 +436,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSubquerySu
...
@@ -436,7 +436,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSubquerySu
// set the tags value for ts_comp function
// set the tags value for ts_comp function
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pNewQueryInfo
,
0
);
SSqlExpr
*
pExpr
=
tscSqlExprGet
(
pNewQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pNewQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pNewQueryInfo
,
0
);
int16_t
tagColIndex
=
tscGetJoinTagColIndexByUid
(
&
pSupporter
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
uid
);
int16_t
tagColIndex
=
tscGetJoinTagColIndexByUid
(
&
pSupporter
->
tagCond
,
pTableMetaInfo
->
pTableMeta
->
uid
);
pExpr
->
param
->
i64Key
=
tagColIndex
;
pExpr
->
param
->
i64Key
=
tagColIndex
;
...
@@ -455,14 +455,14 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSubquerySu
...
@@ -455,14 +455,14 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSubquerySu
"exprInfo:%d, colList:%d, fieldsInfo:%d, name:%s"
,
"exprInfo:%d, colList:%d, fieldsInfo:%d, name:%s"
,
pSql
,
pNew
,
tableIndex
,
pTableMetaInfo
->
vnodeIndex
,
pNewQueryInfo
->
type
,
pSql
,
pNew
,
tableIndex
,
pTableMetaInfo
->
vnodeIndex
,
pNewQueryInfo
->
type
,
pNewQueryInfo
->
exprsInfo
.
numOfExprs
,
pNewQueryInfo
->
colList
.
numOfCols
,
pNewQueryInfo
->
exprsInfo
.
numOfExprs
,
pNewQueryInfo
->
colList
.
numOfCols
,
pNewQueryInfo
->
fieldsInfo
.
numOfOutputCols
,
pNewQueryInfo
->
p
Meter
Info
[
0
]
->
name
);
pNewQueryInfo
->
fieldsInfo
.
numOfOutputCols
,
pNewQueryInfo
->
p
TableMeta
Info
[
0
]
->
name
);
tscPrintSelectClause
(
pNew
,
0
);
tscPrintSelectClause
(
pNew
,
0
);
tscTrace
(
"%p subquery:%p tableIndex:%d, vnodeIdx:%d, type:%d, transfer to ts_comp query to retrieve timestamps, "
tscTrace
(
"%p subquery:%p tableIndex:%d, vnodeIdx:%d, type:%d, transfer to ts_comp query to retrieve timestamps, "
"exprInfo:%d, colList:%d, fieldsInfo:%d, name:%s"
,
"exprInfo:%d, colList:%d, fieldsInfo:%d, name:%s"
,
pSql
,
pNew
,
tableIndex
,
pTableMetaInfo
->
vnodeIndex
,
pNewQueryInfo
->
type
,
pSql
,
pNew
,
tableIndex
,
pTableMetaInfo
->
vnodeIndex
,
pNewQueryInfo
->
type
,
pNewQueryInfo
->
exprsInfo
.
numOfExprs
,
pNewQueryInfo
->
colList
.
numOfCols
,
pNewQueryInfo
->
exprsInfo
.
numOfExprs
,
pNewQueryInfo
->
colList
.
numOfCols
,
pNewQueryInfo
->
fieldsInfo
.
numOfOutputCols
,
pNewQueryInfo
->
p
Meter
Info
[
0
]
->
name
);
pNewQueryInfo
->
fieldsInfo
.
numOfOutputCols
,
pNewQueryInfo
->
p
TableMeta
Info
[
0
]
->
name
);
tscPrintSelectClause
(
pNew
,
0
);
tscPrintSelectClause
(
pNew
,
0
);
}
else
{
}
else
{
SQueryInfo
*
pNewQueryInfo
=
tscGetQueryInfoDetail
(
&
pNew
->
cmd
,
0
);
SQueryInfo
*
pNewQueryInfo
=
tscGetQueryInfoDetail
(
&
pNew
->
cmd
,
0
);
...
@@ -521,7 +521,7 @@ int tscProcessSql(SSqlObj *pSql) {
...
@@ -521,7 +521,7 @@ int tscProcessSql(SSqlObj *pSql) {
int16_t
type
=
0
;
int16_t
type
=
0
;
if
(
pQueryInfo
!=
NULL
)
{
if
(
pQueryInfo
!=
NULL
)
{
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
if
(
pTableMetaInfo
!=
NULL
)
{
if
(
pTableMetaInfo
!=
NULL
)
{
name
=
pTableMetaInfo
->
name
;
name
=
pTableMetaInfo
->
name
;
}
}
...
@@ -668,7 +668,7 @@ int tscLaunchSTableSubqueries(SSqlObj *pSql) {
...
@@ -668,7 +668,7 @@ int tscLaunchSTableSubqueries(SSqlObj *pSql) {
const
uint32_t
nBufferSize
=
(
1
<<
16
);
// 64KB
const
uint32_t
nBufferSize
=
(
1
<<
16
);
// 64KB
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
int32_t
numOfSubQueries
=
pTableMetaInfo
->
pMetricMeta
->
numOfVnodes
;
int32_t
numOfSubQueries
=
pTableMetaInfo
->
pMetricMeta
->
numOfVnodes
;
assert
(
numOfSubQueries
>
0
);
assert
(
numOfSubQueries
>
0
);
...
@@ -929,7 +929,7 @@ void tscRetrieveFromVnodeCallBack(void *param, TAOS_RES *tres, int numOfRows) {
...
@@ -929,7 +929,7 @@ void tscRetrieveFromVnodeCallBack(void *param, TAOS_RES *tres, int numOfRows) {
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
SVnodeSidList
*
vnodeInfo
=
tscGetVnodeSidList
(
pTableMetaInfo
->
pMetricMeta
,
idx
);
SVnodeSidList
*
vnodeInfo
=
tscGetVnodeSidList
(
pTableMetaInfo
->
pMetricMeta
,
idx
);
SVnodeDesc
*
pSvd
=
&
vnodeInfo
->
vpeerDesc
[
vnodeInfo
->
index
];
SVnodeDesc
*
pSvd
=
&
vnodeInfo
->
vpeerDesc
[
vnodeInfo
->
index
];
...
@@ -1110,7 +1110,7 @@ static SSqlObj *tscCreateSqlObjForSubquery(SSqlObj *pSql, SRetrieveSupport *trsu
...
@@ -1110,7 +1110,7 @@ static SSqlObj *tscCreateSqlObjForSubquery(SSqlObj *pSql, SRetrieveSupport *trsu
assert
(
pQueryInfo
->
numOfTables
==
1
&&
pNew
->
cmd
.
numOfClause
==
1
);
assert
(
pQueryInfo
->
numOfTables
==
1
&&
pNew
->
cmd
.
numOfClause
==
1
);
// launch subquery for each vnode, so the subquery index equals to the vnodeIndex.
// launch subquery for each vnode, so the subquery index equals to the vnodeIndex.
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
table_index
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
table_index
);
pTableMetaInfo
->
vnodeIndex
=
trsupport
->
subqueryIndex
;
pTableMetaInfo
->
vnodeIndex
=
trsupport
->
subqueryIndex
;
pSql
->
pSubs
[
trsupport
->
subqueryIndex
]
=
pNew
;
pSql
->
pSubs
[
trsupport
->
subqueryIndex
]
=
pNew
;
...
@@ -1176,7 +1176,7 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
...
@@ -1176,7 +1176,7 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
trsupport
->
numOfRetry
=
MAX_NUM_OF_SUBQUERY_RETRY
;
trsupport
->
numOfRetry
=
MAX_NUM_OF_SUBQUERY_RETRY
;
}
else
{
}
else
{
SQueryInfo
*
pNewQueryInfo
=
tscGetQueryInfoDetail
(
&
pNew
->
cmd
,
0
);
SQueryInfo
*
pNewQueryInfo
=
tscGetQueryInfoDetail
(
&
pNew
->
cmd
,
0
);
assert
(
pNewQueryInfo
->
p
MeterInfo
[
0
]
->
pTableMeta
!=
NULL
&&
pNewQueryInfo
->
pMeter
Info
[
0
]
->
pMetricMeta
!=
NULL
);
assert
(
pNewQueryInfo
->
p
TableMetaInfo
[
0
]
->
pTableMeta
!=
NULL
&&
pNewQueryInfo
->
pTableMeta
Info
[
0
]
->
pMetricMeta
!=
NULL
);
tscProcessSql
(
pNew
);
tscProcessSql
(
pNew
);
return
;
return
;
}
}
...
@@ -1298,7 +1298,7 @@ static int32_t tscEstimateQueryMsgSize(SSqlCmd *pCmd, int32_t clauseIndex) {
...
@@ -1298,7 +1298,7 @@ static int32_t tscEstimateQueryMsgSize(SSqlCmd *pCmd, int32_t clauseIndex) {
int32_t
srcColListSize
=
pQueryInfo
->
colList
.
numOfCols
*
sizeof
(
SColumnInfo
);
int32_t
srcColListSize
=
pQueryInfo
->
colList
.
numOfCols
*
sizeof
(
SColumnInfo
);
int32_t
exprSize
=
sizeof
(
SSqlFuncExprMsg
)
*
pQueryInfo
->
exprsInfo
.
numOfExprs
;
int32_t
exprSize
=
sizeof
(
SSqlFuncExprMsg
)
*
pQueryInfo
->
exprsInfo
.
numOfExprs
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
// meter query without tags values
// meter query without tags values
if
(
!
UTIL_METER_IS_SUPERTABLE
(
pTableMetaInfo
))
{
if
(
!
UTIL_METER_IS_SUPERTABLE
(
pTableMetaInfo
))
{
...
@@ -1330,21 +1330,21 @@ static char *doSerializeTableInfo(SSqlObj *pSql, int32_t numOfTables, int32_t vn
...
@@ -1330,21 +1330,21 @@ static char *doSerializeTableInfo(SSqlObj *pSql, int32_t numOfTables, int32_t vn
#ifdef _DEBUG_VIEW
#ifdef _DEBUG_VIEW
tscTrace
(
"%p sid:%d, uid:%"
PRIu64
,
pSql
,
pTableMetaInfo
->
pTableMeta
->
sid
,
pTableMetaInfo
->
pTableMeta
->
uid
);
tscTrace
(
"%p sid:%d, uid:%"
PRIu64
,
pSql
,
pTableMetaInfo
->
pTableMeta
->
sid
,
pTableMetaInfo
->
pTableMeta
->
uid
);
#endif
#endif
STableSidExtInfo
*
p
Meter
Info
=
(
STableSidExtInfo
*
)
pMsg
;
STableSidExtInfo
*
p
TableMeta
Info
=
(
STableSidExtInfo
*
)
pMsg
;
p
Meter
Info
->
sid
=
htonl
(
pTableMeta
->
sid
);
p
TableMeta
Info
->
sid
=
htonl
(
pTableMeta
->
sid
);
p
Meter
Info
->
uid
=
htobe64
(
pTableMeta
->
uid
);
p
TableMeta
Info
->
uid
=
htobe64
(
pTableMeta
->
uid
);
p
Meter
Info
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pTableMeta
->
uid
));
p
TableMeta
Info
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pTableMeta
->
uid
));
pMsg
+=
sizeof
(
STableSidExtInfo
);
pMsg
+=
sizeof
(
STableSidExtInfo
);
}
else
{
}
else
{
SVnodeSidList
*
pVnodeSidList
=
tscGetVnodeSidList
(
pMetricMeta
,
pTableMetaInfo
->
vnodeIndex
);
SVnodeSidList
*
pVnodeSidList
=
tscGetVnodeSidList
(
pMetricMeta
,
pTableMetaInfo
->
vnodeIndex
);
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
STableSidExtInfo
*
p
Meter
Info
=
(
STableSidExtInfo
*
)
pMsg
;
STableSidExtInfo
*
p
TableMeta
Info
=
(
STableSidExtInfo
*
)
pMsg
;
STableSidExtInfo
*
pQueryMeterInfo
=
tscGetMeterSidInfo
(
pVnodeSidList
,
i
);
STableSidExtInfo
*
pQueryMeterInfo
=
tscGetMeterSidInfo
(
pVnodeSidList
,
i
);
p
Meter
Info
->
sid
=
htonl
(
pQueryMeterInfo
->
sid
);
p
TableMeta
Info
->
sid
=
htonl
(
pQueryMeterInfo
->
sid
);
p
Meter
Info
->
uid
=
htobe64
(
pQueryMeterInfo
->
uid
);
p
TableMeta
Info
->
uid
=
htobe64
(
pQueryMeterInfo
->
uid
);
p
Meter
Info
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pQueryMeterInfo
->
uid
));
p
TableMeta
Info
->
key
=
htobe64
(
tscGetSubscriptionProgress
(
pSql
->
pSubscription
,
pQueryMeterInfo
->
uid
));
pMsg
+=
sizeof
(
STableSidExtInfo
);
pMsg
+=
sizeof
(
STableSidExtInfo
);
...
@@ -1371,7 +1371,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1371,7 +1371,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
}
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
char
*
pStart
=
pCmd
->
payload
+
tsRpcHeadSize
;
char
*
pStart
=
pCmd
->
payload
+
tsRpcHeadSize
;
...
@@ -1438,7 +1438,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1438,7 +1438,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
}
pQueryMsg
->
intervalTime
=
htobe64
(
pQueryInfo
->
intervalTime
);
pQueryMsg
->
intervalTime
=
htobe64
(
pQueryInfo
->
intervalTime
);
pQueryMsg
->
intervalTimeUnit
=
pQueryInfo
->
interval
TimeUnit
;
pQueryMsg
->
slidingTimeUnit
=
pQueryInfo
->
sliding
TimeUnit
;
pQueryMsg
->
slidingTime
=
htobe64
(
pQueryInfo
->
slidingTime
);
pQueryMsg
->
slidingTime
=
htobe64
(
pQueryInfo
->
slidingTime
);
if
(
pQueryInfo
->
intervalTime
<
0
)
{
if
(
pQueryInfo
->
intervalTime
<
0
)
{
...
@@ -1968,7 +1968,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -1968,7 +1968,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
// Reallocate the payload size
// Reallocate the payload size
size
=
tscEstimateCreateTableMsgLength
(
pSql
,
pInfo
);
size
=
tscEstimateCreateTableMsgLength
(
pSql
,
pInfo
);
...
@@ -2047,7 +2047,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -2047,7 +2047,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
size
=
tscEstimateAlterTableMsgLength
(
pCmd
);
size
=
tscEstimateAlterTableMsgLength
(
pCmd
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
...
@@ -2186,7 +2186,7 @@ int tscProcessTagRetrieveRsp(SSqlObj *pSql) {
...
@@ -2186,7 +2186,7 @@ int tscProcessTagRetrieveRsp(SSqlObj *pSql) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
int32_t
numOfRes
=
0
;
int32_t
numOfRes
=
0
;
if
(
tscSqlExprGet
(
pQueryInfo
,
0
)
->
functionId
==
TSDB_FUNC_TAGPRJ
)
{
if
(
tscSqlExprGet
(
pQueryInfo
,
0
)
->
functionId
==
TSDB_FUNC_TAGPRJ
)
{
...
@@ -2266,7 +2266,7 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -2266,7 +2266,7 @@ int tscBuildTableMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
pInfoMsg
=
(
SCMTableInfoMsg
*
)
pCmd
->
payload
;
pInfoMsg
=
(
SCMTableInfoMsg
*
)
pCmd
->
payload
;
strcpy
(
pInfoMsg
->
tableId
,
pTableMetaInfo
->
name
);
strcpy
(
pInfoMsg
->
tableId
,
pTableMetaInfo
->
name
);
...
@@ -2365,7 +2365,7 @@ int tscBuildMetricMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
...
@@ -2365,7 +2365,7 @@ int tscBuildMetricMetaMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
STagCond
*
pTagCond
=
&
pQueryInfo
->
tagCond
;
STagCond
*
pTagCond
=
&
pQueryInfo
->
tagCond
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
tableIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
tableIndex
);
int32_t
size
=
tscEstimateMetricMetaMsgSize
(
pCmd
);
int32_t
size
=
tscEstimateMetricMetaMsgSize
(
pCmd
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
pCmd
,
size
))
{
...
@@ -2833,7 +2833,7 @@ int tscProcessMetricMetaRsp(SSqlObj *pSql) {
...
@@ -2833,7 +2833,7 @@ int tscProcessMetricMetaRsp(SSqlObj *pSql) {
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
char
name
[
TSDB_MAX_TAGS_LEN
+
1
]
=
{
0
};
char
name
[
TSDB_MAX_TAGS_LEN
+
1
]
=
{
0
};
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
i
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
i
);
tscGetMetricMetaCacheKey
(
pQueryInfo
,
name
,
pTableMetaInfo
->
pTableMeta
->
uid
);
tscGetMetricMetaCacheKey
(
pQueryInfo
,
name
,
pTableMetaInfo
->
pTableMeta
->
uid
);
#ifdef _DEBUG_VIEW
#ifdef _DEBUG_VIEW
...
@@ -2880,7 +2880,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
...
@@ -2880,7 +2880,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
pShow
=
(
SCMShowRsp
*
)
pRes
->
pRsp
;
pShow
=
(
SCMShowRsp
*
)
pRes
->
pRsp
;
pShow
->
qhandle
=
htobe64
(
pShow
->
qhandle
);
pShow
->
qhandle
=
htobe64
(
pShow
->
qhandle
);
...
@@ -3093,11 +3093,9 @@ int tscProcessRetrieveRspFromLocal(SSqlObj *pSql) {
...
@@ -3093,11 +3093,9 @@ int tscProcessRetrieveRspFromLocal(SSqlObj *pSql) {
return
0
;
return
0
;
}
}
void
tsc
Meter
MetaCallBack
(
void
*
param
,
TAOS_RES
*
res
,
int
code
);
void
tsc
Table
MetaCallBack
(
void
*
param
,
TAOS_RES
*
res
,
int
code
);
static
int32_t
doGetMeterMetaFromServer
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
)
{
static
int32_t
doGetMeterMetaFromServer
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
)
{
int32_t
code
=
TSDB_CODE_SUCCESS
;
SSqlObj
*
pNew
=
calloc
(
1
,
sizeof
(
SSqlObj
));
SSqlObj
*
pNew
=
calloc
(
1
,
sizeof
(
SSqlObj
));
if
(
NULL
==
pNew
)
{
if
(
NULL
==
pNew
)
{
tscError
(
"%p malloc failed for new sqlobj to get meter meta"
,
pSql
);
tscError
(
"%p malloc failed for new sqlobj to get meter meta"
,
pSql
);
...
@@ -3121,46 +3119,25 @@ static int32_t doGetMeterMetaFromServer(SSqlObj *pSql, STableMetaInfo *pTableMet
...
@@ -3121,46 +3119,25 @@ static int32_t doGetMeterMetaFromServer(SSqlObj *pSql, STableMetaInfo *pTableMet
return
TSDB_CODE_CLI_OUT_OF_MEMORY
;
return
TSDB_CODE_CLI_OUT_OF_MEMORY
;
}
}
STableMetaInfo
*
pNewMeterMetaInfo
=
tscAddEmptyMet
erMet
aInfo
(
pNewQueryInfo
);
STableMetaInfo
*
pNewMeterMetaInfo
=
tscAddEmptyMetaInfo
(
pNewQueryInfo
);
assert
(
pNew
->
cmd
.
numOfClause
==
1
&&
pNewQueryInfo
->
numOfTables
==
1
);
assert
(
pNew
->
cmd
.
numOfClause
==
1
&&
pNewQueryInfo
->
numOfTables
==
1
);
strcpy
(
pNewMeterMetaInfo
->
name
,
pTableMetaInfo
->
name
);
strcpy
(
pNewMeterMetaInfo
->
name
,
pTableMetaInfo
->
name
);
memcpy
(
pNew
->
cmd
.
payload
,
pSql
->
cmd
.
payload
,
TSDB_DEFAULT_PAYLOAD_SIZE
);
// tag information if table does not exists.
memcpy
(
pNew
->
cmd
.
payload
,
pSql
->
cmd
.
payload
,
TSDB_DEFAULT_PAYLOAD_SIZE
);
// tag information if table does not exists.
tscTrace
(
"%p new pSqlObj:%p to get tableMeta"
,
pSql
,
pNew
);
tscTrace
(
"%p new pSqlObj:%p to get tableMeta"
,
pSql
,
pNew
);
if
(
pSql
->
fp
==
NULL
)
{
pNew
->
fp
=
tscTableMetaCallBack
;
tsem_init
(
&
pNew
->
rspSem
,
0
,
0
);
pNew
->
param
=
pSql
;
tsem_init
(
&
pNew
->
emptyRspSem
,
0
,
1
);
code
=
tscProcessSql
(
pNew
);
/*
* Update cache only on succeeding in getting metermeta.
* Transfer the ownership of metermeta to the new object, instead of invoking the release/acquire routine
*/
if
(
code
==
TSDB_CODE_SUCCESS
)
{
pTableMetaInfo
->
pTableMeta
=
taosCacheTransfer
(
tscCacheHandle
,
(
void
**
)
&
pNewMeterMetaInfo
->
pTableMeta
);
assert
(
pTableMetaInfo
->
pTableMeta
!=
NULL
);
}
tscTrace
(
"%p get meter meta complete, code:%d, pTableMeta:%p"
,
pSql
,
code
,
pTableMetaInfo
->
pTableMeta
);
tscFreeSqlObj
(
pNew
);
}
else
{
pNew
->
fp
=
tscMeterMetaCallBack
;
pNew
->
param
=
pSql
;
pNew
->
sqlstr
=
strdup
(
pSql
->
sqlstr
);
code
=
tscProcessSql
(
pNew
);
int32_t
code
=
tscProcessSql
(
pNew
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
code
=
TSDB_CODE_ACTION_IN_PROGRESS
;
}
}
}
return
code
;
return
code
;
}
}
int
tscGetMeter
Meta
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
)
{
int
32_t
tscGetTable
Meta
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
)
{
assert
(
strlen
(
pTableMetaInfo
->
name
)
!=
0
);
assert
(
strlen
(
pTableMetaInfo
->
name
)
!=
0
);
// If this STableMetaInfo owns a metermeta, release it first
// If this STableMetaInfo owns a metermeta, release it first
...
@@ -3179,14 +3156,14 @@ int tscGetMeterMeta(SSqlObj *pSql, STableMetaInfo *pTableMetaInfo) {
...
@@ -3179,14 +3156,14 @@ int tscGetMeterMeta(SSqlObj *pSql, STableMetaInfo *pTableMetaInfo) {
/*
/*
* for async insert operation, release data block buffer before issue new object to get metermeta
* for async insert operation, release data block buffer before issue new object to get metermeta
* because in
meter
meta callback function, the tscParse function will generate the submit data blocks
* because in
table
meta callback function, the tscParse function will generate the submit data blocks
*/
*/
return
doGetMeterMetaFromServer
(
pSql
,
pTableMetaInfo
);
return
doGetMeterMetaFromServer
(
pSql
,
pTableMetaInfo
);
}
}
int
tscGetMeterMetaEx
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
,
bool
createIfNotExists
)
{
int
tscGetMeterMetaEx
(
SSqlObj
*
pSql
,
STableMetaInfo
*
pTableMetaInfo
,
bool
createIfNotExists
)
{
pSql
->
cmd
.
createOnDemand
=
createIfNotExists
;
pSql
->
cmd
.
createOnDemand
=
createIfNotExists
;
return
tscGet
Meter
Meta
(
pSql
,
pTableMetaInfo
);
return
tscGet
Table
Meta
(
pSql
,
pTableMetaInfo
);
}
}
/*
/*
...
@@ -3215,7 +3192,7 @@ int tscRenewMeterMeta(SSqlObj *pSql, char *tableId) {
...
@@ -3215,7 +3192,7 @@ int tscRenewMeterMeta(SSqlObj *pSql, char *tableId) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
// enforce the renew metermeta operation in async model
// enforce the renew metermeta operation in async model
if
(
pSql
->
fp
==
NULL
)
pSql
->
fp
=
(
void
*
)
0x1
;
if
(
pSql
->
fp
==
NULL
)
pSql
->
fp
=
(
void
*
)
0x1
;
...
@@ -3262,7 +3239,7 @@ int tscGetMetricMeta(SSqlObj *pSql, int32_t clauseIndex) {
...
@@ -3262,7 +3239,7 @@ int tscGetMetricMeta(SSqlObj *pSql, int32_t clauseIndex) {
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
char
tagstr
[
TSDB_MAX_TAGS_LEN
+
1
]
=
{
0
};
char
tagstr
[
TSDB_MAX_TAGS_LEN
+
1
]
=
{
0
};
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
i
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
i
);
tscGetMetricMetaCacheKey
(
pQueryInfo
,
tagstr
,
pTableMetaInfo
->
pTableMeta
->
uid
);
tscGetMetricMetaCacheKey
(
pQueryInfo
,
tagstr
,
pTableMetaInfo
->
pTableMeta
->
uid
);
taosCacheRelease
(
tscCacheHandle
,
(
void
**
)
&
(
pTableMetaInfo
->
pMetricMeta
),
false
);
taosCacheRelease
(
tscCacheHandle
,
(
void
**
)
&
(
pTableMetaInfo
->
pMetricMeta
),
false
);
...
@@ -3293,7 +3270,7 @@ int tscGetMetricMeta(SSqlObj *pSql, int32_t clauseIndex) {
...
@@ -3293,7 +3270,7 @@ int tscGetMetricMeta(SSqlObj *pSql, int32_t clauseIndex) {
}
}
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
STableMetaInfo
*
pMMInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
i
);
STableMetaInfo
*
pMMInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
i
);
STableMeta
*
pTableMeta
=
taosCacheAcquireByName
(
tscCacheHandle
,
pMMInfo
->
name
);
STableMeta
*
pTableMeta
=
taosCacheAcquireByName
(
tscCacheHandle
,
pMMInfo
->
name
);
tscAddMeterMetaInfo
(
pNewQueryInfo
,
pMMInfo
->
name
,
pTableMeta
,
NULL
,
pMMInfo
->
numOfTags
,
pMMInfo
->
tagColumnIndex
);
tscAddMeterMetaInfo
(
pNewQueryInfo
,
pMMInfo
->
name
,
pTableMeta
,
NULL
,
pMMInfo
->
numOfTags
,
pMMInfo
->
tagColumnIndex
);
...
@@ -3333,7 +3310,7 @@ int tscGetMetricMeta(SSqlObj *pSql, int32_t clauseIndex) {
...
@@ -3333,7 +3310,7 @@ int tscGetMetricMeta(SSqlObj *pSql, int32_t clauseIndex) {
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
char
tagstr
[
TSDB_MAX_TAGS_LEN
]
=
{
0
};
char
tagstr
[
TSDB_MAX_TAGS_LEN
]
=
{
0
};
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
i
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
i
);
tscGetMetricMetaCacheKey
(
pQueryInfo
,
tagstr
,
pTableMetaInfo
->
pTableMeta
->
uid
);
tscGetMetricMetaCacheKey
(
pQueryInfo
,
tagstr
,
pTableMetaInfo
->
pTableMeta
->
uid
);
#ifdef _DEBUG_VIEW
#ifdef _DEBUG_VIEW
...
@@ -3347,7 +3324,7 @@ int tscGetMetricMeta(SSqlObj *pSql, int32_t clauseIndex) {
...
@@ -3347,7 +3324,7 @@ int tscGetMetricMeta(SSqlObj *pSql, int32_t clauseIndex) {
tscFreeSqlObj
(
pNew
);
tscFreeSqlObj
(
pNew
);
}
else
{
}
else
{
pNew
->
fp
=
tsc
Meter
MetaCallBack
;
pNew
->
fp
=
tsc
Table
MetaCallBack
;
pNew
->
param
=
pSql
;
pNew
->
param
=
pSql
;
code
=
tscProcessSql
(
pNew
);
code
=
tscProcessSql
(
pNew
);
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
...
...
src/client/src/tscSql.c
浏览文件 @
d1828544
...
@@ -509,7 +509,7 @@ static bool tscHashRemainDataInSubqueryResultSet(SSqlObj *pSql) {
...
@@ -509,7 +509,7 @@ static bool tscHashRemainDataInSubqueryResultSet(SSqlObj *pSql) {
SSqlCmd
*
pCmd1
=
&
pSql
->
pSubs
[
i
]
->
cmd
;
SSqlCmd
*
pCmd1
=
&
pSql
->
pSubs
[
i
]
->
cmd
;
SQueryInfo
*
pQueryInfo1
=
tscGetQueryInfoDetail
(
pCmd1
,
pCmd1
->
clauseIndex
);
SQueryInfo
*
pQueryInfo1
=
tscGetQueryInfoDetail
(
pCmd1
,
pCmd1
->
clauseIndex
);
STableMetaInfo
*
pMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo1
,
0
);
STableMetaInfo
*
pMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo1
,
0
);
assert
(
pQueryInfo1
->
numOfTables
==
1
);
assert
(
pQueryInfo1
->
numOfTables
==
1
);
...
@@ -810,7 +810,7 @@ void taos_free_result_imp(TAOS_RES *res, int keepCmd) {
...
@@ -810,7 +810,7 @@ void taos_free_result_imp(TAOS_RES *res, int keepCmd) {
pQueryInfo
->
type
=
TSDB_QUERY_TYPE_FREE_RESOURCE
;
pQueryInfo
->
type
=
TSDB_QUERY_TYPE_FREE_RESOURCE
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
/*
/*
* case 1. Partial data have been retrieved from vnodes, but not all data has been retrieved yet.
* case 1. Partial data have been retrieved from vnodes, but not all data has been retrieved yet.
...
@@ -1109,7 +1109,7 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t
...
@@ -1109,7 +1109,7 @@ static int tscParseTblNameList(SSqlObj *pSql, const char *tblNameList, int32_t t
SQueryInfo
*
pQueryInfo
=
NULL
;
SQueryInfo
*
pQueryInfo
=
NULL
;
tscGetQueryInfoDetailSafely
(
pCmd
,
pCmd
->
clauseIndex
,
&
pQueryInfo
);
tscGetQueryInfoDetailSafely
(
pCmd
,
pCmd
->
clauseIndex
,
&
pQueryInfo
);
STableMetaInfo
*
pTableMetaInfo
=
tscAddEmptyMet
erMet
aInfo
(
pQueryInfo
);
STableMetaInfo
*
pTableMetaInfo
=
tscAddEmptyMetaInfo
(
pQueryInfo
);
if
((
code
=
tscAllocPayload
(
pCmd
,
tblListLen
+
16
))
!=
TSDB_CODE_SUCCESS
)
{
if
((
code
=
tscAllocPayload
(
pCmd
,
tblListLen
+
16
))
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
return
code
;
...
...
src/client/src/tscStream.c
浏览文件 @
d1828544
...
@@ -72,9 +72,9 @@ static void tscProcessStreamLaunchQuery(SSchedMsg *pMsg) {
...
@@ -72,9 +72,9 @@ static void tscProcessStreamLaunchQuery(SSchedMsg *pMsg) {
pSql
->
param
=
pStream
;
pSql
->
param
=
pStream
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
int
code
=
tscGet
Meter
Meta
(
pSql
,
pTableMetaInfo
);
int
code
=
tscGet
Table
Meta
(
pSql
,
pTableMetaInfo
);
pSql
->
res
.
code
=
code
;
pSql
->
res
.
code
=
code
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
if
(
code
==
TSDB_CODE_ACTION_IN_PROGRESS
)
return
;
...
@@ -540,7 +540,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
...
@@ -540,7 +540,7 @@ TAOS_STREAM *taos_open_stream(TAOS *taos, const char *sqlstr, void (*fp)(void *p
}
}
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
STableInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
STableInfo
tinfo
=
tscGetTableInfo
(
pTableMetaInfo
->
pTableMeta
);
pStream
->
fp
=
fp
;
pStream
->
fp
=
fp
;
...
...
src/client/src/tscSub.c
浏览文件 @
d1828544
...
@@ -202,8 +202,8 @@ int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
...
@@ -202,8 +202,8 @@ int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
for
(
int32_t
i
=
0
;
i
<
pMetricMeta
->
numOfVnodes
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
pMetricMeta
->
numOfVnodes
;
i
++
)
{
SVnodeSidList
*
pVnodeSidList
=
tscGetVnodeSidList
(
pMetricMeta
,
i
);
SVnodeSidList
*
pVnodeSidList
=
tscGetVnodeSidList
(
pMetricMeta
,
i
);
for
(
int32_t
j
=
0
;
j
<
pVnodeSidList
->
numOfSids
;
j
++
)
{
for
(
int32_t
j
=
0
;
j
<
pVnodeSidList
->
numOfSids
;
j
++
)
{
STableSidExtInfo
*
p
Meter
Info
=
tscGetMeterSidInfo
(
pVnodeSidList
,
j
);
STableSidExtInfo
*
p
TableMeta
Info
=
tscGetMeterSidInfo
(
pVnodeSidList
,
j
);
int64_t
uid
=
p
Meter
Info
->
uid
;
int64_t
uid
=
p
TableMeta
Info
->
uid
;
progress
[
numOfTables
].
uid
=
uid
;
progress
[
numOfTables
].
uid
=
uid
;
progress
[
numOfTables
++
].
key
=
tscGetSubscriptionProgress
(
pSub
,
uid
);
progress
[
numOfTables
++
].
key
=
tscGetSubscriptionProgress
(
pSub
,
uid
);
}
}
...
...
src/client/src/tscUtil.c
浏览文件 @
d1828544
...
@@ -214,7 +214,7 @@ bool tscIsTwoStageMergeMetricQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
...
@@ -214,7 +214,7 @@ bool tscIsTwoStageMergeMetricQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
return
false
;
return
false
;
}
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
tableIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
tableIndex
);
if
(
pTableMetaInfo
==
NULL
)
{
if
(
pTableMetaInfo
==
NULL
)
{
return
false
;
return
false
;
}
}
...
@@ -246,7 +246,7 @@ bool tscIsTwoStageMergeMetricQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
...
@@ -246,7 +246,7 @@ bool tscIsTwoStageMergeMetricQuery(SQueryInfo* pQueryInfo, int32_t tableIndex) {
}
}
bool
tscIsProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
bool
tscIsProjectionQueryOnSTable
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
tableIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
tableIndex
);
/*
/*
* In following cases, return false for non ordered project query on super table
* In following cases, return false for non ordered project query on super table
...
@@ -1116,7 +1116,7 @@ SSqlExpr* tscSqlExprInsertEmpty(SQueryInfo* pQueryInfo, int32_t index, int16_t f
...
@@ -1116,7 +1116,7 @@ SSqlExpr* tscSqlExprInsertEmpty(SQueryInfo* pQueryInfo, int32_t index, int16_t f
SSqlExpr
*
tscSqlExprInsert
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
SSqlExpr
*
tscSqlExprInsert
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
interSize
)
{
int16_t
type
,
int16_t
size
,
int16_t
interSize
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
pColIndex
->
tableIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
pColIndex
->
tableIndex
);
SSqlExprInfo
*
pExprInfo
=
&
pQueryInfo
->
exprsInfo
;
SSqlExprInfo
*
pExprInfo
=
&
pQueryInfo
->
exprsInfo
;
...
@@ -1161,7 +1161,7 @@ SSqlExpr* tscSqlExprInsert(SQueryInfo* pQueryInfo, int32_t index, int16_t functi
...
@@ -1161,7 +1161,7 @@ SSqlExpr* tscSqlExprInsert(SQueryInfo* pQueryInfo, int32_t index, int16_t functi
SSqlExpr
*
tscSqlExprUpdate
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
int16_t
functionId
,
int16_t
srcColumnIndex
,
SSqlExpr
*
tscSqlExprUpdate
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
int16_t
functionId
,
int16_t
srcColumnIndex
,
int16_t
type
,
int16_t
size
)
{
int16_t
type
,
int16_t
size
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
SSqlExprInfo
*
pExprInfo
=
&
pQueryInfo
->
exprsInfo
;
SSqlExprInfo
*
pExprInfo
=
&
pQueryInfo
->
exprsInfo
;
if
(
index
>
pExprInfo
->
numOfExprs
)
{
if
(
index
>
pExprInfo
->
numOfExprs
)
{
return
NULL
;
return
NULL
;
...
@@ -1629,7 +1629,7 @@ void tscTagCondRelease(STagCond* pCond) {
...
@@ -1629,7 +1629,7 @@ void tscTagCondRelease(STagCond* pCond) {
}
}
void
tscGetSrcColumnInfo
(
SSrcColumnInfo
*
pColInfo
,
SQueryInfo
*
pQueryInfo
)
{
void
tscGetSrcColumnInfo
(
SSrcColumnInfo
*
pColInfo
,
SQueryInfo
*
pQueryInfo
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMetaInfo
->
pTableMeta
);
SSchema
*
pSchema
=
tscGetTableSchema
(
pTableMetaInfo
->
pTableMeta
);
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
exprsInfo
.
numOfExprs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
exprsInfo
.
numOfExprs
;
++
i
)
{
...
@@ -1725,7 +1725,7 @@ bool tscShouldFreeAsyncSqlObj(SSqlObj* pSql) {
...
@@ -1725,7 +1725,7 @@ bool tscShouldFreeAsyncSqlObj(SSqlObj* pSql) {
SDataBlockList
*
pDataBlocks
=
pCmd
->
pDataBlocks
;
SDataBlockList
*
pDataBlocks
=
pCmd
->
pDataBlocks
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
assert
(
pQueryInfo
->
numOfTables
==
1
||
pQueryInfo
->
numOfTables
==
2
);
assert
(
pQueryInfo
->
numOfTables
==
1
||
pQueryInfo
->
numOfTables
==
2
);
if
(
pDataBlocks
==
NULL
||
pTableMetaInfo
->
vnodeIndex
>=
pDataBlocks
->
nSize
)
{
if
(
pDataBlocks
==
NULL
||
pTableMetaInfo
->
vnodeIndex
>=
pDataBlocks
->
nSize
)
{
...
@@ -1755,20 +1755,20 @@ STableMetaInfo* tscGetMeterMetaInfo(SSqlCmd* pCmd, int32_t clauseIndex, int32_t
...
@@ -1755,20 +1755,20 @@ STableMetaInfo* tscGetMeterMetaInfo(SSqlCmd* pCmd, int32_t clauseIndex, int32_t
assert
(
clauseIndex
>=
0
&&
clauseIndex
<
pCmd
->
numOfClause
);
assert
(
clauseIndex
>=
0
&&
clauseIndex
<
pCmd
->
numOfClause
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
clauseIndex
);
return
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
tableIndex
);
return
tscGetMet
a
Info
(
pQueryInfo
,
tableIndex
);
}
}
STableMetaInfo
*
tscGetMet
erMetaInfoFromQuery
Info
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
STableMetaInfo
*
tscGetMet
a
Info
(
SQueryInfo
*
pQueryInfo
,
int32_t
tableIndex
)
{
assert
(
pQueryInfo
!=
NULL
);
assert
(
pQueryInfo
!=
NULL
);
if
(
pQueryInfo
->
p
Meter
Info
==
NULL
)
{
if
(
pQueryInfo
->
p
TableMeta
Info
==
NULL
)
{
assert
(
pQueryInfo
->
numOfTables
==
0
);
assert
(
pQueryInfo
->
numOfTables
==
0
);
return
NULL
;
return
NULL
;
}
}
assert
(
tableIndex
>=
0
&&
tableIndex
<=
pQueryInfo
->
numOfTables
&&
pQueryInfo
->
p
Meter
Info
!=
NULL
);
assert
(
tableIndex
>=
0
&&
tableIndex
<=
pQueryInfo
->
numOfTables
&&
pQueryInfo
->
p
TableMeta
Info
!=
NULL
);
return
pQueryInfo
->
p
Meter
Info
[
tableIndex
];
return
pQueryInfo
->
p
TableMeta
Info
[
tableIndex
];
}
}
SQueryInfo
*
tscGetQueryInfoDetail
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
)
{
SQueryInfo
*
tscGetQueryInfoDetail
(
SSqlCmd
*
pCmd
,
int32_t
subClauseIndex
)
{
...
@@ -1801,7 +1801,7 @@ STableMetaInfo* tscGetMeterMetaInfoByUid(SQueryInfo* pQueryInfo, uint64_t uid, i
...
@@ -1801,7 +1801,7 @@ STableMetaInfo* tscGetMeterMetaInfoByUid(SQueryInfo* pQueryInfo, uint64_t uid, i
int32_t
k
=
-
1
;
int32_t
k
=
-
1
;
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pQueryInfo
->
numOfTables
;
++
i
)
{
if
(
pQueryInfo
->
p
Meter
Info
[
i
]
->
pTableMeta
->
uid
==
uid
)
{
if
(
pQueryInfo
->
p
TableMeta
Info
[
i
]
->
pTableMeta
->
uid
==
uid
)
{
k
=
i
;
k
=
i
;
break
;
break
;
}
}
...
@@ -1812,7 +1812,7 @@ STableMetaInfo* tscGetMeterMetaInfoByUid(SQueryInfo* pQueryInfo, uint64_t uid, i
...
@@ -1812,7 +1812,7 @@ STableMetaInfo* tscGetMeterMetaInfoByUid(SQueryInfo* pQueryInfo, uint64_t uid, i
}
}
assert
(
k
!=
-
1
);
assert
(
k
!=
-
1
);
return
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
k
);
return
tscGetMet
a
Info
(
pQueryInfo
,
k
);
}
}
int32_t
tscAddSubqueryInfo
(
SSqlCmd
*
pCmd
)
{
int32_t
tscAddSubqueryInfo
(
SSqlCmd
*
pCmd
)
{
...
@@ -1876,15 +1876,15 @@ void tscFreeSubqueryInfo(SSqlCmd* pCmd) {
...
@@ -1876,15 +1876,15 @@ void tscFreeSubqueryInfo(SSqlCmd* pCmd) {
STableMetaInfo
*
tscAddMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
STableMeta
*
pTableMeta
,
STableMetaInfo
*
tscAddMeterMetaInfo
(
SQueryInfo
*
pQueryInfo
,
const
char
*
name
,
STableMeta
*
pTableMeta
,
SSuperTableMeta
*
pMetricMeta
,
int16_t
numOfTags
,
int16_t
*
tags
)
{
SSuperTableMeta
*
pMetricMeta
,
int16_t
numOfTags
,
int16_t
*
tags
)
{
void
*
pAlloc
=
realloc
(
pQueryInfo
->
p
Meter
Info
,
(
pQueryInfo
->
numOfTables
+
1
)
*
POINTER_BYTES
);
void
*
pAlloc
=
realloc
(
pQueryInfo
->
p
TableMeta
Info
,
(
pQueryInfo
->
numOfTables
+
1
)
*
POINTER_BYTES
);
if
(
pAlloc
==
NULL
)
{
if
(
pAlloc
==
NULL
)
{
return
NULL
;
return
NULL
;
}
}
pQueryInfo
->
p
Meter
Info
=
pAlloc
;
pQueryInfo
->
p
TableMeta
Info
=
pAlloc
;
pQueryInfo
->
p
Meter
Info
[
pQueryInfo
->
numOfTables
]
=
calloc
(
1
,
sizeof
(
STableMetaInfo
));
pQueryInfo
->
p
TableMeta
Info
[
pQueryInfo
->
numOfTables
]
=
calloc
(
1
,
sizeof
(
STableMetaInfo
));
STableMetaInfo
*
pTableMetaInfo
=
pQueryInfo
->
p
Meter
Info
[
pQueryInfo
->
numOfTables
];
STableMetaInfo
*
pTableMetaInfo
=
pQueryInfo
->
p
TableMeta
Info
[
pQueryInfo
->
numOfTables
];
assert
(
pTableMetaInfo
!=
NULL
);
assert
(
pTableMetaInfo
!=
NULL
);
if
(
name
!=
NULL
)
{
if
(
name
!=
NULL
)
{
...
@@ -1904,7 +1904,7 @@ STableMetaInfo* tscAddMeterMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST
...
@@ -1904,7 +1904,7 @@ STableMetaInfo* tscAddMeterMetaInfo(SQueryInfo* pQueryInfo, const char* name, ST
return
pTableMetaInfo
;
return
pTableMetaInfo
;
}
}
STableMetaInfo
*
tscAddEmptyMet
erMet
aInfo
(
SQueryInfo
*
pQueryInfo
)
{
STableMetaInfo
*
tscAddEmptyMetaInfo
(
SQueryInfo
*
pQueryInfo
)
{
return
tscAddMeterMetaInfo
(
pQueryInfo
,
NULL
,
NULL
,
NULL
,
0
,
NULL
);
return
tscAddMeterMetaInfo
(
pQueryInfo
,
NULL
,
NULL
,
NULL
,
0
,
NULL
);
}
}
...
@@ -1913,14 +1913,14 @@ void doRemoveMeterMetaInfo(SQueryInfo* pQueryInfo, int32_t index, bool removeFro
...
@@ -1913,14 +1913,14 @@ void doRemoveMeterMetaInfo(SQueryInfo* pQueryInfo, int32_t index, bool removeFro
return
;
return
;
}
}
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
index
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
index
);
tscClearMeterMetaInfo
(
pTableMetaInfo
,
removeFromCache
);
tscClearMeterMetaInfo
(
pTableMetaInfo
,
removeFromCache
);
free
(
pTableMetaInfo
);
free
(
pTableMetaInfo
);
int32_t
after
=
pQueryInfo
->
numOfTables
-
index
-
1
;
int32_t
after
=
pQueryInfo
->
numOfTables
-
index
-
1
;
if
(
after
>
0
)
{
if
(
after
>
0
)
{
memmove
(
&
pQueryInfo
->
p
MeterInfo
[
index
],
&
pQueryInfo
->
pMeter
Info
[
index
+
1
],
after
*
POINTER_BYTES
);
memmove
(
&
pQueryInfo
->
p
TableMetaInfo
[
index
],
&
pQueryInfo
->
pTableMeta
Info
[
index
+
1
],
after
*
POINTER_BYTES
);
}
}
pQueryInfo
->
numOfTables
-=
1
;
pQueryInfo
->
numOfTables
-=
1
;
...
@@ -1934,7 +1934,7 @@ void tscRemoveAllMeterMetaInfo(SQueryInfo* pQueryInfo, const char* address, bool
...
@@ -1934,7 +1934,7 @@ void tscRemoveAllMeterMetaInfo(SQueryInfo* pQueryInfo, const char* address, bool
doRemoveMeterMetaInfo
(
pQueryInfo
,
--
index
,
removeFromCache
);
doRemoveMeterMetaInfo
(
pQueryInfo
,
--
index
,
removeFromCache
);
}
}
tfree
(
pQueryInfo
->
p
Meter
Info
);
tfree
(
pQueryInfo
->
p
TableMeta
Info
);
}
}
void
tscClearMeterMetaInfo
(
STableMetaInfo
*
pTableMetaInfo
,
bool
removeFromCache
)
{
void
tscClearMeterMetaInfo
(
STableMetaInfo
*
pTableMetaInfo
,
bool
removeFromCache
)
{
...
@@ -1999,7 +1999,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
...
@@ -1999,7 +1999,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, void (*fp)(), void
memset
(
&
pNewQueryInfo
->
colList
,
0
,
sizeof
(
pNewQueryInfo
->
colList
));
memset
(
&
pNewQueryInfo
->
colList
,
0
,
sizeof
(
pNewQueryInfo
->
colList
));
memset
(
&
pNewQueryInfo
->
fieldsInfo
,
0
,
sizeof
(
SFieldInfo
));
memset
(
&
pNewQueryInfo
->
fieldsInfo
,
0
,
sizeof
(
SFieldInfo
));
pNewQueryInfo
->
p
Meter
Info
=
NULL
;
pNewQueryInfo
->
p
TableMeta
Info
=
NULL
;
pNewQueryInfo
->
defaultVal
=
NULL
;
pNewQueryInfo
->
defaultVal
=
NULL
;
pNewQueryInfo
->
numOfTables
=
0
;
pNewQueryInfo
->
numOfTables
=
0
;
pNewQueryInfo
->
tsBuf
=
NULL
;
pNewQueryInfo
->
tsBuf
=
NULL
;
...
@@ -2189,7 +2189,7 @@ bool hasMoreVnodesToTry(SSqlObj* pSql) {
...
@@ -2189,7 +2189,7 @@ bool hasMoreVnodesToTry(SSqlObj* pSql) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
if
(
!
UTIL_METER_IS_SUPERTABLE
(
pTableMetaInfo
)
||
(
pTableMetaInfo
->
pMetricMeta
==
NULL
))
{
if
(
!
UTIL_METER_IS_SUPERTABLE
(
pTableMetaInfo
)
||
(
pTableMetaInfo
->
pMetricMeta
==
NULL
))
{
return
false
;
return
false
;
}
}
...
@@ -2211,7 +2211,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
...
@@ -2211,7 +2211,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
*/
*/
assert
(
pRes
->
numOfRows
==
0
&&
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
!
tscHasReachLimitation
(
pQueryInfo
,
pRes
));
assert
(
pRes
->
numOfRows
==
0
&&
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)
&&
!
tscHasReachLimitation
(
pQueryInfo
,
pRes
));
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
erMetaInfoFromQuery
Info
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMet
a
Info
(
pQueryInfo
,
0
);
int32_t
totalVnode
=
pTableMetaInfo
->
pMetricMeta
->
numOfVnodes
;
int32_t
totalVnode
=
pTableMetaInfo
->
pMetricMeta
->
numOfVnodes
;
while
(
++
pTableMetaInfo
->
vnodeIndex
<
totalVnode
)
{
while
(
++
pTableMetaInfo
->
vnodeIndex
<
totalVnode
)
{
...
...
src/inc/taosmsg.h
浏览文件 @
d1828544
...
@@ -464,7 +464,7 @@ typedef struct {
...
@@ -464,7 +464,7 @@ typedef struct {
int16_t
orderColId
;
int16_t
orderColId
;
int16_t
numOfCols
;
// the number of columns will be load from vnode
int16_t
numOfCols
;
// the number of columns will be load from vnode
char
interval
TimeUnit
;
// time interval type, for revisement of interval(1d)
char
sliding
TimeUnit
;
// time interval type, for revisement of interval(1d)
int64_t
intervalTime
;
// time interval for aggregation, in million second
int64_t
intervalTime
;
// time interval for aggregation, in million second
int64_t
slidingTime
;
// value for sliding window
int64_t
slidingTime
;
// value for sliding window
...
...
tests/examples/c/demo.c
浏览文件 @
d1828544
...
@@ -35,6 +35,7 @@ int main(int argc, char *argv[]) {
...
@@ -35,6 +35,7 @@ int main(int argc, char *argv[]) {
return
0
;
return
0
;
}
}
taos_options
(
TSDB_OPTION_CONFIGDIR
,
"~/first/cfg"
);
// init TAOS
// init TAOS
taos_init
();
taos_init
();
...
@@ -44,8 +45,27 @@ int main(int argc, char *argv[]) {
...
@@ -44,8 +45,27 @@ int main(int argc, char *argv[]) {
exit
(
1
);
exit
(
1
);
}
}
printf
(
"success to connect to server
\n
"
);
printf
(
"success to connect to server
\n
"
);
int32_t
code
=
taos_query
(
taos
,
"select * from test.t1"
);
if
(
code
!=
0
)
{
printf
(
"failed to execute query, reason:%s
\n
"
,
taos_errstr
(
taos
));
}
TAOS_RES
*
res
=
taos_use_result
(
taos
);
TAOS_ROW
row
=
NULL
;
char
buf
[
512
]
=
{
0
};
int32_t
numOfFields
=
taos_num_fields
(
res
);
TAOS_FIELD
*
pFields
=
taos_fetch_fields
(
res
);
while
((
row
=
taos_fetch_row
(
res
))
!=
NULL
)
{
taos_print_row
(
buf
,
row
,
pFields
,
numOfFields
);
printf
(
"%s
\n
"
,
buf
);
memset
(
buf
,
0
,
512
);
}
return
0
;
taos_query
(
taos
,
"drop database demo"
);
taos_query
(
taos
,
"drop database demo"
);
if
(
taos_query
(
taos
,
"create database demo"
)
!=
0
)
{
if
(
taos_query
(
taos
,
"create database demo"
)
!=
0
)
{
printf
(
"failed to create database, reason:%s
\n
"
,
taos_errstr
(
taos
));
printf
(
"failed to create database, reason:%s
\n
"
,
taos_errstr
(
taos
));
...
@@ -90,7 +110,7 @@ int main(int argc, char *argv[]) {
...
@@ -90,7 +110,7 @@ int main(int argc, char *argv[]) {
exit
(
1
);
exit
(
1
);
}
}
TAOS_ROW
row
;
//
TAOS_ROW row;
int
rows
=
0
;
int
rows
=
0
;
int
num_fields
=
taos_field_count
(
taos
);
int
num_fields
=
taos_field_count
(
taos
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
result
);
TAOS_FIELD
*
fields
=
taos_fetch_fields
(
result
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录