--- Negative tests --- --- Test default GRANULARITY (should be 100 mio. for annoy)--- CREATE TABLE default.tab\n(\n `id` Int32,\n `vector` Array(Float32),\n INDEX annoy_index vector TYPE annoy GRANULARITY 100000000\n)\nENGINE = MergeTree\nORDER BY id\nSETTINGS index_granularity = 8192 CREATE TABLE default.tab\n(\n `id` Int32,\n `vector` Array(Float32),\n INDEX annoy_index vector TYPE annoy GRANULARITY 100000000\n)\nENGINE = MergeTree\nORDER BY id\nSETTINGS index_granularity = 8192 --- Test with Array, GRANULARITY = 1, index_granularity = 5 --- WHERE type, L2Distance, check that index is used Expression ((Projection + Before ORDER BY)) Limit (preliminary LIMIT (without OFFSET)) ReadFromMergeTree (default.tab) Indexes: PrimaryKey Condition: true Parts: 1/1 Granules: 3/3 Skip Name: annoy_index Description: annoy GRANULARITY 1 Parts: 1/1 Granules: 1/3 ORDER BY type, L2Distance, check that index is used Expression (Projection) Limit (preliminary LIMIT (without OFFSET)) Sorting (Sorting for ORDER BY) Expression (Before ORDER BY) ReadFromMergeTree (default.tab) Indexes: PrimaryKey Condition: true Parts: 1/1 Granules: 3/3 Skip Name: annoy_index Description: annoy GRANULARITY 1 Parts: 1/1 Granules: 3/3 Reference ARRAYs with non-matching dimension are rejected Special case: MaximumDistance is negative WHERE type, L2Distance Special case: setting annoy_index_search_k_nodes Special case: setting max_limit_for_ann_queries Expression (Projection) Limit (preliminary LIMIT (without OFFSET)) Sorting (Sorting for ORDER BY) Expression (Before ORDER BY) ReadFromMergeTree (default.tab) Indexes: PrimaryKey Condition: true Parts: 1/1 Granules: 3/3 --- Test with Tuple, GRANULARITY = 1, index_granularity = 5 --- WHERE type, L2Distance, check that index is used Expression ((Projection + Before ORDER BY)) Limit (preliminary LIMIT (without OFFSET)) ReadFromMergeTree (default.tab) Indexes: PrimaryKey Condition: true Parts: 1/1 Granules: 3/3 Skip Name: annoy_index Description: annoy GRANULARITY 1 Parts: 1/1 Granules: 1/3 ORDER BY type, L2Distance, check that index is used Expression (Projection) Limit (preliminary LIMIT (without OFFSET)) Sorting (Sorting for ORDER BY) Expression (Before ORDER BY) ReadFromMergeTree (default.tab) Indexes: PrimaryKey Condition: true Parts: 1/1 Granules: 3/3 Skip Name: annoy_index Description: annoy GRANULARITY 1 Parts: 1/1 Granules: 3/3 --- Test non-default metric (cosine distance) + non-default NumTrees (200) --- --- Test with Array, GRANULARITY = 2, index_granularity = 4 --- WHERE type, L2Distance, check that index is used Expression ((Projection + Before ORDER BY)) Limit (preliminary LIMIT (without OFFSET)) ReadFromMergeTree (default.tab) Indexes: PrimaryKey Condition: true Parts: 1/1 Granules: 4/4 Skip Name: annoy_index Description: annoy GRANULARITY 2 Parts: 0/1 Granules: 0/4 ORDER BY type, L2Distance, check that index is used Expression (Projection) Limit (preliminary LIMIT (without OFFSET)) Sorting (Sorting for ORDER BY) Expression (Before ORDER BY) ReadFromMergeTree (default.tab) Indexes: PrimaryKey Condition: true Parts: 1/1 Granules: 4/4 Skip Name: annoy_index Description: annoy GRANULARITY 2 Parts: 1/1 Granules: 2/4 --- Test with Array, GRANULARITY = 4, index_granularity = 4 --- WHERE type, L2Distance, check that index is used Expression ((Projection + Before ORDER BY)) Limit (preliminary LIMIT (without OFFSET)) ReadFromMergeTree (default.tab) Indexes: PrimaryKey Condition: true Parts: 1/1 Granules: 4/4 Skip Name: annoy_index Description: annoy GRANULARITY 4 Parts: 0/1 Granules: 0/4 ORDER BY type, L2Distance, check that index is used Expression (Projection) Limit (preliminary LIMIT (without OFFSET)) Sorting (Sorting for ORDER BY) Expression (Before ORDER BY) ReadFromMergeTree (default.tab) Indexes: PrimaryKey Condition: true Parts: 1/1 Granules: 4/4 Skip Name: annoy_index Description: annoy GRANULARITY 4 Parts: 1/1 Granules: 1/4 --- Test correctness of Annoy index with > 1 mark 1 [1,0,0,0] 9000 [9000,0,0,0] 1 (1,0,0,0) 9000 (9000,0,0,0)