提交 63e27798 编写于 作者: X xywang

[TS-715]<enhance>: added threshold for 'UNION ALL'

上级 90c13670
......@@ -368,19 +368,28 @@ static int32_t handlePassword(SSqlCmd* pCmd, SStrToken* pPwd) {
// validate the out put field type for "UNION ALL" subclause
static int32_t normalizeVarDataTypeLength(SSqlCmd* pCmd) {
const char* msg1 = "columns in select clause not identical";
const char* msg2 = "too many select clause siblings, at most 100 allowed";
int32_t siblings = 0;
int32_t diffSize = 0;
// if there is only one element, the limit of clause is the limit of global result.
SQueryInfo* pQueryInfo1 = pCmd->pQueryInfo;
SQueryInfo* pSibling = pQueryInfo1->sibling;
// pQueryInfo1 itself
++siblings;
while(pSibling != NULL) {
int32_t ret = tscFieldInfoCompare(&pQueryInfo1->fieldsInfo, &pSibling->fieldsInfo, &diffSize);
if (ret != 0) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
}
if (++siblings > 100) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
}
pSibling = pSibling->sibling;
}
......
......@@ -109,7 +109,7 @@ class TDTestCase:
tdSql.execute("create table st2(ts timestamp, c1 int, c2 int, c3 int) tags(loc nchar(20))")
for i in range(7000):
for i in range(101):
if i == 0:
sql = "select last(*) from sub0 "
else:
......@@ -118,13 +118,7 @@ class TDTestCase:
tdSql.execute("create table sub%d using st2 tags('nchar%d')" % (i, i))
tdSql.execute("insert into sub%d values(%d, %d, %d, %d)" % (i, self.ts + i, i, i, i))
exception = "Exception(\"ProgrammingError('Result set too large to be output', -2147483097)\")"
try:
tdSql.query(sql)
except Exception as e:
if {exception} != {repr(e)}:
tdLog.info(f"sql: {sql}, {exception} expected, actually raises {repr(e)}")
raise e
tdSql.error(sql)
def stop(self):
tdSql.close()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册