未验证 提交 e1b25c19 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #19337 from taosdata/fix/TD-21688-MAIN

fix:  varchar type order by rule different with nchar type
......@@ -23,6 +23,7 @@
#include "thash.h"
#include "tlog.h"
#include "types.h"
#include "osString.h"
int32_t setChkInBytes1(const void *pLeft, const void *pRight) {
return NULL != taosHashGet((SHashObj *)pRight, pLeft, 1) ? 1 : 0;
......@@ -208,16 +209,16 @@ int32_t compareLenPrefixedWStr(const void *pLeft, const void *pRight) {
int32_t len1 = varDataLen(pLeft);
int32_t len2 = varDataLen(pRight);
if (len1 != len2) {
return len1 > len2 ? 1 : -1;
} else {
int32_t ret = memcmp((TdUcs4 *)pLeft, (TdUcs4 *)pRight, len1);
if (ret == 0) {
int32_t ret = tasoUcs4Compare((TdUcs4 *)varDataVal(pLeft), (TdUcs4 *)varDataVal(pRight), len1>len2 ? len2:len1);
if (ret == 0) {
if (len1 > len2)
return 1;
else if(len1 < len2)
return -1;
else
return 0;
} else {
return ret > 0 ? 1 : -1;
}
}
return (ret < 0) ? -1 : 1;
}
int32_t compareLenPrefixedWStrDesc(const void *pLeft, const void *pRight) {
......
......@@ -408,8 +408,8 @@ class TDTestCase:
# test group by & order by json tag
tdSql.query(f"select ts,jtag->'tag1' from {dbname}.jsons1 partition by jtag->'tag1' order by jtag->'tag1' desc")
tdSql.checkRows(11)
tdSql.checkData(0, 1, '"femail"')
tdSql.checkData(2, 1, '"收到货"')
tdSql.checkData(0, 1, '"收到货"')
tdSql.checkData(2, 1, '"femail"')
tdSql.checkData(7, 1, "false")
......@@ -421,9 +421,10 @@ class TDTestCase:
tdSql.query(f"select count(*),jtag->'tag1' from {dbname}.jsons1 group by jtag->'tag1' order by jtag->'tag1' desc")
tdSql.checkRows(8)
tdSql.checkData(0, 0, 2)
tdSql.checkData(0, 1, '"femail"')
tdSql.checkData(0, 1, '"收到货"')
tdSql.checkData(1, 1, '"femail"')
tdSql.checkData(1, 0, 2)
tdSql.checkData(1, 1, '"收到货"')
tdSql.checkData(2, 0, 1)
tdSql.checkData(2, 1, "11.000000000")
tdSql.checkData(5, 0, 1)
......@@ -437,7 +438,7 @@ class TDTestCase:
tdSql.checkData(5, 0, 1)
tdSql.checkData(5, 1, "11.000000000")
tdSql.checkData(7, 0, 2)
tdSql.checkData(7, 1, '"femail"')
tdSql.checkData(7, 1, '"收到货"')
# test stddev with group by json tag
tdSql.query(f"select stddev(dataint),jtag->'tag1' from {dbname}.jsons1 group by jtag->'tag1' order by jtag->'tag1'")
......@@ -445,8 +446,8 @@ class TDTestCase:
tdSql.checkData(0, 1, None)
tdSql.checkData(4, 0, 0)
tdSql.checkData(4, 1, "5.000000000")
tdSql.checkData(7, 0, 11)
tdSql.checkData(7, 1, '"femail"')
tdSql.checkData(6, 0, 11)
tdSql.checkData(7, 1, '"收到货"')
res = tdSql.getColNameList(f"select stddev(dataint),jsons1.jtag->'tag1' from {dbname}.jsons1 group by jsons1.jtag->'tag1' order by jtag->'tag1'")
cname_list = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册