<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: How to save a dataframe as ORC file ? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-save-a-dataframe-as-ORC-file/m-p/144706#M107285</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/687/christopherwmenke.html" nodeid="687"&gt;@Kit Menke&lt;/A&gt; isn't wrong.&lt;/P&gt;&lt;P&gt;Take a look at the API docs. You'll notice there are several options for creating data frames from an RDD. In your case; it looks as though you have an RDD of class type Row; so you'll need to also provide a schema to the createDataFrame() method.&lt;/P&gt;&lt;P&gt;Scala API docs: &lt;A href="https://spark.apache.org/docs/2.2.0/api/scala/index.html#org.apache.spark.sql.SQLContext"&gt; https://spark.apache.org/docs/2.2.0/api/scala/index.html#org.apache.spark.sql.SQLContext&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;import org.apache.spark.sql._
import org.apache.spark.sql.types._
val sqlContext = new org.apache.spark.sql.SQLContext(sc)

val schema =
  StructType(
    StructField("name", StringType, false) ::
    StructField("age", IntegerType, true) :: Nil)

val people =
  sc.textFile("examples/src/main/resources/people.txt").map(
    _.split(",")).map(p =&amp;gt; Row(p(0), p(1).trim.toInt))
val dataFrame = sqlContext.createDataFrame(people, schema)
dataFrame.printSchema
// root
// |-- name: string (nullable = false)
// |-- age: integer (nullable = true)

dataFrame.createOrReplaceTempView("people")
sqlContext.sql("select name from people").collect.foreach(println)&lt;/PRE&gt;</description>
    <pubDate>Tue, 19 Jun 2018 06:39:50 GMT</pubDate>
    <dc:creator>palwell</dc:creator>
    <dc:date>2018-06-19T06:39:50Z</dc:date>
  </channel>
</rss>

