diff --git a/source/libs/stream/src/streamBackendRocksdb.c b/source/libs/stream/src/streamBackendRocksdb.c index d469580d04..f91c26638a 100644 --- a/source/libs/stream/src/streamBackendRocksdb.c +++ b/source/libs/stream/src/streamBackendRocksdb.c @@ -3307,7 +3307,7 @@ int32_t streamStateGet_rocksdb(SStreamState* pState, const SWinKey* key, void** int code = 0; SStateKey sKey = {.key = *key, .opNum = pState->number}; - char* tVal; + char* tVal = NULL; size_t tValLen = 0; STREAM_STATE_GET_ROCKSDB(pState, "state", &sKey, &tVal, &tValLen); if (code != 0) { @@ -3569,6 +3569,10 @@ int32_t streamStateFuncPut_rocksdb(SStreamState* pState, const STupleKey* key, c int code = 0; char* dst = NULL; size_t size = 0; + if (pState->pResultRowStore.resultRowPut == NULL || pState->pExprSupp == NULL) { + STREAM_STATE_PUT_ROCKSDB(pState, "func", key, (void*)value, (int32_t)vLen); + return code; + } code = (pState->pResultRowStore.resultRowPut)(pState->pExprSupp, value, vLen, &dst, &size); if (code != 0) { return code; diff --git a/source/libs/stream/test/backendTest.cpp b/source/libs/stream/test/backendTest.cpp index e7e7149882..1518d22fe9 100644 --- a/source/libs/stream/test/backendTest.cpp +++ b/source/libs/stream/test/backendTest.cpp @@ -228,17 +228,17 @@ void *backendOpen() { memset(&key, 0, sizeof(key)); char *val = NULL; int32_t vlen = 0; - code = streamStateSessionGetKVByCur_rocksdb(pCurr, &key, (void **)&val, &vlen); + code = streamStateSessionGetKVByCur_rocksdb(NULL, pCurr, &key, (void **)&val, &vlen); ASSERT(code == 0); pCurr = streamStateSessionSeekKeyPrev_rocksdb(p, &key); - code = streamStateSessionGetKVByCur_rocksdb(pCurr, &key, (void **)&val, &vlen); + code = streamStateSessionGetKVByCur_rocksdb(NULL, pCurr, &key, (void **)&val, &vlen); ASSERT(code == 0); ASSERT(key.groupId == 0 && key.win.ekey == tsArray[tsArray.size() - 2]); pCurr = streamStateSessionSeekKeyNext_rocksdb(p, &key); - code = streamStateSessionGetKVByCur_rocksdb(pCurr, &key, (void **)&val, &vlen); + code = streamStateSessionGetKVByCur_rocksdb(NULL, pCurr, &key, (void **)&val, &vlen); ASSERT(code == 0); ASSERT(vlen == strlen("Value")); ASSERT(key.groupId == 0 && key.win.skey == tsArray[tsArray.size() - 1]);