同一数据集,不同的排序条件,有的可以,但某一条件,却能100%重现报错。

  1. procedure TkbmIndex.InternalFastQuickSort(const L,R:Integer);
  2. var
  3. I,J:integer;
  4. P:PkbmRecord;
  5. begin
  6. if ((R-L)>) then
  7. // if ((R-L)>0) then
  8. begin
  9. I:=(R+L) div ;
  10. if CompareRecords(FIndexFieldList,PkbmRecord(FReferences[L]),PkbmRecord(FReferences[I]),true,false)> then
  11. InternalSwap(L,I);
  12. if CompareRecords(FIndexFieldList,PkbmRecord(FReferences[L]),PkbmRecord(FReferences[R]),true,false)> then
  13. InternalSwap(L,R);
  14. if CompareRecords(FIndexFieldList,PkbmRecord(FReferences[I]),PkbmRecord(FReferences[R]),true,false)> then
  15. InternalSwap(I,R);
  16.  
  17. J:=R-;
  18. InternalSwap(I,J);
  19. I:=L;
  20. P:=PkbmRecord(FReferences[J]);
  21. while true do
  22. begin
  23. Inc(I);
  24. Dec(J);
  25. while CompareRecords(FIndexFieldList,PkbmRecord(FReferences[I]),P,true,false) < do Inc(I);
  26. while CompareRecords(FIndexFieldList,PkbmRecord(FReferences[J]),P,true,false) > 0 do Dec(J);
  27. if (J<I) then break;
  28. InternalSwap(I,J);
  29. end;
  30. InternalSwap(I,R-);
  31. InternalFastQuickSort(L,J);
  32. InternalFastQuickSort(I+,R);
  33. end;
  34. end;

 反复跟代码,发现在  kbmMemTable.PAS中,当J减至0时,FReferences[J] 下标越界

试改为FIndexFieldList.Count>0前判断条件却未解决,说明并非是递减原因,改为大于J,未报错,是否有问题,待应用中再关注。

  1. procedure TkbmIndex.InternalFastQuickSort(const L,R:Integer);
  2. var
  3. I,J:integer;
  4. P:PkbmRecord;
  5. begin
  6. if ((R-L)>) then
  7. // if ((R-L)>0) then
  8. begin
  9. I:=(R+L) div ;
  10. if CompareRecords(FIndexFieldList,PkbmRecord(FReferences[L]),PkbmRecord(FReferences[I]),true,false)> then
  11. InternalSwap(L,I);
  12. if CompareRecords(FIndexFieldList,PkbmRecord(FReferences[L]),PkbmRecord(FReferences[R]),true,false)> then
  13. InternalSwap(L,R);
  14. if CompareRecords(FIndexFieldList,PkbmRecord(FReferences[I]),PkbmRecord(FReferences[R]),true,false)> then
  15. InternalSwap(I,R);
  16.  
  17. J:=R-;
  18. InternalSwap(I,J);
  19. I:=L;
  20. P:=PkbmRecord(FReferences[J]);
  21. while true do
  22. begin
  23. Inc(I);
  24. Dec(J);
  25. while CompareRecords(FIndexFieldList,PkbmRecord(FReferences[I]),P,true,false) < do Inc(I);
  26. while (FIndexFieldList.Count>J )and (CompareRecords(FIndexFieldList,PkbmRecord(FReferences[J]),P,true,false) > ) do Dec(J);
  27. if (J<I) then break;
  28. InternalSwap(I,J);
  29. end;
  30. InternalSwap(I,R-);
  31. InternalFastQuickSort(L,J);
  32. InternalFastQuickSort(I+,R);
  33. end;
  34. end;

kbmmemtable sorton 报错 : List index out of bounds的更多相关文章

  1. git报错之index.lock

    当想回退到某个版本的时候,用git reset --hard commit_id,发现报错,原因是.git目录下多了个index.lock文件,可以通过rm命令删除,然后再回退 rm -f ./.gi ...

  2. Faster RCNN 运行自己的数据,刚开始正常,后来就报错: Index exceeds matrix dimensions. Error in ori_demo (line 114) boxes_cell{i} = [boxes(:, (1+(i-1)*4):(i*4)), scores(:, i)];

    function script_faster_rcnn_demo() close all; clc; clear mex; clear is_valid_handle; % to clear init ...

  3. 踩坑记录-nuxt引入vuex报错store/index.js should export a method that returns a Vuex instance.

    错误 store/index.js代码如下: import Vue from 'vue'; import Vuex from 'vuex'; import city from './moudle/ci ...

  4. jdbcTemplate异常:like模糊查询报错(Parameter index out of range (1 > number of parameters)

    http://cuisuqiang.iteye.com/blog/1480525   模糊查询like要这样写 注意Object参数和like语法   public static void main( ...

  5. vue打包后刷新页面报错:Unexpected token <

    前言 今天遇到了一个很怪的问题,在vue-cli+webpack的项目中,刷新特定页面后页面会变空白,报错为index.html文件中Unexpected token <. 怪点一是开发环境没有 ...

  6. Maven新建webapp项目index.jsp报错

    最近用eclipse新建了一个maven项目,结果刚新建完成index.jsp页面就报错了,先把错误信息贴出来看看 后来就找资料,结果发现两种解决办法,希望可以帮助用得上的人! 第一种:直接在pom. ...

  7. 报错:org.apache.jasper.JasperException: /index.jsp (line: 1, column: 17) equal symbol expected

    现象:写了如下一个jsp文件,导入需要用到的两个包: 运行结果报错:org.apache.jasper.JasperException: /index.jsp (line: 1, column: 17 ...

  8. mongodb 查询时没有索引报错(too much data for sort() with no index)

    报错信息: .... too much data for sort() with no index.... 给对应排序字段加索引就OK 了... 在对应"表"名上,右键--> ...

  9. eclipse里index.jsp头部报错的原因和解决方法

    index.jsp的头<%@这句报错的话,是因为没有引入Tomcat的原因.解决:A:Window---Preferences---server---RuntimeEnviroments--Ad ...

随机推荐

  1. 数据结构-堆 Java实现

    数据结构-堆 Java实现. 实现堆自动增长 /** * 数据结构-堆. 自动增长 * */ public class Heap<T extends Comparable> { priva ...

  2. page1201未完成

    import java.util.Scanner; /** * @author:李柏宏(LiberHome) * @date:Created in 2019/3/4 20:37 * @descript ...

  3. 课堂动手动脑String

    一 public class StringPool { public static void main(String args[]) { String s0="Hello"; St ...

  4. 简述移动端开发前端和app间的关系

    <p>前端页面嵌套进app内部,一般有时候会进行一些交互,类似于前端页面请求后台接口一样,通常会起一个前端开发人员和app开发人员会相互协定一个协议;双方就协议而言去进行请求接口和返回数据 ...

  5. Building gRPC Client iOS Swift Note Taking App

    gRPC is an universal remote procedure call framework developed by Google that has been gaining inter ...

  6. vue跳转到外部链接

    <span @click="see('http://xxxx">点击跳转到xxx</span> 方法:(调用函数) See (e) { window.loc ...

  7. 随手科技(随手记)2017招聘Java工程师笔试题

    一  如何解决多台web服务器粘性会话的问题? 粘性session:web服务器会把某个用户的请求,交给tomcat集群中的一个节点,以后此节点就负责该保存该用户的session,如果此节点挂掉,那么 ...

  8. openssh-win64 on windows2016 ssh pub key config

    DO NOT follow the official M$ documentation at https://docs.microsoft.com/en-us/windows-server/admin ...

  9. Jackson流式API

    public class JacksonTester {   public static void main(String args[]){    JacksonTester tester = new ...

  10. 误用WeakHashMap引起的死循环cpu跑满问题

    最近使用mvel 2.2.0.Final,出现一次cpu跑满,经过线程栈分析,发现是误用WeakHashMap引起的. 故障现场: 看WeakHashMap源码: public V get(Objec ...