Skip to content

Commit

Permalink
fix "Type mismatch: Varbinary vs Varchar" in VectorHasher
Browse files Browse the repository at this point in the history
  • Loading branch information
yma11 authored and FelixYBW committed Jul 1, 2024
1 parent 406621d commit b079cae
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions velox/exec/VectorHasher.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,21 @@ class VectorHasher {

static constexpr uint64_t kNullHash = BaseVector::kNullHash;

bool isVarbinaryOrVarchar(TypeKind type) {
return type == TypeKind::VARCHAR || type == TypeKind::VARBINARY;
}

// Decodes the 'vector' in preparation for calling hash() or
// computeValueIds(). The decoded vector can be accessed via decodedVector()
// getter.
void decode(const BaseVector& vector, const SelectivityVector& rows) {
VELOX_CHECK(
type_->kindEquals(vector.type()),
"Type mismatch: {} vs. {}",
type_->toString(),
vector.type()->toString());
if (!(isVarbinaryOrVarchar(type_->kind()) && isVarbinaryOrVarchar(vector.type()->kind()))) {
VELOX_CHECK(
type_->kindEquals(vector.type()),
"Type mismatch: {} vs. {}",
type_->toString(),
vector.type()->toString());
}
decoded_.decode(vector, rows);
}

Expand Down

0 comments on commit b079cae

Please sign in to comment.