⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 no.148.mils

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 MILS
字号:
# >Number:         148# >Category:       Module_xtables# >Synopsis:       table() call fails in xtable.mil# >Confidential:   no# >Severity:       serious# >Priority:       medium# >Responsible:    mk (Martin Kersten)# >State:          open# >Class:          sw-bug# >Submitter-Id:   unknown# >Arrival-Date:   Wed Mar 11 14:28:45 1998# >Originator:     manegold@cwi.nl# >Organization:# CWI# >Release:        980101# >Environment:# any# >Description:# 'table(histo, $(3..))` in 'proc xtable_print`  in# 'xtables.mil` (also available as test 'plain/xtables/`)# ends up in an endless loop in the macro 'matchloop`# (src/gdk/gdk_relop.mx) as soon as the first tuple is # printed. 'matchloop` is called as # 'matchloop(hloc,OID,_oid)` in line 1054 of # 'src/gdk/gdk_relop.mx`.# # maybe, this is no bug in module xtables, but somewhere # else, but as it seems to occur only here, I submit # this as an xtables bug report.# # as soon as I got some time, I will try to do some more # debugging.# # 	stefan# # ================# Output# ----------------# [...]# # #You are system administrator (adm)!# # #line 437 "modules/plain/xtables.mx"# setoid(oid(20000000));# module(xtables);# # # First some procs for convenience:# # - xtable_print(group[oid,oid], str, attr1[oid,a1], attr2[oid,a2], ...)# #       print group count table # # - xtable_realloc(bat, capacity):  bat# #       allocate more memory and return a copy of a bat# # - xtable_test(str title, bat x, bat y, bat z)# #        major test script on xtable functionality# # proc xtable_print() : void { #         var histo := $1.histogram;#         histo.rename("count");#         printf("\n# %s (ct: %d elts, %d groups, %d bytes)\n",#                 $2, $1.count, histo.count, $1.batsize);#         table(histo, $(3..));# }# # proc xtable_realloc(bat b, int cap) : bat { #         bn := new(b.htype, b.ttype, bat);#         if (b.htype = void) bn.seqbase(b.reverse.fetch(0));#         if (b.ttype = void) bn.seqbase(b.fetch(0));#         bn.insert(b);#         return bn;# }# # proc xtable_test(str title, bat x, bat y, bat z) : bat {#     printf("# xtable_test: %s grouping (%d tuples, %d bytes)\n\n",#                 title, x.count, x.batsize + y.batsize + z.batsize);#     x.rename("x"); y.rename("y"); z.rename("z");# #     print(x.slice(0,7),y,z);#     printf("synced(x,y) := %s\n", synced(x,y).str);#     printf("synced(x,z) := %s\n", synced(x,z).str);# #     var x1 := CTgroup(x);#     x1.xtable_print("CT(x)", x);# #     var x1y := CTgroup(x1,y);#     x1y.xtable_print("CT(x,y)", x, y);# #     var v :=  y.uselect(dbl(2.0),dbl(3.0));#     var xvy := CTsubgroup(x1,y,v);#     xvy.xtable_print("CT(x,y|v)", x, y);# #     var x1yz := CTgroup(x1y,z);#     x1yz.xtable_print("CT(x,y,z)", x, y, z);# }# # x := new(oid,chr);# x.insert(1@0,'a');# x.insert(2@0,'a');# x.insert(3@0,'b');# x.insert(4@0,'b');# x.insert(5@0,'b');# x.insert(6@0,'b');# x.insert(7@0,'c');# x.insert(8@0,'c');# # y:= new(oid,dbl);# y.insert(1@0,dbl(1.0));# y.insert(2@0,dbl(3.0));# y.insert(3@0,dbl(2.0));# y.insert(4@0,dbl(2.0));# y.insert(5@0,dbl(2.0));# y.insert(6@0,dbl(3.0));# y.insert(7@0,dbl(1.0));# y.insert(8@0,dbl(1.0));# # z:= new(oid,str);# z.insert(1@0,"c");# z.insert(2@0,"a");# z.insert(3@0,"b");# z.insert(4@0,"c");# z.insert(5@0,"a");# z.insert(6@0,"a");# z.insert(7@0,"c");# z.insert(8@0,"a");# # xtable_test("small hash", x, y, z);# # xtable_test: small hash grouping (8 tuples, 8660 bytes)# # #-----------------------------------------## # oid   | tmp_30| y             | z       ## #-----------------------------------------## [ 1@0,    'a',    1.000000,       "c"     ]# [ 2@0,    'a',    3.000000,       "a"     ]# [ 3@0,    'b',    2.000000,       "b"     ]# [ 4@0,    'b',    2.000000,       "c"     ]# [ 5@0,    'b',    2.000000,       "a"     ]# [ 6@0,    'b',    3.000000,       "a"     ]# [ 7@0,    'c',    1.000000,       "c"     ]# [ 8@0,    'c',    1.000000,       "a"     ]# synced(x,y) := false# synced(x,z) := false# # # CT(x) (ct: 8 elts, 3 groups, 1096 bytes)# #-----------------## # count | x       ## #-----------------## [ 2,      'a'     ]# # ================#line 450 "modules/plain/xtables.mx"setoid(oid(20000000));module(xtables);# First some procs for convenience: # - xtable_print(group[oid,oid], str, attr1[oid,a1], attr2[oid,a2], ...)# 	print group count table # - xtable_realloc(bat, capacity):  bat#	allocate more memory and return a copy of a bat# - xtable_test(str title, bat x, bat y, bat z)#	 major test script on xtable functionality proc xtable_print(..any..) : void {        var histo := $1.histogram();        printf("\n# %s (ct: %d elts, %d groups, %d bytes)\n",                $2, $1.count(), histo.count(), $1.batsize());        table(histo.col_name("count"), $(3..));} proc xtable_realloc(bat b,int cap) : bat {        var inf := b.info();        var ht := monet_atomtbl.find(inf.find("head"));        var tt := monet_atomtbl.find(inf.find("tail"));        var bn := new(ht, tt, cap);        bn.insert(b);        if (ht = void) bn.seqbase(b.reverse().fetch(0));        if (tt = void) bn.seqbase(b.fetch(0));        return bn;} proc xtable_test(str title, bat x, bat y, bat z) : void {    printf("# xtable_test: %s grouping (%d tuples, %d bytes)\n\n",                title, x.count(), x.batsize() + y.batsize() + z.batsize());    x.col_name("x"); y.col_name("y"); z.col_name("z");     print(x.slice(0,7),y,z);    printf("synced(x,y) := %s\n", synced(x,y).str());    printf("synced(x,z) := %s\n", synced(x,z).str());     var x1 := CTgroup(x);    x1.xtable_print("CT(x)", x);     var x1y := CTgroup(x1,y);    x1y.xtable_print("CT(x,y)", x, y);     var v :=  y.uselect(dbl(2.0),dbl(3.0));    var xvy := CTsubgroup(x1,y,v);    xvy.xtable_print("CT(x,y|v)", x, y);    var x1yz := CTgroup(x1y,z);    x1yz.xtable_print("CT(x,y,z)", x, y, z);} var x := new(oid,chr);x.insert(1@0,'a');x.insert(2@0,'a');x.insert(3@0,'b');x.insert(4@0,'b');x.insert(5@0,'b');x.insert(6@0,'b');x.insert(7@0,'c');x.insert(8@0,'c'); var y:= new(oid,dbl);y.insert(1@0,dbl(1.0));y.insert(2@0,dbl(3.0));y.insert(3@0,dbl(2.0));y.insert(4@0,dbl(2.0));y.insert(5@0,dbl(2.0));y.insert(6@0,dbl(3.0));y.insert(7@0,dbl(1.0));y.insert(8@0,dbl(1.0)); var z:= new(oid,str);z.insert(1@0,"c");z.insert(2@0,"a");z.insert(3@0,"b");z.insert(4@0,"c");z.insert(5@0,"a");z.insert(6@0,"a");z.insert(7@0,"c");z.insert(8@0,"a"); xtable_test("small hash", x, y, z); # create vectorized versionsx := x.reverse().project().reverse().copy();y := y.reverse().project().reverse().copy();z := z.reverse().project().reverse().copy(); # activate voidsx.seqbase(1@0);y.seqbase(1@0);z.seqbase(1@0); xtable_test("small vectorized", x, y, z);# deactivate voidsx.seqbase(oid(nil));y.seqbase(oid(nil));z.seqbase(oid(nil));print("growing tables from 8 to 512k elements...");x := x.xtable_realloc(512*1024);y := y.xtable_realloc(512*1024);z := z.xtable_realloc(512*1024);var i := 17;while((i := i - 1) > 0) {        x.insert(x.copy());        y.insert(y.copy());        z.insert(z.copy());        print(x.count());}print("done!");# materialize the oids againx := [oid](x.reverse().mark(oid(1))).reverse();y := [oid](y.reverse().mark(oid(1))).reverse();z := [oid](z.reverse().mark(oid(1))).reverse();y.access(BAT_WRITE);z.access(BAT_WRITE);y.insert(0@0,dbl(nil));z.insert(0@0,str(nil));y.delete(0@0);z.delete(0@0); xtable_test("big hash", x, y, z);# let the Mserver find out that the head columns are equaly := x.mirror().join(y);z := x.mirror().join(z); xtable_test("big synced", x, y, z); # activate voidsx := x.reverse().mark(1@0).reverse();y := y.reverse().mark(1@0).reverse();z := z.reverse().mark(1@0).reverse(); xtable_test("big vectorized", x, y, z); # try out the histosum#z:= histogram(x1yz);#z2:= y.CTgroup();#print(z2);#z3:= z2.CThistosum(z);#print(z3);quit();# try out the histosum#z:= histogram(x1yz);#z2:= y.CTgroup();#print(z2);#z3:= z2.CThistosum(z);#print(z3);#line 638 "modules/plain/xtables.mx"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -