Skip to content

Commit

Permalink
varchar and varbinary are compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Jan 10, 2023
1 parent bc489b1 commit c8b4842
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion velox/connectors/hive/HiveConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ bool testFilters(
template <TypeKind ToKind>
velox::variant convertFromString(const std::optional<std::string>& value) {
if (value.has_value()) {
if constexpr (ToKind == TypeKind::VARCHAR) {
if constexpr (ToKind == TypeKind::VARCHAR || ToKind == TypeKind::VARBINARY) {
return velox::variant(value.value());
}
bool nullOutput = false;
Expand Down
5 changes: 4 additions & 1 deletion velox/vector/BaseVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,10 @@ class BaseVector {
// two unknowns but values cannot be assigned into an unknown 'left'
// from a not-unknown 'right'.
static bool compatibleKind(TypeKind left, TypeKind right) {
return left == right || right == TypeKind::UNKNOWN;
// Vectors of VARCHAR and VARBINARY are compatible with each other.
bool varcharAndBinary = (left == TypeKind::VARCHAR && right == TypeKind::VARBINARY) ||
(left == TypeKind::VARBINARY && right == TypeKind::VARCHAR);
return left == right || right == TypeKind::UNKNOWN || varcharAndBinary;
}

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

0 comments on commit c8b4842

Please sign in to comment.