The map-reduce framework is quite useful for creating inverted indices on a setof documents. An inverted index stores for each word a list of all documentIDs that it appears in (offsets in the documents are also normally stored, butwe shall ignore them in this question).For example, if the input document IDs and contents are as follows:1: data clean2: data base3: clean basethen the inverted lists woulddata: 1, 2clean: 1, 3base: 2, 3Give pseudocode for map and reduce functions to create inverted indices on agiven set of files (each file is a document).Assume the document IDis availableusing a function context.getDocumentID(), and the map function is invokedonce per line of the document. The output inverted list for each word should bea list of document IDs separated by commas. The document IDs are normallysorted, but for the purpose of this question you do not need to bother to sortthem.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
The map-reduce framework is quite useful for creating inverted indices on a set
of documents. An inverted index stores for each word a list of all document
IDs that it appears in (offsets in the documents are also normally stored, but
we shall ignore them in this question).
For example, if the input document IDs and contents are as follows:
1: data clean
2: data base
3: clean base
then the inverted lists would
data: 1, 2
clean: 1, 3
base: 2, 3
Give pseudocode for map and reduce functions to create inverted indices on a
given set of files (each file is a document).Assume the document IDis available
using a function context.getDocumentID(), and the map function is invoked
once per line of the document. The output inverted list for each word should be
a list of document IDs separated by commas. The document IDs are normally
sorted, but for the purpose of this question you do not need to bother to sort
them.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Hash Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education