mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-08 22:32:55 +00:00
* feat: add built-in functions h3 and geohash * tests: add sqlness tests for geo functions * doc: correct h3 comment * fix: lint error * fix: toml format * refactor: address review comments * test: add more sqlness cases * Apply suggestions from code review Co-authored-by: Ruihang Xia <waynestxia@gmail.com> --------- Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
193 lines
9.5 KiB
Plaintext
193 lines
9.5 KiB
Plaintext
SELECT h3(37.76938, -122.3889, 0);
|
|
|
|
+---------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),Int64(0)) |
|
|
+---------------------------------------------------+
|
|
| 8029fffffffffff |
|
|
+---------------------------------------------------+
|
|
|
|
SELECT h3(37.76938, -122.3889, 1);
|
|
|
|
+---------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),Int64(1)) |
|
|
+---------------------------------------------------+
|
|
| 81283ffffffffff |
|
|
+---------------------------------------------------+
|
|
|
|
SELECT h3(37.76938, -122.3889, 8);
|
|
|
|
+---------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),Int64(8)) |
|
|
+---------------------------------------------------+
|
|
| 88283082e7fffff |
|
|
+---------------------------------------------------+
|
|
|
|
SELECT h3(37.76938, -122.3889, 100);
|
|
|
|
Error: 3001(EngineExecuteQuery), H3 error: invalid resolution (got Some(100)): out of range
|
|
|
|
SELECT h3(37.76938, -122.3889, -1);
|
|
|
|
Error: 3001(EngineExecuteQuery), H3 error: invalid resolution (got Some(255)): out of range
|
|
|
|
SELECT h3(37.76938, -122.3889, 8::Int8);
|
|
|
|
+---------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),Int64(8)) |
|
|
+---------------------------------------------------+
|
|
| 88283082e7fffff |
|
|
+---------------------------------------------------+
|
|
|
|
SELECT h3(37.76938, -122.3889, 8::Int16);
|
|
|
|
+-----------------------------------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(8),Utf8("Int16"))) |
|
|
+-----------------------------------------------------------------------------+
|
|
| 88283082e7fffff |
|
|
+-----------------------------------------------------------------------------+
|
|
|
|
SELECT h3(37.76938, -122.3889, 8::Int32);
|
|
|
|
+-----------------------------------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(8),Utf8("Int32"))) |
|
|
+-----------------------------------------------------------------------------+
|
|
| 88283082e7fffff |
|
|
+-----------------------------------------------------------------------------+
|
|
|
|
SELECT h3(37.76938, -122.3889, 8::Int64);
|
|
|
|
+-----------------------------------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(8),Utf8("Int64"))) |
|
|
+-----------------------------------------------------------------------------+
|
|
| 88283082e7fffff |
|
|
+-----------------------------------------------------------------------------+
|
|
|
|
SELECT h3(37.76938, -122.3889, 8::UInt8);
|
|
|
|
+-----------------------------------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(8),Utf8("UInt8"))) |
|
|
+-----------------------------------------------------------------------------+
|
|
| 88283082e7fffff |
|
|
+-----------------------------------------------------------------------------+
|
|
|
|
SELECT h3(37.76938, -122.3889, 8::UInt16);
|
|
|
|
+------------------------------------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(8),Utf8("UInt16"))) |
|
|
+------------------------------------------------------------------------------+
|
|
| 88283082e7fffff |
|
|
+------------------------------------------------------------------------------+
|
|
|
|
SELECT h3(37.76938, -122.3889, 8::UInt32);
|
|
|
|
+------------------------------------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(8),Utf8("UInt32"))) |
|
|
+------------------------------------------------------------------------------+
|
|
| 88283082e7fffff |
|
|
+------------------------------------------------------------------------------+
|
|
|
|
SELECT h3(37.76938, -122.3889, 8::UInt64);
|
|
|
|
+------------------------------------------------------------------------------+
|
|
| h3(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(8),Utf8("UInt64"))) |
|
|
+------------------------------------------------------------------------------+
|
|
| 88283082e7fffff |
|
|
+------------------------------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 9);
|
|
|
|
+--------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),Int64(9)) |
|
|
+--------------------------------------------------------+
|
|
| 9q8yygxne |
|
|
+--------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 10);
|
|
|
|
+---------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),Int64(10)) |
|
|
+---------------------------------------------------------+
|
|
| 9q8yygxnef |
|
|
+---------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 11);
|
|
|
|
+---------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),Int64(11)) |
|
|
+---------------------------------------------------------+
|
|
| 9q8yygxneft |
|
|
+---------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 100);
|
|
|
|
Error: 3001(EngineExecuteQuery), Geohash error: Invalid length specified: 100. Accepted values are between 1 and 12, inclusive
|
|
|
|
SELECT geohash(37.76938, -122.3889, -1);
|
|
|
|
Error: 3001(EngineExecuteQuery), Geohash error: Invalid length specified: 18446744073709551615. Accepted values are between 1 and 12, inclusive
|
|
|
|
SELECT geohash(37.76938, -122.3889, 11::Int8);
|
|
|
|
+---------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),Int64(11)) |
|
|
+---------------------------------------------------------+
|
|
| 9q8yygxneft |
|
|
+---------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 11::Int16);
|
|
|
|
+-----------------------------------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(11),Utf8("Int16"))) |
|
|
+-----------------------------------------------------------------------------------+
|
|
| 9q8yygxneft |
|
|
+-----------------------------------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 11::Int32);
|
|
|
|
+-----------------------------------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(11),Utf8("Int32"))) |
|
|
+-----------------------------------------------------------------------------------+
|
|
| 9q8yygxneft |
|
|
+-----------------------------------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 11::Int64);
|
|
|
|
+-----------------------------------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(11),Utf8("Int64"))) |
|
|
+-----------------------------------------------------------------------------------+
|
|
| 9q8yygxneft |
|
|
+-----------------------------------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 11::UInt8);
|
|
|
|
+-----------------------------------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(11),Utf8("UInt8"))) |
|
|
+-----------------------------------------------------------------------------------+
|
|
| 9q8yygxneft |
|
|
+-----------------------------------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 11::UInt16);
|
|
|
|
+------------------------------------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(11),Utf8("UInt16"))) |
|
|
+------------------------------------------------------------------------------------+
|
|
| 9q8yygxneft |
|
|
+------------------------------------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 11::UInt32);
|
|
|
|
+------------------------------------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(11),Utf8("UInt32"))) |
|
|
+------------------------------------------------------------------------------------+
|
|
| 9q8yygxneft |
|
|
+------------------------------------------------------------------------------------+
|
|
|
|
SELECT geohash(37.76938, -122.3889, 11::UInt64);
|
|
|
|
+------------------------------------------------------------------------------------+
|
|
| geohash(Float64(37.76938),Float64(-122.3889),arrow_cast(Int64(11),Utf8("UInt64"))) |
|
|
+------------------------------------------------------------------------------------+
|
|
| 9q8yygxneft |
|
|
+------------------------------------------------------------------------------------+
|
|
|