You can't create a DataFrame from an arbitrary object since we don't know how to figure out the schema. You can either create a JavaBean <https://spark.apache.org/docs/latest/sql-programming-guide.html#programmatically-specifying-the-schema> or manually create a row + specify the schema <https://spark.apache.org/docs/latest/sql-programming-guide.html#programmatically-specifying-the-schema> .
On Mon, Aug 10, 2015 at 11:22 AM, unk1102 <umesh.ka...@gmail.com> wrote: > Hi I have my own Hadoop custom InputFormat which I want to use in > DataFrame. > How do we do that? I know I can use sc.hadoopFile(..) but then how do I > convert it into DataFrame > > JavaPairRDD<Void,MyRecordWritable> myFormatAsPairRdd = > > jsc.hadoopFile("hdfs://tmp/data/myformat.xyz",MyInputFormat.class,Void.class,MyRecordWritable.class); > JavaRDD<MyRecordWritable> myformatRdd = myFormatAsPairRdd.values(); > DataFrame myFormatAsDataframe = sqlContext.createDataFrame(myformatRdd,??); > > In above code what should I put in place of ?? I tried to put > MyRecordWritable.class but it does not work as it is not schema it is > Record > Writable. Please guide. > > > > -- > View this message in context: > http://apache-spark-user-list.1001560.n3.nabble.com/How-to-use-custom-Hadoop-InputFormat-in-DataFrame-tp24198.html > Sent from the Apache Spark User List mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@spark.apache.org > For additional commands, e-mail: user-h...@spark.apache.org > >