sqlContext.sql("select * from table limit 5").show() (not sure if limit 5 supported)
or use Dmitriy's solution. select() defines your projection when you've specified entire query On 25 December 2015 at 15:42, Василец Дмитрий <pronix.serv...@gmail.com> wrote: > hello > you can try to use df.limit(5).show() > just trick :) > > On Fri, Dec 25, 2015 at 2:34 PM, Eugene Morozov < > evgeny.a.moro...@gmail.com> wrote: > >> Hello, I'm basically stuck as I have no idea where to look; >> >> Following simple code, given that my Datasource is working gives me an >> exception. >> >> DataFrame df = sqlc.load(filename, "com.epam.parso.spark.ds.DefaultSource"); >> df.cache(); >> df.printSchema(); <-- prints the schema perfectly fine! >> >> df.show(); <-- Works perfectly fine (shows table with >> 20 lines)! >> df.registerTempTable("table"); >> df.select("select * from table limit 5").show(); <-- gives weird exception >> >> Exception is: >> >> AnalysisException: cannot resolve 'select * from table limit 5' given input >> columns VER, CREATED, SOC, SOCC, HLTC, HLGTC, STATUS >> >> I can do a collect on a dataframe, but cannot select any specific columns >> either "select * from table" or "select VER, CREATED from table". >> >> I use spark 1.5.2. >> The same code perfectly works through Zeppelin 0.5.5. >> >> Thanks. >> -- >> Be well! >> Jean Morozov >> > >