-
Create a folder named classes under the root folder which serves as the output directory for the project.
-
In project root folder, create a system variable COMPONENT pointing to the root directory:
Linux / Mac : execute command
source queryenvWindows : follow the guide
Eclipse (other IDEs such as IntelliJ are similar) : follow the guide
Windows : execute build.bat file
Linux / Mac : execute build.sh file via
./build.sh
Guide is taken from official instruction.
Enter testcases directory.
Write Table Schema in customized file: < tablename >.det
Format for schema:
<# of columns>
<size of tuple>
<attribute name> <data type> <range> <key type> <column size>
Explanation:
data type:
- either INTEGER / STRING / REAL
range:
- For integers, and real, it considers the values between 0 and the range specified.
- For primary keys, provide range value greater than or equal to number of records.
- For strings, just specify number of characters you string need to contain.
Key type:
- May be PK/FK/NK respectively for primary key, foreign key, not a key.
- Use only integer data type for primary key.
Attribute size:
- It is number of bytes required for the attribute.
- In java, integer is 4 bytes, character is 2 bytes.
After creating the schema, use RandomDB class to generate serialized schema file < tablename >.md and the data file in text format < tablename >.txt via command:
java RandomDB <tablename> <# of records>
Once you had the database records in text format in < table name >.txt file, convert the records into object format (< table name >.tbl):
java ConvertTxtToTbl <table name>
The above command also creates another file < table name >.stat that gives the statistics of the table. i.e., number of distinct values for each column. The format of this file is as below.
<# of tuples>
<#of distinct values for col 1> <for col 2>
Eclipse / IntelliJ :
- Copy the table schemas and test cases generated in previous step into the root folder. Run the project with extra parameters query.in query.out
Command line :
- Copy the table schemas and test cases generated in previous step into the classes folder.
- Run the project
java QueryMain _query.in_ _query.out_