2021-02-20 15:30:56 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
# shellcheck source=../shell_config.sh
|
|
|
|
. "$CURDIR"/../shell_config.sh
|
|
|
|
|
|
|
|
${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"
|
|
|
|
|
2021-02-26 12:25:28 +00:00
|
|
|
${CLICKHOUSE_CLIENT} -q "SELECT name, polygonPerimeterSpherical(p) from country_polygons"
|
2021-02-24 13:14:17 +00:00
|
|
|
${CLICKHOUSE_CLIENT} -q "SELECT '-------------------------------------'"
|
2021-02-26 12:25:28 +00:00
|
|
|
${CLICKHOUSE_CLIENT} -q "SELECT name, polygonAreaSpherical(p) from country_polygons"
|
2021-02-24 13:14:17 +00:00
|
|
|
${CLICKHOUSE_CLIENT} -q "SELECT '-------------------------------------'"
|
2021-02-20 15:30:56 +00:00
|
|
|
${CLICKHOUSE_CLIENT} -q "drop table if exists country_rings;"
|
2021-02-24 13:14:17 +00:00
|
|
|
|
|
|
|
|
2021-02-20 15:30:56 +00:00
|
|
|
${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"
|
2021-02-24 13:14:17 +00:00
|
|
|
|
2021-02-26 12:25:28 +00:00
|
|
|
${CLICKHOUSE_CLIENT} -q "SELECT name, polygonPerimeterSpherical(p) from country_rings"
|
2021-02-24 13:14:17 +00:00
|
|
|
${CLICKHOUSE_CLIENT} -q "SELECT '-------------------------------------'"
|
2021-02-26 12:25:28 +00:00
|
|
|
${CLICKHOUSE_CLIENT} -q "SELECT name, polygonAreaSpherical(p) from country_rings"
|
2021-02-24 13:14:17 +00:00
|
|
|
${CLICKHOUSE_CLIENT} -q "SELECT '-------------------------------------'"
|
2021-04-14 16:35:17 +00:00
|
|
|
${CLICKHOUSE_CLIENT} -q "drop table if exists country_rings;"
|
|
|
|
|
|
|
|
${CLICKHOUSE_CLIENT} -q "drop table country_polygons"
|