aboutsummaryrefslogtreecommitdiff
path: root/mllib/src/test/java/org/apache
diff options
context:
space:
mode:
authorXiangrui Meng <meng@databricks.com>2015-09-11 08:53:40 -0700
committerXiangrui Meng <meng@databricks.com>2015-09-11 08:53:40 -0700
commit960d2d0ac6b5a22242a922f87f745f7d1f736181 (patch)
treeff3578f7c6fbfcafe89e41235a8c61ed2d7c6a29 /mllib/src/test/java/org/apache
parentb01b26260625f0ba14e5f3010207666d62d93864 (diff)
downloadspark-960d2d0ac6b5a22242a922f87f745f7d1f736181.tar.gz
spark-960d2d0ac6b5a22242a922f87f745f7d1f736181.tar.bz2
spark-960d2d0ac6b5a22242a922f87f745f7d1f736181.zip
[SPARK-10537] [ML] document LIBSVM source options in public API doc and some minor improvements
We should document options in public API doc. Otherwise, it is hard to find out the options without looking at the code. I tried to make `DefaultSource` private and put the documentation to package doc. However, since then there exists no public class under `source.libsvm`, the Java package doc doesn't show up in the generated html file (http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4492654). So I put the doc to `DefaultSource` instead. There are several minor updates in this PR: 1. Do `vectorType == "sparse"` only once. 2. Update `hashCode` and `equals`. 3. Remove inherited doc. 4. Delete temp dir in `afterAll`. Lewuathe Author: Xiangrui Meng <meng@databricks.com> Closes #8699 from mengxr/SPARK-10537.
Diffstat (limited to 'mllib/src/test/java/org/apache')
-rw-r--r--mllib/src/test/java/org/apache/spark/ml/source/libsvm/JavaLibSVMRelationSuite.java (renamed from mllib/src/test/java/org/apache/spark/ml/source/JavaLibSVMRelationSuite.java)24
1 files changed, 12 insertions, 12 deletions
diff --git a/mllib/src/test/java/org/apache/spark/ml/source/JavaLibSVMRelationSuite.java b/mllib/src/test/java/org/apache/spark/ml/source/libsvm/JavaLibSVMRelationSuite.java
index 11fa4eec0c..2976b38e45 100644
--- a/mllib/src/test/java/org/apache/spark/ml/source/JavaLibSVMRelationSuite.java
+++ b/mllib/src/test/java/org/apache/spark/ml/source/libsvm/JavaLibSVMRelationSuite.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.spark.ml.source;
+package org.apache.spark.ml.source.libsvm;
import java.io.File;
import java.io.IOException;
@@ -42,34 +42,34 @@ import org.apache.spark.util.Utils;
*/
public class JavaLibSVMRelationSuite {
private transient JavaSparkContext jsc;
- private transient SQLContext jsql;
- private transient DataFrame dataset;
+ private transient SQLContext sqlContext;
- private File tmpDir;
- private File path;
+ private File tempDir;
+ private String path;
@Before
public void setUp() throws IOException {
jsc = new JavaSparkContext("local", "JavaLibSVMRelationSuite");
- jsql = new SQLContext(jsc);
-
- tmpDir = Utils.createTempDir(System.getProperty("java.io.tmpdir"), "datasource");
- path = new File(tmpDir.getPath(), "part-00000");
+ sqlContext = new SQLContext(jsc);
+ tempDir = Utils.createTempDir(System.getProperty("java.io.tmpdir"), "datasource");
+ File file = new File(tempDir, "part-00000");
String s = "1 1:1.0 3:2.0 5:3.0\n0\n0 2:4.0 4:5.0 6:6.0";
- Files.write(s, path, Charsets.US_ASCII);
+ Files.write(s, file, Charsets.US_ASCII);
+ path = tempDir.toURI().toString();
}
@After
public void tearDown() {
jsc.stop();
jsc = null;
- Utils.deleteRecursively(tmpDir);
+ Utils.deleteRecursively(tempDir);
}
@Test
public void verifyLibSVMDF() {
- dataset = jsql.read().format("libsvm").option("vectorType", "dense").load(path.getPath());
+ DataFrame dataset = sqlContext.read().format("libsvm").option("vectorType", "dense")
+ .load(path);
Assert.assertEquals("label", dataset.columns()[0]);
Assert.assertEquals("features", dataset.columns()[1]);
Row r = dataset.first();