fix tests

This commit is contained in:
bharatnc 2022-01-23 06:20:31 -08:00
parent d91caa0d3f
commit 6faad9366b
4 changed files with 15 additions and 13 deletions

View File

@ -51,10 +51,10 @@ public:
arg->getName(), 1, getName());
arg = arguments[1].get();
if (!isUnsignedInteger(arg))
if (!WhichDataType(arg).isUInt16())
throw Exception(
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT,
"Illegal type {} of argument {} of function {}. Must be an unsigned integer",
"Illegal type {} of argument {} of function {}. Must be UInt16",
arg->getName(),
2,
getName());
@ -75,11 +75,12 @@ public:
const auto & data_hindex = col_hindex->getData();
const auto * col_k = checkAndGetColumn<ColumnUInt64>(arguments[1].column.get());
/// ColumnUInt16 is sufficient as the max value of 2nd arg is checked (arg > 0 < 10000) in implementation below
const auto * col_k = checkAndGetColumn<ColumnUInt16>(arguments[1].column.get());
if (!col_k)
throw Exception(
ErrorCodes::ILLEGAL_COLUMN,
"Illegal type {} of argument {} of function {}. Must be an unsigned integer.",
"Illegal type {} of argument {} of function {}. Must be UInt16.",
arguments[1].type->getName(),
2,
getName());

View File

@ -1,16 +1,17 @@
-- Tags: no-fasttest
SELECT arraySort(h3kRing(581276613233082367, 1));
SELECT h3kRing(581276613233082367, 0);
SELECT h3kRing(581276613233082367, -1); -- { serverError 12 }
SELECT arraySort(h3kRing(581276613233082367, toUInt16(1)));
SELECT h3kRing(581276613233082367, toUInt16(0));
SELECT h3kRing(581276613233082367, -1); -- { serverError 43 }
SELECT h3kRing(581276613233082367, toUInt16(-1)); -- { serverError 12 }
DROP TABLE IF EXISTS h3_indexes;
CREATE TABLE h3_indexes (h3_index UInt64, res UInt8) ENGINE = Memory;
-- Test h3 indices and k selected from original test fixture: https://github.com/uber/h3/blob/master/src/apps/testapps
CREATE TABLE h3_indexes (h3_index UInt64, k UInt16) ENGINE = Memory;
-- Random geo coordinates were generated using the H3 tool: https://github.com/ClickHouse-Extras/h3/blob/master/src/apps/testapps/mkRandGeo.c at various resolutions from 0 to 15.
-- Corresponding H3 index values were in turn generated with those geo coordinates using `geoToH3(lon, lat, res)` ClickHouse function for the following test.
INSERT INTO h3_indexes VALUES (579205133326352383,1);
INSERT INTO h3_indexes VALUES (581263419093549055,2);
@ -30,6 +31,6 @@ INSERT INTO h3_indexes VALUES (639763125756281263,15);
INSERT INTO h3_indexes VALUES (644178757620501158,16);
SELECT arraySort(h3kRing(h3_index, res)) FROM h3_indexes ORDER BY h3_index;
SELECT arraySort(h3kRing(h3_index, k)) FROM h3_indexes ORDER BY h3_index;
DROP TABLE h3_indexes;

View File

@ -1,6 +1,6 @@
-- Tags: no-fasttest
SELECT h3kRing(581276613233082367, 65535); -- { serverError 12 }
SELECT h3kRing(581276613233082367, -1); -- { serverError 12 }
SELECT h3kRing(581276613233082367, -1); -- { serverError 43 }
SELECT length(h3kRing(111111111111, 1000));
SELECT h3kRing(581276613233082367, nan); -- { serverError 43 }

View File

@ -8,5 +8,5 @@ SELECT h3kRing(0xFFFFFFFFF, 1000) FORMAT Null;
SELECT h3kRing(0xFFFFFFFFFFFFFF, 1000) FORMAT Null;
SELECT h3GetBaseCell(0xFFFFFFFFFFFFFF) FORMAT Null;
SELECT h3GetResolution(0xFFFFFFFFFFFFFF) FORMAT Null;
SELECT h3kRing(0xFFFFFFFFFFFFFF, 10) FORMAT Null;
SELECT h3kRing(0xFFFFFFFFFFFFFF, toUInt16(10)) FORMAT Null;
SELECT h3ToGeo(0xFFFFFFFFFFFFFF) FORMAT Null;