Reading excel files in a streaming fashion in spark 2.0.0 -


i have set of excel format files needs read spark(2.0.0) , when excel file loaded local directory.scala version used here 2.11.8.

i've tried using readstream method of sparksession,but i'm not able read in streaming way.i'm able read excel files statically as:

val df = spark.read.format("com.crealytics.spark.excel").option("sheetname", "data").option("useheader", "true").load("sample.xlsx") 

is there other way of reading excel files in streaming way local directory?

any answers helpful.

thanks


changes done:

val spark = sparksession.builder().master("local[*]").config("spark.sql.warehouse.dir","file:///d:/pooja").appname("spark sql example").getorcreate() spark.conf.set("spark.sql.streaming.schemainference", true) import spark.implicits._   val dataframe = spark.readstream.format("csv").option("inferschema",true).option("header", true).load("file:///d:/pooja/sample.csv") dataframe.writestream.format("console").start() dataframe.show() 

updated code:

val spark = sparksession.builder().master("local[*]").appname("spark sql example").getorcreate() spark.conf.set("spark.sql.streaming.schemainference", true) import spark.implicits._   val df = spark.readstream.format("com.crealytics.spark.excel").option("header", true).load("file:///filepath/*.xlsx") df.writestream.format("memory").queryname("tab").start().awaittermination() val res = spark.sql("select * tab") res.show() 

error:

exception in thread "main" java.lang.unsupportedoperationexception: data source com.crealytics.spark.excel not support streamed reading 

can me resolve issue.

for streaming data frame have provide schema , currently, datastreamreader not support option("inferschema", true|false). can set sqlconf setting "spark.sql.streaming.schemainference", needs set @ session level.

you can refer here


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -