Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
405597e5
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1193
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
405597e5
编写于
10月 09, 2022
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: column support 63K and row support 64k
上级
10b184cc
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
154 addition
and
136 deletion
+154
-136
src/client/inc/tscParseLine.h
src/client/inc/tscParseLine.h
+4
-4
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+5
-5
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+1
-1
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+19
-18
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+17
-17
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+14
-14
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+1
-1
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+7
-7
src/client/src/tscServer.c
src/client/src/tscServer.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+2
-2
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+5
-5
src/inc/taos.h
src/inc/taos.h
+1
-1
src/inc/taosdef.h
src/inc/taosdef.h
+18
-1
src/inc/taosmsg.h
src/inc/taosmsg.h
+12
-12
src/inc/tsdb.h
src/inc/tsdb.h
+2
-2
src/inc/ttype.h
src/inc/ttype.h
+1
-1
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+1
-1
src/query/inc/qScript.h
src/query/inc/qScript.h
+12
-12
src/query/inc/qUdf.h
src/query/inc/qUdf.h
+14
-15
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+6
-5
src/query/src/qScript.c
src/query/src/qScript.c
+1
-1
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+1
-1
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+6
-6
tests/script/api/resultBlock.c
tests/script/api/resultBlock.c
+3
-3
未找到文件。
src/client/inc/tscParseLine.h
浏览文件 @
405597e5
...
...
@@ -26,10 +26,10 @@ extern "C" {
typedef
TSDB_SML_PROTOCOL_TYPE
SMLProtocolType
;
typedef
struct
{
char
*
key
;
uint8_t
type
;
int16_t
length
;
char
*
value
;
char
*
key
;
uint8_t
type
;
u
int16_t
length
;
char
*
value
;
uint32_t
fieldSchemaIdx
;
}
TAOS_SML_KV
;
...
...
src/client/inc/tscUtil.h
浏览文件 @
405597e5
...
...
@@ -141,7 +141,7 @@ int32_t tsSetBlockInfo(SSubmitBlk *pBlocks, const STableMeta *pTableMeta, int32_
void
tscDestroyBoundColumnInfo
(
SParsedDataColInfo
*
pColInfo
);
void
doRetrieveSubqueryData
(
SSchedMsg
*
pMsg
);
SParamInfo
*
tscAddParamToDataBlock
(
STableDataBlocks
*
pDataBlock
,
char
type
,
uint8_t
timePrec
,
int16_t
bytes
,
SParamInfo
*
tscAddParamToDataBlock
(
STableDataBlocks
*
pDataBlock
,
char
type
,
uint8_t
timePrec
,
u
int16_t
bytes
,
uint32_t
offset
);
void
*
tscDestroyBlockArrayList
(
SSqlObj
*
pSql
,
SArray
*
pDataBlockList
);
...
...
@@ -205,7 +205,7 @@ bool tscIsInsertData(char* sqlstr);
int32_t
tscAllocPayloadFast
(
SSqlCmd
*
pCmd
,
size_t
size
);
int32_t
tscAllocPayload
(
SSqlCmd
*
pCmd
,
int
size
);
TAOS_FIELD
tscCreateField
(
int8_t
type
,
const
char
*
name
,
int16_t
bytes
);
TAOS_FIELD
tscCreateField
(
int8_t
type
,
const
char
*
name
,
u
int16_t
bytes
);
SInternalField
*
tscFieldInfoAppend
(
SFieldInfo
*
pFieldInfo
,
TAOS_FIELD
*
pField
);
SInternalField
*
tscFieldInfoInsert
(
SFieldInfo
*
pFieldInfo
,
int32_t
index
,
TAOS_FIELD
*
field
);
...
...
@@ -231,15 +231,15 @@ void addExprParams(SSqlExpr* pExpr, char* argument, int32_t type, int32_t bytes)
int32_t
tscGetResRowLength
(
SArray
*
pExprList
);
SExprInfo
*
tscExprInsert
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
bool
isTagCol
);
u
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
bool
isTagCol
);
SExprInfo
*
tscExprCreate
(
STableMetaInfo
*
pTableMetaInfo
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
int32_t
colType
);
u
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
int32_t
colType
);
void
tscExprAddParams
(
SSqlExpr
*
pExpr
,
char
*
argument
,
int32_t
type
,
int32_t
bytes
);
SExprInfo
*
tscExprAppend
(
SQueryInfo
*
pQueryInfo
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
bool
isTagCol
);
u
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
bool
isTagCol
);
SExprInfo
*
tscExprUpdate
(
SQueryInfo
*
pQueryInfo
,
int32_t
index
,
int16_t
functionId
,
int16_t
srcColumnIndex
,
int16_t
type
,
int32_t
size
);
...
...
src/client/inc/tsclient.h
浏览文件 @
405597e5
...
...
@@ -86,7 +86,7 @@ typedef struct SParamInfo {
int32_t
idx
;
uint8_t
type
;
uint8_t
timePrec
;
int16_t
bytes
;
uint16_t
bytes
;
uint32_t
offset
;
}
SParamInfo
;
...
...
src/client/src/tscLocal.c
浏览文件 @
405597e5
...
...
@@ -168,12 +168,12 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
rowLen
+=
((
TSDB_COL_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
);
f
.
bytes
=
(
int16_t
)(
typeColLength
+
VARSTR_HEADER_SIZE
);
f
.
bytes
=
(
u
int16_t
)(
typeColLength
+
VARSTR_HEADER_SIZE
);
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
tstrncpy
(
f
.
name
,
"Type"
,
sizeof
(
f
.
name
));
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
idx
,
TSDB_DATA_TYPE_BINARY
,
(
int16_t
)(
typeColLength
+
VARSTR_HEADER_SIZE
),
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
idx
,
TSDB_DATA_TYPE_BINARY
,
(
u
int16_t
)(
typeColLength
+
VARSTR_HEADER_SIZE
),
-
1000
,
typeColLength
,
false
);
rowLen
+=
typeColLength
+
VARSTR_HEADER_SIZE
;
...
...
@@ -188,12 +188,12 @@ static int32_t tscBuildTableSchemaResultFields(SSqlObj *pSql, int32_t numOfCols,
rowLen
+=
sizeof
(
int32_t
);
f
.
bytes
=
(
int16_t
)(
noteColLength
+
VARSTR_HEADER_SIZE
);
f
.
bytes
=
(
u
int16_t
)(
noteColLength
+
VARSTR_HEADER_SIZE
);
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
tstrncpy
(
f
.
name
,
"Note"
,
sizeof
(
f
.
name
));
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
idx
,
TSDB_DATA_TYPE_BINARY
,
(
int16_t
)(
noteColLength
+
VARSTR_HEADER_SIZE
),
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
idx
,
TSDB_DATA_TYPE_BINARY
,
(
u
int16_t
)(
noteColLength
+
VARSTR_HEADER_SIZE
),
-
1000
,
noteColLength
,
false
);
rowLen
+=
noteColLength
+
VARSTR_HEADER_SIZE
;
...
...
@@ -414,31 +414,32 @@ static int32_t tscGetTableTagValue(SCreateBuilder *builder, char *result) {
// build 'show create table/database' result fields
static
int32_t
tscSCreateBuildResultFields
(
SSqlObj
*
pSql
,
BuildType
type
,
const
char
*
ddl
)
{
int32_t
rowLen
=
0
;
int16_t
ddlLen
=
(
int16_t
)
strlen
(
ddl
);
int32_t
rowLen
=
0
;
uint16_t
ddlLen
=
(
uint16_t
)
strlen
(
ddl
);
SColumnIndex
idx
=
{
0
};
pSql
->
cmd
.
numOfCols
=
2
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
&
pSql
->
cmd
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
&
pSql
->
cmd
);
pQueryInfo
->
order
.
order
=
TSDB_ORDER_ASC
;
TAOS_FIELD
f
;
TAOS_FIELD
f
;
if
(
type
==
SCREATE_BUILD_TABLE
)
{
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
f
.
bytes
=
(
TSDB_TABLE_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
tstrncpy
(
f
.
name
,
"Table"
,
sizeof
(
f
.
name
));
}
else
{
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
f
.
bytes
=
(
TSDB_DB_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
f
.
bytes
=
(
TSDB_DB_NAME_LEN
-
1
)
+
VARSTR_HEADER_SIZE
;
tstrncpy
(
f
.
name
,
"Database"
,
sizeof
(
f
.
name
));
}
}
SInternalField
*
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
idx
,
TSDB_DATA_TYPE_BINARY
,
f
.
bytes
,
-
1000
,
f
.
bytes
-
VARSTR_HEADER_SIZE
,
false
);
SInternalField
*
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
idx
,
TSDB_DATA_TYPE_BINARY
,
f
.
bytes
,
-
1000
,
f
.
bytes
-
VARSTR_HEADER_SIZE
,
false
);
rowLen
+=
f
.
bytes
;
rowLen
+=
f
.
bytes
;
f
.
bytes
=
(
int16_t
)(
ddlLen
+
VARSTR_HEADER_SIZE
);
f
.
bytes
=
(
u
int16_t
)(
ddlLen
+
VARSTR_HEADER_SIZE
);
f
.
type
=
TSDB_DATA_TYPE_BINARY
;
if
(
type
==
SCREATE_BUILD_TABLE
)
{
tstrncpy
(
f
.
name
,
"Create Table"
,
sizeof
(
f
.
name
));
...
...
@@ -448,7 +449,7 @@ static int32_t tscSCreateBuildResultFields(SSqlObj *pSql, BuildType type, const
pInfo
=
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pInfo
->
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TS_DUMMY
,
&
idx
,
TSDB_DATA_TYPE_BINARY
,
(
int16_t
)(
ddlLen
+
VARSTR_HEADER_SIZE
),
-
1000
,
ddlLen
,
false
);
(
u
int16_t
)(
ddlLen
+
VARSTR_HEADER_SIZE
),
-
1000
,
ddlLen
,
false
);
rowLen
+=
ddlLen
+
VARSTR_HEADER_SIZE
;
...
...
@@ -943,7 +944,7 @@ void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnNa
tscFieldInfoClear
(
&
pQueryInfo
->
fieldsInfo
);
pQueryInfo
->
fieldsInfo
.
internalField
=
taosArrayInit
(
1
,
sizeof
(
SInternalField
));
TAOS_FIELD
f
=
tscCreateField
((
int8_t
)
type
,
columnName
,
(
int16_t
)
valueLength
);
TAOS_FIELD
f
=
tscCreateField
((
int8_t
)
type
,
columnName
,
(
u
int16_t
)
valueLength
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pSql
->
res
.
pMerger
=
tscInitResObjForLocalQuery
(
1
,
(
int32_t
)
valueLength
,
pSql
->
self
);
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
405597e5
...
...
@@ -1643,8 +1643,8 @@ static int32_t isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType, S
static
bool
convertStrToNumber
(
TAOS_SML_KV
*
pVal
,
char
*
str
,
SSmlLinesInfo
*
info
)
{
errno
=
0
;
uint8_t
type
=
pVal
->
type
;
int16_t
length
=
pVal
->
length
;
uint8_t
type
=
pVal
->
type
;
u
int16_t
length
=
pVal
->
length
;
int64_t
val_s
=
0
;
uint64_t
val_u
=
0
;
double
val_d
=
0
.
0
;
...
...
@@ -1761,7 +1761,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
bool
has_sign
;
if
(
isInteger
(
value
,
len
,
&
has_sign
))
{
pVal
->
type
=
has_sign
?
TSDB_DATA_TYPE_BIGINT
:
TSDB_DATA_TYPE_UBIGINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
1
]
=
'\0'
;
if
(
!
isValidInteger
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1770,7 +1770,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
}
if
(
isTinyInt
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_TINYINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
2
]
=
'\0'
;
if
(
!
isValidInteger
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1779,7 +1779,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
}
if
(
isTinyUint
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_UTINYINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
2
]
=
'\0'
;
if
(
!
isValidInteger
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1788,7 +1788,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
}
if
(
isSmallInt
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_SMALLINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
3
]
=
'\0'
;
if
(
!
isValidInteger
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1797,7 +1797,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
}
if
(
isSmallUint
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_USMALLINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
3
]
=
'\0'
;
if
(
!
isValidInteger
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1806,7 +1806,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
}
if
(
isInt
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_INT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
3
]
=
'\0'
;
if
(
!
isValidInteger
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1815,7 +1815,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
}
if
(
isUint
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_UINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
3
]
=
'\0'
;
if
(
!
isValidInteger
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1824,7 +1824,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
}
if
(
isBigInt
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_BIGINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
3
]
=
'\0'
;
if
(
!
isValidInteger
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1833,7 +1833,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
}
if
(
isBigUint
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_UBIGINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
3
]
=
'\0'
;
if
(
!
isValidInteger
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1843,7 +1843,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
//floating number
if
(
isFloat
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_FLOAT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
3
]
=
'\0'
;
if
(
!
isValidFloat
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1852,7 +1852,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
}
if
(
isDouble
(
value
,
len
))
{
pVal
->
type
=
TSDB_DATA_TYPE_DOUBLE
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
value
[
len
-
3
]
=
'\0'
;
if
(
!
isValidFloat
(
value
)
||
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
...
...
@@ -1881,7 +1881,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
bool
bVal
;
if
(
isBool
(
value
,
len
,
&
bVal
))
{
pVal
->
type
=
TSDB_DATA_TYPE_BOOL
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
calloc
(
pVal
->
length
,
1
);
memcpy
(
pVal
->
value
,
&
bVal
,
pVal
->
length
);
return
true
;
...
...
@@ -1890,7 +1890,7 @@ bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
//Handle default(no appendix) type as DOUBLE
if
(
isValidInteger
(
value
)
||
isValidFloat
(
value
))
{
pVal
->
type
=
TSDB_DATA_TYPE_DOUBLE
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
if
(
!
convertStrToNumber
(
pVal
,
value
,
info
))
{
return
false
;
}
...
...
@@ -1962,7 +1962,7 @@ int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
tscDebug
(
"SML:0x%"
PRIx64
"Timestamp after conversion:%"
PRId64
,
info
->
id
,
tsVal
);
pVal
->
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
calloc
(
pVal
->
length
,
1
);
memcpy
(
pVal
->
value
,
&
tsVal
,
pVal
->
length
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -2056,7 +2056,7 @@ static int32_t parseSmlValue(TAOS_SML_KV *pKV, const char **idx, int32_t sqlLen,
int32_t
ret
=
TSDB_CODE_SUCCESS
;
char
*
value
=
NULL
;
int32_t
bufSize
=
TSDB_FUNC_BUF_SIZE
;
int16_t
len
=
0
;
uint16_t
len
=
0
;
bool
kv_done
=
false
;
bool
back_slash
=
false
;
...
...
src/client/src/tscParseOpenTSDB.c
浏览文件 @
405597e5
...
...
@@ -657,7 +657,7 @@ static int32_t parseTimestampFromJSON(cJSON *root, TAOS_SML_KV **pTS, int *num_k
memcpy
((
*
pTS
)
->
key
,
key
,
sizeof
(
key
));
(
*
pTS
)
->
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
(
*
pTS
)
->
length
=
(
int16_t
)
tDataTypes
[(
*
pTS
)
->
type
].
bytes
;
(
*
pTS
)
->
length
=
(
u
int16_t
)
tDataTypes
[(
*
pTS
)
->
type
].
bytes
;
(
*
pTS
)
->
value
=
tcalloc
((
*
pTS
)
->
length
,
1
);
memcpy
((
*
pTS
)
->
value
,
&
tsVal
,
(
*
pTS
)
->
length
);
...
...
@@ -672,7 +672,7 @@ static int32_t convertJSONBool(TAOS_SML_KV *pVal, char* typeStr, int64_t valueIn
return
TSDB_CODE_TSC_INVALID_JSON_TYPE
;
}
pVal
->
type
=
TSDB_DATA_TYPE_BOOL
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
*
(
bool
*
)(
pVal
->
value
)
=
valueInt
?
true
:
false
;
...
...
@@ -688,7 +688,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
pVal
->
type
=
TSDB_DATA_TYPE_TINYINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
*
(
int8_t
*
)(
pVal
->
value
)
=
(
int8_t
)(
value
->
valueint
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -701,7 +701,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
pVal
->
type
=
TSDB_DATA_TYPE_SMALLINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
*
(
int16_t
*
)(
pVal
->
value
)
=
(
int16_t
)(
value
->
valueint
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -714,7 +714,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
pVal
->
type
=
TSDB_DATA_TYPE_INT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
*
(
int32_t
*
)(
pVal
->
value
)
=
(
int32_t
)(
value
->
valueint
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -723,7 +723,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
if
(
strcasecmp
(
typeStr
,
"i64"
)
==
0
||
strcasecmp
(
typeStr
,
"bigint"
)
==
0
)
{
pVal
->
type
=
TSDB_DATA_TYPE_BIGINT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
/* cJSON conversion of legit BIGINT may overflow,
* use original string to do the conversion.
...
...
@@ -745,7 +745,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
pVal
->
type
=
TSDB_DATA_TYPE_FLOAT
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
*
(
float
*
)(
pVal
->
value
)
=
(
float
)(
value
->
valuedouble
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -758,7 +758,7 @@ static int32_t convertJSONNumber(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
return
TSDB_CODE_TSC_VALUE_OUT_OF_RANGE
;
}
pVal
->
type
=
TSDB_DATA_TYPE_DOUBLE
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
*
(
double
*
)(
pVal
->
value
)
=
(
double
)(
value
->
valuedouble
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -778,7 +778,7 @@ static int32_t convertJSONString(TAOS_SML_KV *pVal, char* typeStr, cJSON *value,
tscError
(
"OTD:0x%"
PRIx64
" invalid type(%s) for JSON String"
,
info
->
id
,
typeStr
);
return
TSDB_CODE_TSC_INVALID_JSON_TYPE
;
}
pVal
->
length
=
(
int16_t
)
strlen
(
value
->
valuestring
);
pVal
->
length
=
(
u
int16_t
)
strlen
(
value
->
valuestring
);
pVal
->
value
=
tcalloc
(
pVal
->
length
+
1
,
1
);
memcpy
(
pVal
->
value
,
value
->
valuestring
,
pVal
->
length
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -839,7 +839,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
case
cJSON_True
:
case
cJSON_False
:
{
pVal
->
type
=
TSDB_DATA_TYPE_BOOL
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
*
(
bool
*
)(
pVal
->
value
)
=
root
->
valueint
?
true
:
false
;
break
;
...
...
@@ -848,7 +848,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
//convert default JSON Number type to BIGINT/DOUBLE
//if (isValidInteger(root->numberstring)) {
// pVal->type = TSDB_DATA_TYPE_BIGINT;
// pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
// pVal->length = (
u
int16_t)tDataTypes[pVal->type].bytes;
// pVal->value = tcalloc(pVal->length, 1);
// /* cJSON conversion of legit BIGINT may overflow,
// * use original string to do the conversion.
...
...
@@ -862,7 +862,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
// *(int64_t *)(pVal->value) = val;
//} else if (isValidFloat(root->numberstring)) {
// pVal->type = TSDB_DATA_TYPE_DOUBLE;
// pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
// pVal->length = (
u
int16_t)tDataTypes[pVal->type].bytes;
// pVal->value = tcalloc(pVal->length, 1);
// *(double *)(pVal->value) = (double)(root->valuedouble);
//} else {
...
...
@@ -870,7 +870,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
//}
if
(
isValidInteger
(
root
->
numberstring
)
||
isValidFloat
(
root
->
numberstring
))
{
pVal
->
type
=
TSDB_DATA_TYPE_DOUBLE
;
pVal
->
length
=
(
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
length
=
(
u
int16_t
)
tDataTypes
[
pVal
->
type
].
bytes
;
pVal
->
value
=
tcalloc
(
pVal
->
length
,
1
);
*
(
double
*
)(
pVal
->
value
)
=
(
double
)(
root
->
valuedouble
);
}
...
...
@@ -890,7 +890,7 @@ static int32_t parseValueFromJSON(cJSON *root, TAOS_SML_KV *pVal, SSmlLinesInfo*
return
TSDB_CODE_TSC_INVALID_JSON_CONFIG
;
}
//pVal->length = wcslen((wchar_t *)root->valuestring) * TSDB_NCHAR_SIZE;
pVal
->
length
=
(
int16_t
)
strlen
(
root
->
valuestring
);
pVal
->
length
=
(
u
int16_t
)
strlen
(
root
->
valuestring
);
pVal
->
value
=
tcalloc
(
pVal
->
length
+
1
,
1
);
memcpy
(
pVal
->
value
,
root
->
valuestring
,
pVal
->
length
);
break
;
...
...
src/client/src/tscPrepare.c
浏览文件 @
405597e5
...
...
@@ -922,7 +922,7 @@ static int doBindBatchParam(STableDataBlocks* pBlock, SParamInfo* param, TAOS_MU
tscError
(
"binary length too long, ignore it, max:%d, actual:%d"
,
param
->
bytes
,
(
int32_t
)
pBind
->
length
[
i
]);
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
int16_t
bsize
=
(
shor
t
)
pBind
->
length
[
i
];
uint16_t
bsize
=
(
uint16_
t
)
pBind
->
length
[
i
];
STR_WITH_SIZE_TO_VARSTR
(
data
+
param
->
offset
,
(
char
*
)
pBind
->
buffer
+
pBind
->
buffer_length
*
i
,
bsize
);
}
else
if
(
param
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pBind
->
length
[
i
]
>
(
uintptr_t
)
param
->
bytes
)
{
...
...
src/client/src/tscSQLParser.c
浏览文件 @
405597e5
...
...
@@ -81,7 +81,7 @@ static void getColumnName(tSqlExprItem* pItem, char* resultFieldName, char* rawN
static
int32_t
addExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
int32_t
colIndex
,
tSqlExprItem
*
pItem
,
bool
finalResult
,
SUdfInfo
*
pUdfInfo
);
static
int32_t
insertResultField
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputIndex
,
SColumnList
*
pColList
,
int16_t
bytes
,
static
int32_t
insertResultField
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputIndex
,
SColumnList
*
pColList
,
u
int16_t
bytes
,
int8_t
type
,
char
*
fieldName
,
SExprInfo
*
pSqlExpr
);
static
uint8_t
convertRelationalOperator
(
SStrToken
*
pToken
);
...
...
@@ -2368,7 +2368,7 @@ int32_t validateSelectNodeList(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SArray* pS
return
TSDB_CODE_SUCCESS
;
}
int32_t
insertResultField
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputIndex
,
SColumnList
*
pColList
,
int16_t
bytes
,
int32_t
insertResultField
(
SQueryInfo
*
pQueryInfo
,
int32_t
outputIndex
,
SColumnList
*
pColList
,
u
int16_t
bytes
,
int8_t
type
,
char
*
fieldName
,
SExprInfo
*
pSqlExpr
)
{
for
(
int32_t
i
=
0
;
i
<
pColList
->
num
;
++
i
)
{
int32_t
tableIndex
=
pColList
->
ids
[
i
].
tableIndex
;
...
...
@@ -8276,9 +8276,9 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClau
int16_t
colIndex
=
tscGetTagColIndexById
(
pTableMetaInfo
->
pTableMeta
,
colId
);
SColumnIndex
idx
=
{.
tableIndex
=
0
,
.
columnIndex
=
colIndex
};
char
*
name
=
pTagSchema
->
name
;
int16_t
type
=
pTagSchema
->
type
;
int16_t
bytes
=
pTagSchema
->
bytes
;
char
*
name
=
pTagSchema
->
name
;
int16_t
type
=
pTagSchema
->
type
;
u
int16_t
bytes
=
pTagSchema
->
bytes
;
pExpr
=
tscExprAppend
(
pQueryInfo
,
TSDB_FUNC_TAG
,
&
idx
,
type
,
bytes
,
getNewResColId
(
&
pSql
->
cmd
),
bytes
,
true
);
pExpr
->
base
.
colInfo
.
flag
=
TSDB_COL_TAG
;
...
...
@@ -9350,7 +9350,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
// check again after the convert since it may be converted from binary to nchar.
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
int16_t
len
=
varDataTLen
(
tagVal
);
u
int16_t
len
=
varDataTLen
(
tagVal
);
if
(
len
>
pSchema
->
bytes
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
...
...
@@ -9404,7 +9404,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
// check again after the convert since it may be converted from binary to nchar.
if
(
pSchema
->
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
int16_t
len
=
varDataTLen
(
tagVal
);
u
int16_t
len
=
varDataTLen
(
tagVal
);
if
(
len
>
pSchema
->
bytes
)
{
tdDestroyKVRowBuilder
(
&
kvRowBuilder
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
...
...
src/client/src/tscServer.c
浏览文件 @
405597e5
...
...
@@ -1290,7 +1290,7 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
*
(
int8_t
*
)
pMsg
=
pUdfInfo
->
resType
;
pMsg
+=
sizeof
(
pUdfInfo
->
resType
);
*
(
int16_t
*
)
pMsg
=
htons
(
pUdfInfo
->
resBytes
);
*
(
uint16_t
*
)
pMsg
=
htons
(
pUdfInfo
->
resBytes
);
pMsg
+=
sizeof
(
pUdfInfo
->
resBytes
);
STR_TO_VARSTR
(
pMsg
,
pUdfInfo
->
name
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
405597e5
...
...
@@ -3747,7 +3747,7 @@ _error:
return
pRes
->
code
;
}
static
char
*
getResultBlockPosition
(
SSqlCmd
*
pCmd
,
SSqlRes
*
pRes
,
int32_t
columnIndex
,
int16_t
*
bytes
)
{
static
char
*
getResultBlockPosition
(
SSqlCmd
*
pCmd
,
SSqlRes
*
pRes
,
int32_t
columnIndex
,
u
int16_t
*
bytes
)
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfo
(
pCmd
);
SInternalField
*
pInfo
=
(
SInternalField
*
)
TARRAY_GET_ELEM
(
pQueryInfo
->
fieldsInfo
.
internalField
,
columnIndex
);
...
...
@@ -3805,7 +3805,7 @@ static void doBuildResFromSubqueries(SSqlObj* pSql) {
pRes
->
data
=
pFilePage
->
data
;
char
*
data
=
pRes
->
data
;
int16_t
bytes
=
0
;
u
int16_t
bytes
=
0
;
tscRestoreFuncForSTableQuery
(
pQueryInfo
);
tscFieldInfoUpdateOffset
(
pQueryInfo
);
...
...
src/client/src/tscUtil.c
浏览文件 @
405597e5
...
...
@@ -1865,7 +1865,7 @@ void tscDestroyDataBlock(SSqlObj *pSql, STableDataBlocks* pDataBlock, bool remov
tfree
(
pDataBlock
);
}
SParamInfo
*
tscAddParamToDataBlock
(
STableDataBlocks
*
pDataBlock
,
char
type
,
uint8_t
timePrec
,
int16_t
bytes
,
SParamInfo
*
tscAddParamToDataBlock
(
STableDataBlocks
*
pDataBlock
,
char
type
,
uint8_t
timePrec
,
u
int16_t
bytes
,
uint32_t
offset
)
{
uint32_t
needed
=
pDataBlock
->
numOfParams
+
1
;
if
(
needed
>
pDataBlock
->
numOfAllocedParams
)
{
...
...
@@ -2395,7 +2395,7 @@ int32_t tscAllocPayload(SSqlCmd* pCmd, int size) {
return
code
;
}
TAOS_FIELD
tscCreateField
(
int8_t
type
,
const
char
*
name
,
int16_t
bytes
)
{
TAOS_FIELD
tscCreateField
(
int8_t
type
,
const
char
*
name
,
u
int16_t
bytes
)
{
TAOS_FIELD
f
=
{
.
type
=
type
,
.
bytes
=
bytes
,
};
tstrncpy
(
f
.
name
,
name
,
sizeof
(
f
.
name
));
return
f
;
...
...
@@ -2623,7 +2623,7 @@ void tscFieldInfoCopy(SFieldInfo* pFieldInfo, const SFieldInfo* pSrc, const SArr
SExprInfo
*
tscExprCreate
(
STableMetaInfo
*
pTableMetaInfo
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
int32_t
colType
)
{
u
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
int32_t
colType
)
{
SExprInfo
*
pExpr
=
calloc
(
1
,
sizeof
(
SExprInfo
));
if
(
pExpr
==
NULL
)
{
return
NULL
;
...
...
@@ -2685,7 +2685,7 @@ SExprInfo* tscExprCreate(STableMetaInfo* pTableMetaInfo, int16_t functionId, SCo
}
SExprInfo
*
tscExprInsert
(
SQueryInfo
*
pQueryInfo
,
int32_t
idx
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
bool
isTagCol
)
{
u
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
bool
isTagCol
)
{
int32_t
num
=
(
int32_t
)
taosArrayGetSize
(
pQueryInfo
->
exprList
);
if
(
idx
==
num
)
{
return
tscExprAppend
(
pQueryInfo
,
functionId
,
pColIndex
,
type
,
size
,
resColId
,
interSize
,
isTagCol
);
...
...
@@ -2698,7 +2698,7 @@ SExprInfo* tscExprInsert(SQueryInfo* pQueryInfo, int32_t idx, int16_t functionId
}
SExprInfo
*
tscExprAppend
(
SQueryInfo
*
pQueryInfo
,
int16_t
functionId
,
SColumnIndex
*
pColIndex
,
int16_t
type
,
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
bool
isTagCol
)
{
u
int16_t
size
,
int16_t
resColId
,
int32_t
interSize
,
bool
isTagCol
)
{
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
pColIndex
->
tableIndex
);
SExprInfo
*
pExpr
=
tscExprCreate
(
pTableMetaInfo
,
functionId
,
pColIndex
,
type
,
size
,
resColId
,
interSize
,
isTagCol
);
taosArrayPush
(
pQueryInfo
->
exprList
,
&
pExpr
);
...
...
src/inc/taos.h
浏览文件 @
405597e5
...
...
@@ -66,7 +66,7 @@ typedef enum {
typedef
struct
taosField
{
char
name
[
65
];
uint8_t
type
;
int16_t
bytes
;
uint16_t
bytes
;
}
TAOS_FIELD
;
typedef
enum
{
...
...
src/inc/taosdef.h
浏览文件 @
405597e5
...
...
@@ -206,7 +206,14 @@ do { \
// this is the length of its string representation, including the terminator zero
#define TSDB_ACCT_ID_LEN 11
#define TSDB_MODE_RICH_COL_
#ifdef TSDB_MODE_RICH_COL
#define TSDB_MAX_COLUMNS 4096
#else
#define TSDB_MAX_COLUMNS 128
#endif
#define TSDB_MIN_COLUMNS 2 //PRIMARY COLUMN(timestamp) + other columns
#define TSDB_NODE_NAME_LEN 64
...
...
@@ -231,7 +238,12 @@ do { \
* - Secondly, if all cols are VarDataT type except primary key, we need 4 bits to store the offset, thus
* the final value is 65531-(4096-1)*4 = 49151.
*/
#define TSDB_MAX_BYTES_PER_ROW 49151
#ifdef TSDB_MODE_RICH_COL
#define TSDB_MAX_BYTES_PER_ROW 49151
#else
#define TSDB_MAX_BYTES_PER_ROW 65023 // 65531-(128-1)*4=65023
#endif
#define TSDB_MAX_TAGS_LEN 16384
#define TSDB_MAX_JSON_TAGS_LEN (4096*TSDB_NCHAR_SIZE + 2 + 1) // 2->var_header_len 1->type
#define TSDB_MAX_TAGS 128
...
...
@@ -371,7 +383,12 @@ do { \
#define TSDB_MAX_JOIN_TABLE_NUM 10
#define TSDB_MAX_UNION_CLAUSE 5
#ifdef TSDB_MODE_RICH_COL
#define TSDB_MAX_FIELD_LEN 16384
#else
#define TSDB_MAX_FIELD_LEN 64512
#endif
#define TSDB_MAX_BINARY_LEN (TSDB_MAX_FIELD_LEN-TSDB_KEYSIZE) // keep 16384
#define TSDB_MAX_NCHAR_LEN (TSDB_MAX_FIELD_LEN-TSDB_KEYSIZE) // keep 16384
#define PRIMARYKEY_TIMESTAMP_COL_INDEX 0
...
...
src/inc/taosmsg.h
浏览文件 @
405597e5
...
...
@@ -265,10 +265,10 @@ typedef struct {
}
SShellSubmitRspMsg
;
typedef
struct
SSchema
{
uint8_t
type
;
char
name
[
TSDB_COL_NAME_LEN
];
int16_t
colId
;
int16_t
bytes
;
uint8_t
type
;
char
name
[
TSDB_COL_NAME_LEN
];
int16_t
colId
;
u
int16_t
bytes
;
}
SSchema
;
typedef
struct
STimeWindow
{
...
...
@@ -643,14 +643,14 @@ typedef struct {
}
SRetrieveFuncMsg
;
typedef
struct
{
int8_t
extend
;
char
name
[
TSDB_FUNC_NAME_LEN
];
int32_t
funcType
;
int8_t
resType
;
int16_t
resBytes
;
int32_t
bufSize
;
int32_t
len
;
char
content
[];
int8_t
extend
;
char
name
[
TSDB_FUNC_NAME_LEN
];
int32_t
funcType
;
int8_t
resType
;
u
int16_t
resBytes
;
int32_t
bufSize
;
int32_t
len
;
char
content
[];
}
SFunctionInfoMsg
;
typedef
struct
{
...
...
src/inc/tsdb.h
浏览文件 @
405597e5
...
...
@@ -432,8 +432,8 @@ bool tsdbNoProblem(STsdbRepo* pRepo);
int
tsdbCheckWal
(
STsdbRepo
*
pRepo
,
uint32_t
walSize
);
// for json tag
void
*
getJsonTagValueElment
(
void
*
data
,
char
*
key
,
int32_t
keyLen
,
char
*
out
,
int16_t
bytes
);
void
getJsonTagValueAll
(
void
*
data
,
void
*
dst
,
int16_t
bytes
);
void
*
getJsonTagValueElment
(
void
*
data
,
char
*
key
,
int32_t
keyLen
,
char
*
out
,
u
int16_t
bytes
);
void
getJsonTagValueAll
(
void
*
data
,
void
*
dst
,
u
int16_t
bytes
);
char
*
parseTagDatatoJson
(
void
*
p
);
//
...
...
src/inc/ttype.h
浏览文件 @
405597e5
...
...
@@ -11,7 +11,7 @@ extern "C" {
// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
typedef
int32_t
VarDataOffsetT
;
typedef
int16_t
VarDataLenT
;
// maxVarDataLen: 32767
typedef
uint16_t
VarDataLenT
;
// maxVarDataLen: 65535
typedef
uint16_t
TDRowLenT
;
// not including overhead: 0 ~ 65535
typedef
uint32_t
TDRowTLenT
;
// total length, including overhead
...
...
src/mnode/inc/mnodeDef.h
浏览文件 @
405597e5
...
...
@@ -239,7 +239,7 @@ typedef struct SFuncObj {
int32_t
bufSize
;
int64_t
createdTime
;
uint8_t
resType
;
int16_t
resBytes
;
uint16_t
resBytes
;
int64_t
sig
;
// partial md5 sign
int16_t
type
;
// [lua script|so|js]
int8_t
reserved
[
64
];
...
...
src/query/inc/qScript.h
浏览文件 @
405597e5
...
...
@@ -42,23 +42,23 @@ enum ScriptState {
typedef
struct
{
SHashObj
*
funcId
;
//func already registed in lua_env, may be no use
lua_State
*
lua_state
;
// lua env
}
ScriptEnv
;
}
ScriptEnv
;
typedef
struct
ScriptCtx
{
// one-more-space-for-null-terminator to support function name
// at most USER_FUNC_NAME_LIMIT bytes long actually
char
funcName
[
USER_FUNC_NAME_LIMIT
+
1
];
int8_t
state
;
ScriptEnv
*
pEnv
;
int8_t
isAgg
;
// agg function or not
char
funcName
[
USER_FUNC_NAME_LIMIT
+
1
];
int8_t
state
;
ScriptEnv
*
pEnv
;
int8_t
isAgg
;
// agg function or not
// init value of udf script
int8_t
resType
;
int16_t
resBytes
;
int8_t
resType
;
uint16_t
resBytes
;
int32_t
numOfOutput
;
int32_t
offset
;
int32_t
numOfOutput
;
int32_t
offset
;
}
ScriptCtx
;
int
taosLoadScriptInit
(
void
*
pInit
);
...
...
@@ -75,7 +75,7 @@ typedef struct {
pthread_mutex_t
mutex
;
}
ScriptEnvPool
;
ScriptCtx
*
createScriptCtx
(
char
*
str
,
int8_t
resType
,
int16_t
resBytes
);
ScriptCtx
*
createScriptCtx
(
char
*
str
,
int8_t
resType
,
u
int16_t
resBytes
);
void
destroyScriptCtx
(
void
*
pScriptCtx
);
int32_t
scriptEnvPoolInit
();
...
...
src/query/inc/qUdf.h
浏览文件 @
405597e5
...
...
@@ -32,26 +32,25 @@ typedef struct SUdfInit{
void
(
*
destroyCtxFunc
)(
void
*
script_ctx
);
}
SUdfInit
;
typedef
struct
SUdfInfo
{
int32_t
functionId
;
// system assigned function id
int32_t
funcType
;
// scalar function or aggregate function
int8_t
resType
;
// result type
int16_t
resBytes
;
// result byte
int32_t
contLen
;
// content length
int32_t
bufSize
;
//
interbuf size
char
*
name
;
// function name
void
*
handle
;
// handle loaded in mem
void
*
funcs
[
TSDB_UDF_FUNC_MAX_NUM
];
// function ptr
int32_t
functionId
;
// system assigned function id
int32_t
funcType
;
// scalar function or aggregate function
int8_t
resType
;
// result type
uint16_t
resBytes
;
// result byte
int32_t
contLen
;
// content length
int32_t
bufSize
;
//
interbuf size
char
*
name
;
// function name
void
*
handle
;
// handle loaded in mem
void
*
funcs
[
TSDB_UDF_FUNC_MAX_NUM
];
// function ptr
// for script like lua/javascript only
int
isScript
;
void
*
pScriptCtx
;
int
isScript
;
void
*
pScriptCtx
;
SUdfInit
init
;
char
*
content
;
char
*
path
;
bool
keep
;
char
*
content
;
char
*
path
;
bool
keep
;
}
SUdfInfo
;
//script
...
...
src/query/src/qExecutor.c
浏览文件 @
405597e5
...
...
@@ -3446,7 +3446,7 @@ void filterColRowsInDataBlock(SQueryRuntimeEnv* pRuntimeEnv, SSDataBlock* pBlock
static
SColumnInfo
*
doGetTagColumnInfoById
(
SColumnInfo
*
pTagColList
,
int32_t
numOfTags
,
int16_t
colId
);
static
void
doSetTagValueInParam
(
void
*
pTable
,
char
*
param
,
int32_t
paraLen
,
int32_t
tagColId
,
tVariant
*
tag
,
int16_t
type
,
int16_t
bytes
);
int16_t
type
,
u
int16_t
bytes
);
static
uint32_t
doFilterByBlockTimeWindow
(
STableScanInfo
*
pTableScanInfo
,
SSDataBlock
*
pBlock
)
{
SQLFunctionCtx
*
pCtx
=
pTableScanInfo
->
pCtx
;
...
...
@@ -3732,7 +3732,7 @@ int32_t binarySearchForKey(char* pValue, int num, TSKEY key, int order) {
* e.g.,tag information into input buffer
*/
static
void
doSetTagValueInParam
(
void
*
pTable
,
char
*
param
,
int32_t
paramLen
,
int32_t
tagColId
,
tVariant
*
tag
,
int16_t
type
,
int16_t
bytes
)
{
int16_t
type
,
u
int16_t
bytes
)
{
tVariantDestroy
(
tag
);
char
*
val
=
NULL
;
...
...
@@ -8580,7 +8580,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
count
=
0
;
int16_t
bytes
=
pExprInfo
->
base
.
resBytes
;
u
int16_t
bytes
=
pExprInfo
->
base
.
resBytes
;
int16_t
type
=
pExprInfo
->
base
.
resType
;
for
(
int32_t
i
=
0
;
i
<
pQueryAttr
->
numOfTags
;
++
i
)
{
...
...
@@ -8654,7 +8654,8 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
STableQueryInfo
*
item
=
taosArrayGetP
(
pa
,
i
);
char
*
data
=
NULL
,
*
dst
=
NULL
;
int16_t
type
=
0
,
bytes
=
0
;
int16_t
type
=
0
;
uint16_t
bytes
=
0
;
for
(
int32_t
j
=
0
;
j
<
pOperator
->
numOfOutput
;
++
j
)
{
// not assign value in case of user defined constant output column
if
(
TSDB_COL_IS_UD_COL
(
pExprInfo
[
j
].
base
.
colInfo
.
flag
))
{
...
...
@@ -9359,7 +9360,7 @@ int32_t convertQueryMsg(SQueryTableMsg* pQueryMsg, SQueryParam* param) {
param
->
pUdfInfo
->
resType
=
*
(
int8_t
*
)
pMsg
;
pMsg
+=
sizeof
(
int8_t
);
param
->
pUdfInfo
->
resBytes
=
htons
(
*
(
int16_t
*
)
pMsg
);
param
->
pUdfInfo
->
resBytes
=
htons
(
*
(
u
int16_t
*
)
pMsg
);
pMsg
+=
sizeof
(
int16_t
);
tstr
*
name
=
(
tstr
*
)(
pMsg
);
...
...
src/query/src/qScript.c
浏览文件 @
405597e5
...
...
@@ -210,7 +210,7 @@ void taosLoadScriptDestroy(void *pInit) {
destroyScriptCtx
(
pInit
);
}
ScriptCtx
*
createScriptCtx
(
char
*
script
,
int8_t
resType
,
int16_t
resBytes
)
{
ScriptCtx
*
createScriptCtx
(
char
*
script
,
int8_t
resType
,
u
int16_t
resBytes
)
{
ScriptCtx
*
pCtx
=
(
ScriptCtx
*
)
calloc
(
1
,
sizeof
(
ScriptCtx
));
pCtx
->
state
=
SCRIPT_STATE_INIT
;
pCtx
->
pEnv
=
getScriptEnvFromPool
();
//
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
405597e5
...
...
@@ -1373,7 +1373,7 @@ static int tsdbEncodeTableName(void **buf, tstr *name) {
}
static
void
*
tsdbDecodeTableName
(
void
*
buf
,
tstr
**
name
)
{
VarDataLenT
len
=
0
;
int16_t
len
=
0
;
buf
=
taosDecodeFixedI16
(
buf
,
&
len
);
*
name
=
calloc
(
1
,
sizeof
(
tstr
)
+
len
+
1
);
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
405597e5
...
...
@@ -1866,11 +1866,11 @@ static int32_t doCopyRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t c
static
void
mergeTwoRowFromMem
(
STsdbQueryHandle
*
pQueryHandle
,
int32_t
capacity
,
int32_t
numOfRows
,
SMemRow
row1
,
SMemRow
row2
,
int32_t
numOfCols
,
STable
*
pTable
,
STSchema
*
pSchema1
,
STSchema
*
pSchema2
,
bool
forceSetNull
)
{
char
*
pData
=
NULL
;
char
*
pData
=
NULL
;
STSchema
*
pSchema
;
SMemRow
row
;
int16_t
colId
;
int16_t
offset
;
SMemRow
row
;
int16_t
colId
;
uint16_t
offset
;
bool
isRow1DataRow
=
isDataRow
(
row1
);
bool
isRow2DataRow
=
false
;
...
...
@@ -4593,7 +4593,7 @@ static int32_t tsdbQueryTableList(STable* pTable, SArray* pRes, void* filterInfo
return
TSDB_CODE_SUCCESS
;
}
void
*
getJsonTagValueElment
(
void
*
data
,
char
*
key
,
int32_t
keyLen
,
char
*
dst
,
int16_t
bytes
){
void
*
getJsonTagValueElment
(
void
*
data
,
char
*
key
,
int32_t
keyLen
,
char
*
dst
,
u
int16_t
bytes
){
char
keyMd5
[
TSDB_MAX_JSON_KEY_MD5_LEN
]
=
{
0
};
jsonKeyMd5
(
key
,
keyLen
,
keyMd5
);
...
...
@@ -4625,7 +4625,7 @@ void* getJsonTagValueElment(void* data, char* key, int32_t keyLen, char* dst, in
return
result
;
}
void
getJsonTagValueAll
(
void
*
data
,
void
*
dst
,
int16_t
bytes
)
{
void
getJsonTagValueAll
(
void
*
data
,
void
*
dst
,
u
int16_t
bytes
)
{
char
*
json
=
parseTagDatatoJson
(
data
);
char
*
tagData
=
POINTER_SHIFT
(
dst
,
CHAR_BYTES
);
*
(
char
*
)
dst
=
TSDB_DATA_TYPE_JSON
;
...
...
tests/script/api/resultBlock.c
浏览文件 @
405597e5
...
...
@@ -121,10 +121,10 @@ static int print_result(TAOS_RES* res, int32_t rows) {
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
{
int32_t
charLen
=
*
(
int16_t
*
)
col
[
i
];
int32_t
charLen
=
*
(
u
int16_t
*
)
col
[
i
];
int32_t
charBytes
=
(
fields
[
i
].
type
==
TSDB_DATA_TYPE_BINARY
)
?
sizeof
(
char
)
:
sizeof
(
wchar_t
);
int32_t
offset
=
k
*
(
sizeof
(
int16_t
)
+
fields
[
i
].
bytes
*
charBytes
);
memcpy
(
str
+
len
,
(
char
*
)
col
[
i
]
+
sizeof
(
int16_t
)
+
offset
,
charLen
);
int32_t
offset
=
k
*
(
sizeof
(
u
int16_t
)
+
fields
[
i
].
bytes
*
charBytes
);
memcpy
(
str
+
len
,
(
char
*
)
col
[
i
]
+
sizeof
(
u
int16_t
)
+
offset
,
charLen
);
len
+=
charLen
;
}
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录