CSE 512 - Assignment 2

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) Ratings table
stored in PostgreSQL, (2) RatingMinValue (3) RatingMaxValue (4)
openconnection
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 a text file, named RangeQueryOut.txt (in
the same directory where Assignment2_Interface.py is present) such that 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
o Note: Please use ‘,’ (COMMA) as delimiter between PartitionName, UserID,
MovieID and Rating.
• PointQuery() –
o Implement a Python function PointQuery that takes as input: (1) Ratings table
stored in PostgreSQL, (2) RatingValue. (3) openconnection
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 a text file, named PointQueryOut.txt (in
the same directory where Assignment2_Interface.py is present) such that 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
o Note: Please use ‘,’ (COMMA) as delimiter between PartitionName, UserID,
MovieID and Rating.
Please use the function signature exactly same as mentioned in Assignment2_Interface.py
Powered by