mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
fix tests
This commit is contained in:
parent
c4b0d8f849
commit
356c11bb25
@ -48,40 +48,22 @@ public:
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
size_t number_of_arguments = arguments.size();
|
||||
for (size_t index = 0; index < getNumberOfArguments(); ++index)
|
||||
{
|
||||
const auto * arg = arguments[index].get();
|
||||
|
||||
if (number_of_arguments != 3) {
|
||||
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
|
||||
"Number of arguments for function {} doesn't match: passed {}, should be 3",
|
||||
getName(),
|
||||
toString(number_of_arguments));
|
||||
}
|
||||
|
||||
const auto * arg = arguments[0].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), 1, getName());
|
||||
}
|
||||
|
||||
arg = arguments[1].get();
|
||||
|
||||
if (!WhichDataType(arg).isFloat64()) {
|
||||
if (index == 1 && !WhichDataType(arg).isFloat64())
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be Float64",
|
||||
arg->getName(), 2, getName());
|
||||
}
|
||||
|
||||
arg = arguments[2].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
else if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), 3, getName());
|
||||
arg->getName(), index + 1, getName()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return std::make_shared<DataTypeUInt8>();
|
||||
|
@ -50,44 +50,22 @@ public:
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
size_t number_of_arguments = arguments.size();
|
||||
|
||||
if (number_of_arguments != 4) {
|
||||
throw Exception("Number of arguments for function " + getName() + " doesn't match: passed "
|
||||
+ toString(number_of_arguments) + ", should be 4",
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
}
|
||||
|
||||
const auto * arg = arguments[0].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
for (size_t index = 0; index < getNumberOfArguments(); ++index)
|
||||
{
|
||||
const auto * arg = arguments[index].get();
|
||||
if ((index == 1 || index == 3) && !WhichDataType(arg).isFloat64())
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(1) + " of function " + getName() + ". Must be UInt64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
|
||||
arg = arguments[1].get();
|
||||
|
||||
if (!WhichDataType(arg).isFloat64()) {
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT
|
||||
"Illegal type {} of argument {} of function {}. Must be Float64",
|
||||
arg->getName(), index + 1, getName()
|
||||
);
|
||||
else if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(2) + " of function " + getName() + ". Must be Float64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), index + 1, getName()
|
||||
);
|
||||
}
|
||||
|
||||
arg = arguments[2].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(3) + " of function " + getName() + ". Must be UInt64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
|
||||
arg = arguments[3].get();
|
||||
|
||||
if (!WhichDataType(arg).isFloat64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(4) + " of function " + getName() + ". Must be Float64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
|
||||
DataTypePtr center = std::make_shared<DataTypeUInt64>();
|
||||
|
@ -44,34 +44,22 @@ public:
|
||||
return name;
|
||||
}
|
||||
|
||||
size_t getNumberOfArguments() const override { return 1; }
|
||||
size_t getNumberOfArguments() const override { return 2; }
|
||||
|
||||
bool useDefaultImplementationForConstants() const override { return true; }
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
size_t number_of_arguments = arguments.size();
|
||||
|
||||
if (number_of_arguments != 2) {
|
||||
throw Exception("Number of arguments for function " + getName() + " doesn't match: passed "
|
||||
+ toString(number_of_arguments) + ", should be 2",
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
}
|
||||
|
||||
const auto * arg = arguments[0].get();
|
||||
|
||||
for (size_t i = 0; i < getNumberOfArguments(); ++i)
|
||||
{
|
||||
const auto * arg = arguments[i].get();
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(1) + " of function " + getName() + ". Must be UInt64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), i, getName()
|
||||
);
|
||||
}
|
||||
|
||||
arg = arguments[1].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(2) + " of function " + getName() + ". Must be UInt64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
|
||||
return std::make_shared<DataTypeUInt8>();
|
||||
|
@ -48,20 +48,14 @@ public:
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
size_t number_of_arguments = arguments.size();
|
||||
|
||||
if (number_of_arguments != 1) {
|
||||
throw Exception("Number of arguments for function " + getName() + " doesn't match: passed "
|
||||
+ toString(number_of_arguments) + ", should be 2",
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
}
|
||||
|
||||
const auto * arg = arguments[0].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(1) + " of function " + getName() + ". Must be Float64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be Float64",
|
||||
arg->getName(), 1, getName()
|
||||
);
|
||||
}
|
||||
|
||||
return std::make_shared<DataTypeArray>(std::make_shared<DataTypeUInt64>());
|
||||
|
@ -50,36 +50,16 @@ public:
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
size_t number_of_arguments = arguments.size();
|
||||
|
||||
if (number_of_arguments != 3) {
|
||||
throw Exception("Number of arguments for function " + getName() + " doesn't match: passed "
|
||||
+ toString(number_of_arguments) + ", should be 3",
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
}
|
||||
|
||||
const auto * arg = arguments[0].get();
|
||||
|
||||
for (size_t index = 0; index < getNumberOfArguments(); ++index)
|
||||
{
|
||||
const auto * arg = arguments[index].get();
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(1) + " of function " + getName() + ". Must be UInt64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), i, getName()
|
||||
);
|
||||
}
|
||||
|
||||
arg = arguments[1].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(2) + " of function " + getName() + ". Must be UInt64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
|
||||
arg = arguments[2].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(3) + " of function " + getName() + ". Must be UInt64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
|
||||
DataTypePtr element = std::make_shared<DataTypeUInt64>();
|
||||
|
@ -50,36 +50,16 @@ public:
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
size_t number_of_arguments = arguments.size();
|
||||
|
||||
if (number_of_arguments != 3) {
|
||||
throw Exception("Number of arguments for function " + getName() + " doesn't match: passed "
|
||||
+ toString(number_of_arguments) + ", should be 3",
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
}
|
||||
|
||||
const auto * arg = arguments[0].get();
|
||||
|
||||
for (size_t i = 0; i < getNumberOfArguments(); ++i)
|
||||
{
|
||||
const auto * arg = arguments[i].get();
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(1) + " of function " + getName() + ". Must be UInt64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), i, getName()
|
||||
);
|
||||
}
|
||||
|
||||
arg = arguments[1].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(2) + " of function " + getName() + ". Must be UInt64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
|
||||
arg = arguments[2].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(3) + " of function " + getName() + ". Must be UInt64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
|
||||
return std::make_shared<DataTypeUInt8>();
|
||||
|
@ -50,49 +50,16 @@ public:
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
size_t number_of_arguments = arguments.size();
|
||||
|
||||
if (number_of_arguments != 4) {
|
||||
throw Exception(
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
|
||||
"Number of arguments for function {} doesn't match: passed {}, should be 4",
|
||||
getName(), number_of_arguments);
|
||||
}
|
||||
|
||||
const auto * arg = arguments[0].get();
|
||||
|
||||
for (size_t i = 0; i < getNumberOfArguments(); ++i)
|
||||
{
|
||||
const auto * arg = arguments[i].get();
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), 1, getName());
|
||||
arg->getName(), i, getName()
|
||||
);
|
||||
}
|
||||
|
||||
arg = arguments[1].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), 2, getName());
|
||||
}
|
||||
|
||||
arg = arguments[2].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), 3, getName());
|
||||
}
|
||||
|
||||
arg = arguments[3].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), 4, getName());
|
||||
}
|
||||
|
||||
DataTypePtr element = std::make_shared<DataTypeUInt64>();
|
||||
|
@ -50,49 +50,16 @@ public:
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
size_t number_of_arguments = arguments.size();
|
||||
|
||||
if (number_of_arguments != 4) {
|
||||
throw Exception(
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
|
||||
"Number of arguments for function {} doesn't match: passed {}, should be 4",
|
||||
getName(), number_of_arguments);
|
||||
}
|
||||
|
||||
const auto * arg = arguments[0].get();
|
||||
|
||||
for (size_t i = 0; i < getNumberOfArguments(); ++i)
|
||||
{
|
||||
const auto * arg = arguments[i].get();
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), 1, getName());
|
||||
arg->getName(), i, getName()
|
||||
);
|
||||
}
|
||||
|
||||
arg = arguments[1].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), 2, getName());
|
||||
}
|
||||
|
||||
arg = arguments[2].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), 3, getName());
|
||||
}
|
||||
|
||||
arg = arguments[3].get();
|
||||
|
||||
if (!WhichDataType(arg).isUInt64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be UInt64",
|
||||
arg->getName(), 4, getName());
|
||||
}
|
||||
|
||||
DataTypePtr element = std::make_shared<DataTypeUInt64>();
|
||||
|
@ -48,27 +48,16 @@ public:
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
size_t number_of_arguments = arguments.size();
|
||||
|
||||
if (number_of_arguments != 2) {
|
||||
throw Exception("Number of arguments for function " + getName() + " doesn't match: passed "
|
||||
+ toString(number_of_arguments) + ", should be 2",
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH);
|
||||
}
|
||||
|
||||
const auto * arg = arguments[0].get();
|
||||
|
||||
for (size_t i = 0; i < getNumberOfArguments(); ++i)
|
||||
{
|
||||
const auto * arg = arguments[i].get();
|
||||
if (!WhichDataType(arg).isFloat64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(1) + " of function " + getName() + ". Must be Float64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be Float64",
|
||||
arg->getName(), i, getName()
|
||||
);
|
||||
}
|
||||
|
||||
arg = arguments[1].get();
|
||||
if (!WhichDataType(arg).isFloat64()) {
|
||||
throw Exception(
|
||||
"Illegal type " + arg->getName() + " of argument " + std::to_string(2) + " of function " + getName() + ". Must be Float64",
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
|
||||
}
|
||||
|
||||
return std::make_shared<DataTypeUInt64>();
|
||||
|
@ -48,30 +48,16 @@ public:
|
||||
|
||||
DataTypePtr getReturnTypeImpl(const DataTypes & arguments) const override
|
||||
{
|
||||
size_t number_of_arguments = arguments.size();
|
||||
|
||||
if (number_of_arguments != 2) {
|
||||
throw Exception(
|
||||
ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH,
|
||||
"Number of arguments for function {} doesn't match: passed {}, should be 2",
|
||||
getName(), number_of_arguments);
|
||||
}
|
||||
|
||||
const auto * arg = arguments[0].get();
|
||||
|
||||
for (size_t i = 0; i < getNumberOfArguments(); ++i)
|
||||
{
|
||||
const auto * arg = arguments[i].get();
|
||||
if (!WhichDataType(arg).isFloat64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be Float64",
|
||||
arg->getName(), 1, getName());
|
||||
arg->getName(), i, getName()
|
||||
);
|
||||
}
|
||||
|
||||
arg = arguments[1].get();
|
||||
if (!WhichDataType(arg).isFloat64()) {
|
||||
throw Exception(
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
|
||||
"Illegal type {} of argument {} of function {}. Must be Float64",
|
||||
arg->getName(), 2, getName());
|
||||
}
|
||||
|
||||
return std::make_shared<DataTypeUInt64>();
|
||||
|
@ -1,4 +1,4 @@
|
||||
select degreesToS2(55.77922738, 37.63098076);
|
||||
select degreesToS2(55.76324100, 37.66018300);
|
||||
select degreesToS2(90, 45);
|
||||
select degreesToS2(-12, 34);
|
||||
select degreesToS2(90.0, 45.0);
|
||||
select degreesToS2(-12.0, 34.0);
|
||||
|
@ -1,4 +1,4 @@
|
||||
select radiansToS2(0.97353117, 0.65678451)
|
||||
select radiansToS2(0.97325215, 0.65729419)
|
||||
select radiansToS2(1.57079632, 0.78539816)
|
||||
select radiansToS2(-0.20943951, 0.59341194)
|
||||
select radiansToS2(0.97353117, 0.65678451);
|
||||
select radiansToS2(0.97325215, 0.65729419);
|
||||
select radiansToS2(1.57079632, 0.78539816);
|
||||
select radiansToS2(-0.20943951, 0.59341194);
|
||||
|
@ -1,2 +1,2 @@
|
||||
select S2ToGeo(4573520603753570041)
|
||||
select S2ToGeo(4573517609713934091)
|
||||
select S2ToGeo(4573520603753570041);
|
||||
select S2ToGeo(4573517609713934091);
|
||||
|
@ -0,0 +1 @@
|
||||
[5074766987100422144,5074766712222515200,5074767536856236032,5074767261978329088]
|
@ -1 +1 @@
|
||||
select S2GetNeigbors(5074766849661468672)
|
||||
select S2GetNeighbors(5074766849661468672);
|
||||
|
@ -1,2 +1,2 @@
|
||||
select S2CellsIntersect(9926595209846587392, 9926594385212866560)
|
||||
select S2CellsIntersect(9926595209846587392, 9937259648002293760)
|
||||
select S2CellsIntersect(9926595209846587392, 9926594385212866560);
|
||||
select S2CellsIntersect(9926595209846587392, 9937259648002293760);
|
||||
|
@ -1,2 +1,2 @@
|
||||
select S2CapContains(1157339245694594829, 1.0, 1157347770437378819)
|
||||
select S2CapContains(1157339245694594829, 1.0, 1152921504606846977)
|
||||
select S2CapContains(1157339245694594829, 1.0, 1157347770437378819);
|
||||
select S2CapContains(1157339245694594829, 1.0, 1152921504606846977);
|
||||
|
Loading…
Reference in New Issue
Block a user