未验证 提交 9c01cec7 编写于 作者: H haojun Liao 提交者: GitHub

Merge pull request #5955 from taosdata/hotfix/TD-3996

[TD-3996]udc query issue
...@@ -1606,6 +1606,22 @@ bool isValidDistinctSql(SQueryInfo* pQueryInfo) { ...@@ -1606,6 +1606,22 @@ bool isValidDistinctSql(SQueryInfo* pQueryInfo) {
return false; return false;
} }
static bool hasNoneUserDefineExpr(SQueryInfo* pQueryInfo) {
size_t numOfExprs = taosArrayGetSize(pQueryInfo->exprList);
for (int32_t i = 0; i < numOfExprs; ++i) {
SSqlExpr* pExpr = taosArrayGetP(pQueryInfo->exprList, i);
if (TSDB_COL_IS_UD_COL(pExpr->colInfo.flag)) {
continue;
}
return true;
}
return false;
}
int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, SArray* pSelectList, bool isSTable, bool joinQuery, bool timeWindowQuery) { int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, SArray* pSelectList, bool isSTable, bool joinQuery, bool timeWindowQuery) {
assert(pSelectList != NULL && pCmd != NULL); assert(pSelectList != NULL && pCmd != NULL);
const char* msg1 = "too many columns in selection clause"; const char* msg1 = "too many columns in selection clause";
...@@ -1670,7 +1686,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, SArray* pSelectLis ...@@ -1670,7 +1686,7 @@ int32_t parseSelectClause(SSqlCmd* pCmd, int32_t clauseIndex, SArray* pSelectLis
// there is only one user-defined column in the final result field, add the timestamp column. // there is only one user-defined column in the final result field, add the timestamp column.
size_t numOfSrcCols = taosArrayGetSize(pQueryInfo->colList); size_t numOfSrcCols = taosArrayGetSize(pQueryInfo->colList);
if (numOfSrcCols <= 0 && !tscQueryTags(pQueryInfo) && !tscQueryBlockInfo(pQueryInfo)) { if ((numOfSrcCols <= 0 || !hasNoneUserDefineExpr(pQueryInfo)) && !tscQueryTags(pQueryInfo) && !tscQueryBlockInfo(pQueryInfo)) {
addPrimaryTsColIntoResult(pQueryInfo); addPrimaryTsColIntoResult(pQueryInfo);
} }
......
...@@ -358,6 +358,13 @@ if $data00 != 0.300000000 then ...@@ -358,6 +358,13 @@ if $data00 != 0.300000000 then
return -1 return -1
endi endi
print =============================> td-3996
sql select 'abc' as res from t1 where f1 < 0
if $rows != 0 then
return -1
endi
print ======================udc with normal column group by print ======================udc with normal column group by
sql_error select from t1 sql_error select from t1
......
...@@ -421,8 +421,18 @@ if $data10 != @union_db0@ then ...@@ -421,8 +421,18 @@ if $data10 != @union_db0@ then
return -1 return -1
endi endi
sql select 'aaa' as option from union_tb1 where c1 < 0 limit 1 union all select 'bbb' as option from union_tb0 limit 1
if $rows != 1 then
return -1
endi
if $data00 != @bbb@ then
return -1
endi
sql_error show tables union all show tables sql_error show tables union all show tables
sql_error show stables union all show stables sql_error show stables union all show stables
sql_error show databases union all show databases sql_error show databases union all show databases
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册