[Enhancement](functions) change some nullable mode and clear some smooth upgrade (#25334)

This commit is contained in:
zclllyybb
2023-10-16 19:50:17 +08:00
committed by GitHub
parent 7fd876f3a2
commit f9df3bae61
24 changed files with 152 additions and 834 deletions

View File

@ -146,7 +146,7 @@ public:
}
};
template <bool is_key>
template <bool is_key, bool OldVersion = false>
class FunctionMapContains : public IFunction {
public:
static constexpr auto name = is_key ? "map_contains_key" : "map_contains_value";
@ -170,7 +170,16 @@ public:
}
DCHECK(is_map(datatype)) << "first argument for function: " << name
<< " should be DataTypeMap";
return make_nullable(std::make_shared<DataTypeNumber<UInt8>>());
if constexpr (OldVersion) {
return make_nullable(std::make_shared<DataTypeNumber<UInt8>>());
} else {
if (arguments[0]->is_nullable()) {
return make_nullable(std::make_shared<DataTypeNumber<UInt8>>());
} else {
return std::make_shared<DataTypeNumber<UInt8>>();
}
}
}
Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,