/Bigtable

Primary LanguageJava

Bigtable

This project communicates with Cloud Bigtable through the Cloud Bigtable HBase client for Java, which is a customized version of the Apache HBase client. The Bigtable contains following data -

  • userID -> Unique ID for user
  • itemID -> Unique ID for item
  • viewCount -> The total times a given itemID has been viewed by a given userID.

Methods

  1. readCSV
    • Description - Reads CSV file and stores data in Bigtable.
    • Signature - void readCSV(filepath)
    • Parameters - filepath:string
  2. top
    • Description - Get the top K items for a given userID with the highest view count.
    • Signature - int[] top(userID, K)
    • Parameters - userID:int and K:int
    • Return Type - Integer array of size K containing top K items.
  3. interested
    • Description - Get the number of users interested in a given itemID.
    • Signature - int interested(itemID)
    • Parameters - itemID:int
    • Return Type - integer denoting the number of users interested in itemID.
  4. top_interested
    • Description - For a given itemID, find the top K items that are of interest to those who viewed this item.
    • Signature - int[] top_interested(itemID,K)
    • Parameters - userID:int and K:int
    • Return Type - Integer array of size K containing top K items.
  5. view_count
    • Description - Get the total view count for a given itemID.
    • Signature - int view_count(itemID)
    • Parameters - itemID:int
    • Return Type - Integer denoting total view count for given itemID.
  6. popular
    • Description - Get the itemID of the most popular item in the database.
    • Signature - int popular()
    • Return Type - Integer denoting the itemID of the most popular item.

How to use?

  • Clone/Download this repository
  • Run following commands
cd Bigtable/my-app
mvn package
mvn exec:java
  • Interaction -

    • You'll see this after running the commands mentioned above.
    Enter project ID for bigtable = ****
    Enter instance ID for bigtable = ****
    

    Enter project ID and instance ID corresponding to the instance where bigtable should be created.

    • After this the command prompt would display the list of functions supported
    1.readCSV
    2.top
    3.interested
    4.top_interested
    5.view_count
    6.popular
    7.Quit
    Enter command number = 
    

    Example - For readCSV enter 1. The program would then ask for the path to csv file(full path or path relative to Bigtable folder).

    Enter command number = 1
    Enter path to csv file = data.csv
    

    Similarly this can be used for all other functions.