Skip to content

Commit c8b4842

Browse files
committed
varchar and varbinary are compatible
1 parent bc489b1 commit c8b4842

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

velox/connectors/hive/HiveConnector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ bool testFilters(
309309
template <TypeKind ToKind>
310310
velox::variant convertFromString(const std::optional<std::string>& value) {
311311
if (value.has_value()) {
312-
if constexpr (ToKind == TypeKind::VARCHAR) {
312+
if constexpr (ToKind == TypeKind::VARCHAR || ToKind == TypeKind::VARBINARY) {
313313
return velox::variant(value.value());
314314
}
315315
bool nullOutput = false;

velox/vector/BaseVector.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,10 @@ class BaseVector {
668668
// two unknowns but values cannot be assigned into an unknown 'left'
669669
// from a not-unknown 'right'.
670670
static bool compatibleKind(TypeKind left, TypeKind right) {
671-
return left == right || right == TypeKind::UNKNOWN;
671+
// Vectors of VARCHAR and VARBINARY are compatible with each other.
672+
bool varcharAndBinary = (left == TypeKind::VARCHAR && right == TypeKind::VARBINARY) ||
673+
(left == TypeKind::VARBINARY && right == TypeKind::VARCHAR);
674+
return left == right || right == TypeKind::UNKNOWN || varcharAndBinary;
672675
}
673676

674677
/// Returns a brief summary of the vector. If 'recursive' is true, includes a

0 commit comments

Comments
 (0)