Created with IntelliJ IDEA. @Author: KaiDu @Date: 2023/09/12/15:44 @Description: the setup algorithm of JXT
| 21 | * @Description: the setup algorithm of JXT |
| 22 | */ |
| 23 | public class Setup_JXT { |
| 24 | private static String K_aes = "8975924566f6e252"; |
| 25 | private static String K_token = "89b7a92966f6eb32"; |
| 26 | private static String K_x = "7975922666f6eb02"; |
| 27 | private static String K_y = "9862192ad6f6ef65"; |
| 28 | private static String K_h1 = "9874a22554e7db85"; |
| 29 | private static String K_h2 = "fad78974156f6b25"; |
| 30 | private int table_id; |
| 31 | private int key_column; |
| 32 | private int join_column; |
| 33 | private int record_num; |
| 34 | private String condition; |
| 35 | private String[] id; |
| 36 | private String[][] keyword; |
| 37 | private String[][] join_attr; |
| 38 | //the XSet is implemented by the Bloom filter |
| 39 | private Bloom f; |
| 40 | |
| 41 | private Map<BigInteger, ArrayList<tuple>> tset = new LinkedHashMap<>(); |
| 42 | |
| 43 | /** |
| 44 | * |
| 45 | * @param table_id_ the table index |
| 46 | * @param key_column_num the number of columns which are not join attribute |
| 47 | * @param join_column_num the number of column |
| 48 | * @param record the number of records of the table |
| 49 | */ |
| 50 | public Setup_JXT(int table_id_, int key_column_num, int join_column_num, int record, String condition_t){ |
| 51 | table_id = table_id_; |
| 52 | key_column = key_column_num; |
| 53 | join_column = join_column_num; |
| 54 | record_num = record; |
| 55 | condition = condition_t; |
| 56 | } |
| 57 | |
| 58 | public void construct(){ |
| 59 | //Step 1 read the dataset from the tables |
| 60 | //Step 1.1 prepare the parameters |
| 61 | id = new String[record_num + 1]; |
| 62 | keyword = new String[record_num + 1][key_column]; |
| 63 | join_attr = new String[record_num + 1][join_column]; |
| 64 | Map<String, ArrayList<Integer>> reverse_id = new LinkedHashMap<>(); //the pairs of (attribute-value pair, record ids) |
| 65 | String path = "data/table" + table_id + "/table" + table_id + "_k" + key_column |
| 66 | + "_j" + join_column + "_" + record_num + condition +".csv"; |
| 67 | //Step 1.2 begin to read dataset |
| 68 | try (Reader reader = Files.newBufferedReader(Paths.get(path))) { |
| 69 | Iterable<CSVRecord> records = CSVFormat.DEFAULT.parse(reader); |
| 70 | int counter = 0; |
| 71 | for (CSVRecord record : records) { |
| 72 | id[counter] = record.get(0); |
| 73 | for (int j = 0; j < key_column; j++) { |
| 74 | keyword[counter][j] = record.get(j + 1); |
| 75 | if (counter != 0) { |
| 76 | String kword = keyword[0][j] + record.get(j + 1); //attribute-value pair |
| 77 | if (!reverse_id.containsKey(kword)) |
| 78 | reverse_id.put(kword, new ArrayList<>()); |
| 79 | reverse_id.get(kword).add(counter); |
| 80 | } |
nothing calls this directly
no outgoing calls
no test coverage detected