Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
36cc1fbc
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看板
未验证
提交
36cc1fbc
编写于
11月 18, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
11月 18, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #18210 from taosdata/fix/3.0_bugfix_wxy
enh: fill value supports implicit type conversion
上级
56a10167
4217441c
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
76 addition
and
59 deletion
+76
-59
include/common/tvariant.h
include/common/tvariant.h
+2
-1
source/common/src/tvariant.c
source/common/src/tvariant.c
+10
-3
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+24
-19
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+2
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+11
-11
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+3
-1
tests/script/tsim/parser/fill.sim
tests/script/tsim/parser/fill.sim
+9
-9
tests/script/tsim/parser/fill_stb.sim
tests/script/tsim/parser/fill_stb.sim
+5
-5
tests/script/tsim/parser/fill_us.sim
tests/script/tsim/parser/fill_us.sim
+9
-9
tests/script/tsim/stream/fillIntervalValue.sim
tests/script/tsim/stream/fillIntervalValue.sim
+1
-1
未找到文件。
include/common/tvariant.h
浏览文件 @
36cc1fbc
...
...
@@ -30,6 +30,7 @@ typedef struct SVariant {
int64_t
i
;
uint64_t
u
;
double
d
;
float
f
;
char
*
pz
;
TdUcs4
*
ucs4
;
SArray
*
arr
;
// only for 'in' query to hold value list, not value for a field
...
...
@@ -47,7 +48,7 @@ void taosVariantAssign(SVariant *pDst, const SVariant *pSrc);
int32_t
taosVariantCompare
(
const
SVariant
*
p1
,
const
SVariant
*
p2
);
char
*
taosVariantGet
(
SVariant
*
pVar
,
int32_t
type
);
char
*
taosVariantGet
(
SVariant
*
pVar
,
int32_t
type
);
#ifdef __cplusplus
}
...
...
source/common/src/tvariant.c
浏览文件 @
36cc1fbc
...
...
@@ -109,7 +109,7 @@ void taosVariantCreateFromBinary(SVariant *pVar, const char *pz, size_t len, uin
}
case
TSDB_DATA_TYPE_FLOAT
:
{
pVar
->
nLen
=
tDataTypes
[
type
].
bytes
;
pVar
->
d
=
GET_FLOAT_VAL
(
pz
);
pVar
->
f
=
GET_FLOAT_VAL
(
pz
);
break
;
}
case
TSDB_DATA_TYPE_NCHAR
:
{
// here we get the nchar length from raw binary bits length
...
...
@@ -223,12 +223,18 @@ int32_t taosVariantCompare(const SVariant *p1, const SVariant *p2) {
}
else
{
return
p1
->
nLen
>
p2
->
nLen
?
1
:
-
1
;
}
}
else
if
(
p1
->
nType
==
TSDB_DATA_TYPE_
FLOAT
||
p1
->
nType
==
TSDB_DATA_TYPE_
DOUBLE
)
{
}
else
if
(
p1
->
nType
==
TSDB_DATA_TYPE_DOUBLE
)
{
if
(
p1
->
d
==
p2
->
d
)
{
return
0
;
}
else
{
return
p1
->
d
>
p2
->
d
?
1
:
-
1
;
}
}
else
if
(
p1
->
nType
==
TSDB_DATA_TYPE_FLOAT
)
{
if
(
p1
->
f
==
p2
->
f
)
{
return
0
;
}
else
{
return
p1
->
f
>
p2
->
f
?
1
:
-
1
;
}
}
else
if
(
IS_UNSIGNED_NUMERIC_TYPE
(
p1
->
nType
))
{
if
(
p1
->
u
==
p2
->
u
)
{
return
0
;
...
...
@@ -259,8 +265,9 @@ char *taosVariantGet(SVariant *pVar, int32_t type) {
case
TSDB_DATA_TYPE_UBIGINT
:
return
(
char
*
)
&
pVar
->
u
;
case
TSDB_DATA_TYPE_DOUBLE
:
case
TSDB_DATA_TYPE_FLOAT
:
return
(
char
*
)
&
pVar
->
d
;
case
TSDB_DATA_TYPE_FLOAT
:
return
(
char
*
)
&
pVar
->
f
;
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_JSON
:
return
(
char
*
)
pVar
->
pz
;
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
36cc1fbc
...
...
@@ -48,8 +48,8 @@ typedef struct SSumRes {
double
dsum
;
};
int16_t
type
;
int64_t
prevTs
;
// used for csum only
bool
isPrevTsSet
;
//
used for csum only
int64_t
prevTs
;
// used for csum only
bool
isPrevTsSet
;
//
used for csum only
}
SSumRes
;
...
...
@@ -2220,8 +2220,8 @@ bool leastSQRFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResultInf
SLeastSQRInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
pResultInfo
);
pInfo
->
startVal
=
IS_FLOAT_TYPE
(
pCtx
->
param
[
1
].
param
.
nType
)
?
pCtx
->
param
[
1
].
param
.
d
:
(
double
)
pCtx
->
param
[
1
].
param
.
i
;
pInfo
->
stepVal
=
IS_FLOAT_TYPE
(
pCtx
->
param
[
2
].
param
.
nType
)
?
pCtx
->
param
[
2
].
param
.
d
:
(
double
)
pCtx
->
param
[
2
].
param
.
i
;
GET_TYPED_DATA
(
pInfo
->
startVal
,
double
,
pCtx
->
param
[
1
].
param
.
nType
,
&
pCtx
->
param
[
1
].
param
.
i
)
;
GET_TYPED_DATA
(
pInfo
->
stepVal
,
double
,
pCtx
->
param
[
2
].
param
.
nType
,
&
pCtx
->
param
[
2
].
param
.
i
)
;
return
true
;
}
...
...
@@ -2565,8 +2565,8 @@ int32_t percentileFunction(SqlFunctionCtx* pCtx) {
int32_t
percentileFinalize
(
SqlFunctionCtx
*
pCtx
,
SSDataBlock
*
pBlock
)
{
SVariant
*
pVal
=
&
pCtx
->
param
[
1
].
param
;
double
v
=
(
IS_SIGNED_NUMERIC_TYPE
(
pVal
->
nType
)
?
pVal
->
i
:
(
IS_UNSIGNED_NUMERIC_TYPE
(
pVal
->
nType
)
?
pVal
->
u
:
pVal
->
d
)
);
double
v
=
0
;
GET_TYPED_DATA
(
v
,
double
,
pVal
->
nType
,
&
pVal
->
i
);
SResultRowEntryInfo
*
pResInfo
=
GET_RES_INFO
(
pCtx
);
SPercentileInfo
*
ppInfo
=
(
SPercentileInfo
*
)
GET_ROWCELL_INTERBUF
(
pResInfo
);
...
...
@@ -2625,8 +2625,8 @@ bool apercentileFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResult
SAPercentileInfo
*
pInfo
=
GET_ROWCELL_INTERBUF
(
pResultInfo
);
SVariant
*
pVal
=
&
pCtx
->
param
[
1
].
param
;
pInfo
->
percent
=
(
IS_SIGNED_NUMERIC_TYPE
(
pVal
->
nType
)
?
pVal
->
i
:
(
IS_UNSIGNED_NUMERIC_TYPE
(
pVal
->
nType
)
?
pVal
->
u
:
pVal
->
d
)
);
pInfo
->
percent
=
0
;
GET_TYPED_DATA
(
pInfo
->
percent
,
double
,
pVal
->
nType
,
&
pVal
->
i
);
if
(
pCtx
->
numOfParams
==
2
)
{
pInfo
->
algo
=
APERCT_ALGO_DEFAULT
;
...
...
@@ -3722,6 +3722,12 @@ static int32_t topBotResComparFn(const void* p1, const void* p2, const void* par
}
return
(
val1
->
v
.
u
>
val2
->
v
.
u
)
?
1
:
-
1
;
}
else
if
(
TSDB_DATA_TYPE_FLOAT
==
type
)
{
if
(
val1
->
v
.
f
==
val2
->
v
.
f
)
{
return
0
;
}
return
(
val1
->
v
.
f
>
val2
->
v
.
f
)
?
1
:
-
1
;
}
if
(
val1
->
v
.
d
==
val2
->
v
.
d
)
{
...
...
@@ -3762,10 +3768,12 @@ void doAddIntoResult(SqlFunctionCtx* pCtx, void* pData, int32_t rowIndex, SSData
}
else
{
// replace the minimum value in the result
if
((
isTopQuery
&&
((
IS_SIGNED_NUMERIC_TYPE
(
type
)
&&
val
.
i
>
pItems
[
0
].
v
.
i
)
||
(
IS_UNSIGNED_NUMERIC_TYPE
(
type
)
&&
val
.
u
>
pItems
[
0
].
v
.
u
)
||
(
IS_FLOAT_TYPE
(
type
)
&&
val
.
d
>
pItems
[
0
].
v
.
d
)))
||
(
TSDB_DATA_TYPE_FLOAT
==
type
&&
val
.
f
>
pItems
[
0
].
v
.
f
)
||
(
TSDB_DATA_TYPE_DOUBLE
==
type
&&
val
.
d
>
pItems
[
0
].
v
.
d
)))
||
(
!
isTopQuery
&&
((
IS_SIGNED_NUMERIC_TYPE
(
type
)
&&
val
.
i
<
pItems
[
0
].
v
.
i
)
||
(
IS_UNSIGNED_NUMERIC_TYPE
(
type
)
&&
val
.
u
<
pItems
[
0
].
v
.
u
)
||
(
IS_FLOAT_TYPE
(
type
)
&&
val
.
d
<
pItems
[
0
].
v
.
d
))))
{
(
TSDB_DATA_TYPE_FLOAT
==
type
&&
val
.
f
<
pItems
[
0
].
v
.
f
)
||
(
TSDB_DATA_TYPE_DOUBLE
==
type
&&
val
.
d
<
pItems
[
0
].
v
.
d
))))
{
// replace the old data and the coresponding tuple data
STopBotResItem
*
pItem
=
&
pItems
[
0
];
pItem
->
v
=
val
;
...
...
@@ -3928,12 +3936,7 @@ int32_t topBotFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
}
for
(
int32_t
i
=
0
;
i
<
pEntryInfo
->
numOfRes
;
++
i
)
{
STopBotResItem
*
pItem
=
&
pRes
->
pItems
[
i
];
if
(
type
==
TSDB_DATA_TYPE_FLOAT
)
{
float
v
=
pItem
->
v
.
d
;
colDataAppend
(
pCol
,
currentRow
,
(
const
char
*
)
&
v
,
false
);
}
else
{
colDataAppend
(
pCol
,
currentRow
,
(
const
char
*
)
&
pItem
->
v
.
i
,
false
);
}
colDataAppend
(
pCol
,
currentRow
,
(
const
char
*
)
&
pItem
->
v
.
i
,
false
);
#ifdef BUF_PAGE_DEBUG
qDebug
(
"page_finalize i:%d,item:%p,pageId:%d, offset:%d
\n
"
,
i
,
pItem
,
pItem
->
tuplePos
.
pageId
,
pItem
->
tuplePos
.
offset
);
...
...
@@ -3964,10 +3967,12 @@ void addResult(SqlFunctionCtx* pCtx, STopBotResItem* pSourceItem, int16_t type,
}
else
{
// replace the minimum value in the result
if
((
isTopQuery
&&
((
IS_SIGNED_NUMERIC_TYPE
(
type
)
&&
pSourceItem
->
v
.
i
>
pItems
[
0
].
v
.
i
)
||
(
IS_UNSIGNED_NUMERIC_TYPE
(
type
)
&&
pSourceItem
->
v
.
u
>
pItems
[
0
].
v
.
u
)
||
(
IS_FLOAT_TYPE
(
type
)
&&
pSourceItem
->
v
.
d
>
pItems
[
0
].
v
.
d
)))
||
(
TSDB_DATA_TYPE_FLOAT
==
type
&&
pSourceItem
->
v
.
f
>
pItems
[
0
].
v
.
f
)
||
(
TSDB_DATA_TYPE_DOUBLE
==
type
&&
pSourceItem
->
v
.
d
>
pItems
[
0
].
v
.
d
)))
||
(
!
isTopQuery
&&
((
IS_SIGNED_NUMERIC_TYPE
(
type
)
&&
pSourceItem
->
v
.
i
<
pItems
[
0
].
v
.
i
)
||
(
IS_UNSIGNED_NUMERIC_TYPE
(
type
)
&&
pSourceItem
->
v
.
u
<
pItems
[
0
].
v
.
u
)
||
(
IS_FLOAT_TYPE
(
type
)
&&
pSourceItem
->
v
.
d
<
pItems
[
0
].
v
.
d
))))
{
(
TSDB_DATA_TYPE_FLOAT
==
type
&&
pSourceItem
->
v
.
f
<
pItems
[
0
].
v
.
f
)
||
(
TSDB_DATA_TYPE_DOUBLE
==
type
&&
pSourceItem
->
v
.
d
<
pItems
[
0
].
v
.
d
))))
{
// replace the old data and the coresponding tuple data
STopBotResItem
*
pItem
=
&
pItems
[
0
];
pItem
->
v
=
pSourceItem
->
v
;
...
...
@@ -6038,7 +6043,7 @@ int32_t twaFinalize(struct SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
}
else
{
if
(
pInfo
->
win
.
ekey
==
pInfo
->
win
.
skey
)
{
pInfo
->
dOutput
=
pInfo
->
p
.
val
;
}
else
if
(
pInfo
->
win
.
ekey
==
INT64_MAX
||
pInfo
->
win
.
skey
==
INT64_MIN
)
{
//
no data in timewindow
}
else
if
(
pInfo
->
win
.
ekey
==
INT64_MAX
||
pInfo
->
win
.
skey
==
INT64_MIN
)
{
//
no data in timewindow
pInfo
->
dOutput
=
0
;
}
else
{
pInfo
->
dOutput
=
pInfo
->
dOutput
/
(
pInfo
->
win
.
ekey
-
pInfo
->
win
.
skey
);
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
36cc1fbc
...
...
@@ -2036,6 +2036,8 @@ void nodesValueNodeToVariant(const SValueNode* pNode, SVariant* pVal) {
pVal
->
u
=
pNode
->
datum
.
u
;
break
;
case
TSDB_DATA_TYPE_FLOAT
:
pVal
->
f
=
pNode
->
datum
.
d
;
break
;
case
TSDB_DATA_TYPE_DOUBLE
:
pVal
->
d
=
pNode
->
datum
.
d
;
break
;
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
36cc1fbc
...
...
@@ -2762,17 +2762,17 @@ static bool needFill(SNode* pNode) {
return
hasFillFunc
;
}
static
bool
mismatchFillDataType
(
SDataType
origDt
,
SDataType
fillDt
)
{
if
(
TSDB_DATA_TYPE_NULL
==
fillDt
.
type
)
{
return
false
;
}
if
(
IS_NUMERIC_TYPE
(
origDt
.
type
)
&&
!
IS_NUMERIC_TYPE
(
fillDt
.
type
))
{
return
true
;
static
int32_t
convertFillValue
(
STranslateContext
*
pCxt
,
SDataType
dt
,
SNodeList
*
pValues
,
int32_t
index
)
{
SListCell
*
pCell
=
nodesListGetCell
(
pValues
,
index
);
if
(
dataTypeEqual
(
&
dt
,
&
((
SExprNode
*
)
pCell
->
pNode
)
->
resType
))
{
return
TSDB_CODE_SUCCESS
;
}
if
(
IS_VAR_DATA_TYPE
(
origDt
.
type
)
&&
!
IS_VAR_DATA_TYPE
(
fillDt
.
type
))
{
return
true
;
SNode
*
pCaseFunc
=
NULL
;
int32_t
code
=
createCastFunc
(
pCxt
,
pCell
->
pNode
,
dt
,
&
pCaseFunc
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
code
=
scalarCalculateConstants
(
pCaseFunc
,
&
pCell
->
pNode
);
}
return
fals
e
;
return
cod
e
;
}
static
int32_t
checkFillValues
(
STranslateContext
*
pCxt
,
SFillNode
*
pFill
,
SNodeList
*
pProjectionList
)
{
...
...
@@ -2788,8 +2788,8 @@ static int32_t checkFillValues(STranslateContext* pCxt, SFillNode* pFill, SNodeL
if
(
fillNo
>=
LIST_LENGTH
(
pFillValues
->
pNodeList
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
"Filled values number mismatch"
);
}
if
(
mismatchFillDataType
(((
SExprNode
*
)
pProject
)
->
resType
,
((
SExprNode
*
)
nodesListGetNode
(
pFillValues
->
pNodeList
,
fillNo
))
->
resType
))
{
if
(
TSDB_CODE_SUCCESS
!=
convertFillValue
(
pCxt
,
((
SExprNode
*
)
pProject
)
->
resType
,
pFillValues
->
pNodeList
,
fillNo
))
{
return
generateSyntaxErrMsgExt
(
&
pCxt
->
msgBuf
,
TSDB_CODE_PAR_WRONG_VALUE_TYPE
,
"Filled data type mismatch"
);
}
++
fillNo
;
...
...
source/libs/planner/src/planOptimizer.c
浏览文件 @
36cc1fbc
...
...
@@ -348,7 +348,9 @@ static int32_t scanPathOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSub
int32_t
code
=
scanPathOptMatch
(
pCxt
,
pLogicSubplan
->
pNode
,
&
info
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
info
.
pScan
)
{
scanPathOptSetScanWin
(
info
.
pScan
);
scanPathOptSetScanOrder
(
info
.
scanOrder
,
info
.
pScan
);
if
(
!
pCxt
->
pPlanCxt
->
streamQuery
)
{
scanPathOptSetScanOrder
(
info
.
scanOrder
,
info
.
pScan
);
}
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
NULL
!=
info
.
pDsoFuncs
||
NULL
!=
info
.
pSdrFuncs
))
{
info
.
pScan
->
dataRequired
=
scanPathOptGetDataRequired
(
info
.
pSdrFuncs
);
...
...
tests/script/tsim/parser/fill.sim
浏览文件 @
36cc1fbc
...
...
@@ -330,7 +330,7 @@ if $data11 != -1 then
endi
# fill_char_values_to_arithmetic_fields
sql
_error
select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
sql select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
# fill_multiple_columns
sql_error select sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc)
...
...
@@ -355,25 +355,25 @@ endi
# fill_into_nonarithmetic_fieds
print select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
sql
_error
select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
sql select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
sql
_error
select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1, 1, 1)
sql
_error
select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1.1, 1.1, 1.1)
sql
_error
select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1)
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1, 1, 1)
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1.1, 1.1, 1.1)
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1)
sql select first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1')
# fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24
# fill values into binary or nchar columns will be set to NULL automatically Note:2018-10-24
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1')
sql
_error
select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true)
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true)
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true')
# fill nonarithmetic values into arithmetic fields
sql_error select count(*) where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, abc);
sql
_error
select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
print select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
sql
_error
select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1);
if $rows != 9 then
...
...
@@ -383,7 +383,7 @@ if $data01 != 1 then
return -1
endi
sql
_error
select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10');
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10');
## linear fill
# feature currently switched off 2018/09/29
...
...
tests/script/tsim/parser/fill_stb.sim
浏览文件 @
36cc1fbc
...
...
@@ -170,7 +170,7 @@ endi
sql_error select max(c1), max(c2), max(c3), max(c4), max(c5) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill (6, 6, 6, 6, 6)
# fill_char_values_to_arithmetic_fields
sql
_error
select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
sql select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
# fill_multiple_columns
sql_error select sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc)
...
...
@@ -240,10 +240,10 @@ sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <=
sql select first(c7), first(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true')
# fill nonarithmetic values into arithmetic fields
sql
_error
select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'abc');
sql
_error
select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
sql select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'abc');
sql select count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
sql
_error
select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '2e1');
sql select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '2e1');
sql select _wstart, count(*) from $stb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20);
if $rows != $val then
...
...
@@ -354,7 +354,7 @@ endi
## NULL fill
print fill(NULL)
print select _wstart, max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 partition by t1 interval(5m) fill(value, NULL) limit 5
print select _wstart, max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 partition by t1 interval(5m) fill(value, NULL
, NULL, NULL, NULL, NULL, NULL, NULL, NULL
) limit 5
sql select _wstart, max(c1), min(c2), avg(c3), sum(c4), count(c5), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 4 partition by t1 interval(5m) fill(NULL) limit 5
if $rows != 25 then
return -1
...
...
tests/script/tsim/parser/fill_us.sim
浏览文件 @
36cc1fbc
...
...
@@ -332,7 +332,7 @@ if $data11 != -1 then
endi
# fill_char_values_to_arithmetic_fields
sql
_error
select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
sql select sum(c1), avg(c2), max(c3), min(c4), avg(c4), count(c6), last(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'c', 'c', 'c', 'c', 'c', 'c', 'c', 'c')
# fill_multiple_columns
sql_error select _wstart, sum(c1), avg(c2), min(c3), max(c4), count(c6), first(c7), last(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 99, 99, 99, 99, 99, abc, abc)
...
...
@@ -358,24 +358,24 @@ endi
# fill_into_nonarithmetic_fieds
sql
_error
select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
sql select _wstart, first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 20000000, 20000000, 20000000)
sql
_error
select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1, 1, 1)
sql
_error
select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1.1, 1.1, 1.1)
sql
_error
select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1)
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1, 1, 1)
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1.1, 1.1, 1.1)
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1, 1e1, 1e1)
sql select first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1')
# fill quoted values into bool column will throw error unless the value is 'true' or 'false' Note:2018-10-24
# fill values into binary or nchar columns will be set to null automatically Note:2018-10-24
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e', '1e1','1e1')
sql
_error
select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true)
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, true, true, true)
sql select first(c6), first(c7), first(c8) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true', 'true','true')
# fill nonarithmetic values into arithmetic fields
sql_error select count(*) where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, abc);
sql
_error
select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
sql select count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 'true');
sql
_error
select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '1e1');
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, 1e1);
if $rows != 9 then
...
...
@@ -385,7 +385,7 @@ if $data01 != 1 then
return -1
endi
sql
_error
select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10');
sql select _wstart, count(*) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) fill(value, '10');
## linear fill
# feature currently switched off 2018/09/29
...
...
tests/script/tsim/stream/fillIntervalValue.sim
浏览文件 @
36cc1fbc
...
...
@@ -4,7 +4,7 @@ looptest:
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/exec.sh -n dnode1 -s start
#==system sh/exec.sh -n dnode1 -s start -v
sleep 200
sql connect
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录