From afe5870f1b3573697380a9e95d16dec3594108f8 Mon Sep 17 00:00:00 2001 From: binwei Date: Thu, 25 Jul 2024 04:23:13 +0000 Subject: [PATCH] fix "Type mismatch: Varbinary vs Varchar" in VectorHasher --- velox/exec/VectorHasher.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/velox/exec/VectorHasher.h b/velox/exec/VectorHasher.h index 339f6deee64c8..94bef4e17e6d7 100644 --- a/velox/exec/VectorHasher.h +++ b/velox/exec/VectorHasher.h @@ -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); }