viirya commented on code in PR #493:
URL: https://github.com/apache/spark-website/pull/493#discussion_r1426323076


##########
examples.md:
##########
@@ -186,13 +178,7 @@ errors.filter(col("line").like("%MySQL%")).collect()
 <div class="code code-tab">
 {% highlight java %}
 // Creates a DataFrame having a single column named "line"
-JavaRDD<String> textFile = sc.textFile("hdfs://...");
-JavaRDD<Row> rowRDD = textFile.map(RowFactory::create);
-List<StructField> fields = Arrays.asList(
-  DataTypes.createStructField("line", DataTypes.StringType, true));
-StructType schema = DataTypes.createStructType(fields);
-DataFrame df = sqlContext.createDataFrame(rowRDD, schema);
-
+DataFrame df = spark.read.text("hdfs://...").toDF("line");

Review Comment:
   ```suggestion
   DataFrame df = spark.read().text("hdfs://...").toDF("line");
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to