MCPcopy Create free account
hub / github.com/CDSecLab/MJXT / test_JXTpp_Lmax

Class test_JXTpp_Lmax

src/test/java/test_JXTpp_Lmax.java:23–118  ·  view source on GitHub ↗

This java file aims to test JXT++'s query efficiency with different L_max {100,200,...,1000}. This code can generate the data about JXT++ for Figure 6 in the paper. @Author: 杜凯 @Date: 2023/11/07/16:04 @Description: JXT++

Source from the content-addressed store, hash-verified

21*/
22
23public class test_JXTpp_Lmax {
24 private static String K_token = "89b7a92966f6eb32";
25 private static String K_w = "7975922666f6eb02";
26 private static String K_wp = "787599ac86f2e82";
27 private static String K_h = "9874a22554e7db85";
28 private static String K_aes = "8975924566f6e252";
29 private static String K_c = "6574b33984e7fb55";
30
31 public static void main(String[] args) {
32 //Step 1 prepare the parameters
33 //the number of attributes which aren't the join attribute in the table.
34 int key_colnum = 9;
35 //the number join attributes in the table.
36 int join_column = 1;
37 int record_num = (int) Math.pow(2, 16);
38 int table_num = 2;//the number of the queried tables
39 String condition = "_Lmax100";//the condition aims to choose different tables from dataset
40 int[][] l_max = new int[table_num][join_column];
41 String[] keyword = new String[table_num];
42 String[] join_attr = new String[table_num];
43 //Step 2 begin to set up
44 System.out.println("---------------- JXT++ for different L_max -----------------");
45 Setup_JXTpp[] table = new Setup_JXTpp[table_num];
46 Map<BigInteger, ArrayList<byte[]>> tset = new LinkedHashMap<>();
47 for (int i = 0; i < table_num; i++) {
48 table[i] = new Setup_JXTpp(i + 1, key_colnum, join_column, record_num, condition);
49 table[i].construct();
50 tset.putAll(table[i].getTset());
51 System.arraycopy(table[i].getL_max(), 0, l_max[i], 0, join_column);
52 }
53 System.out.println("L_max for table1 for the join attribute : " + Arrays.toString(l_max[0]));
54 System.out.println("L_max for table2 for the join attribute : " + Arrays.toString(l_max[1]));
55
56 //Step 3 begin to search
57
58 //query 10 join attributes which indicates different L_max {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000}.
59 for (int v = 100; v <= 1000; v += 100) {
60 l_max[0][0] = v;
61 l_max[1][0] = v;
62 for (int i = 0; i < table_num; i++) {
63 keyword[i] = "keyword0" + "table" + (i + 1) + "_keyword_0_0";
64 join_attr[i] = "join-attr0";
65 }
66 System.out.println("--------- JXT++ search(L_max = " + l_max[0][0] + ") --------");
67 long search_all = 0;
68 for (int x = 0; x < 1000; x++) {//run 1000 times
69 long search_start = System.nanoTime();
70 //Step 3.1 compute the stag
71 BigInteger stag1 = new BigInteger(Hash.Get_SHA_256((K_token + keyword[0] + join_attr[0] + 1).getBytes(StandardCharsets.UTF_8)));
72 Server_JXTpp serverMMJXTpp = new Server_JXTpp(tset, table, stag1);
73 byte[] w_0 = Hash.Get_SHA_256((K_w + keyword[0]).getBytes(StandardCharsets.UTF_8));
74 Map<Integer, byte[]> map_cnt = new LinkedHashMap<>();
75 ArrayList<byte[][]> join_tokens = new ArrayList<>();
76 for (int i = 0; i < table_num; i++) {//Step 3.2 compute the joinTokens
77 byte[] w_i = Hash.Get_SHA_256((K_wp + keyword[i]).getBytes(StandardCharsets.UTF_8));
78 byte[] join_hash = Hash.Get_SHA_256((K_h + join_attr[i]).getBytes(StandardCharsets.UTF_8));
79 byte[][] join_token = new byte[l_max[i][0]][];
80 for (int j = 1; j <= l_max[i][0]; j++) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected