Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ccb10efb
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看板
提交
ccb10efb
编写于
7月 19, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
eliminate redundant codes
上级
c9a3b750
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
71 addition
and
122 deletion
+71
-122
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+13
-13
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+2
-2
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+1
-30
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+18
-54
src/common/src/ttypes.c
src/common/src/ttypes.c
+21
-19
src/cq/src/cqMain.c
src/cq/src/cqMain.c
+2
-2
src/inc/ttype.h
src/inc/ttype.h
+13
-1
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+1
-1
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
ccb10efb
...
...
@@ -425,7 +425,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
case
TSDB_DATA_TYPE_BOOL
:
{
// bool
if
(
isNullStr
(
pToken
))
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_BOOL
),
TYPE_BYTES
[
TSDB_DATA_TYPE_BOOL
],
tOffset
);
getNullValue
(
TSDB_DATA_TYPE_BOOL
),
TYPE_BYTES
[
TSDB_DATA_TYPE_BOOL
],
tOffset
);
}
else
{
if
((
pToken
->
type
==
TK_BOOL
||
pToken
->
type
==
TK_STRING
)
&&
(
pToken
->
n
!=
0
))
{
if
(
strncmp
(
pToken
->
z
,
"true"
,
pToken
->
n
)
==
0
)
{
...
...
@@ -459,7 +459,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
case
TSDB_DATA_TYPE_TINYINT
:
if
(
isNullStr
(
pToken
))
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_TINYINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_TINYINT
],
tOffset
);
getNullValue
(
TSDB_DATA_TYPE_TINYINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_TINYINT
],
tOffset
);
}
else
{
ret
=
tStrToInteger
(
pToken
->
z
,
pToken
->
type
,
pToken
->
n
,
&
iv
,
true
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -479,7 +479,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
case
TSDB_DATA_TYPE_UTINYINT
:
if
(
isNullStr
(
pToken
))
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_UTINYINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_UTINYINT
],
tOffset
);
getNullValue
(
TSDB_DATA_TYPE_UTINYINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_UTINYINT
],
tOffset
);
}
else
{
ret
=
tStrToInteger
(
pToken
->
z
,
pToken
->
type
,
pToken
->
n
,
&
iv
,
false
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -499,7 +499,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
case
TSDB_DATA_TYPE_SMALLINT
:
if
(
isNullStr
(
pToken
))
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_SMALLINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_SMALLINT
],
tOffset
);
getNullValue
(
TSDB_DATA_TYPE_SMALLINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_SMALLINT
],
tOffset
);
}
else
{
ret
=
tStrToInteger
(
pToken
->
z
,
pToken
->
type
,
pToken
->
n
,
&
iv
,
true
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -520,7 +520,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
if
(
isNullStr
(
pToken
))
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_USMALLINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_USMALLINT
],
tOffset
);
getNullValue
(
TSDB_DATA_TYPE_USMALLINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_USMALLINT
],
tOffset
);
}
else
{
ret
=
tStrToInteger
(
pToken
->
z
,
pToken
->
type
,
pToken
->
n
,
&
iv
,
false
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -540,7 +540,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
case
TSDB_DATA_TYPE_INT
:
if
(
isNullStr
(
pToken
))
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_INT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_INT
],
tOffset
);
getNullValue
(
TSDB_DATA_TYPE_INT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_INT
],
tOffset
);
}
else
{
ret
=
tStrToInteger
(
pToken
->
z
,
pToken
->
type
,
pToken
->
n
,
&
iv
,
true
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -560,7 +560,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
case
TSDB_DATA_TYPE_UINT
:
if
(
isNullStr
(
pToken
))
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_UINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_UINT
],
tOffset
);
getNullValue
(
TSDB_DATA_TYPE_UINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_UINT
],
tOffset
);
}
else
{
ret
=
tStrToInteger
(
pToken
->
z
,
pToken
->
type
,
pToken
->
n
,
&
iv
,
false
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -580,7 +580,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
case
TSDB_DATA_TYPE_BIGINT
:
if
(
isNullStr
(
pToken
))
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_BIGINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_BIGINT
],
tOffset
);
getNullValue
(
TSDB_DATA_TYPE_BIGINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_BIGINT
],
tOffset
);
}
else
{
ret
=
tStrToInteger
(
pToken
->
z
,
pToken
->
type
,
pToken
->
n
,
&
iv
,
true
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -598,7 +598,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
case
TSDB_DATA_TYPE_UBIGINT
:
if
(
isNullStr
(
pToken
))
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_UBIGINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_UBIGINT
],
tOffset
);
getNullValue
(
TSDB_DATA_TYPE_UBIGINT
),
TYPE_BYTES
[
TSDB_DATA_TYPE_UBIGINT
],
tOffset
);
}
else
{
ret
=
tStrToInteger
(
pToken
->
z
,
pToken
->
type
,
pToken
->
n
,
&
iv
,
false
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -639,7 +639,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
case
TSDB_DATA_TYPE_DOUBLE
:
if
(
isNullStr
(
pToken
))
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_DOUBLE
),
TYPE_BYTES
[
TSDB_DATA_TYPE_DOUBLE
],
tOffset
);
getNullValue
(
TSDB_DATA_TYPE_DOUBLE
),
TYPE_BYTES
[
TSDB_DATA_TYPE_DOUBLE
],
tOffset
);
}
else
{
double
dv
;
if
(
TK_ILLEGAL
==
tscToDouble
(
pToken
,
&
dv
,
&
endptr
))
{
...
...
@@ -661,7 +661,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
if
(
pToken
->
type
==
TK_NULL
)
{
payloadColSetId
(
payload
,
pSchema
->
colId
);
payloadColSetType
(
payload
,
pSchema
->
type
);
memcpy
(
POINTER_SHIFT
(
payloadStart
,
tOffset
),
tdGetNullVal
(
TSDB_DATA_TYPE_BINARY
),
VARSTR_HEADER_SIZE
+
CHAR_BYTES
);
memcpy
(
POINTER_SHIFT
(
payloadStart
,
tOffset
),
getNullValue
(
TSDB_DATA_TYPE_BINARY
),
VARSTR_HEADER_SIZE
+
CHAR_BYTES
);
*
sizeAppend
=
(
TDRowLenT
)(
VARSTR_HEADER_SIZE
+
CHAR_BYTES
);
}
else
{
// too long values will return invalid sql, not be truncated automatically
if
(
pToken
->
n
+
VARSTR_HEADER_SIZE
>
pSchema
->
bytes
)
{
// todo refactor
...
...
@@ -684,7 +684,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
if
(
pToken
->
type
==
TK_NULL
)
{
payloadColSetId
(
payload
,
pSchema
->
colId
);
payloadColSetType
(
payload
,
pSchema
->
type
);
memcpy
(
POINTER_SHIFT
(
payloadStart
,
tOffset
),
tdGetNullVal
(
TSDB_DATA_TYPE_NCHAR
),
VARSTR_HEADER_SIZE
+
TSDB_NCHAR_SIZE
);
memcpy
(
POINTER_SHIFT
(
payloadStart
,
tOffset
),
getNullValue
(
TSDB_DATA_TYPE_NCHAR
),
VARSTR_HEADER_SIZE
+
TSDB_NCHAR_SIZE
);
*
sizeAppend
=
(
TDRowLenT
)(
VARSTR_HEADER_SIZE
+
TSDB_NCHAR_SIZE
);
}
else
{
// if the converted output len is over than pColumnModel->bytes, return error: 'Argument list too long'
...
...
@@ -716,7 +716,7 @@ static int32_t tsParseOneColumnKV(SSchema *pSchema, SStrToken *pToken, char *pay
*
kvRowColLen
+=
(
TDRowLenT
)(
sizeof
(
SColIdx
)
+
TYPE_BYTES
[
TSDB_DATA_TYPE_TIMESTAMP
]);
}
else
{
*
sizeAppend
=
tsSetPayloadColValue
(
payloadStart
,
payload
,
pSchema
->
colId
,
pSchema
->
type
,
tdGetNullVal
(
TSDB_DATA_TYPE_TIMESTAMP
),
getNullValue
(
TSDB_DATA_TYPE_TIMESTAMP
),
TYPE_BYTES
[
TSDB_DATA_TYPE_TIMESTAMP
],
tOffset
);
}
}
else
{
...
...
src/client/src/tscUtil.c
浏览文件 @
ccb10efb
...
...
@@ -1813,14 +1813,14 @@ static SMemRow tdGenMemRowFromBuilder(SMemRowBuilder* pBuilder) {
p
=
payloadNextCol
(
p
);
++
i
;
}
else
{
tdAppendColVal
(
trow
,
tdGetNullVal
(
pSchema
[
j
].
type
),
pSchema
[
j
].
type
,
toffset
);
tdAppendColVal
(
trow
,
getNullValue
(
pSchema
[
j
].
type
),
pSchema
[
j
].
type
,
toffset
);
toffset
+=
TYPE_BYTES
[
pSchema
[
j
].
type
];
++
j
;
}
}
while
(
j
<
nCols
)
{
tdAppendColVal
(
trow
,
tdGetNullVal
(
pSchema
[
j
].
type
),
pSchema
[
j
].
type
,
toffset
);
tdAppendColVal
(
trow
,
getNullValue
(
pSchema
[
j
].
type
),
pSchema
[
j
].
type
,
toffset
);
toffset
+=
TYPE_BYTES
[
pSchema
[
j
].
type
];
++
j
;
}
...
...
src/common/inc/tdataformat.h
浏览文件 @
ccb10efb
...
...
@@ -24,35 +24,6 @@
extern
"C"
{
#endif
#pragma pack(push, 1)
typedef
struct
{
VarDataLenT
len
;
uint8_t
data
;
}
SBinaryNullT
;
typedef
struct
{
VarDataLenT
len
;
uint32_t
data
;
}
SNCharNullT
;
#pragma pack(pop)
extern
const
uint8_t
BoolNull
;
extern
const
uint8_t
TinyintNull
;
extern
const
uint16_t
SmallintNull
;
extern
const
uint32_t
IntNull
;
extern
const
uint64_t
BigintNull
;
extern
const
uint64_t
TimestampNull
;
extern
const
uint8_t
UTinyintNull
;
extern
const
uint16_t
USmallintNull
;
extern
const
uint32_t
UIntNull
;
extern
const
uint64_t
UBigintNull
;
extern
const
uint32_t
FloatNull
;
extern
const
uint64_t
DoubleNull
;
extern
const
SBinaryNullT
BinaryNull
;
extern
const
SNCharNullT
NcharNull
;
const
void
*
tdGetNullVal
(
int8_t
type
);
#define STR_TO_VARSTR(x, str) \
do { \
VarDataLenT __len = (VarDataLenT)strlen(str); \
...
...
@@ -287,7 +258,7 @@ void dataColSetNEleNull(SDataCol *pCol, int nEle, int maxPoints);
// Get the data pointer from a column-wised data
static
FORCE_INLINE
const
void
*
tdGetColDataOfRow
(
SDataCol
*
pCol
,
int
row
)
{
if
(
isAllRowsNull
(
pCol
))
{
return
tdGetNullVal
(
pCol
->
type
);
return
getNullValue
(
pCol
->
type
);
}
if
(
IS_VAR_DATA_TYPE
(
pCol
->
type
))
{
return
POINTER_SHIFT
(
pCol
->
pData
,
pCol
->
dataOff
[
row
]);
...
...
src/common/src/tdataformat.c
浏览文件 @
ccb10efb
...
...
@@ -18,20 +18,20 @@
#include "tcoding.h"
#include "wchar.h"
const
uint8_t
BoolNull
=
TSDB_DATA_BOOL_NULL
;
const
uint8_t
TinyintNull
=
TSDB_DATA_TINYINT_NULL
;
const
uint16_t
SmallintNull
=
TSDB_DATA_SMALLINT_NULL
;
const
uint32_t
IntNull
=
TSDB_DATA_INT_NULL
;
const
uint64_t
BigintNull
=
TSDB_DATA_BIGINT_NULL
;
const
uint64_t
TimestampNull
=
TSDB_DATA_BIGINT_NULL
;
const
uint8_t
UTinyintNull
=
TSDB_DATA_UTINYINT_NULL
;
const
uint16_t
USmallintNull
=
TSDB_DATA_USMALLINT_NULL
;
const
uint32_t
UIntNull
=
TSDB_DATA_UINT_NULL
;
const
uint64_t
UBigintNull
=
TSDB_DATA_UBIGINT_NULL
;
const
uint32_t
FloatNull
=
TSDB_DATA_FLOAT_NULL
;
const
uint64_t
DoubleNull
=
TSDB_DATA_DOUBLE_NULL
;
const
SBinaryNullT
BinaryNull
=
{
1
,
TSDB_DATA_BINARY_NULL
};
const
SNCharNullT
NcharNull
=
{
4
,
TSDB_DATA_NCHAR_NULL
};
//
const uint8_t BoolNull = TSDB_DATA_BOOL_NULL;
//
const uint8_t TinyintNull = TSDB_DATA_TINYINT_NULL;
//
const uint16_t SmallintNull = TSDB_DATA_SMALLINT_NULL;
//
const uint32_t IntNull = TSDB_DATA_INT_NULL;
//
const uint64_t BigintNull = TSDB_DATA_BIGINT_NULL;
//
const uint64_t TimestampNull = TSDB_DATA_BIGINT_NULL;
//
const uint8_t UTinyintNull = TSDB_DATA_UTINYINT_NULL;
//
const uint16_t USmallintNull = TSDB_DATA_USMALLINT_NULL;
//
const uint32_t UIntNull = TSDB_DATA_UINT_NULL;
//
const uint64_t UBigintNull = TSDB_DATA_UBIGINT_NULL;
//
const uint32_t FloatNull = TSDB_DATA_FLOAT_NULL;
//
const uint64_t DoubleNull = TSDB_DATA_DOUBLE_NULL;
//
const SBinaryNullT BinaryNull = {1, TSDB_DATA_BINARY_NULL};
//
const SNCharNullT NcharNull = {4, TSDB_DATA_NCHAR_NULL};
static
void
tdMergeTwoDataCols
(
SDataCols
*
target
,
SDataCols
*
src1
,
int
*
iter1
,
int
limit1
,
SDataCols
*
src2
,
int
*
iter2
,
int
limit2
,
int
tRows
);
...
...
@@ -453,7 +453,7 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
SDataCol
*
pDataCol
=
&
(
pCols
->
cols
[
dcol
]);
if
(
rcol
>=
schemaNCols
(
pSchema
))
{
// dataColSetNullAt(pDataCol, pCols->numOfRows);
dataColAppendVal
(
pDataCol
,
tdGetNullVal
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dcol
++
;
continue
;
}
...
...
@@ -468,7 +468,7 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
rcol
++
;
}
else
{
// dataColSetNullAt(pDataCol, pCols->numOfRows);
dataColAppendVal
(
pDataCol
,
tdGetNullVal
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dcol
++
;
}
}
...
...
@@ -498,7 +498,7 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
SDataCol
*
pDataCol
=
&
(
pCols
->
cols
[
dcol
]);
if
(
rcol
>=
nRowCols
||
rcol
>=
schemaNCols
(
pSchema
))
{
// dataColSetNullAt(pDataCol, pCols->numOfRows);
dataColAppendVal
(
pDataCol
,
tdGetNullVal
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
++
dcol
;
continue
;
}
...
...
@@ -514,7 +514,7 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
++
rcol
;
}
else
{
// dataColSetNullAt(pDataCol, pCols->numOfRows);
dataColAppendVal
(
pDataCol
,
tdGetNullVal
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
++
dcol
;
}
}
...
...
@@ -799,40 +799,4 @@ SKVRow tdGetKVRowFromBuilder(SKVRowBuilder *pBuilder) {
memcpy
(
kvRowValues
(
row
),
pBuilder
->
buf
,
pBuilder
->
size
);
return
row
;
}
const
void
*
tdGetNullVal
(
int8_t
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
return
&
BoolNull
;
case
TSDB_DATA_TYPE_TINYINT
:
return
&
TinyintNull
;
case
TSDB_DATA_TYPE_SMALLINT
:
return
&
SmallintNull
;
case
TSDB_DATA_TYPE_INT
:
return
&
IntNull
;
case
TSDB_DATA_TYPE_BIGINT
:
return
&
BigintNull
;
case
TSDB_DATA_TYPE_FLOAT
:
return
&
FloatNull
;
case
TSDB_DATA_TYPE_DOUBLE
:
return
&
DoubleNull
;
case
TSDB_DATA_TYPE_BINARY
:
return
&
BinaryNull
;
case
TSDB_DATA_TYPE_TIMESTAMP
:
return
&
TimestampNull
;
case
TSDB_DATA_TYPE_NCHAR
:
return
&
NcharNull
;
case
TSDB_DATA_TYPE_UTINYINT
:
return
&
UTinyintNull
;
case
TSDB_DATA_TYPE_USMALLINT
:
return
&
USmallintNull
;
case
TSDB_DATA_TYPE_UINT
:
return
&
UIntNull
;
case
TSDB_DATA_TYPE_UBIGINT
:
return
&
UBigintNull
;
default:
ASSERT
(
0
);
return
NULL
;
}
}
\ No newline at end of file
src/common/src/ttypes.c
浏览文件 @
ccb10efb
...
...
@@ -492,30 +492,32 @@ void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems) {
}
}
static
uint8_t
nullBool
=
TSDB_DATA_BOOL_NULL
;
static
uint8_t
nullTinyInt
=
TSDB_DATA_TINYINT_NULL
;
static
uint16_t
nullSmallInt
=
TSDB_DATA_SMALLINT_NULL
;
static
uint32_t
nullInt
=
TSDB_DATA_INT_NULL
;
static
uint64_t
nullBigInt
=
TSDB_DATA_BIGINT_NULL
;
static
uint32_t
nullFloat
=
TSDB_DATA_FLOAT_NULL
;
static
uint64_t
nullDouble
=
TSDB_DATA_DOUBLE_NULL
;
static
uint8_t
nullTinyIntu
=
TSDB_DATA_UTINYINT_NULL
;
static
uint16_t
nullSmallIntu
=
TSDB_DATA_USMALLINT_NULL
;
static
uint32_t
nullIntu
=
TSDB_DATA_UINT_NULL
;
static
uint64_t
nullBigIntu
=
TSDB_DATA_UBIGINT_NULL
;
static
union
{
tstr
str
;
char
pad
[
sizeof
(
tstr
)
+
4
];
}
nullBinary
=
{.
str
=
{.
len
=
1
}},
nullNchar
=
{.
str
=
{.
len
=
4
}};
static
void
*
nullValues
[]
=
{
static
uint8_t
nullBool
=
TSDB_DATA_BOOL_NULL
;
static
uint8_t
nullTinyInt
=
TSDB_DATA_TINYINT_NULL
;
static
uint16_t
nullSmallInt
=
TSDB_DATA_SMALLINT_NULL
;
static
uint32_t
nullInt
=
TSDB_DATA_INT_NULL
;
static
uint64_t
nullBigInt
=
TSDB_DATA_BIGINT_NULL
;
static
uint32_t
nullFloat
=
TSDB_DATA_FLOAT_NULL
;
static
uint64_t
nullDouble
=
TSDB_DATA_DOUBLE_NULL
;
static
uint8_t
nullTinyIntu
=
TSDB_DATA_UTINYINT_NULL
;
static
uint16_t
nullSmallIntu
=
TSDB_DATA_USMALLINT_NULL
;
static
uint32_t
nullIntu
=
TSDB_DATA_UINT_NULL
;
static
uint64_t
nullBigIntu
=
TSDB_DATA_UBIGINT_NULL
;
static
SBinaryNullT
nullBinary
=
{
1
,
TSDB_DATA_BINARY_NULL
};
static
SNCharNullT
nullNchar
=
{
4
,
TSDB_DATA_NCHAR_NULL
};
// static union {
// tstr str;
// char pad[sizeof(tstr) + 4];
// } nullBinary = {.str = {.len = 1}}, nullNchar = {.str = {.len = 4}};
static
const
void
*
nullValues
[]
=
{
&
nullBool
,
&
nullTinyInt
,
&
nullSmallInt
,
&
nullInt
,
&
nullBigInt
,
&
nullFloat
,
&
nullDouble
,
&
nullBinary
,
&
nullBigInt
,
&
nullNchar
,
&
nullTinyIntu
,
&
nullSmallIntu
,
&
nullIntu
,
&
nullBigIntu
,
};
void
*
getNullValue
(
int32_t
type
)
{
const
void
*
getNullValue
(
int32_t
type
)
{
assert
(
type
>=
TSDB_DATA_TYPE_BOOL
&&
type
<=
TSDB_DATA_TYPE_UBIGINT
);
return
nullValues
[
type
-
1
];
}
...
...
src/cq/src/cqMain.c
浏览文件 @
ccb10efb
...
...
@@ -490,9 +490,9 @@ static void cqProcessStreamRes(void *param, TAOS_RES *tres, TAOS_ROW row) {
for
(
int32_t
i
=
0
;
i
<
pSchema
->
numOfCols
;
i
++
)
{
STColumn
*
c
=
pSchema
->
columns
+
i
;
void
*
val
=
row
[
i
];
void
*
val
=
row
[
i
];
if
(
val
==
NULL
)
{
val
=
getNullValue
(
c
->
type
);
val
=
(
void
*
)
getNullValue
(
c
->
type
);
}
else
if
(
c
->
type
==
TSDB_DATA_TYPE_BINARY
)
{
val
=
((
char
*
)
val
)
-
sizeof
(
VarDataLenT
);
}
else
if
(
c
->
type
==
TSDB_DATA_TYPE_NCHAR
)
{
...
...
src/inc/ttype.h
浏览文件 @
ccb10efb
...
...
@@ -20,6 +20,18 @@ typedef struct tstr {
char
data
[];
}
tstr
;
#pragma pack(push, 1)
typedef
struct
{
VarDataLenT
len
;
uint8_t
data
;
}
SBinaryNullT
;
typedef
struct
{
VarDataLenT
len
;
uint32_t
data
;
}
SNCharNullT
;
#pragma pack(pop)
#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
#define varDataLen(v) ((VarDataLenT *)(v))[0]
...
...
@@ -182,7 +194,7 @@ 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
);
const
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
);
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
ccb10efb
...
...
@@ -787,7 +787,7 @@ static char *getTagIndexKey(const void *pData) {
void
*
res
=
tdGetKVRowValOfCol
(
pTable
->
tagVal
,
pCol
->
colId
);
if
(
res
==
NULL
)
{
// treat the column as NULL if we cannot find it
res
=
getNullValue
(
pCol
->
type
);
res
=
(
char
*
)
getNullValue
(
pCol
->
type
);
}
return
res
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录