fix tests

This commit is contained in:
Nikita Mikhaylov 2021-07-07 15:27:57 +00:00
parent b92d47fcd0
commit 0be0fc810b
5 changed files with 21 additions and 23 deletions

View File

@ -52,11 +52,14 @@ public:
{
const auto * arg = arguments[index].get();
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());
if (index == 1)
{
if (!WhichDataType(arg).isFloat64())
throw Exception(
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
"Illegal type {} of argument {} of function {}. Must be Float64",
arg->getName(), 2, getName());
}
else if (!WhichDataType(arg).isUInt64()) {
throw Exception(
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,

View File

@ -80,10 +80,10 @@ public:
cell_id.GetEdgeNeighbors(neighbors);
dst_data.reserve(dst_data.size() + 4);
for (int i = 0; i < 4; ++i)
for (auto & neighbor : neighbors)
{
++current_offset;
dst_data.insert(neighbors[i].id());
dst_data.insert(neighbor.id());
}
dst_offsets[row] = current_offset;
}

View File

@ -68,7 +68,7 @@ public:
arg->getName(), 1, getName());
}
DataTypePtr element = std::make_shared<DataTypeUInt64>();
DataTypePtr element = std::make_shared<DataTypeFloat64>();
return std::make_shared<DataTypeTuple>(DataTypes{element, element});
}
@ -77,14 +77,14 @@ public:
{
const auto * col_id = arguments[0].column.get();
auto col_res_first = ColumnUInt32::create();
auto col_res_second = ColumnUInt32::create();
auto col_res_first = ColumnFloat64::create();
auto col_res_second = ColumnFloat64::create();
auto & vec_res_first = col_res_first->getData();
vec_res_first.resize(input_rows_count);
vec_res_first.reserve(input_rows_count);
auto & vec_res_second = col_res_second->getData();
vec_res_second.resize(input_rows_count);
vec_res_second.reserve(input_rows_count);
for (const auto row : collections::range(0, input_rows_count))
{
@ -94,8 +94,8 @@ public:
S2Point point = cell_id.ToPoint();
S2LatLng ll(point);
vec_res_first[row] = ll.lng().degrees();
vec_res_second[row] = ll.lat().degrees();
vec_res_first.emplace_back(ll.lng().degrees());
vec_res_second.emplace_back(ll.lat().degrees());
}
return ColumnTuple::create(Columns{std::move(col_res_first), std::move(col_res_second)});

View File

@ -75,12 +75,9 @@ public:
for (const auto row : collections::range(0, input_rows_count))
{
const double lon = col_lon->getFloat64(row);
double lat = col_lat->getFloat64(row);
const double lat = col_lat->getFloat64(row);
lat = lon;
S2LatLng lat_lng = S2LatLng::FromRadians(lat, lon);
S2CellId id(lat_lng);
S2CellId id(S2LatLng::FromRadians(lat, lon));
dst_data[row] = id.id();
}

View File

@ -1,4 +1,2 @@
(55.7792274, 37.6309808)
(55.7632410, 37.6601830)
(90.0000000, 45.0000000)
(34.0000000, -12.0000000)
(55.779227241803866,37.63098046233757)
(55.76324102676383,37.660183005258276)