Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
daab0724
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看板
提交
daab0724
编写于
11月 12, 2021
作者:
S
shenglian zhou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cell/floor/round reimplemented with scalar expr
上级
9aa19d59
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
587 addition
and
438 deletion
+587
-438
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+19
-26
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+0
-3
src/common/inc/texpr.h
src/common/inc/texpr.h
+1
-0
src/common/src/texpr.c
src/common/src/texpr.c
+7
-7
src/query/inc/qAggMain.h
src/query/inc/qAggMain.h
+4
-8
src/query/src/qAggMain.c
src/query/src/qAggMain.c
+3
-264
tests/pytest/functions/function_ceil.py
tests/pytest/functions/function_ceil.py
+553
-130
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
daab0724
...
...
@@ -1837,19 +1837,30 @@ static int32_t handleAggTypeExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t
char
aliasName
[
TSDB_COL_NAME_LEN
]
=
{
0
};
getColumnName
(
pItem
,
aliasName
,
rawName
,
TSDB_COL_NAME_LEN
);
tExprNode
*
pExpr
=
NULL
;
uint64_t
uid
=
0
;
int32_t
ret
=
exprTreeFromSqlExpr
(
pCmd
,
&
pExpr
,
pItem
->
pNode
,
pQueryInfo
,
NULL
,
&
uid
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
tExprTreeDestroy
(
pExpr
,
NULL
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
"invalid expression in select clause"
);
}
ret
=
exprTreeValidateTree
(
pExpr
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
tExprTreeDestroy
(
pExpr
,
NULL
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
// the expr associated with the result field will become exprList1 in SQueryInfo, then pExpr2 in SQueryAttr
insertResultField
(
pQueryInfo
,
exprIndex
,
columnList
,
sizeof
(
double
),
TSDB_DATA_TYPE_DOUBLE
,
aliasName
,
NULL
);
insertResultField
(
pQueryInfo
,
exprIndex
,
columnList
,
pExpr
->
resultBytes
,
(
int8_t
)
pExpr
->
resultType
,
aliasName
,
NULL
);
int32_t
slot
=
tscNumOfFields
(
pQueryInfo
)
-
1
;
SInternalField
*
pInfo
=
tscFieldInfoGetInternalField
(
&
pQueryInfo
->
fieldsInfo
,
slot
);
assert
(
pInfo
->
pExpr
==
NULL
);
SExprInfo
*
pExprInfo
=
calloc
(
1
,
sizeof
(
SExprInfo
));
// arithmetic expression always return result in the format of double float
pExprInfo
->
base
.
resBytes
=
sizeof
(
double
)
;
pExprInfo
->
base
.
resBytes
=
pExpr
->
resultBytes
;
pExprInfo
->
base
.
interBytes
=
0
;
pExprInfo
->
base
.
resType
=
TSDB_DATA_TYPE_DOUBLE
;
pExprInfo
->
base
.
resType
=
pExpr
->
resultType
;
pExprInfo
->
base
.
functionId
=
TSDB_FUNC_SCALAR_EXPR
;
pExprInfo
->
base
.
numOfParams
=
1
;
...
...
@@ -1857,19 +1868,9 @@ static int32_t handleAggTypeExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t
strncpy
(
pExprInfo
->
base
.
aliasName
,
aliasName
,
tListLen
(
pExprInfo
->
base
.
aliasName
));
strncpy
(
pExprInfo
->
base
.
token
,
rawName
,
tListLen
(
pExprInfo
->
base
.
token
));
int32_t
ret
=
exprTreeFromSqlExpr
(
pCmd
,
&
pExprInfo
->
pExpr
,
pItem
->
pNode
,
pQueryInfo
,
NULL
,
&
(
pExprInfo
->
base
.
uid
));
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
tExprTreeDestroy
(
pExprInfo
->
pExpr
,
NULL
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
"invalid expression in select clause"
);
}
pExprInfo
->
pExpr
=
pExpr
;
pExprInfo
->
base
.
uid
=
uid
;
pInfo
->
pExpr
=
pExprInfo
;
ret
=
exprTreeValidateTree
(
pExprInfo
->
pExpr
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
tExprTreeDestroy
(
pExprInfo
->
pExpr
,
NULL
);
pExprInfo
->
pExpr
=
NULL
;
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
SBufferWriter
bw
=
tbufInitWriter
(
NULL
,
false
);
...
...
@@ -2608,9 +2609,6 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
case
TSDB_FUNC_DIFF
:
case
TSDB_FUNC_DERIVATIVE
:
case
TSDB_FUNC_CSUM
:
case
TSDB_FUNC_CEIL
:
case
TSDB_FUNC_FLOOR
:
case
TSDB_FUNC_ROUND
:
case
TSDB_FUNC_STDDEV
:
case
TSDB_FUNC_LEASTSQR
:
{
// 1. valid the number of parameters
...
...
@@ -3685,10 +3683,6 @@ static bool functionCompatibleCheck(SQueryInfo* pQueryInfo, bool joinQuery, bool
++
prjNum
;
}
if
(
functionId
==
TSDB_FUNC_CEIL
||
functionId
==
TSDB_FUNC_FLOOR
||
functionId
==
TSDB_FUNC_ROUND
)
{
++
scalarFuncNum
;
}
if
(
TSDB_FUNC_IS_SCALAR
(
functionId
))
{
++
scalarFuncNum
;
}
...
...
@@ -6662,8 +6656,7 @@ int32_t validateFunctionsInIntervalOrGroupbyQuery(SSqlCmd* pCmd, SQueryInfo* pQu
int32_t
f
=
pExpr
->
base
.
functionId
;
if
((
f
==
TSDB_FUNC_PRJ
&&
pExpr
->
base
.
numOfParams
==
0
)
||
f
==
TSDB_FUNC_DIFF
||
f
==
TSDB_FUNC_SCALAR_EXPR
||
f
==
TSDB_FUNC_DERIVATIVE
||
f
==
TSDB_FUNC_CSUM
||
f
==
TSDB_FUNC_MAVG
||
f
==
TSDB_FUNC_CEIL
||
f
==
TSDB_FUNC_FLOOR
||
f
==
TSDB_FUNC_ROUND
)
f
==
TSDB_FUNC_CSUM
||
f
==
TSDB_FUNC_MAVG
)
{
isProjectionFunction
=
true
;
break
;
...
...
src/client/src/tscUtil.c
浏览文件 @
daab0724
...
...
@@ -274,9 +274,6 @@ bool tscIsProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex) {
functionId
!=
TSDB_FUNC_CSUM
&&
functionId
!=
TSDB_FUNC_TS_DUMMY
&&
functionId
!=
TSDB_FUNC_TID_TAG
&&
functionId
!=
TSDB_FUNC_CEIL
&&
functionId
!=
TSDB_FUNC_FLOOR
&&
functionId
!=
TSDB_FUNC_ROUND
&&
!
TSDB_FUNC_IS_SCALAR
(
functionId
))
{
return
false
;
}
...
...
src/common/inc/texpr.h
浏览文件 @
daab0724
...
...
@@ -63,6 +63,7 @@ struct SSchema;
#define TSDB_FUNC_SCALAR_CONCAT (TSDB_FUNC_FLAG_SCALAR | 0x000D)
#define TSDB_FUNC_SCALAR_LENGTH (TSDB_FUNC_FLAG_SCALAR | 0x000E)
#define TSDB_FUNC_SCALAR_MAX_NUM 15
#define TSDB_FUNC_SCALAR_NAME_MAX_LEN 16
typedef
struct
{
...
...
src/common/src/texpr.c
浏览文件 @
daab0724
...
...
@@ -1258,7 +1258,7 @@ void vectorMathFunc(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numIn
SET_TYPED_DATA
(
outputData
,
pOutput
->
type
,
result
);
}
else
if
(
pInputs
[
0
].
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
v
=
0
;
GET_TYPED_DATA
(
v
,
float
,
pInputs
[
0
].
type
,
inputData
[
0
]);
GET_TYPED_DATA
(
v
,
double
,
pInputs
[
0
].
type
,
inputData
[
0
]);
double
result
=
ceil
(
v
);
SET_TYPED_DATA
(
outputData
,
pOutput
->
type
,
result
);
}
...
...
@@ -1278,7 +1278,7 @@ void vectorMathFunc(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numIn
SET_TYPED_DATA
(
outputData
,
pOutput
->
type
,
result
);
}
else
if
(
pInputs
[
0
].
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
v
=
0
;
GET_TYPED_DATA
(
v
,
float
,
pInputs
[
0
].
type
,
inputData
[
0
]);
GET_TYPED_DATA
(
v
,
double
,
pInputs
[
0
].
type
,
inputData
[
0
]);
double
result
=
floor
(
v
);
SET_TYPED_DATA
(
outputData
,
pOutput
->
type
,
result
);
}
...
...
@@ -1299,7 +1299,7 @@ void vectorMathFunc(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numIn
SET_TYPED_DATA
(
outputData
,
pOutput
->
type
,
result
);
}
else
if
(
pInputs
[
0
].
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
v
=
0
;
GET_TYPED_DATA
(
v
,
float
,
pInputs
[
0
].
type
,
inputData
[
0
]);
GET_TYPED_DATA
(
v
,
double
,
pInputs
[
0
].
type
,
inputData
[
0
]);
double
result
=
round
(
v
);
SET_TYPED_DATA
(
outputData
,
pOutput
->
type
,
result
);
}
...
...
@@ -1310,9 +1310,9 @@ void vectorMathFunc(int16_t functionId, tExprOperandInfo *pInputs, uint8_t numIn
assert
(
false
);
break
;
}
}
}
}
}
// end switch function(id)
}
// end can produce value, all child has value
}
// end for each row
free
(
inputData
);
}
...
...
@@ -1381,7 +1381,7 @@ tScalarFunctionInfo aScalarFunctions[] = {
},
{
TSDB_FUNC_SCALAR_FLOOR
,
"floo
o
r"
,
"floor"
,
vectorMathFunc
,
},
{
...
...
src/query/inc/qAggMain.h
浏览文件 @
daab0724
...
...
@@ -70,15 +70,11 @@ extern "C" {
#define TSDB_FUNC_TID_TAG 31
#define TSDB_FUNC_DERIVATIVE 32
#define TSDB_FUNC_C
EIL
33
#define TSDB_FUNC_
FLOOR
34
#define TSDB_FUNC_
ROUND
35
#define TSDB_FUNC_C
SUM
33
#define TSDB_FUNC_
MAVG
34
#define TSDB_FUNC_
SAMPLE
35
#define TSDB_FUNC_CSUM 36
#define TSDB_FUNC_MAVG 37
#define TSDB_FUNC_SAMPLE 38
#define TSDB_FUNC_BLKINFO 39
#define TSDB_FUNC_BLKINFO 36
///////////////////////////////////////////
// the following functions is not implemented.
...
...
src/query/src/qAggMain.c
浏览文件 @
daab0724
...
...
@@ -206,8 +206,7 @@ int32_t getResultDataInfo(int32_t dataType, int32_t dataBytes, int32_t functionI
if
(
functionId
==
TSDB_FUNC_TS
||
functionId
==
TSDB_FUNC_TS_DUMMY
||
functionId
==
TSDB_FUNC_TAG_DUMMY
||
functionId
==
TSDB_FUNC_DIFF
||
functionId
==
TSDB_FUNC_PRJ
||
functionId
==
TSDB_FUNC_TAGPRJ
||
functionId
==
TSDB_FUNC_TAG
||
functionId
==
TSDB_FUNC_INTERP
||
functionId
==
TSDB_FUNC_CEIL
||
functionId
==
TSDB_FUNC_FLOOR
||
functionId
==
TSDB_FUNC_ROUND
)
functionId
==
TSDB_FUNC_TAG
||
functionId
==
TSDB_FUNC_INTERP
)
{
*
type
=
(
int16_t
)
dataType
;
*
bytes
=
(
int16_t
)
dataBytes
;
...
...
@@ -4502,233 +4501,6 @@ void blockinfo_func_finalizer(SQLFunctionCtx* pCtx) {
doFinalizer
(
pCtx
);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define CFR_SET_VAL(type, data, pCtx, func, i, step, notNullElems) \
do { \
type *pData = (type *) data; \
type *pOutput = (type *) pCtx->pOutput; \
\
for (; i < pCtx->size && i >= 0; i += step) { \
if (pCtx->hasNull && isNull((const char*) &pData[i], pCtx->inputType)) { \
continue; \
} \
\
*pOutput++ = (type) func((double) pData[i]); \
\
notNullElems++; \
} \
} while (0)
#define CFR_SET_VAL_DOUBLE(data, pCtx, func, i, step, notNullElems) \
do { \
double *pData = (double *) data; \
double *pOutput = (double *) pCtx->pOutput; \
\
for (; i < pCtx->size && i >= 0; i += step) { \
if (pCtx->hasNull && isNull((const char*) &pData[i], pCtx->inputType)) { \
continue; \
} \
\
SET_DOUBLE_VAL(pOutput, func(pData[i])); \
pOutput++; \
\
notNullElems++; \
} \
} while (0)
static
void
ceil_function
(
SQLFunctionCtx
*
pCtx
)
{
void
*
data
=
GET_INPUT_DATA_LIST
(
pCtx
);
int32_t
notNullElems
=
0
;
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
);
int32_t
i
=
(
pCtx
->
order
==
TSDB_ORDER_ASC
)
?
0
:
pCtx
->
size
-
1
;
switch
(
pCtx
->
inputType
)
{
case
TSDB_DATA_TYPE_INT
:
{
CFR_SET_VAL
(
int32_t
,
data
,
pCtx
,
ceil
,
i
,
step
,
notNullElems
);
break
;
};
case
TSDB_DATA_TYPE_UINT
:
{
CFR_SET_VAL
(
uint32_t
,
data
,
pCtx
,
ceil
,
i
,
step
,
notNullElems
);
break
;
};
case
TSDB_DATA_TYPE_BIGINT
:
{
CFR_SET_VAL
(
int64_t
,
data
,
pCtx
,
ceil
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
CFR_SET_VAL
(
uint64_t
,
data
,
pCtx
,
ceil
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
CFR_SET_VAL_DOUBLE
(
data
,
pCtx
,
ceil
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
CFR_SET_VAL
(
float
,
data
,
pCtx
,
ceil
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
CFR_SET_VAL
(
int16_t
,
data
,
pCtx
,
ceil
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
CFR_SET_VAL
(
uint16_t
,
data
,
pCtx
,
ceil
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_TINYINT
:
{
CFR_SET_VAL
(
int8_t
,
data
,
pCtx
,
ceil
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_UTINYINT
:
{
CFR_SET_VAL
(
uint8_t
,
data
,
pCtx
,
ceil
,
i
,
step
,
notNullElems
);
break
;
}
default:
qError
(
"error input type"
);
}
if
(
notNullElems
<=
0
)
{
/*
* current block may be null value
*/
assert
(
pCtx
->
hasNull
);
}
else
{
GET_RES_INFO
(
pCtx
)
->
numOfRes
+=
notNullElems
;
}
}
static
void
floor_function
(
SQLFunctionCtx
*
pCtx
)
{
void
*
data
=
GET_INPUT_DATA_LIST
(
pCtx
);
int32_t
notNullElems
=
0
;
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
);
int32_t
i
=
(
pCtx
->
order
==
TSDB_ORDER_ASC
)
?
0
:
pCtx
->
size
-
1
;
switch
(
pCtx
->
inputType
)
{
case
TSDB_DATA_TYPE_INT
:
{
CFR_SET_VAL
(
int32_t
,
data
,
pCtx
,
floor
,
i
,
step
,
notNullElems
);
break
;
};
case
TSDB_DATA_TYPE_UINT
:
{
CFR_SET_VAL
(
uint32_t
,
data
,
pCtx
,
floor
,
i
,
step
,
notNullElems
);
break
;
};
case
TSDB_DATA_TYPE_BIGINT
:
{
CFR_SET_VAL
(
int64_t
,
data
,
pCtx
,
floor
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
CFR_SET_VAL
(
uint64_t
,
data
,
pCtx
,
floor
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
CFR_SET_VAL_DOUBLE
(
data
,
pCtx
,
floor
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
CFR_SET_VAL
(
float
,
data
,
pCtx
,
floor
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
CFR_SET_VAL
(
int16_t
,
data
,
pCtx
,
floor
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
CFR_SET_VAL
(
uint16_t
,
data
,
pCtx
,
floor
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_TINYINT
:
{
CFR_SET_VAL
(
int8_t
,
data
,
pCtx
,
floor
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_UTINYINT
:
{
CFR_SET_VAL
(
uint8_t
,
data
,
pCtx
,
floor
,
i
,
step
,
notNullElems
);
break
;
}
default:
qError
(
"error input type"
);
}
if
(
notNullElems
<=
0
)
{
/*
* current block may be null value
*/
assert
(
pCtx
->
hasNull
);
}
else
{
GET_RES_INFO
(
pCtx
)
->
numOfRes
+=
notNullElems
;
}
}
static
void
round_function
(
SQLFunctionCtx
*
pCtx
)
{
void
*
data
=
GET_INPUT_DATA_LIST
(
pCtx
);
int32_t
notNullElems
=
0
;
int32_t
step
=
GET_FORWARD_DIRECTION_FACTOR
(
pCtx
->
order
);
int32_t
i
=
(
pCtx
->
order
==
TSDB_ORDER_ASC
)
?
0
:
pCtx
->
size
-
1
;
switch
(
pCtx
->
inputType
)
{
case
TSDB_DATA_TYPE_INT
:
{
CFR_SET_VAL
(
int32_t
,
data
,
pCtx
,
round
,
i
,
step
,
notNullElems
);
break
;
};
case
TSDB_DATA_TYPE_UINT
:
{
CFR_SET_VAL
(
uint32_t
,
data
,
pCtx
,
round
,
i
,
step
,
notNullElems
);
break
;
};
case
TSDB_DATA_TYPE_BIGINT
:
{
CFR_SET_VAL
(
int64_t
,
data
,
pCtx
,
round
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_UBIGINT
:
{
CFR_SET_VAL
(
uint64_t
,
data
,
pCtx
,
round
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
CFR_SET_VAL_DOUBLE
(
data
,
pCtx
,
round
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
CFR_SET_VAL
(
float
,
data
,
pCtx
,
round
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
CFR_SET_VAL
(
int16_t
,
data
,
pCtx
,
round
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_USMALLINT
:
{
CFR_SET_VAL
(
uint16_t
,
data
,
pCtx
,
round
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_TINYINT
:
{
CFR_SET_VAL
(
int8_t
,
data
,
pCtx
,
round
,
i
,
step
,
notNullElems
);
break
;
}
case
TSDB_DATA_TYPE_UTINYINT
:
{
CFR_SET_VAL
(
uint8_t
,
data
,
pCtx
,
round
,
i
,
step
,
notNullElems
);
break
;
}
default:
qError
(
"error input type"
);
}
if
(
notNullElems
<=
0
)
{
/*
* current block may be null value
*/
assert
(
pCtx
->
hasNull
);
}
else
{
GET_RES_INFO
(
pCtx
)
->
numOfRes
+=
notNullElems
;
}
}
#undef CFR_SET_VAL
#undef CFR_SET_VAL_DOUBLE
//////////////////////////////////////////////////////////////////////////////////
//cumulative_sum function
...
...
@@ -5074,8 +4846,8 @@ int32_t functionCompatList[] = {
4
,
-
1
,
-
1
,
1
,
1
,
1
,
1
,
1
,
1
,
-
1
,
// tag, colprj, tagprj, arithm, diff, first_dist, last_dist, stddev_dst, interp rate, irate
1
,
1
,
1
,
1
,
-
1
,
1
,
1
,
1
,
5
,
1
,
1
,
// tid_tag, deriv, c
eil, floor, round, c
sum, mavg, sample,
6
,
8
,
1
,
1
,
1
,
-
1
,
-
1
,
-
1
,
// tid_tag, deriv, csum, mavg, sample,
6
,
8
,
-
1
,
-
1
,
-
1
,
// block_info
7
};
...
...
@@ -5479,39 +5251,6 @@ SAggFunctionInfo aAggs[] = {{
noop1
,
dataBlockRequired
,
},
{
// 33
"ceil"
,
TSDB_FUNC_CEIL
,
TSDB_FUNC_CEIL
,
TSDB_FUNCSTATE_MO
|
TSDB_FUNCSTATE_STABLE
|
TSDB_FUNCSTATE_NEED_TS
|
TSDB_FUNCSTATE_SCALAR
,
function_setup
,
ceil_function
,
doFinalizer
,
noop1
,
dataBlockRequired
},
{
// 34
"floor"
,
TSDB_FUNC_FLOOR
,
TSDB_FUNC_FLOOR
,
TSDB_FUNCSTATE_MO
|
TSDB_FUNCSTATE_STABLE
|
TSDB_FUNCSTATE_NEED_TS
|
TSDB_FUNCSTATE_SCALAR
,
function_setup
,
floor_function
,
doFinalizer
,
noop1
,
dataBlockRequired
},
{
// 35
"round"
,
TSDB_FUNC_ROUND
,
TSDB_FUNC_ROUND
,
TSDB_FUNCSTATE_MO
|
TSDB_FUNCSTATE_STABLE
|
TSDB_FUNCSTATE_NEED_TS
|
TSDB_FUNCSTATE_SCALAR
,
function_setup
,
round_function
,
doFinalizer
,
noop1
,
dataBlockRequired
},
{
// 36
"csum"
,
...
...
tests/pytest/functions/function_ceil.py
浏览文件 @
daab0724
...
...
@@ -1294,21 +1294,21 @@ class TDTestCase:
double_col double, binary_col binary(8), smallint_col smallint, tinyint_col tinyint, bool_col bool, nchar_col nchar(8),
\
uint_col int unsigned, ubigint_col bigint unsigned, usmallint_col smallint unsigned, utinyint_col tinyint unsigned) tags (int_tag int, bigint_tag bigint,
\
float_tag float, double_tag double, binary_tag binary(8), smallint_tag smallint, tinyint_tag tinyint, bool_tag bool, nchar_tag nchar(8),
\
uint_tag int unsigned, ubigint_tag bigint unsigned, usmallint_tag smallint unsigned, utinyint_tag tinyint unsigned)"
uint_tag int unsigned, ubigint_tag bigint unsigned, usmallint_tag smallint unsigned, utinyint_tag tinyint unsigned
, timestamp_tag timestamp
)"
)
tdSql
.
execute
(
"create stable superb (ts timestamp, timestamp_col timestamp, int_col int, bigint_col bigint, float_col float,
\
double_col double, binary_col binary(8), smallint_col smallint, tinyint_col tinyint, bool_col bool, nchar_col nchar(8),
\
uint_col int unsigned, ubigint_col bigint unsigned, usmallint_col smallint unsigned, utinyint_col tinyint unsigned) tags (int_tag int, bigint_tag bigint,
\
float_tag float, double_tag double, binary_tag binary(8), smallint_tag smallint, tinyint_tag tinyint, bool_tag bool, nchar_tag nchar(8),
\
uint_tag int unsigned, ubigint_tag bigint unsigned, usmallint_tag smallint unsigned, utinyint_tag tinyint unsigned)"
uint_tag int unsigned, ubigint_tag bigint unsigned, usmallint_tag smallint unsigned, utinyint_tag tinyint unsigned
, timestamp_tag timestamp
)"
)
tdSql
.
execute
(
"create table t1 using super tags (1, %d, %f, %f, '%s', %d, %d, 1, '%s', %d, %d, %d, %d)"
"create table t1 using super tags (1, %d, %f, %f, '%s', %d, %d, 1, '%s', %d, %d, %d, %d
, %s
)"
%
(
self
.
randomBigint
(),
self
.
randomDouble
(),
self
.
randomDouble
(),
self
.
randomNchar
(),
self
.
randomSmallint
(),
self
.
randomTinyint
(),
self
.
randomNchar
(),
self
.
randomUInt
(),
self
.
randomUBigint
(),
self
.
randomUSmallint
(),
self
.
randomUTinyint
()))
self
.
randomUSmallint
(),
self
.
randomUTinyint
()
,
'now'
))
tdSql
.
execute
(
"insert into t1 values (1629796215891, 1629796215891, %d, %d, %f, %f, '%s', %d, %d, 1, '%s', %d, %d, %d, %d)"
%
(
self
.
randomInt
(),
self
.
randomBigint
(),
self
.
randomDouble
(),
...
...
@@ -1338,11 +1338,11 @@ class TDTestCase:
self
.
randomUBigint
(),
self
.
randomUSmallint
(),
self
.
randomUTinyint
()))
tdSql
.
execute
(
"create table t2 using superb tags (1, %d, %f, %f, '%s', %d, %d, 1, '%s', %d, %d, %d, %d)"
"create table t2 using superb tags (1, %d, %f, %f, '%s', %d, %d, 1, '%s', %d, %d, %d, %d
, %s
)"
%
(
self
.
randomBigint
(),
self
.
randomDouble
(),
self
.
randomDouble
(),
self
.
randomNchar
(),
self
.
randomSmallint
(),
self
.
randomTinyint
(),
self
.
randomNchar
(),
self
.
randomUInt
(),
self
.
randomUBigint
(),
self
.
randomUSmallint
(),
self
.
randomUTinyint
()))
self
.
randomUSmallint
(),
self
.
randomUTinyint
()
,
'now'
))
tdSql
.
execute
(
"insert into t2 values (1629796215891, 1629796215891, %d, %d, %f, %f, '%s', %d, %d, 1, '%s', %d, %d, %d, %d)"
%
(
self
.
randomInt
(),
self
.
randomBigint
(),
self
.
randomDouble
(),
...
...
@@ -1372,139 +1372,562 @@ class TDTestCase:
self
.
randomUBigint
(),
self
.
randomUSmallint
(),
self
.
randomUTinyint
()))
shouldPass
=
[
'select ceil(int_col) from super'
,
'select ceil(int_col) from t1'
,
'select ceil(bigint_col) from super'
,
'select ceil(bigint_col) from t1'
,
'select ceil(float_col) from super'
,
'select ceil(float_col) from t1'
,
'select ceil(double_col) from super'
,
'select ceil(double_col) from t1'
,
'select ceil(smallint_col) from super'
,
'select ceil(smallint_col) from t1'
,
'select ceil(tinyint_col) from super'
,
'select ceil(tinyint_col) from t1'
,
'select ceil(uint_col) from super'
,
'select ceil(uint_col) from t1'
,
'select ceil(ubigint_col) from super'
,
'select ceil(ubigint_col) from t1'
,
'select ceil(usmallint_col) from super'
,
'select ceil(usmallint_col) from t1'
,
'select ceil(utinyint_col) from super'
,
'select ceil(utinyint_col) from t1'
,
'select ceil(int_col) - ceil(int_col) from super'
,
'select ceil(int_col) - ceil(int_col) from t1'
,
'select ceil(bigint_col) - ceil(bigint_col) from super'
,
'select ceil(bigint_col) - ceil(bigint_col) from t1'
,
'select ceil(float_col) - ceil(float_col) from super'
,
'select ceil(float_col) - ceil(float_col) from t1'
,
'select ceil(double_col) - ceil(double_col) from super'
,
'select ceil(double_col) - ceil(double_col) from t1'
,
'select ceil(smallint_col) - ceil(smallint_col) from super'
,
'select ceil(smallint_col) - ceil(smallint_col) from t1'
,
'select ceil(tinyint_col) - ceil(tinyint_col) from super'
,
'select ceil(tinyint_col) - ceil(tinyint_col) from t1'
,
'select ceil(uint_col) - ceil(uint_col) from super'
,
'select ceil(uint_col) - ceil(uint_col) from t1'
,
'select ceil(ubigint_col) - ceil(ubigint_col) from super'
,
'select ceil(ubigint_col) - ceil(ubigint_col) from t1'
,
'select ceil(usmallint_col) - ceil(usmallint_col) from super'
,
'select ceil(usmallint_col) - ceil(usmallint_col) from t1'
,
'select ceil(utinyint_col) - ceil(utinyint_col) from super'
,
'select ceil(utinyint_col) - ceil(utinyint_col) from t1'
,
'select ceil(int_col) / ceil(int_col) from super'
,
'select ceil(int_col) / ceil(int_col) from t1'
,
'select ceil(bigint_col) / ceil(bigint_col) from super'
,
'select ceil(bigint_col) / ceil(bigint_col) from t1'
,
'select ceil(float_col) / ceil(float_col) from super'
,
'select ceil(float_col) / ceil(float_col) from t1'
,
'select ceil(double_col) / ceil(double_col) from super'
,
'select ceil(double_col) / ceil(double_col) from t1'
,
'select ceil(smallint_col) / ceil(smallint_col) from super'
,
'select ceil(smallint_col) / ceil(smallint_col) from t1'
,
'select ceil(tinyint_col) / ceil(tinyint_col) from super'
,
'select ceil(tinyint_col) / ceil(tinyint_col) from t1'
,
'select ceil(uint_col) / ceil(uint_col) from super'
,
'select ceil(uint_col) / ceil(uint_col) from t1'
,
'select ceil(ubigint_col) / ceil(ubigint_col) from super'
,
'select ceil(ubigint_col) / ceil(ubigint_col) from t1'
,
'select ceil(usmallint_col) / ceil(usmallint_col) from super'
,
'select ceil(usmallint_col) / ceil(usmallint_col) from t1'
,
'select ceil(utinyint_col) / ceil(utinyint_col) from super'
,
'select ceil(utinyint_col) / ceil(utinyint_col) from t1'
,
'select ceil(int_col) * ceil(int_col) from super'
,
'select ceil(int_col) * ceil(int_col) from t1'
,
'select ceil(bigint_col) * ceil(bigint_col) from super'
,
'select ceil(bigint_col) * ceil(bigint_col) from t1'
,
'select ceil(float_col) * ceil(float_col) from super'
,
'select ceil(float_col) * ceil(float_col) from t1'
,
'select ceil(double_col) * ceil(double_col) from super'
,
'select ceil(double_col) * ceil(double_col) from t1'
,
'select ceil(smallint_col) * ceil(smallint_col) from super'
,
'select ceil(smallint_col) * ceil(smallint_col) from t1'
,
'select ceil(tinyint_col) * ceil(tinyint_col) from super'
,
'select ceil(tinyint_col) * ceil(tinyint_col) from t1'
,
'select ceil(uint_col) * ceil(uint_col) from super'
,
'select ceil(uint_col) * ceil(uint_col) from t1'
,
'select ceil(ubigint_col) * ceil(ubigint_col) from super'
,
'select ceil(ubigint_col) * ceil(ubigint_col) from t1'
,
'select ceil(usmallint_col) * ceil(usmallint_col) from super'
,
'select ceil(usmallint_col) * ceil(usmallint_col) from t1'
,
'select ceil(utinyint_col) * ceil(utinyint_col) from super'
,
'select ceil(utinyint_col) * ceil(utinyint_col) from t1'
,
'select ceil(count(ts)) from super'
,
'select ceil(count(ts)) from t1'
,
'select ceil(count(timestamp_col)) from super'
,
'select ceil(count(timestamp_col)) from t1'
,
'select ceil(count(int_col)) from super'
,
'select ceil(count(int_col)) from t1'
,
'select ceil(count(bigint_col)) from super'
,
'select ceil(count(bigint_col)) from t1'
,
'select ceil(count(float_col)) from super'
,
'select ceil(count(float_col)) from t1'
,
'select ceil(count(double_col)) from super'
,
'select ceil(count(double_col)) from t1'
,
'select ceil(count(binary_col)) from super'
,
'select ceil(count(binary_col)) from t1'
,
'select ceil(count(smallint_col)) from super'
,
'select ceil(count(smallint_col)) from t1'
,
'select ceil(count(tinyint_col)) from super'
,
'select ceil(count(tinyint_col)) from t1'
,
'select ceil(count(bool_col)) from super'
,
'select ceil(count(bool_col)) from t1'
,
'select ceil(count(nchar_col)) from super'
,
'select ceil(count(nchar_col)) from t1'
,
'select ceil(count(uint_col)) from super'
,
'select ceil(count(uint_col)) from t1'
,
'select ceil(count(ubigint_col)) from super'
,
'select ceil(count(ubigint_col)) from t1'
,
'select ceil(count(usmallint_col)) from super'
,
'select ceil(count(usmallint_col)) from t1'
,
'select ceil(count(utinyint_col)) from super'
,
'select ceil(count(utinyint_col)) from t1'
,
'select ceil(count(timestamp_tag)) from super'
,
'select ceil(count(timestamp_tag)) from t1'
,
'select ceil(count(int_tag)) from super'
,
'select ceil(count(int_tag)) from t1'
,
'select ceil(count(bigint_tag)) from super'
,
'select ceil(count(bigint_tag)) from t1'
,
'select ceil(count(float_tag)) from super'
,
'select ceil(count(float_tag)) from t1'
,
'select ceil(count(double_tag)) from super'
,
'select ceil(count(double_tag)) from t1'
,
'select ceil(count(binary_tag)) from super'
,
'select ceil(count(binary_tag)) from t1'
,
'select ceil(count(smallint_tag)) from super'
,
'select ceil(count(smallint_tag)) from t1'
,
'select ceil(count(tinyint_tag)) from super'
,
'select ceil(count(tinyint_tag)) from t1'
,
'select ceil(count(bool_tag)) from super'
,
'select ceil(count(bool_tag)) from t1'
,
'select ceil(count(nchar_tag)) from super'
,
'select ceil(count(nchar_tag)) from t1'
,
'select ceil(count(uint_tag)) from super'
,
'select ceil(count(uint_tag)) from t1'
,
'select ceil(count(ubigint_tag)) from super'
,
'select ceil(count(ubigint_tag)) from t1'
,
'select ceil(count(usmallint_tag)) from super'
,
'select ceil(count(usmallint_tag)) from t1'
,
'select ceil(count(utinyint_tag)) from super'
,
'select ceil(count(utinyint_tag)) from t1'
,
'select ceil(avg(int_col)) from super'
,
'select ceil(avg(int_col)) from t1'
,
'select ceil(avg(bigint_col)) from super'
,
'select ceil(avg(bigint_col)) from t1'
,
'select ceil(avg(float_col)) from super'
,
'select ceil(avg(float_col)) from t1'
,
'select ceil(avg(double_col)) from super'
,
'select ceil(avg(double_col)) from t1'
,
'select ceil(avg(smallint_col)) from super'
,
'select ceil(avg(smallint_col)) from t1'
,
'select ceil(avg(tinyint_col)) from super'
,
'select ceil(avg(tinyint_col)) from t1'
,
'select ceil(avg(uint_col)) from super'
,
'select ceil(avg(uint_col)) from t1'
,
'select ceil(avg(ubigint_col)) from super'
,
'select ceil(avg(ubigint_col)) from t1'
,
'select ceil(avg(usmallint_col)) from super'
,
'select ceil(avg(usmallint_col)) from t1'
,
'select ceil(avg(utinyint_col)) from super'
,
'select ceil(avg(utinyint_col)) from t1'
,
'select ceil(twa(int_col)) from t1'
,
'select ceil(twa(bigint_col)) from t1'
,
'select ceil(twa(float_col)) from t1'
,
'select ceil(twa(double_col)) from t1'
,
'select ceil(twa(smallint_col)) from t1'
,
'select ceil(twa(tinyint_col)) from t1'
,
'select ceil(twa(uint_col)) from t1'
,
'select ceil(twa(ubigint_col)) from t1'
,
'select ceil(twa(usmallint_col)) from t1'
,
'select ceil(twa(utinyint_col)) from t1'
,
'select ceil(sum(int_col)) from super'
,
'select ceil(sum(int_col)) from t1'
,
'select ceil(sum(bigint_col)) from super'
,
'select ceil(sum(bigint_col)) from t1'
,
'select ceil(sum(float_col)) from super'
,
'select ceil(sum(float_col)) from t1'
,
'select ceil(sum(double_col)) from super'
,
'select ceil(sum(double_col)) from t1'
,
'select ceil(sum(smallint_col)) from super'
,
'select ceil(sum(smallint_col)) from t1'
,
'select ceil(sum(tinyint_col)) from super'
,
'select ceil(sum(tinyint_col)) from t1'
,
'select ceil(sum(uint_col)) from super'
,
'select ceil(sum(uint_col)) from t1'
,
'select ceil(sum(ubigint_col)) from super'
,
'select ceil(sum(ubigint_col)) from t1'
,
'select ceil(sum(usmallint_col)) from super'
,
'select ceil(sum(usmallint_col)) from t1'
,
'select ceil(sum(utinyint_col)) from super'
,
'select ceil(sum(utinyint_col)) from t1'
,
'select ceil(stddev(int_col)) from super'
,
'select ceil(stddev(int_col)) from t1'
,
'select ceil(stddev(bigint_col)) from super'
,
'select ceil(stddev(bigint_col)) from t1'
,
'select ceil(stddev(float_col)) from super'
,
'select ceil(stddev(float_col)) from t1'
,
'select ceil(stddev(double_col)) from super'
,
'select ceil(stddev(double_col)) from t1'
,
'select ceil(stddev(smallint_col)) from super'
,
'select ceil(stddev(smallint_col)) from t1'
,
'select ceil(stddev(tinyint_col)) from super'
,
'select ceil(stddev(tinyint_col)) from t1'
,
'select ceil(stddev(uint_col)) from super'
,
'select ceil(stddev(uint_col)) from t1'
,
'select ceil(stddev(ubigint_col)) from super'
,
'select ceil(stddev(ubigint_col)) from t1'
,
'select ceil(stddev(usmallint_col)) from super'
,
'select ceil(stddev(usmallint_col)) from t1'
,
'select ceil(stddev(utinyint_col)) from super'
,
'select ceil(stddev(utinyint_col)) from t1'
,
'select ceil(irate(int_col)) from t1'
,
'select ceil(irate(bigint_col)) from t1'
,
'select ceil(irate(float_col)) from t1'
,
'select ceil(irate(double_col)) from t1'
,
'select ceil(irate(smallint_col)) from t1'
,
'select ceil(irate(tinyint_col)) from t1'
,
'select ceil(irate(uint_col)) from t1'
,
'select ceil(irate(ubigint_col)) from t1'
,
'select ceil(irate(usmallint_col)) from t1'
,
'select ceil(irate(utinyint_col)) from t1'
,
'select ceil(min(int_col)) from super'
,
'select ceil(min(int_col)) from t1'
,
'select ceil(min(bigint_col)) from super'
,
'select ceil(min(bigint_col)) from t1'
,
'select ceil(min(float_col)) from super'
,
'select ceil(min(float_col)) from t1'
,
'select ceil(min(double_col)) from super'
,
'select ceil(min(double_col)) from t1'
,
'select ceil(min(smallint_col)) from super'
,
'select ceil(min(smallint_col)) from t1'
,
'select ceil(min(tinyint_col)) from super'
,
'select ceil(min(tinyint_col)) from t1'
,
'select ceil(min(uint_col)) from super'
,
'select ceil(min(uint_col)) from t1'
,
'select ceil(min(ubigint_col)) from super'
,
'select ceil(min(ubigint_col)) from t1'
,
'select ceil(min(usmallint_col)) from super'
,
'select ceil(min(usmallint_col)) from t1'
,
'select ceil(min(utinyint_col)) from super'
,
'select ceil(min(utinyint_col)) from t1'
,
'select ceil(max(int_col)) from super'
,
'select ceil(max(int_col)) from t1'
,
'select ceil(max(bigint_col)) from super'
,
'select ceil(max(bigint_col)) from t1'
,
'select ceil(max(float_col)) from super'
,
'select ceil(max(float_col)) from t1'
,
'select ceil(max(double_col)) from super'
,
'select ceil(max(double_col)) from t1'
,
'select ceil(max(smallint_col)) from super'
,
'select ceil(max(smallint_col)) from t1'
,
'select ceil(max(tinyint_col)) from super'
,
'select ceil(max(tinyint_col)) from t1'
,
'select ceil(max(uint_col)) from super'
,
'select ceil(max(uint_col)) from t1'
,
'select ceil(max(ubigint_col)) from super'
,
'select ceil(max(ubigint_col)) from t1'
,
'select ceil(max(usmallint_col)) from super'
,
'select ceil(max(usmallint_col)) from t1'
,
'select ceil(max(utinyint_col)) from super'
,
'select ceil(max(utinyint_col)) from t1'
,
'select ceil(first(int_col)) from super'
,
'select ceil(first(int_col)) from t1'
,
'select ceil(first(bigint_col)) from super'
,
'select ceil(first(bigint_col)) from t1'
,
'select ceil(first(float_col)) from super'
,
'select ceil(first(float_col)) from t1'
,
'select ceil(first(double_col)) from super'
,
'select ceil(first(double_col)) from t1'
,
'select ceil(first(smallint_col)) from super'
,
'select ceil(first(smallint_col)) from t1'
,
'select ceil(first(tinyint_col)) from super'
,
'select ceil(first(tinyint_col)) from t1'
,
'select ceil(first(uint_col)) from super'
,
'select ceil(first(uint_col)) from t1'
,
'select ceil(first(ubigint_col)) from super'
,
'select ceil(first(ubigint_col)) from t1'
,
'select ceil(first(usmallint_col)) from super'
,
'select ceil(first(usmallint_col)) from t1'
,
'select ceil(first(utinyint_col)) from super'
,
'select ceil(first(utinyint_col)) from t1'
,
'select ceil(last(int_col)) from super'
,
'select ceil(last(int_col)) from t1'
,
'select ceil(last(bigint_col)) from super'
,
'select ceil(last(bigint_col)) from t1'
,
'select ceil(last(float_col)) from super'
,
'select ceil(last(float_col)) from t1'
,
'select ceil(last(double_col)) from super'
,
'select ceil(last(double_col)) from t1'
,
'select ceil(last(smallint_col)) from super'
,
'select ceil(last(smallint_col)) from t1'
,
'select ceil(last(tinyint_col)) from super'
,
'select ceil(last(tinyint_col)) from t1'
,
'select ceil(last(uint_col)) from super'
,
'select ceil(last(uint_col)) from t1'
,
'select ceil(last(ubigint_col)) from super'
,
'select ceil(last(ubigint_col)) from t1'
,
'select ceil(last(usmallint_col)) from super'
,
'select ceil(last(usmallint_col)) from t1'
,
'select ceil(last(utinyint_col)) from super'
,
'select ceil(last(utinyint_col)) from t1'
,
'select ceil(percentile(int_col, 1)) from t1'
,
'select ceil(percentile(bigint_col, 1)) from t1'
,
'select ceil(percentile(float_col, 1)) from t1'
,
'select ceil(percentile(double_col, 1)) from t1'
,
'select ceil(percentile(smallint_col, 1)) from t1'
,
'select ceil(percentile(tinyint_col, 1)) from t1'
,
'select ceil(percentile(uint_col, 1)) from t1'
,
'select ceil(percentile(ubigint_col, 1)) from t1'
,
'select ceil(percentile(usmallint_col, 1)) from t1'
,
'select ceil(percentile(utinyint_col, 1)) from t1'
,
'select ceil(apercentile(int_col, 1)) from super'
,
'select ceil(apercentile(int_col, 1)) from t1'
,
'select ceil(apercentile(bigint_col, 1)) from super'
,
'select ceil(apercentile(bigint_col, 1)) from t1'
,
'select ceil(apercentile(float_col, 1)) from super'
,
'select ceil(apercentile(float_col, 1)) from t1'
,
'select ceil(apercentile(double_col, 1)) from super'
,
'select ceil(apercentile(double_col, 1)) from t1'
,
'select ceil(apercentile(smallint_col, 1)) from super'
,
'select ceil(apercentile(smallint_col, 1)) from t1'
,
'select ceil(apercentile(tinyint_col, 1)) from super'
,
'select ceil(apercentile(tinyint_col, 1)) from t1'
,
'select ceil(apercentile(uint_col, 1)) from super'
,
'select ceil(apercentile(uint_col, 1)) from t1'
,
'select ceil(apercentile(ubigint_col, 1)) from super'
,
'select ceil(apercentile(ubigint_col, 1)) from t1'
,
'select ceil(apercentile(usmallint_col, 1)) from super'
,
'select ceil(apercentile(usmallint_col, 1)) from t1'
,
'select ceil(apercentile(utinyint_col, 1)) from super'
,
'select ceil(apercentile(utinyint_col, 1)) from t1'
,
'select ceil(last_row(int_col)) from super'
,
'select ceil(last_row(int_col)) from t1'
,
'select ceil(last_row(bigint_col)) from super'
,
'select ceil(last_row(bigint_col)) from t1'
,
'select ceil(last_row(float_col)) from super'
,
'select ceil(last_row(float_col)) from t1'
,
'select ceil(last_row(double_col)) from super'
,
'select ceil(last_row(double_col)) from t1'
,
'select ceil(last_row(smallint_col)) from super'
,
'select ceil(last_row(smallint_col)) from t1'
,
'select ceil(last_row(tinyint_col)) from super'
,
'select ceil(last_row(tinyint_col)) from t1'
,
'select ceil(last_row(uint_col)) from super'
,
'select ceil(last_row(uint_col)) from t1'
,
'select ceil(last_row(ubigint_col)) from super'
,
'select ceil(last_row(ubigint_col)) from t1'
,
'select ceil(last_row(usmallint_col)) from super'
,
'select ceil(last_row(usmallint_col)) from t1'
,
'select ceil(last_row(utinyint_col)) from super'
,
'select ceil(last_row(utinyint_col)) from t1'
,
'select ceil(spread(ts)) from super'
,
'select ceil(spread(ts)) from t1'
,
'select ceil(spread(timestamp_col)) from super'
,
'select ceil(spread(timestamp_col)) from t1'
,
'select ceil(spread(int_col)) from super'
,
'select ceil(spread(int_col)) from t1'
,
'select ceil(spread(bigint_col)) from super'
,
'select ceil(spread(bigint_col)) from t1'
,
'select ceil(spread(float_col)) from super'
,
'select ceil(spread(float_col)) from t1'
,
'select ceil(spread(double_col)) from super'
,
'select ceil(spread(double_col)) from t1'
,
'select ceil(spread(smallint_col)) from super'
,
'select ceil(spread(smallint_col)) from t1'
,
'select ceil(spread(tinyint_col)) from super'
,
'select ceil(spread(tinyint_col)) from t1'
,
'select ceil(spread(uint_col)) from super'
,
'select ceil(spread(uint_col)) from t1'
,
'select ceil(spread(ubigint_col)) from super'
,
'select ceil(spread(ubigint_col)) from t1'
,
'select ceil(spread(usmallint_col)) from super'
,
'select ceil(spread(usmallint_col)) from t1'
,
'select ceil(spread(utinyint_col)) from super'
,
'select ceil(spread(utinyint_col)) from t1'
,
'select ceil(int_col + int_col) from super'
,
'select ceil(int_col + int_col) from t1'
,
'select ceil(bigint_col + bigint_col) from super'
,
'select ceil(bigint_col + bigint_col) from t1'
,
'select ceil(float_col + float_col) from super'
,
'select ceil(float_col + float_col) from t1'
,
'select ceil(double_col + double_col) from super'
,
'select ceil(double_col + double_col) from t1'
,
'select ceil(smallint_col + smallint_col) from super'
,
'select ceil(smallint_col + smallint_col) from t1'
,
'select ceil(tinyint_col + tinyint_col) from super'
,
'select ceil(tinyint_col + tinyint_col) from t1'
,
'select ceil(uint_col + uint_col) from super'
,
'select ceil(uint_col + uint_col) from t1'
,
'select ceil(ubigint_col + ubigint_col) from super'
,
'select ceil(ubigint_col + ubigint_col) from t1'
,
'select ceil(usmallint_col + usmallint_col) from super'
,
'select ceil(usmallint_col + usmallint_col) from t1'
,
'select ceil(utinyint_col + utinyint_col) from super'
,
'select ceil(utinyint_col + utinyint_col) from t1'
,
'select ceil(int_col - int_col) from super'
,
'select ceil(int_col - int_col) from t1'
,
'select ceil(bigint_col - bigint_col) from super'
,
'select ceil(bigint_col - bigint_col) from t1'
,
'select ceil(float_col - float_col) from super'
,
'select ceil(float_col - float_col) from t1'
,
'select ceil(double_col - double_col) from super'
,
'select ceil(double_col - double_col) from t1'
,
'select ceil(smallint_col - smallint_col) from super'
,
'select ceil(smallint_col - smallint_col) from t1'
,
'select ceil(tinyint_col - tinyint_col) from super'
,
'select ceil(tinyint_col - tinyint_col) from t1'
,
'select ceil(uint_col - uint_col) from super'
,
'select ceil(uint_col - uint_col) from t1'
,
'select ceil(ubigint_col - ubigint_col) from super'
,
'select ceil(ubigint_col - ubigint_col) from t1'
,
'select ceil(usmallint_col - usmallint_col) from super'
,
'select ceil(usmallint_col - usmallint_col) from t1'
,
'select ceil(utinyint_col - utinyint_col) from super'
,
'select ceil(utinyint_col - utinyint_col) from t1'
,
'select ceil(int_col * int_col) from super'
,
'select ceil(int_col * int_col) from t1'
,
'select ceil(bigint_col * bigint_col) from super'
,
'select ceil(bigint_col * bigint_col) from t1'
,
'select ceil(float_col * float_col) from super'
,
'select ceil(float_col * float_col) from t1'
,
'select ceil(double_col * double_col) from super'
,
'select ceil(double_col * double_col) from t1'
,
'select ceil(smallint_col * smallint_col) from super'
,
'select ceil(smallint_col * smallint_col) from t1'
,
'select ceil(tinyint_col * tinyint_col) from super'
,
'select ceil(tinyint_col * tinyint_col) from t1'
,
'select ceil(uint_col * uint_col) from super'
,
'select ceil(uint_col * uint_col) from t1'
,
'select ceil(ubigint_col * ubigint_col) from super'
,
'select ceil(ubigint_col * ubigint_col) from t1'
,
'select ceil(usmallint_col * usmallint_col) from super'
,
'select ceil(usmallint_col * usmallint_col) from t1'
,
'select ceil(utinyint_col * utinyint_col) from super'
,
'select ceil(utinyint_col * utinyint_col) from t1'
,
'select ceil(int_col / int_col) from super'
,
'select ceil(int_col / int_col) from t1'
,
'select ceil(bigint_col / bigint_col) from super'
,
'select ceil(bigint_col / bigint_col) from t1'
,
'select ceil(float_col / float_col) from super'
,
'select ceil(float_col / float_col) from t1'
,
'select ceil(double_col / double_col) from super'
,
'select ceil(double_col / double_col) from t1'
,
'select ceil(smallint_col / smallint_col) from super'
,
'select ceil(smallint_col / smallint_col) from t1'
,
'select ceil(tinyint_col / tinyint_col) from super'
,
'select ceil(tinyint_col / tinyint_col) from t1'
,
'select ceil(uint_col / uint_col) from super'
,
'select ceil(uint_col / uint_col) from t1'
,
'select ceil(ubigint_col / ubigint_col) from super'
,
'select ceil(ubigint_col / ubigint_col) from t1'
,
'select ceil(usmallint_col / usmallint_col) from super'
,
'select ceil(usmallint_col / usmallint_col) from t1'
,
'select ceil(utinyint_col / utinyint_col) from super'
,
'select ceil(utinyint_col / utinyint_col) from t1'
,
'select int_col, ceil(int_col), int_col from super'
,
'select int_col, ceil(int_col), int_col from t1'
,
'select bigint_col, ceil(bigint_col), bigint_col from super'
,
'select bigint_col, ceil(bigint_col), bigint_col from t1'
,
'select float_col, ceil(float_col), float_col from super'
,
'select float_col, ceil(float_col), float_col from t1'
,
'select double_col, ceil(double_col), double_col from super'
,
'select double_col, ceil(double_col), double_col from t1'
,
'select smallint_col, ceil(smallint_col), smallint_col from super'
,
'select smallint_col, ceil(smallint_col), smallint_col from t1'
,
'select tinyint_col, ceil(tinyint_col), tinyint_col from super'
,
'select tinyint_col, ceil(tinyint_col), tinyint_col from t1'
,
'select uint_col, ceil(uint_col), uint_col from super'
,
'select uint_col, ceil(uint_col), uint_col from t1'
,
'select ubigint_col, ceil(ubigint_col), ubigint_col from super'
,
'select ubigint_col, ceil(ubigint_col), ubigint_col from t1'
,
'select usmallint_col, ceil(usmallint_col), usmallint_col from super'
,
'select usmallint_col, ceil(usmallint_col), usmallint_col from t1'
,
'select utinyint_col, ceil(utinyint_col), utinyint_col from super'
,
'select utinyint_col, ceil(utinyint_col), utinyint_col from t1'
,
'select 1, ceil(int_col), 1 from super'
,
'select 1, ceil(int_col), 1 from t1'
,
'select 1, ceil(bigint_col), 1 from super'
,
'select 1, ceil(bigint_col), 1 from t1'
,
'select 1, ceil(float_col), 1 from super'
,
'select 1, ceil(float_col), 1 from t1'
,
'select 1, ceil(double_col), 1 from super'
,
'select 1, ceil(double_col), 1 from t1'
,
'select 1, ceil(smallint_col), 1 from super'
,
'select 1, ceil(smallint_col), 1 from t1'
,
'select 1, ceil(tinyint_col), 1 from super'
,
'select 1, ceil(tinyint_col), 1 from t1'
,
'select 1, ceil(uint_col), 1 from super'
,
'select 1, ceil(uint_col), 1 from t1'
,
'select 1, ceil(ubigint_col), 1 from super'
,
'select 1, ceil(ubigint_col), 1 from t1'
,
'select 1, ceil(usmallint_col), 1 from super'
,
'select 1, ceil(usmallint_col), 1 from t1'
,
'select 1, ceil(utinyint_col), 1 from super'
,
'select 1, ceil(utinyint_col), 1 from t1'
,
'select ceil(int_col) as anyName from super'
,
'select ceil(int_col) as anyName from t1'
,
'select ceil(bigint_col) as anyName from super'
,
'select ceil(bigint_col) as anyName from t1'
,
'select ceil(float_col) as anyName from super'
,
'select ceil(float_col) as anyName from t1'
,
'select ceil(double_col) as anyName from super'
,
'select ceil(double_col) as anyName from t1'
,
'select ceil(smallint_col) as anyName from super'
,
'select ceil(smallint_col) as anyName from t1'
,
'select ceil(tinyint_col) as anyName from super'
,
'select ceil(tinyint_col) as anyName from t1'
,
'select ceil(uint_col) as anyName from super'
,
'select ceil(uint_col) as anyName from t1'
,
'select ceil(ubigint_col) as anyName from super'
,
'select ceil(ubigint_col) as anyName from t1'
,
'select ceil(usmallint_col) as anyName from super'
,
'select ceil(usmallint_col) as anyName from t1'
,
'select ceil(utinyint_col) as anyName from super'
,
'select ceil(utinyint_col) as anyName from t1'
]
for
s
in
range
(
len
(
select_command
)):
for
f
in
range
(
len
(
from_command
)):
sql
=
"select "
+
select_command
[
s
]
+
from_command
[
f
]
if
(
select_command
[
s
]
==
"ceil(int_col)"
\
or
select_command
[
s
]
==
"ceil(bigint_col)"
\
or
select_command
[
s
]
==
"ceil(smallint_col)"
\
or
select_command
[
s
]
==
"ceil(float_col)"
\
or
select_command
[
s
]
==
"ceil(double_col)"
\
or
select_command
[
s
]
==
"ceil(tinyint_col)"
\
or
select_command
[
s
]
==
"ceil(uint_col)"
\
or
select_command
[
s
]
==
"ceil(ubigint_col)"
\
or
select_command
[
s
]
==
"ceil(usmallint_col)"
\
or
select_command
[
s
]
==
"ceil(utinyint_col)"
\
or
select_command
[
s
]
==
"1, ceil(int_col), 1"
\
or
select_command
[
s
]
==
"1, ceil(bigint_col), 1"
\
or
select_command
[
s
]
==
"1, ceil(float_col), 1"
\
or
select_command
[
s
]
==
"1, ceil(double_col), 1"
\
or
select_command
[
s
]
==
"1, ceil(smallint_col), 1"
\
or
select_command
[
s
]
==
"1, ceil(tinyint_col), 1"
\
or
select_command
[
s
]
==
"1, ceil(uint_col), 1"
\
or
select_command
[
s
]
==
"1, ceil(ubigint_col), 1"
\
or
select_command
[
s
]
==
"1, ceil(usmallint_col), 1"
\
or
select_command
[
s
]
==
"1, ceil(utinyint_col), 1"
\
or
select_command
[
s
]
==
"int_col, ceil(int_col), int_col"
\
or
select_command
[
s
]
==
"bigint_col, ceil(bigint_col), bigint_col"
\
or
select_command
[
s
]
==
"float_col, ceil(float_col), float_col"
\
or
select_command
[
s
]
==
"double_col, ceil(double_col), double_col"
\
or
select_command
[
s
]
==
"smallint_col, ceil(smallint_col), smallint_col"
\
or
select_command
[
s
]
==
"tinyint_col, ceil(tinyint_col), tinyint_col"
\
or
select_command
[
s
]
==
"uint_col, ceil(uint_col), uint_col"
\
or
select_command
[
s
]
==
"ubigint_col, ceil(ubigint_col), ubigint_col"
\
or
select_command
[
s
]
==
"usmallint_col, ceil(usmallint_col), usmallint_col"
\
or
select_command
[
s
]
==
"utinyint_col, ceil(utinyint_col), utinyint_col"
\
or
select_command
[
s
]
==
"ceil(int_col) as anyName"
\
or
select_command
[
s
]
==
"ceil(bigint_col) as anyName"
\
or
select_command
[
s
]
==
"ceil(float_col) as anyName"
\
or
select_command
[
s
]
==
"ceil(double_col) as anyName"
\
or
select_command
[
s
]
==
"ceil(smallint_col) as anyName"
\
or
select_command
[
s
]
==
"ceil(tinyint_col) as anyName"
\
or
select_command
[
s
]
==
"ceil(uint_col) as anyName"
\
or
select_command
[
s
]
==
"ceil(ubigint_col) as anyName"
\
or
select_command
[
s
]
==
"ceil(usmallint_col) as anyName"
\
or
select_command
[
s
]
==
"ceil(utinyint_col) as anyName"
\
or
select_command
[
s
]
==
"ceil(int_col) + ceil(int_col)"
\
or
select_command
[
s
]
==
"ceil(bigint_col) + ceil(bigint_col)"
\
or
select_command
[
s
]
==
"ceil(float_col) + ceil(float_col)"
\
or
select_command
[
s
]
==
"ceil(double_col) + ceil(double_col)"
\
or
select_command
[
s
]
==
"ceil(smallint_col) + ceil(smallint_col)"
\
or
select_command
[
s
]
==
"ceil(tinyint_col) + ceil(tinyint_col)"
\
or
select_command
[
s
]
==
"ceil(uint_col) + ceil(uint_col)"
\
or
select_command
[
s
]
==
"ceil(ubigint_col) + ceil(ubigint_col)"
\
or
select_command
[
s
]
==
"ceil(usmallint_col) + ceil(usmallint_col)"
\
or
select_command
[
s
]
==
"ceil(utinyint_col) + ceil(utinyint_col)"
\
or
select_command
[
s
]
==
"ceil(int_col) + ceil(int_col)"
\
or
select_command
[
s
]
==
"ceil(bigint_col) + ceil(bigint_col)"
\
or
select_command
[
s
]
==
"ceil(float_col) + ceil(float_col)"
\
or
select_command
[
s
]
==
"ceil(double_col) + ceil(double_col)"
\
or
select_command
[
s
]
==
"ceil(smallint_col) + ceil(smallint_col)"
\
or
select_command
[
s
]
==
"ceil(tinyint_col) + ceil(tinyint_col)"
\
or
select_command
[
s
]
==
"ceil(uint_col) + ceil(uint_col)"
\
or
select_command
[
s
]
==
"ceil(ubigint_col) + ceil(ubigint_col)"
\
or
select_command
[
s
]
==
"ceil(usmallint_col) + ceil(usmallint_col)"
\
or
select_command
[
s
]
==
"ceil(utinyint_col) + cei(utinyint_col)"
\
or
select_command
[
s
]
==
"ceil(int_col) - ceil(int_col)"
\
or
select_command
[
s
]
==
"ceil(bigint_col) - ceil(bigint_col)"
\
or
select_command
[
s
]
==
"ceil(float_col) - ceil(float_col)"
\
or
select_command
[
s
]
==
"ceil(double_col) - ceil(double_col)"
\
or
select_command
[
s
]
==
"ceil(smallint_col) - ceil(smallint_col)"
\
or
select_command
[
s
]
==
"ceil(tinyint_col) - ceil(tinyint_col)"
\
or
select_command
[
s
]
==
"ceil(uint_col) - ceil(uint_col)"
\
or
select_command
[
s
]
==
"ceil(ubigint_col) - ceil(ubigint_col)"
\
or
select_command
[
s
]
==
"ceil(usmallint_col) - ceil(usmallint_col)"
\
or
select_command
[
s
]
==
"ceil(utinyint_col) - ceil(utinyint_col)"
\
or
select_command
[
s
]
==
"ceil(int_col) * ceil(int_col)"
\
or
select_command
[
s
]
==
"ceil(bigint_col) * ceil(bigint_col)"
\
or
select_command
[
s
]
==
"ceil(float_col) * ceil(float_col)"
\
or
select_command
[
s
]
==
"ceil(double_col) * ceil(double_col)"
\
or
select_command
[
s
]
==
"ceil(smallint_col) * ceil(smallint_col)"
\
or
select_command
[
s
]
==
"ceil(tinyint_col) * ceil(tinyint_col)"
\
or
select_command
[
s
]
==
"ceil(uint_col) * ceil(uint_col)"
\
or
select_command
[
s
]
==
"ceil(ubigint_col) * ceil(ubigint_col)"
\
or
select_command
[
s
]
==
"ceil(usmallint_col) * ceil(usmallint_col)"
\
or
select_command
[
s
]
==
"ceil(utinyint_col) * ceil(utinyint_col)"
\
or
select_command
[
s
]
==
"ceil(int_col) / ceil(int_col)"
\
or
select_command
[
s
]
==
"ceil(bigint_col) / ceil(bigint_col)"
\
or
select_command
[
s
]
==
"ceil(float_col) / ceil(float_col)"
\
or
select_command
[
s
]
==
"ceil(double_col) / ceil(double_col)"
\
or
select_command
[
s
]
==
"ceil(smallint_col) / ceil(smallint_col)"
\
or
select_command
[
s
]
==
"ceil(tinyint_col) / ceil(tinyint_col)"
\
or
select_command
[
s
]
==
"ceil(uint_col) / ceil(uint_col)"
\
or
select_command
[
s
]
==
"ceil(ubigint_col) / ceil(ubigint_col)"
\
or
select_command
[
s
]
==
"ceil(usmallint_col) / ceil(usmallint_col)"
\
or
select_command
[
s
]
==
"ceil(utinyint_col) / ceil(utinyint_col)"
):
if
sql
in
shouldPass
:
tdSql
.
query
(
sql
)
else
:
tdSql
.
error
(
sql
)
shouldPass2
=
[
'select ceil(super.int_col) from super'
,
'select ceil(super.int_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag'
,
'select ceil(super.bigint_col) from super'
,
'select ceil(super.bigint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag'
,
'select ceil(super.float_col) from super'
,
'select ceil(super.float_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag'
,
'select ceil(super.double_col) from super'
,
'select ceil(super.double_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag'
,
'select ceil(super.smallint_col) from super'
,
'select ceil(super.smallint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag'
,
'select ceil(super.tinyint_col) from super'
,
'select ceil(super.tinyint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag'
,
'select ceil(super.uint_col) from super'
,
'select ceil(super.uint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag'
,
'select ceil(super.ubigint_col) from super'
,
'select ceil(super.ubigint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag'
,
'select ceil(super.usmallint_col) from super'
,
'select ceil(super.usmallint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag'
,
'select ceil(super.utinyint_col) from super'
,
'select ceil(super.utinyint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag'
,
'select ceil(t1.int_col) from t1'
,
'select ceil(t1.bigint_col) from t1'
,
'select ceil(t1.float_col) from t1'
,
'select ceil(t1.double_col) from t1'
,
'select ceil(t1.smallint_col) from t1'
,
'select ceil(t1.tinyint_col) from t1'
,
'select ceil(t1.uint_col) from t1'
,
'select ceil(t1.ubigint_col) from t1'
,
'select ceil(t1.usmallint_col) from t1'
,
'select ceil(t1.utinyint_col) from t1'
]
for
sim
in
range
(
len
(
simple_select_command
)):
for
fr
in
range
(
len
(
advance_from_command
)):
for
filter
in
range
(
len
(
filter_command
)):
for
groupby
in
range
(
len
(
filter_command
)):
for
fill
in
range
(
len
(
fill_command
)):
sql
=
"select "
+
simple_select_command
[
sim
]
+
advance_from_command
[
fr
]
+
filter_command
[
filter
]
+
fill_command
[
fill
]
if
sql
==
"select ceil(t1.int_col) from t1"
\
or
sql
==
"select ceil(super.int_col) from super"
\
or
sql
==
"select ceil(t1.bigint_col) from t1"
\
or
sql
==
"select ceil(super.bigint_col) from super"
\
or
sql
==
"select ceil(t1.smallint_col) from t1"
\
or
sql
==
"select ceil(super.smallint_col) from super"
\
or
sql
==
"select ceil(t1.tinyint_col) from t1"
\
or
sql
==
"select ceil(super.tinyint_col) from super"
\
or
sql
==
"select ceil(t1.float_col) from t1"
\
or
sql
==
"select ceil(super.float_col) from super"
\
or
sql
==
"select ceil(t1.double_col) from t1"
\
or
sql
==
"select ceil(super.double_col) from super"
\
or
sql
==
"select ceil(t1.uint_col) from t1"
\
or
sql
==
"select ceil(super.uint_col) from super"
\
or
sql
==
"select ceil(t1.ubigint_col) from t1"
\
or
sql
==
"select ceil(super.ubigint_col) from super"
\
or
sql
==
"select ceil(t1.usmallint_col) from t1"
\
or
sql
==
"select ceil(super.usmallint_col) from super"
\
or
sql
==
"select ceil(t1.utinyint_col) from t1"
\
or
sql
==
"select ceil(super.utinyint_col) from super"
\
or
sql
==
"select ceil(super.int_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag"
\
or
sql
==
"select ceil(super.bigint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag"
\
or
sql
==
"select ceil(super.smallint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag"
\
or
sql
==
"select ceil(super.tinyint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag"
\
or
sql
==
"select ceil(super.float_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag"
\
or
sql
==
"select ceil(super.double_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag"
\
or
sql
==
"select ceil(super.uint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag"
\
or
sql
==
"select ceil(super.ubigint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag"
\
or
sql
==
"select ceil(super.usmallint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag"
\
or
sql
==
"select ceil(super.utinyint_col) from super, superb where super.ts = superb.ts and super.int_tag = superb.int_tag"
:
sql
=
"select "
+
simple_select_command
[
sim
]
+
advance_from_command
[
fr
]
+
filter_command
[
groupby
]
+
fill_command
[
fill
]
if
sql
in
shouldPass2
:
tdSql
.
query
(
sql
)
else
:
tdSql
.
error
(
sql
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录