Skip to content

Commit f97108e

Browse files
BobLiu20rhdong
authored andcommitted
fix redis cluster MaccumCommand
1 parent c94b4ab commit f97108e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tensorflow_recommenders_addons/dynamic_embedding/core/kernels/redis_impl/redis_cluster_connection_pool.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ every bucket has its own BucketContext for sending data---for locating reply-
12811281
dtype_str_size);
12821282
}
12831283

1284+
std::vector<std::vector<bool>> exists_split(storage_slice);
12841285
VContentAndTypeSizeResult VCATS_temp;
12851286
// std::vector<char> for storage all string in one KV pair
12861287
std::vector<std::vector<char>> buff_temp(total);
@@ -1298,12 +1299,18 @@ every bucket has its own BucketContext for sending data---for locating reply-
12981299
key_bucket_locs, KContentPointer<K>(pk_raw), KTypeSize<K>(pk_raw));
12991300
thread_context->HandlePushBack(
13001301
key_bucket_locs, VCATS_temp.VContentPointer, VCATS_temp.VTypeSize);
1302+
exists_split[key_bucket_locs].push_back(*(exists + begin + i));
13011303
}
13021304

13031305
const bool *pe_raw = exists + begin;
13041306
for (unsigned i = 0; i < storage_slice; ++i) {
1305-
thread_context->HandlePushBack(i, KContentPointer<bool>(pe_raw),
1306-
total * KTypeSize<bool>(pe_raw));
1307+
if (!exists_split[i].empty()) {
1308+
std::vector<char> exists_char(exists_split[i].size());
1309+
std::transform(exists_split[i].begin(), exists_split[i].end(), exists_char.begin(), [](bool b) {
1310+
return static_cast<char>(b);
1311+
});
1312+
thread_context->HandlePushBack(i, exists_char.data(), exists_char.size() * sizeof(char));
1313+
}
13071314
}
13081315

13091316
auto cmd = [](::sw::redis::Connection &connection,

0 commit comments

Comments
 (0)