h3ToGeo - fixes to code

This commit is contained in:
bharatnc 2021-06-02 13:20:08 -07:00
parent 1284a04a8b
commit cabd4144da
2 changed files with 5 additions and 13 deletions

View File

@ -24,8 +24,6 @@ namespace DB
namespace ErrorCodes
{
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
extern const int ILLEGAL_COLUMN;
}
namespace
@ -61,13 +59,7 @@ public:
{
const auto * col_index = arguments[0].column.get();
auto dst = ColumnVector<Float64>::create();
auto & dst_data = dst->getData();
dst_data.resize(input_rows_count);
ColumnPtr res_column;
auto latitude = ColumnFloat64::create(input_rows_count);
auto longitude = ColumnFloat64::create(input_rows_count);
@ -76,13 +68,13 @@ public:
for (const auto row : ext::range(0, input_rows_count))
{
const UInt64 h3Index = col_index->getUInt(row);
const UInt64 h3index = col_index->getUInt(row);
GeoCoord coord;
h3ToGeo(h3Index,&coord);
h3ToGeo(h3index,&coord);
lon_data[row] = radsToDegs(coord.lon);
lat_data[row] = radsToDegs(coord.lat);
}
MutableColumns result;
result.emplace_back(std::move(longitude));
result.emplace_back(std::move(latitude));

View File

@ -7,6 +7,6 @@ INSERT INTO h3_indexes VALUES(644325524701193975);
INSERT INTO h3_indexes VALUES(644325524701193976);
INSERT INTO h3_indexes VALUES(644325524701193977);
select h3ToGeo(h3_index) from h3_indexes;
select h3ToGeo(h3_index) from h3_indexes order by h3_index;
DROP TABLE h3_indexes;
DROP TABLE h3_indexes;