提交 f49b4879 编写于 作者: W wpan

fix case issues

上级 60a996cb
...@@ -569,7 +569,7 @@ static void shellPrintNChar(const char *str, int length, int width) { ...@@ -569,7 +569,7 @@ static void shellPrintNChar(const char *str, int length, int width) {
while (pos < length) { while (pos < length) {
wchar_t wc; wchar_t wc;
int bytes = mbtowc(&wc, str + pos, MB_CUR_MAX); int bytes = mbtowc(&wc, str + pos, MB_CUR_MAX);
if (bytes == 0) { if (bytes <= 0) {
break; break;
} }
pos += bytes; pos += bytes;
......
...@@ -937,7 +937,7 @@ int32_t filterAddUnitToGroup(SFilterGroup *group, uint16_t unitIdx) { ...@@ -937,7 +937,7 @@ int32_t filterAddUnitToGroup(SFilterGroup *group, uint16_t unitIdx) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
int32_t filterConvertSetFromBinary(void **q, const char *buf, int32_t len, uint32_t tType) { int32_t filterConvertSetFromBinary(void **q, const char *buf, int32_t len, uint32_t tType, bool tolower) {
SBufferReader br = tbufInitReader(buf, len, false); SBufferReader br = tbufInitReader(buf, len, false);
uint32_t sType = tbufReadUint32(&br); uint32_t sType = tbufReadUint32(&br);
SHashObj *pObj = taosHashInit(256, taosGetDefaultHashFunction(tType), true, false); SHashObj *pObj = taosHashInit(256, taosGetDefaultHashFunction(tType), true, false);
...@@ -1113,6 +1113,7 @@ int32_t filterConvertSetFromBinary(void **q, const char *buf, int32_t len, uint3 ...@@ -1113,6 +1113,7 @@ int32_t filterConvertSetFromBinary(void **q, const char *buf, int32_t len, uint3
} }
t = varDataLen(tmp); t = varDataLen(tmp);
pvar = varDataVal(tmp); pvar = varDataVal(tmp);
strntolower_s(pvar, pvar, t);
break; break;
} }
case TSDB_DATA_TYPE_NCHAR: { case TSDB_DATA_TYPE_NCHAR: {
...@@ -1157,7 +1158,7 @@ int32_t filterAddGroupUnitFromNode(SFilterInfo *info, tExprNode* tree, SArray *g ...@@ -1157,7 +1158,7 @@ int32_t filterAddGroupUnitFromNode(SFilterInfo *info, tExprNode* tree, SArray *g
if (tree->_node.optr == TSDB_RELATION_IN && (!IS_VAR_DATA_TYPE(type))) { if (tree->_node.optr == TSDB_RELATION_IN && (!IS_VAR_DATA_TYPE(type))) {
void *data = NULL; void *data = NULL;
filterConvertSetFromBinary((void **)&data, var->pz, var->nLen, type); filterConvertSetFromBinary((void **)&data, var->pz, var->nLen, type, false);
CHK_LRET(data == NULL, TSDB_CODE_QRY_APP_ERROR, "failed to convert in param"); CHK_LRET(data == NULL, TSDB_CODE_QRY_APP_ERROR, "failed to convert in param");
if (taosHashGetSize((SHashObj *)data) <= 0) { if (taosHashGetSize((SHashObj *)data) <= 0) {
...@@ -1798,7 +1799,10 @@ int32_t filterInitValFieldData(SFilterInfo *info) { ...@@ -1798,7 +1799,10 @@ int32_t filterInitValFieldData(SFilterInfo *info) {
} }
if (unit->compare.optr == TSDB_RELATION_IN) { if (unit->compare.optr == TSDB_RELATION_IN) {
filterConvertSetFromBinary((void **)&fi->data, var->pz, var->nLen, type); SSchema *sch = FILTER_UNIT_COL_DESC(info, unit);
bool tolower = (sch->colId == -1) ? true : false;
filterConvertSetFromBinary((void **)&fi->data, var->pz, var->nLen, type, tolower);
CHK_LRET(fi->data == NULL, TSDB_CODE_QRY_APP_ERROR, "failed to convert in param"); CHK_LRET(fi->data == NULL, TSDB_CODE_QRY_APP_ERROR, "failed to convert in param");
FILTER_SET_FLAG(fi->flag, FLD_DATA_IS_HASH); FILTER_SET_FLAG(fi->flag, FLD_DATA_IS_HASH);
...@@ -2531,8 +2535,6 @@ int32_t filterPostProcessRange(SFilterInfo *info) { ...@@ -2531,8 +2535,6 @@ int32_t filterPostProcessRange(SFilterInfo *info) {
int32_t filterGenerateComInfo(SFilterInfo *info) { int32_t filterGenerateComInfo(SFilterInfo *info) {
uint16_t n = 0;
info->cunits = malloc(info->unitNum * sizeof(*info->cunits)); info->cunits = malloc(info->unitNum * sizeof(*info->cunits));
info->blkUnitRes = malloc(sizeof(*info->blkUnitRes) * info->unitNum); info->blkUnitRes = malloc(sizeof(*info->blkUnitRes) * info->unitNum);
info->blkUnits = malloc(sizeof(*info->blkUnits) * (info->unitNum + 1) * info->groupNum); info->blkUnits = malloc(sizeof(*info->blkUnits) * (info->unitNum + 1) * info->groupNum);
...@@ -2560,24 +2562,6 @@ int32_t filterGenerateComInfo(SFilterInfo *info) { ...@@ -2560,24 +2562,6 @@ int32_t filterGenerateComInfo(SFilterInfo *info) {
info->cunits[i].dataSize = FILTER_UNIT_COL_SIZE(info, unit); info->cunits[i].dataSize = FILTER_UNIT_COL_SIZE(info, unit);
info->cunits[i].dataType = FILTER_UNIT_DATA_TYPE(unit); info->cunits[i].dataType = FILTER_UNIT_DATA_TYPE(unit);
} }
uint16_t cgroupNum = info->groupNum + 1;
for (uint16_t i = 0; i < info->groupNum; ++i) {
cgroupNum += info->groups[i].unitNum;
}
info->cgroups = malloc(cgroupNum * sizeof(*info->cgroups));
for (uint16_t i = 0; i < info->groupNum; ++i) {
info->cgroups[n++] = info->groups[i].unitNum;
for (uint16_t m = 0; m < info->groups[i].unitNum; ++m) {
info->cgroups[n++] = info->groups[i].unitIdxs[m];
}
}
info->cgroups[n] = 0;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -2887,7 +2871,7 @@ static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows, ...@@ -2887,7 +2871,7 @@ static FORCE_INLINE bool filterExecuteImplIsNull(void *pinfo, int32_t numOfRows,
for (int32_t i = 0; i < numOfRows; ++i) { for (int32_t i = 0; i < numOfRows; ++i) {
uint16_t uidx = info->groups[0].unitIdxs[0]; uint16_t uidx = info->groups[0].unitIdxs[0];
void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i; void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i;
(*p)[i] = isNull(colData, info->cunits[uidx].dataType); (*p)[i] = ((colData == NULL) || isNull(colData, info->cunits[uidx].dataType));
if ((*p)[i] == 0) { if ((*p)[i] == 0) {
all = false; all = false;
} }
...@@ -2910,7 +2894,7 @@ static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows ...@@ -2910,7 +2894,7 @@ static FORCE_INLINE bool filterExecuteImplNotNull(void *pinfo, int32_t numOfRows
for (int32_t i = 0; i < numOfRows; ++i) { for (int32_t i = 0; i < numOfRows; ++i) {
uint16_t uidx = info->groups[0].unitIdxs[0]; uint16_t uidx = info->groups[0].unitIdxs[0];
void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i; void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i;
(*p)[i] = !isNull(colData, info->cunits[uidx].dataType); (*p)[i] = ((colData != NULL) && !isNull(colData, info->cunits[uidx].dataType));
if ((*p)[i] == 0) { if ((*p)[i] == 0) {
all = false; all = false;
} }
...@@ -2938,7 +2922,7 @@ bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SDataSta ...@@ -2938,7 +2922,7 @@ bool filterExecuteImplRange(void *pinfo, int32_t numOfRows, int8_t** p, SDataSta
} }
for (int32_t i = 0; i < numOfRows; ++i) { for (int32_t i = 0; i < numOfRows; ++i) {
if (isNull(colData, info->cunits[0].dataType)) { if (colData == NULL || isNull(colData, info->cunits[0].dataType)) {
all = false; all = false;
colData += dataSize; colData += dataSize;
continue; continue;
...@@ -2971,7 +2955,7 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SDataStat ...@@ -2971,7 +2955,7 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SDataStat
for (int32_t i = 0; i < numOfRows; ++i) { for (int32_t i = 0; i < numOfRows; ++i) {
uint16_t uidx = info->groups[0].unitIdxs[0]; uint16_t uidx = info->groups[0].unitIdxs[0];
void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i; void *colData = (char *)info->cunits[uidx].colData + info->cunits[uidx].dataSize * i;
if (isNull(colData, info->cunits[uidx].dataType)) { if (colData == NULL || isNull(colData, info->cunits[uidx].dataType)) {
(*p)[i] = 0; (*p)[i] = 0;
all = false; all = false;
continue; continue;
...@@ -3015,7 +2999,7 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SDataStatis * ...@@ -3015,7 +2999,7 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SDataStatis *
//} else { //} else {
uint8_t optr = cunit->optr; uint8_t optr = cunit->optr;
if (isNull(colData, cunit->dataType)) { if (colData == NULL || isNull(colData, cunit->dataType)) {
(*p)[i] = optr == TSDB_RELATION_ISNULL ? true : false; (*p)[i] = optr == TSDB_RELATION_ISNULL ? true : false;
} else { } else {
if (optr == TSDB_RELATION_NOTNULL) { if (optr == TSDB_RELATION_NOTNULL) {
......
...@@ -80,10 +80,12 @@ class TDTestCase: ...@@ -80,10 +80,12 @@ class TDTestCase:
tdSql.error("select * from st where tbcol1 like '____'") tdSql.error("select * from st where tbcol1 like '____'")
# > for nchar type on column # > for nchar type on column
tdSql.error("select * from st where tbcol2 > 'taosdata'") tdSql.query("select * from st where tbcol2 > 'taosdata'")
tdSql.checkRows(10)
# >= for nchar type on column # >= for nchar type on column
tdSql.error("select * from st where tbcol2 >= 'taosdata'") tdSql.query("select * from st where tbcol2 >= 'taosdata'")
tdSql.checkRows(10)
# = for nchar type on column # = for nchar type on column
tdSql.query("select * from st where tbcol2 = 'taosdata1'") tdSql.query("select * from st where tbcol2 = 'taosdata1'")
...@@ -98,10 +100,12 @@ class TDTestCase: ...@@ -98,10 +100,12 @@ class TDTestCase:
tdSql.checkRows(9) tdSql.checkRows(9)
# > for nchar type on column # > for nchar type on column
tdSql.error("select * from st where tbcol2 < 'taodata'") tdSql.query("select * from st where tbcol2 < 'taodata'")
tdSql.checkRows(0)
# >= for nchar type on column # >= for nchar type on column
tdSql.error("select * from st where tbcol2 <= 'taodata'") tdSql.query("select * from st where tbcol2 <= 'taodata'")
tdSql.checkRows(0)
# % for nchar type on column case 1 # % for nchar type on column case 1
tdSql.query("select * from st where tbcol2 like '%'") tdSql.query("select * from st where tbcol2 like '%'")
...@@ -140,10 +144,12 @@ class TDTestCase: ...@@ -140,10 +144,12 @@ class TDTestCase:
tdSql.checkRows(10) tdSql.checkRows(10)
# > for binary type on column # > for binary type on column
tdSql.error("select * from st where tbcol3 > '涛思数据'") tdSql.query("select * from st where tbcol3 > '涛思数据'")
tdSql.checkRows(10)
# >= for binary type on column # >= for binary type on column
tdSql.error("select * from st where tbcol3 >= '涛思数据'") tdSql.query("select * from st where tbcol3 >= '涛思数据'")
tdSql.checkRows(10)
# = for binary type on column # = for binary type on column
tdSql.query("select * from st where tbcol3 = '涛思数据1'") tdSql.query("select * from st where tbcol3 = '涛思数据1'")
...@@ -158,10 +164,12 @@ class TDTestCase: ...@@ -158,10 +164,12 @@ class TDTestCase:
tdSql.checkRows(9) tdSql.checkRows(9)
# > for binary type on column # > for binary type on column
tdSql.error("select * from st where tbcol3 < '涛思数据'") tdSql.query("select * from st where tbcol3 < '涛思数据'")
tdSql.checkRows(0)
# >= for binary type on column # >= for binary type on column
tdSql.error("select * from st where tbcol3 <= '涛思数据'") tdSql.query("select * from st where tbcol3 <= '涛思数据'")
tdSql.checkRows(0)
# % for binary type on column case 1 # % for binary type on column case 1
tdSql.query("select * from st where tbcol3 like '%'") tdSql.query("select * from st where tbcol3 like '%'")
......
...@@ -159,7 +159,7 @@ if $data11 != 3 then ...@@ -159,7 +159,7 @@ if $data11 != 3 then
endi endi
sql_error select * from st2 where f7 between 2.0 and 3.0; sql_error select * from st2 where f7 between 2.0 and 3.0;
sql_error select * from st2 where f8 between 2.0 and 3.0; sql select * from st2 where f8 between 2.0 and 3.0;
sql_error select * from st2 where f9 between 2.0 and 3.0; sql select * from st2 where f9 between 2.0 and 3.0;
system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s stop -x SIGINT
...@@ -655,6 +655,32 @@ if $data80 != @21-05-05 18:19:38.000@ then ...@@ -655,6 +655,32 @@ if $data80 != @21-05-05 18:19:38.000@ then
return -1 return -1
endi endi
sql select ts,c1,t9,t10,tbname from stb5 where tbname in ('tb5_1', 'TB5_2');
if $rows != 12 then
return -1
endi
sql select ts,c1,t9,t10,tbname from stb5 where tbname in ('tb5_1', 'TB5_2') or tbname in ('tb5_3');
if $rows != 16 then
return -1
endi
sql select ts,c1,t9,t10,tbname from stb5 where tbname in ('tb5_1', 'TB5_2') and tbname in ('tb5_2');
if $rows != 4 then
return -1
endi
if $data00 != @21-05-05 18:19:08.000@ then
return -1
endi
if $data10 != @21-05-05 18:19:09.000@ then
return -1
endi
if $data20 != @21-05-05 18:19:10.000@ then
return -1
endi
if $data30 != @21-05-05 18:19:11.000@ then
return -1
endi
print "tag test" print "tag test"
sql_error select * from stb5 where t1 match '.*'; sql_error select * from stb5 where t1 match '.*';
sql_error select * from stb5 where t2 match '.*'; sql_error select * from stb5 where t2 match '.*';
......
...@@ -125,11 +125,10 @@ if $data21 != 2 then ...@@ -125,11 +125,10 @@ if $data21 != 2 then
return -1 return -1
endi endi
# multiple tbname in is not allowed NOW sql select count(*) from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbname in ('ti_tb5', 'ti_tb1000') group by t1 order by t1 asc
sql_error select count(*) from $stb where tbname in ('ti_tb1', 'ti_tb300') and tbname in ('ti_tb5', 'ti_tb1000') group by t1 order by t1 asc if $rows != 0 then
#if $rows != 4 then return -1
# return -1 endi
#endi
#if $data00 != $rowNum then #if $data00 != $rowNum then
# return -1 # return -1
#endi #endi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册