diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 95eec389e961f9353e5651cdd9af2ce081e4a5df..46848ab742fb1f4378ce93c4e481944bba20bfc3 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -6047,7 +6047,11 @@ static int32_t doAddGroupbyColumnsOnDemand(SSqlCmd* pCmd, SQueryInfo* pQueryInfo STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); SSchema* pSchema = tscGetTableSchema(pTableMetaInfo->pTableMeta); - SSchema* tagSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); + + SSchema* tagSchema = NULL; + if (!UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) { + tagSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); + } SSchema* s = NULL; @@ -6196,10 +6200,6 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) { return TSDB_CODE_TSC_INVALID_SQL; } - /* - * group by tag function must be not changed the function name, otherwise, the group operation may fail to - * divide the subset of final result. - */ if (doAddGroupbyColumnsOnDemand(pCmd, pQueryInfo) != TSDB_CODE_SUCCESS) { return TSDB_CODE_TSC_INVALID_SQL; }