NMSUCS582Spring2018Group9 / javaminibase

A repo for javaminibase for use in NMSU's CS 582's Course Project
1 stars 1 forks source link

Implement "batchinsert" #7

Closed shanealv closed 6 years ago

shanealv commented 6 years ago

Implement a program batchinsert. Given the command line invocation:

batchinsert DATAFILENAME DBNAME DBTYPE NUMCOLUMNS

where DATAFILENAME, DBNAME, DBTYPE are string inputs and NUMCOLUMNS is an integer input.

DATAFILENAME = name of the data file (which includes the path to the file) DBNAME = name of the database DBTYPE = type of the database. This input can only have two values: “row” or “column”. You should store there records appropriately depending on the chosen input (i.e. if “row” is chosen, the data should be stored in a row-oriented architecture, which is the default for Minibase. If “column” is chosen, then you should store the data in a column-oriented architecture). NUMCOLUMNS = number of columns in the input data

If the DBNAME already exists, then the program should insert the tuples into the existing database. Regardless of the DBTYPE, no two databases can have the same DBNAME.

The format of the data file will be as follows:

atr1name:atrtype atr2name:atrtype ...
value11 value12 ...
value21 value22 ...
...

At the end of the program, the program should output the number of disk pages that were read and the number ofdisk pages that were written (if any).

aalbaltan commented 6 years ago

@shanealv @Jbvaldez @Cgood627 batchinsert (issue #7) is done. Will be able to do further tests once the query program is done. Here is a sample run:

abdu@abdu-VirtualBox:~/cs582/javaminibase/src$ pwd
/home/abdu/cs582/javaminibase/src
abdu@abdu-VirtualBox:~/cs582/javaminibase/src$ java tools.batchinsert /home/abdu/Project-Phase2_test.txt batchinsert_db column 4
Creating a new database (batchinsert_db).
Replacer: Clock

Inserting records into table_1_column.
1000 records inserted. Table table_1_column has 1000 records.
elapsed time: 217 ms

Input file used (this is the same file provided by the TA, you can find it on canvas):

abdu@abdu-VirtualBox:~$ head Project-Phase2_test.txt 
ID:Int Name:String Major:String Credit:Float
0 Jose Biology 90
1 Paul Athletics 73
2 Barry Marketing 28
3 Carol Cybernetics 84
4 Jared MechEng 117
5 Juanita Geology 100
6 Fay Psychology 48
7 Donald Athletics 128
8 Steven Languages 81