This code aims to generate the table with different numbers of join attributes. For example, 'data/table1/table1_k5_j5_65536.csv' @Author: 杜凯 @Date: 2023/11/06/15:29 @Description:
| 12 | * @Description: |
| 13 | */ |
| 14 | public class Table_Gen { |
| 15 | static String table_name = "table6"; |
| 16 | static String condition = ""; |
| 17 | static String not_meet = "f_"; |
| 18 | static int key_colnum = 9; |
| 19 | static int join_column = 10 - key_colnum; |
| 20 | static int record_num = (int)Math.pow(2, 16);//65536 |
| 21 | |
| 22 | /** |
| 23 | * write the records that all match. e.g., attribute-value pair w matching 1000 records which all satisfy the query |
| 24 | * @param buffWriter write buffer |
| 25 | * @param th the column number |
| 26 | * @param type the number of records for each kind |
| 27 | * @param counter the counter |
| 28 | * @return the counter |
| 29 | * @throws IOException |
| 30 | */ |
| 31 | public static int write_all_matched(BufferedWriter buffWriter, int th, int type, int counter) throws IOException { |
| 32 | int share_num = 2;//the number of the identical record |
| 33 | for (int i = 0; i < type; i++) { |
| 34 | for (int j = 0; j < share_num; j++) { |
| 35 | String csv = table_name + "_id_" + counter; |
| 36 | for (int k = 0; k < key_colnum; k++) { |
| 37 | csv += "," + table_name +"_keyword_" + th + "_" + k; |
| 38 | } |
| 39 | for (int k = 0; k < join_column; k++) { |
| 40 | csv += "," + "join_" + th + "_"+ i + "_" + k; |
| 41 | } |
| 42 | counter++; |
| 43 | buffWriter.write(csv); |
| 44 | buffWriter.newLine(); |
| 45 | buffWriter.flush(); |
| 46 | } |
| 47 | } |
| 48 | return counter; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * write the records that all match. e.g., w matching 1000 records where 100 records satisfy the query. |
| 53 | * @param buffWriter |
| 54 | * @param th the column number |
| 55 | * @param all_type total number of the record for the w, i.e., 1000 |
| 56 | * @param part_type partly number, 100,200,...,1000 |
| 57 | * @param counter |
| 58 | * @return |
| 59 | * @throws IOException |
| 60 | */ |
| 61 | public static int write_partly_matched(BufferedWriter buffWriter, int th, int all_type, int part_type, int counter) throws IOException { |
| 62 | int share_num = 2; |
| 63 | int cnt = 0; |
| 64 | for (int i = 0; i < all_type; i++) { |
| 65 | for (int k = 0; k < share_num; k++) { |
| 66 | String csv = table_name + "_id_" + counter; |
| 67 | if (cnt < part_type){ |
| 68 | for (int j = 0; j < key_colnum; j++) { |
| 69 | csv += "," + table_name +"_keyword_" + th + "_" + j; |
| 70 | } |
| 71 | for (int j = 0; j < join_column; j++) { |
nothing calls this directly
no outgoing calls
no test coverage detected