Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
10e48241
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
未验证
提交
10e48241
编写于
6月 05, 2022
作者:
wmmhello
提交者:
GitHub
6月 05, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13483 from taosdata/feature/TD-13041
feat: add sort/group logic for json
上级
6c57bb2b
3aab3800
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
344 addition
and
146 deletion
+344
-146
include/common/tdatablock.h
include/common/tdatablock.h
+3
-9
include/util/tdef.h
include/util/tdef.h
+1
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+1
-1
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+1
-1
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+1
-1
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+1
-1
source/libs/scalar/inc/filterInt.h
source/libs/scalar/inc/filterInt.h
+1
-1
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+3
-2
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+87
-66
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+235
-53
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+10
-10
未找到文件。
include/common/tdatablock.h
浏览文件 @
10e48241
...
@@ -71,20 +71,14 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet);
...
@@ -71,20 +71,14 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet);
#define colDataGetData(p1_, r_) \
#define colDataGetData(p1_, r_) \
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? colDataGetVarData(p1_, r_) : colDataGetNumData(p1_, r_))
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? colDataGetVarData(p1_, r_) : colDataGetNumData(p1_, r_))
static
FORCE_INLINE
bool
colDataIsNull_s
(
const
SColumnInfoData
*
pColumnInfoData
,
uint32_t
row
)
{
#define IS_JSON_NULL(type,data) ((type) == TSDB_DATA_TYPE_JSON && *(data) == TSDB_DATA_TYPE_NULL)
if
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
colDataIsNull_var
(
pColumnInfoData
,
row
))
{
return
true
;
}
char
*
data
=
colDataGetVarData
(
pColumnInfoData
,
row
);
return
(
*
data
==
TSDB_DATA_TYPE_NULL
);
}
static
FORCE_INLINE
bool
colDataIsNull_s
(
const
SColumnInfoData
*
pColumnInfoData
,
uint32_t
row
)
{
if
(
!
pColumnInfoData
->
hasNull
)
{
if
(
!
pColumnInfoData
->
hasNull
)
{
return
false
;
return
false
;
}
}
if
(
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_VARCHAR
||
pColumnInfoData
->
info
.
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
IS_VAR_DATA_TYPE
(
pColumnInfoData
->
info
.
type
)
)
{
return
colDataIsNull_var
(
pColumnInfoData
,
row
);
return
colDataIsNull_var
(
pColumnInfoData
,
row
);
}
else
{
}
else
{
if
(
pColumnInfoData
->
nullbitmap
==
NULL
)
{
if
(
pColumnInfoData
->
nullbitmap
==
NULL
)
{
...
...
include/util/tdef.h
浏览文件 @
10e48241
...
@@ -129,7 +129,7 @@ typedef enum EOperatorType {
...
@@ -129,7 +129,7 @@ typedef enum EOperatorType {
OP_TYPE_SUB
,
OP_TYPE_SUB
,
OP_TYPE_MULTI
,
OP_TYPE_MULTI
,
OP_TYPE_DIV
,
OP_TYPE_DIV
,
OP_TYPE_
MOD
,
OP_TYPE_
REM
,
// unary arithmetic operator
// unary arithmetic operator
OP_TYPE_MINUS
,
OP_TYPE_MINUS
,
OP_TYPE_ASSIGN
,
OP_TYPE_ASSIGN
,
...
...
source/common/src/tdatablock.c
浏览文件 @
10e48241
...
@@ -109,7 +109,7 @@ int32_t getJsonValueLen(const char *data) {
...
@@ -109,7 +109,7 @@ int32_t getJsonValueLen(const char *data) {
dataLen
=
DOUBLE_BYTES
+
CHAR_BYTES
;
dataLen
=
DOUBLE_BYTES
+
CHAR_BYTES
;
}
else
if
(
*
data
==
TSDB_DATA_TYPE_BOOL
)
{
}
else
if
(
*
data
==
TSDB_DATA_TYPE_BOOL
)
{
dataLen
=
CHAR_BYTES
+
CHAR_BYTES
;
dataLen
=
CHAR_BYTES
+
CHAR_BYTES
;
}
else
if
(
*
data
==
TD_TAG_JSON
)
{
// json string
}
else
if
(
*
data
&
TD_TAG_JSON
)
{
// json string
dataLen
=
((
STag
*
)(
data
))
->
len
;
dataLen
=
((
STag
*
)(
data
))
->
len
;
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
10e48241
...
@@ -1096,7 +1096,7 @@ bool nodesIsArithmeticOp(const SOperatorNode* pOp) {
...
@@ -1096,7 +1096,7 @@ bool nodesIsArithmeticOp(const SOperatorNode* pOp) {
case
OP_TYPE_SUB
:
case
OP_TYPE_SUB
:
case
OP_TYPE_MULTI
:
case
OP_TYPE_MULTI
:
case
OP_TYPE_DIV
:
case
OP_TYPE_DIV
:
case
OP_TYPE_
MOD
:
case
OP_TYPE_
REM
:
return
true
;
return
true
;
default:
default:
break
;
break
;
...
...
source/libs/parser/inc/sql.y
浏览文件 @
10e48241
...
@@ -611,7 +611,7 @@ expression(A) ::= expression(B) NK_SLASH expression(C).
...
@@ -611,7 +611,7 @@ expression(A) ::= expression(B) NK_SLASH expression(C).
expression(A) ::= expression(B) NK_REM expression(C). {
expression(A) ::= expression(B) NK_REM expression(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken e = getTokenFromRawExprNode(pCxt, C);
SToken e = getTokenFromRawExprNode(pCxt, C);
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_
MOD, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
A = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_
REM, releaseRawExprNode(pCxt, B), releaseRawExprNode(pCxt, C)));
}
}
expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C). {
expression(A) ::= column_reference(B) NK_ARROW NK_STRING(C). {
SToken s = getTokenFromRawExprNode(pCxt, B);
SToken s = getTokenFromRawExprNode(pCxt, B);
...
...
source/libs/parser/src/sql.c
浏览文件 @
10e48241
...
@@ -4079,7 +4079,7 @@ static YYACTIONTYPE yy_reduce(
...
@@ -4079,7 +4079,7 @@ static YYACTIONTYPE yy_reduce(
{
{
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy172
);
SToken
s
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy172
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy172
);
SToken
e
=
getTokenFromRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy172
);
yylhsminor
.
yy172
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_
MOD
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy172
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy172
)));
yylhsminor
.
yy172
=
createRawExprNodeExt
(
pCxt
,
&
s
,
&
e
,
createOperatorNode
(
pCxt
,
OP_TYPE_
REM
,
releaseRawExprNode
(
pCxt
,
yymsp
[
-
2
].
minor
.
yy172
),
releaseRawExprNode
(
pCxt
,
yymsp
[
0
].
minor
.
yy172
)));
}
}
yymsp
[
-
2
].
minor
.
yy172
=
yylhsminor
.
yy172
;
yymsp
[
-
2
].
minor
.
yy172
=
yylhsminor
.
yy172
;
break
;
break
;
...
...
source/libs/scalar/inc/filterInt.h
浏览文件 @
10e48241
...
@@ -350,7 +350,7 @@ struct SFilterInfo {
...
@@ -350,7 +350,7 @@ struct SFilterInfo {
extern
bool
filterDoCompare
(
__compar_fn_t
func
,
uint8_t
optr
,
void
*
left
,
void
*
right
);
extern
bool
filterDoCompare
(
__compar_fn_t
func
,
uint8_t
optr
,
void
*
left
,
void
*
right
);
extern
__compar_fn_t
filterGetCompFunc
(
int32_t
type
,
int32_t
optr
);
extern
__compar_fn_t
filterGetCompFunc
(
int32_t
type
,
int32_t
optr
);
extern
OptrStr
gOptrStr
[];
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/libs/scalar/src/filter.c
浏览文件 @
10e48241
...
@@ -29,8 +29,9 @@ OptrStr gOptrStr[] = {
...
@@ -29,8 +29,9 @@ OptrStr gOptrStr[] = {
{
OP_TYPE_SUB
,
"-"
},
{
OP_TYPE_SUB
,
"-"
},
{
OP_TYPE_MULTI
,
"*"
},
{
OP_TYPE_MULTI
,
"*"
},
{
OP_TYPE_DIV
,
"/"
},
{
OP_TYPE_DIV
,
"/"
},
{
OP_TYPE_MOD
,
"%"
},
{
OP_TYPE_REM
,
"%"
},
{
OP_TYPE_MINUS
,
"minus"
},
{
OP_TYPE_ASSIGN
,
"assign"
},
// bit operator
// bit operator
{
OP_TYPE_BIT_AND
,
"&"
},
{
OP_TYPE_BIT_AND
,
"&"
},
{
OP_TYPE_BIT_OR
,
"|"
},
{
OP_TYPE_BIT_OR
,
"|"
},
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
10e48241
...
@@ -29,6 +29,12 @@
...
@@ -29,6 +29,12 @@
#define LEFT_COL ((pLeftCol->info.type == TSDB_DATA_TYPE_JSON ? (void*)pLeftCol : pLeftCol->pData))
#define LEFT_COL ((pLeftCol->info.type == TSDB_DATA_TYPE_JSON ? (void*)pLeftCol : pLeftCol->pData))
#define RIGHT_COL ((pRightCol->info.type == TSDB_DATA_TYPE_JSON ? (void*)pRightCol : pRightCol->pData))
#define RIGHT_COL ((pRightCol->info.type == TSDB_DATA_TYPE_JSON ? (void*)pRightCol : pRightCol->pData))
#define IS_NULL colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i) \
|| IS_JSON_NULL(pLeft->columnData->info.type, colDataGetVarData(pLeft->columnData, i)) \
|| IS_JSON_NULL(pRight->columnData->info.type, colDataGetVarData(pRight->columnData, i))
#define IS_HELPER_NULL(col,i) colDataIsNull_s(col, i) || IS_JSON_NULL(col->info.type, colDataGetVarData(col, i))
void
convertNumberToNumber
(
const
void
*
inData
,
void
*
outData
,
int8_t
inType
,
int8_t
outType
){
void
convertNumberToNumber
(
const
void
*
inData
,
void
*
outData
,
int8_t
inType
,
int8_t
outType
){
switch
(
outType
)
{
switch
(
outType
)
{
case
TSDB_DATA_TYPE_BOOL
:
{
case
TSDB_DATA_TYPE_BOOL
:
{
...
@@ -387,7 +393,7 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in
...
@@ -387,7 +393,7 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in
pOut
->
numOfRows
=
pIn
->
numOfRows
;
pOut
->
numOfRows
=
pIn
->
numOfRows
;
for
(
int32_t
i
=
0
;
i
<
pIn
->
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pIn
->
numOfRows
;
++
i
)
{
if
(
colDataIsNull_s
(
pIn
->
columnData
,
i
))
{
if
(
IS_HELPER_NULL
(
pIn
->
columnData
,
i
))
{
colDataAppendNULL
(
pOut
->
columnData
,
i
);
colDataAppendNULL
(
pOut
->
columnData
,
i
);
continue
;
continue
;
}
}
...
@@ -396,8 +402,7 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in
...
@@ -396,8 +402,7 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in
int32_t
convertType
=
inType
;
int32_t
convertType
=
inType
;
if
(
inType
==
TSDB_DATA_TYPE_JSON
){
if
(
inType
==
TSDB_DATA_TYPE_JSON
){
if
(
*
data
==
TSDB_DATA_TYPE_NULL
)
{
if
(
*
data
==
TSDB_DATA_TYPE_NULL
)
{
colDataAppendNULL
(
pOut
->
columnData
,
i
);
ASSERT
(
0
);
continue
;
}
}
else
if
(
*
data
==
TSDB_DATA_TYPE_NCHAR
)
{
else
if
(
*
data
==
TSDB_DATA_TYPE_NCHAR
)
{
data
+=
CHAR_BYTES
;
data
+=
CHAR_BYTES
;
...
@@ -447,13 +452,13 @@ double getVectorDoubleValue_JSON(void *src, int32_t index){
...
@@ -447,13 +452,13 @@ double getVectorDoubleValue_JSON(void *src, int32_t index){
return
out
;
return
out
;
}
}
void
convertJsonValue
(
__compar_fn_t
*
fp
,
int32_t
optr
,
int8_t
typeLeft
,
int8_t
typeRight
,
char
**
pLeftData
,
char
**
pRightData
,
void
*
pLeftOut
,
void
*
pRightOut
,
bool
*
isNull
){
bool
convertJsonValue
(
__compar_fn_t
*
fp
,
int32_t
optr
,
int8_t
typeLeft
,
int8_t
typeRight
,
char
**
pLeftData
,
char
**
pRightData
,
void
*
pLeftOut
,
void
*
pRightOut
,
bool
*
isNull
){
if
(
optr
==
OP_TYPE_JSON_CONTAINS
)
{
if
(
optr
==
OP_TYPE_JSON_CONTAINS
)
{
return
;
return
true
;
}
}
if
(
typeLeft
!=
TSDB_DATA_TYPE_JSON
&&
typeRight
!=
TSDB_DATA_TYPE_JSON
){
if
(
typeLeft
!=
TSDB_DATA_TYPE_JSON
&&
typeRight
!=
TSDB_DATA_TYPE_JSON
){
return
;
return
true
;
}
}
if
(
typeLeft
==
TSDB_DATA_TYPE_JSON
){
if
(
typeLeft
==
TSDB_DATA_TYPE_JSON
){
...
@@ -464,15 +469,22 @@ void convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t
...
@@ -464,15 +469,22 @@ void convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t
typeRight
=
**
pRightData
;
typeRight
=
**
pRightData
;
(
*
pRightData
)
++
;
(
*
pRightData
)
++
;
}
}
if
(
optr
==
OP_TYPE_LIKE
||
optr
==
OP_TYPE_NOT_LIKE
||
optr
==
OP_TYPE_MATCH
||
optr
==
OP_TYPE_NMATCH
){
if
(
typeLeft
!=
TSDB_DATA_TYPE_NCHAR
&&
typeLeft
!=
TSDB_DATA_TYPE_BINARY
){
return
false
;
}
}
if
(
typeLeft
==
TSDB_DATA_TYPE_NULL
||
typeRight
==
TSDB_DATA_TYPE_NULL
){
if
(
typeLeft
==
TSDB_DATA_TYPE_NULL
||
typeRight
==
TSDB_DATA_TYPE_NULL
){
*
isNull
=
true
;
*
isNull
=
true
;
return
;
return
true
;
}
}
int8_t
type
=
vectorGetConvertType
(
typeLeft
,
typeRight
);
int8_t
type
=
vectorGetConvertType
(
typeLeft
,
typeRight
);
if
(
type
==
0
)
{
if
(
type
==
0
)
{
*
fp
=
filterGetCompFunc
(
typeLeft
,
optr
);
*
fp
=
filterGetCompFunc
(
typeLeft
,
optr
);
return
;
return
true
;
}
}
*
fp
=
filterGetCompFunc
(
type
,
optr
);
*
fp
=
filterGetCompFunc
(
type
,
optr
);
...
@@ -492,6 +504,7 @@ void convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t
...
@@ -492,6 +504,7 @@ void convertJsonValue(__compar_fn_t *fp, int32_t optr, int8_t typeLeft, int8_t t
convertNumberToNumber
(
*
pRightData
,
pRightOut
,
typeRight
,
type
);
convertNumberToNumber
(
*
pRightData
,
pRightOut
,
typeRight
,
type
);
*
pRightData
=
pRightOut
;
*
pRightData
=
pRightOut
;
}
}
return
true
;
}
}
int32_t
vectorConvertToVarData
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
,
int16_t
inType
,
int16_t
outType
)
{
int32_t
vectorConvertToVarData
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
,
int16_t
inType
,
int16_t
outType
)
{
...
@@ -867,11 +880,11 @@ static void vectorMathAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig
...
@@ -867,11 +880,11 @@ static void vectorMathAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
if
(
colDataIsNull_f
(
pRightCol
->
nullbitmap
,
0
))
{
// Set pLeft->numOfRows NULL value
if
(
IS_HELPER_NULL
(
pRightCol
,
0
))
{
// Set pLeft->numOfRows NULL value
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
}
else
{
}
else
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeftCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -887,11 +900,11 @@ static void vectorMathBigintAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData
...
@@ -887,11 +900,11 @@ static void vectorMathBigintAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
if
(
colDataIsNull_f
(
pRightCol
->
nullbitmap
,
0
))
{
// Set pLeft->numOfRows NULL value
if
(
IS_HELPER_NULL
(
pRightCol
,
0
))
{
// Set pLeft->numOfRows NULL value
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
}
else
{
}
else
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeftCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -982,7 +995,7 @@ void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
...
@@ -982,7 +995,7 @@ void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
||
colDataIsNull_s
(
pRight
->
columnData
,
i
)
)
{
if
(
IS_NULL
)
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1000,7 +1013,7 @@ void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
...
@@ -1000,7 +1013,7 @@ void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
||
colDataIsNull_s
(
pRight
->
columnData
,
i
))
{
if
(
IS_NULL
)
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1024,11 +1037,11 @@ static void vectorMathSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig
...
@@ -1024,11 +1037,11 @@ static void vectorMathSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
if
(
colDataIsNull_f
(
pRightCol
->
nullbitmap
,
0
))
{
// Set pLeft->numOfRows NULL value
if
(
IS_HELPER_NULL
(
pRightCol
,
0
))
{
// Set pLeft->numOfRows NULL value
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
}
else
{
}
else
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeftCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1044,11 +1057,11 @@ static void vectorMathBigintSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData
...
@@ -1044,11 +1057,11 @@ static void vectorMathBigintSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
if
(
colDataIsNull_f
(
pRightCol
->
nullbitmap
,
0
))
{
// Set pLeft->numOfRows NULL value
if
(
IS_HELPER_NULL
(
pRightCol
,
0
))
{
// Set pLeft->numOfRows NULL value
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
}
else
{
}
else
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeftCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1077,7 +1090,7 @@ void vectorMathSub(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
...
@@ -1077,7 +1090,7 @@ void vectorMathSub(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
||
colDataIsNull_s
(
pRight
->
columnData
,
i
)
)
{
if
(
IS_NULL
)
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1095,7 +1108,7 @@ void vectorMathSub(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
...
@@ -1095,7 +1108,7 @@ void vectorMathSub(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
||
colDataIsNull_s
(
pRight
->
columnData
,
i
)
)
{
if
(
IS_NULL
)
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1119,11 +1132,11 @@ static void vectorMathMultiplyHelper(SColumnInfoData* pLeftCol, SColumnInfoData*
...
@@ -1119,11 +1132,11 @@ static void vectorMathMultiplyHelper(SColumnInfoData* pLeftCol, SColumnInfoData*
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
if
(
colDataIsNull_f
(
pRightCol
->
nullbitmap
,
0
))
{
// Set pLeft->numOfRows NULL value
if
(
IS_HELPER_NULL
(
pRightCol
,
0
))
{
// Set pLeft->numOfRows NULL value
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
}
else
{
}
else
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeftCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1149,7 +1162,7 @@ void vectorMathMultiply(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
...
@@ -1149,7 +1162,7 @@ void vectorMathMultiply(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
||
colDataIsNull_s
(
pRight
->
columnData
,
i
)
)
{
if
(
IS_NULL
)
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1182,7 +1195,7 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
...
@@ -1182,7 +1195,7 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
||
colDataIsNull_s
(
pRight
->
columnData
,
i
)
||
(
getVectorDoubleValueFnRight
(
RIGHT_COL
,
i
)
==
0
))
{
//divide by 0 check
if
(
IS_NULL
||
(
getVectorDoubleValueFnRight
(
RIGHT_COL
,
i
)
==
0
))
{
//divide by 0 check
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
continue
;
}
}
...
@@ -1190,11 +1203,11 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
...
@@ -1190,11 +1203,11 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
/
getVectorDoubleValueFnRight
(
RIGHT_COL
,
i
);
/
getVectorDoubleValueFnRight
(
RIGHT_COL
,
i
);
}
}
}
else
if
(
pLeft
->
numOfRows
==
1
)
{
}
else
if
(
pLeft
->
numOfRows
==
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
0
))
{
// Set pLeft->numOfRows NULL value
if
(
IS_HELPER_NULL
(
pLeftCol
,
0
))
{
// Set pLeft->numOfRows NULL value
colDataAppendNNULL
(
pOutputCol
,
0
,
pRight
->
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
pRight
->
numOfRows
);
}
else
{
}
else
{
for
(;
i
>=
0
&&
i
<
pRight
->
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
pRight
->
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pRightCol
,
i
)
||
(
getVectorDoubleValueFnRight
(
RIGHT_COL
,
i
)
==
0
))
{
// divide by 0 check
if
(
IS_HELPER_NULL
(
pRightCol
,
i
)
||
(
getVectorDoubleValueFnRight
(
RIGHT_COL
,
i
)
==
0
))
{
// divide by 0 check
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
continue
;
}
}
...
@@ -1203,11 +1216,11 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
...
@@ -1203,11 +1216,11 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
}
}
}
}
}
else
if
(
pRight
->
numOfRows
==
1
)
{
}
else
if
(
pRight
->
numOfRows
==
1
)
{
if
(
colDataIsNull_s
(
pRightCol
,
0
)
||
(
getVectorDoubleValueFnRight
(
RIGHT_COL
,
0
)
==
0
))
{
// Set pLeft->numOfRows NULL value (divde by 0 check)
if
(
IS_HELPER_NULL
(
pRightCol
,
0
)
||
(
getVectorDoubleValueFnRight
(
RIGHT_COL
,
0
)
==
0
))
{
// Set pLeft->numOfRows NULL value (divde by 0 check)
colDataAppendNNULL
(
pOutputCol
,
0
,
pLeft
->
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
pLeft
->
numOfRows
);
}
else
{
}
else
{
for
(;
i
>=
0
&&
i
<
pLeft
->
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
pLeft
->
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeftCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
continue
;
}
}
...
@@ -1236,18 +1249,17 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
...
@@ -1236,18 +1249,17 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
_getDoubleValue_fn_t
getVectorDoubleValueFnRight
=
getVectorDoubleValueFn
(
pRightCol
->
info
.
type
);
_getDoubleValue_fn_t
getVectorDoubleValueFnRight
=
getVectorDoubleValueFn
(
pRightCol
->
info
.
type
);
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
double
zero
=
0
.
0
;
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
i
)
||
colDataIsNull_s
(
pRightCol
,
i
)
)
{
if
(
IS_NULL
)
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
continue
;
}
}
double
lx
=
getVectorDoubleValueFnLeft
(
LEFT_COL
,
i
);
double
lx
=
getVectorDoubleValueFnLeft
(
LEFT_COL
,
i
);
double
rx
=
getVectorDoubleValueFnRight
(
RIGHT_COL
,
i
);
double
rx
=
getVectorDoubleValueFnRight
(
RIGHT_COL
,
i
);
if
(
isnan
(
lx
)
||
isinf
(
lx
)
||
isnan
(
rx
)
||
isinf
(
rx
))
{
if
(
isnan
(
lx
)
||
isinf
(
lx
)
||
isnan
(
rx
)
||
isinf
(
rx
)
||
FLT_EQUAL
(
rx
,
0
)
)
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
continue
;
}
}
...
@@ -1256,11 +1268,11 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
...
@@ -1256,11 +1268,11 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
}
}
}
else
if
(
pLeft
->
numOfRows
==
1
)
{
}
else
if
(
pLeft
->
numOfRows
==
1
)
{
double
lx
=
getVectorDoubleValueFnLeft
(
LEFT_COL
,
0
);
double
lx
=
getVectorDoubleValueFnLeft
(
LEFT_COL
,
0
);
if
(
colDataIsNull_s
(
pLeftCol
,
0
)
||
isnan
(
lx
)
||
isinf
(
lx
))
{
// Set pLeft->numOfRows NULL value
if
(
IS_HELPER_NULL
(
pLeftCol
,
0
))
{
// Set pLeft->numOfRows NULL value
colDataAppendNNULL
(
pOutputCol
,
0
,
pRight
->
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
pRight
->
numOfRows
);
}
else
{
}
else
{
for
(;
i
>=
0
&&
i
<
pRight
->
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
pRight
->
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pRightCol
,
i
))
{
if
(
IS_HELPER_NULL
(
pRightCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
continue
;
}
}
...
@@ -1276,11 +1288,11 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
...
@@ -1276,11 +1288,11 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
}
}
}
else
if
(
pRight
->
numOfRows
==
1
)
{
}
else
if
(
pRight
->
numOfRows
==
1
)
{
double
rx
=
getVectorDoubleValueFnRight
(
RIGHT_COL
,
0
);
double
rx
=
getVectorDoubleValueFnRight
(
RIGHT_COL
,
0
);
if
(
colDataIsNull_s
(
pRightCol
,
0
)
||
FLT_EQUAL
(
rx
,
0
))
{
// Set pLeft->numOfRows NULL value
if
(
IS_HELPER_NULL
(
pRightCol
,
0
)
||
FLT_EQUAL
(
rx
,
0
))
{
// Set pLeft->numOfRows NULL value
colDataAppendNNULL
(
pOutputCol
,
0
,
pLeft
->
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
pLeft
->
numOfRows
);
}
else
{
}
else
{
for
(;
i
>=
0
&&
i
<
pLeft
->
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
pLeft
->
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeftCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
continue
;
}
}
...
@@ -1315,7 +1327,7 @@ void vectorMathMinus(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pO
...
@@ -1315,7 +1327,7 @@ void vectorMathMinus(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pO
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
for
(;
i
<
pLeft
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
<
pLeft
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeftCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
continue
;
}
}
...
@@ -1331,7 +1343,7 @@ void vectorAssign(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
...
@@ -1331,7 +1343,7 @@ void vectorAssign(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
pOut
->
numOfRows
=
pLeft
->
numOfRows
;
pOut
->
numOfRows
=
pLeft
->
numOfRows
;
if
(
colDataIsNull_s
(
pRight
->
columnData
,
0
))
{
if
(
IS_HELPER_NULL
(
pRight
->
columnData
,
0
))
{
for
(
int32_t
i
=
0
;
i
<
pOut
->
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pOut
->
numOfRows
;
++
i
)
{
colDataAppend
(
pOutputCol
,
i
,
NULL
,
true
);
colDataAppend
(
pOutputCol
,
i
,
NULL
,
true
);
}
}
...
@@ -1397,13 +1409,13 @@ static void vectorBitAndHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRigh
...
@@ -1397,13 +1409,13 @@ static void vectorBitAndHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRigh
_getBigintValue_fn_t
getVectorBigintValueFnLeft
=
getVectorBigintValueFn
(
pLeftCol
->
info
.
type
);
_getBigintValue_fn_t
getVectorBigintValueFnLeft
=
getVectorBigintValueFn
(
pLeftCol
->
info
.
type
);
_getBigintValue_fn_t
getVectorBigintValueFnRight
=
getVectorBigintValueFn
(
pRightCol
->
info
.
type
);
_getBigintValue_fn_t
getVectorBigintValueFnRight
=
getVectorBigintValueFn
(
pRightCol
->
info
.
type
);
double
*
output
=
(
double
*
)
pOutputCol
->
pData
;
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
if
(
colDataIsNull_s
(
pRightCol
,
0
))
{
// Set pLeft->numOfRows NULL value
if
(
IS_HELPER_NULL
(
pRightCol
,
0
))
{
// Set pLeft->numOfRows NULL value
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
}
else
{
}
else
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeftCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1429,7 +1441,7 @@ void vectorBitAnd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
...
@@ -1429,7 +1441,7 @@ void vectorBitAnd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
||
colDataIsNull_s
(
pRight
->
columnData
,
i
)
)
{
if
(
IS_NULL
)
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1451,12 +1463,12 @@ static void vectorBitOrHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRight
...
@@ -1451,12 +1463,12 @@ static void vectorBitOrHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRight
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
if
(
colDataIsNull_s
(
pRightCol
,
0
))
{
// Set pLeft->numOfRows NULL value
if
(
IS_HELPER_NULL
(
pRightCol
,
0
))
{
// Set pLeft->numOfRows NULL value
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
colDataAppendNNULL
(
pOutputCol
,
0
,
numOfRows
);
}
else
{
}
else
{
int64_t
rx
=
getVectorBigintValueFnRight
(
RIGHT_COL
,
0
);
int64_t
rx
=
getVectorBigintValueFnRight
(
RIGHT_COL
,
0
);
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
>=
0
&&
i
<
numOfRows
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeftCol
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeftCol
,
i
))
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1482,7 +1494,7 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
...
@@ -1482,7 +1494,7 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
int64_t
*
output
=
(
int64_t
*
)
pOutputCol
->
pData
;
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
,
output
+=
1
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
||
colDataIsNull_s
(
pRight
->
columnData
,
i
)
)
{
if
(
IS_NULL
)
{
colDataAppendNULL
(
pOutputCol
,
i
);
colDataAppendNULL
(
pOutputCol
,
i
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
}
}
...
@@ -1507,7 +1519,7 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
...
@@ -1507,7 +1519,7 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
if
(
pRight
->
pHashFilter
!=
NULL
)
{
if
(
pRight
->
pHashFilter
!=
NULL
)
{
for
(;
i
>=
0
&&
i
<
pLeft
->
numOfRows
;
i
+=
step
)
{
for
(;
i
>=
0
&&
i
<
pLeft
->
numOfRows
;
i
+=
step
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeft
->
columnData
,
i
))
{
bool
res
=
false
;
bool
res
=
false
;
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
continue
;
continue
;
...
@@ -1522,7 +1534,7 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
...
@@ -1522,7 +1534,7 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
if
(
pLeft
->
numOfRows
==
pRight
->
numOfRows
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
)
{
for
(;
i
<
pRight
->
numOfRows
&&
i
>=
0
;
i
+=
step
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
||
colDataIsNull_s
(
pRight
->
columnData
,
i
))
{
if
(
IS_HELPER_NULL
(
pLeft
->
columnData
,
i
)
||
IS_HELPER_NULL
(
pRight
->
columnData
,
i
))
{
bool
res
=
false
;
bool
res
=
false
;
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
continue
;
// TODO set null or ignore
continue
;
// TODO set null or ignore
...
@@ -1534,18 +1546,21 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
...
@@ -1534,18 +1546,21 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
int64_t
leftOut
=
0
;
int64_t
leftOut
=
0
;
int64_t
rightOut
=
0
;
int64_t
rightOut
=
0
;
bool
isJsonnull
=
false
;
bool
isJsonnull
=
false
;
convertJsonValue
(
&
fp
,
optr
,
GET_PARAM_TYPE
(
pLeft
),
GET_PARAM_TYPE
(
pRight
),
&
pLeftData
,
&
pRightData
,
&
leftOut
,
&
rightOut
,
&
isJsonnull
);
bool
result
=
convertJsonValue
(
&
fp
,
optr
,
GET_PARAM_TYPE
(
pLeft
),
GET_PARAM_TYPE
(
pRight
),
&
pLeftData
,
&
pRightData
,
&
leftOut
,
&
rightOut
,
&
isJsonnull
);
if
(
isJsonnull
){
if
(
isJsonnull
){
colDataAppendNULL
(
pOut
->
columnData
,
i
);
ASSERT
(
0
);
continue
;
// TODO set null or ignore
}
}
if
(
!
result
){
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
result
);
}
else
{
bool
res
=
filterDoCompare
(
fp
,
optr
,
pLeftData
,
pRightData
);
bool
res
=
filterDoCompare
(
fp
,
optr
,
pLeftData
,
pRightData
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
}
}
}
}
else
if
(
pRight
->
numOfRows
==
1
)
{
}
else
if
(
pRight
->
numOfRows
==
1
)
{
ASSERT
(
pLeft
->
pHashFilter
==
NULL
);
ASSERT
(
pLeft
->
pHashFilter
==
NULL
);
for
(;
i
>=
0
&&
i
<
pLeft
->
numOfRows
;
i
+=
step
)
{
for
(;
i
>=
0
&&
i
<
pLeft
->
numOfRows
;
i
+=
step
)
{
if
(
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
||
colDataIsNull_s
(
pRight
->
columnData
,
0
))
{
if
(
IS_HELPER_NULL
(
pLeft
->
columnData
,
i
)
||
IS_HELPER_NULL
(
pRight
->
columnData
,
0
))
{
bool
res
=
false
;
bool
res
=
false
;
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
continue
;
continue
;
...
@@ -1556,17 +1571,20 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
...
@@ -1556,17 +1571,20 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
int64_t
leftOut
=
0
;
int64_t
leftOut
=
0
;
int64_t
rightOut
=
0
;
int64_t
rightOut
=
0
;
bool
isJsonnull
=
false
;
bool
isJsonnull
=
false
;
convertJsonValue
(
&
fp
,
optr
,
GET_PARAM_TYPE
(
pLeft
),
GET_PARAM_TYPE
(
pRight
),
&
pLeftData
,
&
pRightData
,
&
leftOut
,
&
rightOut
,
&
isJsonnull
);
bool
result
=
convertJsonValue
(
&
fp
,
optr
,
GET_PARAM_TYPE
(
pLeft
),
GET_PARAM_TYPE
(
pRight
),
&
pLeftData
,
&
pRightData
,
&
leftOut
,
&
rightOut
,
&
isJsonnull
);
if
(
isJsonnull
){
if
(
isJsonnull
){
colDataAppendNULL
(
pOut
->
columnData
,
i
);
ASSERT
(
0
);
continue
;
// TODO set null or ignore
}
}
if
(
!
result
){
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
result
);
}
else
{
bool
res
=
filterDoCompare
(
fp
,
optr
,
pLeftData
,
pRightData
);
bool
res
=
filterDoCompare
(
fp
,
optr
,
pLeftData
,
pRightData
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
}
}
}
}
else
if
(
pLeft
->
numOfRows
==
1
)
{
}
else
if
(
pLeft
->
numOfRows
==
1
)
{
for
(;
i
>=
0
&&
i
<
pRight
->
numOfRows
;
i
+=
step
)
{
for
(;
i
>=
0
&&
i
<
pRight
->
numOfRows
;
i
+=
step
)
{
if
(
colDataIsNull_s
(
pRight
->
columnData
,
i
)
||
colDataIsNull_s
(
pLeft
->
columnData
,
0
))
{
if
(
IS_HELPER_NULL
(
pRight
->
columnData
,
i
)
||
IS_HELPER_NULL
(
pLeft
->
columnData
,
0
))
{
bool
res
=
false
;
bool
res
=
false
;
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
continue
;
continue
;
...
@@ -1577,15 +1595,18 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
...
@@ -1577,15 +1595,18 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
int64_t
leftOut
=
0
;
int64_t
leftOut
=
0
;
int64_t
rightOut
=
0
;
int64_t
rightOut
=
0
;
bool
isJsonnull
=
false
;
bool
isJsonnull
=
false
;
convertJsonValue
(
&
fp
,
optr
,
GET_PARAM_TYPE
(
pLeft
),
GET_PARAM_TYPE
(
pRight
),
&
pLeftData
,
&
pRightData
,
&
leftOut
,
&
rightOut
,
&
isJsonnull
);
bool
result
=
convertJsonValue
(
&
fp
,
optr
,
GET_PARAM_TYPE
(
pLeft
),
GET_PARAM_TYPE
(
pRight
),
&
pLeftData
,
&
pRightData
,
&
leftOut
,
&
rightOut
,
&
isJsonnull
);
if
(
isJsonnull
){
if
(
isJsonnull
){
colDataAppendNULL
(
pOut
->
columnData
,
i
);
ASSERT
(
0
);
continue
;
// TODO set null or ignore
}
}
if
(
!
result
){
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
result
);
}
else
{
bool
res
=
filterDoCompare
(
fp
,
optr
,
pLeftData
,
pRightData
);
bool
res
=
filterDoCompare
(
fp
,
optr
,
pLeftData
,
pRightData
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
(
int8_t
*
)
&
res
);
}
}
}
}
}
}
}
void
vectorCompare
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
,
int32_t
optr
)
{
void
vectorCompare
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
,
int32_t
optr
)
{
...
@@ -1668,7 +1689,7 @@ void vectorJsonContains(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
...
@@ -1668,7 +1689,7 @@ void vectorJsonContains(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
void
vectorIsNull
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
)
{
void
vectorIsNull
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
)
{
for
(
int32_t
i
=
0
;
i
<
pLeft
->
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pLeft
->
numOfRows
;
++
i
)
{
int8_t
v
=
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
?
1
:
0
;
int8_t
v
=
IS_HELPER_NULL
(
pLeft
->
columnData
,
i
)
?
1
:
0
;
colDataAppendInt8
(
pOut
->
columnData
,
i
,
&
v
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
&
v
);
}
}
pOut
->
numOfRows
=
pLeft
->
numOfRows
;
pOut
->
numOfRows
=
pLeft
->
numOfRows
;
...
@@ -1676,7 +1697,7 @@ void vectorIsNull(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
...
@@ -1676,7 +1697,7 @@ void vectorIsNull(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
void
vectorNotNull
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
)
{
void
vectorNotNull
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
)
{
for
(
int32_t
i
=
0
;
i
<
pLeft
->
numOfRows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pLeft
->
numOfRows
;
++
i
)
{
int8_t
v
=
colDataIsNull_s
(
pLeft
->
columnData
,
i
)
?
0
:
1
;
int8_t
v
=
IS_HELPER_NULL
(
pLeft
->
columnData
,
i
)
?
0
:
1
;
colDataAppendInt8
(
pOut
->
columnData
,
i
,
&
v
);
colDataAppendInt8
(
pOut
->
columnData
,
i
,
&
v
);
}
}
pOut
->
numOfRows
=
pLeft
->
numOfRows
;
pOut
->
numOfRows
=
pLeft
->
numOfRows
;
...
@@ -1696,7 +1717,7 @@ _bin_scalar_fn_t getBinScalarOperatorFn(int32_t binFunctionId) {
...
@@ -1696,7 +1717,7 @@ _bin_scalar_fn_t getBinScalarOperatorFn(int32_t binFunctionId) {
return
vectorMathMultiply
;
return
vectorMathMultiply
;
case
OP_TYPE_DIV
:
case
OP_TYPE_DIV
:
return
vectorMathDivide
;
return
vectorMathDivide
;
case
OP_TYPE_
MOD
:
case
OP_TYPE_
REM
:
return
vectorMathRemainder
;
return
vectorMathRemainder
;
case
OP_TYPE_MINUS
:
case
OP_TYPE_MINUS
:
return
vectorMathMinus
;
return
vectorMathMinus
;
...
...
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
10e48241
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
#include "nodes.h"
#include "nodes.h"
#include "tlog.h"
#include "tlog.h"
#include "parUtil.h"
#include "parUtil.h"
#include "filterInt.h"
#define _DEBUG_PRINT_ 0
#define _DEBUG_PRINT_ 0
...
@@ -212,6 +213,24 @@ void scltMakeColumnNode(SNode **pNode, SSDataBlock **block, int32_t dataType, in
...
@@ -212,6 +213,24 @@ void scltMakeColumnNode(SNode **pNode, SSDataBlock **block, int32_t dataType, in
*
pNode
=
(
SNode
*
)
rnode
;
*
pNode
=
(
SNode
*
)
rnode
;
}
}
void
scltMakeOpNode2
(
SNode
**
pNode
,
EOperatorType
opType
,
int32_t
resType
,
SNode
*
pLeft
,
SNode
*
pRight
,
bool
isReverse
)
{
SNode
*
node
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_OPERATOR
);
SOperatorNode
*
onode
=
(
SOperatorNode
*
)
node
;
onode
->
node
.
resType
.
type
=
resType
;
onode
->
node
.
resType
.
bytes
=
tDataTypes
[
resType
].
bytes
;
onode
->
opType
=
opType
;
if
(
isReverse
){
onode
->
pLeft
=
pRight
;
onode
->
pRight
=
pLeft
;
}
else
{
onode
->
pLeft
=
pLeft
;
onode
->
pRight
=
pRight
;
}
*
pNode
=
(
SNode
*
)
onode
;
}
void
scltMakeOpNode
(
SNode
**
pNode
,
EOperatorType
opType
,
int32_t
resType
,
SNode
*
pLeft
,
SNode
*
pRight
)
{
void
scltMakeOpNode
(
SNode
**
pNode
,
EOperatorType
opType
,
int32_t
resType
,
SNode
*
pLeft
,
SNode
*
pRight
)
{
SNode
*
node
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_OPERATOR
);
SNode
*
node
=
(
SNode
*
)
nodesMakeNode
(
QUERY_NODE_OPERATOR
);
SOperatorNode
*
onode
=
(
SOperatorNode
*
)
node
;
SOperatorNode
*
onode
=
(
SOperatorNode
*
)
node
;
...
@@ -1039,10 +1058,10 @@ void makeJsonArrow(SSDataBlock **src, SNode **opNode, void *json, char *key){
...
@@ -1039,10 +1058,10 @@ void makeJsonArrow(SSDataBlock **src, SNode **opNode, void *json, char *key){
scltMakeOpNode
(
opNode
,
OP_TYPE_JSON_GET_VALUE
,
TSDB_DATA_TYPE_JSON
,
pLeft
,
pRight
);
scltMakeOpNode
(
opNode
,
OP_TYPE_JSON_GET_VALUE
,
TSDB_DATA_TYPE_JSON
,
pLeft
,
pRight
);
}
}
void
makeOperator
(
SNode
**
opNode
,
SArray
*
blockList
,
EOperatorType
opType
,
int32_t
rightType
,
void
*
rightData
){
void
makeOperator
(
SNode
**
opNode
,
SArray
*
blockList
,
EOperatorType
opType
,
int32_t
rightType
,
void
*
rightData
,
bool
isReverse
){
int32_t
resType
=
TSDB_DATA_TYPE_NULL
;
int32_t
resType
=
TSDB_DATA_TYPE_NULL
;
if
(
opType
==
OP_TYPE_ADD
||
opType
==
OP_TYPE_SUB
||
opType
==
OP_TYPE_MULTI
||
if
(
opType
==
OP_TYPE_ADD
||
opType
==
OP_TYPE_SUB
||
opType
==
OP_TYPE_MULTI
||
opType
==
OP_TYPE_DIV
||
opType
==
OP_TYPE_
MOD
||
opType
==
OP_TYPE_MINUS
){
opType
==
OP_TYPE_DIV
||
opType
==
OP_TYPE_
REM
||
opType
==
OP_TYPE_MINUS
){
resType
=
TSDB_DATA_TYPE_DOUBLE
;
resType
=
TSDB_DATA_TYPE_DOUBLE
;
}
else
if
(
opType
==
OP_TYPE_BIT_AND
||
opType
==
OP_TYPE_BIT_OR
){
}
else
if
(
opType
==
OP_TYPE_BIT_AND
||
opType
==
OP_TYPE_BIT_OR
){
resType
=
TSDB_DATA_TYPE_BIGINT
;
resType
=
TSDB_DATA_TYPE_BIGINT
;
...
@@ -1057,7 +1076,7 @@ void makeOperator(SNode **opNode, SArray *blockList, EOperatorType opType, int32
...
@@ -1057,7 +1076,7 @@ void makeOperator(SNode **opNode, SArray *blockList, EOperatorType opType, int32
SNode
*
right
=
NULL
;
SNode
*
right
=
NULL
;
scltMakeValueNode
(
&
right
,
rightType
,
rightData
);
scltMakeValueNode
(
&
right
,
rightType
,
rightData
);
scltMakeOpNode
(
opNode
,
opType
,
resType
,
*
opNode
,
right
);
scltMakeOpNode
2
(
opNode
,
opType
,
resType
,
*
opNode
,
right
,
isReverse
);
SColumnInfo
colInfo
=
createColumnInfo
(
1
,
resType
,
tDataTypes
[
resType
].
bytes
);
SColumnInfo
colInfo
=
createColumnInfo
(
1
,
resType
,
tDataTypes
[
resType
].
bytes
);
int16_t
dataBlockId
=
0
,
slotId
=
0
;
int16_t
dataBlockId
=
0
,
slotId
=
0
;
...
@@ -1065,7 +1084,7 @@ void makeOperator(SNode **opNode, SArray *blockList, EOperatorType opType, int32
...
@@ -1065,7 +1084,7 @@ void makeOperator(SNode **opNode, SArray *blockList, EOperatorType opType, int32
scltMakeTargetNode
(
opNode
,
dataBlockId
,
slotId
,
*
opNode
);
scltMakeTargetNode
(
opNode
,
dataBlockId
,
slotId
,
*
opNode
);
}
}
void
makeCalculate
(
void
*
json
,
void
*
key
,
int32_t
rightType
,
void
*
rightData
,
double
exceptValue
,
EOperatorType
opType
){
void
makeCalculate
(
void
*
json
,
void
*
key
,
int32_t
rightType
,
void
*
rightData
,
double
exceptValue
,
EOperatorType
opType
,
bool
isReverse
){
SArray
*
blockList
=
taosArrayInit
(
2
,
POINTER_BYTES
);
SArray
*
blockList
=
taosArrayInit
(
2
,
POINTER_BYTES
);
SSDataBlock
*
src
=
NULL
;
SSDataBlock
*
src
=
NULL
;
SNode
*
opNode
=
NULL
;
SNode
*
opNode
=
NULL
;
...
@@ -1073,7 +1092,7 @@ void makeCalculate(void *json, void *key, int32_t rightType, void *rightData, do
...
@@ -1073,7 +1092,7 @@ void makeCalculate(void *json, void *key, int32_t rightType, void *rightData, do
makeJsonArrow
(
&
src
,
&
opNode
,
json
,
(
char
*
)
key
);
makeJsonArrow
(
&
src
,
&
opNode
,
json
,
(
char
*
)
key
);
taosArrayPush
(
blockList
,
&
src
);
taosArrayPush
(
blockList
,
&
src
);
makeOperator
(
&
opNode
,
blockList
,
opType
,
rightType
,
rightData
);
makeOperator
(
&
opNode
,
blockList
,
opType
,
rightType
,
rightData
,
isReverse
);
int32_t
code
=
scalarCalculate
(
opNode
,
blockList
,
NULL
);
int32_t
code
=
scalarCalculate
(
opNode
,
blockList
,
NULL
);
ASSERT_EQ
(
code
,
0
);
ASSERT_EQ
(
code
,
0
);
...
@@ -1087,17 +1106,17 @@ void makeCalculate(void *json, void *key, int32_t rightType, void *rightData, do
...
@@ -1087,17 +1106,17 @@ void makeCalculate(void *json, void *key, int32_t rightType, void *rightData, do
printf
(
"result:NULL
\n
"
);
printf
(
"result:NULL
\n
"
);
}
else
if
(
opType
==
OP_TYPE_ADD
||
opType
==
OP_TYPE_SUB
||
opType
==
OP_TYPE_MULTI
||
opType
==
OP_TYPE_DIV
||
}
else
if
(
opType
==
OP_TYPE_ADD
||
opType
==
OP_TYPE_SUB
||
opType
==
OP_TYPE_MULTI
||
opType
==
OP_TYPE_DIV
||
opType
==
OP_TYPE_
MOD
||
opType
==
OP_TYPE_MINUS
){
opType
==
OP_TYPE_
REM
||
opType
==
OP_TYPE_MINUS
){
printf
(
"
1result:%f,except:%f
\n
"
,
*
((
double
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
printf
(
"
op:%s,1result:%f,except:%f
\n
"
,
gOptrStr
[
opType
].
str
,
*
((
double
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
ASSERT_TRUE
(
fabs
(
*
((
double
*
)
colDataGetData
(
column
,
0
))
-
exceptValue
)
<
0.0001
);
ASSERT_TRUE
(
fabs
(
*
((
double
*
)
colDataGetData
(
column
,
0
))
-
exceptValue
)
<
0.0001
);
}
else
if
(
opType
==
OP_TYPE_BIT_AND
||
opType
==
OP_TYPE_BIT_OR
){
}
else
if
(
opType
==
OP_TYPE_BIT_AND
||
opType
==
OP_TYPE_BIT_OR
){
printf
(
"
2result:%ld,except:%f
\n
"
,
*
((
int64_t
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
printf
(
"
op:%s,2result:%ld,except:%f
\n
"
,
gOptrStr
[
opType
].
str
,
*
((
int64_t
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
ASSERT_EQ
(
*
((
int64_t
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
ASSERT_EQ
(
*
((
int64_t
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
}
else
if
(
opType
==
OP_TYPE_GREATER_THAN
||
opType
==
OP_TYPE_GREATER_EQUAL
||
opType
==
OP_TYPE_LOWER_THAN
||
}
else
if
(
opType
==
OP_TYPE_GREATER_THAN
||
opType
==
OP_TYPE_GREATER_EQUAL
||
opType
==
OP_TYPE_LOWER_THAN
||
opType
==
OP_TYPE_LOWER_EQUAL
||
opType
==
OP_TYPE_EQUAL
||
opType
==
OP_TYPE_NOT_EQUAL
||
opType
==
OP_TYPE_LOWER_EQUAL
||
opType
==
OP_TYPE_EQUAL
||
opType
==
OP_TYPE_NOT_EQUAL
||
opType
==
OP_TYPE_IS_NULL
||
opType
==
OP_TYPE_IS_NOT_NULL
||
opType
==
OP_TYPE_IS_TRUE
||
opType
==
OP_TYPE_IS_NULL
||
opType
==
OP_TYPE_IS_NOT_NULL
||
opType
==
OP_TYPE_IS_TRUE
||
opType
==
OP_TYPE_LIKE
||
opType
==
OP_TYPE_NOT_LIKE
||
opType
==
OP_TYPE_MATCH
||
opType
==
OP_TYPE_NMATCH
){
opType
==
OP_TYPE_LIKE
||
opType
==
OP_TYPE_NOT_LIKE
||
opType
==
OP_TYPE_MATCH
||
opType
==
OP_TYPE_NMATCH
){
printf
(
"
3result:%d,except:%f
\n
"
,
*
((
bool
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
printf
(
"
op:%s,3result:%d,except:%f
\n
"
,
gOptrStr
[
opType
].
str
,
*
((
bool
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
ASSERT_EQ
(
*
((
bool
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
ASSERT_EQ
(
*
((
bool
*
)
colDataGetData
(
column
,
0
)),
exceptValue
);
}
}
...
@@ -1107,7 +1126,7 @@ void makeCalculate(void *json, void *key, int32_t rightType, void *rightData, do
...
@@ -1107,7 +1126,7 @@ void makeCalculate(void *json, void *key, int32_t rightType, void *rightData, do
TEST
(
columnTest
,
json_column_arith_op
)
{
TEST
(
columnTest
,
json_column_arith_op
)
{
scltInitLogFile
();
scltInitLogFile
();
char
*
rightvTmp
=
"{
\"
k1
\"
:4,
\"
k2
\"
:
\"
hello
\"
,
\"
k3
\"
:null,
\"
k4
\"
:true,
\"
k5
\"
:5.44}"
;
char
*
rightvTmp
=
"{
\"
k1
\"
:4,
\"
k2
\"
:
\"
hello
\"
,
\"
k3
\"
:null,
\"
k4
\"
:true,
\"
k5
\"
:5.44
,
\"
k6
\"
:-10,
\"
k7
\"
:-9.8,
\"
k8
\"
:false,
\"
k9
\"
:
\"
8hel
\"
}"
;
char
rightv
[
256
]
=
{
0
};
char
rightv
[
256
]
=
{
0
};
memcpy
(
rightv
,
rightvTmp
,
strlen
(
rightvTmp
));
memcpy
(
rightv
,
rightvTmp
,
strlen
(
rightvTmp
));
...
@@ -1117,54 +1136,126 @@ TEST(columnTest, json_column_arith_op) {
...
@@ -1117,54 +1136,126 @@ TEST(columnTest, json_column_arith_op) {
const
int32_t
len
=
8
;
const
int32_t
len
=
8
;
EOperatorType
op
[
len
]
=
{
OP_TYPE_ADD
,
OP_TYPE_SUB
,
OP_TYPE_MULTI
,
OP_TYPE_DIV
,
EOperatorType
op
[
len
]
=
{
OP_TYPE_ADD
,
OP_TYPE_SUB
,
OP_TYPE_MULTI
,
OP_TYPE_DIV
,
OP_TYPE_MOD
,
OP_TYPE_MINUS
,
OP_TYPE_BIT_AND
,
OP_TYPE_BIT_OR
};
OP_TYPE_REM
,
OP_TYPE_MINUS
,
OP_TYPE_BIT_AND
,
OP_TYPE_BIT_OR
};
int32_t
input
[
len
]
=
{
1
,
8
,
2
,
2
,
3
,
0
,
-
4
,
9
};
int32_t
input
[
len
]
=
{
1
,
8
,
2
,
2
,
3
,
0
,
-
4
,
9
};
printf
(
"--------------------json int---------------------
\n
"
);
printf
(
"--------------------json int-
4 op {1, 8, 2, 2, 3, 0, -4, 9}
--------------------
\n
"
);
char
*
key
=
"k1"
;
char
*
key
=
"k1"
;
double
eRes
[
len
]
=
{
5.0
,
-
4
,
8.0
,
2.0
,
1.0
,
-
4
,
4
&-
4
,
4
|
9
};
double
eRes00
[
len
]
=
{
5.0
,
-
4
,
8.0
,
2.0
,
1.0
,
-
4
,
4
&-
4
,
4
|
9
};
double
eRes01
[
len
]
=
{
5.0
,
4
,
8.0
,
0.5
,
3
,
0
,
4
&-
4
,
4
|
9
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes00
[
i
],
op
[
i
],
false
);
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes
[
i
],
op
[
i
]
);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes
01
[
i
],
op
[
i
],
true
);
}
}
printf
(
"--------------------json string---------------------
\n
"
);
printf
(
"--------------------json string-
0 op {1, 8, 2, 2, 3, 0, -4, 9}
--------------------
\n
"
);
key
=
"k2"
;
key
=
"k2"
;
double
eRes1
[
len
]
=
{
1.0
,
-
8
,
0
,
0
,
0
,
0
,
0
,
9
};
double
eRes10
[
len
]
=
{
1.0
,
-
8
,
0
,
0
,
0
,
0
,
0
,
9
};
double
eRes11
[
len
]
=
{
1.0
,
8
,
0
,
DBL_MAX
,
DBL_MAX
,
0
,
0
,
9
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes1
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes10
[
i
],
op
[
i
],
false
);
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes11
[
i
],
op
[
i
],
true
);
}
}
printf
(
"---------------------json null--------------------
\n
"
);
printf
(
"---------------------json null-
null op {1, 8, 2, 2, 3, 0, -4, 9}
-------------------
\n
"
);
key
=
"k3"
;
key
=
"k3"
;
double
eRes2
[
len
]
=
{
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
};
double
eRes20
[
len
]
=
{
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
};
double
eRes21
[
len
]
=
{
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
0
,
DBL_MAX
,
DBL_MAX
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes20
[
i
],
op
[
i
],
false
);
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes2
[
i
],
op
[
i
]
);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes2
1
[
i
],
op
[
i
],
true
);
}
}
printf
(
"---------------------json bool--------------------
\n
"
);
printf
(
"---------------------json bool-
true op {1, 8, 2, 2, 3, 0, -4, 9}
-------------------
\n
"
);
key
=
"k4"
;
key
=
"k4"
;
double
eRes3
[
len
]
=
{
2.0
,
-
7
,
2
,
0.5
,
1
,
-
1
,
1
&-
4
,
1
|
9
};
double
eRes30
[
len
]
=
{
2.0
,
-
7
,
2
,
0.5
,
1
,
-
1
,
1
&-
4
,
1
|
9
};
double
eRes31
[
len
]
=
{
2.0
,
7
,
2
,
2
,
0
,
0
,
1
&-
4
,
1
|
9
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes30
[
i
],
op
[
i
],
false
);
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes3
[
i
],
op
[
i
]
);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes3
1
[
i
],
op
[
i
],
true
);
}
}
printf
(
"----------------------json double-------------------
\n
"
);
printf
(
"----------------------json double--
5.44 op {1, 8, 2, 2, 3, 0, -4, 9}-
-----------------
\n
"
);
key
=
"k5"
;
key
=
"k5"
;
double
eRes4
[
len
]
=
{
6.44
,
-
2.56
,
10.88
,
2.72
,
2.44
,
-
5.44
,
5
&-
4
,
5
|
9
};
double
eRes40
[
len
]
=
{
6.44
,
-
2.56
,
10.88
,
2.72
,
2.44
,
-
5.44
,
5
&-
4
,
5
|
9
};
double
eRes41
[
len
]
=
{
6.44
,
2.56
,
10.88
,
0.3676470588235294
,
3
,
0
,
5
&-
4
,
5
|
9
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes40
[
i
],
op
[
i
],
false
);
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes41
[
i
],
op
[
i
],
true
);
}
printf
(
"----------------------json int-- -10 op {1, 8, 2, 2, 3, 0, -4, 9}------------------
\n
"
);
key
=
"k6"
;
double
eRes50
[
len
]
=
{
-
9
,
-
18
,
-
20
,
-
5
,
-
10
%
3
,
10
,
-
10
&-
4
,
-
10
|
9
};
double
eRes51
[
len
]
=
{
-
9
,
18
,
-
20
,
-
0.2
,
3
%-
10
,
0
,
-
10
&-
4
,
-
10
|
9
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes50
[
i
],
op
[
i
],
false
);
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes51
[
i
],
op
[
i
],
true
);
}
printf
(
"----------------------json double-- -9.8 op {1, 8, 2, 2, 3, 0, -4, 9}------------------
\n
"
);
key
=
"k7"
;
double
eRes60
[
len
]
=
{
-
8.8
,
-
17.8
,
-
19.6
,
-
4.9
,
-
0.8
,
9.8
,
-
9
&-
4
,
-
9
|
9
};
double
eRes61
[
len
]
=
{
-
8.8
,
17.8
,
-
19.6
,
-
0.2040816326530612
,
3
,
0
,
-
9
&-
4
,
-
9
|
9
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes60
[
i
],
op
[
i
],
false
);
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes61
[
i
],
op
[
i
],
true
);
}
printf
(
"----------------------json bool-- 0 op {1, 8, 2, 2, 3, 0, -4, 9}------------------
\n
"
);
key
=
"k8"
;
double
eRes70
[
len
]
=
{
1.0
,
-
8
,
0
,
0
,
0
,
0
,
0
,
9
};
double
eRes71
[
len
]
=
{
1.0
,
8
,
0
,
DBL_MAX
,
DBL_MAX
,
0
,
0
,
9
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes70
[
i
],
op
[
i
],
false
);
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes71
[
i
],
op
[
i
],
true
);
}
printf
(
"----------------------json string-- 8 op {1, 8, 2, 2, 3, 0, -4, 9}------------------
\n
"
);
key
=
"k9"
;
double
eRes80
[
len
]
=
{
9
,
0
,
16
,
4
,
8
%
3
,
-
8
,
8
&-
4
,
8
|
9
};
double
eRes81
[
len
]
=
{
9
,
0
,
16
,
0.25
,
3
%
8
,
0
,
8
&-
4
,
8
|
9
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes80
[
i
],
op
[
i
],
false
);
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes
4
[
i
],
op
[
i
]
);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes
81
[
i
],
op
[
i
],
true
);
}
}
printf
(
"---------------------json not exist--------------------
\n
"
);
printf
(
"---------------------json not exist--
NULL op {1, 8, 2, 2, 3, 0, -4, 9}
------------------
\n
"
);
key
=
"k10"
;
key
=
"k10"
;
double
eRes5
[
len
]
=
{
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
};
double
eRes90
[
len
]
=
{
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
};
double
eRes91
[
len
]
=
{
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
DBL_MAX
,
0
,
DBL_MAX
,
DBL_MAX
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes5
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes90
[
i
],
op
[
i
],
false
);
}
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes91
[
i
],
op
[
i
],
true
);
}
}
taosArrayDestroy
(
tags
);
taosArrayDestroy
(
tags
);
...
@@ -1183,7 +1274,7 @@ void *prepareNchar(char* rightData){
...
@@ -1183,7 +1274,7 @@ void *prepareNchar(char* rightData){
TEST
(
columnTest
,
json_column_logic_op
)
{
TEST
(
columnTest
,
json_column_logic_op
)
{
scltInitLogFile
();
scltInitLogFile
();
char
*
rightvTmp
=
"{
\"
k1
\"
:4,
\"
k2
\"
:
\"
hello
\"
,
\"
k3
\"
:null,
\"
k4
\"
:true,
\"
k5
\"
:5.44,
\"
k6
\"
:
\"
6.6hello
\"
}"
;
char
*
rightvTmp
=
"{
\"
k1
\"
:4,
\"
k2
\"
:
\"
hello
\"
,
\"
k3
\"
:null,
\"
k4
\"
:true,
\"
k5
\"
:5.44,
\"
k6
\"
:
-10,
\"
k7
\"
:-9.8,
\"
k8
\"
:false,
\"
k9
\"
:
\"
6.6hello
\"
}"
;
char
rightv
[
256
]
=
{
0
};
char
rightv
[
256
]
=
{
0
};
memcpy
(
rightv
,
rightvTmp
,
strlen
(
rightvTmp
));
memcpy
(
rightv
,
rightvTmp
,
strlen
(
rightvTmp
));
...
@@ -1191,6 +1282,7 @@ TEST(columnTest, json_column_logic_op) {
...
@@ -1191,6 +1282,7 @@ TEST(columnTest, json_column_logic_op) {
STag
*
row
=
NULL
;
STag
*
row
=
NULL
;
parseJsontoTagData
(
rightv
,
tags
,
&
row
,
NULL
);
parseJsontoTagData
(
rightv
,
tags
,
&
row
,
NULL
);
const
int32_t
len0
=
6
;
const
int32_t
len
=
9
;
const
int32_t
len
=
9
;
const
int32_t
len1
=
4
;
const
int32_t
len1
=
4
;
EOperatorType
op
[
len
+
len1
]
=
{
OP_TYPE_GREATER_THAN
,
OP_TYPE_GREATER_EQUAL
,
OP_TYPE_LOWER_THAN
,
OP_TYPE_LOWER_EQUAL
,
OP_TYPE_EQUAL
,
OP_TYPE_NOT_EQUAL
,
EOperatorType
op
[
len
+
len1
]
=
{
OP_TYPE_GREATER_THAN
,
OP_TYPE_GREATER_EQUAL
,
OP_TYPE_LOWER_THAN
,
OP_TYPE_LOWER_EQUAL
,
OP_TYPE_EQUAL
,
OP_TYPE_NOT_EQUAL
,
...
@@ -1199,93 +1291,183 @@ TEST(columnTest, json_column_logic_op) {
...
@@ -1199,93 +1291,183 @@ TEST(columnTest, json_column_logic_op) {
int32_t
input
[
len
]
=
{
1
,
8
,
2
,
2
,
3
,
0
,
0
,
0
,
0
};
int32_t
input
[
len
]
=
{
1
,
8
,
2
,
2
,
3
,
0
,
0
,
0
,
0
};
char
*
inputNchar
[
len1
]
=
{
"hell_"
,
"hel%"
,
"hell"
,
"llll"
};
char
*
inputNchar
[
len1
]
=
{
"hell_"
,
"hel%"
,
"hell"
,
"llll"
};
printf
(
"--------------------json int---------------------
\n
"
);
printf
(
"--------------------json int---
4 {1, 8, 2, 2, 3, 0, 0, 0, 0}
------------------
\n
"
);
char
*
key
=
"k1"
;
char
*
key
=
"k1"
;
bool
eRes
[
len
+
len1
]
=
{
true
,
false
,
false
,
false
,
false
,
true
,
false
,
true
,
true
,
false
,
false
,
false
,
false
};
bool
eRes
[
len
+
len1
]
=
{
true
,
false
,
false
,
false
,
false
,
true
,
false
,
true
,
true
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes
[
i
],
op
[
i
],
false
);
}
bool
eRes_0
[
len0
]
=
{
false
,
true
,
true
,
true
,
false
,
true
};
for
(
int
i
=
0
;
i
<
len0
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes_0
[
i
],
op
[
i
],
true
);
}
}
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes
[
i
],
op
[
i
]
,
false
);
taosMemoryFree
(
rightData
);
taosMemoryFree
(
rightData
);
}
}
printf
(
"--------------------json string---------------------
\n
"
);
printf
(
"--------------------json string--
0 {1, 8, 2, 2, 3, 0, 0, 0, 0}
-------------------
\n
"
);
key
=
"k2"
;
key
=
"k2"
;
bool
eRes1
[
len
+
len1
]
=
{
false
,
false
,
true
,
true
,
false
,
false
,
false
,
true
,
false
,
true
,
false
,
true
,
true
};
bool
eRes1
[
len
+
len1
]
=
{
false
,
false
,
true
,
true
,
false
,
false
,
false
,
true
,
false
,
true
,
false
,
true
,
true
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes1
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes1
[
i
],
op
[
i
]
,
false
);
}
}
bool
eRes_1
[
len0
]
=
{
true
,
true
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len0
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes_1
[
i
],
op
[
i
],
true
);
}
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes1
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes1
[
i
],
op
[
i
]
,
false
);
taosMemoryFree
(
rightData
);
taosMemoryFree
(
rightData
);
}
}
printf
(
"--------------------json null---------------------
\n
"
);
printf
(
"--------------------json null---
null {1, 8, 2, 2, 3, 0, 0, 0, 0}
------------------
\n
"
);
key
=
"k3"
;
// (null is true) return NULL, so use DBL_MAX represent NULL
key
=
"k3"
;
// (null is true) return NULL, so use DBL_MAX represent NULL
double
eRes2
[
len
+
len1
]
=
{
false
,
false
,
false
,
false
,
false
,
false
,
true
,
false
,
DBL_MAX
,
false
,
false
,
false
,
false
};
double
eRes2
[
len
+
len1
]
=
{
false
,
false
,
false
,
false
,
false
,
false
,
true
,
false
,
DBL_MAX
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes2
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes2
[
i
],
op
[
i
],
false
);
}
bool
eRes_2
[
len0
]
=
{
false
,
false
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len0
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes_2
[
i
],
op
[
i
],
true
);
}
}
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes2
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes2
[
i
],
op
[
i
]
,
false
);
taosMemoryFree
(
rightData
);
taosMemoryFree
(
rightData
);
}
}
printf
(
"--------------------json bool---------------------
\n
"
);
printf
(
"--------------------json bool--
1 {1, 8, 2, 2, 3, 0, 0, 0, 0}
-------------------
\n
"
);
key
=
"k4"
;
key
=
"k4"
;
bool
eRes3
[
len
+
len1
]
=
{
false
,
false
,
true
,
true
,
false
,
true
,
false
,
true
,
true
,
false
,
false
,
false
,
false
};
bool
eRes3
[
len
+
len1
]
=
{
false
,
false
,
true
,
true
,
false
,
true
,
false
,
true
,
true
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes3
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes3
[
i
],
op
[
i
],
false
);
}
bool
eRes_3
[
len0
]
=
{
false
,
true
,
false
,
false
,
false
,
true
};
for
(
int
i
=
0
;
i
<
len0
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes_3
[
i
],
op
[
i
],
true
);
}
}
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes3
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes3
[
i
],
op
[
i
]
,
false
);
taosMemoryFree
(
rightData
);
taosMemoryFree
(
rightData
);
}
}
printf
(
"--------------------json double---------------------
\n
"
);
printf
(
"--------------------json double--
5.44 {1, 8, 2, 2, 3, 0, 0, 0, 0}
-------------------
\n
"
);
key
=
"k5"
;
key
=
"k5"
;
bool
eRes4
[
len
+
len1
]
=
{
true
,
false
,
false
,
false
,
false
,
true
,
false
,
true
,
true
,
false
,
false
,
false
,
false
};
bool
eRes4
[
len
+
len1
]
=
{
true
,
false
,
false
,
false
,
false
,
true
,
false
,
true
,
true
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes4
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes4
[
i
],
op
[
i
]
,
false
);
}
}
bool
eRes_4
[
len0
]
=
{
false
,
true
,
true
,
true
,
false
,
true
};
for
(
int
i
=
0
;
i
<
len0
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes_4
[
i
],
op
[
i
],
true
);
}
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes4
[
i
],
op
[
i
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes4
[
i
],
op
[
i
]
,
false
);
taosMemoryFree
(
rightData
);
taosMemoryFree
(
rightData
);
}
}
printf
(
"--------------------json
double--
-------------------
\n
"
);
printf
(
"--------------------json
int-- -10 {1, 8, 2, 2, 3, 0, 0, 0, 0}
-------------------
\n
"
);
key
=
"k6"
;
key
=
"k6"
;
bool
eRes5
[
len
+
len1
]
=
{
true
,
false
,
false
,
false
,
false
,
true
,
false
,
true
,
true
,
false
,
true
,
false
,
true
};
bool
eRes5
[
len
+
len1
]
=
{
false
,
false
,
true
,
true
,
false
,
true
,
false
,
true
,
true
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes5
[
i
],
op
[
i
],
false
);
}
bool
eRes_5
[
len0
]
=
{
true
,
true
,
false
,
false
,
false
,
true
};
for
(
int
i
=
0
;
i
<
len0
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes_5
[
i
],
op
[
i
],
true
);
}
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes5
[
i
],
op
[
i
],
false
);
taosMemoryFree
(
rightData
);
}
printf
(
"--------------------json double-- -9.8 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------
\n
"
);
key
=
"k7"
;
bool
eRes6
[
len
+
len1
]
=
{
false
,
false
,
true
,
true
,
false
,
true
,
false
,
true
,
true
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes
5
[
i
],
op
[
i
]
);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes
6
[
i
],
op
[
i
],
false
);
}
}
bool
eRes_6
[
len0
]
=
{
true
,
true
,
false
,
false
,
false
,
true
};
for
(
int
i
=
0
;
i
<
len0
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes_6
[
i
],
op
[
i
],
true
);
}
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes
5
[
i
],
op
[
i
]
);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes
6
[
i
],
op
[
i
],
false
);
taosMemoryFree
(
rightData
);
taosMemoryFree
(
rightData
);
}
}
printf
(
"---------------------json not exist--------------------
\n
"
);
printf
(
"--------------------json bool-- 0 {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------
\n
"
);
key
=
"k8"
;
bool
eRes7
[
len
+
len1
]
=
{
false
,
false
,
true
,
true
,
false
,
false
,
false
,
true
,
false
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes7
[
i
],
op
[
i
],
false
);
}
bool
eRes_7
[
len0
]
=
{
true
,
true
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len0
;
i
++
)
{
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes_7
[
i
],
op
[
i
],
true
);
}
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes7
[
i
],
op
[
i
],
false
);
taosMemoryFree
(
rightData
);
}
printf
(
"--------------------json string-- 6.6hello {1, 8, 2, 2, 3, 0, 0, 0, 0}-------------------
\n
"
);
key
=
"k9"
;
bool
eRes8
[
len
+
len1
]
=
{
true
,
false
,
false
,
false
,
false
,
true
,
false
,
true
,
true
,
false
,
true
,
false
,
true
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes8
[
i
],
op
[
i
],
false
);
}
bool
eRes_8
[
len0
]
=
{
false
,
true
,
true
,
true
,
false
,
true
};
for
(
int
i
=
0
;
i
<
len0
;
i
++
)
{
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes_8
[
i
],
op
[
i
],
true
);
}
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes8
[
i
],
op
[
i
],
false
);
taosMemoryFree
(
rightData
);
}
printf
(
"---------------------json not exist-- NULL {1, 8, 2, 2, 3, 0, 0, 0, 0}------------------
\n
"
);
key
=
"k10"
;
// (NULL is true) return NULL, so use DBL_MAX represent NULL
key
=
"k10"
;
// (NULL is true) return NULL, so use DBL_MAX represent NULL
double
eRes
10
[
len
+
len1
]
=
{
false
,
false
,
false
,
false
,
false
,
false
,
true
,
false
,
DBL_MAX
,
false
,
false
,
false
,
false
};
double
eRes
9
[
len
+
len1
]
=
{
false
,
false
,
false
,
false
,
false
,
false
,
true
,
false
,
DBL_MAX
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len
;
i
++
){
for
(
int
i
=
0
;
i
<
len
;
i
++
){
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes
10
[
i
],
op
[
i
]
);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes
9
[
i
],
op
[
i
],
false
);
}
}
bool
eRes_9
[
len0
]
=
{
false
,
false
,
false
,
false
,
false
,
false
};
for
(
int
i
=
0
;
i
<
len0
;
i
++
)
{
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_INT
,
&
input
[
i
],
eRes_9
[
i
],
op
[
i
],
true
);
}
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
for
(
int
i
=
len
;
i
<
len
+
len1
;
i
++
){
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
void
*
rightData
=
prepareNchar
(
inputNchar
[
i
-
len
]);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes
10
[
i
],
op
[
i
]
);
makeCalculate
(
row
,
key
,
TSDB_DATA_TYPE_NCHAR
,
rightData
,
eRes
9
[
i
],
op
[
i
],
false
);
taosMemoryFree
(
rightData
);
taosMemoryFree
(
rightData
);
}
}
...
...
tests/system-test/2-query/json_tag.py
浏览文件 @
10e48241
...
@@ -137,9 +137,9 @@ class TDTestCase:
...
@@ -137,9 +137,9 @@ class TDTestCase:
tdSql
.
checkRows
(
9
)
tdSql
.
checkRows
(
9
)
tdSql
.
query
(
"select jtag from jsons1"
)
tdSql
.
query
(
"select jtag from jsons1"
)
tdSql
.
checkRows
(
13
)
tdSql
.
checkRows
(
13
)
#
tdSql.query("select jtag from jsons1 where jtag is null")
tdSql
.
query
(
"select jtag from jsons1 where jtag is null"
)
# tdSql.checkRows(5)
# tdSql.checkRows(5)
#
tdSql.query("select jtag from jsons1 where jtag is not null")
tdSql
.
query
(
"select jtag from jsons1 where jtag is not null"
)
# tdSql.checkRows(8)
# tdSql.checkRows(8)
# test jtag is NULL
# test jtag is NULL
...
@@ -260,9 +260,9 @@ class TDTestCase:
...
@@ -260,9 +260,9 @@ class TDTestCase:
# tdSql.checkRows(1)
# tdSql.checkRows(1)
#
#
# # where json is null
# # where json is null
#
tdSql.query("select * from jsons1 where jtag is null")
tdSql
.
query
(
"select * from jsons1 where jtag is null"
)
# tdSql.checkRows(1)
# tdSql.checkRows(1)
#
tdSql.query("select * from jsons1 where jtag is not null")
tdSql
.
query
(
"select * from jsons1 where jtag is not null"
)
# tdSql.checkRows(8)
# tdSql.checkRows(8)
#
#
# # where json key is null
# # where json key is null
...
@@ -389,8 +389,8 @@ class TDTestCase:
...
@@ -389,8 +389,8 @@ class TDTestCase:
tdSql
.
checkData
(
2
,
1
,
"11.000000000"
)
tdSql
.
checkData
(
2
,
1
,
"11.000000000"
)
tdSql
.
checkData
(
5
,
0
,
1
)
tdSql
.
checkData
(
5
,
0
,
1
)
tdSql
.
checkData
(
5
,
1
,
"false"
)
tdSql
.
checkData
(
5
,
1
,
"false"
)
#
tdSql.checkData(6, 0, 1)
tdSql
.
checkData
(
6
,
0
,
1
)
#
tdSql.checkData(6, 1, "null")
tdSql
.
checkData
(
6
,
1
,
"null"
)
tdSql
.
checkData
(
7
,
0
,
2
)
tdSql
.
checkData
(
7
,
0
,
2
)
tdSql
.
checkData
(
7
,
1
,
None
)
tdSql
.
checkData
(
7
,
1
,
None
)
...
@@ -409,7 +409,7 @@ class TDTestCase:
...
@@ -409,7 +409,7 @@ class TDTestCase:
tdSql
.
query
(
"select stddev(dataint),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'"
)
tdSql
.
query
(
"select stddev(dataint),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'"
)
tdSql
.
checkRows
(
8
)
tdSql
.
checkRows
(
8
)
tdSql
.
checkData
(
0
,
0
,
10
)
tdSql
.
checkData
(
0
,
0
,
10
)
#
tdSql.checkData(0, 1, None)
tdSql
.
checkData
(
0
,
1
,
None
)
tdSql
.
checkData
(
4
,
0
,
0
)
tdSql
.
checkData
(
4
,
0
,
0
)
tdSql
.
checkData
(
4
,
1
,
"5.000000000"
)
tdSql
.
checkData
(
4
,
1
,
"5.000000000"
)
tdSql
.
checkData
(
7
,
0
,
11
)
tdSql
.
checkData
(
7
,
0
,
11
)
...
@@ -424,10 +424,10 @@ class TDTestCase:
...
@@ -424,10 +424,10 @@ class TDTestCase:
# test top/bottom with group by json tag
# test top/bottom with group by json tag
tdSql
.
query
(
"select top(dataint,2),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'"
)
tdSql
.
query
(
"select top(dataint,2),jtag->'tag1' from jsons1 group by jtag->'tag1' order by jtag->'tag1'"
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkData
(
0
,
1
,
None
)
tdSql
.
checkData
(
2
,
0
,
4
)
tdSql
.
checkData
(
3
,
0
,
3
)
tdSql
.
checkData
(
3
,
0
,
3
)
tdSql
.
checkData
(
3
,
1
,
"false"
)
tdSql
.
checkData
(
3
,
1
,
"false"
)
# tdSql.checkData(3, 0, 24)
# tdSql.checkData(3, 1, None)
tdSql
.
checkData
(
10
,
0
,
23
)
tdSql
.
checkData
(
10
,
0
,
23
)
tdSql
.
checkData
(
10
,
1
,
'"femail"'
)
tdSql
.
checkData
(
10
,
1
,
'"femail"'
)
...
@@ -436,7 +436,7 @@ class TDTestCase:
...
@@ -436,7 +436,7 @@ class TDTestCase:
# tdSql.checkRows(2)
# tdSql.checkRows(2)
# subquery with json tag
# subquery with json tag
tdSql
.
query
(
"select * from (select jtag, dataint from jsons1)"
)
tdSql
.
query
(
"select * from (select jtag, dataint from jsons1)
order by dataint
"
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkRows
(
11
)
tdSql
.
checkData
(
1
,
1
,
1
)
tdSql
.
checkData
(
1
,
1
,
1
)
tdSql
.
checkData
(
2
,
0
,
'{"tag1":5,"tag2":"beijing"}'
)
tdSql
.
checkData
(
2
,
0
,
'{"tag1":5,"tag2":"beijing"}'
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录