This code aims to generate the tables with different Lmax, where Lmax is a parameter in JXT++. For example, 'data/table1/table1_k9_j1_65536_Lmax.csv' @Author: 杜凯 @Date: 2023/11/06/15:29 @Description:
| 12 | * @Description: |
| 13 | */ |
| 14 | public class Table_Gen_Lmax { |
| 15 | static String table_name = "table2"; |
| 16 | static int key_colnum = 9; |
| 17 | static int join_column = 1; |
| 18 | static int record_num = (int) Math.pow(2, 16);//65536 |
| 19 | static int Lmax = 1000; |
| 20 | static String condition = "_Lmax" + Lmax; //same_num or same_type |
| 21 | |
| 22 | public static int write_Lmax(BufferedWriter buffWriter, int num, int L_max, int counter) throws IOException { |
| 23 | for (int i = 0; i < num; i++) { |
| 24 | String csv = table_name + "_id_" + counter; |
| 25 | for (int j = 0; j < key_colnum; j++) { |
| 26 | csv += "," + table_name +"_keyword_0_" + j; |
| 27 | } |
| 28 | |
| 29 | for (int j = 0; j < join_column; j++) { |
| 30 | int mod = counter / L_max; |
| 31 | csv += "," + "join_0_" + mod + "_" + j; |
| 32 | } |
| 33 | counter++; |
| 34 | buffWriter.write(csv); |
| 35 | buffWriter.newLine(); |
| 36 | buffWriter.flush(); |
| 37 | } |
| 38 | return counter; |
| 39 | } |
| 40 | |
| 41 | public static void main(String[] args) { |
| 42 | BufferedWriter buffWriter = null; |
| 43 | try { |
| 44 | File csvFile = new File("data/" + table_name + "/" + table_name+ "_k" + key_colnum |
| 45 | + "_j" + join_column + "_" + record_num + condition +".csv"); |
| 46 | FileWriter writer = new FileWriter(csvFile, false); |
| 47 | buffWriter = new BufferedWriter(writer, 1024); |
| 48 | String title = "id"; |
| 49 | for (int i = 0; i < key_colnum; i++) { |
| 50 | title += ",keyword" + i; |
| 51 | } |
| 52 | for (int i = 0; i < join_column; i++) { |
| 53 | title += ",join-attr" + i; |
| 54 | } |
| 55 | buffWriter.write(title + "\n"); |
| 56 | |
| 57 | int counter = 0; |
| 58 | //int[] L_max = new int[]{100, 200, 300, 400, 500, 600, 700, 800, 900, 1000}; |
| 59 | counter = write_Lmax(buffWriter, 1000, Lmax, counter); |
| 60 | System.out.println(counter); |
| 61 | for (int i = counter; i < record_num; i++) { |
| 62 | String csv = table_name + "_id_" + counter; |
| 63 | for (int j = 0; j < key_colnum; j++) { |
| 64 | csv += "," + table_name +"_keyword_" + counter + "_" + j; |
| 65 | } |
| 66 | for (int j = 0; j < join_column; j++) { |
| 67 | csv += "," + "join_" + counter + "_" + j; |
| 68 | } |
| 69 | counter++; |
| 70 | buffWriter.write(csv); |
| 71 | buffWriter.newLine(); |
nothing calls this directly
no outgoing calls
no test coverage detected