Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
aa556cb4
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看板
提交
aa556cb4
编写于
2月 23, 2022
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feature/qnode
上级
b5982c5c
变更
14
展开全部
显示空白变更内容
内联
并排
Showing
14 changed file
with
312 addition
and
329 deletion
+312
-329
include/libs/nodes/querynodes.h
include/libs/nodes/querynodes.h
+0
-44
include/libs/scalar/filter.h
include/libs/scalar/filter.h
+19
-1
include/util/tdef.h
include/util/tdef.h
+45
-31
source/common/src/tname.c
source/common/src/tname.c
+1
-1
source/common/src/ttypes.c
source/common/src/ttypes.c
+1
-1
source/libs/function/src/texpr.c
source/libs/function/src/texpr.c
+6
-5
source/libs/parser/src/parserUtil.c
source/libs/parser/src/parserUtil.c
+20
-20
source/libs/parser/test/parserTests.cpp
source/libs/parser/test/parserTests.cpp
+1
-1
source/libs/scalar/inc/filterInt.h
source/libs/scalar/inc/filterInt.h
+4
-24
source/libs/scalar/inc/sclvector.h
source/libs/scalar/inc/sclvector.h
+0
-1
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+187
-168
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+0
-3
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+14
-15
source/util/src/compare.c
source/util/src/compare.c
+14
-14
未找到文件。
include/libs/nodes/querynodes.h
浏览文件 @
aa556cb4
...
...
@@ -81,45 +81,6 @@ typedef struct SValueNode {
}
datum
;
}
SValueNode
;
typedef
enum
EOperatorType
{
// arithmetic operator
OP_TYPE_ADD
=
1
,
OP_TYPE_SUB
,
OP_TYPE_MULTI
,
OP_TYPE_DIV
,
OP_TYPE_MOD
,
// bit operator
OP_TYPE_BIT_AND
,
OP_TYPE_BIT_OR
,
// comparison operator
OP_TYPE_GREATER_THAN
,
OP_TYPE_GREATER_EQUAL
,
OP_TYPE_LOWER_THAN
,
OP_TYPE_LOWER_EQUAL
,
OP_TYPE_EQUAL
,
OP_TYPE_NOT_EQUAL
,
OP_TYPE_IN
,
OP_TYPE_NOT_IN
,
OP_TYPE_LIKE
,
OP_TYPE_NOT_LIKE
,
OP_TYPE_MATCH
,
OP_TYPE_NMATCH
,
OP_TYPE_IS_NULL
,
OP_TYPE_IS_NOT_NULL
,
OP_TYPE_IS_TRUE
,
OP_TYPE_IS_FALSE
,
OP_TYPE_IS_UNKNOWN
,
OP_TYPE_IS_NOT_TRUE
,
OP_TYPE_IS_NOT_FALSE
,
OP_TYPE_IS_NOT_UNKNOWN
,
// json operator
OP_TYPE_JSON_GET_VALUE
,
OP_TYPE_JSON_CONTAINS
}
EOperatorType
;
typedef
struct
SOperatorNode
{
SExprNode
node
;
// QUERY_NODE_OPERATOR
EOperatorType
opType
;
...
...
@@ -127,11 +88,6 @@ typedef struct SOperatorNode {
SNode
*
pRight
;
}
SOperatorNode
;
typedef
enum
ELogicConditionType
{
LOGIC_COND_TYPE_AND
,
LOGIC_COND_TYPE_OR
,
LOGIC_COND_TYPE_NOT
,
}
ELogicConditionType
;
typedef
struct
SLogicConditionNode
{
SExprNode
node
;
// QUERY_NODE_LOGIC_CONDITION
...
...
include/libs/scalar/filter.h
浏览文件 @
aa556cb4
...
...
@@ -20,6 +20,14 @@ extern "C" {
#endif
typedef
struct
SFilterInfo
SFilterInfo
;
typedef
int32_t
(
*
filer_get_col_from_id
)(
void
*
,
int32_t
,
void
**
);
enum
{
FLT_OPTION_NO_REWRITE
=
1
,
FLT_OPTION_TIMESTAMP
=
2
,
FLT_OPTION_NEED_UNIQE
=
4
,
};
typedef
struct
SFilterColumnParam
{
int32_t
numOfCols
;
...
...
@@ -27,6 +35,16 @@ typedef struct SFilterColumnParam{
}
SFilterColumnParam
;
extern
int32_t
filterInitFromNode
(
SNode
*
pNode
,
SFilterInfo
**
pinfo
,
uint32_t
options
);
extern
bool
filterExecute
(
SFilterInfo
*
info
,
SSDataBlock
*
pSrc
,
int8_t
**
p
,
SColumnDataAgg
*
statis
,
int16_t
numOfCols
);
extern
int32_t
filterSetDataFromSlotId
(
SFilterInfo
*
info
,
void
*
param
,
filer_get_col_from_id
fp
);
extern
int32_t
filterSetDataFromColId
(
SFilterInfo
*
info
,
void
*
param
,
filer_get_col_from_id
fp
);
extern
int32_t
filterGetTimeRange
(
SFilterInfo
*
info
,
STimeWindow
*
win
);
extern
int32_t
filterConverNcharColumns
(
SFilterInfo
*
pFilterInfo
,
int32_t
rows
,
bool
*
gotNchar
);
extern
int32_t
filterFreeNcharColumns
(
SFilterInfo
*
pFilterInfo
);
extern
void
filterFreeInfo
(
SFilterInfo
*
info
);
extern
bool
filterRangeExecute
(
SFilterInfo
*
info
,
SColumnDataAgg
*
pDataStatis
,
int32_t
numOfCols
,
int32_t
numOfRows
);
#ifdef __cplusplus
}
#endif
...
...
include/util/tdef.h
浏览文件 @
aa556cb4
...
...
@@ -108,35 +108,52 @@ do { \
(src) = (void *)((char *)src + sizeof(type));\
} while(0)
typedef
enum
EOperatorType
{
// arithmetic operator
OP_TYPE_ADD
=
1
,
OP_TYPE_SUB
,
OP_TYPE_MULTI
,
OP_TYPE_DIV
,
OP_TYPE_MOD
,
// bit operator
OP_TYPE_BIT_AND
,
OP_TYPE_BIT_OR
,
// comparison operator
OP_TYPE_GREATER_THAN
,
OP_TYPE_GREATER_EQUAL
,
OP_TYPE_LOWER_THAN
,
OP_TYPE_LOWER_EQUAL
,
OP_TYPE_EQUAL
,
OP_TYPE_NOT_EQUAL
,
OP_TYPE_IN
,
OP_TYPE_NOT_IN
,
OP_TYPE_LIKE
,
OP_TYPE_NOT_LIKE
,
OP_TYPE_MATCH
,
OP_TYPE_NMATCH
,
OP_TYPE_IS_NULL
,
OP_TYPE_IS_NOT_NULL
,
OP_TYPE_IS_TRUE
,
OP_TYPE_IS_FALSE
,
OP_TYPE_IS_UNKNOWN
,
OP_TYPE_IS_NOT_TRUE
,
OP_TYPE_IS_NOT_FALSE
,
OP_TYPE_IS_NOT_UNKNOWN
,
// json operator
OP_TYPE_JSON_GET_VALUE
,
OP_TYPE_JSON_CONTAINS
}
EOperatorType
;
typedef
enum
ELogicConditionType
{
LOGIC_COND_TYPE_AND
,
LOGIC_COND_TYPE_OR
,
LOGIC_COND_TYPE_NOT
,
}
ELogicConditionType
;
// TODO: check if below is necessary
#define TSDB_RELATION_INVALID 0
#define TSDB_RELATION_LESS 1
#define TSDB_RELATION_GREATER 2
#define TSDB_RELATION_EQUAL 3
#define TSDB_RELATION_LESS_EQUAL 4
#define TSDB_RELATION_GREATER_EQUAL 5
#define TSDB_RELATION_NOT_EQUAL 6
#define TSDB_RELATION_LIKE 7
#define TSDB_RELATION_NOT_LIKE 8
#define TSDB_RELATION_ISNULL 9
#define TSDB_RELATION_NOTNULL 10
#define TSDB_RELATION_IN 11
#define TSDB_RELATION_NOT_IN 12
#define TSDB_RELATION_AND 13
#define TSDB_RELATION_OR 14
#define TSDB_RELATION_NOT 15
#define TSDB_RELATION_MATCH 16
#define TSDB_RELATION_NMATCH 17
#define TSDB_BINARY_OP_ADD 4000
#define TSDB_BINARY_OP_SUBTRACT 4001
#define TSDB_BINARY_OP_MULTIPLY 4002
#define TSDB_BINARY_OP_DIVIDE 4003
#define TSDB_BINARY_OP_REMAINDER 4004
#define TSDB_BINARY_OP_CONCAT 4005
#define FUNCTION_CEIL 4500
#define FUNCTION_FLOOR 4501
...
...
@@ -148,9 +165,6 @@ do { \
#define FUNCTION_LTRIM 4802
#define FUNCTION_RTRIM 4803
#define IS_RELATION_OPTR(op) (((op) >= TSDB_RELATION_LESS) && ((op) < TSDB_RELATION_IN))
#define IS_ARITHMETIC_OPTR(op) (((op) >= TSDB_BINARY_OP_ADD) && ((op) <= TSDB_BINARY_OP_REMAINDER))
#define TSDB_NAME_DELIMITER_LEN 1
#define TSDB_UNI_LEN 24
...
...
source/common/src/tname.c
浏览文件 @
aa556cb4
...
...
@@ -31,7 +31,7 @@ SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFil
}
assert
(
src
->
filterstr
==
0
||
src
->
filterstr
==
1
);
assert
(
!
(
src
->
lowerRelOptr
==
TSDB_RELATION_INVALID
&&
src
->
upperRelOptr
==
TSDB_RELATION_INVALID
));
assert
(
!
(
src
->
lowerRelOptr
==
0
&&
src
->
upperRelOptr
==
0
));
return
pFilter
;
}
...
...
source/common/src/ttypes.c
浏览文件 @
aa556cb4
...
...
@@ -585,7 +585,7 @@ void assignVal(char *val, const char *src, int32_t len, int32_t type) {
}
void
operateVal
(
void
*
dst
,
void
*
s1
,
void
*
s2
,
int32_t
optr
,
int32_t
type
)
{
if
(
optr
==
TSDB_BINARY_OP
_ADD
)
{
if
(
optr
==
OP_TYPE
_ADD
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_TINYINT
:
*
((
int8_t
*
)
dst
)
=
GET_INT8_VAL
(
s1
)
+
GET_INT8_VAL
(
s2
);
...
...
source/libs/function/src/texpr.c
浏览文件 @
aa556cb4
...
...
@@ -25,6 +25,7 @@
#include "thash.h"
#include "texpr.h"
#include "tvariant.h"
#include "tdef.h"
//static uint8_t UNUSED_FUNC isQueryOnPrimaryKey(const char *primaryColumnName, const tExprNode *pLeft, const tExprNode *pRight) {
// if (pLeft->nodeType == TEXPR_COL_NODE) {
...
...
@@ -94,7 +95,7 @@ bool exprTreeApplyFilter(tExprNode *pExpr, const void *pItem, SExprTraverseSupp
//non-leaf nodes, recursively traverse the expression tree in the post-root order
if
(
pLeft
->
nodeType
==
TEXPR_BINARYEXPR_NODE
&&
pRight
->
nodeType
==
TEXPR_BINARYEXPR_NODE
)
{
if
(
pExpr
->
_node
.
optr
==
TSDB_RELATION
_OR
)
{
// or
if
(
pExpr
->
_node
.
optr
==
LOGIC_COND_TYPE
_OR
)
{
// or
if
(
exprTreeApplyFilter
(
pLeft
,
pItem
,
param
))
{
return
true
;
}
...
...
@@ -255,7 +256,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
if
(
strncmp
(
tbnameCond
,
QUERY_COND_REL_PREFIX_LIKE
,
QUERY_COND_REL_PREFIX_LIKE_LEN
)
==
0
)
{
right
->
nodeType
=
TEXPR_VALUE_NODE
;
expr
->
_node
.
optr
=
TSDB_RELATION
_LIKE
;
expr
->
_node
.
optr
=
OP_TYPE
_LIKE
;
SVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
SVariant
));
right
->
pVal
=
pVal
;
size_t
len
=
strlen
(
tbnameCond
+
QUERY_COND_REL_PREFIX_LIKE_LEN
)
+
1
;
...
...
@@ -266,7 +267,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
}
else
if
(
strncmp
(
tbnameCond
,
QUERY_COND_REL_PREFIX_MATCH
,
QUERY_COND_REL_PREFIX_MATCH_LEN
)
==
0
)
{
right
->
nodeType
=
TEXPR_VALUE_NODE
;
expr
->
_node
.
optr
=
TSDB_RELATION
_MATCH
;
expr
->
_node
.
optr
=
OP_TYPE
_MATCH
;
SVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
SVariant
));
right
->
pVal
=
pVal
;
size_t
len
=
strlen
(
tbnameCond
+
QUERY_COND_REL_PREFIX_MATCH_LEN
)
+
1
;
...
...
@@ -276,7 +277,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
pVal
->
nLen
=
(
int32_t
)
len
;
}
else
if
(
strncmp
(
tbnameCond
,
QUERY_COND_REL_PREFIX_NMATCH
,
QUERY_COND_REL_PREFIX_NMATCH_LEN
)
==
0
)
{
right
->
nodeType
=
TEXPR_VALUE_NODE
;
expr
->
_node
.
optr
=
TSDB_RELATION
_NMATCH
;
expr
->
_node
.
optr
=
OP_TYPE
_NMATCH
;
SVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
SVariant
));
right
->
pVal
=
pVal
;
size_t
len
=
strlen
(
tbnameCond
+
QUERY_COND_REL_PREFIX_NMATCH_LEN
)
+
1
;
...
...
@@ -286,7 +287,7 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
pVal
->
nLen
=
(
int32_t
)
len
;
}
else
if
(
strncmp
(
tbnameCond
,
QUERY_COND_REL_PREFIX_IN
,
QUERY_COND_REL_PREFIX_IN_LEN
)
==
0
)
{
right
->
nodeType
=
TEXPR_VALUE_NODE
;
expr
->
_node
.
optr
=
TSDB_RELATION
_IN
;
expr
->
_node
.
optr
=
OP_TYPE
_IN
;
SVariant
*
pVal
=
exception_calloc
(
1
,
sizeof
(
SVariant
));
right
->
pVal
=
pVal
;
pVal
->
nType
=
TSDB_DATA_TYPE_POINTER_ARRAY
;
...
...
source/libs/parser/src/parserUtil.c
浏览文件 @
aa556cb4
...
...
@@ -884,7 +884,7 @@ SColumnFilterInfo* tFilterInfoDup(const SColumnFilterInfo* src, int32_t numOfFil
}
assert
(
src
->
filterstr
==
0
||
src
->
filterstr
==
1
);
assert
(
!
(
src
->
lowerRelOptr
==
TSDB_RELATION_INVALID
&&
src
->
upperRelOptr
==
TSDB_RELATION_INVALID
));
assert
(
!
(
src
->
lowerRelOptr
==
0
&&
src
->
upperRelOptr
==
0
));
return
pFilter
;
}
...
...
@@ -1507,45 +1507,45 @@ int32_t getTagFilterSerializeLen(SQueryStmtInfo* pQueryInfo) {
uint32_t
convertRelationalOperator
(
SToken
*
pToken
)
{
switch
(
pToken
->
type
)
{
case
TK_LT
:
return
TSDB_RELATION_LESS
;
return
OP_TYPE_LOWER_THAN
;
case
TK_LE
:
return
TSDB_RELATION_LESS
_EQUAL
;
return
OP_TYPE_LOWER
_EQUAL
;
case
TK_GT
:
return
TSDB_RELATION_GREATER
;
return
OP_TYPE_GREATER_THAN
;
case
TK_GE
:
return
TSDB_RELATION
_GREATER_EQUAL
;
return
OP_TYPE
_GREATER_EQUAL
;
case
TK_NE
:
return
TSDB_RELATION
_NOT_EQUAL
;
return
OP_TYPE
_NOT_EQUAL
;
case
TK_AND
:
return
TSDB_RELATION
_AND
;
return
LOGIC_COND_TYPE
_AND
;
case
TK_OR
:
return
TSDB_RELATION
_OR
;
return
LOGIC_COND_TYPE
_OR
;
case
TK_EQ
:
return
TSDB_RELATION
_EQUAL
;
return
OP_TYPE
_EQUAL
;
case
TK_PLUS
:
return
TSDB_BINARY_OP
_ADD
;
return
OP_TYPE
_ADD
;
case
TK_MINUS
:
return
TSDB_BINARY_OP_SUBTRACT
;
return
OP_TYPE_SUB
;
case
TK_STAR
:
return
TSDB_BINARY_OP_MULTIPLY
;
return
OP_TYPE_MULTI
;
case
TK_SLASH
:
case
TK_DIVIDE
:
return
TSDB_BINARY_OP_DIVIDE
;
return
OP_TYPE_DIV
;
case
TK_REM
:
return
TSDB_BINARY_OP_REMAINDER
;
return
OP_TYPE_MOD
;
case
TK_LIKE
:
return
TSDB_RELATION
_LIKE
;
return
OP_TYPE
_LIKE
;
case
TK_MATCH
:
return
TSDB_RELATION
_MATCH
;
return
OP_TYPE
_MATCH
;
case
TK_NMATCH
:
return
TSDB_RELATION
_NMATCH
;
return
OP_TYPE
_NMATCH
;
case
TK_ISNULL
:
return
TSDB_RELATION_IS
NULL
;
return
OP_TYPE_IS_
NULL
;
case
TK_NOTNULL
:
return
TSDB_RELATION_NOT
NULL
;
return
OP_TYPE_IS_NOT_
NULL
;
case
TK_IN
:
return
TSDB_RELATION
_IN
;
return
OP_TYPE
_IN
;
default:
{
return
0
;
}
}
}
...
...
source/libs/parser/test/parserTests.cpp
浏览文件 @
aa556cb4
...
...
@@ -593,7 +593,7 @@ TEST(testCase, function_Test6) {
SExprInfo
*
p2
=
(
SExprInfo
*
)
taosArrayGetP
(
pQueryInfo
->
exprList
[
1
],
0
);
ASSERT_EQ
(
p2
->
pExpr
->
nodeType
,
TEXPR_BINARYEXPR_NODE
);
ASSERT_EQ
(
p2
->
pExpr
->
_node
.
optr
,
TSDB_BINARY_OP
_ADD
);
ASSERT_EQ
(
p2
->
pExpr
->
_node
.
optr
,
OP_TYPE
_ADD
);
ASSERT_EQ
(
p2
->
pExpr
->
_node
.
pLeft
->
nodeType
,
TEXPR_COL_NODE
);
ASSERT_EQ
(
p2
->
pExpr
->
_node
.
pRight
->
nodeType
,
TEXPR_COL_NODE
);
...
...
source/libs/scalar/inc/filterInt.h
浏览文件 @
aa556cb4
...
...
@@ -43,7 +43,6 @@ enum {
FLD_TYPE_COLUMN
=
1
,
FLD_TYPE_VALUE
=
2
,
FLD_TYPE_MAX
=
3
,
FLD_DESC_NO_FREE
=
4
,
FLD_DATA_NO_FREE
=
8
,
FLD_DATA_IS_HASH
=
16
,
};
...
...
@@ -61,11 +60,6 @@ enum {
RANGE_FLG_NULL
=
4
,
};
enum
{
FI_OPTION_NO_REWRITE
=
1
,
FI_OPTION_TIMESTAMP
=
2
,
FI_OPTION_NEED_UNIQE
=
4
,
};
enum
{
FI_STATUS_ALL
=
1
,
...
...
@@ -107,7 +101,6 @@ typedef struct SFilterRange {
typedef
bool
(
*
rangeCompFunc
)
(
const
void
*
,
const
void
*
,
const
void
*
,
const
void
*
,
__compar_fn_t
);
typedef
int32_t
(
*
filter_desc_compare_func
)(
const
void
*
,
const
void
*
);
typedef
bool
(
*
filter_exec_func
)(
void
*
,
int32_t
,
int8_t
**
,
SColumnDataAgg
*
,
int16_t
);
typedef
int32_t
(
*
filer_get_col_from_id
)(
void
*
,
int32_t
,
void
**
);
typedef
int32_t
(
*
filer_get_col_from_name
)(
void
*
,
int32_t
,
char
*
,
void
**
);
typedef
struct
SFilterRangeCompare
{
...
...
@@ -264,12 +257,12 @@ typedef struct SFilterInfo {
}
SFilterInfo
;
#define FILTER_NO_MERGE_DATA_TYPE(t) ((t) == TSDB_DATA_TYPE_BINARY || (t) == TSDB_DATA_TYPE_NCHAR || (t) == TSDB_DATA_TYPE_JSON)
#define FILTER_NO_MERGE_OPTR(o) ((o) ==
TSDB_RELATION_ISNULL || (o) == TSDB_RELATION_NOT
NULL || (o) == FILTER_DUMMY_EMPTY_OPTR)
#define FILTER_NO_MERGE_OPTR(o) ((o) ==
OP_TYPE_IS_NULL || (o) == OP_TYPE_IS_NOT_
NULL || (o) == FILTER_DUMMY_EMPTY_OPTR)
#define MR_EMPTY_RES(ctx) (ctx->rs == NULL)
#define SET_AND_OPTR(ctx, o) do {if (o ==
TSDB_RELATION_ISNULL) { (ctx)->isnull = true; } else if (o == TSDB_RELATION_NOT
NULL) { if (!(ctx)->isrange) { (ctx)->notnull = true; } } else if (o != FILTER_DUMMY_EMPTY_OPTR) { (ctx)->isrange = true; (ctx)->notnull = false; } } while (0)
#define SET_OR_OPTR(ctx,o) do {if (o ==
TSDB_RELATION_ISNULL) { (ctx)->isnull = true; } else if (o == TSDB_RELATION_NOT
NULL) { (ctx)->notnull = true; (ctx)->isrange = false; } else if (o != FILTER_DUMMY_EMPTY_OPTR) { if (!(ctx)->notnull) { (ctx)->isrange = true; } } } while (0)
#define SET_AND_OPTR(ctx, o) do {if (o ==
OP_TYPE_IS_NULL) { (ctx)->isnull = true; } else if (o == OP_TYPE_IS_NOT_
NULL) { if (!(ctx)->isrange) { (ctx)->notnull = true; } } else if (o != FILTER_DUMMY_EMPTY_OPTR) { (ctx)->isrange = true; (ctx)->notnull = false; } } while (0)
#define SET_OR_OPTR(ctx,o) do {if (o ==
OP_TYPE_IS_NULL) { (ctx)->isnull = true; } else if (o == OP_TYPE_IS_NOT_
NULL) { (ctx)->notnull = true; (ctx)->isrange = false; } else if (o != FILTER_DUMMY_EMPTY_OPTR) { if (!(ctx)->notnull) { (ctx)->isrange = true; } } } while (0)
#define CHK_OR_OPTR(ctx) ((ctx)->isnull == true && (ctx)->notnull == true)
#define CHK_AND_OPTR(ctx) ((ctx)->isnull == true && (((ctx)->notnull == true) || ((ctx)->isrange == true)))
...
...
@@ -351,23 +344,10 @@ typedef struct SFilterInfo {
#define FILTER_ALL_RES(i) FILTER_GET_FLAG((i)->status, FI_STATUS_ALL)
#define FILTER_EMPTY_RES(i) FILTER_GET_FLAG((i)->status, FI_STATUS_EMPTY)
#if 0
extern int32_t filterInitFromTree(tExprNode* tree, void **pinfo, uint32_t options);
extern bool filterExecute(SFilterInfo *info, int32_t numOfRows, int8_t** p, SColumnDataAgg *statis, int16_t numOfCols);
extern int32_t filterSetColFieldData(SFilterInfo *info, void *param, filer_get_col_from_id fp);
extern int32_t filterSetJsonColFieldData(SFilterInfo *info, void *param, filer_get_col_from_name fp);
extern int32_t filterGetTimeRange(SFilterInfo *info, STimeWindow *win);
extern int32_t filterConverNcharColumns(SFilterInfo* pFilterInfo, int32_t rows, bool *gotNchar);
extern int32_t filterFreeNcharColumns(SFilterInfo* pFilterInfo);
extern void filterFreeInfo(SFilterInfo *info);
extern bool filterRangeExecute(SFilterInfo *info, SColumnDataAgg *pDataStatis, int32_t numOfCols, int32_t numOfRows);
#else
//REMOVE THESE!!!!!!!!!!!!!!!!!!!!
#include "function.h"
#endif
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
);
#ifdef __cplusplus
}
#endif
...
...
source/libs/scalar/inc/sclvector.h
浏览文件 @
aa556cb4
...
...
@@ -24,7 +24,6 @@ extern "C" {
typedef
void
(
*
_bin_scalar_fn_t
)(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
output
,
int32_t
order
);
_bin_scalar_fn_t
getBinScalarOperatorFn
(
int32_t
binOperator
);
bool
isBinaryStringOp
(
int32_t
op
);
#ifdef __cplusplus
}
...
...
source/libs/scalar/src/filter.c
浏览文件 @
aa556cb4
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclfunc.c
浏览文件 @
aa556cb4
...
...
@@ -268,9 +268,6 @@ static void setScalarFuncParam(SScalarParam* param, int32_t type, int32_t bytes,
param
->
data
=
pInput
;
}
bool
isStringOp
(
int32_t
op
)
{
return
op
==
TSDB_BINARY_OP_CONCAT
;
}
#if 0
int32_t evaluateExprNodeTree(tExprNode* pExprs, int32_t numOfRows, SScalarFuncParam* pOutput, void* param,
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
aa556cb4
...
...
@@ -23,6 +23,7 @@
#include "query.h"
#include "sclInt.h"
#include "tep.h"
#include "filter.h"
//GET_TYPED_DATA(v, double, pRight->type, (char *)&((right)[i]));
...
...
@@ -1380,51 +1381,51 @@ void vectorCompare(SScalarParam* pLeft, SScalarParam* pRight, void *out, int32_t
}
void
vectorGreater
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION_GREATER
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE_GREATER_THAN
);
}
void
vectorGreaterEqual
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION
_GREATER_EQUAL
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE
_GREATER_EQUAL
);
}
void
vectorLower
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION_LESS
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE_LOWER_THAN
);
}
void
vectorLowerEqual
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION_LESS
_EQUAL
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE_LOWER
_EQUAL
);
}
void
vectorEqual
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION
_EQUAL
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE
_EQUAL
);
}
void
vectorNotEqual
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION
_NOT_EQUAL
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE
_NOT_EQUAL
);
}
void
vectorIn
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION
_IN
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE
_IN
);
}
void
vectorNotIn
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION
_NOT_IN
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE
_NOT_IN
);
}
void
vectorLike
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION
_LIKE
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE
_LIKE
);
}
void
vectorNotLike
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION
_NOT_LIKE
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE
_NOT_LIKE
);
}
void
vectorMatch
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION
_MATCH
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE
_MATCH
);
}
void
vectorNotMatch
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
TSDB_RELATION
_NMATCH
);
vectorCompare
(
pLeft
,
pRight
,
out
,
_ord
,
OP_TYPE
_NMATCH
);
}
void
vectorIsNull
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
void
*
out
,
int32_t
_ord
)
{
...
...
@@ -1543,6 +1544,4 @@ _bin_scalar_fn_t getBinScalarOperatorFn(int32_t binFunctionId) {
}
}
bool
isBinaryStringOp
(
int32_t
op
)
{
return
op
==
TSDB_BINARY_OP_CONCAT
;
}
source/util/src/compare.c
浏览文件 @
aa556cb4
...
...
@@ -466,7 +466,7 @@ int32_t compareWStrPatternNotMatch(const void* pLeft, const void* pRight) {
__compar_fn_t
getComparFunc
(
int32_t
type
,
int32_t
optr
)
{
__compar_fn_t
comparFn
=
NULL
;
if
(
optr
==
TSDB_RELATION
_IN
&&
(
type
!=
TSDB_DATA_TYPE_BINARY
&&
type
!=
TSDB_DATA_TYPE_NCHAR
))
{
if
(
optr
==
OP_TYPE
_IN
&&
(
type
!=
TSDB_DATA_TYPE_BINARY
&&
type
!=
TSDB_DATA_TYPE_NCHAR
))
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
...
...
@@ -489,7 +489,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) {
}
}
if
(
optr
==
TSDB_RELATION
_NOT_IN
&&
(
type
!=
TSDB_DATA_TYPE_BINARY
&&
type
!=
TSDB_DATA_TYPE_NCHAR
))
{
if
(
optr
==
OP_TYPE
_NOT_IN
&&
(
type
!=
TSDB_DATA_TYPE_BINARY
&&
type
!=
TSDB_DATA_TYPE_NCHAR
))
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
...
...
@@ -522,17 +522,17 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) {
case
TSDB_DATA_TYPE_FLOAT
:
comparFn
=
compareFloatVal
;
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
comparFn
=
compareDoubleVal
;
break
;
case
TSDB_DATA_TYPE_BINARY
:
{
if
(
optr
==
TSDB_RELATION
_MATCH
)
{
if
(
optr
==
OP_TYPE
_MATCH
)
{
comparFn
=
compareStrRegexCompMatch
;
}
else
if
(
optr
==
TSDB_RELATION
_NMATCH
)
{
}
else
if
(
optr
==
OP_TYPE
_NMATCH
)
{
comparFn
=
compareStrRegexCompNMatch
;
}
else
if
(
optr
==
TSDB_RELATION
_LIKE
)
{
/* wildcard query using like operator */
}
else
if
(
optr
==
OP_TYPE
_LIKE
)
{
/* wildcard query using like operator */
comparFn
=
compareStrPatternMatch
;
}
else
if
(
optr
==
TSDB_RELATION
_NOT_LIKE
)
{
/* wildcard query using like operator */
}
else
if
(
optr
==
OP_TYPE
_NOT_LIKE
)
{
/* wildcard query using like operator */
comparFn
=
compareStrPatternNotMatch
;
}
else
if
(
optr
==
TSDB_RELATION
_IN
)
{
}
else
if
(
optr
==
OP_TYPE
_IN
)
{
comparFn
=
compareChkInString
;
}
else
if
(
optr
==
TSDB_RELATION
_NOT_IN
)
{
}
else
if
(
optr
==
OP_TYPE
_NOT_IN
)
{
comparFn
=
compareChkNotInString
;
}
else
{
/* normal relational comparFn */
comparFn
=
compareLenPrefixedStr
;
...
...
@@ -542,17 +542,17 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) {
}
case
TSDB_DATA_TYPE_NCHAR
:
{
if
(
optr
==
TSDB_RELATION
_MATCH
)
{
if
(
optr
==
OP_TYPE
_MATCH
)
{
comparFn
=
compareStrRegexCompMatch
;
}
else
if
(
optr
==
TSDB_RELATION
_NMATCH
)
{
}
else
if
(
optr
==
OP_TYPE
_NMATCH
)
{
comparFn
=
compareStrRegexCompNMatch
;
}
else
if
(
optr
==
TSDB_RELATION
_LIKE
)
{
}
else
if
(
optr
==
OP_TYPE
_LIKE
)
{
comparFn
=
compareWStrPatternMatch
;
}
else
if
(
optr
==
TSDB_RELATION
_NOT_LIKE
)
{
}
else
if
(
optr
==
OP_TYPE
_NOT_LIKE
)
{
comparFn
=
compareWStrPatternNotMatch
;
}
else
if
(
optr
==
TSDB_RELATION
_IN
)
{
}
else
if
(
optr
==
OP_TYPE
_IN
)
{
comparFn
=
compareChkInString
;
}
else
if
(
optr
==
TSDB_RELATION
_NOT_IN
)
{
}
else
if
(
optr
==
OP_TYPE
_NOT_IN
)
{
comparFn
=
compareChkNotInString
;
}
else
{
comparFn
=
compareLenPrefixedWStr
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录