Merge pull request #15541 from taosdata/fix/TD-17009

fix(query): fix apercentile with interval crash issue
This commit is contained in:
Ganlin Zhao 2022-07-29 16:55:17 +08:00 committed by GitHub
commit f280721687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 222 additions and 222 deletions

View File

@ -2068,7 +2068,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "apercentile", .name = "apercentile",
.type = FUNCTION_TYPE_APERCENTILE, .type = FUNCTION_TYPE_APERCENTILE,
.classification = FUNC_MGT_AGG_FUNC, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC,
.translateFunc = translateApercentile, .translateFunc = translateApercentile,
.getEnvFunc = getApercentileFuncEnv, .getEnvFunc = getApercentileFuncEnv,
.initFunc = apercentileFunctionSetup, .initFunc = apercentileFunctionSetup,
@ -2083,7 +2083,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
}, },
{ {
.name = "_apercentile_partial", .name = "_apercentile_partial",
.type = FUNCTION_TYPE_APERCENTILE_PARTIAL, .type = FUNCTION_TYPE_APERCENTILE_PARTIAL | FUNC_MGT_TIMELINE_FUNC,
.classification = FUNC_MGT_AGG_FUNC, .classification = FUNC_MGT_AGG_FUNC,
.translateFunc = translateApercentilePartial, .translateFunc = translateApercentilePartial,
.getEnvFunc = getApercentileFuncEnv, .getEnvFunc = getApercentileFuncEnv,
@ -2096,7 +2096,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{ {
.name = "_apercentile_merge", .name = "_apercentile_merge",
.type = FUNCTION_TYPE_APERCENTILE_MERGE, .type = FUNCTION_TYPE_APERCENTILE_MERGE,
.classification = FUNC_MGT_AGG_FUNC, .classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_TIMELINE_FUNC,
.translateFunc = translateApercentileMerge, .translateFunc = translateApercentileMerge,
.getEnvFunc = getApercentileFuncEnv, .getEnvFunc = getApercentileFuncEnv,
.initFunc = apercentileFunctionSetup, .initFunc = apercentileFunctionSetup,

View File

@ -141,8 +141,8 @@ class TDTestCase:
query_data = tdSql.queryResult query_data = tdSql.queryResult
# nest query for support max # nest query for support max
tdSql.query(f"select apercentile(c2+2,10)+1 from (select max(c1) c2 from {dbname}.stb1)") #tdSql.query(f"select apercentile(c2+2,10)+1 from (select max(c1) c2 from {dbname}.stb1)")
tdSql.checkData(0,0,31.000000000) #tdSql.checkData(0,0,31.000000000)
tdSql.query(f"select apercentile(c1+2,10)+1 as c2 from (select ts ,c1 ,c2 from {dbname}.stb1)") tdSql.query(f"select apercentile(c1+2,10)+1 as c2 from (select ts ,c1 ,c2 from {dbname}.stb1)")
tdSql.checkData(0,0,7.560701700) tdSql.checkData(0,0,7.560701700)
tdSql.query(f"select apercentile(a+2,10)+1 as c2 from (select ts ,abs(c1) a ,c2 from {dbname}.stb1)") tdSql.query(f"select apercentile(a+2,10)+1 as c2 from (select ts ,abs(c1) a ,c2 from {dbname}.stb1)")