mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Add some comments & new tests for different input types
This commit is contained in:
parent
d2e4f4e778
commit
5f2ed57c49
@ -425,6 +425,7 @@ void IPolygonDictionary::getItemsImpl(
|
||||
{
|
||||
size_t id = 0;
|
||||
const auto found = find(points[i], id);
|
||||
id = ids[id];
|
||||
if (!found)
|
||||
{
|
||||
set_value(i, static_cast<OutputType>(get_default(i)));
|
||||
@ -462,7 +463,7 @@ struct Data
|
||||
|
||||
void addPolygon(bool new_multi_polygon = false) {
|
||||
dest.emplace_back();
|
||||
ids.push_back((ids.size() ? ids.back() + new_multi_polygon : 0));
|
||||
ids.push_back((ids.empty() ? 0 : ids.back() + new_multi_polygon));
|
||||
}
|
||||
};
|
||||
|
||||
@ -677,7 +678,7 @@ bool SimplePolygonDictionary::find(const Point &point, size_t & id) const
|
||||
if (!found || new_area < area)
|
||||
{
|
||||
found = true;
|
||||
id = ids[i];
|
||||
id = i;
|
||||
area = new_area;
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,23 @@ namespace bg = boost::geometry;
|
||||
class IPolygonDictionary : public IDictionaryBase
|
||||
{
|
||||
public:
|
||||
/** Controls the different types of polygons allowed as input.
|
||||
* The structure of a multi-polygon is as follows:
|
||||
* - A multi-polygon is represented by a nonempty array of polygons.
|
||||
* - A polygon is represented by a nonempty array of rings. The first element represents the outer ring. Zero
|
||||
* or more following rings are cut out from the polygon.
|
||||
* - A ring is represented by a nonempty array of points.
|
||||
* - A point is represented by its coordinates stored in an according structure (see below).
|
||||
* A simple polygon is represented by an one-dimensional array of points, stored in the according structure.
|
||||
*/
|
||||
enum class InputType
|
||||
{
|
||||
MultiPolygon,
|
||||
SimplePolygon
|
||||
};
|
||||
/** Controls the different types allowed for providing the coordinates of points.
|
||||
* Right now a point can be represented by either an array or a tuple of two Float64 values.
|
||||
*/
|
||||
enum class PointType
|
||||
{
|
||||
Array,
|
||||
@ -166,14 +178,10 @@ public:
|
||||
// TODO: Refactor the whole dictionary design to perform stronger checks, i.e. make this an override.
|
||||
void has(const Columns & key_columns, const DataTypes & key_types, PaddedPODArray<UInt8> & out) const;
|
||||
|
||||
/** The number of dimensions used. Change with great caution, some extra work will be required. */
|
||||
static constexpr size_t DIM = 2;
|
||||
/** A point in Euclidean coordinates. */
|
||||
using Point = bg::model::point<Float64, DIM, bg::cs::cartesian>;
|
||||
/** A two-dimensional point in Euclidean coordinates. */
|
||||
using Point = bg::model::point<Float64, 2, bg::cs::cartesian>;
|
||||
/** A polygon in boost is a an outer ring of points with zero or more cut out inner rings. */
|
||||
using Polygon = bg::model::polygon<Point>;
|
||||
/** A multi_polygon in boost is a collection of polygons. */
|
||||
using MultiPolygon = bg::model::multi_polygon<Polygon>;
|
||||
|
||||
protected:
|
||||
/** Returns true if the given point can be found in the polygon dictionary.
|
||||
@ -183,6 +191,9 @@ protected:
|
||||
virtual bool find(const Point & point, size_t & id) const = 0;
|
||||
|
||||
std::vector<Polygon> polygons;
|
||||
/** Since the original data may have been in the form of multi-polygons, an id is stored for each single polygon
|
||||
* corresponding to the row in which any other attributes for this entry are located.
|
||||
*/
|
||||
std::vector<size_t> ids;
|
||||
|
||||
const std::string database;
|
||||
@ -246,14 +257,8 @@ private:
|
||||
size_t element_count = 0;
|
||||
mutable std::atomic<size_t> query_count{0};
|
||||
|
||||
/** Extracts a list of multi-polygons from a column of 4-dimensional arrays of Float64 values. The results are
|
||||
* written to dest.
|
||||
* The structure is as follows:
|
||||
* - A multi-polygon is represented by a nonempty array of polygons.
|
||||
* - A polygon is represented by a nonempty array of rings. The first element represents the outer ring. Zero
|
||||
* or more following rings are cut out from the polygon.
|
||||
* - A ring is represented by a nonempty array of points.
|
||||
* - A point is represented by an array of coordinates.
|
||||
/** Extracts a list of polygons from a column according to input_type and point_type.
|
||||
* The polygons are appended to the dictionary with the corresponding ids.
|
||||
*/
|
||||
void extractPolygons(const ColumnPtr & column);
|
||||
|
||||
|
@ -1,59 +0,0 @@
|
||||
dictGet test_01037.dict (-100,-42) qqq 101
|
||||
dictGet test_01037.dict (-1,0) Click South 423
|
||||
dictGet test_01037.dict (-0.1,0) Click South 423
|
||||
dictGet test_01037.dict (0,-2) Click West 424
|
||||
dictGet test_01037.dict (0,-1.1) Click West 424
|
||||
dictGet test_01037.dict (0,1.1) Click North 422
|
||||
dictGet test_01037.dict (0,2) Click North 422
|
||||
dictGet test_01037.dict (0.1,0) Click East 421
|
||||
dictGet test_01037.dict (0.99,2.99) Click North 422
|
||||
dictGet test_01037.dict (1,0) Click East 421
|
||||
dictGet test_01037.dict (3,3) House 314159
|
||||
dictGet test_01037.dict (5,6) Click 42
|
||||
dictGet test_01037.dict (7.01,7.01) qqq 101
|
||||
dictGetOrDefault test_01037.dict (-100,-42) www 1234
|
||||
dictGetOrDefault test_01037.dict (-1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict (-0.1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict (0,-2) Click West 424
|
||||
dictGetOrDefault test_01037.dict (0,-1.1) Click West 424
|
||||
dictGetOrDefault test_01037.dict (0,1.1) Click North 422
|
||||
dictGetOrDefault test_01037.dict (0,2) Click North 422
|
||||
dictGetOrDefault test_01037.dict (0.1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict (0.99,2.99) Click North 422
|
||||
dictGetOrDefault test_01037.dict (1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict (3,3) House 314159
|
||||
dictGetOrDefault test_01037.dict (5,6) Click 42
|
||||
dictGetOrDefault test_01037.dict (7.01,7.01) www 1234
|
||||
dictGetOrDefault test_01037.dict (-100,-42) dd 44
|
||||
dictGetOrDefault test_01037.dict (-1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict (-0.1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict (0,-2) Click West 424
|
||||
dictGetOrDefault test_01037.dict (0,-1.1) Click West 424
|
||||
dictGetOrDefault test_01037.dict (0,1.1) Click North 422
|
||||
dictGetOrDefault test_01037.dict (0,2) Click North 422
|
||||
dictGetOrDefault test_01037.dict (0.1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict (0.99,2.99) Click North 422
|
||||
dictGetOrDefault test_01037.dict (1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict (3,3) House 314159
|
||||
dictGetOrDefault test_01037.dict (5,6) Click 42
|
||||
dictGetOrDefault test_01037.dict (7.01,7.01) ee 55
|
||||
dictHas test_01037.dict (-100,-42) 0
|
||||
dictHas test_01037.dict (-1,0) 1
|
||||
dictHas test_01037.dict (-0.1,0) 1
|
||||
dictHas test_01037.dict (0,-2) 1
|
||||
dictHas test_01037.dict (0,-1.1) 1
|
||||
dictHas test_01037.dict (0,-1) 1
|
||||
dictHas test_01037.dict (0,0) 1
|
||||
dictHas test_01037.dict (0,1) 1
|
||||
dictHas test_01037.dict (0,1.1) 1
|
||||
dictHas test_01037.dict (0,2) 1
|
||||
dictHas test_01037.dict (0.1,0) 1
|
||||
dictHas test_01037.dict (0.99,2.99) 1
|
||||
dictHas test_01037.dict (1,0) 1
|
||||
dictHas test_01037.dict (1,1) 1
|
||||
dictHas test_01037.dict (1,3) 1
|
||||
dictHas test_01037.dict (3,3) 1
|
||||
dictHas test_01037.dict (5,1) 1
|
||||
dictHas test_01037.dict (5,5) 1
|
||||
dictHas test_01037.dict (5,6) 1
|
||||
dictHas test_01037.dict (7.01,7.01) 0
|
@ -1,70 +0,0 @@
|
||||
SET send_logs_level = 'none';
|
||||
|
||||
DROP DATABASE IF EXISTS test_01037;
|
||||
|
||||
CREATE DATABASE test_01037 Engine = Ordinary;
|
||||
|
||||
DROP DICTIONARY IF EXISTS test_01037.dict;
|
||||
DROP TABLE IF EXISTS test_01037.polygons;
|
||||
|
||||
CREATE TABLE test_01037.polygons (key Array(Array(Array(Array(Float64)))), name String, value UInt64) ENGINE = Memory;
|
||||
INSERT INTO test_01037.polygons VALUES ([[[[1, 3], [1, 1], [3, 1], [3, -1], [1, -1], [1, -3], [-1, -3], [-1, -1], [-3, -1], [-3, 1], [-1, 1], [-1, 3]]], [[[5, 5], [5, 1], [7, 1], [7, 7], [1, 7], [1, 5]]]], 'Click', 42);
|
||||
INSERT INTO test_01037.polygons VALUES ([[[[5, 5], [5, -5], [-5, -5], [-5, 5]], [[1, 3], [1, 1], [3, 1], [3, -1], [1, -1], [1, -3], [-1, -3], [-1, -1], [-3, -1], [-3, 1], [-1, 1], [-1, 3]]]], 'House', 314159);
|
||||
INSERT INTO test_01037.polygons VALUES ([[[[3, 1], [0, 1], [0, -1], [3, -1]]]], 'Click East', 421);
|
||||
INSERT INTO test_01037.polygons VALUES ([[[[-1, 1], [1, 1], [1, 3], [-1, 3]]]], 'Click North', 422);
|
||||
INSERT INTO test_01037.polygons VALUES ([[[[-3, 1], [-3, -1], [0, -1], [0, 1]]]], 'Click South', 423);
|
||||
INSERT INTO test_01037.polygons VALUES ([[[[-1, -1], [1, -1], [1, -3], [-1, -3]]]], 'Click West', 424);
|
||||
|
||||
CREATE DICTIONARY test_01037.dict
|
||||
(
|
||||
key Array(Array(Array(Array(Float64)))),
|
||||
name String DEFAULT 'qqq',
|
||||
value UInt64 DEFAULT 101
|
||||
)
|
||||
PRIMARY KEY key
|
||||
SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'polygons' PASSWORD '' DB 'test_01037'))
|
||||
LIFETIME(MIN 1 MAX 10)
|
||||
LAYOUT(POLYGON());
|
||||
|
||||
DROP TABLE IF EXISTS test_01037.points;
|
||||
|
||||
CREATE TABLE test_01037.points (x Float64, y Float64, def_i UInt64, def_s String) ENGINE = Memory;
|
||||
INSERT INTO test_01037.points VALUES (0.1, 0.0, 112, 'aax');
|
||||
INSERT INTO test_01037.points VALUES (-0.1, 0.0, 113, 'aay');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 1.1, 114, 'aaz');
|
||||
INSERT INTO test_01037.points VALUES (0.0, -1.1, 115, 'aat');
|
||||
INSERT INTO test_01037.points VALUES (3.0, 3.0, 22, 'bb');
|
||||
INSERT INTO test_01037.points VALUES (5.0, 6.0, 33, 'cc');
|
||||
INSERT INTO test_01037.points VALUES (-100.0, -42.0, 44, 'dd');
|
||||
INSERT INTO test_01037.points VALUES (7.01, 7.01, 55, 'ee')
|
||||
INSERT INTO test_01037.points VALUES (0.99, 2.99, 66, 'ee');
|
||||
INSERT INTO test_01037.points VALUES (1.0, 0.0, 771, 'ffa');
|
||||
INSERT INTO test_01037.points VALUES (-1.0, 0.0, 772, 'ffb');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 2.0, 773, 'ffc');
|
||||
INSERT INTO test_01037.points VALUES (0.0, -2.0, 774, 'ffd');
|
||||
|
||||
select 'dictGet', 'test_01037.dict' as dict_name, tuple(x, y) as key,
|
||||
dictGet(dict_name, 'name', key),
|
||||
dictGet(dict_name, 'value', key) from test_01037.points order by x, y;
|
||||
select 'dictGetOrDefault', 'test_01037.dict' as dict_name, tuple(x, y) as key,
|
||||
dictGetOrDefault(dict_name, 'name', key, 'www'),
|
||||
dictGetOrDefault(dict_name, 'value', key, toUInt64(1234)) from test_01037.points order by x, y;
|
||||
select 'dictGetOrDefault', 'test_01037.dict' as dict_name, tuple(x, y) as key,
|
||||
dictGetOrDefault(dict_name, 'name', key, def_s),
|
||||
dictGetOrDefault(dict_name, 'value', key, def_i) from test_01037.points order by x, y;
|
||||
|
||||
INSERT INTO test_01037.points VALUES (5.0, 5.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (5.0, 1.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (1.0, 3.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 0.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 1.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (0.0, -1.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (1.0, 1.0, 0, '');
|
||||
|
||||
select 'dictHas', 'test_01037.dict' as dict_name, tuple(x, y) as key,
|
||||
dictHas(dict_name, key) from test_01037.points order by x, y;
|
||||
|
||||
DROP DICTIONARY test_01037.dict;
|
||||
DROP TABLE test_01037.polygons;
|
||||
DROP TABLE test_01037.points;
|
||||
DROP DATABASE test_01037;
|
@ -0,0 +1,118 @@
|
||||
dictGet test_01037.dict_array (-100,-42) qqq 101
|
||||
dictGet test_01037.dict_array (-1,0) Click South 423
|
||||
dictGet test_01037.dict_array (-0.1,0) Click South 423
|
||||
dictGet test_01037.dict_array (0,-2) Click West 424
|
||||
dictGet test_01037.dict_array (0,-1.1) Click West 424
|
||||
dictGet test_01037.dict_array (0,1.1) Click North 422
|
||||
dictGet test_01037.dict_array (0,2) Click North 422
|
||||
dictGet test_01037.dict_array (0.1,0) Click East 421
|
||||
dictGet test_01037.dict_array (0.99,2.99) Click North 422
|
||||
dictGet test_01037.dict_array (1,0) Click East 421
|
||||
dictGet test_01037.dict_array (3,3) House 314159
|
||||
dictGet test_01037.dict_array (5,6) Click 42
|
||||
dictGet test_01037.dict_array (7.01,7.01) qqq 101
|
||||
dictGetOrDefault test_01037.dict_array (-100,-42) www 1234
|
||||
dictGetOrDefault test_01037.dict_array (-1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_array (-0.1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_array (0,-2) Click West 424
|
||||
dictGetOrDefault test_01037.dict_array (0,-1.1) Click West 424
|
||||
dictGetOrDefault test_01037.dict_array (0,1.1) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (0,2) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (0.1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_array (0.99,2.99) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_array (3,3) House 314159
|
||||
dictGetOrDefault test_01037.dict_array (5,6) Click 42
|
||||
dictGetOrDefault test_01037.dict_array (7.01,7.01) www 1234
|
||||
dictGetOrDefault test_01037.dict_array (-100,-42) dd 44
|
||||
dictGetOrDefault test_01037.dict_array (-1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_array (-0.1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_array (0,-2) Click West 424
|
||||
dictGetOrDefault test_01037.dict_array (0,-1.1) Click West 424
|
||||
dictGetOrDefault test_01037.dict_array (0,1.1) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (0,2) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (0.1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_array (0.99,2.99) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_array (3,3) House 314159
|
||||
dictGetOrDefault test_01037.dict_array (5,6) Click 42
|
||||
dictGetOrDefault test_01037.dict_array (7.01,7.01) ee 55
|
||||
dictGet test_01037.dict_tuple (-100,-42) qqq 101
|
||||
dictGet test_01037.dict_tuple (-1,0) Click South 423
|
||||
dictGet test_01037.dict_tuple (-0.1,0) Click South 423
|
||||
dictGet test_01037.dict_tuple (0,-2) Click West 424
|
||||
dictGet test_01037.dict_tuple (0,-1.1) Click West 424
|
||||
dictGet test_01037.dict_tuple (0,1.1) Click North 422
|
||||
dictGet test_01037.dict_tuple (0,2) Click North 422
|
||||
dictGet test_01037.dict_tuple (0.1,0) Click East 421
|
||||
dictGet test_01037.dict_tuple (0.99,2.99) Click North 422
|
||||
dictGet test_01037.dict_tuple (1,0) Click East 421
|
||||
dictGet test_01037.dict_tuple (3,3) House 314159
|
||||
dictGet test_01037.dict_tuple (5,6) Click 42
|
||||
dictGet test_01037.dict_tuple (7.01,7.01) qqq 101
|
||||
dictGetOrDefault test_01037.dict_tuple (-100,-42) www 1234
|
||||
dictGetOrDefault test_01037.dict_tuple (-1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_tuple (-0.1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_tuple (0,-2) Click West 424
|
||||
dictGetOrDefault test_01037.dict_tuple (0,-1.1) Click West 424
|
||||
dictGetOrDefault test_01037.dict_tuple (0,1.1) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (0,2) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (0.1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_tuple (0.99,2.99) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_tuple (3,3) House 314159
|
||||
dictGetOrDefault test_01037.dict_tuple (5,6) Click 42
|
||||
dictGetOrDefault test_01037.dict_tuple (7.01,7.01) www 1234
|
||||
dictGetOrDefault test_01037.dict_tuple (-100,-42) dd 44
|
||||
dictGetOrDefault test_01037.dict_tuple (-1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_tuple (-0.1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_tuple (0,-2) Click West 424
|
||||
dictGetOrDefault test_01037.dict_tuple (0,-1.1) Click West 424
|
||||
dictGetOrDefault test_01037.dict_tuple (0,1.1) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (0,2) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (0.1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_tuple (0.99,2.99) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_tuple (3,3) House 314159
|
||||
dictGetOrDefault test_01037.dict_tuple (5,6) Click 42
|
||||
dictGetOrDefault test_01037.dict_tuple (7.01,7.01) ee 55
|
||||
dictHas test_01037.dict_array (-100,-42) 0
|
||||
dictHas test_01037.dict_array (-1,0) 1
|
||||
dictHas test_01037.dict_array (-0.1,0) 1
|
||||
dictHas test_01037.dict_array (0,-2) 1
|
||||
dictHas test_01037.dict_array (0,-1.1) 1
|
||||
dictHas test_01037.dict_array (0,-1) 1
|
||||
dictHas test_01037.dict_array (0,0) 1
|
||||
dictHas test_01037.dict_array (0,1) 1
|
||||
dictHas test_01037.dict_array (0,1.1) 1
|
||||
dictHas test_01037.dict_array (0,2) 1
|
||||
dictHas test_01037.dict_array (0.1,0) 1
|
||||
dictHas test_01037.dict_array (0.99,2.99) 1
|
||||
dictHas test_01037.dict_array (1,0) 1
|
||||
dictHas test_01037.dict_array (1,1) 1
|
||||
dictHas test_01037.dict_array (1,3) 1
|
||||
dictHas test_01037.dict_array (3,3) 1
|
||||
dictHas test_01037.dict_array (5,1) 1
|
||||
dictHas test_01037.dict_array (5,5) 1
|
||||
dictHas test_01037.dict_array (5,6) 1
|
||||
dictHas test_01037.dict_array (7.01,7.01) 0
|
||||
dictHas test_01037.dict_tuple (-100,-42) 0
|
||||
dictHas test_01037.dict_tuple (-1,0) 1
|
||||
dictHas test_01037.dict_tuple (-0.1,0) 1
|
||||
dictHas test_01037.dict_tuple (0,-2) 1
|
||||
dictHas test_01037.dict_tuple (0,-1.1) 1
|
||||
dictHas test_01037.dict_tuple (0,-1) 1
|
||||
dictHas test_01037.dict_tuple (0,0) 1
|
||||
dictHas test_01037.dict_tuple (0,1) 1
|
||||
dictHas test_01037.dict_tuple (0,1.1) 1
|
||||
dictHas test_01037.dict_tuple (0,2) 1
|
||||
dictHas test_01037.dict_tuple (0.1,0) 1
|
||||
dictHas test_01037.dict_tuple (0.99,2.99) 1
|
||||
dictHas test_01037.dict_tuple (1,0) 1
|
||||
dictHas test_01037.dict_tuple (1,1) 1
|
||||
dictHas test_01037.dict_tuple (1,3) 1
|
||||
dictHas test_01037.dict_tuple (3,3) 1
|
||||
dictHas test_01037.dict_tuple (5,1) 1
|
||||
dictHas test_01037.dict_tuple (5,5) 1
|
||||
dictHas test_01037.dict_tuple (5,6) 1
|
||||
dictHas test_01037.dict_tuple (7.01,7.01) 0
|
@ -0,0 +1,107 @@
|
||||
SET send_logs_level = 'none';
|
||||
|
||||
DROP DATABASE IF EXISTS test_01037;
|
||||
|
||||
CREATE DATABASE test_01037 Engine = Ordinary;
|
||||
|
||||
DROP DICTIONARY IF EXISTS test_01037.dict_array;
|
||||
DROP TABLE IF EXISTS test_01037.polygons_array;
|
||||
|
||||
CREATE TABLE test_01037.polygons_array (key Array(Array(Array(Array(Float64)))), name String, value UInt64) ENGINE = Memory;
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[[[1, 3], [1, 1], [3, 1], [3, -1], [1, -1], [1, -3], [-1, -3], [-1, -1], [-3, -1], [-3, 1], [-1, 1], [-1, 3]]], [[[5, 5], [5, 1], [7, 1], [7, 7], [1, 7], [1, 5]]]], 'Click', 42);
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[[[5, 5], [5, -5], [-5, -5], [-5, 5]], [[1, 3], [1, 1], [3, 1], [3, -1], [1, -1], [1, -3], [-1, -3], [-1, -1], [-3, -1], [-3, 1], [-1, 1], [-1, 3]]]], 'House', 314159);
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[[[3, 1], [0, 1], [0, -1], [3, -1]]]], 'Click East', 421);
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[[[-1, 1], [1, 1], [1, 3], [-1, 3]]]], 'Click North', 422);
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[[[-3, 1], [-3, -1], [0, -1], [0, 1]]]], 'Click South', 423);
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[[[-1, -1], [1, -1], [1, -3], [-1, -3]]]], 'Click West', 424);
|
||||
|
||||
CREATE DICTIONARY test_01037.dict_array
|
||||
(
|
||||
key Array(Array(Array(Array(Float64)))),
|
||||
name String DEFAULT 'qqq',
|
||||
value UInt64 DEFAULT 101
|
||||
)
|
||||
PRIMARY KEY key
|
||||
SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'polygons_array' PASSWORD '' DB 'test_01037'))
|
||||
LIFETIME(MIN 1 MAX 10)
|
||||
LAYOUT(POLYGON());
|
||||
|
||||
DROP DICTIONARY IF EXISTS test_01037.dict_tuple;
|
||||
DROP TABLE IF EXISTS test_01037.polygons_tuple;
|
||||
|
||||
CREATE TABLE test_01037.polygons_tuple (key Array(Array(Array(Tuple(Float64, Float64)))), name String, value UInt64) ENGINE = Memory;
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([[[(1, 3), (1, 1), (3, 1), (3, -1), (1, -1), (1, -3), (-1, -3), (-1, -1), (-3, -1), (-3, 1), (-1, 1), (-1, 3)]], [[(5, 5), (5, 1), (7, 1), (7, 7), (1, 7), (1, 5)]]], 'Click', 42);
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([[[(5, 5), (5, -5), (-5, -5), (-5, 5)], [(1, 3), (1, 1), (3, 1), (3, -1), (1, -1), (1, -3), (-1, -3), (-1, -1), (-3, -1), (-3, 1), (-1, 1), (-1, 3)]]], 'House', 314159);
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([[[(3, 1), (0, 1), (0, -1), (3, -1)]]], 'Click East', 421);
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([[[(-1, 1), (1, 1), (1, 3), (-1, 3)]]], 'Click North', 422);
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([[[(-3, 1), (-3, -1), (0, -1), (0, 1)]]], 'Click South', 423);
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([[[(-1, -1), (1, -1), (1, -3), (-1, -3)]]], 'Click West', 424);
|
||||
|
||||
CREATE DICTIONARY test_01037.dict_tuple
|
||||
(
|
||||
key Array(Array(Array(Tuple(Float64, Float64)))),
|
||||
name String DEFAULT 'qqq',
|
||||
value UInt64 DEFAULT 101
|
||||
)
|
||||
PRIMARY KEY key
|
||||
SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'polygons_tuple' PASSWORD '' DB 'test_01037'))
|
||||
LIFETIME(MIN 1 MAX 10)
|
||||
LAYOUT(POLYGON());
|
||||
|
||||
DROP TABLE IF EXISTS test_01037.points;
|
||||
|
||||
CREATE TABLE test_01037.points (x Float64, y Float64, def_i UInt64, def_s String) ENGINE = Memory;
|
||||
INSERT INTO test_01037.points VALUES (0.1, 0.0, 112, 'aax');
|
||||
INSERT INTO test_01037.points VALUES (-0.1, 0.0, 113, 'aay');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 1.1, 114, 'aaz');
|
||||
INSERT INTO test_01037.points VALUES (0.0, -1.1, 115, 'aat');
|
||||
INSERT INTO test_01037.points VALUES (3.0, 3.0, 22, 'bb');
|
||||
INSERT INTO test_01037.points VALUES (5.0, 6.0, 33, 'cc');
|
||||
INSERT INTO test_01037.points VALUES (-100.0, -42.0, 44, 'dd');
|
||||
INSERT INTO test_01037.points VALUES (7.01, 7.01, 55, 'ee')
|
||||
INSERT INTO test_01037.points VALUES (0.99, 2.99, 66, 'ee');
|
||||
INSERT INTO test_01037.points VALUES (1.0, 0.0, 771, 'ffa');
|
||||
INSERT INTO test_01037.points VALUES (-1.0, 0.0, 772, 'ffb');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 2.0, 773, 'ffc');
|
||||
INSERT INTO test_01037.points VALUES (0.0, -2.0, 774, 'ffd');
|
||||
|
||||
select 'dictGet', 'test_01037.dict_array' as dict_name, tuple(x, y) as key,
|
||||
dictGet(dict_name, 'name', key),
|
||||
dictGet(dict_name, 'value', key) from test_01037.points order by x, y;
|
||||
select 'dictGetOrDefault', 'test_01037.dict_array' as dict_name, tuple(x, y) as key,
|
||||
dictGetOrDefault(dict_name, 'name', key, 'www'),
|
||||
dictGetOrDefault(dict_name, 'value', key, toUInt64(1234)) from test_01037.points order by x, y;
|
||||
select 'dictGetOrDefault', 'test_01037.dict_array' as dict_name, tuple(x, y) as key,
|
||||
dictGetOrDefault(dict_name, 'name', key, def_s),
|
||||
dictGetOrDefault(dict_name, 'value', key, def_i) from test_01037.points order by x, y;
|
||||
|
||||
select 'dictGet', 'test_01037.dict_tuple' as dict_name, tuple(x, y) as key,
|
||||
dictGet(dict_name, 'name', key),
|
||||
dictGet(dict_name, 'value', key) from test_01037.points order by x, y;
|
||||
select 'dictGetOrDefault', 'test_01037.dict_tuple' as dict_name, tuple(x, y) as key,
|
||||
dictGetOrDefault(dict_name, 'name', key, 'www'),
|
||||
dictGetOrDefault(dict_name, 'value', key, toUInt64(1234)) from test_01037.points order by x, y;
|
||||
select 'dictGetOrDefault', 'test_01037.dict_tuple' as dict_name, tuple(x, y) as key,
|
||||
dictGetOrDefault(dict_name, 'name', key, def_s),
|
||||
dictGetOrDefault(dict_name, 'value', key, def_i) from test_01037.points order by x, y;
|
||||
|
||||
INSERT INTO test_01037.points VALUES (5.0, 5.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (5.0, 1.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (1.0, 3.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 0.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 1.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (0.0, -1.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (1.0, 1.0, 0, '');
|
||||
|
||||
select 'dictHas', 'test_01037.dict_array' as dict_name, tuple(x, y) as key,
|
||||
dictHas(dict_name, key) from test_01037.points order by x, y;
|
||||
|
||||
select 'dictHas', 'test_01037.dict_tuple' as dict_name, tuple(x, y) as key,
|
||||
dictHas(dict_name, key) from test_01037.points order by x, y;
|
||||
|
||||
DROP DICTIONARY test_01037.dict_array;
|
||||
DROP DICTIONARY test_01037.dict_tuple;
|
||||
DROP TABLE test_01037.polygons_array;
|
||||
DROP TABLE test_01037.polygons_tuple;
|
||||
DROP TABLE test_01037.points;
|
||||
DROP DATABASE test_01037;
|
@ -0,0 +1,142 @@
|
||||
dictGet test_01037.dict_array (-100,-42) qqq 101
|
||||
dictGet test_01037.dict_array (-1,0) Click South 423
|
||||
dictGet test_01037.dict_array (-0.1,0) Click South 423
|
||||
dictGet test_01037.dict_array (0,-2) Click West 424
|
||||
dictGet test_01037.dict_array (0,-1.1) Click West 424
|
||||
dictGet test_01037.dict_array (0,1.1) Click North 422
|
||||
dictGet test_01037.dict_array (0,2) Click North 422
|
||||
dictGet test_01037.dict_array (0.1,0) Click East 421
|
||||
dictGet test_01037.dict_array (0.99,2.99) Click North 422
|
||||
dictGet test_01037.dict_array (1,0) Click East 421
|
||||
dictGet test_01037.dict_array (2,4) House 523
|
||||
dictGet test_01037.dict_array (2,4.1) qqq 101
|
||||
dictGet test_01037.dict_array (3,3) House 523
|
||||
dictGet test_01037.dict_array (4,4) House 523
|
||||
dictGet test_01037.dict_array (5,6) qqq 101
|
||||
dictGet test_01037.dict_array (7.01,7.01) qqq 101
|
||||
dictGetOrDefault test_01037.dict_array (-100,-42) www 1234
|
||||
dictGetOrDefault test_01037.dict_array (-1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_array (-0.1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_array (0,-2) Click West 424
|
||||
dictGetOrDefault test_01037.dict_array (0,-1.1) Click West 424
|
||||
dictGetOrDefault test_01037.dict_array (0,1.1) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (0,2) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (0.1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_array (0.99,2.99) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_array (2,4) House 523
|
||||
dictGetOrDefault test_01037.dict_array (2,4.1) www 1234
|
||||
dictGetOrDefault test_01037.dict_array (3,3) House 523
|
||||
dictGetOrDefault test_01037.dict_array (4,4) House 523
|
||||
dictGetOrDefault test_01037.dict_array (5,6) www 1234
|
||||
dictGetOrDefault test_01037.dict_array (7.01,7.01) www 1234
|
||||
dictGetOrDefault test_01037.dict_array (-100,-42) dd 44
|
||||
dictGetOrDefault test_01037.dict_array (-1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_array (-0.1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_array (0,-2) Click West 424
|
||||
dictGetOrDefault test_01037.dict_array (0,-1.1) Click West 424
|
||||
dictGetOrDefault test_01037.dict_array (0,1.1) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (0,2) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (0.1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_array (0.99,2.99) Click North 422
|
||||
dictGetOrDefault test_01037.dict_array (1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_array (2,4) House 523
|
||||
dictGetOrDefault test_01037.dict_array (2,4.1) gac 803
|
||||
dictGetOrDefault test_01037.dict_array (3,3) House 523
|
||||
dictGetOrDefault test_01037.dict_array (4,4) House 523
|
||||
dictGetOrDefault test_01037.dict_array (5,6) cc 33
|
||||
dictGetOrDefault test_01037.dict_array (7.01,7.01) ee 55
|
||||
dictGet test_01037.dict_tuple (-100,-42) qqq 101
|
||||
dictGet test_01037.dict_tuple (-1,0) Click South 423
|
||||
dictGet test_01037.dict_tuple (-0.1,0) Click South 423
|
||||
dictGet test_01037.dict_tuple (0,-2) Click West 424
|
||||
dictGet test_01037.dict_tuple (0,-1.1) Click West 424
|
||||
dictGet test_01037.dict_tuple (0,1.1) Click North 422
|
||||
dictGet test_01037.dict_tuple (0,2) Click North 422
|
||||
dictGet test_01037.dict_tuple (0.1,0) Click East 421
|
||||
dictGet test_01037.dict_tuple (0.99,2.99) Click North 422
|
||||
dictGet test_01037.dict_tuple (1,0) Click East 421
|
||||
dictGet test_01037.dict_tuple (2,4) House 523
|
||||
dictGet test_01037.dict_tuple (2,4.1) qqq 101
|
||||
dictGet test_01037.dict_tuple (3,3) House 523
|
||||
dictGet test_01037.dict_tuple (4,4) House 523
|
||||
dictGet test_01037.dict_tuple (5,6) qqq 101
|
||||
dictGet test_01037.dict_tuple (7.01,7.01) qqq 101
|
||||
dictGetOrDefault test_01037.dict_tuple (-100,-42) www 1234
|
||||
dictGetOrDefault test_01037.dict_tuple (-1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_tuple (-0.1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_tuple (0,-2) Click West 424
|
||||
dictGetOrDefault test_01037.dict_tuple (0,-1.1) Click West 424
|
||||
dictGetOrDefault test_01037.dict_tuple (0,1.1) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (0,2) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (0.1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_tuple (0.99,2.99) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_tuple (2,4) House 523
|
||||
dictGetOrDefault test_01037.dict_tuple (2,4.1) www 1234
|
||||
dictGetOrDefault test_01037.dict_tuple (3,3) House 523
|
||||
dictGetOrDefault test_01037.dict_tuple (4,4) House 523
|
||||
dictGetOrDefault test_01037.dict_tuple (5,6) www 1234
|
||||
dictGetOrDefault test_01037.dict_tuple (7.01,7.01) www 1234
|
||||
dictGetOrDefault test_01037.dict_tuple (-100,-42) dd 44
|
||||
dictGetOrDefault test_01037.dict_tuple (-1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_tuple (-0.1,0) Click South 423
|
||||
dictGetOrDefault test_01037.dict_tuple (0,-2) Click West 424
|
||||
dictGetOrDefault test_01037.dict_tuple (0,-1.1) Click West 424
|
||||
dictGetOrDefault test_01037.dict_tuple (0,1.1) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (0,2) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (0.1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_tuple (0.99,2.99) Click North 422
|
||||
dictGetOrDefault test_01037.dict_tuple (1,0) Click East 421
|
||||
dictGetOrDefault test_01037.dict_tuple (2,4) House 523
|
||||
dictGetOrDefault test_01037.dict_tuple (2,4.1) gac 803
|
||||
dictGetOrDefault test_01037.dict_tuple (3,3) House 523
|
||||
dictGetOrDefault test_01037.dict_tuple (4,4) House 523
|
||||
dictGetOrDefault test_01037.dict_tuple (5,6) cc 33
|
||||
dictGetOrDefault test_01037.dict_tuple (7.01,7.01) ee 55
|
||||
dictHas test_01037.dict_array (-100,-42) 0
|
||||
dictHas test_01037.dict_array (-1,0) 1
|
||||
dictHas test_01037.dict_array (-0.1,0) 1
|
||||
dictHas test_01037.dict_array (0,-2) 1
|
||||
dictHas test_01037.dict_array (0,-1.1) 1
|
||||
dictHas test_01037.dict_array (0,-1) 1
|
||||
dictHas test_01037.dict_array (0,0) 1
|
||||
dictHas test_01037.dict_array (0,1) 1
|
||||
dictHas test_01037.dict_array (0,1.1) 1
|
||||
dictHas test_01037.dict_array (0,2) 1
|
||||
dictHas test_01037.dict_array (0.1,0) 1
|
||||
dictHas test_01037.dict_array (0.99,2.99) 1
|
||||
dictHas test_01037.dict_array (1,0) 1
|
||||
dictHas test_01037.dict_array (1,1) 1
|
||||
dictHas test_01037.dict_array (1,3) 1
|
||||
dictHas test_01037.dict_array (2,4) 1
|
||||
dictHas test_01037.dict_array (2,4.1) 0
|
||||
dictHas test_01037.dict_array (3,3) 1
|
||||
dictHas test_01037.dict_array (4,4) 1
|
||||
dictHas test_01037.dict_array (5,1) 1
|
||||
dictHas test_01037.dict_array (5,5) 1
|
||||
dictHas test_01037.dict_array (5,6) 0
|
||||
dictHas test_01037.dict_array (7.01,7.01) 0
|
||||
dictHas test_01037.dict_tuple (-100,-42) 0
|
||||
dictHas test_01037.dict_tuple (-1,0) 1
|
||||
dictHas test_01037.dict_tuple (-0.1,0) 1
|
||||
dictHas test_01037.dict_tuple (0,-2) 1
|
||||
dictHas test_01037.dict_tuple (0,-1.1) 1
|
||||
dictHas test_01037.dict_tuple (0,-1) 1
|
||||
dictHas test_01037.dict_tuple (0,0) 1
|
||||
dictHas test_01037.dict_tuple (0,1) 1
|
||||
dictHas test_01037.dict_tuple (0,1.1) 1
|
||||
dictHas test_01037.dict_tuple (0,2) 1
|
||||
dictHas test_01037.dict_tuple (0.1,0) 1
|
||||
dictHas test_01037.dict_tuple (0.99,2.99) 1
|
||||
dictHas test_01037.dict_tuple (1,0) 1
|
||||
dictHas test_01037.dict_tuple (1,1) 1
|
||||
dictHas test_01037.dict_tuple (1,3) 1
|
||||
dictHas test_01037.dict_tuple (2,4) 1
|
||||
dictHas test_01037.dict_tuple (2,4.1) 0
|
||||
dictHas test_01037.dict_tuple (3,3) 1
|
||||
dictHas test_01037.dict_tuple (4,4) 1
|
||||
dictHas test_01037.dict_tuple (5,1) 1
|
||||
dictHas test_01037.dict_tuple (5,5) 1
|
||||
dictHas test_01037.dict_tuple (5,6) 0
|
||||
dictHas test_01037.dict_tuple (7.01,7.01) 0
|
@ -0,0 +1,108 @@
|
||||
SET send_logs_level = 'none';
|
||||
|
||||
DROP DATABASE IF EXISTS test_01037;
|
||||
|
||||
CREATE DATABASE test_01037 Engine = Ordinary;
|
||||
|
||||
DROP DICTIONARY IF EXISTS test_01037.dict_array;
|
||||
DROP TABLE IF EXISTS test_01037.polygons_array;
|
||||
|
||||
CREATE TABLE test_01037.polygons_array (key Array(Array(Float64)), name String, value UInt64) ENGINE = Memory;
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[3, 1], [0, 1], [0, -1], [3, -1]], 'Click East', 421);
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[-1, 1], [1, 1], [1, 3], [-1, 3]], 'Click North', 422);
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[-3, 1], [-3, -1], [0, -1], [0, 1]], 'Click South', 423);
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[-1, -1], [1, -1], [1, -3], [-1, -3]], 'Click West', 424);
|
||||
INSERT INTO test_01037.polygons_array VALUES ([[1, 1], [1, 3], [3, 5], [5, 5], [5, 1]], 'House', 523);
|
||||
|
||||
CREATE DICTIONARY test_01037.dict_array
|
||||
(
|
||||
key Array(Array(Float64)),
|
||||
name String DEFAULT 'qqq',
|
||||
value UInt64 DEFAULT 101
|
||||
)
|
||||
PRIMARY KEY key
|
||||
SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'polygons_array' PASSWORD '' DB 'test_01037'))
|
||||
LIFETIME(MIN 1 MAX 10)
|
||||
LAYOUT(POLYGON());
|
||||
|
||||
DROP DICTIONARY IF EXISTS test_01037.dict_tuple;
|
||||
DROP TABLE IF EXISTS test_01037.polygons_tuple;
|
||||
|
||||
CREATE TABLE test_01037.polygons_tuple (key Array(Tuple(Float64, Float64)), name String, value UInt64) ENGINE = Memory;
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([(3.0, 1.0), (0.0, 1.0), (0.0, -1.0), (3.0, -1.0)], 'Click East', 421);
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([(-1, 1), (1, 1), (1, 3), (-1, 3)], 'Click North', 422);
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([(-3, 1), (-3, -1), (0, -1), (0, 1)], 'Click South', 423);
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([(-1, -1), (1, -1), (1, -3), (-1, -3)], 'Click West', 424);
|
||||
INSERT INTO test_01037.polygons_tuple VALUES ([(1, 1), (1, 3), (3, 5), (5, 5), (5, 1)], 'House', 523);
|
||||
|
||||
CREATE DICTIONARY test_01037.dict_tuple
|
||||
(
|
||||
key Array(Tuple(Float64, Float64)),
|
||||
name String DEFAULT 'qqq',
|
||||
value UInt64 DEFAULT 101
|
||||
)
|
||||
PRIMARY KEY key
|
||||
SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'polygons_tuple' PASSWORD '' DB 'test_01037'))
|
||||
LIFETIME(MIN 1 MAX 10)
|
||||
LAYOUT(POLYGON());
|
||||
|
||||
DROP TABLE IF EXISTS test_01037.points;
|
||||
|
||||
CREATE TABLE test_01037.points (x Float64, y Float64, def_i UInt64, def_s String) ENGINE = Memory;
|
||||
INSERT INTO test_01037.points VALUES (0.1, 0.0, 112, 'aax');
|
||||
INSERT INTO test_01037.points VALUES (-0.1, 0.0, 113, 'aay');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 1.1, 114, 'aaz');
|
||||
INSERT INTO test_01037.points VALUES (0.0, -1.1, 115, 'aat');
|
||||
INSERT INTO test_01037.points VALUES (3.0, 3.0, 22, 'bb');
|
||||
INSERT INTO test_01037.points VALUES (5.0, 6.0, 33, 'cc');
|
||||
INSERT INTO test_01037.points VALUES (-100.0, -42.0, 44, 'dd');
|
||||
INSERT INTO test_01037.points VALUES (7.01, 7.01, 55, 'ee')
|
||||
INSERT INTO test_01037.points VALUES (0.99, 2.99, 66, 'ee');
|
||||
INSERT INTO test_01037.points VALUES (1.0, 0.0, 771, 'ffa');
|
||||
INSERT INTO test_01037.points VALUES (-1.0, 0.0, 772, 'ffb');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 2.0, 773, 'ffc');
|
||||
INSERT INTO test_01037.points VALUES (0.0, -2.0, 774, 'ffd');
|
||||
INSERT INTO test_01037.points VALUES (2.0, 4.0, 801, 'gaa')
|
||||
INSERT INTO test_01037.points VALUES (4.0, 4.0, 802, 'gab')
|
||||
INSERT INTO test_01037.points VALUES (2.0, 4.1, 803, 'gac')
|
||||
|
||||
select 'dictGet', 'test_01037.dict_array' as dict_name, tuple(x, y) as key,
|
||||
dictGet(dict_name, 'name', key),
|
||||
dictGet(dict_name, 'value', key) from test_01037.points order by x, y;
|
||||
select 'dictGetOrDefault', 'test_01037.dict_array' as dict_name, tuple(x, y) as key,
|
||||
dictGetOrDefault(dict_name, 'name', key, 'www'),
|
||||
dictGetOrDefault(dict_name, 'value', key, toUInt64(1234)) from test_01037.points order by x, y;
|
||||
select 'dictGetOrDefault', 'test_01037.dict_array' as dict_name, tuple(x, y) as key,
|
||||
dictGetOrDefault(dict_name, 'name', key, def_s),
|
||||
dictGetOrDefault(dict_name, 'value', key, def_i) from test_01037.points order by x, y;
|
||||
|
||||
select 'dictGet', 'test_01037.dict_tuple' as dict_name, tuple(x, y) as key,
|
||||
dictGet(dict_name, 'name', key),
|
||||
dictGet(dict_name, 'value', key) from test_01037.points order by x, y;
|
||||
select 'dictGetOrDefault', 'test_01037.dict_tuple' as dict_name, tuple(x, y) as key,
|
||||
dictGetOrDefault(dict_name, 'name', key, 'www'),
|
||||
dictGetOrDefault(dict_name, 'value', key, toUInt64(1234)) from test_01037.points order by x, y;
|
||||
select 'dictGetOrDefault', 'test_01037.dict_tuple' as dict_name, tuple(x, y) as key,
|
||||
dictGetOrDefault(dict_name, 'name', key, def_s),
|
||||
dictGetOrDefault(dict_name, 'value', key, def_i) from test_01037.points order by x, y;
|
||||
|
||||
INSERT INTO test_01037.points VALUES (5.0, 5.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (5.0, 1.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (1.0, 3.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 0.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (0.0, 1.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (0.0, -1.0, 0, '');
|
||||
INSERT INTO test_01037.points VALUES (1.0, 1.0, 0, '');
|
||||
|
||||
select 'dictHas', 'test_01037.dict_array' as dict_name, tuple(x, y) as key,
|
||||
dictHas(dict_name, key) from test_01037.points order by x, y;
|
||||
|
||||
select 'dictHas', 'test_01037.dict_tuple' as dict_name, tuple(x, y) as key,
|
||||
dictHas(dict_name, key) from test_01037.points order by x, y;
|
||||
|
||||
DROP DICTIONARY test_01037.dict_array;
|
||||
DROP DICTIONARY test_01037.dict_tuple;
|
||||
DROP TABLE test_01037.polygons_array;
|
||||
DROP TABLE test_01037.polygons_tuple;
|
||||
DROP TABLE test_01037.points;
|
||||
DROP DATABASE test_01037;
|
Loading…
Reference in New Issue
Block a user