Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9deb3c4f
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
9deb3c4f
编写于
11月 25, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into fix/TD-10796
上级
87e56807
34efc629
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
142 addition
and
75 deletion
+142
-75
packaging/tools/post.sh
packaging/tools/post.sh
+2
-2
src/client/inc/tscGlobalmerge.h
src/client/inc/tscGlobalmerge.h
+1
-1
src/client/src/tscGlobalmerge.c
src/client/src/tscGlobalmerge.c
+8
-5
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+7
-7
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+3
-3
src/common/inc/tname.h
src/common/inc/tname.h
+1
-1
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-1
src/kit/taosdemo/inc/demo.h
src/kit/taosdemo/inc/demo.h
+3
-0
src/kit/taosdemo/src/demoCommandOpt.c
src/kit/taosdemo/src/demoCommandOpt.c
+56
-7
src/kit/taosdemo/src/demoData.c
src/kit/taosdemo/src/demoData.c
+10
-12
src/kit/taosdemo/src/demoInsert.c
src/kit/taosdemo/src/demoInsert.c
+2
-4
src/kit/taosdemo/src/demoMain.c
src/kit/taosdemo/src/demoMain.c
+1
-0
src/query/inc/qAggMain.h
src/query/inc/qAggMain.h
+2
-2
src/query/inc/qExtbuffer.h
src/query/inc/qExtbuffer.h
+10
-3
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+18
-18
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+10
-2
src/query/src/qExtbuffer.c
src/query/src/qExtbuffer.c
+5
-5
src/query/tests/cSortTest.cpp
src/query/tests/cSortTest.cpp
+1
-1
src/query/tests/percentileTest.cpp
src/query/tests/percentileTest.cpp
+1
-1
未找到文件。
packaging/tools/post.sh
浏览文件 @
9deb3c4f
...
@@ -468,8 +468,8 @@ function install_service_on_systemd() {
...
@@ -468,8 +468,8 @@ function install_service_on_systemd() {
function
install_taosadapter_service
()
{
function
install_taosadapter_service
()
{
if
((
${
service_mod
}
==
0
))
;
then
if
((
${
service_mod
}
==
0
))
;
then
[
-f
${
script_dir
}
/cfg/taosadapter.service
]
&&
\
[
-f
${
script_dir
}
/
../
cfg/taosadapter.service
]
&&
\
${
csudo
}
cp
${
script_dir
}
/cfg/taosadapter.service
\
${
csudo
}
cp
${
script_dir
}
/
../
cfg/taosadapter.service
\
${
service_config_dir
}
/
||
:
${
service_config_dir
}
/
||
:
${
csudo
}
systemctl daemon-reload
${
csudo
}
systemctl daemon-reload
fi
fi
...
...
src/client/inc/tscGlobalmerge.h
浏览文件 @
9deb3c4f
...
@@ -62,7 +62,7 @@ typedef struct SRetrieveSupport {
...
@@ -62,7 +62,7 @@ typedef struct SRetrieveSupport {
uint32_t
numOfRetry
;
// record the number of retry times
uint32_t
numOfRetry
;
// record the number of retry times
}
SRetrieveSupport
;
}
SRetrieveSupport
;
int32_t
tscCreateGlobalMergerEnv
(
SQueryInfo
*
pQueryInfo
,
tExtMemBuffer
***
pMemBuffer
,
int32_t
numOfSub
,
tOrderDescriptor
**
pDesc
,
uint32_t
nBufferSize
,
int64_t
id
);
int32_t
tscCreateGlobalMergerEnv
(
SQueryInfo
*
pQueryInfo
,
tExtMemBuffer
***
pMemBuffer
,
int32_t
numOfSub
,
tOrderDescriptor
**
pDesc
,
uint32_t
*
nBufferSize
,
int64_t
id
);
void
tscDestroyGlobalMergerEnv
(
tExtMemBuffer
**
pMemBuffer
,
tOrderDescriptor
*
pDesc
,
int32_t
numOfVnodes
);
void
tscDestroyGlobalMergerEnv
(
tExtMemBuffer
**
pMemBuffer
,
tOrderDescriptor
*
pDesc
,
int32_t
numOfVnodes
);
...
...
src/client/src/tscGlobalmerge.c
浏览文件 @
9deb3c4f
...
@@ -407,8 +407,8 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SQueryInfo*
...
@@ -407,8 +407,8 @@ static int32_t createOrderDescriptor(tOrderDescriptor **pOrderDesc, SQueryInfo*
}
}
int32_t
tscCreateGlobalMergerEnv
(
SQueryInfo
*
pQueryInfo
,
tExtMemBuffer
***
pMemBuffer
,
int32_t
numOfSub
,
int32_t
tscCreateGlobalMergerEnv
(
SQueryInfo
*
pQueryInfo
,
tExtMemBuffer
***
pMemBuffer
,
int32_t
numOfSub
,
tOrderDescriptor
**
pOrderDesc
,
uint32_t
nBufferSizes
,
int64_t
id
)
{
tOrderDescriptor
**
pOrderDesc
,
uint32_t
*
nBufferSizes
,
int64_t
id
)
{
SSchema
*
pSchema
=
NULL
;
SSchema
1
*
pSchema
=
NULL
;
SColumnModel
*
pModel
=
NULL
;
SColumnModel
*
pModel
=
NULL
;
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
...
@@ -421,7 +421,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
...
@@ -421,7 +421,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
size_t
size
=
tscNumOfExprs
(
pQueryInfo
);
size_t
size
=
tscNumOfExprs
(
pQueryInfo
);
pSchema
=
(
SSchema
*
)
calloc
(
1
,
sizeof
(
SSchema
)
*
size
);
pSchema
=
(
SSchema
1
*
)
calloc
(
1
,
sizeof
(
SSchema1
)
*
size
);
if
(
pSchema
==
NULL
)
{
if
(
pSchema
==
NULL
)
{
tscError
(
"0x%"
PRIx64
" failed to allocate memory"
,
id
);
tscError
(
"0x%"
PRIx64
" failed to allocate memory"
,
id
);
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
...
@@ -440,7 +440,10 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
...
@@ -440,7 +440,10 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
int32_t
capacity
=
0
;
int32_t
capacity
=
0
;
if
(
rlen
!=
0
)
{
if
(
rlen
!=
0
)
{
capacity
=
nBufferSizes
/
rlen
;
if
((
*
nBufferSizes
)
<
rlen
)
{
(
*
nBufferSizes
)
=
rlen
*
2
;
}
capacity
=
(
*
nBufferSizes
)
/
rlen
;
}
}
pModel
=
createColumnModel
(
pSchema
,
(
int32_t
)
size
,
capacity
);
pModel
=
createColumnModel
(
pSchema
,
(
int32_t
)
size
,
capacity
);
...
@@ -457,7 +460,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
...
@@ -457,7 +460,7 @@ int32_t tscCreateGlobalMergerEnv(SQueryInfo *pQueryInfo, tExtMemBuffer ***pMemBu
assert
(
numOfSub
<=
pTableMetaInfo
->
vgroupList
->
numOfVgroups
);
assert
(
numOfSub
<=
pTableMetaInfo
->
vgroupList
->
numOfVgroups
);
for
(
int32_t
i
=
0
;
i
<
numOfSub
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfSub
;
++
i
)
{
(
*
pMemBuffer
)[
i
]
=
createExtMemBuffer
(
nBufferSizes
,
rlen
,
pg
,
pModel
);
(
*
pMemBuffer
)[
i
]
=
createExtMemBuffer
(
*
nBufferSizes
,
rlen
,
pg
,
pModel
);
(
*
pMemBuffer
)[
i
]
->
flushModel
=
MULTIPLE_APPEND_MODEL
;
(
*
pMemBuffer
)[
i
]
->
flushModel
=
MULTIPLE_APPEND_MODEL
;
}
}
...
...
src/client/src/tscSQLParser.c
浏览文件 @
9deb3c4f
...
@@ -2399,7 +2399,7 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
...
@@ -2399,7 +2399,7 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
}
}
int16_t
resType
=
0
;
int16_t
resType
=
0
;
int
16
_t
resBytes
=
0
;
int
32
_t
resBytes
=
0
;
int32_t
interBufSize
=
0
;
int32_t
interBufSize
=
0
;
getResultDataInfo
(
pSchema
->
type
,
pSchema
->
bytes
,
f
,
0
,
&
resType
,
&
resBytes
,
&
interBufSize
,
0
,
false
,
pUdfInfo
);
getResultDataInfo
(
pSchema
->
type
,
pSchema
->
bytes
,
f
,
0
,
&
resType
,
&
resBytes
,
&
interBufSize
,
0
,
false
,
pUdfInfo
);
...
@@ -2638,7 +2638,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -2638,7 +2638,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
}
int16_t
resultType
=
0
;
int16_t
resultType
=
0
;
int
16
_t
resultSize
=
0
;
int
32
_t
resultSize
=
0
;
int32_t
intermediateResSize
=
0
;
int32_t
intermediateResSize
=
0
;
if
(
getResultDataInfo
(
pSchema
->
type
,
pSchema
->
bytes
,
functionId
,
0
,
&
resultType
,
&
resultSize
,
if
(
getResultDataInfo
(
pSchema
->
type
,
pSchema
->
bytes
,
functionId
,
0
,
&
resultType
,
&
resultSize
,
...
@@ -2897,7 +2897,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -2897,7 +2897,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
tVariant
*
pVariant
=
&
pParamElem
[
1
].
pNode
->
value
;
tVariant
*
pVariant
=
&
pParamElem
[
1
].
pNode
->
value
;
int16_t
resultType
=
pSchema
->
type
;
int16_t
resultType
=
pSchema
->
type
;
int
16
_t
resultSize
=
pSchema
->
bytes
;
int
32
_t
resultSize
=
pSchema
->
bytes
;
int32_t
interResult
=
0
;
int32_t
interResult
=
0
;
char
val
[
8
]
=
{
0
};
char
val
[
8
]
=
{
0
};
...
@@ -3079,7 +3079,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -3079,7 +3079,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
s
=
pTagSchema
[
index
.
columnIndex
];
s
=
pTagSchema
[
index
.
columnIndex
];
}
}
int
16
_t
bytes
=
0
;
int
32
_t
bytes
=
0
;
int16_t
type
=
0
;
int16_t
type
=
0
;
int32_t
inter
=
0
;
int32_t
inter
=
0
;
...
@@ -3106,7 +3106,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -3106,7 +3106,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
int32_t
inter
=
0
;
int32_t
inter
=
0
;
int16_t
resType
=
0
;
int16_t
resType
=
0
;
int
16
_t
bytes
=
0
;
int
32
_t
bytes
=
0
;
getResultDataInfo
(
TSDB_DATA_TYPE_INT
,
4
,
TSDB_FUNC_BLKINFO
,
0
,
&
resType
,
&
bytes
,
&
inter
,
0
,
0
,
NULL
);
getResultDataInfo
(
TSDB_DATA_TYPE_INT
,
4
,
TSDB_FUNC_BLKINFO
,
0
,
&
resType
,
&
bytes
,
&
inter
,
0
,
0
,
NULL
);
...
@@ -3159,7 +3159,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
...
@@ -3159,7 +3159,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
int32_t
inter
=
0
;
int32_t
inter
=
0
;
int16_t
resType
=
0
;
int16_t
resType
=
0
;
int
16
_t
bytes
=
0
;
int
32
_t
bytes
=
0
;
getResultDataInfo
(
TSDB_DATA_TYPE_INT
,
4
,
functionId
,
0
,
&
resType
,
&
bytes
,
&
inter
,
0
,
false
,
pUdfInfo
);
getResultDataInfo
(
TSDB_DATA_TYPE_INT
,
4
,
functionId
,
0
,
&
resType
,
&
bytes
,
&
inter
,
0
,
false
,
pUdfInfo
);
SExprInfo
*
pExpr
=
tscExprAppend
(
pQueryInfo
,
functionId
,
&
index
,
resType
,
bytes
,
getNewResColId
(
pCmd
),
inter
,
false
);
SExprInfo
*
pExpr
=
tscExprAppend
(
pQueryInfo
,
functionId
,
&
index
,
resType
,
bytes
,
getNewResColId
(
pCmd
),
inter
,
false
);
...
@@ -3479,7 +3479,7 @@ int32_t tscTansformFuncForSTableQuery(SQueryInfo* pQueryInfo) {
...
@@ -3479,7 +3479,7 @@ int32_t tscTansformFuncForSTableQuery(SQueryInfo* pQueryInfo) {
assert
(
tscGetNumOfTags
(
pTableMetaInfo
->
pTableMeta
)
>=
0
);
assert
(
tscGetNumOfTags
(
pTableMetaInfo
->
pTableMeta
)
>=
0
);
int
16
_t
bytes
=
0
;
int
32
_t
bytes
=
0
;
int16_t
type
=
0
;
int16_t
type
=
0
;
int32_t
interBytes
=
0
;
int32_t
interBytes
=
0
;
...
...
src/client/src/tscSubquery.c
浏览文件 @
9deb3c4f
...
@@ -2000,7 +2000,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
...
@@ -2000,7 +2000,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
colIndex
.
columnIndex
=
tscGetTagColIndexById
(
pTableMetaInfo
->
pTableMeta
,
tagColId
);
colIndex
.
columnIndex
=
tscGetTagColIndexById
(
pTableMetaInfo
->
pTableMeta
,
tagColId
);
int
16
_t
bytes
=
0
;
int
32
_t
bytes
=
0
;
int16_t
type
=
0
;
int16_t
type
=
0
;
int32_t
inter
=
0
;
int32_t
inter
=
0
;
...
@@ -2636,7 +2636,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
...
@@ -2636,7 +2636,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
pRes
->
qId
=
0x1
;
// hack the qhandle check
pRes
->
qId
=
0x1
;
// hack the qhandle check
const
uint32_t
nBufferSize
=
(
1u
<<
18u
);
// 256KB, default buffer size
uint32_t
nBufferSize
=
(
1u
<<
18u
);
// 256KB, default buffer size
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
pCmd
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
pCmd
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
...
@@ -2652,7 +2652,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
...
@@ -2652,7 +2652,7 @@ int32_t tscHandleMasterSTableQuery(SSqlObj *pSql) {
return
ret
;
return
ret
;
}
}
ret
=
tscCreateGlobalMergerEnv
(
pQueryInfo
,
&
pMemoryBuf
,
pSql
->
subState
.
numOfSub
,
&
pDesc
,
nBufferSize
,
pSql
->
self
);
ret
=
tscCreateGlobalMergerEnv
(
pQueryInfo
,
&
pMemoryBuf
,
pSql
->
subState
.
numOfSub
,
&
pDesc
,
&
nBufferSize
,
pSql
->
self
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
pRes
->
code
=
ret
;
pRes
->
code
=
ret
;
tscAsyncResultOnError
(
pSql
);
tscAsyncResultOnError
(
pSql
);
...
...
src/common/inc/tname.h
浏览文件 @
9deb3c4f
...
@@ -51,7 +51,7 @@ typedef struct SSqlExpr {
...
@@ -51,7 +51,7 @@ typedef struct SSqlExpr {
int16_t
functionId
;
// function id in aAgg array
int16_t
functionId
;
// function id in aAgg array
int16_t
resType
;
// return value type
int16_t
resType
;
// return value type
int
16
_t
resBytes
;
// length of return value
int
32
_t
resBytes
;
// length of return value
int32_t
interBytes
;
// inter result buffer size
int32_t
interBytes
;
// inter result buffer size
int16_t
colType
;
// table column type
int16_t
colType
;
// table column type
...
...
src/inc/taosmsg.h
浏览文件 @
9deb3c4f
...
@@ -438,7 +438,7 @@ typedef struct SColumnFilterList {
...
@@ -438,7 +438,7 @@ typedef struct SColumnFilterList {
typedef
struct
SColumnInfo
{
typedef
struct
SColumnInfo
{
int16_t
colId
;
int16_t
colId
;
int16_t
type
;
int16_t
type
;
int
16
_t
bytes
;
int
32
_t
bytes
;
SColumnFilterList
flist
;
SColumnFilterList
flist
;
}
SColumnInfo
;
}
SColumnInfo
;
...
...
src/kit/taosdemo/inc/demo.h
浏览文件 @
9deb3c4f
...
@@ -141,6 +141,8 @@ extern char configDir[];
...
@@ -141,6 +141,8 @@ extern char configDir[];
{ TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT }
{ TSDB_DATA_TYPE_FLOAT, TSDB_DATA_TYPE_INT, TSDB_DATA_TYPE_FLOAT }
#define DEFAULT_DATATYPE \
#define DEFAULT_DATATYPE \
{ "FLOAT", "INT", "FLOAT" }
{ "FLOAT", "INT", "FLOAT" }
#define DEFAULT_DATALENGTH \
{ 4, 4, 4 }
#define DEFAULT_BINWIDTH 64
#define DEFAULT_BINWIDTH 64
#define DEFAULT_COL_COUNT 4
#define DEFAULT_COL_COUNT 4
#define DEFAULT_LEN_ONE_ROW 76
#define DEFAULT_LEN_ONE_ROW 76
...
@@ -306,6 +308,7 @@ typedef struct SArguments_S {
...
@@ -306,6 +308,7 @@ typedef struct SArguments_S {
bool
async_mode
;
bool
async_mode
;
char
data_type
[
MAX_NUM_COLUMNS
+
1
];
char
data_type
[
MAX_NUM_COLUMNS
+
1
];
char
*
dataType
[
MAX_NUM_COLUMNS
+
1
];
char
*
dataType
[
MAX_NUM_COLUMNS
+
1
];
int32_t
data_length
[
MAX_NUM_COLUMNS
+
1
];
uint32_t
binwidth
;
uint32_t
binwidth
;
uint32_t
columnCount
;
uint32_t
columnCount
;
uint64_t
lenOfOneRow
;
uint64_t
lenOfOneRow
;
...
...
src/kit/taosdemo/src/demoCommandOpt.c
浏览文件 @
9deb3c4f
...
@@ -1338,9 +1338,10 @@ void setParaFromArg() {
...
@@ -1338,9 +1338,10 @@ void setParaFromArg() {
g_args
.
prepared_rand
=
min
(
g_args
.
insertRows
,
MAX_PREPARED_RAND
);
g_args
.
prepared_rand
=
min
(
g_args
.
insertRows
,
MAX_PREPARED_RAND
);
g_Dbs
.
aggr_func
=
g_args
.
aggr_func
;
g_Dbs
.
aggr_func
=
g_args
.
aggr_func
;
char
dataString
[
TSDB_MAX_BYTES_PER_ROW
];
char
dataString
[
TSDB_MAX_BYTES_PER_ROW
];
char
*
data_type
=
g_args
.
data_type
;
char
*
data_type
=
g_args
.
data_type
;
char
**
dataType
=
g_args
.
dataType
;
char
**
dataType
=
g_args
.
dataType
;
int32_t
*
data_length
=
g_args
.
data_length
;
memset
(
dataString
,
0
,
TSDB_MAX_BYTES_PER_ROW
);
memset
(
dataString
,
0
,
TSDB_MAX_BYTES_PER_ROW
);
...
@@ -1469,6 +1470,47 @@ void setParaFromArg() {
...
@@ -1469,6 +1470,47 @@ void setParaFromArg() {
}
else
{
}
else
{
g_Dbs
.
threadCountForCreateTbl
=
g_args
.
nthreads
;
g_Dbs
.
threadCountForCreateTbl
=
g_args
.
nthreads
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
tagCount
=
0
;
g_Dbs
.
db
[
0
].
superTbls
[
0
].
tagCount
=
0
;
for
(
int
i
=
0
;
i
<
MAX_NUM_COLUMNS
;
i
++
)
{
if
(
data_type
[
i
]
==
TSDB_DATA_TYPE_NULL
)
{
break
;
}
if
(
1
==
regexMatch
(
dataType
[
i
],
"^(NCHAR|BINARY)(
\\
([1-9][0-9]*
\\
))$"
,
REG_ICASE
|
REG_EXTENDED
))
{
sscanf
(
dataType
[
i
],
"%[^(](%[^)]"
,
type
,
length
);
data_length
[
i
]
=
atoi
(
length
);
}
else
{
switch
(
data_type
[
i
])
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_UTINYINT
:
case
TSDB_DATA_TYPE_TINYINT
:
data_length
[
i
]
=
sizeof
(
char
);
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
case
TSDB_DATA_TYPE_USMALLINT
:
data_length
[
i
]
=
sizeof
(
int16_t
);
break
;
case
TSDB_DATA_TYPE_INT
:
case
TSDB_DATA_TYPE_UINT
:
data_length
[
i
]
=
sizeof
(
int32_t
);
break
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_UBIGINT
:
data_length
[
i
]
=
sizeof
(
int64_t
);
break
;
case
TSDB_DATA_TYPE_FLOAT
:
data_length
[
i
]
=
sizeof
(
float
);
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
data_length
[
i
]
=
sizeof
(
double
);
break
;
default:
data_length
[
i
]
=
g_args
.
binwidth
;
break
;
}
}
}
}
}
}
}
...
@@ -1698,8 +1740,15 @@ void *queryNtableAggrFunc(void *sarg) {
...
@@ -1698,8 +1740,15 @@ void *queryNtableAggrFunc(void *sarg) {
double
totalT
=
0
;
double
totalT
=
0
;
uint64_t
count
=
0
;
uint64_t
count
=
0
;
for
(
int64_t
i
=
0
;
i
<
ntables
;
i
++
)
{
for
(
int64_t
i
=
0
;
i
<
ntables
;
i
++
)
{
sprintf
(
command
,
"SELECT %s FROM %s%"
PRId64
" WHERE ts>= %"
PRIu64
,
if
(
g_args
.
escapeChar
)
{
aggreFunc
[
j
],
tb_prefix
,
i
,
startTime
);
sprintf
(
command
,
"SELECT %s FROM `%s%"
PRId64
"` WHERE ts>= %"
PRIu64
,
aggreFunc
[
j
],
tb_prefix
,
i
,
startTime
);
}
else
{
sprintf
(
command
,
"SELECT %s FROM %s%"
PRId64
" WHERE ts>= %"
PRIu64
,
aggreFunc
[
j
],
tb_prefix
,
i
,
startTime
);
}
double
t
=
(
double
)
taosGetTimestampUs
();
double
t
=
(
double
)
taosGetTimestampUs
();
debugPrint
(
"%s() LN%d, sql command: %s
\n
"
,
__func__
,
__LINE__
,
debugPrint
(
"%s() LN%d, sql command: %s
\n
"
,
__func__
,
__LINE__
,
...
@@ -1708,9 +1757,9 @@ void *queryNtableAggrFunc(void *sarg) {
...
@@ -1708,9 +1757,9 @@ void *queryNtableAggrFunc(void *sarg) {
int32_t
code
=
taos_errno
(
pSql
);
int32_t
code
=
taos_errno
(
pSql
);
if
(
code
!=
0
)
{
if
(
code
!=
0
)
{
errorPrint
(
"Failed to query:%s
\n
"
,
taos_errstr
(
pSql
));
errorPrint
(
"Failed to query <%s>, reason:%s
\n
"
,
command
,
taos_errstr
(
pSql
));
taos_free_result
(
pSql
);
taos_free_result
(
pSql
);
taos_close
(
taos
);
fclose
(
fp
);
fclose
(
fp
);
free
(
command
);
free
(
command
);
return
NULL
;
return
NULL
;
...
...
src/kit/taosdemo/src/demoData.c
浏览文件 @
9deb3c4f
...
@@ -868,8 +868,8 @@ int64_t generateStbRowData(SSuperTable *stbInfo, char *recBuf,
...
@@ -868,8 +868,8 @@ int64_t generateStbRowData(SSuperTable *stbInfo, char *recBuf,
return
strlen
(
recBuf
);
return
strlen
(
recBuf
);
}
}
static
int64_t
generateData
(
char
*
recBuf
,
char
*
data_type
,
int
64_t
timestamp
,
static
int64_t
generateData
(
char
*
recBuf
,
char
*
data_type
,
int
32_t
*
data_length
,
int
lenOfBinary
)
{
int
64_t
timestamp
)
{
memset
(
recBuf
,
0
,
MAX_DATA_SIZE
);
memset
(
recBuf
,
0
,
MAX_DATA_SIZE
);
char
*
pstr
=
recBuf
;
char
*
pstr
=
recBuf
;
pstr
+=
sprintf
(
pstr
,
"(%"
PRId64
""
,
timestamp
);
pstr
+=
sprintf
(
pstr
,
"(%"
PRId64
""
,
timestamp
);
...
@@ -915,13 +915,13 @@ static int64_t generateData(char *recBuf, char *data_type, int64_t timestamp,
...
@@ -915,13 +915,13 @@ static int64_t generateData(char *recBuf, char *data_type, int64_t timestamp,
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
case
TSDB_DATA_TYPE_NCHAR
:
s
=
calloc
(
1
,
lenOfBinary
+
1
);
s
=
calloc
(
1
,
data_length
[
i
]
+
1
);
if
(
NULL
==
s
)
{
if
(
NULL
==
s
)
{
errorPrint
(
"%s"
,
"failed to allocate memory
\n
"
);
errorPrint
(
"%s"
,
"failed to allocate memory
\n
"
);
return
-
1
;
return
-
1
;
}
}
rand_string
(
s
,
lenOfBinary
);
rand_string
(
s
,
data_length
[
i
]
);
pstr
+=
sprintf
(
pstr
,
",
\"
%s
\"
"
,
s
);
pstr
+=
sprintf
(
pstr
,
",
\"
%s
\"
"
,
s
);
free
(
s
);
free
(
s
);
break
;
break
;
...
@@ -1156,20 +1156,18 @@ static int32_t generateDataTailWithoutStb(
...
@@ -1156,20 +1156,18 @@ static int32_t generateDataTailWithoutStb(
int64_t
retLen
=
0
;
int64_t
retLen
=
0
;
char
*
data_type
=
g_args
.
data_type
;
char
*
data_type
=
g_args
.
data_type
;
int
lenOfBinary
=
g_args
.
binwid
th
;
int
32_t
*
data_length
=
g_args
.
data_leng
th
;
if
(
g_args
.
disorderRatio
)
{
if
(
g_args
.
disorderRatio
)
{
retLen
=
retLen
=
generateData
(
data
,
data_type
,
generateData
(
data
,
data_type
,
data_length
,
startTime
+
getTSRandTail
(
g_args
.
timestamp_step
,
k
,
startTime
+
getTSRandTail
(
g_args
.
timestamp_step
,
k
,
g_args
.
disorderRatio
,
g_args
.
disorderRatio
,
g_args
.
disorderRange
),
g_args
.
disorderRange
));
lenOfBinary
);
}
else
{
}
else
{
retLen
=
generateData
(
data
,
data_type
,
retLen
=
generateData
(
data
,
data_type
,
data_length
,
startTime
+
g_args
.
timestamp_step
*
k
,
startTime
+
g_args
.
timestamp_step
*
k
);
lenOfBinary
);
}
}
if
(
len
>
remainderBufLen
)
break
;
if
(
len
>
remainderBufLen
)
break
;
...
...
src/kit/taosdemo/src/demoInsert.c
浏览文件 @
9deb3c4f
...
@@ -1043,10 +1043,8 @@ int createChildTables() {
...
@@ -1043,10 +1043,8 @@ int createChildTables() {
// normal table
// normal table
len
=
snprintf
(
tblColsBuf
,
TSDB_MAX_BYTES_PER_ROW
,
"(TS TIMESTAMP"
);
len
=
snprintf
(
tblColsBuf
,
TSDB_MAX_BYTES_PER_ROW
,
"(TS TIMESTAMP"
);
for
(
int
j
=
0
;
j
<
g_args
.
columnCount
;
j
++
)
{
for
(
int
j
=
0
;
j
<
g_args
.
columnCount
;
j
++
)
{
if
((
strncasecmp
(
g_args
.
dataType
[
j
],
"BINARY"
,
if
((
strcasecmp
(
g_args
.
dataType
[
j
],
"BINARY"
)
==
0
)
||
strlen
(
"BINARY"
))
==
0
)
||
(
strcasecmp
(
g_args
.
dataType
[
j
],
"NCHAR"
)
==
0
))
{
(
strncasecmp
(
g_args
.
dataType
[
j
],
"NCHAR"
,
strlen
(
"NCHAR"
))
==
0
))
{
snprintf
(
tblColsBuf
+
len
,
TSDB_MAX_BYTES_PER_ROW
-
len
,
snprintf
(
tblColsBuf
+
len
,
TSDB_MAX_BYTES_PER_ROW
-
len
,
",C%d %s(%d)"
,
j
,
g_args
.
dataType
[
j
],
",C%d %s(%d)"
,
j
,
g_args
.
dataType
[
j
],
g_args
.
binwidth
);
g_args
.
binwidth
);
...
...
src/kit/taosdemo/src/demoMain.c
浏览文件 @
9deb3c4f
...
@@ -45,6 +45,7 @@ SArguments g_args = {
...
@@ -45,6 +45,7 @@ SArguments g_args = {
DEFAULT_SYNC_MODE
,
// mode : sync or async
DEFAULT_SYNC_MODE
,
// mode : sync or async
DEFAULT_DATA_TYPE
,
// data_type
DEFAULT_DATA_TYPE
,
// data_type
DEFAULT_DATATYPE
,
// dataType
DEFAULT_DATATYPE
,
// dataType
DEFAULT_DATALENGTH
,
// data_length
DEFAULT_BINWIDTH
,
// binwidth
DEFAULT_BINWIDTH
,
// binwidth
DEFAULT_COL_COUNT
,
// columnCount, timestamp + float + int + float
DEFAULT_COL_COUNT
,
// columnCount, timestamp + float + int + float
DEFAULT_LEN_ONE_ROW
,
// lenOfOneRow
DEFAULT_LEN_ONE_ROW
,
// lenOfOneRow
...
...
src/query/inc/qAggMain.h
浏览文件 @
9deb3c4f
...
@@ -183,7 +183,7 @@ typedef struct SQLFunctionCtx {
...
@@ -183,7 +183,7 @@ typedef struct SQLFunctionCtx {
int16_t
inputBytes
;
int16_t
inputBytes
;
int16_t
outputType
;
int16_t
outputType
;
int
16
_t
outputBytes
;
// size of results, determined by function and input column data type
int
32
_t
outputBytes
;
// size of results, determined by function and input column data type
int32_t
interBufBytes
;
// internal buffer size
int32_t
interBufBytes
;
// internal buffer size
bool
hasNull
;
// null value exist in current block
bool
hasNull
;
// null value exist in current block
bool
requireNull
;
// require null in some function
bool
requireNull
;
// require null in some function
...
@@ -227,7 +227,7 @@ typedef struct SAggFunctionInfo {
...
@@ -227,7 +227,7 @@ typedef struct SAggFunctionInfo {
#define GET_RES_INFO(ctx) ((ctx)->resultInfo)
#define GET_RES_INFO(ctx) ((ctx)->resultInfo)
int32_t
getResultDataInfo
(
int32_t
dataType
,
int32_t
dataBytes
,
int32_t
functionId
,
int32_t
param
,
int16_t
*
type
,
int32_t
getResultDataInfo
(
int32_t
dataType
,
int32_t
dataBytes
,
int32_t
functionId
,
int32_t
param
,
int16_t
*
type
,
int
16
_t
*
len
,
int32_t
*
interBytes
,
int16_t
extLength
,
bool
isSuperTable
,
SUdfInfo
*
pUdfInfo
);
int
32
_t
*
len
,
int32_t
*
interBytes
,
int16_t
extLength
,
bool
isSuperTable
,
SUdfInfo
*
pUdfInfo
);
int32_t
isValidFunction
(
const
char
*
name
,
int32_t
len
);
int32_t
isValidFunction
(
const
char
*
name
,
int32_t
len
);
#define IS_STREAM_QUERY_VALID(x) (((x)&TSDB_FUNCSTATE_STREAM) != 0)
#define IS_STREAM_QUERY_VALID(x) (((x)&TSDB_FUNCSTATE_STREAM) != 0)
...
...
src/query/inc/qExtbuffer.h
浏览文件 @
9deb3c4f
...
@@ -75,8 +75,15 @@ typedef struct tFilePagesItem {
...
@@ -75,8 +75,15 @@ typedef struct tFilePagesItem {
tFilePage
item
;
tFilePage
item
;
}
tFilePagesItem
;
}
tFilePagesItem
;
typedef
struct
SSchema1
{
uint8_t
type
;
char
name
[
TSDB_COL_NAME_LEN
];
int16_t
colId
;
int32_t
bytes
;
}
SSchema1
;
typedef
struct
SSchemaEx
{
typedef
struct
SSchemaEx
{
struct
SSchema
field
;
SSchema1
field
;
int32_t
offset
;
int32_t
offset
;
}
SSchemaEx
;
}
SSchemaEx
;
...
@@ -178,7 +185,7 @@ bool tExtMemBufferIsAllDataInMem(tExtMemBuffer *pMemBuffer);
...
@@ -178,7 +185,7 @@ bool tExtMemBufferIsAllDataInMem(tExtMemBuffer *pMemBuffer);
* @param blockCapacity
* @param blockCapacity
* @return
* @return
*/
*/
SColumnModel
*
createColumnModel
(
SSchema
*
fields
,
int32_t
numOfCols
,
int32_t
blockCapacity
);
SColumnModel
*
createColumnModel
(
SSchema
1
*
fields
,
int32_t
numOfCols
,
int32_t
blockCapacity
);
/**
/**
*
*
...
@@ -199,7 +206,7 @@ void destroyColumnModel(SColumnModel *pModel);
...
@@ -199,7 +206,7 @@ void destroyColumnModel(SColumnModel *pModel);
void
tColModelCompact
(
SColumnModel
*
pModel
,
tFilePage
*
inputBuffer
,
int32_t
maxElemsCapacity
);
void
tColModelCompact
(
SColumnModel
*
pModel
,
tFilePage
*
inputBuffer
,
int32_t
maxElemsCapacity
);
void
tColModelErase
(
SColumnModel
*
pModel
,
tFilePage
*
inputBuffer
,
int32_t
maxCapacity
,
int32_t
s
,
int32_t
e
);
void
tColModelErase
(
SColumnModel
*
pModel
,
tFilePage
*
inputBuffer
,
int32_t
maxCapacity
,
int32_t
s
,
int32_t
e
);
SSchema
*
getColumnModelSchema
(
SColumnModel
*
pColumnModel
,
int32_t
index
);
SSchema
1
*
getColumnModelSchema
(
SColumnModel
*
pColumnModel
,
int32_t
index
);
int16_t
getColumnModelOffset
(
SColumnModel
*
pColumnModel
,
int32_t
index
);
int16_t
getColumnModelOffset
(
SColumnModel
*
pColumnModel
,
int32_t
index
);
...
...
src/query/src/qAggMain.c
浏览文件 @
9deb3c4f
...
@@ -197,7 +197,7 @@ typedef struct {
...
@@ -197,7 +197,7 @@ typedef struct {
}
SSampleFuncInfo
;
}
SSampleFuncInfo
;
int32_t
getResultDataInfo
(
int32_t
dataType
,
int32_t
dataBytes
,
int32_t
functionId
,
int32_t
param
,
int16_t
*
type
,
int32_t
getResultDataInfo
(
int32_t
dataType
,
int32_t
dataBytes
,
int32_t
functionId
,
int32_t
param
,
int16_t
*
type
,
int
16
_t
*
bytes
,
int32_t
*
interBytes
,
int16_t
extLength
,
bool
isSuperTable
,
SUdfInfo
*
pUdfInfo
)
{
int
32
_t
*
bytes
,
int32_t
*
interBytes
,
int16_t
extLength
,
bool
isSuperTable
,
SUdfInfo
*
pUdfInfo
)
{
if
(
!
isValidDataType
(
dataType
))
{
if
(
!
isValidDataType
(
dataType
))
{
qError
(
"Illegal data type %d or data type length %d"
,
dataType
,
dataBytes
);
qError
(
"Illegal data type %d or data type length %d"
,
dataType
,
dataBytes
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
...
@@ -210,7 +210,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -210,7 +210,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
functionId
==
TSDB_FUNC_FLOOR
||
functionId
==
TSDB_FUNC_ROUND
)
functionId
==
TSDB_FUNC_FLOOR
||
functionId
==
TSDB_FUNC_ROUND
)
{
{
*
type
=
(
int16_t
)
dataType
;
*
type
=
(
int16_t
)
dataType
;
*
bytes
=
(
int16_t
)
dataBytes
;
*
bytes
=
dataBytes
;
if
(
functionId
==
TSDB_FUNC_INTERP
)
{
if
(
functionId
==
TSDB_FUNC_INTERP
)
{
*
interBytes
=
sizeof
(
SInterpInfoDetail
);
*
interBytes
=
sizeof
(
SInterpInfoDetail
);
...
@@ -224,7 +224,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -224,7 +224,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
// (uid, tid) + VGID + TAGSIZE + VARSTR_HEADER_SIZE
// (uid, tid) + VGID + TAGSIZE + VARSTR_HEADER_SIZE
if
(
functionId
==
TSDB_FUNC_TID_TAG
)
{
// todo use struct
if
(
functionId
==
TSDB_FUNC_TID_TAG
)
{
// todo use struct
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
(
int16_t
)(
dataBytes
+
sizeof
(
int16_t
)
+
sizeof
(
int64_t
)
+
sizeof
(
int32_t
)
+
sizeof
(
int32_t
)
+
VARSTR_HEADER_SIZE
);
*
bytes
=
(
dataBytes
+
sizeof
(
int16_t
)
+
sizeof
(
int64_t
)
+
sizeof
(
int32_t
)
+
sizeof
(
int32_t
)
+
VARSTR_HEADER_SIZE
);
*
interBytes
=
0
;
*
interBytes
=
0
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -302,7 +302,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -302,7 +302,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
if
(
functionId
==
TSDB_FUNC_MIN
||
functionId
==
TSDB_FUNC_MAX
)
{
if
(
functionId
==
TSDB_FUNC_MIN
||
functionId
==
TSDB_FUNC_MAX
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
(
int16_t
)(
dataBytes
+
DATA_SET_FLAG_SIZE
);
*
bytes
=
(
dataBytes
+
DATA_SET_FLAG_SIZE
);
*
interBytes
=
*
bytes
;
*
interBytes
=
*
bytes
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -325,13 +325,13 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -325,13 +325,13 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
)
{
}
else
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
(
int16_t
)(
sizeof
(
STopBotInfo
)
+
(
sizeof
(
tValuePair
)
+
POINTER_BYTES
+
extLength
)
*
param
);
*
bytes
=
(
sizeof
(
STopBotInfo
)
+
(
sizeof
(
tValuePair
)
+
POINTER_BYTES
+
extLength
)
*
param
);
*
interBytes
=
*
bytes
;
*
interBytes
=
*
bytes
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
functionId
==
TSDB_FUNC_SAMPLE
)
{
}
else
if
(
functionId
==
TSDB_FUNC_SAMPLE
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
(
int16_t
)(
sizeof
(
SSampleFuncInfo
)
+
dataBytes
*
param
+
sizeof
(
int64_t
)
*
param
+
extLength
*
param
);
*
bytes
=
(
sizeof
(
SSampleFuncInfo
)
+
dataBytes
*
param
+
sizeof
(
int64_t
)
*
param
+
extLength
*
param
);
*
interBytes
=
*
bytes
;
*
interBytes
=
*
bytes
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -344,14 +344,14 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -344,14 +344,14 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
}
else
if
(
functionId
==
TSDB_FUNC_APERCT
)
{
}
else
if
(
functionId
==
TSDB_FUNC_APERCT
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
int16_t
bytesHist
=
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
)
+
sizeof
(
SHistogramInfo
)
+
sizeof
(
SAPercentileInfo
);
int16_t
bytesHist
=
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
)
+
sizeof
(
SHistogramInfo
)
+
sizeof
(
SAPercentileInfo
);
int
16_t
bytesDigest
=
(
int16_t
)
(
sizeof
(
SAPercentileInfo
)
+
TDIGEST_SIZE
(
COMPRESSION
));
int
32_t
bytesDigest
=
(
int32_t
)
(
sizeof
(
SAPercentileInfo
)
+
TDIGEST_SIZE
(
COMPRESSION
));
*
bytes
=
MAX
(
bytesHist
,
bytesDigest
);
*
bytes
=
MAX
(
bytesHist
,
bytesDigest
);
*
interBytes
=
*
bytes
;
*
interBytes
=
*
bytes
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
functionId
==
TSDB_FUNC_LAST_ROW
)
{
}
else
if
(
functionId
==
TSDB_FUNC_LAST_ROW
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
(
int16_t
)(
sizeof
(
SLastrowInfo
)
+
dataBytes
);
*
bytes
=
(
sizeof
(
SLastrowInfo
)
+
dataBytes
);
*
interBytes
=
*
bytes
;
*
interBytes
=
*
bytes
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -379,7 +379,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -379,7 +379,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*
type
=
TSDB_DATA_TYPE_DOUBLE
;
*
type
=
TSDB_DATA_TYPE_DOUBLE
;
*
bytes
=
sizeof
(
double
);
*
bytes
=
sizeof
(
double
);
int16_t
bytesHist
=
sizeof
(
SAPercentileInfo
)
+
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
);
int16_t
bytesHist
=
sizeof
(
SAPercentileInfo
)
+
sizeof
(
SHistogramInfo
)
+
sizeof
(
SHistBin
)
*
(
MAX_HISTOGRAM_BIN
+
1
);
int
16_t
bytesDigest
=
(
int16_t
)
(
sizeof
(
SAPercentileInfo
)
+
TDIGEST_SIZE
(
COMPRESSION
));
int
32_t
bytesDigest
=
(
int32_t
)
(
sizeof
(
SAPercentileInfo
)
+
TDIGEST_SIZE
(
COMPRESSION
));
*
interBytes
=
MAX
(
bytesHist
,
bytesDigest
);
*
interBytes
=
MAX
(
bytesHist
,
bytesDigest
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
functionId
==
TSDB_FUNC_TWA
)
{
}
else
if
(
functionId
==
TSDB_FUNC_TWA
)
{
...
@@ -416,31 +416,31 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -416,31 +416,31 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*
interBytes
=
sizeof
(
SStddevInfo
);
*
interBytes
=
sizeof
(
SStddevInfo
);
}
else
if
(
functionId
==
TSDB_FUNC_MIN
||
functionId
==
TSDB_FUNC_MAX
)
{
}
else
if
(
functionId
==
TSDB_FUNC_MIN
||
functionId
==
TSDB_FUNC_MAX
)
{
*
type
=
(
int16_t
)
dataType
;
*
type
=
(
int16_t
)
dataType
;
*
bytes
=
(
int16_t
)
dataBytes
;
*
bytes
=
dataBytes
;
*
interBytes
=
dataBytes
+
DATA_SET_FLAG_SIZE
;
*
interBytes
=
dataBytes
+
DATA_SET_FLAG_SIZE
;
}
else
if
(
functionId
==
TSDB_FUNC_FIRST
||
functionId
==
TSDB_FUNC_LAST
)
{
}
else
if
(
functionId
==
TSDB_FUNC_FIRST
||
functionId
==
TSDB_FUNC_LAST
)
{
*
type
=
(
int16_t
)
dataType
;
*
type
=
(
int16_t
)
dataType
;
*
bytes
=
(
int16_t
)
dataBytes
;
*
bytes
=
dataBytes
;
*
interBytes
=
(
int16_t
)(
dataBytes
+
sizeof
(
SFirstLastInfo
));
*
interBytes
=
(
dataBytes
+
sizeof
(
SFirstLastInfo
));
}
else
if
(
functionId
==
TSDB_FUNC_SPREAD
)
{
}
else
if
(
functionId
==
TSDB_FUNC_SPREAD
)
{
*
type
=
(
int16_t
)
TSDB_DATA_TYPE_DOUBLE
;
*
type
=
(
int16_t
)
TSDB_DATA_TYPE_DOUBLE
;
*
bytes
=
sizeof
(
double
);
*
bytes
=
sizeof
(
double
);
*
interBytes
=
sizeof
(
SSpreadInfo
);
*
interBytes
=
sizeof
(
SSpreadInfo
);
}
else
if
(
functionId
==
TSDB_FUNC_PERCT
)
{
}
else
if
(
functionId
==
TSDB_FUNC_PERCT
)
{
*
type
=
(
int16_t
)
TSDB_DATA_TYPE_DOUBLE
;
*
type
=
(
int16_t
)
TSDB_DATA_TYPE_DOUBLE
;
*
bytes
=
(
int16_t
)
sizeof
(
double
);
*
bytes
=
sizeof
(
double
);
*
interBytes
=
(
int16_t
)
sizeof
(
SPercentileInfo
);
*
interBytes
=
sizeof
(
SPercentileInfo
);
}
else
if
(
functionId
==
TSDB_FUNC_LEASTSQR
)
{
}
else
if
(
functionId
==
TSDB_FUNC_LEASTSQR
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
MAX
(
TSDB_AVG_FUNCTION_INTER_BUFFER_SIZE
,
sizeof
(
SLeastsquaresInfo
));
// string
*
bytes
=
MAX
(
TSDB_AVG_FUNCTION_INTER_BUFFER_SIZE
,
sizeof
(
SLeastsquaresInfo
));
// string
*
interBytes
=
*
bytes
;
*
interBytes
=
*
bytes
;
}
else
if
(
functionId
==
TSDB_FUNC_FIRST_DST
||
functionId
==
TSDB_FUNC_LAST_DST
)
{
}
else
if
(
functionId
==
TSDB_FUNC_FIRST_DST
||
functionId
==
TSDB_FUNC_LAST_DST
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
bytes
=
(
int16_t
)(
dataBytes
+
sizeof
(
SFirstLastInfo
));
*
bytes
=
(
dataBytes
+
sizeof
(
SFirstLastInfo
));
*
interBytes
=
*
bytes
;
*
interBytes
=
*
bytes
;
}
else
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
)
{
}
else
if
(
functionId
==
TSDB_FUNC_TOP
||
functionId
==
TSDB_FUNC_BOTTOM
)
{
*
type
=
(
int16_t
)
dataType
;
*
type
=
(
int16_t
)
dataType
;
*
bytes
=
(
int16_t
)
dataBytes
;
*
bytes
=
dataBytes
;
size_t
size
=
sizeof
(
STopBotInfo
)
+
(
sizeof
(
tValuePair
)
+
POINTER_BYTES
+
extLength
)
*
param
;
size_t
size
=
sizeof
(
STopBotInfo
)
+
(
sizeof
(
tValuePair
)
+
POINTER_BYTES
+
extLength
)
*
param
;
...
@@ -448,12 +448,12 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
...
@@ -448,12 +448,12 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
*
interBytes
=
(
int32_t
)
size
;
*
interBytes
=
(
int32_t
)
size
;
}
else
if
(
functionId
==
TSDB_FUNC_SAMPLE
)
{
}
else
if
(
functionId
==
TSDB_FUNC_SAMPLE
)
{
*
type
=
(
int16_t
)
dataType
;
*
type
=
(
int16_t
)
dataType
;
*
bytes
=
(
int16_t
)
dataBytes
;
*
bytes
=
dataBytes
;
size_t
size
=
sizeof
(
SSampleFuncInfo
)
+
dataBytes
*
param
+
sizeof
(
int64_t
)
*
param
+
extLength
*
param
;
size_t
size
=
sizeof
(
SSampleFuncInfo
)
+
dataBytes
*
param
+
sizeof
(
int64_t
)
*
param
+
extLength
*
param
;
*
interBytes
=
(
int32_t
)
size
;
*
interBytes
=
(
int32_t
)
size
;
}
else
if
(
functionId
==
TSDB_FUNC_LAST_ROW
)
{
}
else
if
(
functionId
==
TSDB_FUNC_LAST_ROW
)
{
*
type
=
(
int16_t
)
dataType
;
*
type
=
(
int16_t
)
dataType
;
*
bytes
=
(
int16_t
)
dataBytes
;
*
bytes
=
dataBytes
;
*
interBytes
=
dataBytes
;
*
interBytes
=
dataBytes
;
}
else
if
(
functionId
==
TSDB_FUNC_STDDEV_DST
)
{
}
else
if
(
functionId
==
TSDB_FUNC_STDDEV_DST
)
{
*
type
=
TSDB_DATA_TYPE_BINARY
;
*
type
=
TSDB_DATA_TYPE_BINARY
;
...
...
src/query/src/qExecutor.c
浏览文件 @
9deb3c4f
...
@@ -2639,6 +2639,14 @@ static void getIntermediateBufInfo(SQueryRuntimeEnv* pRuntimeEnv, int32_t* ps, i
...
@@ -2639,6 +2639,14 @@ static void getIntermediateBufInfo(SQueryRuntimeEnv* pRuntimeEnv, int32_t* ps, i
while
(((
*
rowsize
)
*
MIN_ROWS_PER_PAGE
)
>
(
*
ps
)
-
overhead
)
{
while
(((
*
rowsize
)
*
MIN_ROWS_PER_PAGE
)
>
(
*
ps
)
-
overhead
)
{
*
ps
=
((
*
ps
)
<<
1u
);
*
ps
=
((
*
ps
)
<<
1u
);
}
}
if
(
*
ps
>
5
*
1024
*
1024
)
{
MIN_ROWS_PER_PAGE
=
2
;
*
ps
=
DEFAULT_INTERN_BUF_PAGE_SIZE
;
while
(((
*
rowsize
)
*
MIN_ROWS_PER_PAGE
)
>
(
*
ps
)
-
overhead
)
{
*
ps
=
((
*
ps
)
<<
1u
);
}
}
}
}
#define IS_PREFILTER_TYPE(_t) ((_t) != TSDB_DATA_TYPE_BINARY && (_t) != TSDB_DATA_TYPE_NCHAR)
#define IS_PREFILTER_TYPE(_t) ((_t) != TSDB_DATA_TYPE_BINARY && (_t) != TSDB_DATA_TYPE_NCHAR)
...
@@ -4792,8 +4800,8 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr
...
@@ -4792,8 +4800,8 @@ int32_t doInitQInfo(SQInfo* pQInfo, STSBuf* pTsBuf, void* tsdb, void* sourceOptr
int32_t
ps
=
DEFAULT_PAGE_SIZE
;
int32_t
ps
=
DEFAULT_PAGE_SIZE
;
getIntermediateBufInfo
(
pRuntimeEnv
,
&
ps
,
&
pQueryAttr
->
intermediateResultRowSize
);
getIntermediateBufInfo
(
pRuntimeEnv
,
&
ps
,
&
pQueryAttr
->
intermediateResultRowSize
);
int32_t
T
ENMB
=
1024
*
1024
*
1
0
;
int32_t
T
WENTYMB
=
1024
*
1024
*
2
0
;
int32_t
code
=
createDiskbasedResultBuffer
(
&
pRuntimeEnv
->
pResultBuf
,
ps
,
T
EN
MB
,
pQInfo
->
qId
);
int32_t
code
=
createDiskbasedResultBuffer
(
&
pRuntimeEnv
->
pResultBuf
,
ps
,
T
WENTY
MB
,
pQInfo
->
qId
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
return
code
;
}
}
...
...
src/query/src/qExtbuffer.c
浏览文件 @
9deb3c4f
...
@@ -521,7 +521,7 @@ static void swap(SColumnModel *pColumnModel, int32_t count, int32_t s1, char *da
...
@@ -521,7 +521,7 @@ static void swap(SColumnModel *pColumnModel, int32_t count, int32_t s1, char *da
void
*
first
=
COLMODEL_GET_VAL
(
data1
,
pColumnModel
,
count
,
s1
,
i
);
void
*
first
=
COLMODEL_GET_VAL
(
data1
,
pColumnModel
,
count
,
s1
,
i
);
void
*
second
=
COLMODEL_GET_VAL
(
data1
,
pColumnModel
,
count
,
s2
,
i
);
void
*
second
=
COLMODEL_GET_VAL
(
data1
,
pColumnModel
,
count
,
s2
,
i
);
SSchema
*
pSchema
=
&
pColumnModel
->
pFields
[
i
].
field
;
SSchema
1
*
pSchema
=
&
pColumnModel
->
pFields
[
i
].
field
;
tsDataSwap
(
first
,
second
,
pSchema
->
type
,
pSchema
->
bytes
,
buf
);
tsDataSwap
(
first
,
second
,
pSchema
->
type
,
pSchema
->
bytes
,
buf
);
}
}
}
}
...
@@ -750,7 +750,7 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta
...
@@ -750,7 +750,7 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta
size_t
width
=
0
;
size_t
width
=
0
;
for
(
int32_t
i
=
0
;
i
<
pModel
->
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pModel
->
numOfCols
;
++
i
)
{
SSchema
*
pSchema
=
&
pModel
->
pFields
[
i
].
field
;
SSchema
1
*
pSchema
=
&
pModel
->
pFields
[
i
].
field
;
if
(
width
<
pSchema
->
bytes
)
{
if
(
width
<
pSchema
->
bytes
)
{
width
=
pSchema
->
bytes
;
width
=
pSchema
->
bytes
;
}
}
...
@@ -771,7 +771,7 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta
...
@@ -771,7 +771,7 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta
/*
/*
* deep copy of sschema
* deep copy of sschema
*/
*/
SColumnModel
*
createColumnModel
(
SSchema
*
fields
,
int32_t
numOfCols
,
int32_t
blockCapacity
)
{
SColumnModel
*
createColumnModel
(
SSchema
1
*
fields
,
int32_t
numOfCols
,
int32_t
blockCapacity
)
{
SColumnModel
*
pColumnModel
=
(
SColumnModel
*
)
calloc
(
1
,
sizeof
(
SColumnModel
)
+
numOfCols
*
sizeof
(
SSchemaEx
));
SColumnModel
*
pColumnModel
=
(
SColumnModel
*
)
calloc
(
1
,
sizeof
(
SColumnModel
)
+
numOfCols
*
sizeof
(
SSchemaEx
));
if
(
pColumnModel
==
NULL
)
{
if
(
pColumnModel
==
NULL
)
{
return
NULL
;
return
NULL
;
...
@@ -1023,7 +1023,7 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE
...
@@ -1023,7 +1023,7 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE
}
}
}
}
SSchema
*
getColumnModelSchema
(
SColumnModel
*
pColumnModel
,
int32_t
index
)
{
SSchema
1
*
getColumnModelSchema
(
SColumnModel
*
pColumnModel
,
int32_t
index
)
{
assert
(
pColumnModel
!=
NULL
&&
index
>=
0
&&
index
<
pColumnModel
->
numOfCols
);
assert
(
pColumnModel
!=
NULL
&&
index
>=
0
&&
index
<
pColumnModel
->
numOfCols
);
return
&
pColumnModel
->
pFields
[
index
].
field
;
return
&
pColumnModel
->
pFields
[
index
].
field
;
}
}
...
@@ -1045,7 +1045,7 @@ void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t blockC
...
@@ -1045,7 +1045,7 @@ void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t blockC
/* start from the second column */
/* start from the second column */
for
(
int32_t
i
=
0
;
i
<
pModel
->
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pModel
->
numOfCols
;
++
i
)
{
int16_t
offset
=
getColumnModelOffset
(
pModel
,
i
);
int16_t
offset
=
getColumnModelOffset
(
pModel
,
i
);
SSchema
*
pSchema
=
getColumnModelSchema
(
pModel
,
i
);
SSchema
1
*
pSchema
=
getColumnModelSchema
(
pModel
,
i
);
char
*
startPos
=
inputBuffer
->
data
+
offset
*
blockCapacity
+
s
*
pSchema
->
bytes
;
char
*
startPos
=
inputBuffer
->
data
+
offset
*
blockCapacity
+
s
*
pSchema
->
bytes
;
char
*
endPos
=
startPos
+
pSchema
->
bytes
*
removed
;
char
*
endPos
=
startPos
+
pSchema
->
bytes
*
removed
;
...
...
src/query/tests/cSortTest.cpp
浏览文件 @
9deb3c4f
...
@@ -97,7 +97,7 @@ TEST(testCase, colunmnwise_sort_test) {
...
@@ -97,7 +97,7 @@ TEST(testCase, colunmnwise_sort_test) {
}
}
TEST
(
testCase
,
columnsort_test
)
{
TEST
(
testCase
,
columnsort_test
)
{
SSchema
field
[
1
]
=
{
SSchema
1
field
[
1
]
=
{
{
TSDB_DATA_TYPE_INT
,
"k"
,
sizeof
(
int32_t
)},
{
TSDB_DATA_TYPE_INT
,
"k"
,
sizeof
(
int32_t
)},
};
};
...
...
src/query/tests/percentileTest.cpp
浏览文件 @
9deb3c4f
...
@@ -192,7 +192,7 @@ void largeDataTest() {
...
@@ -192,7 +192,7 @@ void largeDataTest() {
void
qsortTest
()
{
void
qsortTest
()
{
printf
(
"running : %s
\n
"
,
__FUNCTION__
);
printf
(
"running : %s
\n
"
,
__FUNCTION__
);
SSchema
field
[
1
]
=
{
SSchema
1
field
[
1
]
=
{
{
TSDB_DATA_TYPE_INT
,
"k"
,
sizeof
(
int32_t
)},
{
TSDB_DATA_TYPE_INT
,
"k"
,
sizeof
(
int32_t
)},
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录