Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yiicenne
TDengine
提交
79076505
TDengine
项目概览
yiicenne
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
79076505
编写于
1月 14, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-225]refactor codes.
上级
bd99bde9
变更
19
展开全部
隐藏空白更改
内联
并排
Showing
19 changed file
with
174 addition
and
1306 deletion
+174
-1306
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+2
-2
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+8
-8
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+11
-11
src/client/src/tscSchemaUtil.c
src/client/src/tscSchemaUtil.c
+1
-1
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+0
-14
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+1
-1
src/common/src/tname.c
src/common/src/tname.c
+1
-1
src/common/src/ttypes.c
src/common/src/ttypes.c
+14
-14
src/common/src/tvariant.c
src/common/src/tvariant.c
+4
-4
src/inc/taosdef.h
src/inc/taosdef.h
+26
-113
src/inc/ttype.h
src/inc/ttype.h
+86
-0
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+2
-2
src/query/src/qArithmeticOperator.c
src/query/src/qArithmeticOperator.c
+4
-1121
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+1
-1
src/query/src/qHistogram.c
src/query/src/qHistogram.c
+2
-2
src/query/src/qParserImpl.c
src/query/src/qParserImpl.c
+5
-5
src/query/tests/percentileTest.cpp
src/query/tests/percentileTest.cpp
+1
-1
src/tsdb/src/tsdbRWHelper.c
src/tsdb/src/tsdbRWHelper.c
+4
-4
src/util/src/tcompare.c
src/util/src/tcompare.c
+1
-1
未找到文件。
src/client/inc/tsclient.h
浏览文件 @
79076505
...
...
@@ -463,7 +463,7 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField
pRes
->
length
[
columnIndex
]
=
pInfo
->
pSqlExpr
->
param
[
1
].
nLen
;
pRes
->
tsrow
[
columnIndex
]
=
(
pInfo
->
pSqlExpr
->
param
[
1
].
nType
==
TSDB_DATA_TYPE_NULL
)
?
NULL
:
(
unsigned
char
*
)
pData
;
}
else
{
assert
(
bytes
==
tDataType
Desc
[
type
].
nSize
);
assert
(
bytes
==
tDataType
s
[
type
].
bytes
);
pRes
->
tsrow
[
columnIndex
]
=
isNull
(
pData
,
type
)
?
NULL
:
(
unsigned
char
*
)
&
pInfo
->
pSqlExpr
->
param
[
1
].
i64
;
pRes
->
length
[
columnIndex
]
=
bytes
;
...
...
@@ -480,7 +480,7 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField
pRes
->
length
[
columnIndex
]
=
realLen
;
}
else
{
assert
(
bytes
==
tDataType
Desc
[
type
].
nSize
);
assert
(
bytes
==
tDataType
s
[
type
].
bytes
);
pRes
->
tsrow
[
columnIndex
]
=
isNull
(
pData
,
type
)
?
NULL
:
(
unsigned
char
*
)
pData
;
pRes
->
length
[
columnIndex
]
=
bytes
;
...
...
src/client/src/tscLocal.c
浏览文件 @
79076505
...
...
@@ -79,7 +79,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
char
*
dst
=
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
0
)
*
totalNumOfRows
+
pField
->
bytes
*
i
;
STR_WITH_MAXSIZE_TO_VARSTR
(
dst
,
pSchema
[
i
].
name
,
pField
->
bytes
);
char
*
type
=
tDataType
Desc
[
pSchema
[
i
].
type
].
aN
ame
;
char
*
type
=
tDataType
s
[
pSchema
[
i
].
type
].
n
ame
;
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
1
);
dst
=
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
1
)
*
totalNumOfRows
+
pField
->
bytes
*
i
;
...
...
@@ -119,7 +119,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
// type name
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
1
);
char
*
type
=
tDataType
Desc
[
pSchema
[
i
].
type
].
aN
ame
;
char
*
type
=
tDataType
s
[
pSchema
[
i
].
type
].
n
ame
;
output
=
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
1
)
*
totalNumOfRows
+
pField
->
bytes
*
i
;
STR_WITH_MAXSIZE_TO_VARSTR
(
output
,
type
,
pField
->
bytes
);
...
...
@@ -619,9 +619,9 @@ static int32_t tscRebuildDDLForNormalTable(SSqlObj *pSql, const char *tableName,
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
bytes
=
bytes
/
TSDB_NCHAR_SIZE
;
}
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataType
Desc
[
pSchema
[
i
].
type
].
aN
ame
,
bytes
);
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataType
s
[
pSchema
[
i
].
type
].
n
ame
,
bytes
);
}
else
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataType
Desc
[
pSchema
[
i
].
type
].
aName
);
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataType
s
[
pSchema
[
i
].
type
].
name
);
}
}
sprintf
(
result
+
strlen
(
result
)
-
1
,
"%s"
,
")"
);
...
...
@@ -646,9 +646,9 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
bytes
=
bytes
/
TSDB_NCHAR_SIZE
;
}
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataType
Desc
[
pSchema
[
i
].
type
].
aN
ame
,
bytes
);
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataType
s
[
pSchema
[
i
].
type
].
n
ame
,
bytes
);
}
else
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataType
Desc
[
type
].
aName
);
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataType
s
[
type
].
name
);
}
}
snprintf
(
result
+
strlen
(
result
)
-
1
,
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s"
,
")"
,
"TAGS ("
);
...
...
@@ -660,9 +660,9 @@ static int32_t tscRebuildDDLForSuperTable(SSqlObj *pSql, const char *tableName,
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
bytes
=
bytes
/
TSDB_NCHAR_SIZE
;
}
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataType
Desc
[
pSchema
[
i
].
type
].
aN
ame
,
bytes
);
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s(%d),"
,
pSchema
[
i
].
name
,
tDataType
s
[
pSchema
[
i
].
type
].
n
ame
,
bytes
);
}
else
{
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataType
Desc
[
type
].
aName
);
snprintf
(
result
+
strlen
(
result
),
TSDB_MAX_BINARY_LEN
-
strlen
(
result
),
"%s %s,"
,
pSchema
[
i
].
name
,
tDataType
s
[
type
].
name
);
}
}
sprintf
(
result
+
strlen
(
result
)
-
1
,
"%s"
,
")"
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
79076505
...
...
@@ -1738,7 +1738,7 @@ static int32_t setExprInfoForFunctions(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SS
return
-
1
;
}
else
{
type
=
TSDB_DATA_TYPE_DOUBLE
;
bytes
=
tDataType
Desc
[
type
].
nSize
;
bytes
=
tDataType
s
[
type
].
bytes
;
}
}
else
{
type
=
pSchema
->
type
;
...
...
@@ -1844,7 +1844,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
index
=
(
SColumnIndex
){
0
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
int32_t
size
=
tDataType
Desc
[
TSDB_DATA_TYPE_BIGINT
].
nSize
;
int32_t
size
=
tDataType
s
[
TSDB_DATA_TYPE_BIGINT
].
bytes
;
pExpr
=
tscSqlExprAppend
(
pQueryInfo
,
functionID
,
&
index
,
TSDB_DATA_TYPE_BIGINT
,
size
,
getNewResColId
(
pQueryInfo
),
size
,
false
);
}
else
if
(
sqlOptr
==
TK_INTEGER
)
{
// select count(1) from table1
char
buf
[
8
]
=
{
0
};
...
...
@@ -1856,7 +1856,7 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
if
(
val
==
1
)
{
index
=
(
SColumnIndex
){
0
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
int32_t
size
=
tDataType
Desc
[
TSDB_DATA_TYPE_BIGINT
].
nSize
;
int32_t
size
=
tDataType
s
[
TSDB_DATA_TYPE_BIGINT
].
bytes
;
pExpr
=
tscSqlExprAppend
(
pQueryInfo
,
functionID
,
&
index
,
TSDB_DATA_TYPE_BIGINT
,
size
,
getNewResColId
(
pQueryInfo
),
size
,
false
);
}
else
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg3
);
...
...
@@ -1876,12 +1876,12 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
isTag
=
true
;
}
int32_t
size
=
tDataType
Desc
[
TSDB_DATA_TYPE_BIGINT
].
nSize
;
int32_t
size
=
tDataType
s
[
TSDB_DATA_TYPE_BIGINT
].
bytes
;
pExpr
=
tscSqlExprAppend
(
pQueryInfo
,
functionID
,
&
index
,
TSDB_DATA_TYPE_BIGINT
,
size
,
getNewResColId
(
pQueryInfo
),
size
,
isTag
);
}
}
else
{
// count(*) is equalled to count(primary_timestamp_key)
index
=
(
SColumnIndex
){
0
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
int32_t
size
=
tDataType
Desc
[
TSDB_DATA_TYPE_BIGINT
].
nSize
;
int32_t
size
=
tDataType
s
[
TSDB_DATA_TYPE_BIGINT
].
bytes
;
pExpr
=
tscSqlExprAppend
(
pQueryInfo
,
functionID
,
&
index
,
TSDB_DATA_TYPE_BIGINT
,
size
,
getNewResColId
(
pQueryInfo
),
size
,
false
);
}
...
...
@@ -4869,7 +4869,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char
name1
[
128
]
=
{
0
};
strncpy
(
name1
,
pItem
->
pVar
.
pz
,
pItem
->
pVar
.
nLen
);
TAOS_FIELD
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name1
,
tDataType
Desc
[
TSDB_DATA_TYPE_INT
].
nSize
);
TAOS_FIELD
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name1
,
tDataType
s
[
TSDB_DATA_TYPE_INT
].
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_CHANGE_TAG_COLUMN
)
{
SArray
*
pVarList
=
pAlterSQL
->
varList
;
...
...
@@ -4905,14 +4905,14 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char
name
[
TSDB_COL_NAME_LEN
]
=
{
0
};
strncpy
(
name
,
pItem
->
pVar
.
pz
,
pItem
->
pVar
.
nLen
);
TAOS_FIELD
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name
,
tDataType
Desc
[
TSDB_DATA_TYPE_INT
].
nSize
);
TAOS_FIELD
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name
,
tDataType
s
[
TSDB_DATA_TYPE_INT
].
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
pItem
=
taosArrayGet
(
pVarList
,
1
);
memset
(
name
,
0
,
tListLen
(
name
));
strncpy
(
name
,
pItem
->
pVar
.
pz
,
pItem
->
pVar
.
nLen
);
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name
,
tDataType
Desc
[
TSDB_DATA_TYPE_INT
].
nSize
);
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name
,
tDataType
s
[
TSDB_DATA_TYPE_INT
].
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
}
else
if
(
pAlterSQL
->
type
==
TSDB_ALTER_TABLE_UPDATE_TAG_VAL
)
{
// Note: update can only be applied to table not super table.
...
...
@@ -4987,7 +4987,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
int32_t
len
=
0
;
if
(
pTagsSchema
->
type
!=
TSDB_DATA_TYPE_BINARY
&&
pTagsSchema
->
type
!=
TSDB_DATA_TYPE_NCHAR
)
{
len
=
tDataType
Desc
[
pTagsSchema
->
type
].
nSize
;
len
=
tDataType
s
[
pTagsSchema
->
type
].
bytes
;
}
else
{
len
=
varDataTLen
(
pUpdateMsg
->
data
+
schemaLen
);
}
...
...
@@ -5034,7 +5034,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char
name1
[
TSDB_COL_NAME_LEN
]
=
{
0
};
tstrncpy
(
name1
,
pItem
->
pVar
.
pz
,
sizeof
(
name1
));
TAOS_FIELD
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name1
,
tDataType
Desc
[
TSDB_DATA_TYPE_INT
].
nSize
);
TAOS_FIELD
f
=
tscCreateField
(
TSDB_DATA_TYPE_INT
,
name1
,
tDataType
s
[
TSDB_DATA_TYPE_INT
].
bytes
);
tscFieldInfoAppend
(
&
pQueryInfo
->
fieldsInfo
,
&
f
);
}
...
...
@@ -5997,7 +5997,7 @@ int32_t doLocalQueryProcess(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SQuerySQL* pQ
SColumnIndex
ind
=
{
0
};
SSqlExpr
*
pExpr1
=
tscSqlExprAppend
(
pQueryInfo
,
TSDB_FUNC_TAG_DUMMY
,
&
ind
,
TSDB_DATA_TYPE_INT
,
tDataType
Desc
[
TSDB_DATA_TYPE_INT
].
nSize
,
getNewResColId
(
pQueryInfo
),
tDataTypeDesc
[
TSDB_DATA_TYPE_INT
].
nSize
,
false
);
tDataType
s
[
TSDB_DATA_TYPE_INT
].
bytes
,
getNewResColId
(
pQueryInfo
),
tDataTypes
[
TSDB_DATA_TYPE_INT
].
bytes
,
false
);
const
char
*
name
=
(
pExprList
->
a
[
0
].
aliasName
!=
NULL
)
?
pExprList
->
a
[
0
].
aliasName
:
functionsInfo
[
index
].
name
;
tstrncpy
(
pExpr1
->
aliasName
,
name
,
tListLen
(
pExpr1
->
aliasName
));
...
...
src/client/src/tscSchemaUtil.c
浏览文件 @
79076505
...
...
@@ -85,7 +85,7 @@ static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen
return
false
;
}
}
else
{
if
(
pSchema
[
i
].
bytes
!=
tDataType
Desc
[
pSchema
[
i
].
type
].
nSize
)
{
if
(
pSchema
[
i
].
bytes
!=
tDataType
s
[
pSchema
[
i
].
type
].
bytes
)
{
return
false
;
}
}
...
...
src/client/src/tscSubquery.c
浏览文件 @
79076505
...
...
@@ -1372,13 +1372,6 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
// retrieve actual query results from vnode during the second stage join subquery
if
(
pParentSql
->
res
.
code
!=
TSDB_CODE_SUCCESS
)
{
tscError
(
"%p abort query due to other subquery failure. code:%d, global code:%d"
,
pSql
,
code
,
pParentSql
->
res
.
code
);
if
(
!
(
pTableMetaInfo
->
vgroupIndex
>
0
&&
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)))
{
if
(
atomic_sub_fetch_32
(
&
pParentSql
->
subState
.
numOfRemain
,
1
)
>
0
)
{
return
;
}
}
quitAllSubquery
(
pParentSql
,
pSupporter
);
tscAsyncResultOnError
(
pParentSql
);
...
...
@@ -1391,13 +1384,6 @@ void tscJoinQueryCallback(void* param, TAOS_RES* tres, int code) {
tscError
(
"%p abort query, code:%s, global code:%s"
,
pSql
,
tstrerror
(
code
),
tstrerror
(
pParentSql
->
res
.
code
));
pParentSql
->
res
.
code
=
code
;
if
(
!
(
pTableMetaInfo
->
vgroupIndex
>
0
&&
tscNonOrderedProjectionQueryOnSTable
(
pQueryInfo
,
0
)))
{
if
(
atomic_sub_fetch_32
(
&
pParentSql
->
subState
.
numOfRemain
,
1
)
>
0
)
{
return
;
}
}
quitAllSubquery
(
pParentSql
,
pSupporter
);
tscAsyncResultOnError
(
pParentSql
);
...
...
src/common/inc/tdataformat.h
浏览文件 @
79076505
...
...
@@ -20,7 +20,7 @@
#include <string.h>
#include "talgo.h"
#include "t
aosdef
.h"
#include "t
type
.h"
#include "tutil.h"
#ifdef __cplusplus
...
...
src/common/src/tname.c
浏览文件 @
79076505
...
...
@@ -62,7 +62,7 @@ SSchema tGetUserSpecifiedColumnSchema(tVariant* pVal, SStrToken* exprStr, const
if
(
s
.
type
==
TSDB_DATA_TYPE_BINARY
||
s
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
s
.
bytes
=
(
int16_t
)(
pVal
->
nLen
+
VARSTR_HEADER_SIZE
);
}
else
{
s
.
bytes
=
tDataType
Desc
[
pVal
->
nType
].
nSize
;
s
.
bytes
=
tDataType
s
[
pVal
->
nType
].
bytes
;
}
s
.
colId
=
TSDB_UD_COLUMN_INDEX
;
...
...
src/common/src/ttypes.c
浏览文件 @
79076505
...
...
@@ -14,7 +14,7 @@
*/
#include "os.h"
#include "t
aosdef
.h"
#include "t
type
.h"
#include "ttokendef.h"
#include "tscompression.h"
...
...
@@ -367,7 +367,7 @@ static void getStatics_nchr(const void *pData, int32_t numOfRow, int64_t *min, i
*
maxIndex
=
0
;
}
tDataTypeDescriptor
tDataType
Desc
[
15
]
=
{
tDataTypeDescriptor
tDataType
s
[
15
]
=
{
{
TSDB_DATA_TYPE_NULL
,
6
,
1
,
"NOTYPE"
,
NULL
,
NULL
,
NULL
},
{
TSDB_DATA_TYPE_BOOL
,
4
,
CHAR_BYTES
,
"BOOL"
,
tsCompressBool
,
tsDecompressBool
,
getStatics_bool
},
{
TSDB_DATA_TYPE_TINYINT
,
7
,
CHAR_BYTES
,
"TINYINT"
,
tsCompressTinyint
,
tsDecompressTinyint
,
getStatics_i8
},
...
...
@@ -423,58 +423,58 @@ void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems) {
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint8_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_BOOL_NULL
;
*
(
uint8_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_BOOL_NULL
;
}
break
;
case
TSDB_DATA_TYPE_TINYINT
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint8_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_TINYINT_NULL
;
*
(
uint8_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_TINYINT_NULL
;
}
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint16_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_SMALLINT_NULL
;
*
(
uint16_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_SMALLINT_NULL
;
}
break
;
case
TSDB_DATA_TYPE_INT
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint32_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_INT_NULL
;
*
(
uint32_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_INT_NULL
;
}
break
;
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint64_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_BIGINT_NULL
;
*
(
uint64_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_BIGINT_NULL
;
}
break
;
case
TSDB_DATA_TYPE_UTINYINT
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint8_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_UTINYINT_NULL
;
*
(
uint8_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_UTINYINT_NULL
;
}
break
;
case
TSDB_DATA_TYPE_USMALLINT
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint16_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_USMALLINT_NULL
;
*
(
uint16_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_USMALLINT_NULL
;
}
break
;
case
TSDB_DATA_TYPE_UINT
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint32_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_UINT_NULL
;
*
(
uint32_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_UINT_NULL
;
}
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint64_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_UBIGINT_NULL
;
*
(
uint64_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_UBIGINT_NULL
;
}
break
;
case
TSDB_DATA_TYPE_FLOAT
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint32_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_FLOAT_NULL
;
*
(
uint32_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_FLOAT_NULL
;
}
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint64_t
*
)(
val
+
i
*
tDataType
Desc
[
type
].
nSize
)
=
TSDB_DATA_DOUBLE_NULL
;
*
(
uint64_t
*
)(
val
+
i
*
tDataType
s
[
type
].
bytes
)
=
TSDB_DATA_DOUBLE_NULL
;
}
break
;
case
TSDB_DATA_TYPE_NCHAR
:
...
...
@@ -485,7 +485,7 @@ void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems) {
break
;
default:
{
for
(
int32_t
i
=
0
;
i
<
numOfElems
;
++
i
)
{
*
(
uint32_t
*
)(
val
+
i
*
tDataType
Desc
[
TSDB_DATA_TYPE_INT
].
nSize
)
=
TSDB_DATA_INT_NULL
;
*
(
uint32_t
*
)(
val
+
i
*
tDataType
s
[
TSDB_DATA_TYPE_INT
].
bytes
)
=
TSDB_DATA_INT_NULL
;
}
break
;
}
...
...
src/common/src/tvariant.c
浏览文件 @
79076505
...
...
@@ -205,7 +205,7 @@ void tVariantAssign(tVariant *pDst, const tVariant *pSrc) {
}
if
(
pDst
->
nType
!=
TSDB_DATA_TYPE_ARRAY
)
{
pDst
->
nLen
=
tDataType
Desc
[
pDst
->
nType
].
nSize
;
pDst
->
nLen
=
tDataType
s
[
pDst
->
nType
].
bytes
;
}
}
...
...
@@ -424,7 +424,7 @@ static FORCE_INLINE int32_t convertToDouble(char *pStr, int32_t len, double *val
static
FORCE_INLINE
int32_t
convertToInteger
(
tVariant
*
pVariant
,
int64_t
*
result
,
int32_t
type
,
bool
issigned
,
bool
releaseVariantPtr
)
{
if
(
pVariant
->
nType
==
TSDB_DATA_TYPE_NULL
)
{
setNull
((
char
*
)
result
,
type
,
tDataType
Desc
[
type
].
nSize
);
setNull
((
char
*
)
result
,
type
,
tDataType
s
[
type
].
bytes
);
return
0
;
}
...
...
@@ -445,7 +445,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
pVariant
->
nLen
=
0
;
}
setNull
((
char
*
)
result
,
type
,
tDataType
Desc
[
type
].
nSize
);
setNull
((
char
*
)
result
,
type
,
tDataType
s
[
type
].
bytes
);
return
0
;
}
...
...
@@ -495,7 +495,7 @@ static FORCE_INLINE int32_t convertToInteger(tVariant *pVariant, int64_t *result
free
(
pVariant
->
pz
);
pVariant
->
nLen
=
0
;
}
setNull
((
char
*
)
result
,
type
,
tDataType
Desc
[
type
].
nSize
);
setNull
((
char
*
)
result
,
type
,
tDataType
s
[
type
].
bytes
);
return
0
;
}
else
{
int64_t
val
=
wcstoll
(
pVariant
->
wpz
,
&
endPtr
,
10
);
...
...
src/inc/taosdef.h
浏览文件 @
79076505
...
...
@@ -36,29 +36,6 @@ extern "C" {
#define TSWINDOW_INITIALIZER ((STimeWindow) {INT64_MIN, INT64_MAX})
#define TSKEY_INITIAL_VAL INT64_MIN
// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
typedef
int32_t
VarDataOffsetT
;
typedef
int16_t
VarDataLenT
;
typedef
struct
tstr
{
VarDataLenT
len
;
char
data
[];
}
tstr
;
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
#define varDataLen(v) ((VarDataLenT *)(v))[0]
#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v))
#define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE))
#define varDataCopy(dst, v) memcpy((dst), (void*) (v), varDataTLen(v))
#define varDataLenByData(v) (*(VarDataLenT *)(((char*)(v)) - VARSTR_HEADER_SIZE))
#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT) (_len))
#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_BINARY) || ((t) == TSDB_DATA_TYPE_NCHAR))
// this data type is internally used only in 'in' query to hold the values
#define TSDB_DATA_TYPE_ARRAY (TSDB_DATA_TYPE_NCHAR + 1)
// Bytes for each type.
extern
const
int32_t
TYPE_BYTES
[
15
];
...
...
@@ -164,70 +141,6 @@ do { \
#define SET_DOUBLE_PTR(x, y) { (*(double *)(x)) = (*(double *)(y)); }
#endif
typedef
struct
tDataTypeDescriptor
{
int16_t
nType
;
int16_t
nameLen
;
int32_t
nSize
;
char
*
aName
;
int
(
*
compFunc
)(
const
char
*
const
input
,
int
inputSize
,
const
int
nelements
,
char
*
const
output
,
int
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int
bufferSize
);
int
(
*
decompFunc
)(
const
char
*
const
input
,
int
compressedSize
,
const
int
nelements
,
char
*
const
output
,
int
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int
bufferSize
);
void
(
*
getStatisFunc
)(
const
void
*
pData
,
int32_t
numofrow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
int16_t
*
minindex
,
int16_t
*
maxindex
,
int16_t
*
numofnull
);
}
tDataTypeDescriptor
;
extern
tDataTypeDescriptor
tDataTypeDesc
[
15
];
bool
isValidDataType
(
int32_t
type
);
static
FORCE_INLINE
bool
isNull
(
const
char
*
val
,
int32_t
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
return
*
(
uint8_t
*
)
val
==
TSDB_DATA_BOOL_NULL
;
case
TSDB_DATA_TYPE_TINYINT
:
return
*
(
uint8_t
*
)
val
==
TSDB_DATA_TINYINT_NULL
;
case
TSDB_DATA_TYPE_SMALLINT
:
return
*
(
uint16_t
*
)
val
==
TSDB_DATA_SMALLINT_NULL
;
case
TSDB_DATA_TYPE_INT
:
return
*
(
uint32_t
*
)
val
==
TSDB_DATA_INT_NULL
;
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
return
*
(
uint64_t
*
)
val
==
TSDB_DATA_BIGINT_NULL
;
case
TSDB_DATA_TYPE_FLOAT
:
return
*
(
uint32_t
*
)
val
==
TSDB_DATA_FLOAT_NULL
;
case
TSDB_DATA_TYPE_DOUBLE
:
return
*
(
uint64_t
*
)
val
==
TSDB_DATA_DOUBLE_NULL
;
case
TSDB_DATA_TYPE_NCHAR
:
return
varDataLen
(
val
)
==
sizeof
(
int32_t
)
&&
*
(
uint32_t
*
)
varDataVal
(
val
)
==
TSDB_DATA_NCHAR_NULL
;
case
TSDB_DATA_TYPE_BINARY
:
return
varDataLen
(
val
)
==
sizeof
(
int8_t
)
&&
*
(
uint8_t
*
)
varDataVal
(
val
)
==
TSDB_DATA_BINARY_NULL
;
case
TSDB_DATA_TYPE_UTINYINT
:
return
*
(
uint8_t
*
)
val
==
TSDB_DATA_UTINYINT_NULL
;
case
TSDB_DATA_TYPE_USMALLINT
:
return
*
(
uint16_t
*
)
val
==
TSDB_DATA_USMALLINT_NULL
;
case
TSDB_DATA_TYPE_UINT
:
return
*
(
uint32_t
*
)
val
==
TSDB_DATA_UINT_NULL
;
case
TSDB_DATA_TYPE_UBIGINT
:
return
*
(
uint64_t
*
)
val
==
TSDB_DATA_UBIGINT_NULL
;
default:
return
false
;
};
}
void
setVardataNull
(
char
*
val
,
int32_t
type
);
void
setNull
(
char
*
val
,
int32_t
type
,
int32_t
bytes
);
void
setNullN
(
char
*
val
,
int32_t
type
,
int32_t
bytes
,
int32_t
numOfElems
);
void
*
getNullValue
(
int32_t
type
);
void
assignVal
(
char
*
val
,
const
char
*
src
,
int32_t
len
,
int32_t
type
);
void
tsDataSwap
(
void
*
pLeft
,
void
*
pRight
,
int32_t
type
,
int32_t
size
,
void
*
buf
);
int32_t
tStrToInteger
(
const
char
*
z
,
int16_t
type
,
int32_t
n
,
int64_t
*
value
,
bool
issigned
);
#define SET_DOUBLE_NULL(v) (*(uint64_t *)(v) = TSDB_DATA_DOUBLE_NULL)
// TODO: check if below is necessary
#define TSDB_RELATION_INVALID 0
#define TSDB_RELATION_LESS 1
...
...
@@ -270,7 +183,7 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_MAX_SAVED_SQL_LEN TSDB_MAX_COLUMNS * 64
#define TSDB_MAX_SQL_LEN TSDB_PAYLOAD_SIZE
#define TSDB_MAX_SQL_SHOW_LEN 512
#define TSDB_MAX_ALLOWED_SQL_LEN (1*1024*1024
U
) // sql length should be less than 1mb
#define TSDB_MAX_ALLOWED_SQL_LEN (1*1024*1024
u
) // sql length should be less than 1mb
#define TSDB_APPNAME_LEN TSDB_UNI_LEN
...
...
@@ -399,8 +312,8 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_MAX_RPC_THREADS 5
#define TSDB_QUERY_TYPE_NON_TYPE
0x00u // none type
#define TSDB_QUERY_TYPE_FREE_RESOURCE
0x01u // free qhandle at vnode
#define TSDB_QUERY_TYPE_NON_TYPE 0x00u // none type
#define TSDB_QUERY_TYPE_FREE_RESOURCE 0x01u // free qhandle at vnode
/*
* 1. ordinary sub query for select * from super_table
...
...
@@ -420,29 +333,29 @@ int32_t tStrToInteger(const char* z, int16_t type, int32_t n, int64_t* value, bo
#define TSDB_QUERY_TYPE_MULTITABLE_QUERY 0x200u
#define TSDB_QUERY_TYPE_STMT_INSERT 0x800u // stmt insert type
#define TSDB_QUERY_HAS_TYPE(x, _type) (((x) & (_type)) != 0)
#define TSDB_QUERY_SET_TYPE(x, _type) ((x) |= (_type))
#define TSDB_QUERY_CLEAR_TYPE(x, _type) ((x) &= (~_type))
#define TSDB_QUERY_RESET_TYPE(x) ((x) = TSDB_QUERY_TYPE_NON_TYPE)
#define TSDB_ORDER_ASC 1
#define TSDB_ORDER_DESC 2
#define TSDB_DEFAULT_CLUSTER_HASH_SIZE 1
#define TSDB_DEFAULT_MNODES_HASH_SIZE 5
#define TSDB_DEFAULT_DNODES_HASH_SIZE 10
#define TSDB_DEFAULT_ACCOUNTS_HASH_SIZE 10
#define TSDB_DEFAULT_USERS_HASH_SIZE 20
#define TSDB_DEFAULT_DBS_HASH_SIZE 100
#define TSDB_DEFAULT_VGROUPS_HASH_SIZE 100
#define TSDB_DEFAULT_STABLES_HASH_SIZE 100
#define TSDB_DEFAULT_CTABLES_HASH_SIZE 20000
#define TSDB_PORT_DNODESHELL 0
#define TSDB_PORT_DNODEDNODE 5
#define TSDB_PORT_SYNC 10
#define TSDB_PORT_HTTP 11
#define TSDB_PORT_ARBITRATOR 12
#define TSDB_QUERY_HAS_TYPE(x, _type)
(((x) & (_type)) != 0)
#define TSDB_QUERY_SET_TYPE(x, _type)
((x) |= (_type))
#define TSDB_QUERY_CLEAR_TYPE(x, _type)
((x) &= (~_type))
#define TSDB_QUERY_RESET_TYPE(x)
((x) = TSDB_QUERY_TYPE_NON_TYPE)
#define TSDB_ORDER_ASC
1
#define TSDB_ORDER_DESC
2
#define TSDB_DEFAULT_CLUSTER_HASH_SIZE
1
#define TSDB_DEFAULT_MNODES_HASH_SIZE
5
#define TSDB_DEFAULT_DNODES_HASH_SIZE
10
#define TSDB_DEFAULT_ACCOUNTS_HASH_SIZE
10
#define TSDB_DEFAULT_USERS_HASH_SIZE
20
#define TSDB_DEFAULT_DBS_HASH_SIZE
100
#define TSDB_DEFAULT_VGROUPS_HASH_SIZE
100
#define TSDB_DEFAULT_STABLES_HASH_SIZE
100
#define TSDB_DEFAULT_CTABLES_HASH_SIZE
20000
#define TSDB_PORT_DNODESHELL
0
#define TSDB_PORT_DNODEDNODE
5
#define TSDB_PORT_SYNC
10
#define TSDB_PORT_HTTP
11
#define TSDB_PORT_ARBITRATOR
12
#define TSDB_MAX_WAL_SIZE (1024*1024*2)
...
...
src/inc/ttype.h
浏览文件 @
79076505
...
...
@@ -7,6 +7,28 @@ extern "C" {
#include "taosdef.h"
// ----------------- For variable data types such as TSDB_DATA_TYPE_BINARY and TSDB_DATA_TYPE_NCHAR
typedef
int32_t
VarDataOffsetT
;
typedef
int16_t
VarDataLenT
;
typedef
struct
tstr
{
VarDataLenT
len
;
char
data
[];
}
tstr
;
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
#define varDataLen(v) ((VarDataLenT *)(v))[0]
#define varDataTLen(v) (sizeof(VarDataLenT) + varDataLen(v))
#define varDataVal(v) ((void *)((char *)v + VARSTR_HEADER_SIZE))
#define varDataCopy(dst, v) memcpy((dst), (void*) (v), varDataTLen(v))
#define varDataLenByData(v) (*(VarDataLenT *)(((char*)(v)) - VARSTR_HEADER_SIZE))
#define varDataSetLen(v, _len) (((VarDataLenT *)(v))[0] = (VarDataLenT) (_len))
#define IS_VAR_DATA_TYPE(t) (((t) == TSDB_DATA_TYPE_BINARY) || ((t) == TSDB_DATA_TYPE_NCHAR))
// this data type is internally used only in 'in' query to hold the values
#define TSDB_DATA_TYPE_ARRAY (TSDB_DATA_TYPE_NCHAR + 1)
#define GET_TYPED_DATA(_v, _finalType, _type, _data) \
do { \
switch (_type) { \
...
...
@@ -59,6 +81,70 @@ extern "C" {
#define IS_VALID_UINT(_t) ((_t) >= 0 && (_t) < UINT32_MAX)
#define IS_VALID_UBIGINT(_t) ((_t) >= 0 && (_t) < UINT64_MAX)
static
FORCE_INLINE
bool
isNull
(
const
char
*
val
,
int32_t
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
return
*
(
uint8_t
*
)
val
==
TSDB_DATA_BOOL_NULL
;
case
TSDB_DATA_TYPE_TINYINT
:
return
*
(
uint8_t
*
)
val
==
TSDB_DATA_TINYINT_NULL
;
case
TSDB_DATA_TYPE_SMALLINT
:
return
*
(
uint16_t
*
)
val
==
TSDB_DATA_SMALLINT_NULL
;
case
TSDB_DATA_TYPE_INT
:
return
*
(
uint32_t
*
)
val
==
TSDB_DATA_INT_NULL
;
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
return
*
(
uint64_t
*
)
val
==
TSDB_DATA_BIGINT_NULL
;
case
TSDB_DATA_TYPE_FLOAT
:
return
*
(
uint32_t
*
)
val
==
TSDB_DATA_FLOAT_NULL
;
case
TSDB_DATA_TYPE_DOUBLE
:
return
*
(
uint64_t
*
)
val
==
TSDB_DATA_DOUBLE_NULL
;
case
TSDB_DATA_TYPE_NCHAR
:
return
varDataLen
(
val
)
==
sizeof
(
int32_t
)
&&
*
(
uint32_t
*
)
varDataVal
(
val
)
==
TSDB_DATA_NCHAR_NULL
;
case
TSDB_DATA_TYPE_BINARY
:
return
varDataLen
(
val
)
==
sizeof
(
int8_t
)
&&
*
(
uint8_t
*
)
varDataVal
(
val
)
==
TSDB_DATA_BINARY_NULL
;
case
TSDB_DATA_TYPE_UTINYINT
:
return
*
(
uint8_t
*
)
val
==
TSDB_DATA_UTINYINT_NULL
;
case
TSDB_DATA_TYPE_USMALLINT
:
return
*
(
uint16_t
*
)
val
==
TSDB_DATA_USMALLINT_NULL
;
case
TSDB_DATA_TYPE_UINT
:
return
*
(
uint32_t
*
)
val
==
TSDB_DATA_UINT_NULL
;
case
TSDB_DATA_TYPE_UBIGINT
:
return
*
(
uint64_t
*
)
val
==
TSDB_DATA_UBIGINT_NULL
;
default:
return
false
;
};
}
typedef
struct
tDataTypeDescriptor
{
int16_t
type
;
int16_t
nameLen
;
int32_t
bytes
;
char
*
name
;
int
(
*
compFunc
)(
const
char
*
const
input
,
int
inputSize
,
const
int
nelements
,
char
*
const
output
,
int
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int
bufferSize
);
int
(
*
decompFunc
)(
const
char
*
const
input
,
int
compressedSize
,
const
int
nelements
,
char
*
const
output
,
int
outputSize
,
char
algorithm
,
char
*
const
buffer
,
int
bufferSize
);
void
(
*
statisFunc
)(
const
void
*
pData
,
int32_t
numofrow
,
int64_t
*
min
,
int64_t
*
max
,
int64_t
*
sum
,
int16_t
*
minindex
,
int16_t
*
maxindex
,
int16_t
*
numofnull
);
}
tDataTypeDescriptor
;
extern
tDataTypeDescriptor
tDataTypes
[
15
];
bool
isValidDataType
(
int32_t
type
);
void
setVardataNull
(
char
*
val
,
int32_t
type
);
void
setNull
(
char
*
val
,
int32_t
type
,
int32_t
bytes
);
void
setNullN
(
char
*
val
,
int32_t
type
,
int32_t
bytes
,
int32_t
numOfElems
);
void
*
getNullValue
(
int32_t
type
);
void
assignVal
(
char
*
val
,
const
char
*
src
,
int32_t
len
,
int32_t
type
);
void
tsDataSwap
(
void
*
pLeft
,
void
*
pRight
,
int32_t
type
,
int32_t
size
,
void
*
buf
);
int32_t
tStrToInteger
(
const
char
*
z
,
int16_t
type
,
int32_t
n
,
int64_t
*
value
,
bool
issigned
);
#define SET_DOUBLE_NULL(v) (*(uint64_t *)(v) = TSDB_DATA_DOUBLE_NULL)
#ifdef __cplusplus
}
#endif
...
...
src/query/src/qAggMain.c
浏览文件 @
79076505
...
...
@@ -1901,7 +1901,7 @@ static void valuePairAssign(tValuePair *dst, int16_t type, const char *val, int6
static
void
do_top_function_add
(
STopBotInfo
*
pInfo
,
int32_t
maxLen
,
void
*
pData
,
int64_t
ts
,
uint16_t
type
,
SExtTagsInfo
*
pTagInfo
,
char
*
pTags
,
int16_t
stage
)
{
tVariant
val
=
{
0
};
tVariantCreateFromBinary
(
&
val
,
pData
,
tDataType
Desc
[
type
].
nSize
,
type
);
tVariantCreateFromBinary
(
&
val
,
pData
,
tDataType
s
[
type
].
bytes
,
type
);
tValuePair
**
pList
=
pInfo
->
res
;
assert
(
pList
!=
NULL
);
...
...
@@ -1958,7 +1958,7 @@ static void do_top_function_add(STopBotInfo *pInfo, int32_t maxLen, void *pData,
static
void
do_bottom_function_add
(
STopBotInfo
*
pInfo
,
int32_t
maxLen
,
void
*
pData
,
int64_t
ts
,
uint16_t
type
,
SExtTagsInfo
*
pTagInfo
,
char
*
pTags
,
int16_t
stage
)
{
tVariant
val
=
{
0
};
tVariantCreateFromBinary
(
&
val
,
pData
,
tDataType
Desc
[
type
].
nSize
,
type
);
tVariantCreateFromBinary
(
&
val
,
pData
,
tDataType
s
[
type
].
bytes
,
type
);
tValuePair
**
pList
=
pInfo
->
res
;
assert
(
pList
!=
NULL
);
...
...
src/query/src/qArithmeticOperator.c
浏览文件 @
79076505
此差异已折叠。
点击以展开。
src/query/src/qExecutor.c
浏览文件 @
79076505
...
...
@@ -6314,7 +6314,7 @@ static int32_t createQueryFuncExprFromMsg(SQueryTableMsg *pQueryMsg, int32_t num
}
type
=
TSDB_DATA_TYPE_DOUBLE
;
bytes
=
tDataType
Desc
[
type
].
nSize
;
bytes
=
tDataType
s
[
type
].
bytes
;
}
else
if
(
pExprs
[
i
].
base
.
colInfo
.
colId
==
TSDB_TBNAME_COLUMN_INDEX
&&
pExprs
[
i
].
base
.
functionId
==
TSDB_FUNC_TAGPRJ
)
{
// parse the normal column
SSchema
s
=
tGetTableNameColumnSchema
();
type
=
s
.
type
;
...
...
src/query/src/qHistogram.c
浏览文件 @
79076505
...
...
@@ -184,7 +184,7 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
histogramCreateBin
(
*
pHisto
,
idx
,
val
);
}
#else
tSkipListKey
key
=
tSkipListCreateKey
(
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
tDataType
Desc
[
TSDB_DATA_TYPE_DOUBLE
].
nSize
);
tSkipListKey
key
=
tSkipListCreateKey
(
TSDB_DATA_TYPE_DOUBLE
,
&
val
,
tDataType
s
[
TSDB_DATA_TYPE_DOUBLE
].
nSize
);
SHistBin
*
entry
=
calloc
(
1
,
sizeof
(
SHistBin
));
entry
->
val
=
val
;
...
...
@@ -217,7 +217,7 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
}
tSkipListKey
kx
=
tSkipListCreateKey
(
TSDB_DATA_TYPE_DOUBLE
,
&
(
*
pHisto
)
->
max
,
tDataType
Desc
[
TSDB_DATA_TYPE_DOUBLE
].
nSize
);
tSkipListCreateKey
(
TSDB_DATA_TYPE_DOUBLE
,
&
(
*
pHisto
)
->
max
,
tDataType
s
[
TSDB_DATA_TYPE_DOUBLE
].
nSize
);
pLast
=
tSkipListGetOne
((
*
pHisto
)
->
pList
,
&
kx
);
}
}
else
{
...
...
src/query/src/qParserImpl.c
浏览文件 @
79076505
...
...
@@ -398,21 +398,21 @@ void tSqlSetColumnType(TAOS_FIELD *pField, SStrToken *type) {
pField
->
name
[
0
]
=
0
;
int32_t
i
=
0
;
while
(
i
<
tListLen
(
tDataType
Desc
))
{
if
((
type
->
n
==
tDataType
Desc
[
i
].
nameLen
)
&&
(
strncasecmp
(
type
->
z
,
tDataType
Desc
[
i
].
aName
,
tDataTypeDesc
[
i
].
nameLen
)
==
0
))
{
while
(
i
<
tListLen
(
tDataType
s
))
{
if
((
type
->
n
==
tDataType
s
[
i
].
nameLen
)
&&
(
strncasecmp
(
type
->
z
,
tDataType
s
[
i
].
name
,
tDataTypes
[
i
].
nameLen
)
==
0
))
{
break
;
}
i
+=
1
;
}
if
(
i
==
tListLen
(
tDataType
Desc
))
{
if
(
i
==
tListLen
(
tDataType
s
))
{
return
;
}
pField
->
type
=
i
;
pField
->
bytes
=
tDataType
Desc
[
i
].
nSize
;
pField
->
bytes
=
tDataType
s
[
i
].
bytes
;
if
(
i
==
TSDB_DATA_TYPE_NCHAR
)
{
/*
...
...
src/query/tests/percentileTest.cpp
浏览文件 @
79076505
...
...
@@ -43,7 +43,7 @@ tMemBucket *createDoubleDataBucket(int32_t start, int32_t end) {
}
tMemBucket
*
createUnsignedDataBucket
(
int32_t
start
,
int32_t
end
,
int32_t
type
)
{
tMemBucket
*
pBucket
=
tMemBucketCreate
(
tDataType
Desc
[
type
].
nSize
,
type
,
start
,
end
);
tMemBucket
*
pBucket
=
tMemBucketCreate
(
tDataType
s
[
type
].
nSize
,
type
,
start
,
end
);
for
(
int32_t
i
=
start
;
i
<=
end
;
++
i
)
{
uint64_t
k
=
i
;
int32_t
ret
=
tMemBucketPut
(
pBucket
,
&
k
,
1
);
...
...
src/tsdb/src/tsdbRWHelper.c
浏览文件 @
79076505
...
...
@@ -751,8 +751,8 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
pCompCol
->
colId
=
pDataCol
->
colId
;
pCompCol
->
type
=
pDataCol
->
type
;
if
(
tDataType
Desc
[
pDataCol
->
type
].
getS
tatisFunc
)
{
(
*
tDataType
Desc
[
pDataCol
->
type
].
getS
tatisFunc
)(
if
(
tDataType
s
[
pDataCol
->
type
].
s
tatisFunc
)
{
(
*
tDataType
s
[
pDataCol
->
type
].
s
tatisFunc
)(
pDataCol
->
pData
,
rowsToWrite
,
&
(
pCompCol
->
min
),
&
(
pCompCol
->
max
),
&
(
pCompCol
->
sum
),
&
(
pCompCol
->
minIndex
),
&
(
pCompCol
->
maxIndex
),
&
(
pCompCol
->
numOfNull
));
}
...
...
@@ -788,7 +788,7 @@ static int tsdbWriteBlockToFile(SRWHelper *pHelper, SFile *pFile, SDataCols *pDa
}
}
flen
=
(
*
(
tDataType
Desc
[
pDataCol
->
type
].
compFunc
))((
char
*
)
pDataCol
->
pData
,
tlen
,
rowsToWrite
,
tptr
,
flen
=
(
*
(
tDataType
s
[
pDataCol
->
type
].
compFunc
))((
char
*
)
pDataCol
->
pData
,
tlen
,
rowsToWrite
,
tptr
,
(
int32_t
)
taosTSizeof
(
pHelper
->
pBuffer
)
-
lsize
,
pCfg
->
compression
,
pHelper
->
compBuffer
,
(
int32_t
)
taosTSizeof
(
pHelper
->
compBuffer
));
}
else
{
...
...
@@ -1208,7 +1208,7 @@ static int tsdbCheckAndDecodeColumnData(SDataCol *pDataCol, char *content, int32
// Decode the data
if
(
comp
)
{
// // Need to decompress
int
tlen
=
(
*
(
tDataType
Desc
[
pDataCol
->
type
].
decompFunc
))(
content
,
len
-
sizeof
(
TSCKSUM
),
numOfRows
,
pDataCol
->
pData
,
int
tlen
=
(
*
(
tDataType
s
[
pDataCol
->
type
].
decompFunc
))(
content
,
len
-
sizeof
(
TSCKSUM
),
numOfRows
,
pDataCol
->
pData
,
pDataCol
->
spaceSize
,
comp
,
buffer
,
bufferSize
);
if
(
tlen
<=
0
)
{
tsdbError
(
"Failed to decompress column, file corrupted, len:%d comp:%d numOfRows:%d maxPoints:%d bufferSize:%d"
,
...
...
src/util/src/tcompare.c
浏览文件 @
79076505
#include "t
aosdef
.h"
#include "t
type
.h"
#include "tcompare.h"
#include "tarray.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录