From 97f947e15e7df469e3a5852b44becdd5a8d1c1fd Mon Sep 17 00:00:00 2001 From: yan ma Date: Tue, 5 Mar 2024 23:59:32 +0800 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 57232416e196..b6ab609dd4db 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); }