Juliano Oliveira
01/21/2021, 12:54 PMcontext.write()
in a MapReduce using 2.1 api?
Just returning an object with a key/value pair does not seem to be working. The reduce function doesn’t even start!
The object mapContext
provided doesn’t have a write
function…Diderik
01/21/2021, 12:57 PMfunction map(context) {
// Your code
context.write({ key: "your key", value: "your value" })
}
Juliano Oliveira
01/21/2021, 12:59 PMconst map = (mapContext) => { ....
Diderik
01/21/2021, 12:59 PMDiderik
01/21/2021, 12:59 PMDiderik
01/21/2021, 1:01 PMfunction map(mapContext) {}
syntaxbattk
01/21/2021, 1:01 PMbattk
01/21/2021, 1:02 PMDiderik
01/21/2021, 1:02 PMJuliano Oliveira
01/21/2021, 1:04 PMconst getInputData = (inputContext) => {
const map = (mapContext) => {
const reduce = (reduceContext) => {
const summarize = (summaryContext) => {
At least these were given by the IDE…
So you’re saying that i can just forget the arrow function and write like its 2.0?Diderik
01/21/2021, 1:05 PMDiderik
01/21/2021, 1:09 PMwrite.context()
as example which will never work. Instead do context.write()
or mapContext.write()
depending on the parameter nameJuliano Oliveira
01/21/2021, 1:32 PMcontext.write()
🤦🏾♂️ just wrote wrong here. The object context
doesn’t exist using the arrow function since mapContext
is given and for mapContext
the function write()
doesn’t exist..
If I change the entry points declarations to functions instead arrows I expect to have a context
object as usual.Juliano Oliveira
01/21/2021, 1:54 PMDiderik
01/21/2021, 1:59 PMWatz
01/21/2021, 2:48 PMJuliano Oliveira
01/21/2021, 3:28 PMWatz
01/21/2021, 3:28 PMJuliano Oliveira
01/21/2021, 3:34 PMWatz
01/21/2021, 3:35 PM