[CP][FEAT MERGE]SDO_GEOMETRY & MYSQL GIS EXPR IMPLEMENT
This commit is contained in:
@ -62,11 +62,13 @@ ob_unittest(test_geo_bin)
|
||||
ob_unittest(test_s2adapter)
|
||||
ob_unittest(test_geo_common)
|
||||
ob_unittest(test_wkt_parser)
|
||||
ob_unittest(test_geo_3d)
|
||||
ob_unittest(test_geo_tree)
|
||||
ob_unittest(test_geo_srs)
|
||||
ob_unittest(test_geo_srs_parser)
|
||||
ob_unittest(test_geo_func_difference)
|
||||
ob_unittest(test_geo_func_union)
|
||||
ob_unittest(test_geo_func_box)
|
||||
ob_unittest(test_throttling_utils)
|
||||
|
||||
ob_unittest(test_json_base)
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
<NULL, GEOMETRY> : defined
|
||||
<NULL, UDT> : not defined
|
||||
<NULL, DECIMAL_INT> : defined
|
||||
<NULL, COLLECTION> : defined
|
||||
|
||||
/**************** TINYINT ****************/
|
||||
|
||||
@ -105,6 +106,7 @@
|
||||
<TINYINT, GEOMETRY> : not defined
|
||||
<TINYINT, UDT> : not defined
|
||||
<TINYINT, DECIMAL_INT> : not defined
|
||||
<TINYINT, COLLECTION> : not defined
|
||||
|
||||
/**************** SMALLINT ****************/
|
||||
|
||||
@ -159,6 +161,7 @@
|
||||
<SMALLINT, GEOMETRY> : not defined
|
||||
<SMALLINT, UDT> : not defined
|
||||
<SMALLINT, DECIMAL_INT> : not defined
|
||||
<SMALLINT, COLLECTION> : not defined
|
||||
|
||||
/**************** MEDIUMINT ****************/
|
||||
|
||||
@ -213,6 +216,7 @@
|
||||
<MEDIUMINT, GEOMETRY> : not defined
|
||||
<MEDIUMINT, UDT> : not defined
|
||||
<MEDIUMINT, DECIMAL_INT> : not defined
|
||||
<MEDIUMINT, COLLECTION> : not defined
|
||||
|
||||
/**************** INT ****************/
|
||||
|
||||
@ -267,6 +271,7 @@
|
||||
<INT, GEOMETRY> : not defined
|
||||
<INT, UDT> : not defined
|
||||
<INT, DECIMAL_INT> : not defined
|
||||
<INT, COLLECTION> : not defined
|
||||
|
||||
/**************** BIGINT ****************/
|
||||
|
||||
@ -321,6 +326,7 @@
|
||||
<BIGINT, GEOMETRY> : not defined
|
||||
<BIGINT, UDT> : not defined
|
||||
<BIGINT, DECIMAL_INT> : not defined
|
||||
<BIGINT, COLLECTION> : not defined
|
||||
|
||||
/**************** TINYINT UNSIGNED ****************/
|
||||
|
||||
@ -375,6 +381,7 @@
|
||||
<TINYINT UNSIGNED, GEOMETRY> : not defined
|
||||
<TINYINT UNSIGNED, UDT> : not defined
|
||||
<TINYINT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<TINYINT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** SMALLINT UNSIGNED ****************/
|
||||
|
||||
@ -429,6 +436,7 @@
|
||||
<SMALLINT UNSIGNED, GEOMETRY> : not defined
|
||||
<SMALLINT UNSIGNED, UDT> : not defined
|
||||
<SMALLINT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<SMALLINT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** MEDIUMINT UNSIGNED ****************/
|
||||
|
||||
@ -483,6 +491,7 @@
|
||||
<MEDIUMINT UNSIGNED, GEOMETRY> : not defined
|
||||
<MEDIUMINT UNSIGNED, UDT> : not defined
|
||||
<MEDIUMINT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<MEDIUMINT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** INT UNSIGNED ****************/
|
||||
|
||||
@ -537,6 +546,7 @@
|
||||
<INT UNSIGNED, GEOMETRY> : not defined
|
||||
<INT UNSIGNED, UDT> : not defined
|
||||
<INT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<INT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** BIGINT UNSIGNED ****************/
|
||||
|
||||
@ -591,6 +601,7 @@
|
||||
<BIGINT UNSIGNED, GEOMETRY> : not defined
|
||||
<BIGINT UNSIGNED, UDT> : not defined
|
||||
<BIGINT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<BIGINT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** FLOAT ****************/
|
||||
|
||||
@ -645,6 +656,7 @@
|
||||
<FLOAT, GEOMETRY> : not defined
|
||||
<FLOAT, UDT> : not defined
|
||||
<FLOAT, DECIMAL_INT> : not defined
|
||||
<FLOAT, COLLECTION> : not defined
|
||||
|
||||
/**************** DOUBLE ****************/
|
||||
|
||||
@ -699,6 +711,7 @@
|
||||
<DOUBLE, GEOMETRY> : not defined
|
||||
<DOUBLE, UDT> : not defined
|
||||
<DOUBLE, DECIMAL_INT> : not defined
|
||||
<DOUBLE, COLLECTION> : not defined
|
||||
|
||||
/**************** FLOAT UNSIGNED ****************/
|
||||
|
||||
@ -753,6 +766,7 @@
|
||||
<FLOAT UNSIGNED, GEOMETRY> : not defined
|
||||
<FLOAT UNSIGNED, UDT> : not defined
|
||||
<FLOAT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<FLOAT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** DOUBLE UNSIGNED ****************/
|
||||
|
||||
@ -807,6 +821,7 @@
|
||||
<DOUBLE UNSIGNED, GEOMETRY> : not defined
|
||||
<DOUBLE UNSIGNED, UDT> : not defined
|
||||
<DOUBLE UNSIGNED, DECIMAL_INT> : not defined
|
||||
<DOUBLE UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** DECIMAL ****************/
|
||||
|
||||
@ -861,6 +876,7 @@
|
||||
<DECIMAL, GEOMETRY> : not defined
|
||||
<DECIMAL, UDT> : not defined
|
||||
<DECIMAL, DECIMAL_INT> : not defined
|
||||
<DECIMAL, COLLECTION> : not defined
|
||||
|
||||
/**************** DECIMAL UNSIGNED ****************/
|
||||
|
||||
@ -915,6 +931,7 @@
|
||||
<DECIMAL UNSIGNED, GEOMETRY> : not defined
|
||||
<DECIMAL UNSIGNED, UDT> : not defined
|
||||
<DECIMAL UNSIGNED, DECIMAL_INT> : not defined
|
||||
<DECIMAL UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** DATETIME ****************/
|
||||
|
||||
@ -969,6 +986,7 @@
|
||||
<DATETIME, GEOMETRY> : not defined
|
||||
<DATETIME, UDT> : not defined
|
||||
<DATETIME, DECIMAL_INT> : not defined
|
||||
<DATETIME, COLLECTION> : not defined
|
||||
|
||||
/**************** TIMESTAMP ****************/
|
||||
|
||||
@ -1023,6 +1041,7 @@
|
||||
<TIMESTAMP, GEOMETRY> : not defined
|
||||
<TIMESTAMP, UDT> : not defined
|
||||
<TIMESTAMP, DECIMAL_INT> : not defined
|
||||
<TIMESTAMP, COLLECTION> : not defined
|
||||
|
||||
/**************** DATE ****************/
|
||||
|
||||
@ -1077,6 +1096,7 @@
|
||||
<DATE, GEOMETRY> : not defined
|
||||
<DATE, UDT> : not defined
|
||||
<DATE, DECIMAL_INT> : not defined
|
||||
<DATE, COLLECTION> : not defined
|
||||
|
||||
/**************** TIME ****************/
|
||||
|
||||
@ -1131,6 +1151,7 @@
|
||||
<TIME, GEOMETRY> : not defined
|
||||
<TIME, UDT> : not defined
|
||||
<TIME, DECIMAL_INT> : not defined
|
||||
<TIME, COLLECTION> : not defined
|
||||
|
||||
/**************** YEAR ****************/
|
||||
|
||||
@ -1185,6 +1206,7 @@
|
||||
<YEAR, GEOMETRY> : not defined
|
||||
<YEAR, UDT> : not defined
|
||||
<YEAR, DECIMAL_INT> : not defined
|
||||
<YEAR, COLLECTION> : not defined
|
||||
|
||||
/**************** VARCHAR ****************/
|
||||
|
||||
@ -1239,6 +1261,7 @@
|
||||
<VARCHAR, GEOMETRY> : not defined
|
||||
<VARCHAR, UDT> : not defined
|
||||
<VARCHAR, DECIMAL_INT> : not defined
|
||||
<VARCHAR, COLLECTION> : not defined
|
||||
|
||||
/**************** CHAR ****************/
|
||||
|
||||
@ -1293,6 +1316,7 @@
|
||||
<CHAR, GEOMETRY> : not defined
|
||||
<CHAR, UDT> : not defined
|
||||
<CHAR, DECIMAL_INT> : not defined
|
||||
<CHAR, COLLECTION> : not defined
|
||||
|
||||
/**************** HEX_STRING ****************/
|
||||
|
||||
@ -1347,6 +1371,7 @@
|
||||
<HEX_STRING, GEOMETRY> : not defined
|
||||
<HEX_STRING, UDT> : not defined
|
||||
<HEX_STRING, DECIMAL_INT> : not defined
|
||||
<HEX_STRING, COLLECTION> : not defined
|
||||
|
||||
/**************** EXT ****************/
|
||||
|
||||
@ -1401,6 +1426,7 @@
|
||||
<EXT, GEOMETRY> : defined
|
||||
<EXT, UDT> : not defined
|
||||
<EXT, DECIMAL_INT> : defined
|
||||
<EXT, COLLECTION> : defined
|
||||
|
||||
/**************** UNKNOWN ****************/
|
||||
|
||||
@ -1455,6 +1481,7 @@
|
||||
<UNKNOWN, GEOMETRY> : not defined
|
||||
<UNKNOWN, UDT> : not defined
|
||||
<UNKNOWN, DECIMAL_INT> : not defined
|
||||
<UNKNOWN, COLLECTION> : not defined
|
||||
|
||||
/**************** TINYTEXT ****************/
|
||||
|
||||
@ -1509,6 +1536,7 @@
|
||||
<TINYTEXT, GEOMETRY> : not defined
|
||||
<TINYTEXT, UDT> : not defined
|
||||
<TINYTEXT, DECIMAL_INT> : not defined
|
||||
<TINYTEXT, COLLECTION> : not defined
|
||||
|
||||
/**************** TEXT ****************/
|
||||
|
||||
@ -1563,6 +1591,7 @@
|
||||
<TEXT, GEOMETRY> : not defined
|
||||
<TEXT, UDT> : not defined
|
||||
<TEXT, DECIMAL_INT> : not defined
|
||||
<TEXT, COLLECTION> : not defined
|
||||
|
||||
/**************** MEDIUMTEXT ****************/
|
||||
|
||||
@ -1617,6 +1646,7 @@
|
||||
<MEDIUMTEXT, GEOMETRY> : not defined
|
||||
<MEDIUMTEXT, UDT> : not defined
|
||||
<MEDIUMTEXT, DECIMAL_INT> : not defined
|
||||
<MEDIUMTEXT, COLLECTION> : not defined
|
||||
|
||||
/**************** LONGTEXT ****************/
|
||||
|
||||
@ -1671,6 +1701,7 @@
|
||||
<LONGTEXT, GEOMETRY> : not defined
|
||||
<LONGTEXT, UDT> : not defined
|
||||
<LONGTEXT, DECIMAL_INT> : not defined
|
||||
<LONGTEXT, COLLECTION> : not defined
|
||||
|
||||
/**************** BIT ****************/
|
||||
|
||||
@ -1725,6 +1756,7 @@
|
||||
<BIT, GEOMETRY> : not defined
|
||||
<BIT, UDT> : not defined
|
||||
<BIT, DECIMAL_INT> : not defined
|
||||
<BIT, COLLECTION> : not defined
|
||||
|
||||
/**************** ENUM ****************/
|
||||
|
||||
@ -1779,6 +1811,7 @@
|
||||
<ENUM, GEOMETRY> : not defined
|
||||
<ENUM, UDT> : not defined
|
||||
<ENUM, DECIMAL_INT> : not defined
|
||||
<ENUM, COLLECTION> : not defined
|
||||
|
||||
/**************** SET ****************/
|
||||
|
||||
@ -1833,6 +1866,7 @@
|
||||
<SET, GEOMETRY> : not defined
|
||||
<SET, UDT> : not defined
|
||||
<SET, DECIMAL_INT> : not defined
|
||||
<SET, COLLECTION> : not defined
|
||||
|
||||
/**************** ENUM_INNER ****************/
|
||||
|
||||
@ -1887,6 +1921,7 @@
|
||||
<ENUM_INNER, GEOMETRY> : not defined
|
||||
<ENUM_INNER, UDT> : not defined
|
||||
<ENUM_INNER, DECIMAL_INT> : not defined
|
||||
<ENUM_INNER, COLLECTION> : not defined
|
||||
|
||||
/**************** SET_INNER ****************/
|
||||
|
||||
@ -1941,6 +1976,7 @@
|
||||
<SET_INNER, GEOMETRY> : not defined
|
||||
<SET_INNER, UDT> : not defined
|
||||
<SET_INNER, DECIMAL_INT> : not defined
|
||||
<SET_INNER, COLLECTION> : not defined
|
||||
|
||||
/**************** TIMESTAMP_WITH_TIME_ZONE ****************/
|
||||
|
||||
@ -1995,6 +2031,7 @@
|
||||
<TIMESTAMP_WITH_TIME_ZONE, GEOMETRY> : not defined
|
||||
<TIMESTAMP_WITH_TIME_ZONE, UDT> : not defined
|
||||
<TIMESTAMP_WITH_TIME_ZONE, DECIMAL_INT> : not defined
|
||||
<TIMESTAMP_WITH_TIME_ZONE, COLLECTION> : not defined
|
||||
|
||||
/**************** TIMESTAMP_WITH_LOCAL_TIME_ZONE ****************/
|
||||
|
||||
@ -2049,6 +2086,7 @@
|
||||
<TIMESTAMP_WITH_LOCAL_TIME_ZONE, GEOMETRY> : not defined
|
||||
<TIMESTAMP_WITH_LOCAL_TIME_ZONE, UDT> : not defined
|
||||
<TIMESTAMP_WITH_LOCAL_TIME_ZONE, DECIMAL_INT> : not defined
|
||||
<TIMESTAMP_WITH_LOCAL_TIME_ZONE, COLLECTION> : not defined
|
||||
|
||||
/**************** TIMESTAMP ****************/
|
||||
|
||||
@ -2103,6 +2141,7 @@
|
||||
<TIMESTAMP, GEOMETRY> : not defined
|
||||
<TIMESTAMP, UDT> : not defined
|
||||
<TIMESTAMP, DECIMAL_INT> : not defined
|
||||
<TIMESTAMP, COLLECTION> : not defined
|
||||
|
||||
/**************** RAW ****************/
|
||||
|
||||
@ -2157,6 +2196,7 @@
|
||||
<RAW, GEOMETRY> : not defined
|
||||
<RAW, UDT> : not defined
|
||||
<RAW, DECIMAL_INT> : not defined
|
||||
<RAW, COLLECTION> : not defined
|
||||
|
||||
/**************** INTERVAL_YEAR_TO_MONTH ****************/
|
||||
|
||||
@ -2211,6 +2251,7 @@
|
||||
<INTERVAL_YEAR_TO_MONTH, GEOMETRY> : not defined
|
||||
<INTERVAL_YEAR_TO_MONTH, UDT> : not defined
|
||||
<INTERVAL_YEAR_TO_MONTH, DECIMAL_INT> : not defined
|
||||
<INTERVAL_YEAR_TO_MONTH, COLLECTION> : not defined
|
||||
|
||||
/**************** INTERVAL_DAY_TO_SECOND ****************/
|
||||
|
||||
@ -2265,6 +2306,7 @@
|
||||
<INTERVAL_DAY_TO_SECOND, GEOMETRY> : not defined
|
||||
<INTERVAL_DAY_TO_SECOND, UDT> : not defined
|
||||
<INTERVAL_DAY_TO_SECOND, DECIMAL_INT> : not defined
|
||||
<INTERVAL_DAY_TO_SECOND, COLLECTION> : not defined
|
||||
|
||||
/**************** NUMBER_FLOAT ****************/
|
||||
|
||||
@ -2319,6 +2361,7 @@
|
||||
<NUMBER_FLOAT, GEOMETRY> : not defined
|
||||
<NUMBER_FLOAT, UDT> : not defined
|
||||
<NUMBER_FLOAT, DECIMAL_INT> : not defined
|
||||
<NUMBER_FLOAT, COLLECTION> : not defined
|
||||
|
||||
/**************** NVARCHAR2 ****************/
|
||||
|
||||
@ -2373,6 +2416,7 @@
|
||||
<NVARCHAR2, GEOMETRY> : not defined
|
||||
<NVARCHAR2, UDT> : not defined
|
||||
<NVARCHAR2, DECIMAL_INT> : not defined
|
||||
<NVARCHAR2, COLLECTION> : not defined
|
||||
|
||||
/**************** NCHAR ****************/
|
||||
|
||||
@ -2427,6 +2471,7 @@
|
||||
<NCHAR, GEOMETRY> : not defined
|
||||
<NCHAR, UDT> : not defined
|
||||
<NCHAR, DECIMAL_INT> : not defined
|
||||
<NCHAR, COLLECTION> : not defined
|
||||
|
||||
/**************** ROWID ****************/
|
||||
|
||||
@ -2481,6 +2526,7 @@
|
||||
<ROWID, GEOMETRY> : not defined
|
||||
<ROWID, UDT> : not defined
|
||||
<ROWID, DECIMAL_INT> : not defined
|
||||
<ROWID, COLLECTION> : not defined
|
||||
|
||||
/**************** LOB ****************/
|
||||
|
||||
@ -2535,6 +2581,7 @@
|
||||
<LOB, GEOMETRY> : not defined
|
||||
<LOB, UDT> : not defined
|
||||
<LOB, DECIMAL_INT> : not defined
|
||||
<LOB, COLLECTION> : not defined
|
||||
|
||||
/**************** JSON ****************/
|
||||
|
||||
@ -2589,6 +2636,7 @@
|
||||
<JSON, GEOMETRY> : not defined
|
||||
<JSON, UDT> : not defined
|
||||
<JSON, DECIMAL_INT> : not defined
|
||||
<JSON, COLLECTION> : not defined
|
||||
|
||||
/**************** GEOMETRY ****************/
|
||||
|
||||
@ -2643,6 +2691,7 @@
|
||||
<GEOMETRY, GEOMETRY> : defined
|
||||
<GEOMETRY, UDT> : not defined
|
||||
<GEOMETRY, DECIMAL_INT> : not defined
|
||||
<GEOMETRY, COLLECTION> : not defined
|
||||
|
||||
/**************** UDT ****************/
|
||||
|
||||
@ -2697,6 +2746,7 @@
|
||||
<UDT, GEOMETRY> : not defined
|
||||
<UDT, UDT> : not defined
|
||||
<UDT, DECIMAL_INT> : not defined
|
||||
<UDT, COLLECTION> : not defined
|
||||
|
||||
/**************** DECIMAL_INT ****************/
|
||||
|
||||
@ -2751,4 +2801,60 @@
|
||||
<DECIMAL_INT, GEOMETRY> : not defined
|
||||
<DECIMAL_INT, UDT> : not defined
|
||||
<DECIMAL_INT, DECIMAL_INT> : defined
|
||||
<DECIMAL_INT, COLLECTION> : not defined
|
||||
|
||||
/**************** COLLECTION ****************/
|
||||
|
||||
<COLLECTION, NULL> : defined
|
||||
<COLLECTION, TINYINT> : not defined
|
||||
<COLLECTION, SMALLINT> : not defined
|
||||
<COLLECTION, MEDIUMINT> : not defined
|
||||
<COLLECTION, INT> : not defined
|
||||
<COLLECTION, BIGINT> : not defined
|
||||
<COLLECTION, TINYINT UNSIGNED> : not defined
|
||||
<COLLECTION, SMALLINT UNSIGNED> : not defined
|
||||
<COLLECTION, MEDIUMINT UNSIGNED> : not defined
|
||||
<COLLECTION, INT UNSIGNED> : not defined
|
||||
<COLLECTION, BIGINT UNSIGNED> : not defined
|
||||
<COLLECTION, FLOAT> : not defined
|
||||
<COLLECTION, DOUBLE> : not defined
|
||||
<COLLECTION, FLOAT UNSIGNED> : not defined
|
||||
<COLLECTION, DOUBLE UNSIGNED> : not defined
|
||||
<COLLECTION, DECIMAL> : not defined
|
||||
<COLLECTION, DECIMAL UNSIGNED> : not defined
|
||||
<COLLECTION, DATETIME> : not defined
|
||||
<COLLECTION, TIMESTAMP> : not defined
|
||||
<COLLECTION, DATE> : not defined
|
||||
<COLLECTION, TIME> : not defined
|
||||
<COLLECTION, YEAR> : not defined
|
||||
<COLLECTION, VARCHAR> : not defined
|
||||
<COLLECTION, CHAR> : not defined
|
||||
<COLLECTION, HEX_STRING> : not defined
|
||||
<COLLECTION, EXT> : defined
|
||||
<COLLECTION, UNKNOWN> : not defined
|
||||
<COLLECTION, TINYTEXT> : not defined
|
||||
<COLLECTION, TEXT> : not defined
|
||||
<COLLECTION, MEDIUMTEXT> : not defined
|
||||
<COLLECTION, LONGTEXT> : not defined
|
||||
<COLLECTION, BIT> : not defined
|
||||
<COLLECTION, ENUM> : not defined
|
||||
<COLLECTION, SET> : not defined
|
||||
<COLLECTION, ENUM_INNER> : not defined
|
||||
<COLLECTION, SET_INNER> : not defined
|
||||
<COLLECTION, TIMESTAMP_WITH_TIME_ZONE> : not defined
|
||||
<COLLECTION, TIMESTAMP_WITH_LOCAL_TIME_ZONE> : not defined
|
||||
<COLLECTION, TIMESTAMP> : not defined
|
||||
<COLLECTION, RAW> : not defined
|
||||
<COLLECTION, INTERVAL_YEAR_TO_MONTH> : not defined
|
||||
<COLLECTION, INTERVAL_DAY_TO_SECOND> : not defined
|
||||
<COLLECTION, NUMBER_FLOAT> : not defined
|
||||
<COLLECTION, NVARCHAR2> : not defined
|
||||
<COLLECTION, NCHAR> : not defined
|
||||
<COLLECTION, ROWID> : not defined
|
||||
<COLLECTION, LOB> : not defined
|
||||
<COLLECTION, JSON> : not defined
|
||||
<COLLECTION, GEOMETRY> : not defined
|
||||
<COLLECTION, UDT> : not defined
|
||||
<COLLECTION, DECIMAL_INT> : not defined
|
||||
<COLLECTION, COLLECTION> : not defined
|
||||
|
||||
|
||||
@ -51,6 +51,7 @@
|
||||
<NULL, GEOMETRY> : defined
|
||||
<NULL, UDT> : not defined
|
||||
<NULL, DECIMAL_INT> : defined
|
||||
<NULL, COLLECTION> : defined
|
||||
|
||||
/**************** TINYINT ****************/
|
||||
|
||||
@ -105,6 +106,7 @@
|
||||
<TINYINT, GEOMETRY> : not defined
|
||||
<TINYINT, UDT> : not defined
|
||||
<TINYINT, DECIMAL_INT> : not defined
|
||||
<TINYINT, COLLECTION> : not defined
|
||||
|
||||
/**************** SMALLINT ****************/
|
||||
|
||||
@ -159,6 +161,7 @@
|
||||
<SMALLINT, GEOMETRY> : not defined
|
||||
<SMALLINT, UDT> : not defined
|
||||
<SMALLINT, DECIMAL_INT> : not defined
|
||||
<SMALLINT, COLLECTION> : not defined
|
||||
|
||||
/**************** MEDIUMINT ****************/
|
||||
|
||||
@ -213,6 +216,7 @@
|
||||
<MEDIUMINT, GEOMETRY> : not defined
|
||||
<MEDIUMINT, UDT> : not defined
|
||||
<MEDIUMINT, DECIMAL_INT> : not defined
|
||||
<MEDIUMINT, COLLECTION> : not defined
|
||||
|
||||
/**************** INT ****************/
|
||||
|
||||
@ -267,6 +271,7 @@
|
||||
<INT, GEOMETRY> : not defined
|
||||
<INT, UDT> : not defined
|
||||
<INT, DECIMAL_INT> : not defined
|
||||
<INT, COLLECTION> : not defined
|
||||
|
||||
/**************** BIGINT ****************/
|
||||
|
||||
@ -321,6 +326,7 @@
|
||||
<BIGINT, GEOMETRY> : not defined
|
||||
<BIGINT, UDT> : not defined
|
||||
<BIGINT, DECIMAL_INT> : not defined
|
||||
<BIGINT, COLLECTION> : not defined
|
||||
|
||||
/**************** TINYINT UNSIGNED ****************/
|
||||
|
||||
@ -375,6 +381,7 @@
|
||||
<TINYINT UNSIGNED, GEOMETRY> : not defined
|
||||
<TINYINT UNSIGNED, UDT> : not defined
|
||||
<TINYINT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<TINYINT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** SMALLINT UNSIGNED ****************/
|
||||
|
||||
@ -429,6 +436,7 @@
|
||||
<SMALLINT UNSIGNED, GEOMETRY> : not defined
|
||||
<SMALLINT UNSIGNED, UDT> : not defined
|
||||
<SMALLINT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<SMALLINT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** MEDIUMINT UNSIGNED ****************/
|
||||
|
||||
@ -483,6 +491,7 @@
|
||||
<MEDIUMINT UNSIGNED, GEOMETRY> : not defined
|
||||
<MEDIUMINT UNSIGNED, UDT> : not defined
|
||||
<MEDIUMINT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<MEDIUMINT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** INT UNSIGNED ****************/
|
||||
|
||||
@ -537,6 +546,7 @@
|
||||
<INT UNSIGNED, GEOMETRY> : not defined
|
||||
<INT UNSIGNED, UDT> : not defined
|
||||
<INT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<INT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** BIGINT UNSIGNED ****************/
|
||||
|
||||
@ -591,6 +601,7 @@
|
||||
<BIGINT UNSIGNED, GEOMETRY> : not defined
|
||||
<BIGINT UNSIGNED, UDT> : not defined
|
||||
<BIGINT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<BIGINT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** FLOAT ****************/
|
||||
|
||||
@ -645,6 +656,7 @@
|
||||
<FLOAT, GEOMETRY> : not defined
|
||||
<FLOAT, UDT> : not defined
|
||||
<FLOAT, DECIMAL_INT> : not defined
|
||||
<FLOAT, COLLECTION> : not defined
|
||||
|
||||
/**************** DOUBLE ****************/
|
||||
|
||||
@ -699,6 +711,7 @@
|
||||
<DOUBLE, GEOMETRY> : not defined
|
||||
<DOUBLE, UDT> : not defined
|
||||
<DOUBLE, DECIMAL_INT> : not defined
|
||||
<DOUBLE, COLLECTION> : not defined
|
||||
|
||||
/**************** FLOAT UNSIGNED ****************/
|
||||
|
||||
@ -753,6 +766,7 @@
|
||||
<FLOAT UNSIGNED, GEOMETRY> : not defined
|
||||
<FLOAT UNSIGNED, UDT> : not defined
|
||||
<FLOAT UNSIGNED, DECIMAL_INT> : not defined
|
||||
<FLOAT UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** DOUBLE UNSIGNED ****************/
|
||||
|
||||
@ -807,6 +821,7 @@
|
||||
<DOUBLE UNSIGNED, GEOMETRY> : not defined
|
||||
<DOUBLE UNSIGNED, UDT> : not defined
|
||||
<DOUBLE UNSIGNED, DECIMAL_INT> : not defined
|
||||
<DOUBLE UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** DECIMAL ****************/
|
||||
|
||||
@ -861,6 +876,7 @@
|
||||
<DECIMAL, GEOMETRY> : not defined
|
||||
<DECIMAL, UDT> : not defined
|
||||
<DECIMAL, DECIMAL_INT> : not defined
|
||||
<DECIMAL, COLLECTION> : not defined
|
||||
|
||||
/**************** DECIMAL UNSIGNED ****************/
|
||||
|
||||
@ -915,6 +931,7 @@
|
||||
<DECIMAL UNSIGNED, GEOMETRY> : not defined
|
||||
<DECIMAL UNSIGNED, UDT> : not defined
|
||||
<DECIMAL UNSIGNED, DECIMAL_INT> : not defined
|
||||
<DECIMAL UNSIGNED, COLLECTION> : not defined
|
||||
|
||||
/**************** DATETIME ****************/
|
||||
|
||||
@ -969,6 +986,7 @@
|
||||
<DATETIME, GEOMETRY> : not defined
|
||||
<DATETIME, UDT> : not defined
|
||||
<DATETIME, DECIMAL_INT> : not defined
|
||||
<DATETIME, COLLECTION> : not defined
|
||||
|
||||
/**************** TIMESTAMP ****************/
|
||||
|
||||
@ -1023,6 +1041,7 @@
|
||||
<TIMESTAMP, GEOMETRY> : not defined
|
||||
<TIMESTAMP, UDT> : not defined
|
||||
<TIMESTAMP, DECIMAL_INT> : not defined
|
||||
<TIMESTAMP, COLLECTION> : not defined
|
||||
|
||||
/**************** DATE ****************/
|
||||
|
||||
@ -1077,6 +1096,7 @@
|
||||
<DATE, GEOMETRY> : not defined
|
||||
<DATE, UDT> : not defined
|
||||
<DATE, DECIMAL_INT> : not defined
|
||||
<DATE, COLLECTION> : not defined
|
||||
|
||||
/**************** TIME ****************/
|
||||
|
||||
@ -1131,6 +1151,7 @@
|
||||
<TIME, GEOMETRY> : not defined
|
||||
<TIME, UDT> : not defined
|
||||
<TIME, DECIMAL_INT> : not defined
|
||||
<TIME, COLLECTION> : not defined
|
||||
|
||||
/**************** YEAR ****************/
|
||||
|
||||
@ -1185,6 +1206,7 @@
|
||||
<YEAR, GEOMETRY> : not defined
|
||||
<YEAR, UDT> : not defined
|
||||
<YEAR, DECIMAL_INT> : not defined
|
||||
<YEAR, COLLECTION> : not defined
|
||||
|
||||
/**************** VARCHAR ****************/
|
||||
|
||||
@ -1239,6 +1261,7 @@
|
||||
<VARCHAR, GEOMETRY> : not defined
|
||||
<VARCHAR, UDT> : not defined
|
||||
<VARCHAR, DECIMAL_INT> : not defined
|
||||
<VARCHAR, COLLECTION> : not defined
|
||||
|
||||
/**************** CHAR ****************/
|
||||
|
||||
@ -1293,6 +1316,7 @@
|
||||
<CHAR, GEOMETRY> : not defined
|
||||
<CHAR, UDT> : not defined
|
||||
<CHAR, DECIMAL_INT> : not defined
|
||||
<CHAR, COLLECTION> : not defined
|
||||
|
||||
/**************** HEX_STRING ****************/
|
||||
|
||||
@ -1347,6 +1371,7 @@
|
||||
<HEX_STRING, GEOMETRY> : not defined
|
||||
<HEX_STRING, UDT> : not defined
|
||||
<HEX_STRING, DECIMAL_INT> : not defined
|
||||
<HEX_STRING, COLLECTION> : not defined
|
||||
|
||||
/**************** EXT ****************/
|
||||
|
||||
@ -1401,6 +1426,7 @@
|
||||
<EXT, GEOMETRY> : defined
|
||||
<EXT, UDT> : not defined
|
||||
<EXT, DECIMAL_INT> : defined
|
||||
<EXT, COLLECTION> : defined
|
||||
|
||||
/**************** UNKNOWN ****************/
|
||||
|
||||
@ -1455,6 +1481,7 @@
|
||||
<UNKNOWN, GEOMETRY> : not defined
|
||||
<UNKNOWN, UDT> : not defined
|
||||
<UNKNOWN, DECIMAL_INT> : not defined
|
||||
<UNKNOWN, COLLECTION> : not defined
|
||||
|
||||
/**************** TINYTEXT ****************/
|
||||
|
||||
@ -1509,6 +1536,7 @@
|
||||
<TINYTEXT, GEOMETRY> : not defined
|
||||
<TINYTEXT, UDT> : not defined
|
||||
<TINYTEXT, DECIMAL_INT> : not defined
|
||||
<TINYTEXT, COLLECTION> : not defined
|
||||
|
||||
/**************** TEXT ****************/
|
||||
|
||||
@ -1563,6 +1591,7 @@
|
||||
<TEXT, GEOMETRY> : not defined
|
||||
<TEXT, UDT> : not defined
|
||||
<TEXT, DECIMAL_INT> : not defined
|
||||
<TEXT, COLLECTION> : not defined
|
||||
|
||||
/**************** MEDIUMTEXT ****************/
|
||||
|
||||
@ -1617,6 +1646,7 @@
|
||||
<MEDIUMTEXT, GEOMETRY> : not defined
|
||||
<MEDIUMTEXT, UDT> : not defined
|
||||
<MEDIUMTEXT, DECIMAL_INT> : not defined
|
||||
<MEDIUMTEXT, COLLECTION> : not defined
|
||||
|
||||
/**************** LONGTEXT ****************/
|
||||
|
||||
@ -1671,6 +1701,7 @@
|
||||
<LONGTEXT, GEOMETRY> : not defined
|
||||
<LONGTEXT, UDT> : not defined
|
||||
<LONGTEXT, DECIMAL_INT> : not defined
|
||||
<LONGTEXT, COLLECTION> : not defined
|
||||
|
||||
/**************** BIT ****************/
|
||||
|
||||
@ -1725,6 +1756,7 @@
|
||||
<BIT, GEOMETRY> : not defined
|
||||
<BIT, UDT> : not defined
|
||||
<BIT, DECIMAL_INT> : not defined
|
||||
<BIT, COLLECTION> : not defined
|
||||
|
||||
/**************** ENUM ****************/
|
||||
|
||||
@ -1779,6 +1811,7 @@
|
||||
<ENUM, GEOMETRY> : not defined
|
||||
<ENUM, UDT> : not defined
|
||||
<ENUM, DECIMAL_INT> : not defined
|
||||
<ENUM, COLLECTION> : not defined
|
||||
|
||||
/**************** SET ****************/
|
||||
|
||||
@ -1833,6 +1866,7 @@
|
||||
<SET, GEOMETRY> : not defined
|
||||
<SET, UDT> : not defined
|
||||
<SET, DECIMAL_INT> : not defined
|
||||
<SET, COLLECTION> : not defined
|
||||
|
||||
/**************** ENUM_INNER ****************/
|
||||
|
||||
@ -1887,6 +1921,7 @@
|
||||
<ENUM_INNER, GEOMETRY> : not defined
|
||||
<ENUM_INNER, UDT> : not defined
|
||||
<ENUM_INNER, DECIMAL_INT> : not defined
|
||||
<ENUM_INNER, COLLECTION> : not defined
|
||||
|
||||
/**************** SET_INNER ****************/
|
||||
|
||||
@ -1941,6 +1976,7 @@
|
||||
<SET_INNER, GEOMETRY> : not defined
|
||||
<SET_INNER, UDT> : not defined
|
||||
<SET_INNER, DECIMAL_INT> : not defined
|
||||
<SET_INNER, COLLECTION> : not defined
|
||||
|
||||
/**************** TIMESTAMP_WITH_TIME_ZONE ****************/
|
||||
|
||||
@ -1995,6 +2031,7 @@
|
||||
<TIMESTAMP_WITH_TIME_ZONE, GEOMETRY> : not defined
|
||||
<TIMESTAMP_WITH_TIME_ZONE, UDT> : not defined
|
||||
<TIMESTAMP_WITH_TIME_ZONE, DECIMAL_INT> : not defined
|
||||
<TIMESTAMP_WITH_TIME_ZONE, COLLECTION> : not defined
|
||||
|
||||
/**************** TIMESTAMP_WITH_LOCAL_TIME_ZONE ****************/
|
||||
|
||||
@ -2049,6 +2086,7 @@
|
||||
<TIMESTAMP_WITH_LOCAL_TIME_ZONE, GEOMETRY> : not defined
|
||||
<TIMESTAMP_WITH_LOCAL_TIME_ZONE, UDT> : not defined
|
||||
<TIMESTAMP_WITH_LOCAL_TIME_ZONE, DECIMAL_INT> : not defined
|
||||
<TIMESTAMP_WITH_LOCAL_TIME_ZONE, COLLECTION> : not defined
|
||||
|
||||
/**************** TIMESTAMP ****************/
|
||||
|
||||
@ -2103,6 +2141,7 @@
|
||||
<TIMESTAMP, GEOMETRY> : not defined
|
||||
<TIMESTAMP, UDT> : not defined
|
||||
<TIMESTAMP, DECIMAL_INT> : not defined
|
||||
<TIMESTAMP, COLLECTION> : not defined
|
||||
|
||||
/**************** RAW ****************/
|
||||
|
||||
@ -2157,6 +2196,7 @@
|
||||
<RAW, GEOMETRY> : not defined
|
||||
<RAW, UDT> : not defined
|
||||
<RAW, DECIMAL_INT> : not defined
|
||||
<RAW, COLLECTION> : not defined
|
||||
|
||||
/**************** INTERVAL_YEAR_TO_MONTH ****************/
|
||||
|
||||
@ -2211,6 +2251,7 @@
|
||||
<INTERVAL_YEAR_TO_MONTH, GEOMETRY> : not defined
|
||||
<INTERVAL_YEAR_TO_MONTH, UDT> : not defined
|
||||
<INTERVAL_YEAR_TO_MONTH, DECIMAL_INT> : not defined
|
||||
<INTERVAL_YEAR_TO_MONTH, COLLECTION> : not defined
|
||||
|
||||
/**************** INTERVAL_DAY_TO_SECOND ****************/
|
||||
|
||||
@ -2265,6 +2306,7 @@
|
||||
<INTERVAL_DAY_TO_SECOND, GEOMETRY> : not defined
|
||||
<INTERVAL_DAY_TO_SECOND, UDT> : not defined
|
||||
<INTERVAL_DAY_TO_SECOND, DECIMAL_INT> : not defined
|
||||
<INTERVAL_DAY_TO_SECOND, COLLECTION> : not defined
|
||||
|
||||
/**************** NUMBER_FLOAT ****************/
|
||||
|
||||
@ -2319,6 +2361,7 @@
|
||||
<NUMBER_FLOAT, GEOMETRY> : not defined
|
||||
<NUMBER_FLOAT, UDT> : not defined
|
||||
<NUMBER_FLOAT, DECIMAL_INT> : not defined
|
||||
<NUMBER_FLOAT, COLLECTION> : not defined
|
||||
|
||||
/**************** NVARCHAR2 ****************/
|
||||
|
||||
@ -2373,6 +2416,7 @@
|
||||
<NVARCHAR2, GEOMETRY> : not defined
|
||||
<NVARCHAR2, UDT> : not defined
|
||||
<NVARCHAR2, DECIMAL_INT> : not defined
|
||||
<NVARCHAR2, COLLECTION> : not defined
|
||||
|
||||
/**************** NCHAR ****************/
|
||||
|
||||
@ -2427,6 +2471,7 @@
|
||||
<NCHAR, GEOMETRY> : not defined
|
||||
<NCHAR, UDT> : not defined
|
||||
<NCHAR, DECIMAL_INT> : not defined
|
||||
<NCHAR, COLLECTION> : not defined
|
||||
|
||||
/**************** ROWID ****************/
|
||||
|
||||
@ -2481,6 +2526,7 @@
|
||||
<ROWID, GEOMETRY> : not defined
|
||||
<ROWID, UDT> : not defined
|
||||
<ROWID, DECIMAL_INT> : not defined
|
||||
<ROWID, COLLECTION> : not defined
|
||||
|
||||
/**************** LOB ****************/
|
||||
|
||||
@ -2535,6 +2581,7 @@
|
||||
<LOB, GEOMETRY> : not defined
|
||||
<LOB, UDT> : not defined
|
||||
<LOB, DECIMAL_INT> : not defined
|
||||
<LOB, COLLECTION> : not defined
|
||||
|
||||
/**************** JSON ****************/
|
||||
|
||||
@ -2589,6 +2636,7 @@
|
||||
<JSON, GEOMETRY> : not defined
|
||||
<JSON, UDT> : not defined
|
||||
<JSON, DECIMAL_INT> : not defined
|
||||
<JSON, COLLECTION> : not defined
|
||||
|
||||
/**************** GEOMETRY ****************/
|
||||
|
||||
@ -2643,6 +2691,7 @@
|
||||
<GEOMETRY, GEOMETRY> : defined
|
||||
<GEOMETRY, UDT> : not defined
|
||||
<GEOMETRY, DECIMAL_INT> : not defined
|
||||
<GEOMETRY, COLLECTION> : not defined
|
||||
|
||||
/**************** UDT ****************/
|
||||
|
||||
@ -2697,6 +2746,7 @@
|
||||
<UDT, GEOMETRY> : not defined
|
||||
<UDT, UDT> : not defined
|
||||
<UDT, DECIMAL_INT> : not defined
|
||||
<UDT, COLLECTION> : not defined
|
||||
|
||||
/**************** DECIMAL_INT ****************/
|
||||
|
||||
@ -2751,4 +2801,60 @@
|
||||
<DECIMAL_INT, GEOMETRY> : not defined
|
||||
<DECIMAL_INT, UDT> : not defined
|
||||
<DECIMAL_INT, DECIMAL_INT> : defined
|
||||
<DECIMAL_INT, COLLECTION> : not defined
|
||||
|
||||
/**************** COLLECTION ****************/
|
||||
|
||||
<COLLECTION, NULL> : defined
|
||||
<COLLECTION, TINYINT> : not defined
|
||||
<COLLECTION, SMALLINT> : not defined
|
||||
<COLLECTION, MEDIUMINT> : not defined
|
||||
<COLLECTION, INT> : not defined
|
||||
<COLLECTION, BIGINT> : not defined
|
||||
<COLLECTION, TINYINT UNSIGNED> : not defined
|
||||
<COLLECTION, SMALLINT UNSIGNED> : not defined
|
||||
<COLLECTION, MEDIUMINT UNSIGNED> : not defined
|
||||
<COLLECTION, INT UNSIGNED> : not defined
|
||||
<COLLECTION, BIGINT UNSIGNED> : not defined
|
||||
<COLLECTION, FLOAT> : not defined
|
||||
<COLLECTION, DOUBLE> : not defined
|
||||
<COLLECTION, FLOAT UNSIGNED> : not defined
|
||||
<COLLECTION, DOUBLE UNSIGNED> : not defined
|
||||
<COLLECTION, DECIMAL> : not defined
|
||||
<COLLECTION, DECIMAL UNSIGNED> : not defined
|
||||
<COLLECTION, DATETIME> : not defined
|
||||
<COLLECTION, TIMESTAMP> : not defined
|
||||
<COLLECTION, DATE> : not defined
|
||||
<COLLECTION, TIME> : not defined
|
||||
<COLLECTION, YEAR> : not defined
|
||||
<COLLECTION, VARCHAR> : not defined
|
||||
<COLLECTION, CHAR> : not defined
|
||||
<COLLECTION, HEX_STRING> : not defined
|
||||
<COLLECTION, EXT> : defined
|
||||
<COLLECTION, UNKNOWN> : not defined
|
||||
<COLLECTION, TINYTEXT> : not defined
|
||||
<COLLECTION, TEXT> : not defined
|
||||
<COLLECTION, MEDIUMTEXT> : not defined
|
||||
<COLLECTION, LONGTEXT> : not defined
|
||||
<COLLECTION, BIT> : not defined
|
||||
<COLLECTION, ENUM> : not defined
|
||||
<COLLECTION, SET> : not defined
|
||||
<COLLECTION, ENUM_INNER> : not defined
|
||||
<COLLECTION, SET_INNER> : not defined
|
||||
<COLLECTION, TIMESTAMP_WITH_TIME_ZONE> : not defined
|
||||
<COLLECTION, TIMESTAMP_WITH_LOCAL_TIME_ZONE> : not defined
|
||||
<COLLECTION, TIMESTAMP> : not defined
|
||||
<COLLECTION, RAW> : not defined
|
||||
<COLLECTION, INTERVAL_YEAR_TO_MONTH> : not defined
|
||||
<COLLECTION, INTERVAL_DAY_TO_SECOND> : not defined
|
||||
<COLLECTION, NUMBER_FLOAT> : not defined
|
||||
<COLLECTION, NVARCHAR2> : not defined
|
||||
<COLLECTION, NCHAR> : not defined
|
||||
<COLLECTION, ROWID> : not defined
|
||||
<COLLECTION, LOB> : not defined
|
||||
<COLLECTION, JSON> : not defined
|
||||
<COLLECTION, GEOMETRY> : not defined
|
||||
<COLLECTION, UDT> : not defined
|
||||
<COLLECTION, DECIMAL_INT> : not defined
|
||||
<COLLECTION, COLLECTION> : not defined
|
||||
|
||||
|
||||
434
unittest/share/test_geo_3d.cpp
Normal file
434
unittest/share/test_geo_3d.cpp
Normal file
@ -0,0 +1,434 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#define private public
|
||||
#define protected public
|
||||
#include "lib/geo/ob_geo_3d.h"
|
||||
#include "lib/geo/ob_wkt_parser.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace oceanbase {
|
||||
namespace common {
|
||||
class TestGeo3D : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
TestGeo3D()
|
||||
{}
|
||||
~TestGeo3D()
|
||||
{}
|
||||
|
||||
ObString to_hex(const ObString &str) {
|
||||
uint64_t out_str_len = str.length() * 2;
|
||||
int64_t pos = 0;
|
||||
char *data = static_cast<char *>(allocator_.alloc(out_str_len));
|
||||
hex_print(str.ptr(), str.length(), data, out_str_len, pos);
|
||||
return ObString(out_str_len, data);
|
||||
}
|
||||
|
||||
ObString mock_to_wkb(ObGeometry *geo) {
|
||||
ObString wkb;
|
||||
if (OB_NOT_NULL(geo) && !geo->is_tree()) {
|
||||
ObIWkbGeometry *geo_bin = reinterpret_cast<ObIWkbGeometry *>(geo);
|
||||
wkb = geo_bin->data_;
|
||||
}
|
||||
return wkb;
|
||||
}
|
||||
|
||||
void compare_3d_to_2d_result(ObGeoType geo_type, ObString &wkb_3d, ObString &wkb_2d);
|
||||
void compare_to_3d_wkt_result(ObGeoType geo_type, ObString &wkt_3d, ObString &wkt_3d_res);
|
||||
void check_wkb_is_valid_3d(ObString &wkt, bool is_valid);
|
||||
void check_reserver_coordinate(ObString &wkt);
|
||||
// construct data
|
||||
template<typename T>
|
||||
int append_val(ObStringBuffer &buf, T t, ObGeoWkbByteOrder bo);
|
||||
int append_pointz(ObStringBuffer &buf, double x, double y, double z, ObGeoWkbByteOrder bo);
|
||||
int mock_get_tenant_srs_item(ObIAllocator &allocator, uint64_t srs_id, const ObSrsItem *&srs_item);
|
||||
private:
|
||||
ObArenaAllocator allocator_;
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(TestGeo3D);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
int TestGeo3D::append_val(ObStringBuffer &buf, T t, ObGeoWkbByteOrder bo)
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
if (OB_FAIL(buf.reserve(sizeof(T)))) {
|
||||
} else {
|
||||
char *ptr = buf.ptr() + buf.length();
|
||||
ObGeoWkbByteOrderUtil::write<T>(ptr, t, bo);
|
||||
ret = buf.set_length(buf.length() + sizeof(T));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
template<>
|
||||
int TestGeo3D::append_val(ObStringBuffer &buf, uint8_t t, ObGeoWkbByteOrder bo)
|
||||
{
|
||||
return buf.append(reinterpret_cast<char*>(&t), sizeof(uint8_t));
|
||||
}
|
||||
|
||||
int TestGeo3D::append_pointz(ObStringBuffer &buf, double x, double y, double z, ObGeoWkbByteOrder bo)
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
if (OB_FAIL(append_val<double>(buf, x, bo))) {
|
||||
} else if (OB_FAIL(append_val<double>(buf, y, bo))) {
|
||||
} else if (OB_FAIL(append_val<double>(buf, z, bo))) {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TestGeo3D::compare_3d_to_2d_result(ObGeoType geo_type, ObString &wkt_3d, ObString &wkb_2d)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo_3d = NULL;
|
||||
ObGeometry *geo_2d = NULL;
|
||||
ASSERT_EQ(OB_SUCCESS, ObWktParser::parse_wkt(allocator, wkt_3d, geo_3d, true, false));
|
||||
ASSERT_TRUE(NULL != geo_3d);
|
||||
ASSERT_EQ(geo_3d->type(), geo_type);
|
||||
ASSERT_EQ(OB_SUCCESS, static_cast<ObGeometry3D *>(geo_3d)->to_2d_geo(allocator, geo_2d));
|
||||
ASSERT_TRUE(NULL != geo_2d);
|
||||
ASSERT_EQ(geo_2d->type(), static_cast<ObGeoType>(static_cast<uint32_t>(geo_type) - 1000));
|
||||
ObString wkb_2d_res = to_hex(mock_to_wkb(geo_2d));
|
||||
ASSERT_EQ(wkb_2d_res, wkb_2d);
|
||||
}
|
||||
|
||||
void TestGeo3D::compare_to_3d_wkt_result(ObGeoType geo_type, ObString &wkt_3d, ObString &wkt_3d_res)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo_3d = NULL;
|
||||
ASSERT_EQ(OB_SUCCESS, ObWktParser::parse_wkt(allocator, wkt_3d, geo_3d, true, false));
|
||||
ASSERT_TRUE(NULL != geo_3d);
|
||||
ASSERT_EQ(geo_3d->type(), geo_type);
|
||||
ObString wkt;
|
||||
ASSERT_EQ(OB_SUCCESS, static_cast<ObGeometry3D *>(geo_3d)->to_wkt(allocator, wkt));
|
||||
std::cout<<std::string(wkt.ptr(), wkt.length())<<std::endl;
|
||||
std::cout<<std::string(wkt_3d_res.ptr(), wkt_3d_res.length())<<std::endl;
|
||||
ASSERT_EQ(wkt_3d_res, wkt);
|
||||
}
|
||||
|
||||
void TestGeo3D::check_wkb_is_valid_3d(ObString &wkt, bool expected_valid)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo = NULL;
|
||||
ASSERT_EQ(OB_SUCCESS, ObWktParser::parse_wkt(allocator, wkt, geo, true, false));
|
||||
ObString wkb(geo->length(), geo->val());
|
||||
ObGeometry3D geo_3d;
|
||||
geo_3d.set_data(wkb);
|
||||
bool is_valid = false;
|
||||
if (OB_SUCCESS == geo_3d.check_wkb_valid()) {
|
||||
is_valid = true;
|
||||
} else {
|
||||
is_valid = false;
|
||||
}
|
||||
// std::cout<<std::string(wkt.ptr(), wkt.length())<<std::endl;
|
||||
ASSERT_EQ(is_valid, expected_valid);
|
||||
}
|
||||
|
||||
void TestGeo3D::check_reserver_coordinate(ObString &wkt)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo = NULL;
|
||||
ObString res_wkt;
|
||||
ASSERT_EQ(OB_SUCCESS, ObWktParser::parse_wkt(allocator, wkt, geo, true, false));
|
||||
ObString wkb(geo->length(), geo->val());
|
||||
ObString wkb_copy;
|
||||
ob_write_string(allocator, wkb, wkb_copy);
|
||||
ObGeometry3D geo_3d;
|
||||
geo_3d.set_data(wkb);
|
||||
ASSERT_EQ(OB_SUCCESS, geo_3d.reverse_coordinate());
|
||||
ASSERT_NE(0, MEMCMP(geo_3d.val(), wkb_copy.ptr(), wkb.length()));
|
||||
// ASSERT_EQ(OB_SUCCESS, geo_3d.to_wkt(allocator,res_wkt));
|
||||
// std::cout<<"wkt: "<<std::string(wkt.ptr(), wkt.length())<<std::endl;
|
||||
// std::cout<<"reserver wkt: "<<std::string(res_wkt.ptr(), res_wkt.length())<<std::endl;
|
||||
ASSERT_EQ(OB_SUCCESS, geo_3d.reverse_coordinate());
|
||||
// ASSERT_EQ(OB_SUCCESS, geo_3d.to_wkt(allocator,res_wkt));
|
||||
// ASSERT_EQ(wkt, res_wkt);
|
||||
ASSERT_EQ(0, MEMCMP(geo_3d.val(), wkb_copy.ptr(), wkb.length()));
|
||||
|
||||
}
|
||||
|
||||
int TestGeo3D::mock_get_tenant_srs_item(ObIAllocator &allocator, uint64_t srs_id, const ObSrsItem *&srs_item)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObGeographicRs rs;
|
||||
rs.rs_name.assign_ptr("ED50", strlen("ED50"));
|
||||
rs.datum_info.name.assign_ptr("European Datum 1950", strlen("European Datum 1950"));
|
||||
rs.datum_info.spheroid.name.assign_ptr("International 1924", strlen("International 1924"));
|
||||
rs.datum_info.spheroid.inverse_flattening = 297;
|
||||
rs.datum_info.spheroid.semi_major_axis = 6378388;
|
||||
rs.primem.longtitude = 0;
|
||||
rs.unit.conversion_factor = 0.017453292519943278;
|
||||
rs.axis.x.direction = ObAxisDirection::NORTH;
|
||||
rs.axis.y.direction = ObAxisDirection::EAST;
|
||||
rs.datum_info.towgs84.value[0] = -157.89;
|
||||
rs.datum_info.towgs84.value[1] = -17.16;
|
||||
rs.datum_info.towgs84.value[2] = -78.41;
|
||||
rs.datum_info.towgs84.value[3] = 2.118;
|
||||
rs.datum_info.towgs84.value[4] = 2.697;
|
||||
rs.datum_info.towgs84.value[5] = -1.434;
|
||||
rs.datum_info.towgs84.value[6] = -5.38;
|
||||
rs.authority.is_valid = false;
|
||||
|
||||
ObSpatialReferenceSystemBase *srs_info;
|
||||
if (OB_FAIL(ObSpatialReferenceSystemBase::create_geographic_srs(&allocator, srs_id, &rs, srs_info))) {
|
||||
printf("faild to create geographical srs, ret=%d", ret);
|
||||
}
|
||||
ObSrsItem *tmp_srs_item = NULL;
|
||||
if (OB_ISNULL(tmp_srs_item = OB_NEWx(ObSrsItem, (&allocator), srs_info))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
printf("fail to alloc memory for srs item, ret=%d", ret);
|
||||
} else {
|
||||
srs_item = tmp_srs_item;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
TEST_F(TestGeo3D, test_3d_to_2d)
|
||||
{
|
||||
// point
|
||||
ObString wkt_3d = ObString::make_string("POINT Z (1 1 1)");
|
||||
ObString wkb_2d = ObString::make_string("0101000000000000000000F03F000000000000F03F");
|
||||
compare_3d_to_2d_result(ObGeoType::POINTZ, wkt_3d, wkb_2d);
|
||||
// linestring
|
||||
wkt_3d = ObString::make_string("LINESTRING Z (1 1 1,1 2 1)");
|
||||
wkb_2d = ObString::make_string("010200000002000000000000000000F03F000000000000F03F000000000000F03F0000000000000040");
|
||||
compare_3d_to_2d_result(ObGeoType::LINESTRINGZ, wkt_3d, wkb_2d);
|
||||
// polygon
|
||||
wkt_3d = ObString::make_string("POLYGONZ((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1),(2 2 5 ,2 5 4,5 5 3,5 2 3,2 2 5))");
|
||||
wkb_2d = ObString::make_string("0103000000020000000500000000000000000000000000000000000000000000000000244000000000"
|
||||
"00000000000000000000244000000000000024400000000000000000000000000000244000000000000"
|
||||
"00000000000000000000005000000000000000000004000000000000000400000000000000040000000"
|
||||
"00000014400000000000001440000000000000144000000000000014400000000000000040000000000"
|
||||
"00000400000000000000040");
|
||||
compare_3d_to_2d_result(ObGeoType::POLYGONZ, wkt_3d, wkb_2d);
|
||||
// multipoint
|
||||
wkt_3d = ObString::make_string("MULTIPOINTZ((0 0 0), (2 0 1))");
|
||||
wkb_2d = ObString::make_string("010400000002000000010100000000000000000000000000000000000000010100000000000000000000400000000000000000");
|
||||
compare_3d_to_2d_result(ObGeoType::MULTIPOINTZ, wkt_3d, wkb_2d);
|
||||
// multilinestring
|
||||
wkt_3d = ObString::make_string("MULTILINESTRINGZ((0 0 1, 2 0 2), (1 1 3, 2 2 4))");
|
||||
wkb_2d = ObString::make_string("0105000000020000000102000000020000000000000000000000000000000000000000000000000000"
|
||||
"400000000000000000010200000002000000000000000000F03F000000000000F03F000000000000004"
|
||||
"00000000000000040");
|
||||
compare_3d_to_2d_result(ObGeoType::MULTILINESTRINGZ, wkt_3d, wkb_2d);
|
||||
// multipolygon
|
||||
wkt_3d = ObString::make_string("MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))");
|
||||
wkb_2d = ObString::make_string("0106000000020000000103000000010000000500000000000000000000000000000000000000000000"
|
||||
"00000024400000000000000000000000000000244000000000000024400000000000000000000000000"
|
||||
"00024400000000000000000000000000000000001030000000100000005000000000000000000004000"
|
||||
"00000000000040000000000000004000000000000014400000000000001440000000000000144000000"
|
||||
"00000001440000000000000004000000000000000400000000000000040");
|
||||
compare_3d_to_2d_result(ObGeoType::MULTIPOLYGONZ, wkt_3d, wkb_2d);
|
||||
// geometrycollection
|
||||
wkt_3d = ObString::make_string("GEOMETRYCOLLECTION Z (POINT Z(1 1 1), LINESTRINGZ (0 0 2, 1 1 3), POLYGON Z((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1),(2 2 5 ,2 5 4,5 5 3,5 2 3,2 2 5)), GEOMETRYCOLLECTIONZ(MULTIPOINTZ((0 0 0), (2 0 1)), MULTILINESTRINGZ((0 0 1, 2 0 2), (1 1 3, 2 2 4)), MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3),(2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))))");
|
||||
wkb_2d = ObString::make_string("0107000000040000000101000000000000000000F03F000000000000F03F0102000000020000000000"
|
||||
"0000000000000000000000000000000000000000F03F000000000000F03F01030000000200000005000"
|
||||
"00000000000000000000000000000000000000000000000244000000000000000000000000000002440"
|
||||
"00000000000024400000000000000000000000000000244000000000000000000000000000000000050"
|
||||
"00000000000000000004000000000000000400000000000000040000000000000144000000000000014"
|
||||
"40000000000000144000000000000014400000000000000040000000000000004000000000000000400"
|
||||
"10700000003000000010400000002000000010100000000000000000000000000000000000000010100"
|
||||
"00000000000000000040000000000000000001050000000200000001020000000200000000000000000"
|
||||
"00000000000000000000000000000000000400000000000000000010200000002000000000000000000"
|
||||
"F03F000000000000F03F000000000000004000000000000000400106000000010000000103000000020"
|
||||
"00000050000000000000000000000000000000000000000000000000024400000000000000000000000"
|
||||
"00000024400000000000002440000000000000000000000000000024400000000000000000000000000"
|
||||
"00000000500000000000000000000400000000000000040000000000000004000000000000014400000"
|
||||
"00000000144000000000000014400000000000001440000000000000004000000000000000400000000"
|
||||
"000000040");
|
||||
compare_3d_to_2d_result(ObGeoType::GEOMETRYCOLLECTIONZ, wkt_3d, wkb_2d);
|
||||
|
||||
}
|
||||
|
||||
TEST_F(TestGeo3D, test_to_3d_wkt)
|
||||
{
|
||||
ObString wkt_3d = ObString::make_string("POINT Z (1 1 1)");
|
||||
compare_to_3d_wkt_result(ObGeoType::POINTZ, wkt_3d, wkt_3d);
|
||||
|
||||
wkt_3d = ObString::make_string("LINESTRING Z (1 1 1,1 2 1)");
|
||||
compare_to_3d_wkt_result(ObGeoType::LINESTRINGZ, wkt_3d, wkt_3d);
|
||||
|
||||
wkt_3d = ObString::make_string("POLYGON Z ((0 0 1,10 0 2,10 10 2,0 10 2,0 0 1),(2 2 5,2 5 4,5 5 3,5 2 3,2 2 5))");
|
||||
compare_to_3d_wkt_result(ObGeoType::POLYGONZ, wkt_3d, wkt_3d);
|
||||
|
||||
wkt_3d = ObString::make_string("MULTIPOINT Z ((0 0 0),(2 0 1))");
|
||||
compare_to_3d_wkt_result(ObGeoType::MULTIPOINTZ, wkt_3d, wkt_3d);
|
||||
|
||||
wkt_3d = ObString::make_string("MULTILINESTRING Z ((0 0 1,2 0 2),(1 1 3,2 2 4))");
|
||||
compare_to_3d_wkt_result(ObGeoType::MULTILINESTRINGZ, wkt_3d, wkt_3d);
|
||||
|
||||
wkt_3d = ObString::make_string("MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))");
|
||||
compare_to_3d_wkt_result(ObGeoType::MULTIPOLYGONZ, wkt_3d, wkt_3d);
|
||||
|
||||
|
||||
wkt_3d = ObString::make_string("GEOMETRYCOLLECTION Z (POINT Z (1 1 1),LINESTRING Z (0 0 2,1 1 3),POLYGON Z ((0 0 1"
|
||||
",10 0 2,10 10 2,0 10 2,0 0 1),(2 2 5,2 5 4,5 5 3,5 2 3,2 2 5)),GEOMETRYCOLLECTION Z"
|
||||
" (MULTIPOINT Z ((0 0 0),(2 0 1)),MULTILINESTRING Z ((0 0 1,2 0 2),(1 1 3,2 2 4)),MULTIP"
|
||||
"OLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3),(2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))))");
|
||||
compare_to_3d_wkt_result(ObGeoType::GEOMETRYCOLLECTIONZ, wkt_3d, wkt_3d);
|
||||
wkt_3d = ObString::make_string("GEOMETRYCOLLECTION Z ()");
|
||||
ObString wkt_3d_res = ObString::make_string("GEOMETRYCOLLECTION Z EMPTY");
|
||||
compare_to_3d_wkt_result(ObGeoType::GEOMETRYCOLLECTIONZ, wkt_3d, wkt_3d_res);
|
||||
wkt_3d = ObString::make_string("GEOMETRYCOLLECTION Z EMPTY");
|
||||
compare_to_3d_wkt_result(ObGeoType::GEOMETRYCOLLECTIONZ, wkt_3d, wkt_3d);
|
||||
|
||||
}
|
||||
|
||||
TEST_F(TestGeo3D, test_check_wkb)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObStringBuffer buf(&allocator);
|
||||
ObGeoWkbByteOrder bo = ObGeoWkbByteOrder::LittleEndian;
|
||||
ObGeometry3D geo_3d;
|
||||
// linestring
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint8_t>(buf, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint32_t>(buf, static_cast<uint32_t>(ObGeoType::LINESTRINGZ), bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint32_t>(buf, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_pointz(buf, 1, 1, 1, bo));
|
||||
geo_3d.set_data(buf.string());
|
||||
ASSERT_NE(OB_SUCCESS, geo_3d.check_wkb_valid());
|
||||
|
||||
// linestring
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint8_t>(buf, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint32_t>(buf, static_cast<uint32_t>(ObGeoType::LINESTRINGZ), bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint32_t>(buf, 2, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_pointz(buf, 1, 1, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_pointz(buf, 1, 2, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_pointz(buf, 1, 3, 1, bo));
|
||||
geo_3d.set_data(buf.string());
|
||||
ASSERT_NE(OB_SUCCESS, geo_3d.check_wkb_valid());
|
||||
|
||||
// polygon
|
||||
buf.reset();
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint8_t>(buf, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint32_t>(buf, static_cast<uint32_t>(ObGeoType::POLYGONZ), bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint32_t>(buf, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint32_t>(buf, 3, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_pointz(buf, 1, 1, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_pointz(buf, 1, 2, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_pointz(buf, 1, 3, 1, bo));
|
||||
geo_3d.set_data(buf.string());
|
||||
ASSERT_NE(OB_SUCCESS, geo_3d.check_wkb_valid());
|
||||
}
|
||||
|
||||
TEST_F(TestGeo3D, test_check_wkb_1)
|
||||
{
|
||||
// point
|
||||
ObString wkt_2d = ObString::make_string("POINT(1 1)");
|
||||
check_wkb_is_valid_3d(wkt_2d, false);
|
||||
ObString wkt_3d = ObString::make_string("POINT Z (1 1 1)");
|
||||
check_wkb_is_valid_3d(wkt_3d, true);
|
||||
// linestring
|
||||
wkt_2d = ObString::make_string("LINESTRING (1 1,1 2)");
|
||||
check_wkb_is_valid_3d(wkt_2d, false);
|
||||
wkt_3d = ObString::make_string("LINESTRING Z (1 1 1,1 2 1)");
|
||||
check_wkb_is_valid_3d(wkt_3d, true);
|
||||
// polygon
|
||||
wkt_3d = ObString::make_string("POLYGONZ((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1))");
|
||||
check_wkb_is_valid_3d(wkt_3d, true);
|
||||
wkt_2d = ObString::make_string("POLYGON((0 0,10 0 ,10 10,0 10,0 0))");
|
||||
check_wkb_is_valid_3d(wkt_2d, false);
|
||||
// multi point
|
||||
wkt_3d = ObString::make_string("MULTIPOINTZ((0 0 0), (2 0 1))");
|
||||
check_wkb_is_valid_3d(wkt_3d, true);
|
||||
wkt_2d = ObString::make_string("MULTIPOINT((0 0), (2 0))");
|
||||
check_wkb_is_valid_3d(wkt_2d, false);
|
||||
// multi linestring
|
||||
wkt_3d = ObString::make_string("MULTILINESTRING Z ((0 0 1,2 0 2),(1 1 3,2 2 4))");
|
||||
check_wkb_is_valid_3d(wkt_3d, true);
|
||||
wkt_2d = ObString::make_string("MULTILINESTRING((0 0,2 0),(1 1,2 2))");
|
||||
check_wkb_is_valid_3d(wkt_2d, false);
|
||||
// multi polygon
|
||||
wkt_3d = ObString::make_string("MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))");
|
||||
check_wkb_is_valid_3d(wkt_3d, true);
|
||||
wkt_2d = ObString::make_string("MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)),((2 2,2 5,5 5,5 2,2 2)))");
|
||||
check_wkb_is_valid_3d(wkt_2d, false);
|
||||
// collectionz
|
||||
wkt_3d = ObString::make_string("GEOMETRYCOLLECTION Z (POINT Z (1 1 1),LINESTRING Z (0 0 2,1 1 3),POLYGON Z ((0 0 1"
|
||||
",10 0 2,10 10 2,0 10 2,0 0 1),(2 2 5,2 5 4,5 5 3,5 2 3,2 2 5)),GEOMETRYCOLLECTION Z"
|
||||
" (MULTIPOINT Z ((0 0 0),(2 0 1)),MULTILINESTRING Z ((0 0 1,2 0 2),(1 1 3,2 2 4)),MULTIP"
|
||||
"OLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3),(2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))))");
|
||||
check_wkb_is_valid_3d(wkt_3d, true);
|
||||
wkt_2d = ObString::make_string("GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1),POLYGON((0 0"
|
||||
",10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2)),GEOMETRYCOLLECTION"
|
||||
" (MULTIPOINT(0 0,2 0),MULTILINESTRING((0 0,2 0),(1 1,2 2)),MULTIP"
|
||||
"OLYGON(((0 0,10 0,10 10,0 10,0 0),(2 2,2 5,5 5,5 2,2 2)))))");
|
||||
check_wkb_is_valid_3d(wkt_2d, false);
|
||||
}
|
||||
|
||||
TEST_F(TestGeo3D, test_reserve_coordinate)
|
||||
{
|
||||
ObString wkt_3d = ObString::make_string("POINT Z (1 2 1)");
|
||||
check_reserver_coordinate(wkt_3d);
|
||||
wkt_3d = ObString::make_string("LINESTRING Z (1 2 1,3 4 1)");
|
||||
check_reserver_coordinate(wkt_3d);
|
||||
wkt_3d = ObString::make_string("POLYGONZ((0 1 1,10 0 2 ,10 5 2,0 10 2,0 1 1))");
|
||||
check_reserver_coordinate(wkt_3d);
|
||||
wkt_3d = ObString::make_string("MULTIPOINTZ((0 1 0), (2 0 1))");
|
||||
check_reserver_coordinate(wkt_3d);
|
||||
wkt_3d = ObString::make_string("MULTILINESTRING Z ((0 1 1,2 0 2),(1 2 3,2 3 4))");
|
||||
check_reserver_coordinate(wkt_3d);
|
||||
wkt_3d = ObString::make_string("MULTIPOLYGON Z (((0 1 3,10 0 3,10 5 3,0 10 3,0 1 3)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))");
|
||||
check_reserver_coordinate(wkt_3d);
|
||||
wkt_3d = ObString::make_string("GEOMETRYCOLLECTION Z (POINT Z (1 2 1),LINESTRING Z (0 2 2,1 3 3),POLYGON Z ((0 1 1"
|
||||
",10 0 2,10 5 2,0 10 2,0 1 1),(2 1 5,2 5 4,5 4 3,5 2 3,2 1 5)),GEOMETRYCOLLECTION Z"
|
||||
" (MULTIPOINT Z (0 1 0,2 0 1),MULTILINESTRING Z ((0 1 1,2 0 2),(1 2 3,2 3 4)),MULTIP"
|
||||
"OLYGON Z (((0 1 3,10 0 3,10 5 3,0 10 3,0 1 3),(2 1 3,2 5 3,5 10 3,5 2 3,2 1 3)))))");
|
||||
check_reserver_coordinate(wkt_3d);
|
||||
}
|
||||
|
||||
TEST_F(TestGeo3D, test_coordinate_range)
|
||||
{
|
||||
const ObSrsItem *srs_item = NULL;
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ASSERT_EQ(OB_SUCCESS, mock_get_tenant_srs_item(allocator, 4326, srs_item));
|
||||
ObStringBuffer buf(&allocator);
|
||||
ObGeoWkbByteOrder bo = ObGeoWkbByteOrder::LittleEndian;
|
||||
ObGeometry3D geo_3d;
|
||||
// point valid
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint8_t>(buf, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint32_t>(buf, static_cast<uint32_t>(ObGeoType::POINTZ), bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_pointz(buf, 180 * srs_item->angular_unit(), 89 * srs_item->angular_unit(), 1, bo));
|
||||
geo_3d.set_data(buf.string());
|
||||
ObGeoCoordRangeResult result;
|
||||
ASSERT_EQ(OB_SUCCESS, geo_3d.check_3d_coordinate_range(srs_item, true, result));
|
||||
ASSERT_EQ(result.is_lati_out_range_, false);
|
||||
ASSERT_EQ(result.is_long_out_range_, false);
|
||||
// point invalid
|
||||
buf.reset();
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint8_t>(buf, 1, bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_val<uint32_t>(buf, static_cast<uint32_t>(ObGeoType::POINTZ), bo));
|
||||
ASSERT_EQ(OB_SUCCESS, append_pointz(buf, 181 * srs_item->angular_unit(), 89 * srs_item->angular_unit(), 1, bo));
|
||||
geo_3d.set_data(buf.string());
|
||||
ObGeoCoordRangeResult result1;
|
||||
ASSERT_EQ(OB_SUCCESS, geo_3d.check_3d_coordinate_range(srs_item, true, result));
|
||||
ASSERT_EQ(result.is_lati_out_range_, false);
|
||||
ASSERT_EQ(result.is_long_out_range_, true);
|
||||
ASSERT_TRUE(std::abs(result.value_out_range_ - 181) < 0.001);
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
system("rm -f test_geo_3d.log");
|
||||
OB_LOGGER.set_file_name("test_geo_3d.log");
|
||||
OB_LOGGER.set_log_level("INFO");
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -14,8 +14,14 @@
|
||||
#include "lib/geo/ob_geo_common.h"
|
||||
#include "lib/geo/ob_geo_utils.h"
|
||||
#include "lib/json_type/ob_json_common.h"
|
||||
#include "rpc/obmysql/ob_mysql_global.h"
|
||||
#include "src/pl/ob_pl_user_type.h"
|
||||
#include "src/pl/ob_pl_allocator.h"
|
||||
#include "src/sql/engine/expr/ob_expr_sql_udt_utils.h"
|
||||
#define private public
|
||||
#undef private
|
||||
using namespace oceanbase::pl;
|
||||
using namespace oceanbase::sql;
|
||||
|
||||
namespace oceanbase {
|
||||
namespace common {
|
||||
@ -143,6 +149,158 @@ TEST_F(TestGeoCommon, test_wkb_byte_order_util)
|
||||
}
|
||||
}
|
||||
|
||||
void double_to_number(double d, ObArenaAllocator &allocator, number::ObNumber &num)
|
||||
{
|
||||
char buf[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE] = {0};
|
||||
uint64_t length = ob_gcvt(d, ob_gcvt_arg_type::OB_GCVT_ARG_DOUBLE,
|
||||
sizeof(buf) - 1, buf, NULL);
|
||||
ObString str(sizeof(buf), static_cast<int32_t>(length), buf);
|
||||
ObPrecision res_precision = PRECISION_UNKNOWN_YET;
|
||||
ObScale res_scale = -1;
|
||||
ASSERT_EQ(num.from_sci_opt(str.ptr(), str.length(), allocator, &res_precision, &res_scale), OB_SUCCESS);
|
||||
}
|
||||
|
||||
void build_obj_uint64(uint64_t num, ObArenaAllocator &allocator, ObObj &res) {
|
||||
number::ObNumber nmb;
|
||||
ASSERT_EQ(nmb.from(num, allocator), OB_SUCCESS);
|
||||
res.set_number(nmb);
|
||||
}
|
||||
|
||||
void build_obj_double(double num, ObArenaAllocator &allocator, ObObj &res) {
|
||||
number::ObNumber nmb;
|
||||
double_to_number(num, allocator, nmb);
|
||||
res.set_number(nmb);
|
||||
}
|
||||
|
||||
void mock_write_sdo_elem_info(ObArray<uint64_t> &elem_info, common::ObIAllocator &ctx_allocator, common::ObObj &result)
|
||||
{
|
||||
pl::ObPLVArray *elem_array = reinterpret_cast<pl::ObPLVArray *>(ctx_allocator.alloc(sizeof(pl::ObPLVArray)));
|
||||
ASSERT_EQ(elem_array != NULL, true);
|
||||
pl::ObPLCollAllocator *coll_allocator = reinterpret_cast<pl::ObPLCollAllocator *>(ctx_allocator.alloc(sizeof(pl::ObPLCollAllocator)));
|
||||
ASSERT_EQ(coll_allocator != NULL, true);
|
||||
|
||||
elem_array = new (elem_array) pl::ObPLVArray(300029);
|
||||
coll_allocator = new (coll_allocator) pl::ObPLCollAllocator(elem_array);
|
||||
elem_array->set_allocator(coll_allocator);
|
||||
ObIAllocator *allocator = coll_allocator->get_allocator();
|
||||
uint64_t elem_cnt = elem_info.size();
|
||||
ASSERT_EQ(allocator != NULL, true);
|
||||
ObObj *array_data = reinterpret_cast<ObObj *>(allocator->alloc(sizeof(ObObj) * elem_cnt));
|
||||
ASSERT_EQ(array_data != NULL, true);
|
||||
number::ObNumber elem_num;
|
||||
for (uint64_t i = 0; i < elem_cnt; ++i) {
|
||||
ASSERT_EQ(elem_num.from(elem_info[i], *allocator), OB_SUCCESS);
|
||||
array_data[i].set_number(ObNumberType, elem_num);
|
||||
}
|
||||
|
||||
ObElemDesc elem_desc;
|
||||
elem_array->set_capacity(elem_cnt);
|
||||
elem_array->set_column_count(elem_cnt);
|
||||
elem_array->set_count(elem_cnt);
|
||||
elem_array->set_data(array_data);
|
||||
elem_desc.set_pl_type(PL_VARRAY_TYPE);
|
||||
elem_desc.set_not_null(false);
|
||||
elem_desc.set_field_count(elem_cnt);
|
||||
elem_array->set_element_desc(elem_desc);
|
||||
elem_array->set_first(1);
|
||||
elem_array->set_last(elem_cnt);
|
||||
result.set_extend(reinterpret_cast<int64_t>(elem_array), elem_array->get_type());
|
||||
}
|
||||
|
||||
void mock_write_sdo_ordinates(ObArray<double> &ordinate, common::ObIAllocator &ctx_allocator, common::ObObj &result)
|
||||
{
|
||||
pl::ObPLVArray *elem_array = reinterpret_cast<pl::ObPLVArray *>(ctx_allocator.alloc(sizeof(pl::ObPLVArray)));
|
||||
ASSERT_EQ(elem_array != NULL, true);
|
||||
pl::ObPLCollAllocator *coll_allocator = reinterpret_cast<pl::ObPLCollAllocator *>(ctx_allocator.alloc(sizeof(pl::ObPLCollAllocator)));
|
||||
ASSERT_EQ(coll_allocator != NULL, true);
|
||||
|
||||
elem_array = new (elem_array) pl::ObPLVArray(300028);
|
||||
coll_allocator = new (coll_allocator) pl::ObPLCollAllocator(elem_array);
|
||||
elem_array->set_allocator(coll_allocator);
|
||||
ObIAllocator *allocator = coll_allocator->get_allocator();
|
||||
uint64_t ori_size = ordinate.size();
|
||||
ASSERT_EQ(allocator != NULL, true);
|
||||
ObObj *array_data = reinterpret_cast<ObObj *>(allocator->alloc(sizeof(ObObj) * ori_size));
|
||||
ASSERT_EQ(array_data != NULL, true);
|
||||
number::ObNumber elem_num;
|
||||
for (uint64_t i = 0; i < ori_size; ++i) {
|
||||
ASSERT_EQ(ObJsonBaseUtil::double_to_number(ordinate[i], *allocator, elem_num), OB_SUCCESS);
|
||||
array_data[i].set_number(ObNumberType, elem_num);
|
||||
}
|
||||
|
||||
ObElemDesc elem_desc;
|
||||
elem_array->set_capacity(ori_size);
|
||||
elem_array->set_column_count(ori_size);
|
||||
elem_array->set_count(ori_size);
|
||||
elem_array->set_data(array_data);
|
||||
elem_desc.set_pl_type(PL_VARRAY_TYPE);
|
||||
elem_desc.set_not_null(false);
|
||||
elem_desc.set_field_count(ori_size);
|
||||
elem_array->set_element_desc(elem_desc);
|
||||
elem_array->set_first(1);
|
||||
elem_array->set_last(ori_size);
|
||||
result.set_extend(reinterpret_cast<int64_t>(elem_array), elem_array->get_type());
|
||||
}
|
||||
|
||||
TEST_F(TestGeoCommon, sql_udt_to_wkt)
|
||||
{
|
||||
int ret = 0;
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObObj gtype;
|
||||
build_obj_uint64(2001, allocator, gtype);
|
||||
ObObj srid;
|
||||
build_obj_uint64(4326, allocator, srid);
|
||||
ObObj point_x;
|
||||
build_obj_double(1.23, allocator, point_x);
|
||||
ObObj point_y;
|
||||
build_obj_double(4.56, allocator, point_y);
|
||||
ObObj point_z;
|
||||
build_obj_double(7.89, allocator, point_z);
|
||||
|
||||
QualifiedMap map;
|
||||
ASSERT_EQ(map.create(7, ObModIds::TEST), OB_SUCCESS);
|
||||
ASSERT_EQ(map.set_refactored("SDO_GTYPE", >ype), OB_SUCCESS);
|
||||
ASSERT_EQ(map.set_refactored("SDO_SRID", &srid), OB_SUCCESS);
|
||||
ASSERT_EQ(map.set_refactored("SDO_POINT.X", &point_x), OB_SUCCESS);
|
||||
ASSERT_EQ(map.set_refactored("SDO_POINT.Y", &point_y), OB_SUCCESS);
|
||||
ASSERT_EQ(map.set_refactored("SDO_POINT.Z", &point_z), OB_SUCCESS);
|
||||
|
||||
ObString ewkt;
|
||||
ASSERT_EQ(ObGeoTypeUtil::sql_geo_obj_to_ewkt(map, allocator, ewkt), OB_SUCCESS);
|
||||
ASSERT_EQ(ewkt == "SRID=4326;POINT(1.23 4.56)", true) << ewkt.ptr();
|
||||
|
||||
ObObj elem_info_pl;
|
||||
ObObj elem_info_obj;
|
||||
ObArray<uint64_t> elem_info;
|
||||
ASSERT_EQ(elem_info.push_back(1), OB_SUCCESS);
|
||||
ASSERT_EQ(elem_info.push_back(1), OB_SUCCESS);
|
||||
ASSERT_EQ(elem_info.push_back(1), OB_SUCCESS);
|
||||
mock_write_sdo_elem_info(elem_info, allocator, elem_info_pl);
|
||||
ObString elem_info_str;
|
||||
ASSERT_EQ(ObSqlUdtUtils::cast_pl_varray_to_sql_varray(allocator, elem_info_str, elem_info_pl), OB_SUCCESS);
|
||||
elem_info_obj.set_sql_collection(elem_info_str.ptr(), elem_info_str.length(), 30027);
|
||||
|
||||
ObObj ordinate_pl;
|
||||
ObObj ordinate_obj;
|
||||
ObArray<double> ordinates;
|
||||
ASSERT_EQ(ordinates.push_back(9.87), OB_SUCCESS);
|
||||
ASSERT_EQ(ordinates.push_back(6.54), OB_SUCCESS);
|
||||
mock_write_sdo_ordinates(ordinates, allocator, ordinate_pl);
|
||||
ObString ordinates_str;
|
||||
ASSERT_EQ(ObSqlUdtUtils::cast_pl_varray_to_sql_varray(allocator, ordinates_str, ordinate_pl), OB_SUCCESS);
|
||||
ordinate_obj.set_sql_collection(ordinates_str.ptr(), ordinates_str.length(), 30028);
|
||||
|
||||
QualifiedMap map2;
|
||||
ASSERT_EQ(map2.create(7, ObModIds::TEST), OB_SUCCESS);
|
||||
ASSERT_EQ(map2.set_refactored("SDO_GTYPE", >ype), OB_SUCCESS);
|
||||
ASSERT_EQ(map2.set_refactored("SDO_ELEM_INFO", &elem_info_obj), OB_SUCCESS);
|
||||
ASSERT_EQ(map2.set_refactored("SDO_ORDINATES", &ordinate_obj), OB_SUCCESS);
|
||||
|
||||
ObString ewkt2;
|
||||
ASSERT_EQ(ObGeoTypeUtil::sql_geo_obj_to_ewkt(map2, allocator, ewkt2), OB_SUCCESS);
|
||||
ASSERT_EQ(ewkt2 == "SRID=NULL;POINT(9.87 6.54)", true) << ewkt2.ptr();
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
|
||||
|
||||
468
unittest/share/test_geo_func_box.cpp
Normal file
468
unittest/share/test_geo_func_box.cpp
Normal file
@ -0,0 +1,468 @@
|
||||
/**
|
||||
* Copyright (c) 2021 OceanBase
|
||||
* OceanBase CE is licensed under Mulan PubL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PubL v2.
|
||||
* You may obtain a copy of Mulan PubL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPubL-2.0
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PubL v2 for more details.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <boost/geometry.hpp>
|
||||
#include <boost/geometry/geometries/point_xy.hpp>
|
||||
#include <boost/geometry/geometries/polygon.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#define private public
|
||||
#include "lib/geo/ob_geo_bin.h"
|
||||
#include "lib/geo/ob_geo_tree.h"
|
||||
#include "lib/geo/ob_geo_to_tree_visitor.h"
|
||||
#include "lib/geo/ob_geo_tree_traits.h"
|
||||
#include "lib/geo/ob_geo_bin_traits.h"
|
||||
#include "lib/geo/ob_geo_func_register.h"
|
||||
#include "lib/geo/ob_geo_func_box.h"
|
||||
#include "lib/geo/ob_geo_func_utils.h"
|
||||
#include "lib/json_type/ob_json_common.h"
|
||||
#include "lib/random/ob_random.h"
|
||||
#undef private
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <stdexcept>
|
||||
#include <exception>
|
||||
#include <typeinfo>
|
||||
|
||||
namespace bg = boost::geometry;
|
||||
using namespace oceanbase::common;
|
||||
|
||||
namespace oceanbase
|
||||
{
|
||||
|
||||
namespace common
|
||||
{
|
||||
|
||||
class TestGeoFuncBox : public ::testing::Test
|
||||
{
|
||||
public:
|
||||
TestGeoFuncBox()
|
||||
{}
|
||||
~TestGeoFuncBox()
|
||||
{}
|
||||
virtual void SetUp()
|
||||
{}
|
||||
virtual void TearDown()
|
||||
{}
|
||||
|
||||
static void SetUpTestCase()
|
||||
{}
|
||||
|
||||
static void TearDownTestCase()
|
||||
{}
|
||||
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(TestGeoFuncBox);
|
||||
};
|
||||
|
||||
int append_bo(ObJsonBuffer &data, ObGeoWkbByteOrder bo = ObGeoWkbByteOrder::LittleEndian)
|
||||
{
|
||||
uint8_t sbo = static_cast<uint8_t>(bo);
|
||||
return data.append(reinterpret_cast<char *>(&sbo), sizeof(uint8_t));
|
||||
}
|
||||
|
||||
int append_type(ObJsonBuffer &data, ObGeoType type, ObGeoWkbByteOrder bo = ObGeoWkbByteOrder::LittleEndian)
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
uint32_t stype = static_cast<uint32_t>(type);
|
||||
if (OB_FAIL(data.reserve(sizeof(uint32_t)))) {
|
||||
} else {
|
||||
char *ptr = data.ptr() + data.length();
|
||||
ObGeoWkbByteOrderUtil::write<uint32_t>(ptr, stype, bo);
|
||||
ret = data.set_length(data.length() + sizeof(uint32_t));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int append_uint32(ObJsonBuffer &data, uint32_t val, ObGeoWkbByteOrder bo = ObGeoWkbByteOrder::LittleEndian)
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
if (OB_FAIL(data.reserve(sizeof(uint32_t)))) {
|
||||
} else {
|
||||
char *ptr = data.ptr() + data.length();
|
||||
ObGeoWkbByteOrderUtil::write<uint32_t>(ptr, val, bo);
|
||||
ret = data.set_length(data.length() + sizeof(uint32_t));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int append_double(ObJsonBuffer &data, double val, ObGeoWkbByteOrder bo = ObGeoWkbByteOrder::LittleEndian)
|
||||
{
|
||||
INIT_SUCC(ret);
|
||||
if (OB_FAIL(data.reserve(sizeof(double)))) {
|
||||
} else {
|
||||
char *ptr = data.ptr() + data.length();
|
||||
ObGeoWkbByteOrderUtil::write<double>(ptr, val, bo);
|
||||
ret = data.set_length(data.length() + sizeof(double));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void create_point(ObJsonBuffer &data, double x, double y)
|
||||
{
|
||||
ASSERT_EQ(OB_SUCCESS, append_bo(data));
|
||||
ASSERT_EQ(OB_SUCCESS, append_type(data, ObGeoType::POINT));
|
||||
ASSERT_EQ(OB_SUCCESS, append_double(data, x));
|
||||
ASSERT_EQ(OB_SUCCESS, append_double(data, y));
|
||||
}
|
||||
|
||||
void create_line(ObJsonBuffer &data, std::vector<std::pair<double, double> > &value)
|
||||
{
|
||||
ASSERT_EQ(OB_SUCCESS, append_bo(data));
|
||||
ASSERT_EQ(OB_SUCCESS, append_type(data, ObGeoType::LINESTRING));
|
||||
ASSERT_EQ(OB_SUCCESS, append_uint32(data, value.size()));
|
||||
for (auto &p : value) {
|
||||
ASSERT_EQ(OB_SUCCESS, append_double(data, p.first));
|
||||
ASSERT_EQ(OB_SUCCESS, append_double(data, p.second));
|
||||
}
|
||||
}
|
||||
|
||||
void create_polygon(ObJsonBuffer &data, int lnum, int pnum, std::vector<std::pair<double, double> > &value)
|
||||
{
|
||||
ASSERT_EQ(OB_SUCCESS, append_bo(data));
|
||||
ASSERT_EQ(OB_SUCCESS, append_type(data, ObGeoType::POLYGON));
|
||||
ASSERT_EQ(OB_SUCCESS, append_uint32(data, lnum));
|
||||
int i = 0;
|
||||
for (int l = 0; l < lnum; l++) {
|
||||
ASSERT_EQ(OB_SUCCESS, append_uint32(data, pnum));
|
||||
for (int p = 0; p < pnum; p++) {
|
||||
ASSERT_EQ(OB_SUCCESS, append_double(data, value[i].first));
|
||||
ASSERT_EQ(OB_SUCCESS, append_double(data, value[i].second));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void create_multipoint(ObJsonBuffer &data, std::vector<std::pair<double, double> > &value)
|
||||
{
|
||||
ASSERT_EQ(OB_SUCCESS, append_bo(data));
|
||||
ASSERT_EQ(OB_SUCCESS, append_type(data, ObGeoType::MULTIPOINT));
|
||||
ASSERT_EQ(OB_SUCCESS, append_uint32(data, value.size()));
|
||||
for (auto &p : value) {
|
||||
create_point(data, p.first, p.second);
|
||||
}
|
||||
}
|
||||
|
||||
void create_multiline(ObJsonBuffer &data, int lnum, int pnum, std::vector<std::pair<double, double> > &value)
|
||||
{
|
||||
ASSERT_EQ(OB_SUCCESS, append_bo(data));
|
||||
ASSERT_EQ(OB_SUCCESS, append_type(data, ObGeoType::MULTILINESTRING));
|
||||
ASSERT_EQ(OB_SUCCESS, append_uint32(data, lnum));
|
||||
int i = 0;
|
||||
for (int l = 0; l < lnum; l++) {
|
||||
ASSERT_EQ(OB_SUCCESS, append_bo(data));
|
||||
ASSERT_EQ(OB_SUCCESS, append_type(data, ObGeoType::LINESTRING));
|
||||
ASSERT_EQ(OB_SUCCESS, append_uint32(data, pnum));
|
||||
for (int p = 0; p < pnum; p++) {
|
||||
ASSERT_EQ(OB_SUCCESS, append_double(data, value[i].first));
|
||||
ASSERT_EQ(OB_SUCCESS, append_double(data, value[i].second));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// anum: polygon num; rnum: ring num per polygon; pnum: point num per ring
|
||||
void create_multipolygon(
|
||||
ObJsonBuffer &data, int anum, int rnum, int pnum, std::vector<std::pair<double, double> > &value)
|
||||
{
|
||||
ASSERT_EQ(OB_SUCCESS, append_bo(data));
|
||||
ASSERT_EQ(OB_SUCCESS, append_type(data, ObGeoType::MULTIPOLYGON));
|
||||
ASSERT_EQ(OB_SUCCESS, append_uint32(data, anum));
|
||||
int i = 0;
|
||||
for (int a = 0; a < anum; a++) {
|
||||
ASSERT_EQ(OB_SUCCESS, append_bo(data));
|
||||
ASSERT_EQ(OB_SUCCESS, append_type(data, ObGeoType::POLYGON));
|
||||
ASSERT_EQ(OB_SUCCESS, append_uint32(data, rnum));
|
||||
for (int r = 0; r < rnum; r++) {
|
||||
ASSERT_EQ(OB_SUCCESS, append_uint32(data, pnum));
|
||||
for (int p = 0; p < pnum; p++) {
|
||||
ASSERT_EQ(OB_SUCCESS, append_double(data, value[i].first));
|
||||
ASSERT_EQ(OB_SUCCESS, append_double(data, value[i].second));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename GEO1, typename GEO2>
|
||||
bool is_geo_equal(GEO1 &geo1, GEO2 &geo2)
|
||||
{
|
||||
std::stringstream left;
|
||||
std::stringstream right;
|
||||
left << bg::dsv(geo1);
|
||||
right << bg::dsv(geo2);
|
||||
if (left.str() == right.str()) {
|
||||
return true;
|
||||
}
|
||||
std::cout << left.str() << std::endl;
|
||||
std::cout << right.str() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
typedef bg::strategy::within::geographic_winding<ObWkbGeogPoint> ObPlPaStrategy;
|
||||
typedef bg::strategy::intersection::geographic_segments<> ObLlLaAaStrategy;
|
||||
|
||||
typedef bg::model::d2::point_xy<double> point_geom_t;
|
||||
typedef bg::model::multi_point<point_geom_t> mpoint_geom_t;
|
||||
typedef bg::model::linestring<point_geom_t> line_geom_t;
|
||||
typedef bg::model::multi_linestring<line_geom_t> mline_geom_t;
|
||||
typedef bg::model::polygon<point_geom_t, false> polygon_geom_t;
|
||||
typedef bg::model::multi_polygon<polygon_geom_t> mpolygon_geom_t;
|
||||
|
||||
typedef bg::model::d2::point_xy<double, bg::cs::geographic<bg::radian> > point_geog_t;
|
||||
typedef bg::model::multi_point<point_geog_t> mpoint_geog_t;
|
||||
typedef bg::model::linestring<point_geog_t> line_geog_t;
|
||||
typedef bg::model::multi_linestring<line_geog_t> mline_geog_t;
|
||||
typedef bg::model::polygon<point_geog_t, false> polygon_geog_t;
|
||||
typedef bg::model::multi_polygon<polygon_geog_t> mpolygon_geog_t;
|
||||
|
||||
TEST_F(TestGeoFuncBox, geom_point)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObJsonBuffer data(&allocator);
|
||||
double x = 1.2;
|
||||
double y = 3.5;
|
||||
create_point(data, x, y);
|
||||
ObIWkbGeomPoint p;
|
||||
p.set_data(data.string());
|
||||
|
||||
ObGeoEvalCtx gis_context(&allocator);
|
||||
gis_context.ut_set_geo_count(1);
|
||||
gis_context.ut_set_geo_arg(0, &p);
|
||||
ObGeogBox *result = NULL;
|
||||
int ret = ObGeoFunc<ObGeoFuncType::Box>::geo_func::eval(gis_context, result);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_TRUE(result != NULL);
|
||||
ASSERT_EQ(x, result->xmax);
|
||||
ASSERT_EQ(x, result->xmin);
|
||||
ASSERT_EQ(y, result->ymax);
|
||||
ASSERT_EQ(y, result->ymin);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoFuncBox, geom_linestring)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObJsonBuffer data(&allocator);
|
||||
std::vector<std::pair<double, double> > val;
|
||||
val.push_back(std::make_pair(1.5, 1.2));
|
||||
val.push_back(std::make_pair(2.0, 4.0));
|
||||
create_line(data, val);
|
||||
ObIWkbGeomLineString line;
|
||||
line.set_data(data.string());
|
||||
|
||||
ObGeoEvalCtx gis_context(&allocator);
|
||||
gis_context.ut_set_geo_count(1);
|
||||
gis_context.ut_set_geo_arg(0, &line);
|
||||
ObGeogBox *result = NULL;
|
||||
int ret = ObGeoFunc<ObGeoFuncType::Box>::geo_func::eval(gis_context, result);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_TRUE(result != NULL);
|
||||
ASSERT_EQ(2.0, result->xmax);
|
||||
ASSERT_EQ(1.5, result->xmin);
|
||||
ASSERT_EQ(4.0, result->ymax);
|
||||
ASSERT_EQ(1.2, result->ymin);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoFuncBox, geom_polygon)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObJsonBuffer data(&allocator);
|
||||
std::vector<std::pair<double, double> > pol_val;
|
||||
pol_val.push_back(std::make_pair(1, 1));
|
||||
pol_val.push_back(std::make_pair(1, 3));
|
||||
pol_val.push_back(std::make_pair(3, 3));
|
||||
pol_val.push_back(std::make_pair(3, 1));
|
||||
pol_val.push_back(std::make_pair(1, 1));
|
||||
create_polygon(data, 1, 5, pol_val);
|
||||
ObIWkbGeomPolygon poly;
|
||||
poly.set_data(data.string());
|
||||
|
||||
ObGeoEvalCtx gis_context(&allocator);
|
||||
gis_context.ut_set_geo_count(1);
|
||||
gis_context.ut_set_geo_arg(0, &poly);
|
||||
ObGeogBox *result = NULL;
|
||||
int ret = ObGeoFunc<ObGeoFuncType::Box>::geo_func::eval(gis_context, result);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_TRUE(result != NULL);
|
||||
ASSERT_EQ(1.0, result->xmin);
|
||||
ASSERT_EQ(3.0, result->xmax);
|
||||
ASSERT_EQ(1.0, result->ymin);
|
||||
ASSERT_EQ(3.0, result->ymax);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoFuncBox, geom_multipoint)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
|
||||
ObJsonBuffer data1(&allocator);
|
||||
std::vector<std::pair<double, double> > val;
|
||||
val.push_back(std::make_pair(1.0, 1.0));
|
||||
val.push_back(std::make_pair(1.0, 0.0));
|
||||
val.push_back(std::make_pair(1.0, 2.0));
|
||||
create_multipoint(data1, val);
|
||||
ObIWkbGeomMultiPoint multi_point;
|
||||
multi_point.set_data(data1.string());
|
||||
|
||||
ObGeoEvalCtx gis_context(&allocator);
|
||||
gis_context.ut_set_geo_count(1);
|
||||
gis_context.ut_set_geo_arg(0, &multi_point);
|
||||
ObGeogBox *result = NULL;
|
||||
int ret = ObGeoFunc<ObGeoFuncType::Box>::geo_func::eval(gis_context, result);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_TRUE(result != NULL);
|
||||
ASSERT_EQ(1.0, result->xmin);
|
||||
ASSERT_EQ(1.0, result->xmax);
|
||||
ASSERT_EQ(0.0, result->ymin);
|
||||
ASSERT_EQ(2.0, result->ymax);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoFuncBox, geom_multilinestring)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
|
||||
ObJsonBuffer data1(&allocator);
|
||||
std::vector<std::pair<double, double> > val;
|
||||
val.push_back(std::make_pair(0.0, 0.0));
|
||||
val.push_back(std::make_pair(1.0, 1.0));
|
||||
val.push_back(std::make_pair(1.0, 1.0));
|
||||
val.push_back(std::make_pair(2.0, 2.0));
|
||||
val.push_back(std::make_pair(2.0, 2.0));
|
||||
val.push_back(std::make_pair(3.0, 3.0));
|
||||
create_multiline(data1, 3, 2, val);
|
||||
ObIWkbGeomMultiLineString multi_line;
|
||||
multi_line.set_data(data1.string());
|
||||
|
||||
ObGeoEvalCtx gis_context(&allocator);
|
||||
gis_context.ut_set_geo_count(1);
|
||||
gis_context.ut_set_geo_arg(0, &multi_line);
|
||||
ObGeogBox *result = NULL;
|
||||
int ret = ObGeoFunc<ObGeoFuncType::Box>::geo_func::eval(gis_context, result);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_TRUE(result != NULL);
|
||||
ASSERT_EQ(0.0, result->xmin);
|
||||
ASSERT_EQ(3.0, result->xmax);
|
||||
ASSERT_EQ(0.0, result->ymin);
|
||||
ASSERT_EQ(3.0, result->ymax);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoFuncBox, geom_multipolygon)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
|
||||
ObJsonBuffer data1(&allocator);
|
||||
std::vector<std::pair<double, double> > val;
|
||||
val.push_back(std::make_pair(1.0, 1.0));
|
||||
val.push_back(std::make_pair(1.0, 3.0));
|
||||
val.push_back(std::make_pair(3.0, 3.0));
|
||||
val.push_back(std::make_pair(3.0, 1.0));
|
||||
val.push_back(std::make_pair(1.0, 1.0));
|
||||
val.push_back(std::make_pair(4.0, 4.0));
|
||||
val.push_back(std::make_pair(4.0, 6.0));
|
||||
val.push_back(std::make_pair(6.0, 6.0));
|
||||
val.push_back(std::make_pair(6.0, 4.0));
|
||||
val.push_back(std::make_pair(4.0, 4.0));
|
||||
create_multipolygon(data1, 2, 1, 5, val);
|
||||
ObIWkbGeomMultiPolygon multi_poly;
|
||||
multi_poly.set_data(data1.string());
|
||||
|
||||
ObGeoEvalCtx gis_context(&allocator);
|
||||
gis_context.ut_set_geo_count(1);
|
||||
gis_context.ut_set_geo_arg(0, &multi_poly);
|
||||
ObGeogBox *result = NULL;
|
||||
int ret = ObGeoFunc<ObGeoFuncType::Box>::geo_func::eval(gis_context, result);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_TRUE(result != NULL);
|
||||
ASSERT_EQ(1.0, result->xmin);
|
||||
ASSERT_EQ(6.0, result->xmax);
|
||||
ASSERT_EQ(1.0, result->ymin);
|
||||
ASSERT_EQ(6.0, result->ymax);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoFuncBox, geom_collection)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObJsonBuffer data(&allocator);
|
||||
ASSERT_EQ(OB_SUCCESS, append_bo(data));
|
||||
ASSERT_EQ(OB_SUCCESS, append_type(data, ObGeoType::GEOMETRYCOLLECTION));
|
||||
ASSERT_EQ(OB_SUCCESS, append_uint32(data, 6));
|
||||
|
||||
create_point(data, 1.2, 3.5);
|
||||
|
||||
std::vector<std::pair<double, double> > line_val;
|
||||
line_val.push_back(std::make_pair(1.5, 1.2));
|
||||
line_val.push_back(std::make_pair(2.0, 4.0));
|
||||
create_line(data, line_val);
|
||||
|
||||
std::vector<std::pair<double, double> > pol_val;
|
||||
pol_val.push_back(std::make_pair(1, 1));
|
||||
pol_val.push_back(std::make_pair(1, 3));
|
||||
pol_val.push_back(std::make_pair(3, 3));
|
||||
pol_val.push_back(std::make_pair(3, 1));
|
||||
pol_val.push_back(std::make_pair(1, 1));
|
||||
create_polygon(data, 1, 5, pol_val);
|
||||
|
||||
std::vector<std::pair<double, double> > mpt_val;
|
||||
mpt_val.push_back(std::make_pair(1.0, 1.0));
|
||||
mpt_val.push_back(std::make_pair(1.0, 0.0));
|
||||
mpt_val.push_back(std::make_pair(1.0, 2.0));
|
||||
create_multipoint(data, mpt_val);
|
||||
|
||||
std::vector<std::pair<double, double> > mpl_val;
|
||||
mpl_val.push_back(std::make_pair(0.0, 0.0));
|
||||
mpl_val.push_back(std::make_pair(1.0, 1.0));
|
||||
mpl_val.push_back(std::make_pair(1.0, 1.0));
|
||||
mpl_val.push_back(std::make_pair(2.0, 2.0));
|
||||
mpl_val.push_back(std::make_pair(2.0, 2.0));
|
||||
mpl_val.push_back(std::make_pair(3.0, 3.0));
|
||||
create_multiline(data, 3, 2, mpl_val);
|
||||
|
||||
std::vector<std::pair<double, double> > mpy_val;
|
||||
mpy_val.push_back(std::make_pair(1.0, 1.0));
|
||||
mpy_val.push_back(std::make_pair(1.0, 3.0));
|
||||
mpy_val.push_back(std::make_pair(3.0, 3.0));
|
||||
mpy_val.push_back(std::make_pair(3.0, 1.0));
|
||||
mpy_val.push_back(std::make_pair(1.0, 1.0));
|
||||
mpy_val.push_back(std::make_pair(4.0, 4.0));
|
||||
mpy_val.push_back(std::make_pair(4.0, 6.0));
|
||||
mpy_val.push_back(std::make_pair(6.0, 6.0));
|
||||
mpy_val.push_back(std::make_pair(6.0, 4.0));
|
||||
mpy_val.push_back(std::make_pair(4.0, 4.0));
|
||||
create_multipolygon(data, 2, 1, 5, mpy_val);
|
||||
|
||||
ObIWkbGeomCollection collection;
|
||||
collection.set_data(data.string());
|
||||
|
||||
ObGeoEvalCtx gis_context(&allocator);
|
||||
gis_context.ut_set_geo_count(1);
|
||||
gis_context.ut_set_geo_arg(0, &collection);
|
||||
ObGeogBox *result = NULL;
|
||||
int ret = ObGeoFunc<ObGeoFuncType::Box>::geo_func::eval(gis_context, result);
|
||||
ASSERT_EQ(OB_SUCCESS, ret);
|
||||
ASSERT_TRUE(result != NULL);
|
||||
ASSERT_EQ(0.0, result->xmin);
|
||||
ASSERT_EQ(6.0, result->xmax);
|
||||
ASSERT_EQ(0.0, result->ymin);
|
||||
ASSERT_EQ(6.0, result->ymax);
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
// system("rm -f test_geo_func_box.log");
|
||||
// OB_LOGGER.set_file_name("test_geo_func_box.log");
|
||||
// OB_LOGGER.set_log_level("INFO");
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
@ -2164,7 +2164,6 @@ TEST_F(TestGeoFuncUnion, gc_split)
|
||||
ASSERT_EQ(true, is_geo_equal(*res_multi_line, *multi_line_tree));
|
||||
ASSERT_EQ(true, is_geo_equal(*res_multi_poly, *multi_poly_tree));
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
|
||||
|
||||
@ -20,6 +20,13 @@
|
||||
#include "lib/geo/ob_geo_bin_traits.h"
|
||||
#include "lib/json_type/ob_json_common.h"
|
||||
#include "lib/random/ob_random.h"
|
||||
#include "lib/geo/ob_geo_utils.h"
|
||||
#include "lib/geo/ob_geo_box_clip_visitor.h"
|
||||
#include "lib/geo/ob_geo_to_tree_visitor.h"
|
||||
#include "lib/geo/ob_geo_to_wkt_visitor.h"
|
||||
#include "sql/engine/expr/ob_geo_expr_utils.h"
|
||||
#include "lib/geo/ob_wkt_parser.h"
|
||||
#include "lib/geo/ob_geo_common.h"
|
||||
#undef private
|
||||
|
||||
#include <sys/time.h>
|
||||
@ -624,7 +631,304 @@ TEST_F(TestGeoTree, intersection_op)
|
||||
}
|
||||
}
|
||||
|
||||
void wkt_to_tree_geo(const ObString &wkt, ObArenaAllocator &allocator, ObGeometry *&geo_tree)
|
||||
{
|
||||
ObGeometry *geo = nullptr;
|
||||
ASSERT_EQ(ObWktParser::parse_wkt(allocator, wkt, geo, true, false), OB_SUCCESS);
|
||||
ObGeoToTreeVisitor tree_visitor(&allocator);
|
||||
ASSERT_EQ(geo->do_visit(tree_visitor), OB_SUCCESS);
|
||||
geo_tree = tree_visitor.get_geometry();
|
||||
}
|
||||
|
||||
void tree_geo_to_wkt(ObArenaAllocator &allocator, ObGeometry *geo_tree, ObString &wkt_cal)
|
||||
{
|
||||
bool is_geo_empty = false;
|
||||
ASSERT_EQ(sql::ObGeoExprUtils::check_empty(geo_tree, is_geo_empty), OB_SUCCESS);
|
||||
if (is_geo_empty) {
|
||||
wkt_cal = "EMPTY";
|
||||
} else {
|
||||
ObGeometry *geo_bin = NULL;
|
||||
ASSERT_EQ(ObGeoTypeUtil::tree_to_bin(allocator, geo_tree, geo_bin, nullptr), OB_SUCCESS);
|
||||
ObGeoToWktVisitor visitor(&allocator);
|
||||
ASSERT_EQ(geo_bin->do_visit(visitor), OB_SUCCESS);
|
||||
visitor.get_wkt(wkt_cal);
|
||||
}
|
||||
}
|
||||
|
||||
void clip_visitor_test(const ObString &wkt, const ObString &wkt_res, ObGeogBox &box)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo_tree = nullptr;
|
||||
wkt_to_tree_geo(wkt, allocator, geo_tree);
|
||||
|
||||
ObGeometry *geo_res = nullptr;
|
||||
ObGeoBoxClipVisitor clip_visitor(box, allocator);
|
||||
ASSERT_EQ(geo_tree->do_visit(clip_visitor), OB_SUCCESS);
|
||||
ASSERT_EQ(clip_visitor.get_geometry(geo_res), OB_SUCCESS);
|
||||
ASSERT_EQ(geo_res == nullptr, false);
|
||||
|
||||
ObString wkt_cal;
|
||||
tree_geo_to_wkt(allocator, geo_res, wkt_cal);
|
||||
ASSERT_EQ(wkt_cal == wkt_res, true);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoTree, clip_visitor)
|
||||
{
|
||||
ObGeogBox box1 = {0, 10, 0, 10, 0, 0};
|
||||
// linestring
|
||||
clip_visitor_test("LINESTRING(1 1,1 9,9 9,9 1)", "LINESTRING(1 1,1 9,9 9,9 1)", box1);
|
||||
clip_visitor_test("LINESTRING(-1 -9,-1 11,9 11)", "EMPTY", box1);
|
||||
clip_visitor_test("LINESTRING(-1 5,5 5,9 9)", "LINESTRING(0 5,5 5,9 9)", box1);
|
||||
clip_visitor_test("LINESTRING(5 5,8 5,12 5)", "LINESTRING(5 5,8 5,10 5)", box1);
|
||||
clip_visitor_test("LINESTRING(5 -1,5 5,1 2,-3 2,1 6)", "MULTILINESTRING((5 0,5 5,1 2,0 2),(0 5,1 6))", box1);
|
||||
clip_visitor_test("LINESTRING(0 3,0 5,0 7)", "EMPTY", box1);
|
||||
clip_visitor_test("LINESTRING(0 3,0 5,-1 7)", "EMPTY", box1);
|
||||
clip_visitor_test("LINESTRING(0 3,0 5,2 7)", "LINESTRING(0 5,2 7)", box1);
|
||||
clip_visitor_test("LINESTRING(2 1,0 0,1 2)", "LINESTRING(2 1,0 0,1 2)", box1);
|
||||
clip_visitor_test("LINESTRING(3 3,0 3,0 5,2 7)", "MULTILINESTRING((3 3,0 3),(0 5,2 7))", box1);
|
||||
clip_visitor_test("LINESTRING(5 5,10 5,20 5)", "LINESTRING(5 5,10 5)", box1);
|
||||
clip_visitor_test("LINESTRING(3 3,0 6,3 9)", "LINESTRING(3 3,0 6,3 9)", box1);
|
||||
clip_visitor_test("LINESTRING(-1 -1,3 1,3 3,-1 -1)", "LINESTRING(1 0,3 1,3 3,0 0)", box1);
|
||||
|
||||
// polygon
|
||||
clip_visitor_test("POLYGON((5 5,5 6,6 6,6 5,5 5))", "POLYGON((5 5,5 6,6 6,6 5,5 5))", box1);
|
||||
clip_visitor_test("POLYGON((15 15,15 16,16 16,16 15,15 15))", "EMPTY", box1);
|
||||
clip_visitor_test("POLYGON((-1 -1,-1 11,11 11,11 -1,-1 -1))", "POLYGON((0 0,0 10,10 10,10 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((-1 -1,-1 5,5 5,5 -1,-1 -1))", "POLYGON((0 0,0 5,5 5,5 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((-2 -2,-2 5,5 5,5 -2,-2 -2), (3 3,4 4,4 2,3 3))", "POLYGON((0 0,0 5,5 5,5 0,0 0),(3 3,4 4,4 2,3 3))", box1);
|
||||
clip_visitor_test("POLYGON((-2 -2,-2 5,5 5,5 -2,-2 -2), (-1 -1,3 1,3 3,-1 -1))",
|
||||
"POLYGON((0 0,0 5,5 5,5 0,1 0,3 1,3 3,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((0 0,10 0,5 10,0 0))", "POLYGON((0 0,5 10,10 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((5 10,0 0,10 0,5 10))", "POLYGON((0 0,5 10,10 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((-5 -5,5 5,5 -5,-5 -5))", "POLYGON((0 0,5 5,5 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((0 0,0 10,10 10,0 0))", "POLYGON((0 0,0 10,10 10,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((0 5,0 10,10 10,0 5))", "POLYGON((0 5,0 10,10 10,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((0 10,10 10,5 0,0 10))", "POLYGON((0 10,10 10,5 0,0 10))", box1);
|
||||
clip_visitor_test("POLYGON((0 10,10 10,5 5,0 10))", "POLYGON((0 10,10 10,5 5,0 10))", box1);
|
||||
clip_visitor_test("POLYGON((0 10,5 10,0 5,0 10))", "POLYGON((0 5,0 10,5 10,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((0 10,10 5,0 5,0 10))", "POLYGON((0 5,0 10,10 5,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((0 10,10 0,0 5,0 10))", "POLYGON((0 5,0 10,10 0,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((0 10,5 0,0 5,0 10))", "POLYGON((0 5,0 10,5 0,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((0 10,5 5,0 5,0 10))", "POLYGON((0 5,0 10,5 5,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((0 10,7 7,3 3,0 10))", "POLYGON((0 10,7 7,3 3,0 10))", box1);
|
||||
clip_visitor_test("POLYGON((0 10,5 5,5 0,0 10))", "POLYGON((0 10,5 5,5 0,0 10))", box1);
|
||||
clip_visitor_test("POLYGON((0 10,10 5,5 0,0 10))", "POLYGON((0 10,10 5,5 0,0 10))", box1);
|
||||
clip_visitor_test("POLYGON((2 5,5 10,7 5,2 5))",
|
||||
"POLYGON((2 5,5 10,7 5,2 5))", box1);
|
||||
clip_visitor_test("POLYGON((0 5,5 10,5 5,0 5))",
|
||||
"POLYGON((0 5,5 10,5 5,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((0 5,5 10,10 5,0 5))",
|
||||
"POLYGON((0 5,5 10,10 5,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((0 5,5 7,10 5,0 5))",
|
||||
"POLYGON((0 5,5 7,10 5,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((-5 10,0 15,0 10,-5 10))", "EMPTY", box1);
|
||||
clip_visitor_test("POLYGON((-5 10,0 5,-5 0,-5 10))", "EMPTY", box1);
|
||||
clip_visitor_test("POLYGON((-5 5,0 10,0 0,-5 5))", "EMPTY", box1);
|
||||
clip_visitor_test("POLYGON((-5 5,0 10,0 5,-5 5))", "EMPTY", box1);
|
||||
clip_visitor_test("POLYGON((-5 5,0 7,0 3,-5 5))", "EMPTY", box1);
|
||||
clip_visitor_test("POLYGON((5 5,-5 0,-5 10,5 5))",
|
||||
"POLYGON((0 2.5,0 7.5,5 5,0 2.5))", box1);
|
||||
clip_visitor_test("POLYGON((5 0,-5 0,-5 10,5 0))",
|
||||
"POLYGON((0 0,0 5,5 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((10 0,-10 0,-10 10,10 0))",
|
||||
"POLYGON((0 0,0 5,10 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((5 0,-5 5,-5 10,5 0))",
|
||||
"POLYGON((0 2.5,0 5,5 0,0 2.5))", box1);
|
||||
clip_visitor_test("POLYGON((10 5,-10 0,-10 10,10 5))",
|
||||
"POLYGON((0 2.5,0 7.5,10 5,0 2.5))", box1);
|
||||
clip_visitor_test("POLYGON((10 10,-10 0,-10 5,10 10))",
|
||||
"POLYGON((0 5,0 7.5,10 10,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((5 5,-5 -5,-5 15,5 5))",
|
||||
"POLYGON((0 0,0 10,5 5,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((10 5,-10 -5,-10 15,10 5))",
|
||||
"POLYGON((0 0,0 10,10 5,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((5 0,-5 0,-5 20,5 0))",
|
||||
"POLYGON((0 0,0 10,5 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((10 0,-10 0,-10 20,10 0))",
|
||||
"POLYGON((0 0,0 10,10 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((5 5,-10 5,0 15,5 5))",
|
||||
"POLYGON((0 5,0 10,2.5 10,5 5,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((5 5,-5 -5,0 15,5 5))",
|
||||
"POLYGON((0 0,0 10,2.5 10,5 5,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((5 5,-15 -20,-15 30,5 5))",
|
||||
"POLYGON((0 0,0 10,1 10,5 5,1 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((5 7,5 3,-5 5,5 7))",
|
||||
"POLYGON((0 4,0 6,5 7,5 3,0 4))", box1);
|
||||
clip_visitor_test("POLYGON((5 7,5 3,-5 13,5 7))",
|
||||
"POLYGON((0 8,0 10,5 7,5 3,0 8))", box1);
|
||||
clip_visitor_test("POLYGON((6 6,4 4,-4 14,6 6))",
|
||||
"POLYGON((0 9,0 10,1.0000000000000007 10,6 6,4 4,0 9))", box1);
|
||||
clip_visitor_test("POLYGON((-2 -2,-2 12,12 12,12 -2,-2 -2),(-1 -1,11 -1,11 11,-1 11,-1 -1))",
|
||||
"EMPTY", box1);
|
||||
clip_visitor_test("POLYGON((-2 -2,-2 12,12 12,12 -2,-2 -2),(1 1,9 1,9 9,1 9,1 1))",
|
||||
"POLYGON((0 0,0 10,10 10,10 0,0 0),(1 1,9 1,9 9,1 9,1 1))", box1);
|
||||
clip_visitor_test("POLYGON((5 5,15 5,15 -5,5 -5,5 5),(8 1,8 -1,9 -1,9 1,8 1))",
|
||||
"POLYGON((5 0,5 5,10 5,10 0,9 0,9 1,8 1,8 0,5 0))", box1);
|
||||
clip_visitor_test("POLYGON((-6 5,5 5,5 -6,-6 5))",
|
||||
"POLYGON((0 0,0 5,5 5,5 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((-15 -15,-15 15,15 15,15 -15,-15 -15),(-5 5,-5 -5,5 -5,5 5,-5 5))",
|
||||
"POLYGON((0 5,0 10,10 10,10 0,5 0,5 5,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((-15 -15,-15 15,15 15,15 -15,-15 -15),(-6 5,5 -6,5 5,-6 5))",
|
||||
"POLYGON((0 5,0 10,10 10,10 0,5 0,5 5,0 5))", box1);
|
||||
clip_visitor_test("POLYGON((-15 -15,-15 15,15 15,15 -15,-15 -15),(-5 5,-6 5,-6 6,-5 6,-5 5))",
|
||||
"POLYGON((0 0,0 10,10 10,10 0,0 0))", box1);
|
||||
clip_visitor_test("POLYGON((-15 -15,-15 15,15 15,15 -15,-15 -15),(0 5,-1 5,-1 6,0 6,0 5))",
|
||||
"POLYGON((0 0,0 10,10 10,10 0,0 0))", box1);
|
||||
ObGeogBox box2 = {10, 100, 10, 100, 0, 0};
|
||||
clip_visitor_test("POLYGON((50 50,200 50,200 200,50 200,50 50))", // CCW
|
||||
"POLYGON((50 50,50 100,100 100,100 50,50 50))", box2);
|
||||
clip_visitor_test("POLYGON((50 50,50 200,200 200,200 50,50 50))", // CW
|
||||
"POLYGON((50 50,50 100,100 100,100 50,50 50))", box2);
|
||||
// box1
|
||||
clip_visitor_test("POLYGON("
|
||||
"(-10 2,-10 8,8 8,8 2,-10 2)," // CW
|
||||
"(-5 6,-5 4,5 4,5 6,-5 6)" // CCW
|
||||
")",
|
||||
"POLYGON((0 2,0 4,5 4,5 6,0 6,0 8,8 8,8 2,0 2))", box1);
|
||||
clip_visitor_test("POLYGON("
|
||||
"(-10 2,-10 8,8 8,8 2,-10 2)," // CW
|
||||
"(-5 6,5 6,5 4,-5 4,-5 6)" // CW
|
||||
")",
|
||||
"POLYGON((0 2,0 4,5 4,5 6,0 6,0 8,8 8,8 2,0 2))", box1);
|
||||
clip_visitor_test("POLYGON("
|
||||
"(-10 2,8 2,8 8,-10 8,-10 2)," // CCW
|
||||
"(-5 6,5 6,5 4,-5 4,-5 6)" // CW
|
||||
")",
|
||||
"POLYGON((0 2,0 4,5 4,5 6,0 6,0 8,8 8,8 2,0 2))", box1);
|
||||
clip_visitor_test("POLYGON("
|
||||
"(-10 -10,-10 20,20 20,20 -10,-10 -10)," // CW
|
||||
"(-5 -5,0 -5,0 0,-5 0,-5 -5)" // CCW
|
||||
")",
|
||||
"POLYGON((0 0,0 10,10 10,10 0,0 0))", box1);
|
||||
ObGeogBox box3 = {3.0481343214686657e-14, 20000000.000000, -20000000.000000, -1.000000, 0, 0};
|
||||
clip_visitor_test("POLYGON((3.0481343214686657e-14 -20000000, 200000000 -20000000, 200000000 -1, 3.0481343214686657e-14 -1, 3.0481343214686657e-14 -20000000))",
|
||||
"POLYGON((0.000000000000030481343214686657 -20000000,0.000000000000030481343214686657 -1,20000000 -1,20000000 -20000000,0.000000000000030481343214686657 -20000000))", box3);
|
||||
// EMPTY
|
||||
clip_visitor_test("GEOMETRYCOLLECTION EMPTY", "EMPTY", box1);
|
||||
}
|
||||
|
||||
void affine_visitor_test(const ObString &wkt, const ObString &wkt_res, ObAffineMatrix &affine)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo_tree = nullptr;
|
||||
wkt_to_tree_geo(wkt, allocator, geo_tree);
|
||||
ASSERT_EQ(ObGeoMVTUtil::affine_transformation(geo_tree, affine), OB_SUCCESS);
|
||||
|
||||
ObString wkt_cal;
|
||||
tree_geo_to_wkt(allocator, geo_tree, wkt_cal);
|
||||
ASSERT_EQ(wkt_cal == wkt_res, true);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoTree, affine_visitor)
|
||||
{
|
||||
ObAffineMatrix affine = {1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 4096, 0};
|
||||
affine_visitor_test("MULTILINESTRING((1 1, 501 501, 1001 1001),(2 2, 502 502, 1002 1002))",
|
||||
"MULTILINESTRING((1 4095,501 3595,1001 3095),(2 4094,502 3594,1002 3094))", affine);
|
||||
affine_visitor_test("POLYGON ((0 0, 10 0, 10 5, 0 -5, 0 0))",
|
||||
"POLYGON((0 4096,10 4096,10 4091,0 4101,0 4096))", affine);
|
||||
ObAffineMatrix affine2 = {1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 100, 0};
|
||||
affine_visitor_test("LINESTRING(0 0, 2 20, -2 40, -4 60, 4 80, 0 100)",
|
||||
"LINESTRING(0 100,2 80,-2 60,-4 40,4 20,0 0)", affine2);
|
||||
ObAffineMatrix affine3 = {1, 0, 0, 0, -1, 0, 0, 0, 1, 0, 10, 0};
|
||||
affine_visitor_test("POLYGON((10 10, 10 0, 0 0, 0 10, 10 10),(9 9, 1 9, 1 1, 9 1, 9 9),(8 8, 8 2, 2 2, 2 8, 8 8),(7 7, 7 3, 3 3, 3 7, 7 7))",
|
||||
"POLYGON((10 0,10 10,0 10,0 0,10 0),(9 1,1 1,1 9,9 9,9 1),(8 2,8 8,2 8,2 2,8 2),(7 3,7 7,3 7,3 3,7 3))", affine3);
|
||||
// POLYGON((-8231396.69199339 4979982.17443372,-8231396.69199339 4980355.83678553,-8231365.02893734 4980355.83678553,-8231365.02893734 4979982.17443372,-8231396.69199339 4979982.17443372))
|
||||
ObAffineMatrix affine4 = {0.41539995335806329, 0, 0, 0, -0.41539995335802404, 0, 0, 0, 1, 3422112.7441855143, 2068718.1395343679, 0};
|
||||
affine_visitor_test("MULTIPOLYGON(((-8231365.02893734 4980355.83678553,-8231394.82332406 4980186.31880185,-8231367.43081065 4979982.17443372,-8231396.69199339 4980227.59327083,-8231365.02893734 4980355.83678553)))",
|
||||
"MULTIPOLYGON(((2804.095091749914 -121.44277270394377,2791.718504895922 -51.02501018997282,2803.097353688907 33.77655080938712,2790.942259743344 -68.17042267904617,2804.095091749914 -121.44277270394377)))", affine4);
|
||||
}
|
||||
|
||||
void grid_visitor_test(const ObString &wkt, const ObString &wkt_res, double size)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo_tree = nullptr;
|
||||
wkt_to_tree_geo(wkt, allocator, geo_tree);
|
||||
|
||||
ObGeoGrid grid = {0, 0, 0, 0, 0, 0};
|
||||
grid.x_size = grid.y_size = size;
|
||||
ASSERT_EQ(ObGeoMVTUtil::snap_to_grid(geo_tree, grid, false), OB_SUCCESS);
|
||||
|
||||
ObString wkt_cal;
|
||||
tree_geo_to_wkt(allocator, geo_tree, wkt_cal);
|
||||
ASSERT_EQ(wkt_cal == wkt_res, true);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoTree, grid_visitor)
|
||||
{
|
||||
grid_visitor_test("LINESTRING(0 100,2 80,-2 60,-4 40,4 20,0 0)",
|
||||
"LINESTRING(0 100,2 80,-2 60,-4 40,4 20,0 0)", 1);
|
||||
grid_visitor_test("LINESTRING(0 0,1 1,2 2,3 3,4 4,5 5)", "LINESTRING(0 0,2 2,4 4)", 2);
|
||||
grid_visitor_test("POINT(5.1423999999 5.1423999999)", "POINT(5.1424 5.1424)", 0.0001);
|
||||
grid_visitor_test("POINT(5 5)", "POINT(0 0)", 20);
|
||||
grid_visitor_test("MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))", "EMPTY", 20);
|
||||
// different from PG, PG keeps duplicate point in multipoint
|
||||
grid_visitor_test("MULTIPOINT(0 0,1 1, 2 2, 3 3, 4 4, 5 5)", "MULTIPOINT((0 0),(2 2),(4 4))", 2);
|
||||
grid_visitor_test("MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4, 4 5, 5 5, 5 4, 4 4)))",
|
||||
"MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)))", 2);
|
||||
grid_visitor_test("MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(4 4, 4 5, 5 5, 5 4, 4 4)))",
|
||||
"EMPTY", 20);
|
||||
grid_visitor_test("MULTIPOLYGON(((2804.095091749914 -121.44277270394377,2791.718504895922 -51.02501018997282,2803.097353688907 33.77655080938712,2790.942259743344 -68.17042267904617,2804.095091749914 -121.44277270394377)))",
|
||||
"MULTIPOLYGON(((2804 -121,2792 -51,2803 34,2791 -68,2804 -121)))", 1);
|
||||
}
|
||||
|
||||
void simplify_visitor_test(const ObString &wkt, const ObString &wkt_res, double tolerance, bool keep_collapsed)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo_tree = nullptr;
|
||||
wkt_to_tree_geo(wkt, allocator, geo_tree);
|
||||
|
||||
ASSERT_EQ(ObGeoMVTUtil::simplify_geometry(geo_tree, tolerance, keep_collapsed), OB_SUCCESS);
|
||||
|
||||
ObString wkt_cal;
|
||||
tree_geo_to_wkt(allocator, geo_tree, wkt_cal);
|
||||
ASSERT_EQ(wkt_cal == wkt_res, true);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoTree, simplify_visitor)
|
||||
{
|
||||
simplify_visitor_test("POLYGON((10 0,10 10,0 10,0 0,10 0),(9 1,1 1,1 9,9 9,9 1),(8 2,8 8,2 8,2 2,8 2),(7 3,7 7,3 7,3 3,7 3))",
|
||||
"POLYGON((10 0,10 10,0 10,0 0,10 0),(9 1,1 1,1 9,9 9,9 1),(8 2,8 8,2 8,2 2,8 2),(7 3,7 7,3 7,3 3,7 3))", 0, false);
|
||||
simplify_visitor_test("MULTILINESTRING((1 4095,501 3595,1001 3095),(2 4094,502 3594,1002 3094))",
|
||||
"MULTILINESTRING((1 4095,1001 3095),(2 4094,1002 3094))", 0, false);
|
||||
simplify_visitor_test("LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)", "LINESTRING(0 0,0 0)", 10, true);
|
||||
simplify_visitor_test("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))", "POLYGON((0 0,1 0,1 1,0 0))", 10, true);
|
||||
simplify_visitor_test("LINESTRING(0 0, 1 0, 1 1, 0 1, 0 0)", "EMPTY", 10, false);
|
||||
simplify_visitor_test("POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))", "EMPTY", 10, false);
|
||||
simplify_visitor_test("LINESTRING(0 0, 50 1.00001, 100 0)", "LINESTRING(0 0,50 1.00001,100 0)", 1, false);
|
||||
simplify_visitor_test("LINESTRING(0 0,50 0.99999,100 0)", "LINESTRING(0 0,100 0)", 1, false);
|
||||
simplify_visitor_test("POLYGON("
|
||||
"(0 0, 100 0, 100 100, 0 100, 0 0),"
|
||||
"(1 1, 1 5, 5 5, 5 1, 1 1),"
|
||||
"(20 20, 20 40, 40 40, 40 20, 20 20)"
|
||||
")", "POLYGON((0 0,100 0,100 100,0 100,0 0),(20 20,20 40,40 40,40 20,20 20))", 10, false);
|
||||
simplify_visitor_test("POLYGON("
|
||||
"(0 0, 100 0, 100 100, 0 100, 0 0),"
|
||||
"(20 20, 20 40, 40 40, 40 20, 20 20),"
|
||||
"(1 1, 1 5, 5 5, 5 1, 1 1)"
|
||||
")", "POLYGON((0 0,100 0,100 100,0 100,0 0),(20 20,20 40,40 40,40 20,20 20))", 10, false);
|
||||
simplify_visitor_test("POLYGON("
|
||||
"(0 0, 100 0, 100 100, 0 100, 0 0),"
|
||||
"(20 20, 20 40, 40 40, 40 20, 20 20),"
|
||||
"(1 1, 1 5, 5 5, 5 1, 1 1)"
|
||||
")", "EMPTY", 100, false);
|
||||
}
|
||||
|
||||
TEST_F(TestGeoTree, ewkt_with_null)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo_tree = nullptr;
|
||||
wkt_to_tree_geo("POINT(1 1)", allocator, geo_tree);
|
||||
geo_tree->set_srid(UINT32_MAX);
|
||||
ObGeometry *geo_bin = NULL;
|
||||
ASSERT_EQ(ObGeoTypeUtil::tree_to_bin(allocator, geo_tree, geo_bin, nullptr), OB_SUCCESS);
|
||||
ObWkbBuffer buffer(allocator);
|
||||
ASSERT_EQ(buffer.append(static_cast<uint32_t>(UINT32_MAX)), OB_SUCCESS);
|
||||
ASSERT_EQ(buffer.append(geo_bin->val(), geo_bin->length()), OB_SUCCESS);
|
||||
ObString wkt_cal;
|
||||
ASSERT_EQ(ObGeoTypeUtil::geo_to_ewkt(buffer.string(), wkt_cal, allocator, 14), OB_SUCCESS);
|
||||
ObString wkt_res = "SRID=NULL;POINT(1 1)";
|
||||
ASSERT_EQ(wkt_cal == wkt_res, true);
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
@ -632,5 +936,8 @@ TEST_F(TestGeoTree, intersection_op)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
// system("rm -f test_geo_tree.log");
|
||||
// OB_LOGGER.set_file_name("test_geo_tree.log");
|
||||
OB_LOGGER.set_log_level("DEBUG");
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
@ -56,12 +56,35 @@ public:
|
||||
return wkb;
|
||||
}
|
||||
|
||||
void compare_wkt_parse_result(ObGeoType geotype, const ObString &wkt, const ObString &wkb_res);
|
||||
void comapre_wkt_parse_wrong_result(const ObString &wkt);
|
||||
|
||||
private:
|
||||
ObArenaAllocator allocator_;
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(TestWktParser);
|
||||
};
|
||||
|
||||
void TestWktParser::compare_wkt_parse_result(ObGeoType geotype, const ObString &wkt, const ObString &wkb_res)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo = NULL;
|
||||
ASSERT_EQ(OB_SUCCESS, ObWktParser::parse_wkt(allocator, wkt, geo, true, false));
|
||||
ASSERT_TRUE(NULL != geo);
|
||||
ASSERT_EQ(geo->type(), geotype);
|
||||
ObString wkb = to_hex(mock_to_wkb(geo));
|
||||
// std::cout<<std::string(wkb.ptr(), wkb.length())<<std::endl;
|
||||
ASSERT_EQ(wkb, wkb_res);
|
||||
}
|
||||
|
||||
void TestWktParser::comapre_wkt_parse_wrong_result(const ObString &wkt)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
ObGeometry *geo = NULL;
|
||||
ASSERT_TRUE(OB_SUCCESS != ObWktParser::parse_wkt(allocator, wkt, geo, true, false));
|
||||
ASSERT_TRUE(NULL == geo);
|
||||
}
|
||||
|
||||
TEST_F(TestWktParser, test_parse_point)
|
||||
{
|
||||
ObArenaAllocator allocator(ObModIds::TEST);
|
||||
@ -493,6 +516,148 @@ TEST_F(TestWktParser, test_geometrycollection)
|
||||
ASSERT_TRUE(NULL == geo);
|
||||
}
|
||||
|
||||
TEST_F(TestWktParser, test_parse_3dwkt)
|
||||
{
|
||||
ObString wkb_res = ObString::make_string("01E9030000000000000000F03F000000000000F03F000000000000F03F");
|
||||
// point z
|
||||
compare_wkt_parse_result(ObGeoType::POINTZ, ObString("POINTZ(1 1 1)"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::POINTZ, ObString("POINT Z(1 1 1)"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::POINTZ, ObString("POINT(1 1 1)"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::POINTZ, ObString("POINT Z (1 1 1)"), wkb_res);
|
||||
comapre_wkt_parse_wrong_result(ObString("POINT Z (0 0)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POINT Z (0 0,)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POINT Z (0 0 ))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POINT Z (0 0 1))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POINT Z (0 0 1,))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POINT Z ())"));
|
||||
|
||||
// linestring z
|
||||
wkb_res = ObString::make_string("01EA03000002000000000000000000000000000000000000000000000000000040000000000000F03F000000000000F03F0000000000000840");
|
||||
compare_wkt_parse_result(ObGeoType::LINESTRINGZ, ObString("LINESTRING Z (0 0 2, 1 1 3)"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::LINESTRINGZ, ObString("LINESTRINGZ (0 0 2, 1 1 3)"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::LINESTRINGZ, ObString("LINESTRINGZ(0 0 2, 1 1 3)"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::LINESTRINGZ, ObString("LINESTRING(0 0 2, 1 1 3)"), wkb_res);
|
||||
comapre_wkt_parse_wrong_result(ObString("LINESTRING Z (0 0, 0 1)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("LINESTRING Z (0 0 0, 0 1)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("LINESTRING Z (0 0, 0 1 2)"));
|
||||
// linestring z: point num < 2
|
||||
comapre_wkt_parse_wrong_result(ObString("LINESTRING Z (0 0 2)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("LINESTRING Z ()"));
|
||||
|
||||
// polygon z
|
||||
wkb_res = ObString::make_string("01EB030000020000000500000000000000000000000000000000000000000000000000F03F00000000000024400000000000000000000000000000004000000000000024400000000000002440000000000000004000000000000000000000000000002440000000000000004000000000000000000000000000000000000000000000F03F05000000000000000000004000000000000000400000000000001440000000000000004000000000000014400000000000001040000000000000144000000000000014400000000000000840000000000000144000000000000000400000000000000840000000000000004000000000000000400000000000001440");
|
||||
compare_wkt_parse_result(ObGeoType::POLYGONZ, ObString("POLYGONZ((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1),(2 2 5 ,2 5 4,5 5 3,5 2 3,2 2 5))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::POLYGONZ, ObString("POLYGON Z ((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1),(2 2 5 ,2 5 4,5 5 3,5 2 3,2 2 5))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::POLYGONZ, ObString("POLYGON Z((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1),(2 2 5 ,2 5 4,5 5 3,5 2 3,2 2 5))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::POLYGONZ, ObString("POLYGON((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1),(2 2 5 ,2 5 4,5 5 3,5 2 3,2 2 5))"), wkb_res);
|
||||
// not a close ring
|
||||
comapre_wkt_parse_wrong_result(ObString("POLYGONZ((0 0 1,10 0 ,10 10 2,0 10 2,0 0 2))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POLYGONZ((0 0, 10 0, 10 10 2,0 10 2,0 0 2))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POLYGONZ((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1), (0 0,10 0,10 10,0 10,0 0))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POLYGONZ((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1), (0 0 1,10 0 2,0 0 1))"));
|
||||
// point is less than 4
|
||||
comapre_wkt_parse_wrong_result(ObString("POLYGONZ((0 0 1, 10 0 1, 0 0 1))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POLYGON((0 0 1, 10 0, 1 0 1, 0 0 1))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POLYGON Z ()"));
|
||||
comapre_wkt_parse_wrong_result(ObString("POLYGON Z (())"));
|
||||
|
||||
// multipoint z
|
||||
wkb_res = ObString::make_string("01EC0300000200000001E903000000000000000000000000000000000000000000000000000001E903000000000000000000400000000000000000000000000000F03F");
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOINTZ, ObString("MULTIPOINTZ((0 0 0), (2 0 1))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOINTZ, ObString("MULTIPOINTZ(0 0 0, 2 0 1)"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOINTZ, ObString("MULTIPOINT Z ((0 0 0), (2 0 1))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOINTZ, ObString("MULTIPOINT Z (0 0 0, 2 0 1)"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOINTZ, ObString("MULTIPOINT Z((0 0 0), (2 0 1))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOINTZ, ObString("MULTIPOINT Z(0 0 0, 2 0 1)"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOINTZ, ObString("MULTIPOINT((0 0 0), (2 0 1))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOINTZ, ObString("MULTIPOINT(0 0 0, 2 0 1)"), wkb_res);
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOINTZ((0 0 0), (2 0))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOINTZ(0 0 0, 2 0)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOINT((0 0), (2 0 0))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOINT(0 0, 2 0 0)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOINT((0 0 0), 2 0 0)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOINT((0 0 0),)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOINT(0 0 0, )"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOINT()"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOINT(())"));
|
||||
|
||||
// multilinestring z
|
||||
wkb_res = ObString::make_string("01ED0300000200000001EA0300000200000000000000000000000000000000000000000000000000F03F00000000000000400000000000000000000000000000004001EA03000002000000000000000000F03F000000000000F03F0000000000000840000000000000004000000000000000400000000000001040");
|
||||
compare_wkt_parse_result(ObGeoType::MULTILINESTRINGZ, ObString("MULTILINESTRINGZ((0 0 1, 2 0 2), (1 1 3, 2 2 4))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTILINESTRINGZ, ObString("MULTILINESTRING Z ((0 0 1, 2 0 2), (1 1 3, 2 2 4))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTILINESTRINGZ, ObString("MULTILINESTRING Z((0 0 1, 2 0 2), (1 1 3, 2 2 4))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTILINESTRINGZ, ObString("MULTILINESTRING((0 0 1, 2 0 2), (1 1 3, 2 2 4))"), wkb_res);
|
||||
wkb_res = ObString::make_string("01ED0300000100000001EA0300000200000000000000000000000000000000000000000000000000F03F00000000000000000000000000000000000000000000F03F");
|
||||
compare_wkt_parse_result(ObGeoType::MULTILINESTRINGZ, ObString("MULTILINESTRINGZ((0 0 1, 0 0 1))"), wkb_res);
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTILINESTRINGZ((0 0 0))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTILINESTRINGZ((0 0))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTILINESTRINGZ((0 0))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTILINESTRING((0 0, 0 1), (0 1 1, 1 0 1))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTILINESTRING((0 0 1, 0 1 2), (0 1, 1 0))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTILINESTRING((0 0 1, 0 1 2),)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTILINESTRING()"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTILINESTRING(())"));
|
||||
|
||||
// multipolygon z
|
||||
wkb_res = ObString::make_string("01EE0300000200000001EB030000010000000500000000000000000000000000000000000000000000000000084000000000000024400000000000000000000000000000084000000000000024400000000000002440000"
|
||||
"000000000084000000000000000000000000000002440000000000000084000000000000000000000000000000000000000000000084001EB030000010000000500000000000000000000400000000000000040000000000"
|
||||
"0000840000000000000004000000000000014400000000000000840000000000000144000000000000014400000000000000840000000000000144000000000000000400000000000000840000000000000004000000000000000400000000000000840");
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOLYGONZ, ObString("MULTIPOLYGONZ(((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOLYGONZ, ObString("MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOLYGONZ, ObString("MULTIPOLYGON Z(((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3)), ((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOLYGONZ, ObString("MULTIPOLYGON(((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))"), wkb_res);
|
||||
wkb_res = ObString::make_string("01EE0300000200000001EB030000020000000500000000000000000000000000000000000000000000000000084000000000000024400000000000000000000000000000084000000000000024400000000000002440000"
|
||||
"00000000008400000000000000000000000000000244000000000000008400000000000000000000000000000000000000000000008400500000000000000000000000000000000000000000000000000004000000000000"
|
||||
"01440000000000000000000000000000000400000000000001440000000000000144000000000000008400000000000000000000000000000144000000000000008400000000000000000000000000000000000000000000"
|
||||
"0004001EB03000001000000050000000000000000000040000000000000004000000000000008400000000000000040000000000000144000000000000008400000000000001440000000000000144000000000000008400"
|
||||
"00000000000144000000000000000400000000000000840000000000000004000000000000000400000000000000840");
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOLYGONZ, ObString("MULTIPOLYGON(((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3), (0 0 2,5 0 2,5 5 3,0 5 3,0 0 2)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOLYGONZ, ObString("MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3), (0 0 2,5 0 2,5 5 3,0 5 3,0 0 2)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOLYGONZ, ObString("MULTIPOLYGONZ(((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3), (0 0 2,5 0 2,5 5 3,0 5 3,0 0 2)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOLYGONZ, ObString("MULTIPOLYGON(((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3), (0 0 2,5 0 2,5 5 3,0 5 3,0 0 2)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::MULTIPOLYGONZ, ObString("MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3), (0 0 2,5 0 2,5 5 3,0 5 3,0 0 2)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))"), wkb_res);
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOLYGON(((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3)),((2 2,2 5,5 5,5 2,2 2)))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0)),((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOLYGON Z(((2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)),((0 0 1, 1 0 1, 0 0 1)))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 1)),((0 0, 1 0, 1 1, 0 1, 0 0)))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 1)),)"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 1)),())"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOLYGON Z ()"));
|
||||
comapre_wkt_parse_wrong_result(ObString("MULTIPOLYGON Z (())"));
|
||||
|
||||
// geometrycollection z
|
||||
wkb_res = ObString::make_string("01EF0300000400000001E9030000000000000000F03F000000000000F03F000000000000F03F01EA03000002000000000000000000000000000000000000000000000000000040000000000000F03F000000000000F03F0"
|
||||
"00000000000084001EB030000020000000500000000000000000000000000000000000000000000000000F03F000000000000244000000000000000000000000000000040000000000000244000000000000024400000000"
|
||||
"00000004000000000000000000000000000002440000000000000004000000000000000000000000000000000000000000000F03F05000000000000000000004000000000000000400000000000001440000000000000004"
|
||||
"00000000000001440000000000000104000000000000014400000000000001440000000000000084000000000000014400000000000000040000000000000084000000000000000400000000000000040000000000000144"
|
||||
"001EF0300000300000001EC0300000200000001E903000000000000000000000000000000000000000000000000000001E903000000000000000000400000000000000000000000000000F03F01ED0300000200000001EA0"
|
||||
"300000200000000000000000000000000000000000000000000000000F03F00000000000000400000000000000000000000000000004001EA03000002000000000000000000F03F000000000000F03F00000000000008400"
|
||||
"0000000000000400000000000000040000000000000104001EE0300000100000001EB03000002000000050000000000000000000000000000000000000000000000000008400000000000002440000000000000000000000"
|
||||
"00000000840000000000000244000000000000024400000000000000840000000000000000000000000000024400000000000000840000000000000000000000000000000000000000000000840050000000000000000000"
|
||||
"04000000000000000400000000000000840000000000000004000000000000014400000000000000840000000000000144000000000000014400000000000000840000000000000144000000000000000400000000000000"
|
||||
"840000000000000004000000000000000400000000000000840");
|
||||
compare_wkt_parse_result(ObGeoType::GEOMETRYCOLLECTIONZ, ObString("GEOMETRYCOLLECTION Z (POINT Z(1 1 1), LINESTRINGZ (0 0 2, 1 1 3), POLYGON Z((0 0 1,10 0 2 ,10 10 2,0 10 2,0 0 1),(2 2 5 ,2 5 4,5 5 3,5 2 3,2 2 5)), GEOMETRYCOLLECTIONZ(MULTIPOINTZ((0 0 0), (2 0 1)), MULTILINESTRINGZ((0 0 1, 2 0 2), (1 1 3, 2 2 4)), MULTIPOLYGON Z (((0 0 3,10 0 3,10 10 3,0 10 3,0 0 3),(2 2 3,2 5 3,5 5 3,5 2 3,2 2 3)))))"), wkb_res);
|
||||
wkb_res = ObString::make_string("01EF0300000200000001E9030000000000000000F03F000000000000F03F000000000000F03F01EA03000002000000000000000000000000000000000000000000000000000040000000000000F03F000000000000F03F0000000000000840");
|
||||
compare_wkt_parse_result(ObGeoType::GEOMETRYCOLLECTIONZ, ObString("GEOMETRYCOLLECTION (POINT (1 1 1), LINESTRINGZ (0 0 2, 1 1 3))"), wkb_res);
|
||||
wkb_res = ObString::make_string("01EF0300000200000001E9030000000000000000F03F000000000000F03F000000000000F03F01EF03000000000000");
|
||||
compare_wkt_parse_result(ObGeoType::GEOMETRYCOLLECTIONZ, ObString("GEOMETRYCOLLECTION Z (POINT (1 1 1), GEOMETRYCOLLECTION EMPTY)"), wkb_res);
|
||||
wkb_res = ObString::make_string("01EF0300000100000001EF0300000200000001E9030000000000000000F03F000000000000F03F000000000000F03F01EF03000000000000");
|
||||
compare_wkt_parse_result(ObGeoType::GEOMETRYCOLLECTIONZ, ObString("GEOMETRYCOLLECTION (GEOMETRYCOLLECTION(POINT Z(1 1 1) ,GEOMETRYCOLLECTION Z EMPTY))"), wkb_res);
|
||||
wkb_res = ObString::make_string("01EF03000000000000");
|
||||
compare_wkt_parse_result(ObGeoType::GEOMETRYCOLLECTIONZ, ObString("GEOMETRYCOLLECTION Z EMPTY"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::GEOMETRYCOLLECTIONZ, ObString("GEOMETRYCOLLECTION Z ()"), wkb_res);
|
||||
wkb_res = ObString::make_string("01EF0300000100000001EF03000000000000"); // different from pg res
|
||||
compare_wkt_parse_result(ObGeoType::GEOMETRYCOLLECTIONZ, ObString("GEOMETRYCOLLECTION Z (GEOMETRYCOLLECTION Z EMPTY)"), wkb_res);
|
||||
compare_wkt_parse_result(ObGeoType::GEOMETRYCOLLECTIONZ, ObString("GEOMETRYCOLLECTION Z (GEOMETRYCOLLECTION EMPTY)"), wkb_res);
|
||||
wkb_res = ObString::make_string("01EF0300000100000001EF0300000100000001EF0300000100000001EF0300000100000001EF03000000000000");
|
||||
compare_wkt_parse_result(ObGeoType::GEOMETRYCOLLECTIONZ, ObString("GEOMETRYCOLLECTION Z (GEOMETRYCOLLECTION(GEOMETRYCOLLECTIONZ(GEOMETRYCOLLECTION(GEOMETRYCOLLECTIONZ()))))"), wkb_res);
|
||||
comapre_wkt_parse_wrong_result(ObString("GEOMETRYCOLLECTION Z (POINT (1 1))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("GEOMETRYCOLLECTION Z (POINT Z ())"));
|
||||
comapre_wkt_parse_wrong_result(ObString("GEOMETRYCOLLECTION Z (LINESTRING (1 1 , 1 2))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("GEOMETRYCOLLECTION Z (LINESTRING Z (1 1 1))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("GEOMETRYCOLLECTION Z (POLYGON((0 0,10 0,10 10,0 10,0 0)))"));
|
||||
comapre_wkt_parse_wrong_result(ObString("GEOMETRYCOLLECTION Z (POLYGON Z((0 0 1,0 10 1,0 0 2)))"));
|
||||
}
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
|
||||
|
||||
@ -57,9 +57,9 @@ public:
|
||||
// Every ObObjType from ObTinyIntType to ObHexStringType inclusive.
|
||||
// Skip ObNullType and ObExtendType because for external usage, a column type
|
||||
// can't be NULL or NOP.
|
||||
ObObjType not_test_type[9] = {
|
||||
ObObjType not_test_type[11] = {
|
||||
ObNullType, ObExtendType, ObUnknownType, ObEnumInnerType, ObSetInnerType,
|
||||
ObNumberFloatType, ObURowIDType, ObLobType, ObUserDefinedSQLType};
|
||||
ObNumberFloatType, ObURowIDType, ObLobType, ObUserDefinedSQLType, ObDecimalIntType, ObCollectionSQLType};
|
||||
static const int64_t column_num = ObMaxType - sizeof(not_test_type) / sizeof(ObObjType);
|
||||
public:
|
||||
TestNewRowReader()
|
||||
|
||||
Reference in New Issue
Block a user