github-actions[bot] commented on code in PR #32436:
URL: https://github.com/apache/doris/pull/32436#discussion_r1529628510


##########
be/test/olap/rowset/segment_v2/inverted_index_array_test.cpp:
##########
@@ -0,0 +1,211 @@
+// 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.
+
+#include <CLucene.h>
+#include <CLucene/config/repl_wchar.h>
+#include <CLucene/index/IndexReader.h>
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <string.h>
+
+#include <algorithm>
+#include <memory>
+#include <string>
+
+#include "gtest/gtest_pred_impl.h"
+#include "io/fs/file_writer.h"
+#include "io/fs/local_file_system.h"
+#include "olap/rowset/segment_v2/inverted_index_compound_directory.h"
+#include "olap/rowset/segment_v2/inverted_index_compound_reader.h"
+#include "olap/rowset/segment_v2/inverted_index_writer.h"
+#include "olap/rowset/segment_v2/zone_map_index.h"
+#include "olap/tablet_schema.h"
+#include "olap/tablet_schema_helper.h"
+#include "util/slice.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/columns/column_string.h"
+#include "vec/common/pod_array_fwd.h"
+#include "vec/core/field.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_factory.hpp"
+#include "vec/olap/olap_data_convertor.h"
+
+using namespace lucene::index;
+
+namespace doris {
+namespace segment_v2 {

Review Comment:
   warning: nested namespaces can be concatenated 
[modernize-concat-nested-namespaces]
   
   ```suggestion
   namespace doris::segment_v2 {
   ```
   
   be/test/olap/rowset/segment_v2/inverted_index_array_test.cpp:209:
   ```diff
   - } // namespace segment_v2
   - } // namespace doris
   + } // namespace doris
   ```
   



##########
be/test/olap/rowset/segment_v2/inverted_index_array_test.cpp:
##########
@@ -0,0 +1,211 @@
+// 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.
+
+#include <CLucene.h>
+#include <CLucene/config/repl_wchar.h>
+#include <CLucene/index/IndexReader.h>
+#include <gtest/gtest-message.h>
+#include <gtest/gtest-test-part.h>
+#include <string.h>
+
+#include <algorithm>
+#include <memory>
+#include <string>
+
+#include "gtest/gtest_pred_impl.h"
+#include "io/fs/file_writer.h"
+#include "io/fs/local_file_system.h"
+#include "olap/rowset/segment_v2/inverted_index_compound_directory.h"
+#include "olap/rowset/segment_v2/inverted_index_compound_reader.h"
+#include "olap/rowset/segment_v2/inverted_index_writer.h"
+#include "olap/rowset/segment_v2/zone_map_index.h"
+#include "olap/tablet_schema.h"
+#include "olap/tablet_schema_helper.h"
+#include "util/slice.h"
+#include "vec/columns/column_array.h"
+#include "vec/columns/column_nullable.h"
+#include "vec/columns/column_string.h"
+#include "vec/common/pod_array_fwd.h"
+#include "vec/core/field.h"
+#include "vec/core/types.h"
+#include "vec/data_types/data_type_array.h"
+#include "vec/data_types/data_type_factory.hpp"
+#include "vec/olap/olap_data_convertor.h"
+
+using namespace lucene::index;
+
+namespace doris {
+namespace segment_v2 {
+
+class InvertedIndexArrayTest : public testing::Test {
+public:
+    const std::string kTestDir = "./ut_dir/inverted_index_array_test";
+
+    void check_terms_stats(string dir_str, string file_str) {
+        auto fs = io::global_local_filesystem();
+        std::unique_ptr<DorisCompoundReader> reader = 
std::make_unique<DorisCompoundReader>(
+                DorisCompoundDirectoryFactory::getDirectory(fs, 
dir_str.c_str()), file_str.c_str(),
+                4096);
+        std::cout << "Term statistics for " << file_str << std::endl;
+        std::cout << "==================================" << std::endl;
+        lucene::store::Directory* dir = reader.get();
+
+        IndexReader* r = IndexReader::open(dir);
+
+        printf("Max Docs: %d\n", r->maxDoc());
+        printf("Num Docs: %d\n", r->numDocs());
+
+        TermEnum* te = r->terms();
+        int32_t nterms;
+        for (nterms = 0; te->next(); nterms++) {
+            /* empty */
+            std::string token =
+                    lucene_wcstoutf8string(te->term(false)->text(), 
te->term(false)->textLength());
+
+            printf("Term: %s ", token.c_str());
+            printf("Freq: %d\n", te->docFreq());
+        }
+        printf("Term count: %d\n\n", nterms);
+        te->close();
+        _CLLDELETE(te);
+
+        r->close();
+        _CLLDELETE(r);
+        reader->close();
+    }
+
+    void SetUp() override {
+        auto st = io::global_local_filesystem()->delete_directory(kTestDir);
+        ASSERT_TRUE(st.ok()) << st;
+        st = io::global_local_filesystem()->create_directory(kTestDir);
+        ASSERT_TRUE(st.ok()) << st;
+        config::enable_write_index_searcher_cache = false;
+    }
+    void TearDown() override {
+        //        
EXPECT_TRUE(io::global_local_filesystem()->delete_directory(kTestDir).ok());
+    }
+
+    void test_string(std::string testname, Field* field) {

Review Comment:
   warning: function 'test_string' exceeds recommended size/complexity 
thresholds [readability-function-size]
   ```cpp
       void test_string(std::string testname, Field* field) {
            ^
   ```
   <details>
   <summary>Additional context</summary>
   
   **be/test/olap/rowset/segment_v2/inverted_index_array_test.cpp:101:** 90 
lines including whitespace and comments (threshold 80)
   ```cpp
       void test_string(std::string testname, Field* field) {
            ^
   ```
   
   </details>
   



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to