Merge pull request #7279 from taosdata/fix/TD-5918
[TD-5918]<fix> fix assert core by expand wild cards
This commit is contained in:
commit
3dce4c4636
|
@ -991,7 +991,7 @@ static void doInitGlobalConfig(void) {
|
|||
cfg.valType = TAOS_CFG_VTYPE_INT32;
|
||||
cfg.cfgType = TSDB_CFG_CTYPE_B_CONFIG | TSDB_CFG_CTYPE_B_CLIENT | TSDB_CFG_CTYPE_B_SHOW;
|
||||
cfg.minValue = 0;
|
||||
cfg.maxValue = TSDB_MAX_ALLOWED_SQL_LEN;
|
||||
cfg.maxValue = TSDB_MAX_FIELD_LEN;
|
||||
cfg.ptrLength = 0;
|
||||
cfg.unitType = TAOS_CFG_UTYPE_BYTE;
|
||||
taosInitConfigOption(cfg);
|
||||
|
|
|
@ -281,9 +281,9 @@ int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, c
|
|||
int32_t compareStrPatternComp(const void* pLeft, const void* pRight) {
|
||||
SPatternCompareInfo pInfo = {'%', '_'};
|
||||
|
||||
char pattern[128] = {0};
|
||||
assert(varDataLen(pRight) <= TSDB_MAX_FIELD_LEN);
|
||||
char *pattern = calloc(varDataLen(pRight) + 1, sizeof(char));
|
||||
memcpy(pattern, varDataVal(pRight), varDataLen(pRight));
|
||||
assert(varDataLen(pRight) < 128);
|
||||
|
||||
size_t sz = varDataLen(pLeft);
|
||||
char *buf = malloc(sz + 1);
|
||||
|
@ -292,6 +292,7 @@ int32_t compareStrPatternComp(const void* pLeft, const void* pRight) {
|
|||
|
||||
int32_t ret = patternMatch(pattern, buf, sz, &pInfo);
|
||||
free(buf);
|
||||
free(pattern);
|
||||
return (ret == TSDB_PATTERN_MATCH) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
@ -313,13 +314,13 @@ int32_t compareFindItemInSet(const void *pLeft, const void* pRight) {
|
|||
int32_t compareWStrPatternComp(const void* pLeft, const void* pRight) {
|
||||
SPatternCompareInfo pInfo = {'%', '_'};
|
||||
|
||||
wchar_t pattern[128] = {0};
|
||||
assert(TSDB_PATTERN_STRING_MAX_LEN < 128);
|
||||
assert(varDataLen(pRight) <= TSDB_MAX_FIELD_LEN * TSDB_NCHAR_SIZE);
|
||||
wchar_t *pattern = calloc(varDataLen(pRight) + 1, sizeof(wchar_t));
|
||||
|
||||
memcpy(pattern, varDataVal(pRight), varDataLen(pRight));
|
||||
assert(varDataLen(pRight) < 128);
|
||||
|
||||
int32_t ret = WCSPatternMatch(pattern, varDataVal(pLeft), varDataLen(pLeft)/TSDB_NCHAR_SIZE, &pInfo);
|
||||
free(pattern);
|
||||
return (ret == TSDB_PATTERN_MATCH) ? 0 : 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -157,19 +157,6 @@ class TDTestCase:
|
|||
tdSql.execute(f'create table {table_name}_sub1 using {table_name} tags ("{table_name}", "{table_name}")')
|
||||
tdSql.execute(f'insert into {table_name}_sub1 values (now, "{table_name}", "{table_name}");')
|
||||
|
||||
# TODO sc1 leave a bug ---> TD-5918
|
||||
# sql_list = [f'select * from {table_name} where bi1 like "{hp_name}"',
|
||||
# f'select * from {table_name} where bi1 like "{lp_name}"',
|
||||
# f'select * from {table_name} where bi1 like "{ul_name}"',
|
||||
# f'select * from {table_name} where nc1 like "{hp_name}"',
|
||||
# f'select * from {table_name} where nc1 like "{lp_name}"',
|
||||
# f'select * from {table_name} where nc1 like "{ul_name}"',
|
||||
# f'select * from {table_name} where si1 like "{hp_name}"',
|
||||
# f'select * from {table_name} where si1 like "{lp_name}"',
|
||||
# f'select * from {table_name} where si1 like "{ul_name}"',
|
||||
# f'select * from {table_name} where sc1 like "{hp_name}"',
|
||||
# f'select * from {table_name} where sc1 like "{lp_name}"',
|
||||
# f'select * from {table_name} where sc1 like "{ul_name}"']
|
||||
sql_list = [f'select * from {table_name} where bi1 like "{hp_name}"',
|
||||
f'select * from {table_name} where bi1 like "{lp_name}"',
|
||||
f'select * from {table_name} where bi1 like "{ul_name}"',
|
||||
|
@ -178,7 +165,11 @@ class TDTestCase:
|
|||
f'select * from {table_name} where nc1 like "{ul_name}"',
|
||||
f'select * from {table_name} where si1 like "{hp_name}"',
|
||||
f'select * from {table_name} where si1 like "{lp_name}"',
|
||||
f'select * from {table_name} where si1 like "{ul_name}"']
|
||||
f'select * from {table_name} where si1 like "{ul_name}"',
|
||||
f'select * from {table_name} where sc1 like "{hp_name}"',
|
||||
f'select * from {table_name} where sc1 like "{lp_name}"',
|
||||
f'select * from {table_name} where sc1 like "{ul_name}"']
|
||||
|
||||
for sql in sql_list:
|
||||
tdSql.query(sql)
|
||||
if len(table_name) >= 1:
|
||||
|
@ -211,7 +202,6 @@ class TDTestCase:
|
|||
tdSql.close()
|
||||
tdLog.success("%s successfully executed" % __file__)
|
||||
|
||||
|
||||
tdCases.addWindows(__file__, TDTestCase())
|
||||
tdCases.addLinux(__file__, TDTestCase())
|
||||
|
||||
|
|
Loading…
Reference in New Issue