0
是否可以將減速器輸出發送到基於密鑰的多個文件?像,根據鍵/值對(HADOOP)將輸出減少到所需文件
if(key1)
{
//output to file1 using context.write() or otherwise
}
else
{
//output to file2 using context.write() or otherwise
}
是否可以將減速器輸出發送到基於密鑰的多個文件?像,根據鍵/值對(HADOOP)將輸出減少到所需文件
if(key1)
{
//output to file1 using context.write() or otherwise
}
else
{
//output to file2 using context.write() or otherwise
}
你應該能夠在你的減速機一起使用條件邏輯與MultipleOutputs
類來實現你在找什麼做的。他們有一個如何在javadoc鏈接中執行此操作的示例。
另一種可能的方法是實施自定義Partitioner。通過這種方式,可以根據密鑰的值來運行兩個(多個)reducer並進行相應的分區。