diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 26598ba279bdf5718d2660ebe8134e7fa9b4a4df..c5bcab4e7605797002773dc8d277ca5f4d3c776b 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1998,6 +1998,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SArray* pDataBlocks } offset += TYPE_BYTES[pCol->type]; // sum/avg would convert to int64_t/uint64_t/double during aggregation } + tdSRowEnd(&rb); dataLen += TD_ROW_LEN(rb.pBuf); #ifdef TD_DEBUG_PRINT_ROW tdSRowPrint(rb.pBuf, pTSchema, __func__); diff --git a/source/libs/executor/src/tsimplehash.c b/source/libs/executor/src/tsimplehash.c index e709643af9e808eb64db914284cae529f3cd32d3..5ba2be1f21d9bf4c021c167a7b4fa2eb8675892c 100644 --- a/source/libs/executor/src/tsimplehash.c +++ b/source/libs/executor/src/tsimplehash.c @@ -137,13 +137,13 @@ static void taosHashTableResize(SSHashObj *pHashObj) { continue; } - SHNode *pNext; + SHNode *pNext = NULL; SHNode *pPrev = NULL; while (pNode != NULL) { void *key = GET_SHASH_NODE_KEY(pNode, pHashObj->dataLen); - uint32_t hashVal = (*pHashObj->hashFp)(key, (uint32_t)pHashObj->dataLen); + uint32_t hashVal = (*pHashObj->hashFp)(key, (uint32_t)pHashObj->keyLen); int32_t newIdx = HASH_INDEX(hashVal, pHashObj->capacity); pNext = pNode->next; @@ -187,12 +187,13 @@ int32_t tSimpleHashPut(SSHashObj *pHashObj, const void *key, const void *data) { SHNode *pNode = pHashObj->hashList[slot]; if (pNode == NULL) { - SHNode *pNewNode = doCreateHashNode(key, pHashObj->keyLen, data, pHashObj->size, hashVal); + SHNode *pNewNode = doCreateHashNode(key, pHashObj->keyLen, data, pHashObj->dataLen, hashVal); if (pNewNode == NULL) { return -1; } pHashObj->hashList[slot] = pNewNode; + atomic_add_fetch_64(&pHashObj->size, 1); return 0; } @@ -204,7 +205,7 @@ int32_t tSimpleHashPut(SSHashObj *pHashObj, const void *key, const void *data) { } if (pNode == NULL) { - SHNode *pNewNode = doCreateHashNode(key, pHashObj->keyLen, data, pHashObj->size, hashVal); + SHNode *pNewNode = doCreateHashNode(key, pHashObj->keyLen, data, pHashObj->dataLen, hashVal); if (pNewNode == NULL) { return -1; }