spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "萝卜丝炒饭" <1427357...@qq.com>
Subject Re: RDD can not convert to df, thanks
Date Mon, 20 Mar 2017 01:36:59 GMT
it works well, thanks zhang yong.

---Original---
From: "Yong Zhang"<java8964@hotmail.com>
Date: 2017/3/17 19:06:54
To: "user"<user@spark.apache.org>;"user-return-68576-1427357147=qq.com"<user-return-68576-1427357147=qq.com@spark.apache.org>;"萝卜丝炒饭"<1427357147@qq.com>;
Subject: Re: RDD can not convert to df, thanks


  
You also need the import the sqlContext implicits
 

 
 
import sqlContext.implicits._
 
 
 Yong 
  
 From: 萝卜丝炒饭 <1427357147@qq.com>
 Sent: Friday, March 17, 2017 1:52 AM
 To: user-return-68576-1427357147=qq.com; user
 Subject: Re: RDD can not convert to df, thanks  
 
 More info,I have imported the implicitics of sparksession.
 
 ---Original---
  From: "user-return-68576-1427357147=qq.com"<user-return-68576-1427357147=qq.com@spark.apache.org>
 Date: 2017/3/17 11:48:43
 To: "user"<user@spark.apache.org>;
 Subject: RDD can not convert to df, thanks
 
 
 hi all,
 
 when i try to convert rdd to DF, I meet errors like belowing:
 
 value toDF is not a member of org.apache.spark.rdd.RDD[XXXXX]
 possible causer:may be a semicolon is missing before value toDF
 
 My code looks like:
 
 spark.textfile(xxxx).map(s=>_.split(".")).map(  s=>AAA(1,2)).toDF
 
 the code can pass the compile but when run, it meet errors.
 
 AAA is my defined case class.
 my spark is 2.11.
 
 Would any one can help me please?
 
 thanks advanced.
 
 robin
Mime
View raw message