uchenily commented on code in PR #64592: URL: https://github.com/apache/doris/pull/64592#discussion_r3456877614
########## regression-test/suites/ann_index_p0/ivf_rabitq_index_test.groovy: ########## @@ -0,0 +1,79 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("ivf_rabitq_index_test") { + sql "set enable_common_expr_pushdown=true;" + + sql "drop table if exists ivf_rabitq_tbl_ann_l2" + sql """ + CREATE TABLE ivf_rabitq_tbl_ann_l2 ( + id INT NOT NULL, + embedding ARRAY<FLOAT> NOT NULL, + INDEX idx_emb (`embedding`) USING ANN PROPERTIES( + "index_type"="ivf", + "metric_type"="l2_distance", + "quantizer"="rabitq", + "nlist"="3", + "dim"="3" + ) + ) ENGINE=OLAP + DUPLICATE KEY(id) + DISTRIBUTED BY HASH(id) BUCKETS 1 + PROPERTIES ("replication_num" = "1"); + """ + + sql """ + INSERT INTO ivf_rabitq_tbl_ann_l2 VALUES + (1, [1.0, 2.0, 3.0]), + (2, [0.5, 2.1, 2.9]), + (3, [10.0, 10.0, 10.0]), + (4, [20.0, 20.0, 20.0]), + (5, [50.0, 20.0, 20.0]), + (6, [60.0, 20.0, 20.0]); + """ + sql "select * from ivf_rabitq_tbl_ann_l2 order by id;" + sql "select id from ivf_rabitq_tbl_ann_l2 order by l2_distance_approximate(embedding, [1.0,2.0,3.0]) limit 2;" Review Comment: The return value of `l2_distance_approximate(...)` is an approximate result, not a definite one, so we cannot use `qt_` to check the result. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
