RecordSetVO rsvo = new RecordSetVO();
rsvo.addField(new Field("key1", Field.DataType.STRING));
rsvo.addField(new Field("key2", Field.DataType.STRING));
rsvo.addField(new Field("key3", Field.DataType.INTEGER));
rsvo.addField(new Field("key4", Field.DataType.BIGDECIMAL));
rsvo.addField(new Field("key5", Field.DataType.BIGINTEGER));
rsvo.addField(new Field("key6", Field.DataType.DOUBLE));
rsvo.add(new Test("A","B",1,BigDecimal.valueOf(1),BigInteger.valueOf(1),0.1));
rsvo.add(new Test("C","C",2,BigDecimal.valueOf(2),BigInteger.valueOf(2),0.2));
rsvo.add(new Test("B","B",3,BigDecimal.valueOf(3),BigInteger.valueOf(3),0.3));
rsvo.add(new Test("B","C",4,BigDecimal.valueOf(4),BigInteger.valueOf(4),0.4));
rsvo.add(new Test("A","A",5,BigDecimal.valueOf(5),BigInteger.valueOf(5),0.5));
rsvo.add(new Test("A","B",6,BigDecimal.valueOf(6),BigInteger.valueOf(6),0.6));
System.out.println(rsvo);
Stat sum = new Stat(rsvo,"key1");
RecordSetVO rvo = sum.sum("key3","key4","key5","key6");
System.out.println(rvo);
for(int i=0;i<100000;i++){
char a = (char)((int)(Math.random()*26)+65);
char b = (char)((int)(Math.random()*26)+65);
char c = (char)((int)(Math.random()*26)+65);
double d = Math.random()*100;
rsvo.add(new Test(String.valueOf(a),String.valueOf(b),(int)d,BigDecimal.valueOf(d),BigInteger.valueOf((int)d),d));
}
Group group = new Group(rsvo,"key1");
group.group();
System.out.println(rsvo);
long time = System.currentTimeMillis();
sum = new Stat(rsvo,"key1");
RecordSetVO rvo2 = sum.sum("key3","key4","key5","key6");
time = System.currentTimeMillis()-time;
System.out.println(rvo2);
System.out.println("time:" + time);
sum = new Stat(rsvo);
RecordSetVO rvo3 = sum.sum("key3","key4","key5","key6");
System.out.println(rvo3);
sum = new Stat(rvo2);
RecordSetVO rvo4 = sum.sum("key3","key4","key5","key6");
System.out.println(rvo4); |
运行结果:
ff22d6bb-1216-4e16-9e4e-82a7cb036a86
[key1:STRING, key2:STRING, key3:INTEGER, key4:BIGDECIMAL, key5:BIGINTEGER, key6:DOUBLE]
{key1=A,key2=B,key3=1,key4=1,key5=1,key6=0.1}0248d861-7747-40af-912b-fcb76736fe5a
{key1=C,key2=C,key3=2,key4=2,key5=2,key6=0.2}04efe645-e8bf-4af6-a8ac-5372f12b6d2a
{key1=B,key2=B,key3=3,key4=3,key5=3,key6=0.3}f65ec227-96ca-4f9d-a08a-4b67626e912e
{key1=B,key2=C,key3=4,key4=4,key5=4,key6=0.4}d124ac99-51a9-4353-8cc4-cdb8b2e6e943
{key1=A,key2=A,key3=5,key4=5,key5=5,key6=0.5}e0639ef0-4f2a-4e00-8879-befdd186da01
{key1=A,key2=B,key3=6,key4=6,key5=6,key6=0.6}1fbb2676-5b7e-4217-8d23-ca7e1a821392
9fafc252-c1db-4f37-bed2-396e9671512e
[RecordSetVO_COUNT:LONG, key1:STRING, key3:INTEGER, key4:BIGDECIMAL, key5:BIGINTEGER, key6:DOUBLE]
{RecordSetVO_COUNT=1,key1=A,key3=1,key4=1,key5=1,key6=0.1}123ef824-2926-4c18-a275-4325162e8f15
{RecordSetVO_COUNT=1,key1=C,key3=2,key4=2,key5=2,key6=0.2}bf131f20-2e22-4aba-8405-9e9bad62360a
{RecordSetVO_COUNT=2,key1=B,key3=7,key4=7,key5=7,key6=0.7}dfa128c7-5363-4c2f-9fd2-c23cda09340d
{RecordSetVO_COUNT=2,key1=A,key3=11,key4=11,key5=11,key6=1.1}1ed27aab-cda4-456b-a659-7839615bd3c4
ff22d6bb-1216-4e16-9e4e-82a7cb036a86
[key1:STRING, key2:STRING, key3:INTEGER, key4:BIGDECIMAL, key5:BIGINTEGER, key6:DOUBLE]
{key1=A,key2=B,key3=1,key4=1,key5=1,key6=0.1}0248d861-7747-40af-912b-fcb76736fe5a
{key1=C,key2=C,key3=2,key4=2,key5=2,key6=0.2}04efe645-e8bf-4af6-a8ac-5372f12b6d2a
{key1=B,key2=B,key3=3,key4=3,key5=3,key6=0.3}f65ec227-96ca-4f9d-a08a-4b67626e912e
{key1=B,key2=C,key3=4,key4=4,key5=4,key6=0.4}d124ac99-51a9-4353-8cc4-cdb8b2e6e943
{key1=A,key2=A,key3=5,key4=5,key5=5,key6=0.5}e0639ef0-4f2a-4e00-8879-befdd186da01
{key1=A,key2=B,key3=6,key4=6,key5=6,key6=0.6}1fbb2676-5b7e-4217-8d23-ca7e1a821392
{key1=U,key2=W,key3=43,key4=43.37386713329803,key5=43,key6=43.37386713329803}0e6d140a-d811-41b0-9c4f-feb8831c4591
{key1=S,key2=N,key3=57,key4=57.42766495870948,key5=57,key6=57.42766495870948}c7742d17-53e9-4693-add4-9ada670be7dc
{key1=B,key2=D,key3=25,key4=25.74833734215616,key5=25,key6=25.74833734215616}498477ee-0957-4afa-9581-090bb17c3ad6
{key1=H,key2=C,key3=76,key4=76.58383640524428,key5=76,key6=76.58383640524428}8eb5bc8a-3704-4af3-85fa-1b827c9ae09f
{key1=Y,key2=H,key3=36,key4=36.94254509985046,key5=36,key6=36.94254509985046}3f1d68d8-d65a-46b8-aa6b-d35ef577af64
{key1=Q,key2=H,key3=95,key4=95.39296675151823,key5=95,key6=95.39296675151823}edd8ea7c-69f7-4a81-a3a7-da5e0aa502d6
{key1=B,key2=M,key3=33,key4=33.59597337869399,key5=33,key6=33.59597337869399}81969c98-9fd0-4f39-97fc-812d91501456
{key1=H,key2=D,key3=96,key4=96.88514732110404,key5=96,key6=96.88514732110404}7ea8a997-a411-48b4-ba84-a8dffa769ad3
{key1=E,key2=P,key3=48,key4=48.52717112395334,key5=48,key6=48.52717112395334}fbc02421-2dfe-4e6e-bf45-c0256ba38cb8
{key1=I,key2=K,key3=79,key4=79.73567070062981,key5=79,key6=79.73567070062981}c41072e0-80cb-4590-9c90-a272f61b6944
f60b65ef-40b1-4494-afd3-411cccd613a1
[RecordSetVO_COUNT:LONG, key1:STRING, key3:INTEGER, key4:BIGDECIMAL, key5:BIGINTEGER, key6:DOUBLE]
{RecordSetVO_COUNT=1,key1=A,key3=1,key4=1,key5=1,key6=0.1}93b71cfa-bbd8-4ac4-a84e-fbe84581bfb2
{RecordSetVO_COUNT=1,key1=C,key3=2,key4=2,key5=2,key6=0.2}32c26bd8-eb38-423f-b106-44a742b00f30
{RecordSetVO_COUNT=2,key1=B,key3=7,key4=7,key5=7,key6=0.7}6ab9359d-8534-4898-a80b-30f17ec30184
{RecordSetVO_COUNT=2,key1=A,key3=11,key4=11,key5=11,key6=1.1}86e60477-b9bc-48b6-95f7-fd82a2d34823
{RecordSetVO_COUNT=1,key1=U,key3=43,key4=43.37386713329803,key5=43,key6=43.37386713329803}e42634e6-2682-495d-b93a-b097884276ea
{RecordSetVO_COUNT=1,key1=S,key3=57,key4=57.42766495870948,key5=57,key6=57.42766495870948}f2289a4b-307b-434f-8ba3-329856215f13
{RecordSetVO_COUNT=1,key1=B,key3=25,key4=25.74833734215616,key5=25,key6=25.74833734215616}0f17b67f-4815-4547-a970-13a2b9c0e672
{RecordSetVO_COUNT=1,key1=H,key3=76,key4=76.58383640524428,key5=76,key6=76.58383640524428}1dd91f25-79c9-4041-9776-fc1c7449c40e
{RecordSetVO_COUNT=1,key1=Y,key3=36,key4=36.94254509985046,key5=36,key6=36.94254509985046}0b9f1a1c-95a9-4f04-988d-13df7dceac2d
{RecordSetVO_COUNT=1,key1=Q,key3=95,key4=95.39296675151823,key5=95,key6=95.39296675151823}351b9acd-b256-40a5-b4cc-36fb66724424
{RecordSetVO_COUNT=1,key1=B,key3=33,key4=33.59597337869399,key5=33,key6=33.59597337869399}b620e344-00e1-4175-9903-54e7adb9c228
{RecordSetVO_COUNT=1,key1=H,key3=96,key4=96.88514732110404,key5=96,key6=96.88514732110404}5d0927ac-0dc6-43d9-809c-d03900bdafd7
{RecordSetVO_COUNT=1,key1=E,key3=48,key4=48.52717112395334,key5=48,key6=48.52717112395334}2570e1ed-3d6d-4d71-adae-23a566f242d1
{RecordSetVO_COUNT=1,key1=I,key3=79,key4=79.73567070062981,key5=79,key6=79.73567070062981}7cba4514-8df3-4dff-8e71-72e02743518f
……
bbb3f75c-cdac-4f86-adcd-dd2c9d7d26f8
[RecordSetVO_COUNT:LONG, key3:INTEGER, key4:BIGDECIMAL, key5:BIGINTEGER, key6:DOUBLE]
{RecordSetVO_COUNT=16,key3=609,key4=615.21318021515782,key5=609,key6=596.3131802151579}bf592e4c-f62d-4d06-a086-249d41074fb6
a0d39b2d-582d-483c-91e3-9cb43c946202
[RecordSetVO_COUNT:LONG, key3:INTEGER, key4:BIGDECIMAL, key5:BIGINTEGER, key6:DOUBLE]
{RecordSetVO_COUNT=14,key3=609,key4=615.21318021515782,key5=609,key6=596.3131802151579}4bd404f3-b0fa-47bf-b50f-add110a5bb49
|