提交 80501874 编写于 作者: S Shuduo Sang

Merge branch 'develop' into hotfix/py-testcase-refine

...@@ -5563,8 +5563,8 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) { ...@@ -5563,8 +5563,8 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
} }
*(VarDataLenT*)tagVal = pList->a[i].pVar.nLen; ret = tVariantDump(&(pList->a[i].pVar), varDataVal(tagVal), pTagSchema[i].type);
ret = tVariantDump(&(pList->a[i].pVar), tagVal + VARSTR_HEADER_SIZE, pTagSchema[i].type); varDataSetLen(tagVal, pList->a[i].pVar.nLen);
} else { } else {
ret = tVariantDump(&(pList->a[i].pVar), tagVal, pTagSchema[i].type); ret = tVariantDump(&(pList->a[i].pVar), tagVal, pTagSchema[i].type);
} }
......
...@@ -540,8 +540,11 @@ static int32_t setQueryCond(tQueryInfo *queryColInfo, SQueryCond* pCond) { ...@@ -540,8 +540,11 @@ static int32_t setQueryCond(tQueryInfo *queryColInfo, SQueryCond* pCond) {
static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArray* result) { static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArray* result) {
SSkipListIterator* iter = NULL; SSkipListIterator* iter = NULL;
SQueryCond cond = {0}; SQueryCond cond = {0};
setQueryCond(pQueryInfo, &cond); if (setQueryCond(pQueryInfo, &cond) != TSDB_CODE_SUCCESS) {
//todo handle error
}
if (cond.start != NULL) { if (cond.start != NULL) {
iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_ASC); iter = tSkipListCreateIterFromVal(pSkipList, (char*) cond.start->v, pSkipList->keyInfo.type, TSDB_ORDER_ASC);
......
...@@ -389,6 +389,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) { ...@@ -389,6 +389,7 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
return 0; return 0;
} }
// todo handle the error
static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) { static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
char tmpBuf[40] = {0}; char tmpBuf[40] = {0};
...@@ -424,7 +425,12 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) { ...@@ -424,7 +425,12 @@ static int32_t toNchar(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
pVariant->wpz = (wchar_t *)tmp; pVariant->wpz = (wchar_t *)tmp;
} else { } else {
taosMbsToUcs4(pDst, nLen, *pDest, (nLen + 1) * TSDB_NCHAR_SIZE, NULL); size_t output = -1;
taosMbsToUcs4(pDst, nLen, *pDest, (nLen + 1) * TSDB_NCHAR_SIZE, &output);
if (pDestSize != NULL) {
*pDestSize = output;
}
} }
return 0; return 0;
...@@ -779,7 +785,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, char type) { ...@@ -779,7 +785,7 @@ int32_t tVariantDump(tVariant *pVariant, char *payload, char type) {
} }
case TSDB_DATA_TYPE_NCHAR: { case TSDB_DATA_TYPE_NCHAR: {
if (pVariant->nType == TSDB_DATA_TYPE_NULL) { if (pVariant->nType == TSDB_DATA_TYPE_NULL) {
*(uint32_t *)payload = TSDB_DATA_NCHAR_NULL; *(uint32_t *) payload = TSDB_DATA_NCHAR_NULL;
} else { } else {
if (pVariant->nType != TSDB_DATA_TYPE_NCHAR) { if (pVariant->nType != TSDB_DATA_TYPE_NCHAR) {
toNchar(pVariant, &payload, &pVariant->nLen); toNchar(pVariant, &payload, &pVariant->nLen);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here #define TSDB_SUPER_TABLE_SL_LEVEL 5 // TODO: may change here
#define TSDB_META_FILE_NAME "META" #define TSDB_META_FILE_NAME "META"
const int32_t DEFAULT_TAG_INDEX_COLUMN = 0; const int32_t DEFAULT_TAG_INDEX_COLUMN = 0; // skip list built based on the first column of tags
static int tsdbFreeTable(STable *pTable); static int tsdbFreeTable(STable *pTable);
static int32_t tsdbCheckTableCfg(STableCfg *pCfg); static int32_t tsdbCheckTableCfg(STableCfg *pCfg);
...@@ -548,7 +548,10 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) { ...@@ -548,7 +548,10 @@ static int tsdbRemoveTableFromIndex(STsdbMeta *pMeta, STable *pTable) {
STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid); STable* pSTable = tsdbGetTableByUid(pMeta, pTable->superUid);
assert(pSTable != NULL); assert(pSTable != NULL);
char* key = dataRowTuple(pTable->tagVal); // key STSchema* pSchema = tsdbGetTableTagSchema(pMeta, pTable);
STColumn* pCol = &pSchema->columns[DEFAULT_TAG_INDEX_COLUMN];
char* key = tdGetRowDataOfCol(pTable->tagVal, pCol->type, TD_DATA_ROW_HEAD_SIZE + pCol->offset);
bool ret = tSkipListRemove(pSTable->pIndex, key); bool ret = tSkipListRemove(pSTable->pIndex, key);
assert(ret); assert(ret);
......
...@@ -626,7 +626,7 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf ...@@ -626,7 +626,7 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf
for(int32_t k = start; k < pQueryHandle->realNumOfRows + start; ++k) { for(int32_t k = start; k < pQueryHandle->realNumOfRows + start; ++k) {
char* p = tdGetColDataOfRow(src, k); char* p = tdGetColDataOfRow(src, k);
memcpy(dst, p, varDataTLen(p)); memcpy(dst, p, varDataTLen(p));
dst += varDataTLen(p); dst += bytes;
} }
} }
...@@ -1311,8 +1311,8 @@ void filterPrepare(void* expr, void* param) { ...@@ -1311,8 +1311,8 @@ void filterPrepare(void* expr, void* param) {
} else { } else {
pInfo->q = calloc(1, pSchema->bytes); pInfo->q = calloc(1, pSchema->bytes);
if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) { if (pSchema->type == TSDB_DATA_TYPE_BINARY || pSchema->type == TSDB_DATA_TYPE_NCHAR) {
varDataSetLen(pInfo->q, pCond->nLen);
tVariantDump(pCond, varDataVal(pInfo->q), pSchema->type); tVariantDump(pCond, varDataVal(pInfo->q), pSchema->type);
varDataSetLen(pInfo->q, pCond->nLen); // the length may be changed after dump, so assign its value after dump
} else { } else {
tVariantDump(pCond, pInfo->q, pSchema->type); tVariantDump(pCond, pInfo->q, pSchema->type);
} }
......
...@@ -67,33 +67,29 @@ int32_t compareLenPrefixedStr(const void *pLeft, const void *pRight) { ...@@ -67,33 +67,29 @@ int32_t compareLenPrefixedStr(const void *pLeft, const void *pRight) {
if (len1 != len2) { if (len1 != len2) {
return len1 > len2? 1:-1; return len1 > len2? 1:-1;
} else { } else {
return (int32_t) strncmp(varDataVal(pLeft), varDataVal(pRight), len1); int32_t ret = strncmp(varDataVal(pLeft), varDataVal(pRight), len1);
if (ret == 0) {
return 0;
} else {
return ret > 0 ? 1:-1;
}
} }
} }
int32_t compareWStrVal(const void *pLeft, const void *pRight) { int32_t compareLenPrefixedWStr(const void *pLeft, const void *pRight) {
// SSkipListKey *pL = (SSkipListKey *)pLeft; int32_t len1 = varDataLen(pLeft);
// SSkipListKey *pR = (SSkipListKey *)pRight; int32_t len2 = varDataLen(pRight);
//
// if (pL->nLen == 0 && pR->nLen == 0) { if (len1 != len2) {
// return 0; return len1 > len2? 1:-1;
// } } else {
// int32_t ret = wcsncmp(varDataVal(pLeft), varDataVal(pRight), len1);
// // handle only one-side bound compare situation, there is only lower bound or only upper bound if (ret == 0) {
// if (pL->nLen == -1) { return 0;
// return 1; // no lower bound, lower bound is minimum, always return -1; } else {
// } else if (pR->nLen == -1) { return ret > 0 ? 1 : -1;
// return -1; // no upper bound, upper bound is maximum situation, always return 1; }
// } }
//
// int32_t ret = wcscmp(((SSkipListKey *)pLeft)->wpz, ((SSkipListKey *)pRight)->wpz);
//
// if (ret == 0) {
// return 0;
// } else {
// return ret > 0 ? 1 : -1;
// }
return 0;
} }
/* /*
...@@ -284,7 +280,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) { ...@@ -284,7 +280,7 @@ __compar_fn_t getComparFunc(int32_t type, int32_t optr) {
if (optr == TSDB_RELATION_LIKE) { if (optr == TSDB_RELATION_LIKE) {
comparFn = compareWStrPatternComp; comparFn = compareWStrPatternComp;
} else { } else {
comparFn = compareWStrVal; comparFn = compareLenPrefixedWStr;
} }
break; break;
...@@ -326,7 +322,7 @@ __compar_fn_t getKeyComparFunc(int32_t keyType) { ...@@ -326,7 +322,7 @@ __compar_fn_t getKeyComparFunc(int32_t keyType) {
break; break;
case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_NCHAR:
comparFn = compareWStrVal; comparFn = compareLenPrefixedWStr;
break; break;
default: default:
......
...@@ -194,8 +194,10 @@ sql reset query cache ...@@ -194,8 +194,10 @@ sql reset query cache
sql select * from $mt where tgcol = '1' sql select * from $mt where tgcol = '1'
step2: step2:
if $rows != 100 then if $rows != 100 then
print expect 100, actual: $rows
return -1 return -1
endi endi
sql select * from $mt where tgcol > '0' sql select * from $mt where tgcol > '0'
#print rows = $rows #print rows = $rows
if $rows != 100 then if $rows != 100 then
......
...@@ -35,6 +35,12 @@ run general/parser/first_last.sim ...@@ -35,6 +35,12 @@ run general/parser/first_last.sim
sleep 2000 sleep 2000
run general/parser/import_file.sim run general/parser/import_file.sim
sleep 2000 sleep 2000
run general/parser/lastrow.sim
sleep 2000
run general/parser/nchar.sim
sleep 2000
run general/parser/null_char.sim
sleep 2000
run general/parser/fill.sim run general/parser/fill.sim
sleep 2000 sleep 2000
run general/parser/fill_stb.sim run general/parser/fill_stb.sim
...@@ -42,7 +48,6 @@ sleep 2000 ...@@ -42,7 +48,6 @@ sleep 2000
run general/parser/tags_dynamically_specifiy.sim run general/parser/tags_dynamically_specifiy.sim
sleep 2000 sleep 2000
run general/parser/interp.sim run general/parser/interp.sim
run general/parser/lastrow.sim
sleep 2000 sleep 2000
run general/parser/limit.sim run general/parser/limit.sim
sleep 2000 sleep 2000
...@@ -54,10 +59,6 @@ run general/parser/limit2.sim ...@@ -54,10 +59,6 @@ run general/parser/limit2.sim
sleep 2000 sleep 2000
run general/parser/mixed_blocks.sim run general/parser/mixed_blocks.sim
sleep 2000 sleep 2000
run general/parser/nchar.sim
sleep 2000
run general/parser/null_char.sim
sleep 2000
run general/parser/selectResNum.sim run general/parser/selectResNum.sim
sleep 2000 sleep 2000
run general/parser/select_across_vnodes.sim run general/parser/select_across_vnodes.sim
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册