Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Founding a bug about Mtree #2

Open
zongleiZhang opened this issue May 20, 2020 · 1 comment
Open

Founding a bug about Mtree #2

zongleiZhang opened this issue May 20, 2020 · 1 comment

Comments

@zongleiZhang
Copy link

DistanceFunction used by Mtree in this project returns a double-precision number. However, double-precision numbers will lose precision when calculated, which will cause some bugs. For example, some index items will not be deleted, as shown below.

public static void main(String[] args) throws Exception {
MTree tree = new MTree<>(4, Point::distancePoint, null);
Queue queue = new LinkedList<>();
File f = new File("test.txt");
BufferedReader br = new BufferedReader(new FileReader(f));
String line;
int count = 0;
while ((line = br.readLine()) != null){
String[] split = line.split("\t");
TrackPoint point = new TrackPoint(new double[]{Double.parseDouble(split[1]), Double.parseDouble(split[2])},
Long.parseLong(split[3]),
Integer.parseInt(split[0]));
tree.insert(point);
queue.add(point);
count++;
if (count % 40 == 0){
if (count > 20000){
for (int i = 0; i < 40; i++) {
TrackPoint trackPoint = queue.remove();
if (count == 36480 && i == 17)
tree.search(trackPoint, 1.0);
if (!tree.delete(trackPoint))
System.out.print("");

			}

		}
	}
}

}

class TrackPoint {
public double[] data;
public long timestamp;
public int TID;

public TrackPoint(double[] data, long timestamp, int TID) {
	super(data);
	this.timestamp = timestamp;
	this.TID = TID;
}

}

test.txt

@dongx-psu
Copy link
Member

We implement this repo to support static dataset, in which delete will not happen. I recognize the precision issue, but we probably will not fix it due to the purpose of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants