Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacbrodsky committed Dec 9, 2024
1 parent 965bb73 commit 179c35c
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/h3_regions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ static void PolygonWktToCellsExperimentalFunction(DataChunk &args, ExpressionSta
flags = 1;
} else if (flagsStr == "CONTAINMENT_OVERLAPPING") {
flags = 2;
} else if (flagsStr == "CONTAINMENT_OVERLAPPING_BBOX") {
flags = 3;
} else {
// Invalid flags input
return list_entry_t(offset, 0);
Expand Down Expand Up @@ -477,6 +479,8 @@ static void PolygonWktToCellsExperimentalVarcharFunction(DataChunk &args,
flags = 1;
} else if (flagsStr == "CONTAINMENT_OVERLAPPING") {
flags = 2;
} else if (flagsStr == "CONTAINMENT_OVERLAPPING_BBOX") {
flags = 3;
} else {
// Invalid flags input
return list_entry_t(offset, 0);
Expand Down
105 changes: 105 additions & 0 deletions test/sql/h3/h3_functions_regions.test
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,108 @@ query I
select h3_polygon_wkt_to_cells_string('POLYGON EMPTY', 9);
----
[]

query I
select length(h3_polygon_wkt_to_cells_experimental('POLYGON', 'CONTAINMENT_CENTER', 9));
----
0

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'AAA', 9);
----
[]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_CENTER', 5)
----
[]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_FULL', 5)
----
[]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_OVERLAPPING', 5)
----
[599685771850416127, 599685772924157951, 599685776145383423, 599685777219125247]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_OVERLAPPING_BBOX', 5)
----
[]

query I
select h3_polygon_wkt_to_cells_experimental_string('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_CENTER', 5)
----
[]

query I
select h3_polygon_wkt_to_cells_experimental_string('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_FULL', 5)
----
[]

query I
select h3_polygon_wkt_to_cells_experimental_string('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_OVERLAPPING', 5)
----
[85283083fffffff, 85283087fffffff, 85283093fffffff, 85283097fffffff]

query I
select h3_polygon_wkt_to_cells_experimental_string('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_OVERLAPPING_BBOX', 5)
----
[]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_FULL', 5)
----
[]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_OVERLAPPING', 5)
----
[599685771850416127, 599685772924157951, 599685776145383423, 599685777219125247]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_OVERLAPPING_BBOX', 5)
----
[]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_CENTER', 6)
----
[604189371075133439, 604189371209351167, 604189372417310719, 604189376175407103, 604189376309624831]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_FULL', 6)
----
[604189371209351167, 604189376309624831]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_OVERLAPPING', 6)
----
[604189370538262527, 604189370672480255, 604189371075133439, 604189371209351167, 604189372148875263, 604189372417310719, 604189374967447551, 604189375235883007, 604189375906971647, 604189376041189375, 604189376175407103, 604189376309624831]

query I
select h3_polygon_wkt_to_cells_experimental('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_OVERLAPPING_BBOX', 6)
----
[]

query I
select h3_polygon_wkt_to_cells_experimental_string('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_CENTER', 6)
----
[862830827ffffff, 86283082fffffff, 862830877ffffff, 862830957ffffff, 86283095fffffff]

query I
select h3_polygon_wkt_to_cells_experimental_string('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_FULL', 6)
----
[86283082fffffff, 86283095fffffff]

query I
select h3_polygon_wkt_to_cells_experimental_string('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_OVERLAPPING', 6)
----
[862830807ffffff, 86283080fffffff, 862830827ffffff, 86283082fffffff, 862830867ffffff, 862830877ffffff, 86283090fffffff, 86283091fffffff, 862830947ffffff, 86283094fffffff, 862830957ffffff, 86283095fffffff]

query I
select h3_polygon_wkt_to_cells_experimental_string('POLYGON ((-122.53401215374411 37.81666158907579, -122.53401215374411 37.70454536656959, -122.3479361380842 37.70454536656959, -122.3479361380842 37.81666158907579, -122.53401215374411 37.81666158907579))', 'CONTAINMENT_OVERLAPPING_BBOX', 6)
----
[]

0 comments on commit 179c35c

Please sign in to comment.