Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6a3124a5
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6a3124a5
编写于
7月 10, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/enh/in' into feature/3.0_debug_wxy
上级
b542b8f4
6cd21fe0
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
206 addition
and
30 deletion
+206
-30
include/libs/scalar/scalar.h
include/libs/scalar/scalar.h
+1
-1
source/libs/scalar/inc/sclInt.h
source/libs/scalar/inc/sclInt.h
+1
-1
source/libs/scalar/inc/sclvector.h
source/libs/scalar/inc/sclvector.h
+1
-1
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+9
-3
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+10
-4
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+97
-20
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+4
-0
tests/script/tsim/insert/insert_select.sim
tests/script/tsim/insert/insert_select.sim
+0
-0
tests/script/tsim/scalar/in.sim
tests/script/tsim/scalar/in.sim
+83
-0
未找到文件。
include/libs/scalar/scalar.h
浏览文件 @
6a3124a5
...
...
@@ -42,7 +42,7 @@ int32_t scalarGetOperatorParamNum(EOperatorType type);
int32_t
scalarGenerateSetFromList
(
void
**
data
,
void
*
pNode
,
uint32_t
type
);
int32_t
vectorGetConvertType
(
int32_t
type1
,
int32_t
type2
);
int32_t
vectorConvertImpl
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
);
int32_t
vectorConvertImpl
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
,
int32_t
*
overflow
);
/* Math functions */
int32_t
absFunction
(
SScalarParam
*
pInput
,
int32_t
inputNum
,
SScalarParam
*
pOutput
);
...
...
source/libs/scalar/inc/sclInt.h
浏览文件 @
6a3124a5
...
...
@@ -56,7 +56,7 @@ typedef struct SScalarCtx {
#define SCL_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; } return _code; } while (0)
#define SCL_ERR_JRET(c) do { code = c; if (code != TSDB_CODE_SUCCESS) { terrno = code; goto _return; } } while (0)
int32_t
doConvertDataType
(
SValueNode
*
pValueNode
,
SScalarParam
*
out
);
int32_t
doConvertDataType
(
SValueNode
*
pValueNode
,
SScalarParam
*
out
,
int32_t
*
overflow
);
int32_t
sclCreateColumnInfoData
(
SDataType
*
pType
,
int32_t
numOfRows
,
SScalarParam
*
pParam
);
int32_t
sclConvertToTsValueNode
(
int8_t
precision
,
SValueNode
*
valueNode
);
...
...
source/libs/scalar/inc/sclvector.h
浏览文件 @
6a3124a5
...
...
@@ -94,7 +94,7 @@ static FORCE_INLINE _getDoubleValue_fn_t getVectorDoubleValueFn(int32_t srcType)
return
p
;
}
typedef
void
(
*
_bufConverteFunc
)(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
outType
);
typedef
void
(
*
_bufConverteFunc
)(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
outType
,
int32_t
*
overflow
);
typedef
void
(
*
_bin_scalar_fn_t
)(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
output
,
int32_t
order
);
_bin_scalar_fn_t
getBinScalarOperatorFn
(
int32_t
binOperator
);
...
...
source/libs/scalar/src/filter.c
浏览文件 @
6a3124a5
...
...
@@ -1042,12 +1042,18 @@ int32_t fltAddGroupUnitFromNode(SFilterInfo *info, SNode* tree, SArray *group) {
for
(
int32_t
i
=
0
;
i
<
listNode
->
pNodeList
->
length
;
++
i
)
{
SValueNode
*
valueNode
=
(
SValueNode
*
)
cell
->
pNode
;
if
(
valueNode
->
node
.
resType
.
type
!=
type
)
{
code
=
doConvertDataType
(
valueNode
,
&
out
);
if
(
valueNode
->
node
.
resType
.
type
!=
type
)
{
int32_t
overflow
=
0
;
code
=
doConvertDataType
(
valueNode
,
&
out
,
&
overflow
);
if
(
code
)
{
// fltError("convert from %d to %d failed", in.type, out.type);
FLT_ERR_RET
(
code
);
}
if
(
overflow
)
{
cell
=
cell
->
pNext
;
continue
;
}
len
=
tDataTypes
[
type
].
bytes
;
...
...
@@ -1835,7 +1841,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
}
// todo refactor the convert
int32_t
code
=
doConvertDataType
(
var
,
&
out
);
int32_t
code
=
doConvertDataType
(
var
,
&
out
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"convert value to type[%d] failed"
,
type
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
...
...
source/libs/scalar/src/scalar.c
浏览文件 @
6a3124a5
...
...
@@ -59,7 +59,7 @@ int32_t sclCreateColumnInfoData(SDataType* pType, int32_t numOfRows, SScalarPara
return
TSDB_CODE_SUCCESS
;
}
int32_t
doConvertDataType
(
SValueNode
*
pValueNode
,
SScalarParam
*
out
)
{
int32_t
doConvertDataType
(
SValueNode
*
pValueNode
,
SScalarParam
*
out
,
int32_t
*
overflow
)
{
SScalarParam
in
=
{.
numOfRows
=
1
};
int32_t
code
=
sclCreateColumnInfoData
(
&
pValueNode
->
node
.
resType
,
1
,
&
in
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -69,7 +69,7 @@ int32_t doConvertDataType(SValueNode* pValueNode, SScalarParam* out) {
colDataAppend
(
in
.
columnData
,
0
,
nodesGetValueFromNode
(
pValueNode
),
false
);
colInfoDataEnsureCapacity
(
out
->
columnData
,
1
);
code
=
vectorConvertImpl
(
&
in
,
out
);
code
=
vectorConvertImpl
(
&
in
,
out
,
overflow
);
sclFreeParam
(
&
in
);
return
code
;
...
...
@@ -107,15 +107,21 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
out
.
columnData
->
info
.
bytes
=
tDataTypes
[
type
].
bytes
;
}
code
=
doConvertDataType
(
valueNode
,
&
out
);
int32_t
overflow
=
0
;
code
=
doConvertDataType
(
valueNode
,
&
out
,
&
overflow
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// sclError("convert data from %d to %d failed", in.type, out.type);
SCL_ERR_JRET
(
code
);
}
if
(
overflow
)
{
cell
=
cell
->
pNext
;
continue
;
}
if
(
IS_VAR_DATA_TYPE
(
type
))
{
buf
=
colDataGetVarData
(
out
.
columnData
,
0
);
len
=
varDataTLen
(
data
);
len
=
varDataTLen
(
buf
);
}
else
{
len
=
tDataTypes
[
type
].
bytes
;
buf
=
out
.
columnData
->
pData
;
...
...
source/libs/scalar/src/sclvector.c
浏览文件 @
6a3124a5
...
...
@@ -276,7 +276,7 @@ _getValueAddr_fn_t getVectorValueAddrFn(int32_t srcType) {
return
p
;
}
static
FORCE_INLINE
void
varToTimestamp
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
static
FORCE_INLINE
void
varToTimestamp
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
,
int32_t
*
overflow
)
{
int64_t
value
=
0
;
if
(
taosParseTime
(
buf
,
&
value
,
strlen
(
buf
),
pOut
->
columnData
->
info
.
precision
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
value
=
0
;
...
...
@@ -285,10 +285,26 @@ static FORCE_INLINE void varToTimestamp(char *buf, SScalarParam* pOut, int32_t r
colDataAppendInt64
(
pOut
->
columnData
,
rowIndex
,
&
value
);
}
static
FORCE_INLINE
void
varToSigned
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
static
FORCE_INLINE
void
varToSigned
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
,
int32_t
*
overflow
)
{
if
(
overflow
)
{
int64_t
minValue
=
tDataTypes
[
pOut
->
columnData
->
info
.
type
].
minValue
;
int64_t
maxValue
=
tDataTypes
[
pOut
->
columnData
->
info
.
type
].
maxValue
;
int64_t
value
=
(
int64_t
)
taosStr2Int64
(
buf
,
NULL
,
10
);
if
(
value
>
maxValue
)
{
*
overflow
=
1
;
return
;
}
else
if
(
value
<
minValue
)
{
*
overflow
=
-
1
;
return
;
}
else
{
*
overflow
=
0
;
}
}
switch
(
pOut
->
columnData
->
info
.
type
)
{
case
TSDB_DATA_TYPE_TINYINT
:
{
int8_t
value
=
(
int8_t
)
taosStr2Int8
(
buf
,
NULL
,
10
);
colDataAppendInt8
(
pOut
->
columnData
,
rowIndex
,
(
int8_t
*
)
&
value
);
break
;
}
...
...
@@ -310,7 +326,22 @@ static FORCE_INLINE void varToSigned(char *buf, SScalarParam* pOut, int32_t rowI
}
}
static
FORCE_INLINE
void
varToUnsigned
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
static
FORCE_INLINE
void
varToUnsigned
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
,
int32_t
*
overflow
)
{
if
(
overflow
)
{
uint64_t
minValue
=
(
uint64_t
)
tDataTypes
[
pOut
->
columnData
->
info
.
type
].
minValue
;
uint64_t
maxValue
=
(
uint64_t
)
tDataTypes
[
pOut
->
columnData
->
info
.
type
].
maxValue
;
uint64_t
value
=
(
uint64_t
)
taosStr2UInt64
(
buf
,
NULL
,
10
);
if
(
value
>
maxValue
)
{
*
overflow
=
1
;
return
;
}
else
if
(
value
<
minValue
)
{
*
overflow
=
-
1
;
return
;
}
else
{
*
overflow
=
0
;
}
}
switch
(
pOut
->
columnData
->
info
.
type
)
{
case
TSDB_DATA_TYPE_UTINYINT
:
{
uint8_t
value
=
(
uint8_t
)
taosStr2UInt8
(
buf
,
NULL
,
10
);
...
...
@@ -335,18 +366,24 @@ static FORCE_INLINE void varToUnsigned(char *buf, SScalarParam* pOut, int32_t ro
}
}
static
FORCE_INLINE
void
varToFloat
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
static
FORCE_INLINE
void
varToFloat
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
,
int32_t
*
overflow
)
{
if
(
TSDB_DATA_TYPE_FLOAT
==
pOut
->
columnData
->
info
.
type
)
{
float
value
=
taosStr2Float
(
buf
,
NULL
);
colDataAppendFloat
(
pOut
->
columnData
,
rowIndex
,
&
value
);
return
;
}
double
value
=
taosStr2Double
(
buf
,
NULL
);
colDataAppendDouble
(
pOut
->
columnData
,
rowIndex
,
&
value
);
}
static
FORCE_INLINE
void
varToBool
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
static
FORCE_INLINE
void
varToBool
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
,
int32_t
*
overflow
)
{
int64_t
value
=
taosStr2Int64
(
buf
,
NULL
,
10
);
bool
v
=
(
value
!=
0
)
?
true
:
false
;
colDataAppendInt8
(
pOut
->
columnData
,
rowIndex
,
(
int8_t
*
)
&
v
);
}
static
FORCE_INLINE
void
varToNchar
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
static
FORCE_INLINE
void
varToNchar
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
,
int32_t
*
overflow
)
{
int32_t
len
=
0
;
int32_t
inputLen
=
varDataLen
(
buf
);
int32_t
outputMaxLen
=
(
inputLen
+
1
)
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
;
...
...
@@ -359,7 +396,7 @@ static FORCE_INLINE void varToNchar(char* buf, SScalarParam* pOut, int32_t rowIn
taosMemoryFree
(
t
);
}
static
FORCE_INLINE
void
ncharToVar
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
)
{
static
FORCE_INLINE
void
ncharToVar
(
char
*
buf
,
SScalarParam
*
pOut
,
int32_t
rowIndex
,
int32_t
*
overflow
)
{
int32_t
inputLen
=
varDataLen
(
buf
);
char
*
t
=
taosMemoryCalloc
(
1
,
inputLen
+
VARSTR_HEADER_SIZE
);
...
...
@@ -376,7 +413,7 @@ static FORCE_INLINE void ncharToVar(char* buf, SScalarParam* pOut, int32_t rowIn
//TODO opt performance, tmp is not needed.
int32_t
vectorConvertFromVarData
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
,
int32_t
inType
,
int32_t
outType
)
{
int32_t
vectorConvertFromVarData
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
,
int32_t
inType
,
int32_t
outType
,
int32_t
*
overflow
)
{
bool
vton
=
false
;
_bufConverteFunc
func
=
NULL
;
...
...
@@ -415,8 +452,7 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in
if
(
inType
==
TSDB_DATA_TYPE_JSON
){
if
(
*
data
==
TSDB_DATA_TYPE_NULL
)
{
ASSERT
(
0
);
}
else
if
(
*
data
==
TSDB_DATA_TYPE_NCHAR
)
{
}
else
if
(
*
data
==
TSDB_DATA_TYPE_NCHAR
)
{
data
+=
CHAR_BYTES
;
convertType
=
TSDB_DATA_TYPE_NCHAR
;
}
else
if
(
tTagIsJson
(
data
)){
...
...
@@ -453,7 +489,7 @@ int32_t vectorConvertFromVarData(const SScalarParam* pIn, SScalarParam* pOut, in
}
}
(
*
func
)(
tmp
,
pOut
,
i
);
(
*
func
)(
tmp
,
pOut
,
i
,
overflow
);
taosMemoryFreeClear
(
tmp
);
}
...
...
@@ -606,7 +642,7 @@ int32_t vectorConvertToVarData(const SScalarParam* pIn, SScalarParam* pOut, int1
int32_t
len
=
sprintf
(
varDataVal
(
tmp
),
"%"
PRId64
,
value
);
varDataLen
(
tmp
)
=
len
;
if
(
outType
==
TSDB_DATA_TYPE_NCHAR
)
{
varToNchar
(
tmp
,
pOut
,
i
);
varToNchar
(
tmp
,
pOut
,
i
,
NULL
);
}
else
{
colDataAppend
(
pOutputCol
,
i
,
(
char
*
)
tmp
,
false
);
}
...
...
@@ -623,7 +659,7 @@ int32_t vectorConvertToVarData(const SScalarParam* pIn, SScalarParam* pOut, int1
int32_t
len
=
sprintf
(
varDataVal
(
tmp
),
"%"
PRIu64
,
value
);
varDataLen
(
tmp
)
=
len
;
if
(
outType
==
TSDB_DATA_TYPE_NCHAR
)
{
varToNchar
(
tmp
,
pOut
,
i
);
varToNchar
(
tmp
,
pOut
,
i
,
NULL
);
}
else
{
colDataAppend
(
pOutputCol
,
i
,
(
char
*
)
tmp
,
false
);
}
...
...
@@ -640,7 +676,7 @@ int32_t vectorConvertToVarData(const SScalarParam* pIn, SScalarParam* pOut, int1
int32_t
len
=
sprintf
(
varDataVal
(
tmp
),
"%lf"
,
value
);
varDataLen
(
tmp
)
=
len
;
if
(
outType
==
TSDB_DATA_TYPE_NCHAR
)
{
varToNchar
(
tmp
,
pOut
,
i
);
varToNchar
(
tmp
,
pOut
,
i
,
NULL
);
}
else
{
colDataAppend
(
pOutputCol
,
i
,
(
char
*
)
tmp
,
false
);
}
...
...
@@ -653,9 +689,8 @@ int32_t vectorConvertToVarData(const SScalarParam* pIn, SScalarParam* pOut, int1
return
TSDB_CODE_SUCCESS
;
}
// TODO opt performance
int32_t
vectorConvertImpl
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
)
{
int32_t
vectorConvertImpl
(
const
SScalarParam
*
pIn
,
SScalarParam
*
pOut
,
int32_t
*
overflow
)
{
SColumnInfoData
*
pInputCol
=
pIn
->
columnData
;
SColumnInfoData
*
pOutputCol
=
pOut
->
columnData
;
...
...
@@ -668,7 +703,47 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut) {
int16_t
outType
=
pOutputCol
->
info
.
type
;
if
(
IS_VAR_DATA_TYPE
(
inType
))
{
return
vectorConvertFromVarData
(
pIn
,
pOut
,
inType
,
outType
);
return
vectorConvertFromVarData
(
pIn
,
pOut
,
inType
,
outType
,
overflow
);
}
if
(
overflow
)
{
ASSERT
(
1
==
pIn
->
numOfRows
);
pOut
->
numOfRows
=
0
;
if
(
IS_SIGNED_NUMERIC_TYPE
(
outType
))
{
int64_t
minValue
=
tDataTypes
[
outType
].
minValue
;
int64_t
maxValue
=
tDataTypes
[
outType
].
maxValue
;
double
value
=
0
;
GET_TYPED_DATA
(
value
,
double
,
inType
,
colDataGetData
(
pInputCol
,
0
));
if
(
value
>
maxValue
)
{
*
overflow
=
1
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
value
<
minValue
)
{
*
overflow
=
-
1
;
return
TSDB_CODE_SUCCESS
;
}
else
{
*
overflow
=
0
;
}
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
outType
))
{
uint64_t
minValue
=
(
uint64_t
)
tDataTypes
[
outType
].
minValue
;
uint64_t
maxValue
=
(
uint64_t
)
tDataTypes
[
outType
].
maxValue
;
double
value
=
0
;
GET_TYPED_DATA
(
value
,
double
,
inType
,
colDataGetData
(
pInputCol
,
0
));
if
(
value
>
maxValue
)
{
*
overflow
=
1
;
return
TSDB_CODE_SUCCESS
;
}
else
if
(
value
<
minValue
)
{
*
overflow
=
-
1
;
return
TSDB_CODE_SUCCESS
;
}
else
{
*
overflow
=
0
;
}
}
}
pOut
->
numOfRows
=
pIn
->
numOfRows
;
...
...
@@ -829,6 +904,8 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut) {
return
TSDB_CODE_SUCCESS
;
}
int8_t
gConvertTypes
[
TSDB_DATA_TYPE_BLOB
+
1
][
TSDB_DATA_TYPE_BLOB
+
1
]
=
{
/* NULL BOOL TINY SMAL INT BIG FLOA DOUB VARC TIME NCHA UTIN USMA UINT UBIG JSON VARB DECI BLOB */
/*NULL*/
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
...
...
@@ -873,7 +950,7 @@ int32_t vectorConvertScalarParam(SScalarParam *input, SScalarParam *output, int3
return
TSDB_CODE_OUT_OF_MEMORY
;
}
code
=
vectorConvertImpl
(
input
,
output
);
code
=
vectorConvertImpl
(
input
,
output
,
NULL
);
if
(
code
)
{
// taosMemoryFreeClear(paramOut1->data);
return
code
;
...
...
@@ -944,7 +1021,7 @@ static int32_t doConvertHelper(SScalarParam* pDest, int32_t* convert, const SSca
return
code
;
}
code
=
vectorConvertImpl
(
pParam
,
pDest
);
code
=
vectorConvertImpl
(
pParam
,
pDest
,
NULL
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1714,7 +1791,7 @@ void vectorNotNull(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
}
void
vectorIsTrue
(
SScalarParam
*
pLeft
,
SScalarParam
*
pRight
,
SScalarParam
*
pOut
,
int32_t
_ord
)
{
vectorConvertImpl
(
pLeft
,
pOut
);
vectorConvertImpl
(
pLeft
,
pOut
,
NULL
);
for
(
int32_t
i
=
0
;
i
<
pOut
->
numOfRows
;
++
i
)
{
if
(
colDataIsNull_s
(
pOut
->
columnData
,
i
))
{
int8_t
v
=
0
;
...
...
tests/script/jenkins/basic.txt
浏览文件 @
6a3124a5
...
...
@@ -52,6 +52,7 @@
./test.sh -f tsim/insert/null.sim
./test.sh -f tsim/insert/update0.sim
./test.sh -f tsim/insert/commit-merge0.sim
./test.sh -f tsim/insert/insert_select.sim
# ---- parser
./test.sh -f tsim/parser/groupby-basic.sim
...
...
@@ -193,4 +194,7 @@
# --- catalog
./test.sh -f tsim/catalog/alterInCurrent.sim
# --- scalar
./test.sh -f tsim/scalar/in.sim
#======================b1-end===============
tests/script/
general
/insert/insert_select.sim
→
tests/script/
tsim
/insert/insert_select.sim
浏览文件 @
6a3124a5
文件已移动
tests/script/tsim/scalar/in.sim
0 → 100644
浏览文件 @
6a3124a5
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
sql connect
print ======== step1
sql drop database if exists db1;
sql create database db1 vgroups 3;
sql use db1;
sql create stable st1 (fts timestamp, fbool bool, ftiny tinyint, fsmall smallint, fint int, fbig bigint, futiny tinyint unsigned, fusmall smallint unsigned, fuint int unsigned, fubig bigint unsigned, ffloat float, fdouble double, fbin binary(10), fnchar nchar(10)) tags(tts timestamp, tbool bool, ttiny tinyint, tsmall smallint, tint int, tbig bigint, tutiny tinyint unsigned, tusmall smallint unsigned, tuint int unsigned, tubig bigint unsigned, tfloat float, tdouble double, tbin binary(10), tnchar nchar(10));
sql create table tb1 using st1 tags('2022-07-10 16:31:00', true, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0, 'a', 'a');
sql create table tb2 using st1 tags('2022-07-10 16:32:00', false, 2, 2, 2, 2, 2, 2, 2, 2, 2.0, 2.0, 'b', 'b');
sql create table tb3 using st1 tags('2022-07-10 16:33:00', true, 3, 3, 3, 3, 3, 3, 3, 3, 3.0, 3.0, 'c', 'c');
sql insert into tb1 values ('2022-07-10 16:31:01', false, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0, 'a', 'a');
sql insert into tb1 values ('2022-07-10 16:31:02', true, 2, 2, 2, 2, 2, 2, 2, 2, 2.0, 2.0, 'b', 'b');
sql insert into tb1 values ('2022-07-10 16:31:03', false, 3, 3, 3, 3, 3, 3, 3, 3, 3.0, 3.0, 'c', 'c');
sql insert into tb1 values ('2022-07-10 16:31:04', true, 4, 4, 4, 4, 4, 4, 4, 4, 4.0, 4.0, 'd', 'd');
sql insert into tb1 values ('2022-07-10 16:31:05', false, 5, 5, 5, 5, 5, 5, 5, 5, 5.0, 5.0, 'e', 'e');
sql insert into tb2 values ('2022-07-10 16:32:01', false, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0, 'a', 'a');
sql insert into tb2 values ('2022-07-10 16:32:02', true, 2, 2, 2, 2, 2, 2, 2, 2, 2.0, 2.0, 'b', 'b');
sql insert into tb2 values ('2022-07-10 16:32:03', false, 3, 3, 3, 3, 3, 3, 3, 3, 3.0, 3.0, 'c', 'c');
sql insert into tb2 values ('2022-07-10 16:32:04', true, 4, 4, 4, 4, 4, 4, 4, 4, 4.0, 4.0, 'd', 'd');
sql insert into tb2 values ('2022-07-10 16:32:05', false, 5, 5, 5, 5, 5, 5, 5, 5, 5.0, 5.0, 'e', 'e');
sql insert into tb3 values ('2022-07-10 16:33:01', false, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0, 'a', 'a');
sql insert into tb3 values ('2022-07-10 16:33:02', true, 2, 2, 2, 2, 2, 2, 2, 2, 2.0, 2.0, 'b', 'b');
sql insert into tb3 values ('2022-07-10 16:33:03', false, 3, 3, 3, 3, 3, 3, 3, 3, 3.0, 3.0, 'c', 'c');
sql insert into tb3 values ('2022-07-10 16:33:04', true, 4, 4, 4, 4, 4, 4, 4, 4, 4.0, 4.0, 'd', 'd');
sql insert into tb3 values ('2022-07-10 16:33:05', false, 5, 5, 5, 5, 5, 5, 5, 5, 5.0, 5.0, 'e', 'e');
sql select * from tb1 where fts in ('2022-07-10 16:31:01', '2022-07-10 16:31:03', 1657441865000);
if $rows != 3 then
return -1
endi
sql select * from tb1 where fbool in (0, 3);
if $rows != 5 then
return -1
endi
sql select * from tb1 where ftiny in (257);
if $rows != 0 then
return -1
endi
sql select * from tb1 where ftiny in (2, 257);
if $rows != 1 then
return -1
endi
sql select * from tb1 where futiny in (0, 257);
if $rows != 0 then
return -1
endi
sql select * from st1 where tts in ('2022-07-10 16:31:00', '2022-07-10 16:33:00', 1657441865000);
if $rows != 10 then
return -1
endi
sql select * from st1 where tbool in (0, 3);
if $rows != 15 then
return -1
endi
sql select * from st1 where ttiny in (257);
if $rows != 0 then
return -1
endi
sql select * from st1 where ttiny in (2, 257);
if $rows != 5 then
return -1
endi
sql select * from st1 where tutiny in (0, 257);
if $rows != 0 then
return -1
endi
system sh/exec.sh -n dnode1 -s stop -x SIGINT
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录