From 0e1b2d8fcffaf856c15551d960da60111c0b9f2e Mon Sep 17 00:00:00 2001 From: Nikita Mikhailov Date: Fri, 26 Feb 2021 15:25:28 +0300 Subject: [PATCH] geographic -> spherical --- src/Functions/geometryConverters.cpp | 14 +++++------ src/Functions/geometryConverters.h | 24 +++++++++---------- src/Functions/greatCircleDistance.cpp | 2 +- src/Functions/polygonArea.cpp | 4 ++-- src/Functions/polygonPerimeter.cpp | 4 ++-- src/Functions/polygonsDistance.cpp | 4 ++-- src/Functions/polygonsIntersection.cpp | 4 ++-- src/Functions/polygonsSymDifference.cpp | 4 ++-- src/Functions/polygonsUnion.cpp | 4 ++-- src/Functions/polygonsWithin.cpp | 4 ++-- src/Functions/tests/gtest_geometry.cpp | 20 ---------------- .../0_stateless/01301_polygons_within.sql | 4 ++-- .../0_stateless/01302_polygons_distance.sql | 4 ++-- .../0_stateless/01305_polygons_union.sql | 2 +- .../01306_polygons_intersection.sql | 4 ++-- .../0_stateless/01308_polygon_area.sql | 2 +- .../0_stateless/01720_country_intersection.sh | 4 ++-- .../01720_country_perimeter_and_area.sh | 8 +++---- 18 files changed, 48 insertions(+), 68 deletions(-) delete mode 100644 src/Functions/tests/gtest_geometry.cpp diff --git a/src/Functions/geometryConverters.cpp b/src/Functions/geometryConverters.cpp index b0b437d5332..ea6d99787ef 100644 --- a/src/Functions/geometryConverters.cpp +++ b/src/Functions/geometryConverters.cpp @@ -102,13 +102,13 @@ std::vector> MultiPolygonFromColumnConverter::convert template class PointFromColumnConverter; -template class PointFromColumnConverter; +template class PointFromColumnConverter; template class RingFromColumnConverter; -template class RingFromColumnConverter; +template class RingFromColumnConverter; template class PolygonFromColumnConverter; -template class PolygonFromColumnConverter; +template class PolygonFromColumnConverter; template class MultiPolygonFromColumnConverter; -template class MultiPolygonFromColumnConverter; +template class MultiPolygonFromColumnConverter; template typename Desired> void checkColumnTypeOrThrow(const ColumnWithTypeAndName & column) @@ -130,8 +130,8 @@ void checkColumnTypeOrThrow(const ColumnWithTypeAndName & column) template void checkColumnTypeOrThrow(const ColumnWithTypeAndName &); template void checkColumnTypeOrThrow(const ColumnWithTypeAndName &); template void checkColumnTypeOrThrow(const ColumnWithTypeAndName &); -template void checkColumnTypeOrThrow(const ColumnWithTypeAndName &); -template void checkColumnTypeOrThrow(const ColumnWithTypeAndName &); -template void checkColumnTypeOrThrow(const ColumnWithTypeAndName &); +template void checkColumnTypeOrThrow(const ColumnWithTypeAndName &); +template void checkColumnTypeOrThrow(const ColumnWithTypeAndName &); +template void checkColumnTypeOrThrow(const ColumnWithTypeAndName &); } diff --git a/src/Functions/geometryConverters.h b/src/Functions/geometryConverters.h index b591a5b967f..fcce11467d0 100644 --- a/src/Functions/geometryConverters.h +++ b/src/Functions/geometryConverters.h @@ -51,12 +51,12 @@ using CartesianPolygon = Polygon; using CartesianMultiPolygon = MultiPolygon; using CartesianGeometry = Geometry; -// using GeographicPoint = boost::geometry::model::point>; -using GeographicPoint = boost::geometry::model::point>; -using GeographicRing = Ring; -using GeographicPolygon = Polygon; -using GeographicMultiPolygon = MultiPolygon; -using GeographicGeometry = Geometry; +// using SphericalPoint = boost::geometry::model::point>; +using SphericalPoint = boost::geometry::model::point>; +using SphericalRing = Ring; +using SphericalPolygon = Polygon; +using SphericalMultiPolygon = MultiPolygon; +using SphericalGeometry = Geometry; template @@ -70,7 +70,7 @@ class MultiPolygonFromColumnConverter; /** * Class which takes some boost type and returns a pair of numbers. - * They are (x,y) in case of cartesian coordinated and (lon,lat) in case of geographic. + * They are (x,y) in case of cartesian coordinated and (lon,lat) in case of Spherical. */ template class PointFromColumnConverter @@ -151,16 +151,16 @@ private: extern template class PointFromColumnConverter; -extern template class PointFromColumnConverter; +extern template class PointFromColumnConverter; extern template class RingFromColumnConverter; -extern template class RingFromColumnConverter; +extern template class RingFromColumnConverter; extern template class PolygonFromColumnConverter; -extern template class PolygonFromColumnConverter; +extern template class PolygonFromColumnConverter; extern template class MultiPolygonFromColumnConverter; -extern template class MultiPolygonFromColumnConverter; +extern template class MultiPolygonFromColumnConverter; -/// To serialize Geographic or Cartesian point (a pair of numbers in both cases). +/// To serialize Spherical or Cartesian point (a pair of numbers in both cases). template class PointSerializer { diff --git a/src/Functions/greatCircleDistance.cpp b/src/Functions/greatCircleDistance.cpp index 801f8b3da7f..70f6d1f1759 100644 --- a/src/Functions/greatCircleDistance.cpp +++ b/src/Functions/greatCircleDistance.cpp @@ -19,7 +19,7 @@ namespace ErrorCodes extern const int ILLEGAL_TYPE_OF_ARGUMENT; } -/** Calculates the distance between two geographical locations. +/** Calculates the distance between two Sphericalal locations. * There are three variants: * greatCircleAngle: calculates the distance on a sphere in degrees: https://en.wikipedia.org/wiki/Great-circle_distance * greatCircleDistance: calculates the distance on a sphere in meters. diff --git a/src/Functions/polygonArea.cpp b/src/Functions/polygonArea.cpp index 6cc9dd04b69..4291d31d72a 100644 --- a/src/Functions/polygonArea.cpp +++ b/src/Functions/polygonArea.cpp @@ -118,13 +118,13 @@ template <> const char * FunctionPolygonArea::name = "polygonAreaCartesian"; template <> -const char * FunctionPolygonArea::name = "polygonAreaGeographic"; +const char * FunctionPolygonArea::name = "polygonAreaSpherical"; void registerFunctionPolygonArea(FunctionFactory & factory) { factory.registerFunction>(); - factory.registerFunction>(); + factory.registerFunction>(); } diff --git a/src/Functions/polygonPerimeter.cpp b/src/Functions/polygonPerimeter.cpp index fef0777ab52..9bad13d4817 100644 --- a/src/Functions/polygonPerimeter.cpp +++ b/src/Functions/polygonPerimeter.cpp @@ -95,13 +95,13 @@ template <> const char * FunctionPolygonPerimeter::name = "polygonPerimeterCartesian"; template <> -const char * FunctionPolygonPerimeter::name = "polygonPerimeterGeographic"; +const char * FunctionPolygonPerimeter::name = "polygonPerimeterSpherical"; void registerFunctionPolygonPerimeter(FunctionFactory & factory) { factory.registerFunction>(); - factory.registerFunction>(); + factory.registerFunction>(); } diff --git a/src/Functions/polygonsDistance.cpp b/src/Functions/polygonsDistance.cpp index 72b1d5bc888..f961867caae 100644 --- a/src/Functions/polygonsDistance.cpp +++ b/src/Functions/polygonsDistance.cpp @@ -104,13 +104,13 @@ template <> const char * FunctionPolygonsDistance::name = "polygonsDistanceCartesian"; template <> -const char * FunctionPolygonsDistance::name = "polygonsDistanceGeographic"; +const char * FunctionPolygonsDistance::name = "polygonsDistanceSpherical"; void registerFunctionPolygonsDistance(FunctionFactory & factory) { factory.registerFunction>(); - factory.registerFunction>(); + factory.registerFunction>(); } diff --git a/src/Functions/polygonsIntersection.cpp b/src/Functions/polygonsIntersection.cpp index 331215e73e1..0f7a9b1f264 100644 --- a/src/Functions/polygonsIntersection.cpp +++ b/src/Functions/polygonsIntersection.cpp @@ -110,13 +110,13 @@ template <> const char * FunctionPolygonsIntersection::name = "polygonsIntersectionCartesian"; template <> -const char * FunctionPolygonsIntersection::name = "polygonsIntersectionGeographic"; +const char * FunctionPolygonsIntersection::name = "polygonsIntersectionSpherical"; void registerFunctionPolygonsIntersection(FunctionFactory & factory) { factory.registerFunction>(); - factory.registerFunction>(); + factory.registerFunction>(); } } diff --git a/src/Functions/polygonsSymDifference.cpp b/src/Functions/polygonsSymDifference.cpp index b1207582e8b..4768ea93124 100644 --- a/src/Functions/polygonsSymDifference.cpp +++ b/src/Functions/polygonsSymDifference.cpp @@ -105,12 +105,12 @@ template <> const char * FunctionPolygonsSymDifference::name = "polygonsSymDifferenceCartesian"; template <> -const char * FunctionPolygonsSymDifference::name = "polygonsSymDifferenceGeographic"; +const char * FunctionPolygonsSymDifference::name = "polygonsSymDifferenceSpherical"; void registerFunctionPolygonsSymDifference(FunctionFactory & factory) { factory.registerFunction>(); - factory.registerFunction>(); + factory.registerFunction>(); } } diff --git a/src/Functions/polygonsUnion.cpp b/src/Functions/polygonsUnion.cpp index bd761c847b0..d4d67982ee0 100644 --- a/src/Functions/polygonsUnion.cpp +++ b/src/Functions/polygonsUnion.cpp @@ -108,13 +108,13 @@ template <> const char * FunctionPolygonsUnion::name = "polygonsUnionCartesian"; template <> -const char * FunctionPolygonsUnion::name = "polygonsUnionGeographic"; +const char * FunctionPolygonsUnion::name = "polygonsUnionSpherical"; void registerFunctionPolygonsUnion(FunctionFactory & factory) { factory.registerFunction>(); - factory.registerFunction>(); + factory.registerFunction>(); } } diff --git a/src/Functions/polygonsWithin.cpp b/src/Functions/polygonsWithin.cpp index 708ddeee547..eabd5e683b9 100644 --- a/src/Functions/polygonsWithin.cpp +++ b/src/Functions/polygonsWithin.cpp @@ -107,13 +107,13 @@ template <> const char * FunctionPolygonsWithin::name = "polygonsWithinCartesian"; template <> -const char * FunctionPolygonsWithin::name = "polygonsWithinGeographic"; +const char * FunctionPolygonsWithin::name = "polygonsWithinSpherical"; void registerFunctionPolygonsWithin(FunctionFactory & factory) { factory.registerFunction>(); - factory.registerFunction>(); + factory.registerFunction>(); } } diff --git a/src/Functions/tests/gtest_geometry.cpp b/src/Functions/tests/gtest_geometry.cpp deleted file mode 100644 index 9b57eb5449e..00000000000 --- a/src/Functions/tests/gtest_geometry.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include - -#include -#include - -#include -#include -#include - -namespace bg = boost::geometry; - -TEST(Geometry, Area) -{ - - DB::GeographicPolygon sph_poly; - bg::read_wkt("POLYGON ((33.905868 35.090882, 33.913619 35.090882, 33.921474 35.080702, 33.914446 35.073054, 33.908245 35.070729, 33.906524 35.069122, 33.906506 35.069105, 33.898116 35.061272, 33.880133 35.073054, 33.874655 35.067525, 33.867627 35.060497, 33.855122 35.053417, 33.841169 35.051092, 33.834865 35.056621, 33.827113 35.061272, 33.813781 35.055794, 33.804375 35.049541, 33.799001 35.038534, 33.822359 35.030059, 33.830214 35.023031, 33.829387 35.001176, 33.829387 35.001172, 33.840342 34.993369, 33.859049 34.991819, 33.859049 34.974662, 33.850471 34.973009, 33.838068 34.963707, 33.84582 34.959728, 33.864423 34.962983, 33.891841 34.958139, 33.8838 34.949123, 33.874522 34.94123, 33.862315 34.937893, 33.847423 34.94245, 33.819672 34.964748, 33.80421 34.972602, 33.781896 34.976212, 33.784945 34.976212, 33.788046 34.976988, 33.7928 34.977763, 33.79435 34.977763, 33.791146 34.982414, 33.786495 34.984687, 33.782568 34.984687, 33.777917 34.984687, 33.77399 34.988666, 33.766135 34.990268, 33.761484 34.990268, 33.75921 34.988666, 33.765411 34.985566, 33.769339 34.983964, 33.770889 34.980088, 33.77554 34.980088, 33.780191 34.979313, 33.780986 34.976338, 33.780935 34.976345, 33.760427 34.979682, 33.717296 34.977769, 33.70152 34.97289, 33.702935 34.987943, 33.711461 34.985566, 33.71544 34.997296, 33.699731 35.002722, 33.69663 35.008975, 33.705312 35.015228, 33.702211 35.022256, 33.685003 35.029284, 33.679444 35.033891, 33.679435 35.033899, 33.675649 35.037036, 33.674099 35.046441, 33.678853 35.055794, 33.69446 35.058171, 33.705312 35.06675, 33.714717 35.06675, 33.719368 35.06277, 33.711461 35.040963, 33.707585 35.029284, 33.718489 35.032385, 33.739677 35.047216, 33.766135 35.03161, 33.77554 35.040188, 33.786495 35.038534, 33.79435 35.040188, 33.798278 35.052642, 33.824012 35.06675, 33.834865 35.063597, 33.842719 35.056621, 33.853571 35.058171, 33.866904 35.06675, 33.871555 35.073054, 33.876929 35.076826, 33.871555 35.085456, 33.871555 35.100236, 33.876206 35.118994, 33.889435 35.118994, 33.891812 35.110468, 33.89884 35.108814, 33.903594 35.099512, 33.905868 35.09636, 33.905868 35.090882), (33.742792 35.001233, 33.746689 35.002711, 33.752063 35.004323, 33.752063 35.0144, 33.746151 35.015207, 33.741314 35.013729, 33.740239 35.010101, 33.738761 35.005264, 33.739702 35.002576, 33.742792 35.001233))", sph_poly); - auto area = bg::area(sph_poly); - std::cout << std::setprecision (15) << area << std::endl; - ASSERT_TRUE(std::abs(area - 127533079.61976177) < 1e-4); -} diff --git a/tests/queries/0_stateless/01301_polygons_within.sql b/tests/queries/0_stateless/01301_polygons_within.sql index 5bfa586da79..97e0573904a 100644 --- a/tests/queries/0_stateless/01301_polygons_within.sql +++ b/tests/queries/0_stateless/01301_polygons_within.sql @@ -1,7 +1,7 @@ select polygonsWithinCartesian([[[(0, 0),(0, 3),(1, 2.9),(2, 2.6),(2.6, 2),(2.9, 1),(3, 0),(0, 0)]]], [[[(1., 1.),(1., 4.),(4., 4.),(4., 1.),(1., 1.)]]]); select polygonsWithinCartesian([[[(2., 2.), (2., 3.), (3., 3.), (3., 2.)]]], [[[(1., 1.),(1., 4.),(4., 4.),(4., 1.),(1., 1.)]]]); -select polygonsWithinGeographic([[[(4.3613577, 50.8651821), (4.349556, 50.8535879), (4.3602419, 50.8435626), (4.3830299, 50.8428851), (4.3904543, 50.8564867), (4.3613148, 50.8651279)]]], [[[(4.346693, 50.858306), (4.367945, 50.852455), (4.366227, 50.840809), (4.344961, 50.833264), (4.338074, 50.848677), (4.346693, 50.858306)]]]); -select polygonsWithinGeographic([[[(4.3501568, 50.8518269), (4.3444920, 50.8439961), (4.3565941, 50.8443213), (4.3501568, 50.8518269)]]], [[[(4.3679450, 50.8524550),(4.3466930, 50.8583060),(4.3380740, 50.8486770),(4.3449610, 50.8332640),(4.3662270, 50.8408090),(4.3679450, 50.8524550)]]]); +select polygonsWithinSpherical([[[(4.3613577, 50.8651821), (4.349556, 50.8535879), (4.3602419, 50.8435626), (4.3830299, 50.8428851), (4.3904543, 50.8564867), (4.3613148, 50.8651279)]]], [[[(4.346693, 50.858306), (4.367945, 50.852455), (4.366227, 50.840809), (4.344961, 50.833264), (4.338074, 50.848677), (4.346693, 50.858306)]]]); +select polygonsWithinSpherical([[[(4.3501568, 50.8518269), (4.3444920, 50.8439961), (4.3565941, 50.8443213), (4.3501568, 50.8518269)]]], [[[(4.3679450, 50.8524550),(4.3466930, 50.8583060),(4.3380740, 50.8486770),(4.3449610, 50.8332640),(4.3662270, 50.8408090),(4.3679450, 50.8524550)]]]); diff --git a/tests/queries/0_stateless/01302_polygons_distance.sql b/tests/queries/0_stateless/01302_polygons_distance.sql index 0051578ea7c..fdbd0254983 100644 --- a/tests/queries/0_stateless/01302_polygons_distance.sql +++ b/tests/queries/0_stateless/01302_polygons_distance.sql @@ -1,8 +1,8 @@ select polygonsDistanceCartesian([[[(0, 0),(0, 3),(1, 2.9),(2, 2.6),(2.6, 2),(2.9, 1),(3, 0),(0, 0)]]], [[[(1., 1.),(1., 4.),(4., 4.),(4., 1.),(1., 1.)]]]); select polygonsDistanceCartesian([[[(0, 0), (0, 0.1), (0.1, 0.1), (0.1, 0)]]], [[[(1., 1.),(1., 4.),(4., 4.),(4., 1.),(1., 1.)]]]); -select polygonsDistanceGeographic([[[(23.725750, 37.971536)]]], [[[(4.3826169, 50.8119483)]]]); +select polygonsDistanceSpherical([[[(23.725750, 37.971536)]]], [[[(4.3826169, 50.8119483)]]]); drop table if exists polygon_01302; create table polygon_01302 (x Array(Array(Array(Tuple(Float64, Float64)))), y Array(Array(Array(Tuple(Float64, Float64))))) engine=Memory(); insert into polygon_01302 values ([[[(23.725750, 37.971536)]]], [[[(4.3826169, 50.8119483)]]]); -select polygonsDistanceGeographic(x, y) from polygon_01302; +select polygonsDistanceSpherical(x, y) from polygon_01302; diff --git a/tests/queries/0_stateless/01305_polygons_union.sql b/tests/queries/0_stateless/01305_polygons_union.sql index c96c9f7360c..a67c5a7d399 100644 --- a/tests/queries/0_stateless/01305_polygons_union.sql +++ b/tests/queries/0_stateless/01305_polygons_union.sql @@ -2,4 +2,4 @@ select polygonsUnionCartesian([[[(0., 0.),(0., 3.),(1., 2.9),(2., 2.6),(2.6, 2.) SELECT polygonsUnionCartesian([[[(2., 100.0000991821289), (0., 3.), (1., 2.9), (2., 2.6), (2.6, 2.), (2.9, 1), (3., 0.), (100.0000991821289, 2.)]]], [[[(1., 1.), (1000.0001220703125, nan), (4., 4.), (4., 1.), (1., 1.)]]]); -- { serverError 43 } -select polygonsUnionGeographic([[[(4.3613577, 50.8651821), (4.349556, 50.8535879), (4.3602419, 50.8435626), (4.3830299, 50.8428851), (4.3904543, 50.8564867), (4.3613148, 50.8651279)]]], [[[(4.346693, 50.858306), (4.367945, 50.852455), (4.366227, 50.840809), (4.344961, 50.833264), (4.338074, 50.848677), (4.346693, 50.858306)]]]); +select polygonsUnionSpherical([[[(4.3613577, 50.8651821), (4.349556, 50.8535879), (4.3602419, 50.8435626), (4.3830299, 50.8428851), (4.3904543, 50.8564867), (4.3613148, 50.8651279)]]], [[[(4.346693, 50.858306), (4.367945, 50.852455), (4.366227, 50.840809), (4.344961, 50.833264), (4.338074, 50.848677), (4.346693, 50.858306)]]]); diff --git a/tests/queries/0_stateless/01306_polygons_intersection.sql b/tests/queries/0_stateless/01306_polygons_intersection.sql index 15962c43648..fa486a138f4 100644 --- a/tests/queries/0_stateless/01306_polygons_intersection.sql +++ b/tests/queries/0_stateless/01306_polygons_intersection.sql @@ -1,5 +1,5 @@ select polygonsIntersectionCartesian([[[(0., 0.),(0., 3.),(1., 2.9),(2., 2.6),(2.6, 2.),(2.9, 1.),(3., 0.),(0., 0.)]]], [[[(1., 1.),(1., 4.),(4., 4.),(4., 1.),(1., 1.)]]]); select polygonsIntersectionCartesian([[[(0., 0.),(0., 3.),(1., 2.9),(2., 2.6),(2.6, 2.),(2.9, 1.),(3., 0.),(0., 0.)]]], [[[(3., 3.),(3., 4.),(4., 4.),(4., 3.),(3., 3.)]]]); -select polygonsIntersectionGeographic([[[(4.346693, 50.858306), (4.367945, 50.852455), (4.366227, 50.840809), (4.344961, 50.833264), (4.338074, 50.848677), (4.346693, 50.858306)]]], [[[(25.0010, 136.9987), (17.7500, 142.5000), (11.3733, 142.5917)]]]); -select polygonsIntersectionGeographic([[[(4.3613577, 50.8651821), (4.349556, 50.8535879), (4.3602419, 50.8435626), (4.3830299, 50.8428851), (4.3904543, 50.8564867), (4.3613148, 50.8651279)]]], [[[(4.346693, 50.858306), (4.367945, 50.852455), (4.366227, 50.840809), (4.344961, 50.833264), (4.338074, 50.848677), (4.346693, 50.858306)]]]); \ No newline at end of file +select polygonsIntersectionSpherical([[[(4.346693, 50.858306), (4.367945, 50.852455), (4.366227, 50.840809), (4.344961, 50.833264), (4.338074, 50.848677), (4.346693, 50.858306)]]], [[[(25.0010, 136.9987), (17.7500, 142.5000), (11.3733, 142.5917)]]]); +select polygonsIntersectionSpherical([[[(4.3613577, 50.8651821), (4.349556, 50.8535879), (4.3602419, 50.8435626), (4.3830299, 50.8428851), (4.3904543, 50.8564867), (4.3613148, 50.8651279)]]], [[[(4.346693, 50.858306), (4.367945, 50.852455), (4.366227, 50.840809), (4.344961, 50.833264), (4.338074, 50.848677), (4.346693, 50.858306)]]]); \ No newline at end of file diff --git a/tests/queries/0_stateless/01308_polygon_area.sql b/tests/queries/0_stateless/01308_polygon_area.sql index 03f87874139..4f02928b450 100644 --- a/tests/queries/0_stateless/01308_polygon_area.sql +++ b/tests/queries/0_stateless/01308_polygon_area.sql @@ -1,3 +1,3 @@ select polygonAreaCartesian([[[(0., 0.), (0., 5.), (5., 5.), (5., 0.)]]]); -select polygonAreaGeographic([[[(4.346693, 50.858306), (4.367945, 50.852455), (4.366227, 50.840809), (4.344961, 50.833264), (4.338074, 50.848677), (4.346693, 50.858306)]]]); +select polygonAreaSpherical([[[(4.346693, 50.858306), (4.367945, 50.852455), (4.366227, 50.840809), (4.344961, 50.833264), (4.338074, 50.848677), (4.346693, 50.858306)]]]); SELECT polygonAreaCartesian([]); -- { serverError 36 } \ No newline at end of file diff --git a/tests/queries/0_stateless/01720_country_intersection.sh b/tests/queries/0_stateless/01720_country_intersection.sh index 13efe97becf..77418ef0582 100755 --- a/tests/queries/0_stateless/01720_country_intersection.sh +++ b/tests/queries/0_stateless/01720_country_intersection.sh @@ -7,12 +7,12 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) ${CLICKHOUSE_CLIENT} -q "drop table if exists country_polygons;" ${CLICKHOUSE_CLIENT} -q "create table country_polygons(name String, p Array(Array(Tuple(Float64, Float64)))) engine=MergeTree() order by tuple();" cat ${CURDIR}/country_polygons.tsv | ${CLICKHOUSE_CLIENT} -q "insert into country_polygons format TSV" -${CLICKHOUSE_CLIENT} -q "SELECT c, d, polygonsIntersectionGeographic(a, b) FROM (SELECT first.p AS a, second.p AS b, first.name AS c, second.name AS d FROM country_polygons AS first CROSS JOIN country_polygons AS second LIMIT 100) format TSV" +${CLICKHOUSE_CLIENT} -q "SELECT c, d, polygonsIntersectionSpherical(a, b) FROM (SELECT first.p AS a, second.p AS b, first.name AS c, second.name AS d FROM country_polygons AS first CROSS JOIN country_polygons AS second LIMIT 100) format TSV" ${CLICKHOUSE_CLIENT} -q "drop table if exists country_polygons;" ${CLICKHOUSE_CLIENT} -q "drop table if exists country_rings;" ${CLICKHOUSE_CLIENT} -q "create table country_rings(name String, p Array(Tuple(Float64, Float64))) engine=MergeTree() order by tuple();" cat ${CURDIR}/country_rings.tsv | ${CLICKHOUSE_CLIENT} -q "insert into country_rings format TSV" -${CLICKHOUSE_CLIENT} -q "SELECT c, d, polygonsIntersectionGeographic(a, b) FROM (SELECT first.p AS a, second.p AS b, first.name AS c, second.name AS d FROM country_rings AS first CROSS JOIN country_rings AS second LIMIT 100) format TSV" +${CLICKHOUSE_CLIENT} -q "SELECT c, d, polygonsIntersectionSpherical(a, b) FROM (SELECT first.p AS a, second.p AS b, first.name AS c, second.name AS d FROM country_rings AS first CROSS JOIN country_rings AS second LIMIT 100) format TSV" ${CLICKHOUSE_CLIENT} -q "drop table if exists country_rings;" \ No newline at end of file diff --git a/tests/queries/0_stateless/01720_country_perimeter_and_area.sh b/tests/queries/0_stateless/01720_country_perimeter_and_area.sh index a9a1e42ebf2..76dc403fb2f 100755 --- a/tests/queries/0_stateless/01720_country_perimeter_and_area.sh +++ b/tests/queries/0_stateless/01720_country_perimeter_and_area.sh @@ -8,9 +8,9 @@ ${CLICKHOUSE_CLIENT} -q "drop table if exists country_polygons;" ${CLICKHOUSE_CLIENT} -q "create table country_polygons(name String, p Array(Array(Tuple(Float64, Float64)))) engine=MergeTree() order by tuple();" cat ${CURDIR}/country_polygons.tsv | ${CLICKHOUSE_CLIENT} -q "insert into country_polygons format TSV" -${CLICKHOUSE_CLIENT} -q "SELECT name, polygonPerimeterGeographic(p) from country_polygons" +${CLICKHOUSE_CLIENT} -q "SELECT name, polygonPerimeterSpherical(p) from country_polygons" ${CLICKHOUSE_CLIENT} -q "SELECT '-------------------------------------'" -${CLICKHOUSE_CLIENT} -q "SELECT name, polygonAreaGeographic(p) from country_polygons" +${CLICKHOUSE_CLIENT} -q "SELECT name, polygonAreaSpherical(p) from country_polygons" ${CLICKHOUSE_CLIENT} -q "SELECT '-------------------------------------'" ${CLICKHOUSE_CLIENT} -q "drop table if exists country_rings;" @@ -18,8 +18,8 @@ ${CLICKHOUSE_CLIENT} -q "drop table if exists country_rings;" ${CLICKHOUSE_CLIENT} -q "create table country_rings(name String, p Array(Tuple(Float64, Float64))) engine=MergeTree() order by tuple();" cat ${CURDIR}/country_rings.tsv | ${CLICKHOUSE_CLIENT} -q "insert into country_rings format TSV" -${CLICKHOUSE_CLIENT} -q "SELECT name, polygonPerimeterGeographic(p) from country_rings" +${CLICKHOUSE_CLIENT} -q "SELECT name, polygonPerimeterSpherical(p) from country_rings" ${CLICKHOUSE_CLIENT} -q "SELECT '-------------------------------------'" -${CLICKHOUSE_CLIENT} -q "SELECT name, polygonAreaGeographic(p) from country_rings" +${CLICKHOUSE_CLIENT} -q "SELECT name, polygonAreaSpherical(p) from country_rings" ${CLICKHOUSE_CLIENT} -q "SELECT '-------------------------------------'" ${CLICKHOUSE_CLIENT} -q "drop table if exists country_rings;" \ No newline at end of file