@@ -88,13 +88,11 @@ std::optional<int32_t> RowVector::compare(
88
88
vector_size_t otherIndex,
89
89
CompareFlags flags) const {
90
90
auto otherRow = other->wrappedVector ()->as <RowVector>();
91
- if (otherRow->encoding () != VectorEncoding::Simple::ROW) {
92
- VELOX_CHECK (
93
- false ,
94
- " Compare of ROW and non-ROW {} and {}" ,
95
- BaseVector::toString (),
96
- otherRow->BaseVector ::toString ());
97
- }
91
+ VELOX_CHECK (
92
+ otherRow->encoding () == VectorEncoding::Simple::ROW,
93
+ " Compare of ROW and non-ROW {} and {}" ,
94
+ BaseVector::toString (),
95
+ otherRow->BaseVector ::toString ());
98
96
99
97
bool isNull = isNullAt (index );
100
98
bool otherNull = other->isNullAt (otherIndex);
@@ -118,13 +116,14 @@ std::optional<int32_t> RowVector::compare(
118
116
if (!child || !otherChild) {
119
117
return child ? 1 : -1 ; // Absent child counts as less.
120
118
}
121
- if (child->typeKind () != otherChild->typeKind ()) {
122
- VELOX_CHECK (
123
- false ,
124
- " Compare of different child types: {} and {}" ,
125
- BaseVector::toString (),
126
- other->BaseVector ::toString ());
127
- }
119
+
120
+ VELOX_CHECK_EQ (
121
+ child->typeKind (),
122
+ otherChild->typeKind (),
123
+ " Compare of different child types: {} and {}" ,
124
+ BaseVector::toString (),
125
+ other->BaseVector ::toString ());
126
+
128
127
auto wrappedOtherIndex = other->wrappedIndex (otherIndex);
129
128
auto result = child->compare (
130
129
otherChild->loadedVector (), index , wrappedOtherIndex, flags);
@@ -582,7 +581,7 @@ void ArrayVectorBase::copyRangesImpl(
582
581
applyToEachRange (
583
582
ranges, [&](auto targetIndex, auto sourceIndex, auto count) {
584
583
if (count > 0 ) {
585
- VELOX_DCHECK (BaseVector::length_ >= targetIndex + count);
584
+ VELOX_DCHECK_GE (BaseVector::length_, targetIndex + count);
586
585
totalCount += count;
587
586
}
588
587
});
@@ -665,9 +664,7 @@ void RowVector::resize(vector_size_t newSize, bool setNotNull) {
665
664
// Resize all the children.
666
665
for (auto & child : children_) {
667
666
if (child != nullptr ) {
668
- if (child->isLazy ()) {
669
- VELOX_FAIL (" Resize on a lazy vector is not allowed" );
670
- }
667
+ VELOX_CHECK (!child->isLazy (), " Resize on a lazy vector is not allowed" );
671
668
672
669
// If we are just reducing the size of the vector, its safe
673
670
// to skip uniqueness check since effectively we are just changing
@@ -1028,13 +1025,13 @@ std::optional<int32_t> ArrayVector::compare(
1028
1025
1029
1026
auto otherArray = otherValue->asUnchecked <ArrayVector>();
1030
1027
auto otherElements = otherArray->elements_ .get ();
1031
- if (elements_-> typeKind () != otherElements-> typeKind ()) {
1032
- VELOX_CHECK (
1033
- false ,
1034
- " Compare of arrays of different element type: {} and {} " ,
1035
- BaseVector::toString () ,
1036
- otherArray-> BaseVector ::toString ());
1037
- }
1028
+
1029
+ VELOX_CHECK_EQ (
1030
+ elements_-> typeKind () ,
1031
+ otherElements-> typeKind () ,
1032
+ " Compare of arrays of different element type: {} and {} " ,
1033
+ BaseVector::toString (),
1034
+ otherArray-> BaseVector ::toString ());
1038
1035
1039
1036
if (flags.equalsOnly &&
1040
1037
rawSizes_[index ] != otherArray->rawSizes_ [wrappedOtherIndex]) {
@@ -1250,8 +1247,7 @@ std::optional<int32_t> MapVector::compare(
1250
1247
1251
1248
if (keys_->typeKind () != otherMap->keys_ ->typeKind () ||
1252
1249
values_->typeKind () != otherMap->values_ ->typeKind ()) {
1253
- VELOX_CHECK (
1254
- false ,
1250
+ VELOX_FAIL (
1255
1251
" Compare of maps of different key/value types: {} and {}" ,
1256
1252
BaseVector::toString (),
1257
1253
otherMap->BaseVector ::toString ());
@@ -1328,7 +1324,7 @@ void MapVector::canonicalize(
1328
1324
// threads. The keys and values do not have to be uniquely owned
1329
1325
// since they are not mutated but rather transposed, which is
1330
1326
// non-destructive.
1331
- VELOX_CHECK (map.use_count () == 1 );
1327
+ VELOX_CHECK_EQ (map.use_count (), 1 );
1332
1328
BufferPtr indices;
1333
1329
vector_size_t * indicesRange;
1334
1330
for (auto i = 0 ; i < map->BaseVector ::length_; ++i) {
@@ -1697,7 +1693,7 @@ MapVectorPtr MapVector::updateImpl(
1697
1693
1698
1694
MapVectorPtr MapVector::update (const std::vector<MapVectorPtr>& others) const {
1699
1695
VELOX_CHECK (!others.empty ());
1700
- VELOX_CHECK (others.size () < std::numeric_limits<int8_t >::max ());
1696
+ VELOX_CHECK_LT (others.size (), std::numeric_limits<int8_t >::max ());
1701
1697
for (auto & other : others) {
1702
1698
VELOX_CHECK_EQ (size (), other->size ());
1703
1699
}
0 commit comments