Skip to content

Commit

Permalink
change kindEquals to equals
Browse files Browse the repository at this point in the history
  • Loading branch information
majetideepak committed Jun 7, 2022
1 parent e728f02 commit 6cc1be5
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 27 deletions.
3 changes: 1 addition & 2 deletions velox/core/Expressions.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ class ConstantTypedExpr : public ITypedExpr {

if (this->hasValueVector()) {
return casted->hasValueVector() &&
this->valueVector_->type()->kindEquals(
casted->valueVector_->type()) &&
this->valueVector_->type()->equals(*casted->valueVector_->type()) &&
this->valueVector_->equalValueAt(casted->valueVector_.get(), 0, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion velox/core/SimpleFunctionMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ class SimpleFunctionMetadata : public ISimpleFunctionMetadata {

void verifyReturnTypeCompatibility() {
VELOX_USER_CHECK(
CppToType<TReturn>::create()->kindEquals(returnType_),
CppToType<TReturn>::create()->equals(*returnType_),
"return type override mismatch");
}

Expand Down
2 changes: 1 addition & 1 deletion velox/exec/HashAggregation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ HashAggregation::HashAggregation(
const auto& aggResultType = aggregates[i]->resultType();
const auto& expectedType = outputType_->childAt(numHashers + i);
VELOX_CHECK(
aggResultType->kindEquals(expectedType),
aggResultType->equals(*expectedType),
"Unexpected result type for an aggregation: {}, expected {}, step {}",
aggResultType->toString(),
expectedType->toString(),
Expand Down
2 changes: 1 addition & 1 deletion velox/expression/ExprCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ ExprPtr compileExpression(
SimpleFunctions().resolveFunction(call->name(), inputTypes)) {
auto metadata = simpleFunctionEntry->getMetadata();
VELOX_USER_CHECK(
resultType->kindEquals(metadata->returnType()),
resultType->equals(*metadata->returnType()),
"Found incompatible return types for '{}' ({} vs. {}) "
"for input types ({}).",
call->name(),
Expand Down
4 changes: 2 additions & 2 deletions velox/expression/SignatureBinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ bool SignatureBinder::tryBind() {
if (actualTypes_.size() > formalArgsCnt) {
auto& type = actualTypes_[formalArgsCnt - 1];
for (auto i = formalArgsCnt; i < actualTypes_.size(); i++) {
if (!type->kindEquals(actualTypes_[i]) &&
if (!type->equals(*actualTypes_[i]) &&
actualTypes_[i]->kind() != TypeKind::UNKNOWN) {
return false;
}
Expand Down Expand Up @@ -98,7 +98,7 @@ bool SignatureBinder::tryBind(
return true;
}

return it->second->kindEquals(actualType);
return it->second->equals(*actualType);
}

TypePtr SignatureBinder::tryResolveType(
Expand Down
2 changes: 1 addition & 1 deletion velox/expression/tests/ExpressionFuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class ExpressionFuzzer {
if (lhs.name == rhs.name) {
if (lhs.args.size() == rhs.args.size()) {
for (size_t i = 0; i < lhs.args.size(); ++i) {
if (!lhs.args[i]->kindEquals(rhs.args[i])) {
if (!lhs.args[i]->equals(*rhs.args[i])) {
return lhs.args[i]->toString() < rhs.args[i]->toString();
}
}
Expand Down
2 changes: 1 addition & 1 deletion velox/expression/tests/SignatureBinderTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void testSignatureBinder(

auto returnType = binder.tryResolveReturnType();
ASSERT_TRUE(returnType != nullptr);
ASSERT_TRUE(expectedReturnType->kindEquals(returnType));
ASSERT_TRUE(expectedReturnType->equals(*returnType));
}

TEST(SignatureBinderTest, generics) {
Expand Down
4 changes: 2 additions & 2 deletions velox/functions/prestosql/ArrayContains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ class ArrayContainsFunction : public exec::VectorFunction {
const auto& searchVector = args[1];

VELOX_CHECK(arrayVector->type()->isArray());
VELOX_CHECK(arrayVector->type()->asArray().elementType()->kindEquals(
searchVector->type()));
VELOX_CHECK(arrayVector->type()->asArray().elementType()->equals(
*searchVector->type()));

BaseVector::ensureWritable(rows, BOOLEAN(), context->pool(), result);
auto flatResult = (*result)->asFlatVector<bool>();
Expand Down
2 changes: 1 addition & 1 deletion velox/functions/prestosql/ArrayIntersectExcept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ void validateMatchingArrayTypes(

for (auto& arg : inputArgs) {
VELOX_USER_CHECK(
arrayType->kindEquals(arg.type),
arrayType->equals(*arg.type),
"{} function requires all arguments of the same type: {} vs. {}",
name,
arg.type->toString(),
Expand Down
4 changes: 2 additions & 2 deletions velox/functions/prestosql/ArrayPosition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,8 @@ class ArrayPositionFunction : public exec::VectorFunction {
const auto& arrayVector = args[0];
const auto& searchVector = args[1];
VELOX_CHECK(arrayVector->type()->isArray());
VELOX_CHECK(arrayVector->type()->asArray().elementType()->kindEquals(
searchVector->type()));
VELOX_CHECK(arrayVector->type()->asArray().elementType()->equals(
*searchVector->type()));

BaseVector::ensureWritable(rows, BIGINT(), context->pool(), result);
auto flatResult = (*result)->asFlatVector<int64_t>();
Expand Down
4 changes: 2 additions & 2 deletions velox/functions/prestosql/MapConcat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ class MapConcatFunction : public exec::VectorFunction {
auto mapType = args[0]->type();
VELOX_CHECK_EQ(mapType->kind(), TypeKind::MAP);
for (auto& arg : args) {
VELOX_CHECK(mapType->kindEquals(arg->type()));
VELOX_CHECK(mapType->equals(*arg->type()));
}
VELOX_CHECK(mapType->kindEquals(outputType));
VELOX_CHECK(mapType->equals(*outputType));

auto numArgs = args.size();
exec::DecodedArgs decodedArgs(rows, args, context);
Expand Down
4 changes: 2 additions & 2 deletions velox/functions/prestosql/benchmarks/ArrayPositionBasic.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ class ArrayPositionFunctionBasic : public exec::VectorFunction {
const auto& arrayVector = args[0];
const auto& searchVector = args[1];
VELOX_CHECK(arrayVector->type()->isArray());
VELOX_CHECK(arrayVector->type()->asArray().elementType()->kindEquals(
searchVector->type()));
VELOX_CHECK(arrayVector->type()->asArray().elementType()->equals(
*searchVector->type()));

BaseVector::ensureWritable(rows, BIGINT(), context->pool(), result);
auto flatResult = (*result)->asFlatVector<int64_t>();
Expand Down
6 changes: 3 additions & 3 deletions velox/functions/prestosql/tests/MapKeysAndValuesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class MapKeysAndValuesTest : public FunctionBaseTest {
auto expected = expectedFunc(mapVector);

auto resultElements = result->elements();
ASSERT_TRUE(resultElements->type()->kindEquals(expected->type()));
ASSERT_TRUE(resultElements->type()->equals(*expected->type()));

EXPECT_EQ(numRows_, result->size());
for (vector_size_t i = 0; i < numRows_; ++i) {
Expand Down Expand Up @@ -85,7 +85,7 @@ class MapKeysAndValuesTest : public FunctionBaseTest {
auto array = std::dynamic_pointer_cast<ArrayVector>(
result->as<ConstantVector<ComplexType>>()->valueVector());
auto elements = array->elements();
ASSERT_TRUE(elements->type()->kindEquals(expected->type()));
ASSERT_TRUE(elements->type()->equals(*expected->type()));

EXPECT_EQ(numRows_, result->size());
for (vector_size_t i = 0; i < elements->size(); ++i) {
Expand Down Expand Up @@ -115,7 +115,7 @@ class MapKeysAndValuesTest : public FunctionBaseTest {
auto bExpected = expectedFunc(b);

auto resultElements = result->elements();
ASSERT_TRUE(result->type()->childAt(0)->kindEquals(aExpected->type()));
ASSERT_TRUE(result->type()->childAt(0)->equals(*aExpected->type()));

EXPECT_EQ(numRows_, result->size());
for (vector_size_t i = 0; i < numRows_; ++i) {
Expand Down
8 changes: 4 additions & 4 deletions velox/vector/ComplexVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class RowVector : public BaseVector {
const auto& child = children_[i];
if (child) {
VELOX_CHECK(
child->type()->kindEquals(type->childAt(i)),
child->type()->equals(*type->childAt(i)),
"Got type {} for field `{}` at position {}, but expected {}.",
child->type()->toString(),
rowType->nameOf(i),
Expand Down Expand Up @@ -226,7 +226,7 @@ class ArrayVector : public BaseVector {
pool)) {
VELOX_CHECK_EQ(type->kind(), TypeKind::ARRAY);
VELOX_CHECK(
elements_->type()->kindEquals(type->childAt(0)),
elements_->type()->equals(*type->childAt(0)),
"Unexpected element type: {}. Expected: {}",
elements_->type()->toString(),
type->childAt(0)->toString());
Expand Down Expand Up @@ -430,12 +430,12 @@ class MapVector : public BaseVector {
VELOX_CHECK_EQ(type->kind(), TypeKind::MAP);

VELOX_CHECK(
keys_->type()->kindEquals(type->childAt(0)),
keys_->type()->equals(*type->childAt(0)),
"Unexpected key type: {}. Expected: {}",
keys_->type()->toString(),
type->childAt(0)->toString());
VELOX_CHECK(
values_->type()->kindEquals(type->childAt(1)),
values_->type()->equals(*type->childAt(1)),
"Unexpected value type: {}. Expected: {}",
values_->type()->toString(),
type->childAt(1)->toString());
Expand Down
4 changes: 2 additions & 2 deletions velox/vector/tests/EnsureWritableVectorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ TEST_F(EnsureWritableVectorTest, array) {
VectorPtr result;
BaseVector::ensureWritable(rows, ARRAY(INTEGER()), pool_.get(), &result);
ASSERT_EQ(size, result->size());
ASSERT_TRUE(ARRAY(INTEGER())->kindEquals(result->type()));
ASSERT_TRUE(ARRAY(INTEGER())->equals(*result->type()));
ASSERT_EQ(VectorEncoding::Simple::ARRAY, result->encoding());

result->copy(a.get(), rows, nullptr);
Expand Down Expand Up @@ -567,7 +567,7 @@ TEST_F(EnsureWritableVectorTest, map) {
BaseVector::ensureWritable(
rows, MAP(INTEGER(), INTEGER()), pool_.get(), &result);
ASSERT_EQ(size, result->size());
ASSERT_TRUE(MAP(INTEGER(), INTEGER())->kindEquals(result->type()));
ASSERT_TRUE(MAP(INTEGER(), INTEGER())->equals(*result->type()));
ASSERT_EQ(VectorEncoding::Simple::MAP, result->encoding());

result->copy(a.get(), rows, nullptr);
Expand Down

0 comments on commit 6cc1be5

Please sign in to comment.