This java file aims to test JXT++'s query efficiency for the table where 20 attribute-value pairs are queried in batches. This code can generate the data about JXT++ for Figure 2 and Figure 3 in the paper. @Author: 杜凯 @Date: 2023/11/07/16:04 @Description: JXT++
| 19 | */ |
| 20 | |
| 21 | public class test_JXTpp { |
| 22 | private static String K_token = "89b7a92966f6eb32"; |
| 23 | private static String K_w = "7975922666f6eb02"; |
| 24 | private static String K_wp = "787599ac86f2e82"; |
| 25 | private static String K_h = "9874a22554e7db85"; |
| 26 | private static String K_aes = "8975924566f6e252"; |
| 27 | private static String K_c = "6574b33984e7fb55"; |
| 28 | |
| 29 | public static void main(String[] args) { |
| 30 | //Step 1 prepare the parameters |
| 31 | //the number of attributes which aren't the join attribute in the table. |
| 32 | int key_colnum = 9; |
| 33 | //the number join attributes in the table. |
| 34 | int join_column = 1; |
| 35 | int record_num = (int) Math.pow(2, 16); |
| 36 | int table_num = 2;//the number of the queried tables |
| 37 | String condition = "";//the condition aims to choose different tables from dataset |
| 38 | int[][] l_max = new int[table_num][join_column]; |
| 39 | String[] keyword = new String[table_num]; |
| 40 | String[] join_attr = new String[table_num]; |
| 41 | //Step 2 begin to set up |
| 42 | System.out.println("--------------------- JXT++ -----------------------"); |
| 43 | Setup_JXTpp[] table = new Setup_JXTpp[table_num]; |
| 44 | Map<BigInteger, ArrayList<byte[]>> tset = new LinkedHashMap<>(); |
| 45 | for (int i = 0; i < table_num; i++) { |
| 46 | table[i] = new Setup_JXTpp(i + 1, key_colnum, join_column, record_num, condition); |
| 47 | table[i].construct(); |
| 48 | tset.putAll(table[i].getTset()); |
| 49 | System.arraycopy(table[i].getL_max(), 0, l_max[i], 0, join_column); |
| 50 | } |
| 51 | //Step 3 begin to search |
| 52 | for (int v = 0; v < 20; v++) { |
| 53 | for (int i = 0; i < table_num; i++) { |
| 54 | keyword[i] = "keyword0" + "table" + (i + 1) + "_keyword_" + v + "_0"; |
| 55 | join_attr[i] = "join-attr0"; |
| 56 | } |
| 57 | System.out.println("--------- JXT++ search(table_keyword_" + v + "_0) --------"); |
| 58 | long search_all = 0; |
| 59 | for (int x = 0; x < 1000; x++) {//run 1000 times |
| 60 | long search_start = System.nanoTime(); |
| 61 | //Step 3.1 compute the stag |
| 62 | BigInteger stag1 = new BigInteger(Hash.Get_SHA_256((K_token + keyword[0] + join_attr[0] + 1).getBytes(StandardCharsets.UTF_8))); |
| 63 | Server_JXTpp serverMMJXTpp = new Server_JXTpp(tset, table, stag1); |
| 64 | byte[] w_0 = Hash.Get_SHA_256((K_w + keyword[0]).getBytes(StandardCharsets.UTF_8)); |
| 65 | Map<Integer, byte[]> map_cnt = new LinkedHashMap<>(); |
| 66 | ArrayList<byte[][]> join_tokens = new ArrayList<>(); |
| 67 | for (int i = 0; i < table_num; i++) {//Step 3.2 compute the joinTokens |
| 68 | byte[] w_i = Hash.Get_SHA_256((K_wp + keyword[i]).getBytes(StandardCharsets.UTF_8)); |
| 69 | byte[] join_hash = Hash.Get_SHA_256((K_h + join_attr[i]).getBytes(StandardCharsets.UTF_8)); |
| 70 | byte[][] join_token = new byte[l_max[i][0]][]; |
| 71 | for (int j = 1; j <= l_max[i][0]; j++) { |
| 72 | byte[] cnt; |
| 73 | if (map_cnt.containsKey(j)) { |
| 74 | cnt = map_cnt.get(j); |
| 75 | } else { |
| 76 | cnt = Hash.Get_SHA_256((K_c + j).getBytes(StandardCharsets.UTF_8)); |
| 77 | map_cnt.put(j, cnt); |
| 78 | } |
nothing calls this directly
no outgoing calls
no test coverage detected