Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Fix append not supported between LargeBinaryColumn and BinaryColumn in primary key encoder #33548

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion be/src/storage/primary_key_encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,21 @@ void PrimaryKeyEncoder::encode(const Schema& schema, const Chunk& chunk, size_t
if (schema.num_key_fields() == 1) {
// simple encoding, src & dest should have same type
auto& src = chunk.get_column_by_index(0);
dest->append(*src, offset, len);
if (dest->is_large_binary() && src->is_binary()) {
auto& bdest = down_cast<LargeBinaryColumn&>(*dest);
auto& bsrc = down_cast<BinaryColumn&>(*src);
for (size_t i = 0; i < len; i++) {
bdest.append(bsrc.get_slice(offset + i));
}
} else if (dest->is_binary() && src->is_large_binary()) {
auto& bdest = down_cast<BinaryColumn&>(*dest);
auto& bsrc = down_cast<LargeBinaryColumn&>(*src);
for (size_t i = 0; i < len; i++) {
bdest.append(bsrc.get_slice(offset + i));
}
} else {
dest->append(*src, offset, len);
}
} else {
CHECK(dest->is_binary() || dest->is_large_binary()) << "dest column should be binary";
int ncol = schema.num_key_fields();
Expand Down
Loading