I have one text file in my local drive and wanted to save it as a spark data frame. Used sdf_copy_to() but i got the below error .
<-df = fread('/home/cdsw/HIST 1.txt')
|--------------------------------------------------| |==================================================| |--------------------------------------------------| |==================================================|
sdf_copy_to(con,df,name="sdf")
|=================================================================| 100% 1399 MB
Engine exhausted available memory, consider a larger engine size.
Engine exited with status 137.
I was also trying using
spark_read_text(con,name="Month1_IntlData",path="/home/cdsw/SUMMARY_DETAIL_HIST 1.txt",overwrite = TRUE)
And I got this error.
Error: org.apache.spark.sql.AnalysisException: Path does not exist: hdfs://<<server_name>>/home/cdsw/SUMMARY_DETAIL_HIST
1.txt;
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$14.apply(DataSource.scala:360)
at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$14.apply(DataSource.scala:348)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
at scala.collection.immutable.List.flatMap(List.scala:344)
at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:348)
at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:178)
at org.apache.spark.sql.DataFrameReader.text(DataFrameReader.scala:623)
at org.apache.spark.sql.DataFrameReader.text(DataFrameReader.scala:603)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Can you tell me how can we copy the local text file to spark data frame or to a hive table .
Thanks and Regards
Sankar Narayana