diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c index 0ae6ea07f1c7a083d3cf8edfda0e9a4b4fcb0969..4ce80acd67e22b70fd9b3cd083b15f8e3e0581f3 100644 --- a/src/client/src/tscUtil.c +++ b/src/client/src/tscUtil.c @@ -268,7 +268,10 @@ bool tscIsProjectionQueryOnSTable(SQueryInfo* pQueryInfo, int32_t tableIndex) { functionId != TSDB_FUNC_DIFF && functionId != TSDB_FUNC_DERIVATIVE && functionId != TSDB_FUNC_TS_DUMMY && - functionId != TSDB_FUNC_TID_TAG) { + functionId != TSDB_FUNC_TID_TAG && + functionId != TSDB_FUNC_CEIL && + functionId != TSDB_FUNC_FLOOR && + functionId != TSDB_FUNC_ROUND) { return false; } } diff --git a/src/query/src/qPlan.c b/src/query/src/qPlan.c index 1988fc9df7710f15770ca8a9994542d9f4bc8c66..abfa20714b333754478e5c48b9265f839b05a4b1 100644 --- a/src/query/src/qPlan.c +++ b/src/query/src/qPlan.c @@ -645,6 +645,12 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) { } else { op = OP_Project; taosArrayPush(plan, &op); + + if (pQueryAttr->pExpr2 != NULL) { + op = OP_Project; + taosArrayPush(plan, &op); + } + if (pQueryAttr->distinct) { op = OP_Distinct; taosArrayPush(plan, &op); diff --git a/tests/pytest/functions/function_ceil.py b/tests/pytest/functions/function_ceil.py index f857810caf967eed8b4f90c460027ce9e21196ea..67d816ee25a5e4d2e01d3319e611711e6dfa537b 100644 --- a/tests/pytest/functions/function_ceil.py +++ b/tests/pytest/functions/function_ceil.py @@ -286,16 +286,6 @@ class TDTestCase: "derivative(ceil(ubigint_col), 1s, 0)", "derivative(ceil(usmallint_col), 1s, 0)", "derivative(ceil(utinyint_col), 1s, 0)", - "ceil(int_col) + ceil(int_col)", - "ceil(bigint_col) + ceil(bigint_col)", - "ceil(float_col) + ceil(float_col)", - "ceil(double_col) + ceil(double_col)", - "ceil(smallint_col) + ceil(smallint_col)", - "ceil(tinyint_col) + ceil(tinyint_col)", - "ceil(uint_col) + ceil(uint_col)", - "ceil(ubigint_col) + ceil(ubigint_col)", - "ceil(usmallint_col) + ceil(usmallint_col)", - "ceil(utinyint_col) + ceil(utinyint_col)", "ceil(int_col) - ceil(int_col)", "ceil(bigint_col) - ceil(bigint_col)", "ceil(float_col) - ceil(float_col)", @@ -1434,16 +1424,66 @@ class TDTestCase: or select_command[s] == "distinct ceil(uint_col)"\ or select_command[s] == "distinct ceil(ubigint_col)"\ or select_command[s] == "distinct ceil(usmallint_col)"\ - or select_command[s] == "distinct ceil(utinyint_col)"): + or select_command[s] == "distinct 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) + 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)"): tdSql.query(sql) else: tdSql.error(sql) - for s in range(len(simple_select_command)): + for sim in range(len(simple_select_command)): for fr in range(len(advance_from_command)): for filter in range(len(filter_command)): for fill in range(len(fill_command)): sql = "select " + simple_select_command[ - s] + from_command[fr] + filter_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"\