nishant94 commented on code in PR #64667: URL: https://github.com/apache/doris/pull/64667#discussion_r3504743830
########## regression-test/suites/inverted_index_p0/analyzer/test_japanese_analyzer.groovy: ########## @@ -0,0 +1,76 @@ +// 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("test_japanese_analyzer", "p0") { + def tableName = "test_japanese_analyzer" + + def backendId_to_backendIP = [:] + def backendId_to_backendHttpPort = [:] + getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort) + def set_be_config = { key, value -> + for (String backend_id : backendId_to_backendIP.keySet()) { + update_be_config(backendId_to_backendIP.get(backend_id), + backendId_to_backendHttpPort.get(backend_id), key, value) + } + } + + sql "DROP TABLE IF EXISTS ${tableName}" + // kuromoji is disabled by default; enable it for this test. + set_be_config("enable_kuromoji_analyzer", "true") + try { + sql """ + CREATE TABLE ${tableName} ( + `id` int(11) NULL COMMENT "", + `content` text NULL COMMENT "", + INDEX content_idx (`content`) USING INVERTED PROPERTIES("parser" = "kuromoji", "parser_mode" = "search") COMMENT '', + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + COMMENT "OLAP" + DISTRIBUTED BY RANDOM BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1" + ); + """ + + sql """ INSERT INTO ${tableName} VALUES (1, "東京都に住んでいます"); """ + sql """ INSERT INTO ${tableName} VALUES (2, "私は寿司が好きです"); """ + sql """ INSERT INTO ${tableName} VALUES (3, "Apache Doris は高速です"); """ + sql "sync" + + // The kuromoji dictionary is not shipped in the p0 package, so the Review Comment: Right, with the dictionary now shipped and the fallback gone. ########## regression-test/suites/inverted_index_p0/analyzer/test_japanese_analyzer.groovy: ########## @@ -0,0 +1,76 @@ +// 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("test_japanese_analyzer", "p0") { + def tableName = "test_japanese_analyzer" + + def backendId_to_backendIP = [:] + def backendId_to_backendHttpPort = [:] + getBackendIpHttpPort(backendId_to_backendIP, backendId_to_backendHttpPort) + def set_be_config = { key, value -> + for (String backend_id : backendId_to_backendIP.keySet()) { + update_be_config(backendId_to_backendIP.get(backend_id), + backendId_to_backendHttpPort.get(backend_id), key, value) + } + } + + sql "DROP TABLE IF EXISTS ${tableName}" + // kuromoji is disabled by default; enable it for this test. + set_be_config("enable_kuromoji_analyzer", "true") + try { + sql """ + CREATE TABLE ${tableName} ( + `id` int(11) NULL COMMENT "", + `content` text NULL COMMENT "", + INDEX content_idx (`content`) USING INVERTED PROPERTIES("parser" = "kuromoji", "parser_mode" = "search") COMMENT '', + ) ENGINE=OLAP + DUPLICATE KEY(`id`) + COMMENT "OLAP" + DISTRIBUTED BY RANDOM BUCKETS 1 + PROPERTIES ( + "replication_allocation" = "tag.location.default: 1" + ); + """ + + sql """ INSERT INTO ${tableName} VALUES (1, "東京都に住んでいます"); """ + sql """ INSERT INTO ${tableName} VALUES (2, "私は寿司が好きです"); """ + sql """ INSERT INTO ${tableName} VALUES (3, "Apache Doris は高速です"); """ + sql "sync" + + // The kuromoji dictionary is not shipped in the p0 package, so the Review Comment: Updated, I rewrote `test_japanese_analyzer` to assert real morphology instead of unigrams. -- 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]
