This is an automated email from the ASF dual-hosted git repository.

kangrong pushed a commit to branch f_index_dev
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/f_index_dev by this push:
     new 16874da  fix bug
16874da is described below

commit 16874da22483159317cdff3aa292604588c34cac
Author: kr11 <3095717866.com>
AuthorDate: Tue May 11 01:09:54 2021 +0800

    fix bug
---
 .../iotdb/db/index/algorithm/DSTreeIndex.java      | 41 ---------------------
 .../apache/iotdb/db/index/algorithm/ISAXIndex.java | 43 ----------------------
 .../iotdb/db/index/algorithm/mmhh/MMHHIndex.java   |  4 +-
 .../iotdb/db/index/router/ProtoIndexRouter.java    |  1 +
 .../apache/iotdb/db/index/it/MMHHIndexReadIT.java  | 12 +++---
 5 files changed, 11 insertions(+), 90 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/index/algorithm/DSTreeIndex.java 
b/server/src/main/java/org/apache/iotdb/db/index/algorithm/DSTreeIndex.java
deleted file mode 100644
index 496757c..0000000
--- a/server/src/main/java/org/apache/iotdb/db/index/algorithm/DSTreeIndex.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-package org.apache.iotdb.db.index.algorithm;
-
-import org.apache.iotdb.db.index.common.IndexInfo;
-import org.apache.iotdb.db.metadata.PartialPath;
-
-/**
- * The DSTree approach uses the EAPCA representation technique, which allows, 
during node splitting,
- * the resolution of a representation to increase along two dimensions: 
vertically and horizontally.
- * (Instead, SAX-based indexes allow horizontal splitting by adding a 
breakpoint to the y-axis, and
- * SFA allows vertical splitting by adding a new DFT coefficient.) In addition 
to a lower bounding
- * distance, the DSTree also supports an upper bounding distance. It uses both 
distances to
- * determine the optimal splitting policy for each node.
- *
- * <p>The Lernaean Hydra of Data Series Similarity Search: An Experimental 
Evaluation of the State
- * of the Art Echihabi et al. VLDB2018 TODO To be implemented.
- *
- * <p>
- */
-public abstract class DSTreeIndex extends IoTDBIndex {
-
-  public DSTreeIndex(PartialPath path, IndexInfo indexInfo) {
-    super(path, null, indexInfo);
-  }
-}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/index/algorithm/ISAXIndex.java 
b/server/src/main/java/org/apache/iotdb/db/index/algorithm/ISAXIndex.java
deleted file mode 100644
index bfea4b6..0000000
--- a/server/src/main/java/org/apache/iotdb/db/index/algorithm/ISAXIndex.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-package org.apache.iotdb.db.index.algorithm;
-
-import org.apache.iotdb.db.index.common.IndexInfo;
-import org.apache.iotdb.db.metadata.PartialPath;
-
-/**
- * ISAXIndex first splits the input data into segments and extracts their 
discrete SAX features, and
- * then inserts the data features into a root leaf node. When the number of 
series of a leaf node
- * reaches the given threshold, ISAXIndex will upscale the resolution of SAX 
features, thus dividing
- * them into two leaf nodes. The SAX lower bound constraint is used to 
guarantee no-false-dismissals
- * pruning.
- *
- * <p>In some indexing techniques, ISAXIndex is composed of a list of 
subtrees.Suppose the input
- * series is divided into {@code b} segments, all data will be first divided 
into {@code 2^b}
- * sub-index tree according to the first-bits of SAX features.
- *
- * <p>TODO To be implemented.
- *
- * <p>
- */
-public abstract class ISAXIndex extends IoTDBIndex {
-
-  public ISAXIndex(PartialPath path, IndexInfo indexInfo) {
-    super(path, null, indexInfo);
-  }
-}
diff --git 
a/server/src/main/java/org/apache/iotdb/db/index/algorithm/mmhh/MMHHIndex.java 
b/server/src/main/java/org/apache/iotdb/db/index/algorithm/mmhh/MMHHIndex.java
index 4d8702c..86cc5b0 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/index/algorithm/mmhh/MMHHIndex.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/index/algorithm/mmhh/MMHHIndex.java
@@ -423,7 +423,9 @@ public class MMHHIndex extends IoTDBIndex {
       }
     }
     resList.sort(Comparator.comparingDouble(o -> o.backDist));
-    resList.subList(tempQueryStruct.topK, resList.size()).clear();
+    if(tempQueryStruct.topK < resList.size()){
+      resList.subList(tempQueryStruct.topK, resList.size()).clear();
+    }
   }
 
   private long reverseBit(long hashCode, int idx) {
diff --git 
a/server/src/main/java/org/apache/iotdb/db/index/router/ProtoIndexRouter.java 
b/server/src/main/java/org/apache/iotdb/db/index/router/ProtoIndexRouter.java
index 165f129..640027c 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/index/router/ProtoIndexRouter.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/index/router/ProtoIndexRouter.java
@@ -202,6 +202,7 @@ public class ProtoIndexRouter implements IIndexRouter {
     lock.readLock().lock();
     try {
       IndexProcessorStruct struct;
+      partialPath.toLowerCase();
       if (partialPath.isFullPath()) {
         String fullPath = partialPath.getFullPath();
         if (!fullPathProcessorMap.containsKey(fullPath)) {
diff --git 
a/server/src/test/java/org/apache/iotdb/db/index/it/MMHHIndexReadIT.java 
b/server/src/test/java/org/apache/iotdb/db/index/it/MMHHIndexReadIT.java
index 6a4bbd6..0b257b2 100644
--- a/server/src/test/java/org/apache/iotdb/db/index/it/MMHHIndexReadIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/index/it/MMHHIndexReadIT.java
@@ -90,7 +90,9 @@ public class MMHHIndexReadIT {
               wholeDim,
               hashLength,
               MODEL_PATH,
-              
"\"/Users/kangrong/code/github/deep-learning/hash_journal/TAH_project/src/mmhh.pt\""));
+//              
"\"/Users/kangrong/code/github/deep-learning/hash_journal/TAH_project/src/mmhh.pt\""
+              "\"resources/index/mmhh.pt\""
+          ));
       //      String modelPath =
       // 
"/Users/kangrong/code/github/deep-learning/hash_journal/TAH_project/src/mmhh.pt";
       String modelPath = "src/test/resources/index/mmhh.pt";
@@ -141,15 +143,15 @@ public class MMHHIndexReadIT {
 
       String querySQL =
           String.format(
-              "SELECT TOP 5 direction FROM root.wind2.* WHERE direction LIKE 
(%s)",
+              "SELECT TOP 2 direction FROM root.wind2.* WHERE direction LIKE 
(%s)",
               getArrayRange(121, 121 + wholeDim));
 
       System.out.println(querySQL);
       boolean hasIndex = statement.execute(querySQL);
       StringBuilder gt = new StringBuilder();
-      
gt.append("Time,root.wind2.1.direction.(D=0.00),root.wind2.4.direction.(D=1.00),\n");
+      
gt.append("Time,root.wind2.1.direction.(D=0.00),root.wind2.2.direction.(D=1.00),\n");
       for (int i = 0; i < 100; i++) {
-        gt.append(String.format("%d,%.1f,%.1f,\n", i, 100f + i, 400f + i));
+        gt.append(String.format("%d,%.1f,%.1f,\n", i, 100f + i, 200f + i));
       }
       Assert.assertTrue(hasIndex);
       try (ResultSet resultSet = statement.getResultSet()) {
@@ -166,7 +168,7 @@ public class MMHHIndexReadIT {
           sb.append("\n");
         }
         System.out.println(sb);
-        //        Assert.assertEquals(gt.toString(), sb.toString());
+        Assert.assertEquals(gt.toString(), sb.toString());
       }
     } catch (Exception e) {
       e.printStackTrace();

Reply via email to