kev-inn commented on a change in pull request #893:
URL: https://github.com/apache/systemml/pull/893#discussion_r417660073
##########
File path: src/test/java/org/apache/sysds/test/TestUtils.java
##########
@@ -268,78 +268,171 @@ else if (Integer.parseInt(expRcn[2]) !=
Integer.parseInt(rcn[2])) {
fail("unable to read file: " + e.getMessage());
}
}
-
+
/**
* <p>
- * Compares the expected values calculated in Java by testcase and
which are
- * in the normal filesystem, with those calculated by SystemDS located
in
- * HDFS
+ * Read the cell values of the expected file and actual files. Schema
is used for correct parsing if the file is a
+ * frame and if it is null FP64 will be used for all values (useful for
Matrices).
* </p>
- *
- * @param expectedFile
- * file with expected values, which is located in OS
filesystem
- * @param actualDir
- * file with actual values, which is located in HDFS
- * @param epsilon
- * tolerance for value comparison
+ *
+ * @param schema the schema of the frame, can be null (for FP64)
+ * @param expectedFile the file with expected values
+ * @param actualDir the directory where the actual values were
written
+ * @param expectedValues the HashMap where the expected values will be
written to
+ * @param actualValues the HashMap where the actual values will be
written to
*/
- @SuppressWarnings("resource")
- public static void compareDMLMatrixWithJavaMatrix(String expectedFile,
String actualDir, double epsilon) {
+ private static void readActualAndExpectedFile(ValueType[] schema,
String expectedFile, String actualDir,
+ HashMap<CellIndex, Object> expectedValues, HashMap<CellIndex,
Object> actualValues) {
try {
Path outDirectory = new Path(actualDir);
Path compareFile = new Path(expectedFile);
FileSystem fs =
IOUtilFunctions.getFileSystem(outDirectory, conf);
FSDataInputStream fsin = fs.open(compareFile);
-
- HashMap<CellIndex, Double> expectedValues = new
HashMap<>();
-
- try( BufferedReader compareIn = new BufferedReader(new
InputStreamReader(fsin)) ) {
+
+ try(BufferedReader compareIn = new BufferedReader(new
InputStreamReader(fsin))) {
Review comment:
sure, will do as soon as I have time to fix up everything
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]