Starting from:

$25

CSE512-Assignment 2 Solved

The required task is to build a simplified query processor that accesses data from the partitioned ratings table.

 

Input Data: - Same as in Assignment 1 i.e. ratings.dat file.

 

Required Task: - Below are the steps you need to follow to fulfill this assignment:

 

    RangeQuery() – o Implement a Python function RangeQuery that takes as input: (1)

RatingMinValue (2) RatingMaxValue (3) openconnection (4) outputPath o Please note that the RangeQuery would not use ratings table but it would use the range and round robin partitions of the ratings table.

o   RangeQuery() then returns all tuples for which the rating value is larger than or equal to RatingMinValue and less than or equal to RatingMaxValue.

o   The returned tuples should be stored in outputPath. Each line represents a tuple that has the following format such that PartitionName represents the full name of the partition i.e. RangeRatingsPart1 or RoundRobinRatingsPart4 etc. in which this tuple resides.

                    PartitionName, UserID, MovieID, Rating Example:           

RangeRatingsPart0,1,377,0.5

RoundRobinRatingsPart1,1,377,0.5

 

o   Note: Please use ‘,’ (COMMA, no space character) as delimiter between PartitionName, UserID, MovieID and Rating.

 

    PointQuery() – o Implement a Python function PointQuery that takes as input: (1) RatingValue.

(2) openconnection (3) outputPath o Please note that the PointQuery would not use ratings table but it would use the range and round robin partitions of the ratings table.

o   PointQuery() then returns all tuples for which the rating value is equal to RatingValue.

o   The returned tuples should be stored in outputPath. Each line represents a tuple that has the following format such that PartitionName represents the full name of the partition i.e. RangeRatingsPart1 or RoundRobinRatingsPart4 etc. in which this tuple resides.

                                             PartitionName, UserID, MovieID, Rating

                               Example               

RangeRatingsPart3,23,459,3.5

RoundRobinRatingsPart4,31,221,0

 

o   Note: Please use ‘,’ (COMMA, no space character) as delimiter between PartitionName, UserID, MovieID and Rating.

 

Please use the function signature exactly same as mentioned in Assignment2_Interface.py .

 

Naming Convention to be followed strictly:     Database name – ddsassignment2

    Name of Rating table – ratings

    Postgres User name – postgres     Postgres password – 1234

 

How to use tester.py:

    Open the Assignment2.zip file and dump all the contents in a folder.

    Also move ratings.dat file to this folder.

    As per the naming conventions provided above, setup your postgresql.

    Once the setup is done, test the tester.py by simply running it.

    It should provide the following output:

  

 Now, you can implement your functions in Assignment2_Interface.py and once done, use the tester again to generate the output.

 DONOT CHANGE tester.py and Assignment1.py. Changing anyone of these would cause problems and the system will stop working, and may lead to deduction of marks.

 PLEASE  KEEP  IN MIND,  this tester is just for your help. For grading  purpose,  an additional set of test cases would be used. It will try to break your code. So, please provide the functionalities accordingly, so that it handles all possible scenarios.

 

More products