0
**「Path inputPath = new Path(job.get(KnnDriver.QUERY_DIR_PROPERTY));」**//it gives out error。
if (inputPath == null)
throw new UnsupportedOperationException("ERROR: query directory not set");
job.setInputFormat(NonSplitableTextInputFormat.class);
NonSplitableTextInputFormat.addInputPath(job, inputPath);
Path outputPath = new Path(job.get(KnnDriver.RESULT_DIR_PROPERTY));
FileSystem.get(job).delete(outputPath, true);
// Change to FileOutputFormat to see output
job.setOutputFormat(TextOutputFormat.class);
TextOutputFormat.setOutputPath(job, outputPath);
KnnDriver.run(job);
}
我已經在功能標籤的文本錯誤創建Path 以下將是靜態常量我在knnDriver設置。java.lang.IllegalArgumentException異常:無法從一個空字符串
public static final String QUERY_DIR_PROPERTY = "knn.query.dir";
public static final String RESULT_DIR_PROPERTY = "knn.result.dir";
public static final String THRESHOLD_PROPERTY = "knn.sim.threshold";
請給出一些有效的建議。謝謝 –
如何使用if(inputPath!= null){} else {}'來捕獲錯誤。 – Eames
我已經嘗試過它所說的。它不適用於上圖中的相同錯誤。 –