Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacroBase SQL tests fail because of spaces in path #259

Open
AlexP11223 opened this issue Mar 19, 2018 · 0 comments
Open

MacroBase SQL tests fail because of spaces in path #259

AlexP11223 opened this issue Mar 19, 2018 · 0 comments

Comments

@AlexP11223
Copy link

Some tests that use files fail if path to the project contains spaces:

Tests run: 21, Failures: 0, Errors: 21, Skipped: 0, Time elapsed: 3.905 sec <<< FAILURE!
query1(edu.stanford.futuredata.macrobase.sql.MacroBaseSQLTest)  Time elapsed: 2.324 sec  <<< ERROR!
java.lang.IllegalStateException: File /D:/Some%20Folder/macrobase-master/sql/target/test-classes/1.csv cannot be found
	at edu.stanford.futuredata.macrobase.ingest.CSVDataFrameParser.getReader(CSVDataFrameParser.java:140)
	at edu.stanford.futuredata.macrobase.ingest.CSVDataFrameParser.<init>(CSVDataFrameParser.java:47)
	at edu.stanford.futuredata.macrobase.sql.MacroBaseSQLTest.loadDataFrameFromCSV(MacroBaseSQLTest.java:217)
	at edu.stanford.futuredata.macrobase.sql.MacroBaseSQLTest.query1(MacroBaseSQLTest.java:83)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	...
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.io.FileNotFoundException: D:\Some%20Folder\macrobase-master\sql\target\test-classes\1.csv (The system cannot find the path specified)
	at java.io.FileInputStream.open0(Native Method)
	...

Something like this seems to work:

--- a/sql/src/test/java/edu/stanford/futuredata/macrobase/sql/MacroBaseSQLTest.java
+++ b/sql/src/test/java/edu/stanford/futuredata/macrobase/sql/MacroBaseSQLTest.java
@@ -214,7 +214,7 @@ public class MacroBaseSQLTest {

     private DataFrame loadDataFrameFromCSV(final String csvFilename,
         final Map<String, ColType> schema) throws Exception {
-        return new CSVDataFrameParser(Resources.getResource(csvFilename).getFile(), schema).load();
+        return new CSVDataFrameParser(Resources.getResource(csvFilename).toURI().getPath(), schema).load();
     }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant