diff options
author | Nick Pentreath <nick.pentreath@gmail.com> | 2016-03-11 10:20:39 +0200 |
---|---|---|
committer | Nick Pentreath <nick.pentreath@gmail.com> | 2016-03-11 10:20:39 +0200 |
commit | 8fff0f92a4aca90b62c6e272eabcbb0257ba38d5 (patch) | |
tree | adc1ddf11cb2fca6080bce8249b8220423edacd2 /examples/src/main/java | |
parent | 234f781ae19370ce1ab485e364a6fdab7ed2598c (diff) | |
download | spark-8fff0f92a4aca90b62c6e272eabcbb0257ba38d5.tar.gz spark-8fff0f92a4aca90b62c6e272eabcbb0257ba38d5.tar.bz2 spark-8fff0f92a4aca90b62c6e272eabcbb0257ba38d5.zip |
[HOT-FIX][SQL][ML] Fix compile error from use of DataFrame in Java MaxAbsScaler example
## What changes were proposed in this pull request?
Fix build failure introduced in #11392 (change `DataFrame` -> `Dataset<Row>`).
## How was this patch tested?
Existing build/unit tests
Author: Nick Pentreath <nick.pentreath@gmail.com>
Closes #11653 from MLnick/java-maxabs-example-fix.
Diffstat (limited to 'examples/src/main/java')
-rw-r--r-- | examples/src/main/java/org/apache/spark/examples/ml/JavaMaxAbsScalerExample.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/src/main/java/org/apache/spark/examples/ml/JavaMaxAbsScalerExample.java b/examples/src/main/java/org/apache/spark/examples/ml/JavaMaxAbsScalerExample.java index b1e3b9137f..a2a072b253 100644 --- a/examples/src/main/java/org/apache/spark/examples/ml/JavaMaxAbsScalerExample.java +++ b/examples/src/main/java/org/apache/spark/examples/ml/JavaMaxAbsScalerExample.java @@ -22,7 +22,8 @@ import org.apache.spark.api.java.JavaSparkContext; // $example on$ import org.apache.spark.ml.feature.MaxAbsScaler; import org.apache.spark.ml.feature.MaxAbsScalerModel; -import org.apache.spark.sql.DataFrame; +import org.apache.spark.sql.Dataset; +import org.apache.spark.sql.Row; // $example off$ import org.apache.spark.sql.SQLContext; @@ -34,7 +35,7 @@ public class JavaMaxAbsScalerExample { SQLContext jsql = new SQLContext(jsc); // $example on$ - DataFrame dataFrame = jsql.read().format("libsvm").load("data/mllib/sample_libsvm_data.txt"); + Dataset<Row> dataFrame = jsql.read().format("libsvm").load("data/mllib/sample_libsvm_data.txt"); MaxAbsScaler scaler = new MaxAbsScaler() .setInputCol("features") .setOutputCol("scaledFeatures"); @@ -43,7 +44,7 @@ public class JavaMaxAbsScalerExample { MaxAbsScalerModel scalerModel = scaler.fit(dataFrame); // rescale each feature to range [-1, 1]. - DataFrame scaledData = scalerModel.transform(dataFrame); + Dataset<Row> scaledData = scalerModel.transform(dataFrame); scaledData.show(); // $example off$ jsc.stop(); |