Github user concretevitamin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1774#discussion_r15790441
  
    --- Diff: docs/sql-programming-guide.md ---
    @@ -152,6 +152,41 @@ val teenagers = sqlContext.sql("SELECT name FROM 
people WHERE age >= 13 AND age
     teenagers.map(t => "Name: " + t(0)).collect().foreach(println)
     {% endhighlight %}
     
    +Another way to turns an RDD to table is to use `applySchema`. Here is an 
example.
    +{% highlight scala %}
    +// sc is an existing SparkContext.
    +val sqlContext = new org.apache.spark.sql.SQLContext(sc)
    +
    +// Create an RDD
    +val people = sc.textFile("examples/src/main/resources/people.txt")
    +
    +// Import Spark SQL data types and Row.
    +import org.apache.spark.sql._
    +
    +// Define the schema that will be applied to the RDD.
    +val schema =
    +  StructType(
    +    StructField("name", StringType, true) ::
    +    StructField("age", IntegerType, true) :: Nil)
    +
    +// Convert records of the RDD (people) to rows.
    --- End diff --
    
    "to Rows"?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to